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