{-# 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.SpekeKeyProvider where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaPackage.Types.EncryptionContractConfiguration
import qualified Amazonka.Prelude as Prelude
data SpekeKeyProvider = SpekeKeyProvider'
{ SpekeKeyProvider -> Maybe EncryptionContractConfiguration
encryptionContractConfiguration :: Prelude.Maybe EncryptionContractConfiguration,
SpekeKeyProvider -> Maybe Text
certificateArn :: Prelude.Maybe Prelude.Text,
SpekeKeyProvider -> Text
resourceId :: Prelude.Text,
SpekeKeyProvider -> [Text]
systemIds :: [Prelude.Text],
SpekeKeyProvider -> Text
url :: Prelude.Text,
SpekeKeyProvider -> Text
roleArn :: Prelude.Text
}
deriving (SpekeKeyProvider -> SpekeKeyProvider -> Bool
(SpekeKeyProvider -> SpekeKeyProvider -> Bool)
-> (SpekeKeyProvider -> SpekeKeyProvider -> Bool)
-> Eq SpekeKeyProvider
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SpekeKeyProvider -> SpekeKeyProvider -> Bool
$c/= :: SpekeKeyProvider -> SpekeKeyProvider -> Bool
== :: SpekeKeyProvider -> SpekeKeyProvider -> Bool
$c== :: SpekeKeyProvider -> SpekeKeyProvider -> Bool
Prelude.Eq, ReadPrec [SpekeKeyProvider]
ReadPrec SpekeKeyProvider
Int -> ReadS SpekeKeyProvider
ReadS [SpekeKeyProvider]
(Int -> ReadS SpekeKeyProvider)
-> ReadS [SpekeKeyProvider]
-> ReadPrec SpekeKeyProvider
-> ReadPrec [SpekeKeyProvider]
-> Read SpekeKeyProvider
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SpekeKeyProvider]
$creadListPrec :: ReadPrec [SpekeKeyProvider]
readPrec :: ReadPrec SpekeKeyProvider
$creadPrec :: ReadPrec SpekeKeyProvider
readList :: ReadS [SpekeKeyProvider]
$creadList :: ReadS [SpekeKeyProvider]
readsPrec :: Int -> ReadS SpekeKeyProvider
$creadsPrec :: Int -> ReadS SpekeKeyProvider
Prelude.Read, Int -> SpekeKeyProvider -> ShowS
[SpekeKeyProvider] -> ShowS
SpekeKeyProvider -> String
(Int -> SpekeKeyProvider -> ShowS)
-> (SpekeKeyProvider -> String)
-> ([SpekeKeyProvider] -> ShowS)
-> Show SpekeKeyProvider
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SpekeKeyProvider] -> ShowS
$cshowList :: [SpekeKeyProvider] -> ShowS
show :: SpekeKeyProvider -> String
$cshow :: SpekeKeyProvider -> String
showsPrec :: Int -> SpekeKeyProvider -> ShowS
$cshowsPrec :: Int -> SpekeKeyProvider -> ShowS
Prelude.Show, (forall x. SpekeKeyProvider -> Rep SpekeKeyProvider x)
-> (forall x. Rep SpekeKeyProvider x -> SpekeKeyProvider)
-> Generic SpekeKeyProvider
forall x. Rep SpekeKeyProvider x -> SpekeKeyProvider
forall x. SpekeKeyProvider -> Rep SpekeKeyProvider x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SpekeKeyProvider x -> SpekeKeyProvider
$cfrom :: forall x. SpekeKeyProvider -> Rep SpekeKeyProvider x
Prelude.Generic)
newSpekeKeyProvider ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
SpekeKeyProvider
newSpekeKeyProvider :: Text -> Text -> Text -> SpekeKeyProvider
newSpekeKeyProvider Text
pResourceId_ Text
pUrl_ Text
pRoleArn_ =
SpekeKeyProvider' :: Maybe EncryptionContractConfiguration
-> Maybe Text -> Text -> [Text] -> Text -> Text -> SpekeKeyProvider
SpekeKeyProvider'
{ $sel:encryptionContractConfiguration:SpekeKeyProvider' :: Maybe EncryptionContractConfiguration
encryptionContractConfiguration =
Maybe EncryptionContractConfiguration
forall a. Maybe a
Prelude.Nothing,
$sel:certificateArn:SpekeKeyProvider' :: Maybe Text
certificateArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:resourceId:SpekeKeyProvider' :: Text
resourceId = Text
pResourceId_,
$sel:systemIds:SpekeKeyProvider' :: [Text]
systemIds = [Text]
forall a. Monoid a => a
Prelude.mempty,
$sel:url:SpekeKeyProvider' :: Text
url = Text
pUrl_,
$sel:roleArn:SpekeKeyProvider' :: Text
roleArn = Text
pRoleArn_
}
spekeKeyProvider_encryptionContractConfiguration :: Lens.Lens' SpekeKeyProvider (Prelude.Maybe EncryptionContractConfiguration)
spekeKeyProvider_encryptionContractConfiguration :: (Maybe EncryptionContractConfiguration
-> f (Maybe EncryptionContractConfiguration))
-> SpekeKeyProvider -> f SpekeKeyProvider
spekeKeyProvider_encryptionContractConfiguration = (SpekeKeyProvider -> Maybe EncryptionContractConfiguration)
-> (SpekeKeyProvider
-> Maybe EncryptionContractConfiguration -> SpekeKeyProvider)
-> Lens
SpekeKeyProvider
SpekeKeyProvider
(Maybe EncryptionContractConfiguration)
(Maybe EncryptionContractConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SpekeKeyProvider' {Maybe EncryptionContractConfiguration
encryptionContractConfiguration :: Maybe EncryptionContractConfiguration
$sel:encryptionContractConfiguration:SpekeKeyProvider' :: SpekeKeyProvider -> Maybe EncryptionContractConfiguration
encryptionContractConfiguration} -> Maybe EncryptionContractConfiguration
encryptionContractConfiguration) (\s :: SpekeKeyProvider
s@SpekeKeyProvider' {} Maybe EncryptionContractConfiguration
a -> SpekeKeyProvider
s {$sel:encryptionContractConfiguration:SpekeKeyProvider' :: Maybe EncryptionContractConfiguration
encryptionContractConfiguration = Maybe EncryptionContractConfiguration
a} :: SpekeKeyProvider)
spekeKeyProvider_certificateArn :: Lens.Lens' SpekeKeyProvider (Prelude.Maybe Prelude.Text)
spekeKeyProvider_certificateArn :: (Maybe Text -> f (Maybe Text))
-> SpekeKeyProvider -> f SpekeKeyProvider
spekeKeyProvider_certificateArn = (SpekeKeyProvider -> Maybe Text)
-> (SpekeKeyProvider -> Maybe Text -> SpekeKeyProvider)
-> Lens SpekeKeyProvider SpekeKeyProvider (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SpekeKeyProvider' {Maybe Text
certificateArn :: Maybe Text
$sel:certificateArn:SpekeKeyProvider' :: SpekeKeyProvider -> Maybe Text
certificateArn} -> Maybe Text
certificateArn) (\s :: SpekeKeyProvider
s@SpekeKeyProvider' {} Maybe Text
a -> SpekeKeyProvider
s {$sel:certificateArn:SpekeKeyProvider' :: Maybe Text
certificateArn = Maybe Text
a} :: SpekeKeyProvider)
spekeKeyProvider_resourceId :: Lens.Lens' SpekeKeyProvider Prelude.Text
spekeKeyProvider_resourceId :: (Text -> f Text) -> SpekeKeyProvider -> f SpekeKeyProvider
spekeKeyProvider_resourceId = (SpekeKeyProvider -> Text)
-> (SpekeKeyProvider -> Text -> SpekeKeyProvider)
-> Lens SpekeKeyProvider SpekeKeyProvider Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SpekeKeyProvider' {Text
resourceId :: Text
$sel:resourceId:SpekeKeyProvider' :: SpekeKeyProvider -> Text
resourceId} -> Text
resourceId) (\s :: SpekeKeyProvider
s@SpekeKeyProvider' {} Text
a -> SpekeKeyProvider
s {$sel:resourceId:SpekeKeyProvider' :: Text
resourceId = Text
a} :: SpekeKeyProvider)
spekeKeyProvider_systemIds :: Lens.Lens' SpekeKeyProvider [Prelude.Text]
spekeKeyProvider_systemIds :: ([Text] -> f [Text]) -> SpekeKeyProvider -> f SpekeKeyProvider
spekeKeyProvider_systemIds = (SpekeKeyProvider -> [Text])
-> (SpekeKeyProvider -> [Text] -> SpekeKeyProvider)
-> Lens SpekeKeyProvider SpekeKeyProvider [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SpekeKeyProvider' {[Text]
systemIds :: [Text]
$sel:systemIds:SpekeKeyProvider' :: SpekeKeyProvider -> [Text]
systemIds} -> [Text]
systemIds) (\s :: SpekeKeyProvider
s@SpekeKeyProvider' {} [Text]
a -> SpekeKeyProvider
s {$sel:systemIds:SpekeKeyProvider' :: [Text]
systemIds = [Text]
a} :: SpekeKeyProvider) (([Text] -> f [Text]) -> SpekeKeyProvider -> f SpekeKeyProvider)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> SpekeKeyProvider
-> f SpekeKeyProvider
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
spekeKeyProvider_url :: Lens.Lens' SpekeKeyProvider Prelude.Text
spekeKeyProvider_url :: (Text -> f Text) -> SpekeKeyProvider -> f SpekeKeyProvider
spekeKeyProvider_url = (SpekeKeyProvider -> Text)
-> (SpekeKeyProvider -> Text -> SpekeKeyProvider)
-> Lens SpekeKeyProvider SpekeKeyProvider Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SpekeKeyProvider' {Text
url :: Text
$sel:url:SpekeKeyProvider' :: SpekeKeyProvider -> Text
url} -> Text
url) (\s :: SpekeKeyProvider
s@SpekeKeyProvider' {} Text
a -> SpekeKeyProvider
s {$sel:url:SpekeKeyProvider' :: Text
url = Text
a} :: SpekeKeyProvider)
spekeKeyProvider_roleArn :: Lens.Lens' SpekeKeyProvider Prelude.Text
spekeKeyProvider_roleArn :: (Text -> f Text) -> SpekeKeyProvider -> f SpekeKeyProvider
spekeKeyProvider_roleArn = (SpekeKeyProvider -> Text)
-> (SpekeKeyProvider -> Text -> SpekeKeyProvider)
-> Lens SpekeKeyProvider SpekeKeyProvider Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SpekeKeyProvider' {Text
roleArn :: Text
$sel:roleArn:SpekeKeyProvider' :: SpekeKeyProvider -> Text
roleArn} -> Text
roleArn) (\s :: SpekeKeyProvider
s@SpekeKeyProvider' {} Text
a -> SpekeKeyProvider
s {$sel:roleArn:SpekeKeyProvider' :: Text
roleArn = Text
a} :: SpekeKeyProvider)
instance Core.FromJSON SpekeKeyProvider where
parseJSON :: Value -> Parser SpekeKeyProvider
parseJSON =
String
-> (Object -> Parser SpekeKeyProvider)
-> Value
-> Parser SpekeKeyProvider
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"SpekeKeyProvider"
( \Object
x ->
Maybe EncryptionContractConfiguration
-> Maybe Text -> Text -> [Text] -> Text -> Text -> SpekeKeyProvider
SpekeKeyProvider'
(Maybe EncryptionContractConfiguration
-> Maybe Text
-> Text
-> [Text]
-> Text
-> Text
-> SpekeKeyProvider)
-> Parser (Maybe EncryptionContractConfiguration)
-> Parser
(Maybe Text -> Text -> [Text] -> Text -> Text -> SpekeKeyProvider)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe EncryptionContractConfiguration)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"encryptionContractConfiguration")
Parser
(Maybe Text -> Text -> [Text] -> Text -> Text -> SpekeKeyProvider)
-> Parser (Maybe Text)
-> Parser (Text -> [Text] -> Text -> Text -> SpekeKeyProvider)
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
"certificateArn")
Parser (Text -> [Text] -> Text -> Text -> SpekeKeyProvider)
-> Parser Text
-> Parser ([Text] -> Text -> Text -> SpekeKeyProvider)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"resourceId")
Parser ([Text] -> Text -> Text -> SpekeKeyProvider)
-> Parser [Text] -> Parser (Text -> Text -> SpekeKeyProvider)
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
"systemIds" Parser (Maybe [Text]) -> [Text] -> Parser [Text]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [Text]
forall a. Monoid a => a
Prelude.mempty)
Parser (Text -> Text -> SpekeKeyProvider)
-> Parser Text -> Parser (Text -> SpekeKeyProvider)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"url")
Parser (Text -> SpekeKeyProvider)
-> Parser Text -> Parser SpekeKeyProvider
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"roleArn")
)
instance Prelude.Hashable SpekeKeyProvider
instance Prelude.NFData SpekeKeyProvider
instance Core.ToJSON SpekeKeyProvider where
toJSON :: SpekeKeyProvider -> Value
toJSON SpekeKeyProvider' {[Text]
Maybe Text
Maybe EncryptionContractConfiguration
Text
roleArn :: Text
url :: Text
systemIds :: [Text]
resourceId :: Text
certificateArn :: Maybe Text
encryptionContractConfiguration :: Maybe EncryptionContractConfiguration
$sel:roleArn:SpekeKeyProvider' :: SpekeKeyProvider -> Text
$sel:url:SpekeKeyProvider' :: SpekeKeyProvider -> Text
$sel:systemIds:SpekeKeyProvider' :: SpekeKeyProvider -> [Text]
$sel:resourceId:SpekeKeyProvider' :: SpekeKeyProvider -> Text
$sel:certificateArn:SpekeKeyProvider' :: SpekeKeyProvider -> Maybe Text
$sel:encryptionContractConfiguration:SpekeKeyProvider' :: SpekeKeyProvider -> Maybe EncryptionContractConfiguration
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"encryptionContractConfiguration" Text -> EncryptionContractConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(EncryptionContractConfiguration -> Pair)
-> Maybe EncryptionContractConfiguration -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe EncryptionContractConfiguration
encryptionContractConfiguration,
(Text
"certificateArn" 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
certificateArn,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"resourceId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
resourceId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"systemIds" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
systemIds),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"url" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
url),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"roleArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
roleArn)
]
)