{-# 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.MediaPackage.Types.CmafEncryption where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaPackage.Types.SpekeKeyProvider
import qualified Amazonka.Prelude as Prelude
data CmafEncryption = CmafEncryption'
{
CmafEncryption -> Maybe Int
keyRotationIntervalSeconds :: Prelude.Maybe Prelude.Int,
CmafEncryption -> Maybe Text
constantInitializationVector :: Prelude.Maybe Prelude.Text,
CmafEncryption -> SpekeKeyProvider
spekeKeyProvider :: SpekeKeyProvider
}
deriving (CmafEncryption -> CmafEncryption -> Bool
(CmafEncryption -> CmafEncryption -> Bool)
-> (CmafEncryption -> CmafEncryption -> Bool) -> Eq CmafEncryption
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CmafEncryption -> CmafEncryption -> Bool
$c/= :: CmafEncryption -> CmafEncryption -> Bool
== :: CmafEncryption -> CmafEncryption -> Bool
$c== :: CmafEncryption -> CmafEncryption -> Bool
Prelude.Eq, ReadPrec [CmafEncryption]
ReadPrec CmafEncryption
Int -> ReadS CmafEncryption
ReadS [CmafEncryption]
(Int -> ReadS CmafEncryption)
-> ReadS [CmafEncryption]
-> ReadPrec CmafEncryption
-> ReadPrec [CmafEncryption]
-> Read CmafEncryption
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CmafEncryption]
$creadListPrec :: ReadPrec [CmafEncryption]
readPrec :: ReadPrec CmafEncryption
$creadPrec :: ReadPrec CmafEncryption
readList :: ReadS [CmafEncryption]
$creadList :: ReadS [CmafEncryption]
readsPrec :: Int -> ReadS CmafEncryption
$creadsPrec :: Int -> ReadS CmafEncryption
Prelude.Read, Int -> CmafEncryption -> ShowS
[CmafEncryption] -> ShowS
CmafEncryption -> String
(Int -> CmafEncryption -> ShowS)
-> (CmafEncryption -> String)
-> ([CmafEncryption] -> ShowS)
-> Show CmafEncryption
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CmafEncryption] -> ShowS
$cshowList :: [CmafEncryption] -> ShowS
show :: CmafEncryption -> String
$cshow :: CmafEncryption -> String
showsPrec :: Int -> CmafEncryption -> ShowS
$cshowsPrec :: Int -> CmafEncryption -> ShowS
Prelude.Show, (forall x. CmafEncryption -> Rep CmafEncryption x)
-> (forall x. Rep CmafEncryption x -> CmafEncryption)
-> Generic CmafEncryption
forall x. Rep CmafEncryption x -> CmafEncryption
forall x. CmafEncryption -> Rep CmafEncryption x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CmafEncryption x -> CmafEncryption
$cfrom :: forall x. CmafEncryption -> Rep CmafEncryption x
Prelude.Generic)
newCmafEncryption ::
SpekeKeyProvider ->
CmafEncryption
newCmafEncryption :: SpekeKeyProvider -> CmafEncryption
newCmafEncryption SpekeKeyProvider
pSpekeKeyProvider_ =
CmafEncryption' :: Maybe Int -> Maybe Text -> SpekeKeyProvider -> CmafEncryption
CmafEncryption'
{ $sel:keyRotationIntervalSeconds:CmafEncryption' :: Maybe Int
keyRotationIntervalSeconds =
Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:constantInitializationVector:CmafEncryption' :: Maybe Text
constantInitializationVector = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:spekeKeyProvider:CmafEncryption' :: SpekeKeyProvider
spekeKeyProvider = SpekeKeyProvider
pSpekeKeyProvider_
}
cmafEncryption_keyRotationIntervalSeconds :: Lens.Lens' CmafEncryption (Prelude.Maybe Prelude.Int)
cmafEncryption_keyRotationIntervalSeconds :: (Maybe Int -> f (Maybe Int)) -> CmafEncryption -> f CmafEncryption
cmafEncryption_keyRotationIntervalSeconds = (CmafEncryption -> Maybe Int)
-> (CmafEncryption -> Maybe Int -> CmafEncryption)
-> Lens CmafEncryption CmafEncryption (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CmafEncryption' {Maybe Int
keyRotationIntervalSeconds :: Maybe Int
$sel:keyRotationIntervalSeconds:CmafEncryption' :: CmafEncryption -> Maybe Int
keyRotationIntervalSeconds} -> Maybe Int
keyRotationIntervalSeconds) (\s :: CmafEncryption
s@CmafEncryption' {} Maybe Int
a -> CmafEncryption
s {$sel:keyRotationIntervalSeconds:CmafEncryption' :: Maybe Int
keyRotationIntervalSeconds = Maybe Int
a} :: CmafEncryption)
cmafEncryption_constantInitializationVector :: Lens.Lens' CmafEncryption (Prelude.Maybe Prelude.Text)
cmafEncryption_constantInitializationVector :: (Maybe Text -> f (Maybe Text))
-> CmafEncryption -> f CmafEncryption
cmafEncryption_constantInitializationVector = (CmafEncryption -> Maybe Text)
-> (CmafEncryption -> Maybe Text -> CmafEncryption)
-> Lens CmafEncryption CmafEncryption (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CmafEncryption' {Maybe Text
constantInitializationVector :: Maybe Text
$sel:constantInitializationVector:CmafEncryption' :: CmafEncryption -> Maybe Text
constantInitializationVector} -> Maybe Text
constantInitializationVector) (\s :: CmafEncryption
s@CmafEncryption' {} Maybe Text
a -> CmafEncryption
s {$sel:constantInitializationVector:CmafEncryption' :: Maybe Text
constantInitializationVector = Maybe Text
a} :: CmafEncryption)
cmafEncryption_spekeKeyProvider :: Lens.Lens' CmafEncryption SpekeKeyProvider
cmafEncryption_spekeKeyProvider :: (SpekeKeyProvider -> f SpekeKeyProvider)
-> CmafEncryption -> f CmafEncryption
cmafEncryption_spekeKeyProvider = (CmafEncryption -> SpekeKeyProvider)
-> (CmafEncryption -> SpekeKeyProvider -> CmafEncryption)
-> Lens
CmafEncryption CmafEncryption SpekeKeyProvider SpekeKeyProvider
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CmafEncryption' {SpekeKeyProvider
spekeKeyProvider :: SpekeKeyProvider
$sel:spekeKeyProvider:CmafEncryption' :: CmafEncryption -> SpekeKeyProvider
spekeKeyProvider} -> SpekeKeyProvider
spekeKeyProvider) (\s :: CmafEncryption
s@CmafEncryption' {} SpekeKeyProvider
a -> CmafEncryption
s {$sel:spekeKeyProvider:CmafEncryption' :: SpekeKeyProvider
spekeKeyProvider = SpekeKeyProvider
a} :: CmafEncryption)
instance Core.FromJSON CmafEncryption where
parseJSON :: Value -> Parser CmafEncryption
parseJSON =
String
-> (Object -> Parser CmafEncryption)
-> Value
-> Parser CmafEncryption
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"CmafEncryption"
( \Object
x ->
Maybe Int -> Maybe Text -> SpekeKeyProvider -> CmafEncryption
CmafEncryption'
(Maybe Int -> Maybe Text -> SpekeKeyProvider -> CmafEncryption)
-> Parser (Maybe Int)
-> Parser (Maybe Text -> SpekeKeyProvider -> CmafEncryption)
forall (f :: * -> *) a b. Functor 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
"keyRotationIntervalSeconds")
Parser (Maybe Text -> SpekeKeyProvider -> CmafEncryption)
-> Parser (Maybe Text)
-> Parser (SpekeKeyProvider -> CmafEncryption)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"constantInitializationVector")
Parser (SpekeKeyProvider -> CmafEncryption)
-> Parser SpekeKeyProvider -> Parser CmafEncryption
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser SpekeKeyProvider
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"spekeKeyProvider")
)
instance Prelude.Hashable CmafEncryption
instance Prelude.NFData CmafEncryption
instance Core.ToJSON CmafEncryption where
toJSON :: CmafEncryption -> Value
toJSON CmafEncryption' {Maybe Int
Maybe Text
SpekeKeyProvider
spekeKeyProvider :: SpekeKeyProvider
constantInitializationVector :: Maybe Text
keyRotationIntervalSeconds :: Maybe Int
$sel:spekeKeyProvider:CmafEncryption' :: CmafEncryption -> SpekeKeyProvider
$sel:constantInitializationVector:CmafEncryption' :: CmafEncryption -> Maybe Text
$sel:keyRotationIntervalSeconds:CmafEncryption' :: CmafEncryption -> Maybe Int
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"keyRotationIntervalSeconds" 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
keyRotationIntervalSeconds,
(Text
"constantInitializationVector" 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
constantInitializationVector,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"spekeKeyProvider" Text -> SpekeKeyProvider -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= SpekeKeyProvider
spekeKeyProvider)
]
)