{-# 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.SageMaker.Types.CognitoConfig 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 CognitoConfig = CognitoConfig'
{
CognitoConfig -> Text
userPool :: Prelude.Text,
CognitoConfig -> Text
clientId :: Prelude.Text
}
deriving (CognitoConfig -> CognitoConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CognitoConfig -> CognitoConfig -> Bool
$c/= :: CognitoConfig -> CognitoConfig -> Bool
== :: CognitoConfig -> CognitoConfig -> Bool
$c== :: CognitoConfig -> CognitoConfig -> Bool
Prelude.Eq, ReadPrec [CognitoConfig]
ReadPrec CognitoConfig
Int -> ReadS CognitoConfig
ReadS [CognitoConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CognitoConfig]
$creadListPrec :: ReadPrec [CognitoConfig]
readPrec :: ReadPrec CognitoConfig
$creadPrec :: ReadPrec CognitoConfig
readList :: ReadS [CognitoConfig]
$creadList :: ReadS [CognitoConfig]
readsPrec :: Int -> ReadS CognitoConfig
$creadsPrec :: Int -> ReadS CognitoConfig
Prelude.Read, Int -> CognitoConfig -> ShowS
[CognitoConfig] -> ShowS
CognitoConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CognitoConfig] -> ShowS
$cshowList :: [CognitoConfig] -> ShowS
show :: CognitoConfig -> String
$cshow :: CognitoConfig -> String
showsPrec :: Int -> CognitoConfig -> ShowS
$cshowsPrec :: Int -> CognitoConfig -> ShowS
Prelude.Show, forall x. Rep CognitoConfig x -> CognitoConfig
forall x. CognitoConfig -> Rep CognitoConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CognitoConfig x -> CognitoConfig
$cfrom :: forall x. CognitoConfig -> Rep CognitoConfig x
Prelude.Generic)
newCognitoConfig ::
Prelude.Text ->
Prelude.Text ->
CognitoConfig
newCognitoConfig :: Text -> Text -> CognitoConfig
newCognitoConfig Text
pUserPool_ Text
pClientId_ =
CognitoConfig'
{ $sel:userPool:CognitoConfig' :: Text
userPool = Text
pUserPool_,
$sel:clientId:CognitoConfig' :: Text
clientId = Text
pClientId_
}
cognitoConfig_userPool :: Lens.Lens' CognitoConfig Prelude.Text
cognitoConfig_userPool :: Lens' CognitoConfig Text
cognitoConfig_userPool = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CognitoConfig' {Text
userPool :: Text
$sel:userPool:CognitoConfig' :: CognitoConfig -> Text
userPool} -> Text
userPool) (\s :: CognitoConfig
s@CognitoConfig' {} Text
a -> CognitoConfig
s {$sel:userPool:CognitoConfig' :: Text
userPool = Text
a} :: CognitoConfig)
cognitoConfig_clientId :: Lens.Lens' CognitoConfig Prelude.Text
cognitoConfig_clientId :: Lens' CognitoConfig Text
cognitoConfig_clientId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CognitoConfig' {Text
clientId :: Text
$sel:clientId:CognitoConfig' :: CognitoConfig -> Text
clientId} -> Text
clientId) (\s :: CognitoConfig
s@CognitoConfig' {} Text
a -> CognitoConfig
s {$sel:clientId:CognitoConfig' :: Text
clientId = Text
a} :: CognitoConfig)
instance Data.FromJSON CognitoConfig where
parseJSON :: Value -> Parser CognitoConfig
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"CognitoConfig"
( \Object
x ->
Text -> Text -> CognitoConfig
CognitoConfig'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"UserPool")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"ClientId")
)
instance Prelude.Hashable CognitoConfig where
hashWithSalt :: Int -> CognitoConfig -> Int
hashWithSalt Int
_salt CognitoConfig' {Text
clientId :: Text
userPool :: Text
$sel:clientId:CognitoConfig' :: CognitoConfig -> Text
$sel:userPool:CognitoConfig' :: CognitoConfig -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
userPool
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
clientId
instance Prelude.NFData CognitoConfig where
rnf :: CognitoConfig -> ()
rnf CognitoConfig' {Text
clientId :: Text
userPool :: Text
$sel:clientId:CognitoConfig' :: CognitoConfig -> Text
$sel:userPool:CognitoConfig' :: CognitoConfig -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
userPool
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
clientId
instance Data.ToJSON CognitoConfig where
toJSON :: CognitoConfig -> Value
toJSON CognitoConfig' {Text
clientId :: Text
userPool :: Text
$sel:clientId:CognitoConfig' :: CognitoConfig -> Text
$sel:userPool:CognitoConfig' :: CognitoConfig -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"UserPool" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
userPool),
forall a. a -> Maybe a
Prelude.Just (Key
"ClientId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
clientId)
]
)