{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.MediaPackage.Types.CmafPackageCreateOrUpdateParameters
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.MediaPackage.Types.CmafPackageCreateOrUpdateParameters where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaPackage.Types.CmafEncryption
import Amazonka.MediaPackage.Types.HlsManifestCreateOrUpdateParameters
import Amazonka.MediaPackage.Types.StreamSelection
import qualified Amazonka.Prelude as Prelude

-- | A Common Media Application Format (CMAF) packaging configuration.
--
-- /See:/ 'newCmafPackageCreateOrUpdateParameters' smart constructor.
data CmafPackageCreateOrUpdateParameters = CmafPackageCreateOrUpdateParameters'
  { -- | A list of HLS manifest configurations
    CmafPackageCreateOrUpdateParameters
-> Maybe [HlsManifestCreateOrUpdateParameters]
hlsManifests :: Prelude.Maybe [HlsManifestCreateOrUpdateParameters],
    -- | Duration (in seconds) of each segment. Actual segments will be rounded
    -- to the nearest multiple of the source segment duration.
    CmafPackageCreateOrUpdateParameters -> Maybe Int
segmentDurationSeconds :: Prelude.Maybe Prelude.Int,
    CmafPackageCreateOrUpdateParameters -> Maybe StreamSelection
streamSelection :: Prelude.Maybe StreamSelection,
    CmafPackageCreateOrUpdateParameters -> Maybe CmafEncryption
encryption :: Prelude.Maybe CmafEncryption,
    -- | An optional custom string that is prepended to the name of each segment.
    -- If not specified, it defaults to the ChannelId.
    CmafPackageCreateOrUpdateParameters -> Maybe Text
segmentPrefix :: Prelude.Maybe Prelude.Text
  }
  deriving (CmafPackageCreateOrUpdateParameters
-> CmafPackageCreateOrUpdateParameters -> Bool
(CmafPackageCreateOrUpdateParameters
 -> CmafPackageCreateOrUpdateParameters -> Bool)
-> (CmafPackageCreateOrUpdateParameters
    -> CmafPackageCreateOrUpdateParameters -> Bool)
-> Eq CmafPackageCreateOrUpdateParameters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CmafPackageCreateOrUpdateParameters
-> CmafPackageCreateOrUpdateParameters -> Bool
$c/= :: CmafPackageCreateOrUpdateParameters
-> CmafPackageCreateOrUpdateParameters -> Bool
== :: CmafPackageCreateOrUpdateParameters
-> CmafPackageCreateOrUpdateParameters -> Bool
$c== :: CmafPackageCreateOrUpdateParameters
-> CmafPackageCreateOrUpdateParameters -> Bool
Prelude.Eq, ReadPrec [CmafPackageCreateOrUpdateParameters]
ReadPrec CmafPackageCreateOrUpdateParameters
Int -> ReadS CmafPackageCreateOrUpdateParameters
ReadS [CmafPackageCreateOrUpdateParameters]
(Int -> ReadS CmafPackageCreateOrUpdateParameters)
-> ReadS [CmafPackageCreateOrUpdateParameters]
-> ReadPrec CmafPackageCreateOrUpdateParameters
-> ReadPrec [CmafPackageCreateOrUpdateParameters]
-> Read CmafPackageCreateOrUpdateParameters
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CmafPackageCreateOrUpdateParameters]
$creadListPrec :: ReadPrec [CmafPackageCreateOrUpdateParameters]
readPrec :: ReadPrec CmafPackageCreateOrUpdateParameters
$creadPrec :: ReadPrec CmafPackageCreateOrUpdateParameters
readList :: ReadS [CmafPackageCreateOrUpdateParameters]
$creadList :: ReadS [CmafPackageCreateOrUpdateParameters]
readsPrec :: Int -> ReadS CmafPackageCreateOrUpdateParameters
$creadsPrec :: Int -> ReadS CmafPackageCreateOrUpdateParameters
Prelude.Read, Int -> CmafPackageCreateOrUpdateParameters -> ShowS
[CmafPackageCreateOrUpdateParameters] -> ShowS
CmafPackageCreateOrUpdateParameters -> String
(Int -> CmafPackageCreateOrUpdateParameters -> ShowS)
-> (CmafPackageCreateOrUpdateParameters -> String)
-> ([CmafPackageCreateOrUpdateParameters] -> ShowS)
-> Show CmafPackageCreateOrUpdateParameters
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CmafPackageCreateOrUpdateParameters] -> ShowS
$cshowList :: [CmafPackageCreateOrUpdateParameters] -> ShowS
show :: CmafPackageCreateOrUpdateParameters -> String
$cshow :: CmafPackageCreateOrUpdateParameters -> String
showsPrec :: Int -> CmafPackageCreateOrUpdateParameters -> ShowS
$cshowsPrec :: Int -> CmafPackageCreateOrUpdateParameters -> ShowS
Prelude.Show, (forall x.
 CmafPackageCreateOrUpdateParameters
 -> Rep CmafPackageCreateOrUpdateParameters x)
-> (forall x.
    Rep CmafPackageCreateOrUpdateParameters x
    -> CmafPackageCreateOrUpdateParameters)
-> Generic CmafPackageCreateOrUpdateParameters
forall x.
Rep CmafPackageCreateOrUpdateParameters x
-> CmafPackageCreateOrUpdateParameters
forall x.
CmafPackageCreateOrUpdateParameters
-> Rep CmafPackageCreateOrUpdateParameters x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CmafPackageCreateOrUpdateParameters x
-> CmafPackageCreateOrUpdateParameters
$cfrom :: forall x.
CmafPackageCreateOrUpdateParameters
-> Rep CmafPackageCreateOrUpdateParameters x
Prelude.Generic)

-- |
-- Create a value of 'CmafPackageCreateOrUpdateParameters' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'hlsManifests', 'cmafPackageCreateOrUpdateParameters_hlsManifests' - A list of HLS manifest configurations
--
-- 'segmentDurationSeconds', 'cmafPackageCreateOrUpdateParameters_segmentDurationSeconds' - Duration (in seconds) of each segment. Actual segments will be rounded
-- to the nearest multiple of the source segment duration.
--
-- 'streamSelection', 'cmafPackageCreateOrUpdateParameters_streamSelection' - Undocumented member.
--
-- 'encryption', 'cmafPackageCreateOrUpdateParameters_encryption' - Undocumented member.
--
-- 'segmentPrefix', 'cmafPackageCreateOrUpdateParameters_segmentPrefix' - An optional custom string that is prepended to the name of each segment.
-- If not specified, it defaults to the ChannelId.
newCmafPackageCreateOrUpdateParameters ::
  CmafPackageCreateOrUpdateParameters
newCmafPackageCreateOrUpdateParameters :: CmafPackageCreateOrUpdateParameters
newCmafPackageCreateOrUpdateParameters =
  CmafPackageCreateOrUpdateParameters' :: Maybe [HlsManifestCreateOrUpdateParameters]
-> Maybe Int
-> Maybe StreamSelection
-> Maybe CmafEncryption
-> Maybe Text
-> CmafPackageCreateOrUpdateParameters
CmafPackageCreateOrUpdateParameters'
    { $sel:hlsManifests:CmafPackageCreateOrUpdateParameters' :: Maybe [HlsManifestCreateOrUpdateParameters]
hlsManifests =
        Maybe [HlsManifestCreateOrUpdateParameters]
forall a. Maybe a
Prelude.Nothing,
      $sel:segmentDurationSeconds:CmafPackageCreateOrUpdateParameters' :: Maybe Int
segmentDurationSeconds =
        Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:streamSelection:CmafPackageCreateOrUpdateParameters' :: Maybe StreamSelection
streamSelection = Maybe StreamSelection
forall a. Maybe a
Prelude.Nothing,
      $sel:encryption:CmafPackageCreateOrUpdateParameters' :: Maybe CmafEncryption
encryption = Maybe CmafEncryption
forall a. Maybe a
Prelude.Nothing,
      $sel:segmentPrefix:CmafPackageCreateOrUpdateParameters' :: Maybe Text
segmentPrefix = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | A list of HLS manifest configurations
cmafPackageCreateOrUpdateParameters_hlsManifests :: Lens.Lens' CmafPackageCreateOrUpdateParameters (Prelude.Maybe [HlsManifestCreateOrUpdateParameters])
cmafPackageCreateOrUpdateParameters_hlsManifests :: (Maybe [HlsManifestCreateOrUpdateParameters]
 -> f (Maybe [HlsManifestCreateOrUpdateParameters]))
-> CmafPackageCreateOrUpdateParameters
-> f CmafPackageCreateOrUpdateParameters
cmafPackageCreateOrUpdateParameters_hlsManifests = (CmafPackageCreateOrUpdateParameters
 -> Maybe [HlsManifestCreateOrUpdateParameters])
-> (CmafPackageCreateOrUpdateParameters
    -> Maybe [HlsManifestCreateOrUpdateParameters]
    -> CmafPackageCreateOrUpdateParameters)
-> Lens
     CmafPackageCreateOrUpdateParameters
     CmafPackageCreateOrUpdateParameters
     (Maybe [HlsManifestCreateOrUpdateParameters])
     (Maybe [HlsManifestCreateOrUpdateParameters])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CmafPackageCreateOrUpdateParameters' {Maybe [HlsManifestCreateOrUpdateParameters]
hlsManifests :: Maybe [HlsManifestCreateOrUpdateParameters]
$sel:hlsManifests:CmafPackageCreateOrUpdateParameters' :: CmafPackageCreateOrUpdateParameters
-> Maybe [HlsManifestCreateOrUpdateParameters]
hlsManifests} -> Maybe [HlsManifestCreateOrUpdateParameters]
hlsManifests) (\s :: CmafPackageCreateOrUpdateParameters
s@CmafPackageCreateOrUpdateParameters' {} Maybe [HlsManifestCreateOrUpdateParameters]
a -> CmafPackageCreateOrUpdateParameters
s {$sel:hlsManifests:CmafPackageCreateOrUpdateParameters' :: Maybe [HlsManifestCreateOrUpdateParameters]
hlsManifests = Maybe [HlsManifestCreateOrUpdateParameters]
a} :: CmafPackageCreateOrUpdateParameters) ((Maybe [HlsManifestCreateOrUpdateParameters]
  -> f (Maybe [HlsManifestCreateOrUpdateParameters]))
 -> CmafPackageCreateOrUpdateParameters
 -> f CmafPackageCreateOrUpdateParameters)
-> ((Maybe [HlsManifestCreateOrUpdateParameters]
     -> f (Maybe [HlsManifestCreateOrUpdateParameters]))
    -> Maybe [HlsManifestCreateOrUpdateParameters]
    -> f (Maybe [HlsManifestCreateOrUpdateParameters]))
-> (Maybe [HlsManifestCreateOrUpdateParameters]
    -> f (Maybe [HlsManifestCreateOrUpdateParameters]))
-> CmafPackageCreateOrUpdateParameters
-> f CmafPackageCreateOrUpdateParameters
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [HlsManifestCreateOrUpdateParameters]
  [HlsManifestCreateOrUpdateParameters]
  [HlsManifestCreateOrUpdateParameters]
  [HlsManifestCreateOrUpdateParameters]
-> Iso
     (Maybe [HlsManifestCreateOrUpdateParameters])
     (Maybe [HlsManifestCreateOrUpdateParameters])
     (Maybe [HlsManifestCreateOrUpdateParameters])
     (Maybe [HlsManifestCreateOrUpdateParameters])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [HlsManifestCreateOrUpdateParameters]
  [HlsManifestCreateOrUpdateParameters]
  [HlsManifestCreateOrUpdateParameters]
  [HlsManifestCreateOrUpdateParameters]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Duration (in seconds) of each segment. Actual segments will be rounded
-- to the nearest multiple of the source segment duration.
cmafPackageCreateOrUpdateParameters_segmentDurationSeconds :: Lens.Lens' CmafPackageCreateOrUpdateParameters (Prelude.Maybe Prelude.Int)
cmafPackageCreateOrUpdateParameters_segmentDurationSeconds :: (Maybe Int -> f (Maybe Int))
-> CmafPackageCreateOrUpdateParameters
-> f CmafPackageCreateOrUpdateParameters
cmafPackageCreateOrUpdateParameters_segmentDurationSeconds = (CmafPackageCreateOrUpdateParameters -> Maybe Int)
-> (CmafPackageCreateOrUpdateParameters
    -> Maybe Int -> CmafPackageCreateOrUpdateParameters)
-> Lens
     CmafPackageCreateOrUpdateParameters
     CmafPackageCreateOrUpdateParameters
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CmafPackageCreateOrUpdateParameters' {Maybe Int
segmentDurationSeconds :: Maybe Int
$sel:segmentDurationSeconds:CmafPackageCreateOrUpdateParameters' :: CmafPackageCreateOrUpdateParameters -> Maybe Int
segmentDurationSeconds} -> Maybe Int
segmentDurationSeconds) (\s :: CmafPackageCreateOrUpdateParameters
s@CmafPackageCreateOrUpdateParameters' {} Maybe Int
a -> CmafPackageCreateOrUpdateParameters
s {$sel:segmentDurationSeconds:CmafPackageCreateOrUpdateParameters' :: Maybe Int
segmentDurationSeconds = Maybe Int
a} :: CmafPackageCreateOrUpdateParameters)

-- | Undocumented member.
cmafPackageCreateOrUpdateParameters_streamSelection :: Lens.Lens' CmafPackageCreateOrUpdateParameters (Prelude.Maybe StreamSelection)
cmafPackageCreateOrUpdateParameters_streamSelection :: (Maybe StreamSelection -> f (Maybe StreamSelection))
-> CmafPackageCreateOrUpdateParameters
-> f CmafPackageCreateOrUpdateParameters
cmafPackageCreateOrUpdateParameters_streamSelection = (CmafPackageCreateOrUpdateParameters -> Maybe StreamSelection)
-> (CmafPackageCreateOrUpdateParameters
    -> Maybe StreamSelection -> CmafPackageCreateOrUpdateParameters)
-> Lens
     CmafPackageCreateOrUpdateParameters
     CmafPackageCreateOrUpdateParameters
     (Maybe StreamSelection)
     (Maybe StreamSelection)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CmafPackageCreateOrUpdateParameters' {Maybe StreamSelection
streamSelection :: Maybe StreamSelection
$sel:streamSelection:CmafPackageCreateOrUpdateParameters' :: CmafPackageCreateOrUpdateParameters -> Maybe StreamSelection
streamSelection} -> Maybe StreamSelection
streamSelection) (\s :: CmafPackageCreateOrUpdateParameters
s@CmafPackageCreateOrUpdateParameters' {} Maybe StreamSelection
a -> CmafPackageCreateOrUpdateParameters
s {$sel:streamSelection:CmafPackageCreateOrUpdateParameters' :: Maybe StreamSelection
streamSelection = Maybe StreamSelection
a} :: CmafPackageCreateOrUpdateParameters)

-- | Undocumented member.
cmafPackageCreateOrUpdateParameters_encryption :: Lens.Lens' CmafPackageCreateOrUpdateParameters (Prelude.Maybe CmafEncryption)
cmafPackageCreateOrUpdateParameters_encryption :: (Maybe CmafEncryption -> f (Maybe CmafEncryption))
-> CmafPackageCreateOrUpdateParameters
-> f CmafPackageCreateOrUpdateParameters
cmafPackageCreateOrUpdateParameters_encryption = (CmafPackageCreateOrUpdateParameters -> Maybe CmafEncryption)
-> (CmafPackageCreateOrUpdateParameters
    -> Maybe CmafEncryption -> CmafPackageCreateOrUpdateParameters)
-> Lens
     CmafPackageCreateOrUpdateParameters
     CmafPackageCreateOrUpdateParameters
     (Maybe CmafEncryption)
     (Maybe CmafEncryption)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CmafPackageCreateOrUpdateParameters' {Maybe CmafEncryption
encryption :: Maybe CmafEncryption
$sel:encryption:CmafPackageCreateOrUpdateParameters' :: CmafPackageCreateOrUpdateParameters -> Maybe CmafEncryption
encryption} -> Maybe CmafEncryption
encryption) (\s :: CmafPackageCreateOrUpdateParameters
s@CmafPackageCreateOrUpdateParameters' {} Maybe CmafEncryption
a -> CmafPackageCreateOrUpdateParameters
s {$sel:encryption:CmafPackageCreateOrUpdateParameters' :: Maybe CmafEncryption
encryption = Maybe CmafEncryption
a} :: CmafPackageCreateOrUpdateParameters)

-- | An optional custom string that is prepended to the name of each segment.
-- If not specified, it defaults to the ChannelId.
cmafPackageCreateOrUpdateParameters_segmentPrefix :: Lens.Lens' CmafPackageCreateOrUpdateParameters (Prelude.Maybe Prelude.Text)
cmafPackageCreateOrUpdateParameters_segmentPrefix :: (Maybe Text -> f (Maybe Text))
-> CmafPackageCreateOrUpdateParameters
-> f CmafPackageCreateOrUpdateParameters
cmafPackageCreateOrUpdateParameters_segmentPrefix = (CmafPackageCreateOrUpdateParameters -> Maybe Text)
-> (CmafPackageCreateOrUpdateParameters
    -> Maybe Text -> CmafPackageCreateOrUpdateParameters)
-> Lens
     CmafPackageCreateOrUpdateParameters
     CmafPackageCreateOrUpdateParameters
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CmafPackageCreateOrUpdateParameters' {Maybe Text
segmentPrefix :: Maybe Text
$sel:segmentPrefix:CmafPackageCreateOrUpdateParameters' :: CmafPackageCreateOrUpdateParameters -> Maybe Text
segmentPrefix} -> Maybe Text
segmentPrefix) (\s :: CmafPackageCreateOrUpdateParameters
s@CmafPackageCreateOrUpdateParameters' {} Maybe Text
a -> CmafPackageCreateOrUpdateParameters
s {$sel:segmentPrefix:CmafPackageCreateOrUpdateParameters' :: Maybe Text
segmentPrefix = Maybe Text
a} :: CmafPackageCreateOrUpdateParameters)

instance
  Prelude.Hashable
    CmafPackageCreateOrUpdateParameters

instance
  Prelude.NFData
    CmafPackageCreateOrUpdateParameters

instance
  Core.ToJSON
    CmafPackageCreateOrUpdateParameters
  where
  toJSON :: CmafPackageCreateOrUpdateParameters -> Value
toJSON CmafPackageCreateOrUpdateParameters' {Maybe Int
Maybe [HlsManifestCreateOrUpdateParameters]
Maybe Text
Maybe CmafEncryption
Maybe StreamSelection
segmentPrefix :: Maybe Text
encryption :: Maybe CmafEncryption
streamSelection :: Maybe StreamSelection
segmentDurationSeconds :: Maybe Int
hlsManifests :: Maybe [HlsManifestCreateOrUpdateParameters]
$sel:segmentPrefix:CmafPackageCreateOrUpdateParameters' :: CmafPackageCreateOrUpdateParameters -> Maybe Text
$sel:encryption:CmafPackageCreateOrUpdateParameters' :: CmafPackageCreateOrUpdateParameters -> Maybe CmafEncryption
$sel:streamSelection:CmafPackageCreateOrUpdateParameters' :: CmafPackageCreateOrUpdateParameters -> Maybe StreamSelection
$sel:segmentDurationSeconds:CmafPackageCreateOrUpdateParameters' :: CmafPackageCreateOrUpdateParameters -> Maybe Int
$sel:hlsManifests:CmafPackageCreateOrUpdateParameters' :: CmafPackageCreateOrUpdateParameters
-> Maybe [HlsManifestCreateOrUpdateParameters]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"hlsManifests" Text -> [HlsManifestCreateOrUpdateParameters] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([HlsManifestCreateOrUpdateParameters] -> Pair)
-> Maybe [HlsManifestCreateOrUpdateParameters] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [HlsManifestCreateOrUpdateParameters]
hlsManifests,
            (Text
"segmentDurationSeconds" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
segmentDurationSeconds,
            (Text
"streamSelection" Text -> StreamSelection -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (StreamSelection -> Pair) -> Maybe StreamSelection -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe StreamSelection
streamSelection,
            (Text
"encryption" Text -> CmafEncryption -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (CmafEncryption -> Pair) -> Maybe CmafEncryption -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CmafEncryption
encryption,
            (Text
"segmentPrefix" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
segmentPrefix
          ]
      )