{-# 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.SpekeKeyProvider where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data SpekeKeyProvider = SpekeKeyProvider'
{
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 ->
SpekeKeyProvider
newSpekeKeyProvider :: Text -> Text -> SpekeKeyProvider
newSpekeKeyProvider Text
pUrl_ Text
pRoleArn_ =
SpekeKeyProvider' :: [Text] -> Text -> Text -> SpekeKeyProvider
SpekeKeyProvider'
{ $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_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 ->
[Text] -> Text -> Text -> SpekeKeyProvider
SpekeKeyProvider'
([Text] -> Text -> Text -> SpekeKeyProvider)
-> Parser [Text] -> Parser (Text -> Text -> SpekeKeyProvider)
forall (f :: * -> *) a b. Functor 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]
Text
roleArn :: Text
url :: Text
systemIds :: [Text]
$sel:roleArn:SpekeKeyProvider' :: SpekeKeyProvider -> Text
$sel:url:SpekeKeyProvider' :: SpekeKeyProvider -> Text
$sel:systemIds:SpekeKeyProvider' :: SpekeKeyProvider -> [Text]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ 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)
]
)