{-# 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 #-}
module Amazonka.MediaPackageVOD.Types.CmafPackage where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaPackageVOD.Types.CmafEncryption
import Amazonka.MediaPackageVOD.Types.HlsManifest
import qualified Amazonka.Prelude as Prelude
data CmafPackage = CmafPackage'
{
CmafPackage -> Maybe Bool
includeEncoderConfigurationInSegments :: Prelude.Maybe Prelude.Bool,
CmafPackage -> Maybe Int
segmentDurationSeconds :: Prelude.Maybe Prelude.Int,
CmafPackage -> Maybe CmafEncryption
encryption :: Prelude.Maybe CmafEncryption,
CmafPackage -> [HlsManifest]
hlsManifests :: [HlsManifest]
}
deriving (CmafPackage -> CmafPackage -> Bool
(CmafPackage -> CmafPackage -> Bool)
-> (CmafPackage -> CmafPackage -> Bool) -> Eq CmafPackage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CmafPackage -> CmafPackage -> Bool
$c/= :: CmafPackage -> CmafPackage -> Bool
== :: CmafPackage -> CmafPackage -> Bool
$c== :: CmafPackage -> CmafPackage -> Bool
Prelude.Eq, ReadPrec [CmafPackage]
ReadPrec CmafPackage
Int -> ReadS CmafPackage
ReadS [CmafPackage]
(Int -> ReadS CmafPackage)
-> ReadS [CmafPackage]
-> ReadPrec CmafPackage
-> ReadPrec [CmafPackage]
-> Read CmafPackage
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CmafPackage]
$creadListPrec :: ReadPrec [CmafPackage]
readPrec :: ReadPrec CmafPackage
$creadPrec :: ReadPrec CmafPackage
readList :: ReadS [CmafPackage]
$creadList :: ReadS [CmafPackage]
readsPrec :: Int -> ReadS CmafPackage
$creadsPrec :: Int -> ReadS CmafPackage
Prelude.Read, Int -> CmafPackage -> ShowS
[CmafPackage] -> ShowS
CmafPackage -> String
(Int -> CmafPackage -> ShowS)
-> (CmafPackage -> String)
-> ([CmafPackage] -> ShowS)
-> Show CmafPackage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CmafPackage] -> ShowS
$cshowList :: [CmafPackage] -> ShowS
show :: CmafPackage -> String
$cshow :: CmafPackage -> String
showsPrec :: Int -> CmafPackage -> ShowS
$cshowsPrec :: Int -> CmafPackage -> ShowS
Prelude.Show, (forall x. CmafPackage -> Rep CmafPackage x)
-> (forall x. Rep CmafPackage x -> CmafPackage)
-> Generic CmafPackage
forall x. Rep CmafPackage x -> CmafPackage
forall x. CmafPackage -> Rep CmafPackage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CmafPackage x -> CmafPackage
$cfrom :: forall x. CmafPackage -> Rep CmafPackage x
Prelude.Generic)
newCmafPackage ::
CmafPackage
newCmafPackage :: CmafPackage
newCmafPackage =
CmafPackage' :: Maybe Bool
-> Maybe Int
-> Maybe CmafEncryption
-> [HlsManifest]
-> CmafPackage
CmafPackage'
{ $sel:includeEncoderConfigurationInSegments:CmafPackage' :: Maybe Bool
includeEncoderConfigurationInSegments =
Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:segmentDurationSeconds:CmafPackage' :: Maybe Int
segmentDurationSeconds = Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:encryption:CmafPackage' :: Maybe CmafEncryption
encryption = Maybe CmafEncryption
forall a. Maybe a
Prelude.Nothing,
$sel:hlsManifests:CmafPackage' :: [HlsManifest]
hlsManifests = [HlsManifest]
forall a. Monoid a => a
Prelude.mempty
}
cmafPackage_includeEncoderConfigurationInSegments :: Lens.Lens' CmafPackage (Prelude.Maybe Prelude.Bool)
cmafPackage_includeEncoderConfigurationInSegments :: (Maybe Bool -> f (Maybe Bool)) -> CmafPackage -> f CmafPackage
cmafPackage_includeEncoderConfigurationInSegments = (CmafPackage -> Maybe Bool)
-> (CmafPackage -> Maybe Bool -> CmafPackage)
-> Lens CmafPackage CmafPackage (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CmafPackage' {Maybe Bool
includeEncoderConfigurationInSegments :: Maybe Bool
$sel:includeEncoderConfigurationInSegments:CmafPackage' :: CmafPackage -> Maybe Bool
includeEncoderConfigurationInSegments} -> Maybe Bool
includeEncoderConfigurationInSegments) (\s :: CmafPackage
s@CmafPackage' {} Maybe Bool
a -> CmafPackage
s {$sel:includeEncoderConfigurationInSegments:CmafPackage' :: Maybe Bool
includeEncoderConfigurationInSegments = Maybe Bool
a} :: CmafPackage)
cmafPackage_segmentDurationSeconds :: Lens.Lens' CmafPackage (Prelude.Maybe Prelude.Int)
cmafPackage_segmentDurationSeconds :: (Maybe Int -> f (Maybe Int)) -> CmafPackage -> f CmafPackage
cmafPackage_segmentDurationSeconds = (CmafPackage -> Maybe Int)
-> (CmafPackage -> Maybe Int -> CmafPackage)
-> Lens CmafPackage CmafPackage (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CmafPackage' {Maybe Int
segmentDurationSeconds :: Maybe Int
$sel:segmentDurationSeconds:CmafPackage' :: CmafPackage -> Maybe Int
segmentDurationSeconds} -> Maybe Int
segmentDurationSeconds) (\s :: CmafPackage
s@CmafPackage' {} Maybe Int
a -> CmafPackage
s {$sel:segmentDurationSeconds:CmafPackage' :: Maybe Int
segmentDurationSeconds = Maybe Int
a} :: CmafPackage)
cmafPackage_encryption :: Lens.Lens' CmafPackage (Prelude.Maybe CmafEncryption)
cmafPackage_encryption :: (Maybe CmafEncryption -> f (Maybe CmafEncryption))
-> CmafPackage -> f CmafPackage
cmafPackage_encryption = (CmafPackage -> Maybe CmafEncryption)
-> (CmafPackage -> Maybe CmafEncryption -> CmafPackage)
-> Lens
CmafPackage
CmafPackage
(Maybe CmafEncryption)
(Maybe CmafEncryption)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CmafPackage' {Maybe CmafEncryption
encryption :: Maybe CmafEncryption
$sel:encryption:CmafPackage' :: CmafPackage -> Maybe CmafEncryption
encryption} -> Maybe CmafEncryption
encryption) (\s :: CmafPackage
s@CmafPackage' {} Maybe CmafEncryption
a -> CmafPackage
s {$sel:encryption:CmafPackage' :: Maybe CmafEncryption
encryption = Maybe CmafEncryption
a} :: CmafPackage)
cmafPackage_hlsManifests :: Lens.Lens' CmafPackage [HlsManifest]
cmafPackage_hlsManifests :: ([HlsManifest] -> f [HlsManifest]) -> CmafPackage -> f CmafPackage
cmafPackage_hlsManifests = (CmafPackage -> [HlsManifest])
-> (CmafPackage -> [HlsManifest] -> CmafPackage)
-> Lens CmafPackage CmafPackage [HlsManifest] [HlsManifest]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CmafPackage' {[HlsManifest]
hlsManifests :: [HlsManifest]
$sel:hlsManifests:CmafPackage' :: CmafPackage -> [HlsManifest]
hlsManifests} -> [HlsManifest]
hlsManifests) (\s :: CmafPackage
s@CmafPackage' {} [HlsManifest]
a -> CmafPackage
s {$sel:hlsManifests:CmafPackage' :: [HlsManifest]
hlsManifests = [HlsManifest]
a} :: CmafPackage) (([HlsManifest] -> f [HlsManifest])
-> CmafPackage -> f CmafPackage)
-> (([HlsManifest] -> f [HlsManifest])
-> [HlsManifest] -> f [HlsManifest])
-> ([HlsManifest] -> f [HlsManifest])
-> CmafPackage
-> f CmafPackage
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([HlsManifest] -> f [HlsManifest])
-> [HlsManifest] -> f [HlsManifest]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON CmafPackage where
parseJSON :: Value -> Parser CmafPackage
parseJSON =
String
-> (Object -> Parser CmafPackage) -> Value -> Parser CmafPackage
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"CmafPackage"
( \Object
x ->
Maybe Bool
-> Maybe Int
-> Maybe CmafEncryption
-> [HlsManifest]
-> CmafPackage
CmafPackage'
(Maybe Bool
-> Maybe Int
-> Maybe CmafEncryption
-> [HlsManifest]
-> CmafPackage)
-> Parser (Maybe Bool)
-> Parser
(Maybe Int -> Maybe CmafEncryption -> [HlsManifest] -> CmafPackage)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"includeEncoderConfigurationInSegments")
Parser
(Maybe Int -> Maybe CmafEncryption -> [HlsManifest] -> CmafPackage)
-> Parser (Maybe Int)
-> Parser (Maybe CmafEncryption -> [HlsManifest] -> CmafPackage)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"segmentDurationSeconds")
Parser (Maybe CmafEncryption -> [HlsManifest] -> CmafPackage)
-> Parser (Maybe CmafEncryption)
-> Parser ([HlsManifest] -> CmafPackage)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe CmafEncryption)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"encryption")
Parser ([HlsManifest] -> CmafPackage)
-> Parser [HlsManifest] -> Parser CmafPackage
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe [HlsManifest])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"hlsManifests" Parser (Maybe [HlsManifest])
-> [HlsManifest] -> Parser [HlsManifest]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [HlsManifest]
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable CmafPackage
instance Prelude.NFData CmafPackage
instance Core.ToJSON CmafPackage where
toJSON :: CmafPackage -> Value
toJSON CmafPackage' {[HlsManifest]
Maybe Bool
Maybe Int
Maybe CmafEncryption
hlsManifests :: [HlsManifest]
encryption :: Maybe CmafEncryption
segmentDurationSeconds :: Maybe Int
includeEncoderConfigurationInSegments :: Maybe Bool
$sel:hlsManifests:CmafPackage' :: CmafPackage -> [HlsManifest]
$sel:encryption:CmafPackage' :: CmafPackage -> Maybe CmafEncryption
$sel:segmentDurationSeconds:CmafPackage' :: CmafPackage -> Maybe Int
$sel:includeEncoderConfigurationInSegments:CmafPackage' :: CmafPackage -> Maybe Bool
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"includeEncoderConfigurationInSegments" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
includeEncoderConfigurationInSegments,
(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
"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,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"hlsManifests" Text -> [HlsManifest] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [HlsManifest]
hlsManifests)
]
)