{-# 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.AppSync.Types.UserPoolConfig where
import Amazonka.AppSync.Types.DefaultAction
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data UserPoolConfig = UserPoolConfig'
{
UserPoolConfig -> Maybe Text
appIdClientRegex :: Prelude.Maybe Prelude.Text,
UserPoolConfig -> Text
userPoolId :: Prelude.Text,
UserPoolConfig -> Text
awsRegion :: Prelude.Text,
UserPoolConfig -> DefaultAction
defaultAction :: DefaultAction
}
deriving (UserPoolConfig -> UserPoolConfig -> Bool
(UserPoolConfig -> UserPoolConfig -> Bool)
-> (UserPoolConfig -> UserPoolConfig -> Bool) -> Eq UserPoolConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UserPoolConfig -> UserPoolConfig -> Bool
$c/= :: UserPoolConfig -> UserPoolConfig -> Bool
== :: UserPoolConfig -> UserPoolConfig -> Bool
$c== :: UserPoolConfig -> UserPoolConfig -> Bool
Prelude.Eq, ReadPrec [UserPoolConfig]
ReadPrec UserPoolConfig
Int -> ReadS UserPoolConfig
ReadS [UserPoolConfig]
(Int -> ReadS UserPoolConfig)
-> ReadS [UserPoolConfig]
-> ReadPrec UserPoolConfig
-> ReadPrec [UserPoolConfig]
-> Read UserPoolConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UserPoolConfig]
$creadListPrec :: ReadPrec [UserPoolConfig]
readPrec :: ReadPrec UserPoolConfig
$creadPrec :: ReadPrec UserPoolConfig
readList :: ReadS [UserPoolConfig]
$creadList :: ReadS [UserPoolConfig]
readsPrec :: Int -> ReadS UserPoolConfig
$creadsPrec :: Int -> ReadS UserPoolConfig
Prelude.Read, Int -> UserPoolConfig -> ShowS
[UserPoolConfig] -> ShowS
UserPoolConfig -> String
(Int -> UserPoolConfig -> ShowS)
-> (UserPoolConfig -> String)
-> ([UserPoolConfig] -> ShowS)
-> Show UserPoolConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UserPoolConfig] -> ShowS
$cshowList :: [UserPoolConfig] -> ShowS
show :: UserPoolConfig -> String
$cshow :: UserPoolConfig -> String
showsPrec :: Int -> UserPoolConfig -> ShowS
$cshowsPrec :: Int -> UserPoolConfig -> ShowS
Prelude.Show, (forall x. UserPoolConfig -> Rep UserPoolConfig x)
-> (forall x. Rep UserPoolConfig x -> UserPoolConfig)
-> Generic UserPoolConfig
forall x. Rep UserPoolConfig x -> UserPoolConfig
forall x. UserPoolConfig -> Rep UserPoolConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UserPoolConfig x -> UserPoolConfig
$cfrom :: forall x. UserPoolConfig -> Rep UserPoolConfig x
Prelude.Generic)
newUserPoolConfig ::
Prelude.Text ->
Prelude.Text ->
DefaultAction ->
UserPoolConfig
newUserPoolConfig :: Text -> Text -> DefaultAction -> UserPoolConfig
newUserPoolConfig
Text
pUserPoolId_
Text
pAwsRegion_
DefaultAction
pDefaultAction_ =
UserPoolConfig' :: Maybe Text -> Text -> Text -> DefaultAction -> UserPoolConfig
UserPoolConfig'
{ $sel:appIdClientRegex:UserPoolConfig' :: Maybe Text
appIdClientRegex = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:userPoolId:UserPoolConfig' :: Text
userPoolId = Text
pUserPoolId_,
$sel:awsRegion:UserPoolConfig' :: Text
awsRegion = Text
pAwsRegion_,
$sel:defaultAction:UserPoolConfig' :: DefaultAction
defaultAction = DefaultAction
pDefaultAction_
}
userPoolConfig_appIdClientRegex :: Lens.Lens' UserPoolConfig (Prelude.Maybe Prelude.Text)
userPoolConfig_appIdClientRegex :: (Maybe Text -> f (Maybe Text))
-> UserPoolConfig -> f UserPoolConfig
userPoolConfig_appIdClientRegex = (UserPoolConfig -> Maybe Text)
-> (UserPoolConfig -> Maybe Text -> UserPoolConfig)
-> Lens UserPoolConfig UserPoolConfig (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserPoolConfig' {Maybe Text
appIdClientRegex :: Maybe Text
$sel:appIdClientRegex:UserPoolConfig' :: UserPoolConfig -> Maybe Text
appIdClientRegex} -> Maybe Text
appIdClientRegex) (\s :: UserPoolConfig
s@UserPoolConfig' {} Maybe Text
a -> UserPoolConfig
s {$sel:appIdClientRegex:UserPoolConfig' :: Maybe Text
appIdClientRegex = Maybe Text
a} :: UserPoolConfig)
userPoolConfig_userPoolId :: Lens.Lens' UserPoolConfig Prelude.Text
userPoolConfig_userPoolId :: (Text -> f Text) -> UserPoolConfig -> f UserPoolConfig
userPoolConfig_userPoolId = (UserPoolConfig -> Text)
-> (UserPoolConfig -> Text -> UserPoolConfig)
-> Lens UserPoolConfig UserPoolConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserPoolConfig' {Text
userPoolId :: Text
$sel:userPoolId:UserPoolConfig' :: UserPoolConfig -> Text
userPoolId} -> Text
userPoolId) (\s :: UserPoolConfig
s@UserPoolConfig' {} Text
a -> UserPoolConfig
s {$sel:userPoolId:UserPoolConfig' :: Text
userPoolId = Text
a} :: UserPoolConfig)
userPoolConfig_awsRegion :: Lens.Lens' UserPoolConfig Prelude.Text
userPoolConfig_awsRegion :: (Text -> f Text) -> UserPoolConfig -> f UserPoolConfig
userPoolConfig_awsRegion = (UserPoolConfig -> Text)
-> (UserPoolConfig -> Text -> UserPoolConfig)
-> Lens UserPoolConfig UserPoolConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserPoolConfig' {Text
awsRegion :: Text
$sel:awsRegion:UserPoolConfig' :: UserPoolConfig -> Text
awsRegion} -> Text
awsRegion) (\s :: UserPoolConfig
s@UserPoolConfig' {} Text
a -> UserPoolConfig
s {$sel:awsRegion:UserPoolConfig' :: Text
awsRegion = Text
a} :: UserPoolConfig)
userPoolConfig_defaultAction :: Lens.Lens' UserPoolConfig DefaultAction
userPoolConfig_defaultAction :: (DefaultAction -> f DefaultAction)
-> UserPoolConfig -> f UserPoolConfig
userPoolConfig_defaultAction = (UserPoolConfig -> DefaultAction)
-> (UserPoolConfig -> DefaultAction -> UserPoolConfig)
-> Lens UserPoolConfig UserPoolConfig DefaultAction DefaultAction
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserPoolConfig' {DefaultAction
defaultAction :: DefaultAction
$sel:defaultAction:UserPoolConfig' :: UserPoolConfig -> DefaultAction
defaultAction} -> DefaultAction
defaultAction) (\s :: UserPoolConfig
s@UserPoolConfig' {} DefaultAction
a -> UserPoolConfig
s {$sel:defaultAction:UserPoolConfig' :: DefaultAction
defaultAction = DefaultAction
a} :: UserPoolConfig)
instance Core.FromJSON UserPoolConfig where
parseJSON :: Value -> Parser UserPoolConfig
parseJSON =
String
-> (Object -> Parser UserPoolConfig)
-> Value
-> Parser UserPoolConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"UserPoolConfig"
( \Object
x ->
Maybe Text -> Text -> Text -> DefaultAction -> UserPoolConfig
UserPoolConfig'
(Maybe Text -> Text -> Text -> DefaultAction -> UserPoolConfig)
-> Parser (Maybe Text)
-> Parser (Text -> Text -> DefaultAction -> UserPoolConfig)
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
"appIdClientRegex")
Parser (Text -> Text -> DefaultAction -> UserPoolConfig)
-> Parser Text -> Parser (Text -> DefaultAction -> UserPoolConfig)
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
"userPoolId")
Parser (Text -> DefaultAction -> UserPoolConfig)
-> Parser Text -> Parser (DefaultAction -> UserPoolConfig)
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
"awsRegion")
Parser (DefaultAction -> UserPoolConfig)
-> Parser DefaultAction -> Parser UserPoolConfig
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser DefaultAction
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"defaultAction")
)
instance Prelude.Hashable UserPoolConfig
instance Prelude.NFData UserPoolConfig
instance Core.ToJSON UserPoolConfig where
toJSON :: UserPoolConfig -> Value
toJSON UserPoolConfig' {Maybe Text
Text
DefaultAction
defaultAction :: DefaultAction
awsRegion :: Text
userPoolId :: Text
appIdClientRegex :: Maybe Text
$sel:defaultAction:UserPoolConfig' :: UserPoolConfig -> DefaultAction
$sel:awsRegion:UserPoolConfig' :: UserPoolConfig -> Text
$sel:userPoolId:UserPoolConfig' :: UserPoolConfig -> Text
$sel:appIdClientRegex:UserPoolConfig' :: UserPoolConfig -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"appIdClientRegex" 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
appIdClientRegex,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"userPoolId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
userPoolId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"awsRegion" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
awsRegion),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"defaultAction" Text -> DefaultAction -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= DefaultAction
defaultAction)
]
)