{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
{ $sel:allowAuthorizerOverride:AuthorizerConfig' :: Maybe Bool
allowAuthorizerOverride =
forall a. Maybe a
Prelude.Nothing,
$sel:defaultAuthorizerName:AuthorizerConfig' :: Maybe Text
defaultAuthorizerName = forall a. Maybe a
Prelude.Nothing
}
authorizerConfig_allowAuthorizerOverride :: Lens.Lens' AuthorizerConfig (Prelude.Maybe Prelude.Bool)
authorizerConfig_allowAuthorizerOverride :: Lens' AuthorizerConfig (Maybe Bool)
authorizerConfig_allowAuthorizerOverride = 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 :: Lens' AuthorizerConfig (Maybe Text)
authorizerConfig_defaultAuthorizerName = 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 Data.FromJSON AuthorizerConfig where
parseJSON :: Value -> Parser AuthorizerConfig
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"AuthorizerConfig"
( \Object
x ->
Maybe Bool -> Maybe Text -> AuthorizerConfig
AuthorizerConfig'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"allowAuthorizerOverride")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"defaultAuthorizerName")
)
instance Prelude.Hashable AuthorizerConfig where
hashWithSalt :: Int -> AuthorizerConfig -> Int
hashWithSalt Int
_salt AuthorizerConfig' {Maybe Bool
Maybe Text
defaultAuthorizerName :: Maybe Text
allowAuthorizerOverride :: Maybe Bool
$sel:defaultAuthorizerName:AuthorizerConfig' :: AuthorizerConfig -> Maybe Text
$sel:allowAuthorizerOverride:AuthorizerConfig' :: AuthorizerConfig -> Maybe Bool
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
allowAuthorizerOverride
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
defaultAuthorizerName
instance Prelude.NFData AuthorizerConfig where
rnf :: AuthorizerConfig -> ()
rnf AuthorizerConfig' {Maybe Bool
Maybe Text
defaultAuthorizerName :: Maybe Text
allowAuthorizerOverride :: Maybe Bool
$sel:defaultAuthorizerName:AuthorizerConfig' :: AuthorizerConfig -> Maybe Text
$sel:allowAuthorizerOverride:AuthorizerConfig' :: AuthorizerConfig -> Maybe Bool
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
allowAuthorizerOverride
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
defaultAuthorizerName
instance Data.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
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"allowAuthorizerOverride" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
allowAuthorizerOverride,
(Key
"defaultAuthorizerName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
defaultAuthorizerName
]
)