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