{-# 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.DashEncryption 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 DashEncryption = DashEncryption'
{
DashEncryption -> Maybe Int
keyRotationIntervalSeconds :: Prelude.Maybe Prelude.Int,
DashEncryption -> SpekeKeyProvider
spekeKeyProvider :: SpekeKeyProvider
}
deriving (DashEncryption -> DashEncryption -> Bool
(DashEncryption -> DashEncryption -> Bool)
-> (DashEncryption -> DashEncryption -> Bool) -> Eq DashEncryption
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DashEncryption -> DashEncryption -> Bool
$c/= :: DashEncryption -> DashEncryption -> Bool
== :: DashEncryption -> DashEncryption -> Bool
$c== :: DashEncryption -> DashEncryption -> Bool
Prelude.Eq, ReadPrec [DashEncryption]
ReadPrec DashEncryption
Int -> ReadS DashEncryption
ReadS [DashEncryption]
(Int -> ReadS DashEncryption)
-> ReadS [DashEncryption]
-> ReadPrec DashEncryption
-> ReadPrec [DashEncryption]
-> Read DashEncryption
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DashEncryption]
$creadListPrec :: ReadPrec [DashEncryption]
readPrec :: ReadPrec DashEncryption
$creadPrec :: ReadPrec DashEncryption
readList :: ReadS [DashEncryption]
$creadList :: ReadS [DashEncryption]
readsPrec :: Int -> ReadS DashEncryption
$creadsPrec :: Int -> ReadS DashEncryption
Prelude.Read, Int -> DashEncryption -> ShowS
[DashEncryption] -> ShowS
DashEncryption -> String
(Int -> DashEncryption -> ShowS)
-> (DashEncryption -> String)
-> ([DashEncryption] -> ShowS)
-> Show DashEncryption
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DashEncryption] -> ShowS
$cshowList :: [DashEncryption] -> ShowS
show :: DashEncryption -> String
$cshow :: DashEncryption -> String
showsPrec :: Int -> DashEncryption -> ShowS
$cshowsPrec :: Int -> DashEncryption -> ShowS
Prelude.Show, (forall x. DashEncryption -> Rep DashEncryption x)
-> (forall x. Rep DashEncryption x -> DashEncryption)
-> Generic DashEncryption
forall x. Rep DashEncryption x -> DashEncryption
forall x. DashEncryption -> Rep DashEncryption x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DashEncryption x -> DashEncryption
$cfrom :: forall x. DashEncryption -> Rep DashEncryption x
Prelude.Generic)
newDashEncryption ::
SpekeKeyProvider ->
DashEncryption
newDashEncryption :: SpekeKeyProvider -> DashEncryption
newDashEncryption SpekeKeyProvider
pSpekeKeyProvider_ =
DashEncryption' :: Maybe Int -> SpekeKeyProvider -> DashEncryption
DashEncryption'
{ $sel:keyRotationIntervalSeconds:DashEncryption' :: Maybe Int
keyRotationIntervalSeconds =
Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:spekeKeyProvider:DashEncryption' :: SpekeKeyProvider
spekeKeyProvider = SpekeKeyProvider
pSpekeKeyProvider_
}
dashEncryption_keyRotationIntervalSeconds :: Lens.Lens' DashEncryption (Prelude.Maybe Prelude.Int)
dashEncryption_keyRotationIntervalSeconds :: (Maybe Int -> f (Maybe Int)) -> DashEncryption -> f DashEncryption
dashEncryption_keyRotationIntervalSeconds = (DashEncryption -> Maybe Int)
-> (DashEncryption -> Maybe Int -> DashEncryption)
-> Lens DashEncryption DashEncryption (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DashEncryption' {Maybe Int
keyRotationIntervalSeconds :: Maybe Int
$sel:keyRotationIntervalSeconds:DashEncryption' :: DashEncryption -> Maybe Int
keyRotationIntervalSeconds} -> Maybe Int
keyRotationIntervalSeconds) (\s :: DashEncryption
s@DashEncryption' {} Maybe Int
a -> DashEncryption
s {$sel:keyRotationIntervalSeconds:DashEncryption' :: Maybe Int
keyRotationIntervalSeconds = Maybe Int
a} :: DashEncryption)
dashEncryption_spekeKeyProvider :: Lens.Lens' DashEncryption SpekeKeyProvider
dashEncryption_spekeKeyProvider :: (SpekeKeyProvider -> f SpekeKeyProvider)
-> DashEncryption -> f DashEncryption
dashEncryption_spekeKeyProvider = (DashEncryption -> SpekeKeyProvider)
-> (DashEncryption -> SpekeKeyProvider -> DashEncryption)
-> Lens
DashEncryption DashEncryption SpekeKeyProvider SpekeKeyProvider
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DashEncryption' {SpekeKeyProvider
spekeKeyProvider :: SpekeKeyProvider
$sel:spekeKeyProvider:DashEncryption' :: DashEncryption -> SpekeKeyProvider
spekeKeyProvider} -> SpekeKeyProvider
spekeKeyProvider) (\s :: DashEncryption
s@DashEncryption' {} SpekeKeyProvider
a -> DashEncryption
s {$sel:spekeKeyProvider:DashEncryption' :: SpekeKeyProvider
spekeKeyProvider = SpekeKeyProvider
a} :: DashEncryption)
instance Core.FromJSON DashEncryption where
parseJSON :: Value -> Parser DashEncryption
parseJSON =
String
-> (Object -> Parser DashEncryption)
-> Value
-> Parser DashEncryption
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"DashEncryption"
( \Object
x ->
Maybe Int -> SpekeKeyProvider -> DashEncryption
DashEncryption'
(Maybe Int -> SpekeKeyProvider -> DashEncryption)
-> Parser (Maybe Int)
-> Parser (SpekeKeyProvider -> DashEncryption)
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 (SpekeKeyProvider -> DashEncryption)
-> Parser SpekeKeyProvider -> Parser DashEncryption
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 DashEncryption
instance Prelude.NFData DashEncryption
instance Core.ToJSON DashEncryption where
toJSON :: DashEncryption -> Value
toJSON DashEncryption' {Maybe Int
SpekeKeyProvider
spekeKeyProvider :: SpekeKeyProvider
keyRotationIntervalSeconds :: Maybe Int
$sel:spekeKeyProvider:DashEncryption' :: DashEncryption -> SpekeKeyProvider
$sel:keyRotationIntervalSeconds:DashEncryption' :: DashEncryption -> 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,
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)
]
)