{-# 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.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data CognitoConfig = CognitoConfig'
{
CognitoConfig -> Text
userPool :: Prelude.Text,
CognitoConfig -> Text
clientId :: Prelude.Text
}
deriving (CognitoConfig -> CognitoConfig -> Bool
(CognitoConfig -> CognitoConfig -> Bool)
-> (CognitoConfig -> CognitoConfig -> Bool) -> Eq CognitoConfig
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]
(Int -> ReadS CognitoConfig)
-> ReadS [CognitoConfig]
-> ReadPrec CognitoConfig
-> ReadPrec [CognitoConfig]
-> Read 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
(Int -> CognitoConfig -> ShowS)
-> (CognitoConfig -> String)
-> ([CognitoConfig] -> ShowS)
-> Show CognitoConfig
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. CognitoConfig -> Rep CognitoConfig x)
-> (forall x. Rep CognitoConfig x -> CognitoConfig)
-> Generic CognitoConfig
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' :: Text -> Text -> CognitoConfig
CognitoConfig'
{ $sel:userPool:CognitoConfig' :: Text
userPool = Text
pUserPool_,
$sel:clientId:CognitoConfig' :: Text
clientId = Text
pClientId_
}
cognitoConfig_userPool :: Lens.Lens' CognitoConfig Prelude.Text
cognitoConfig_userPool :: (Text -> f Text) -> CognitoConfig -> f CognitoConfig
cognitoConfig_userPool = (CognitoConfig -> Text)
-> (CognitoConfig -> Text -> CognitoConfig)
-> Lens CognitoConfig CognitoConfig Text Text
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 :: (Text -> f Text) -> CognitoConfig -> f CognitoConfig
cognitoConfig_clientId = (CognitoConfig -> Text)
-> (CognitoConfig -> Text -> CognitoConfig)
-> Lens CognitoConfig CognitoConfig Text Text
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 Core.FromJSON CognitoConfig where
parseJSON :: Value -> Parser CognitoConfig
parseJSON =
String
-> (Object -> Parser CognitoConfig)
-> Value
-> Parser CognitoConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"CognitoConfig"
( \Object
x ->
Text -> Text -> CognitoConfig
CognitoConfig'
(Text -> Text -> CognitoConfig)
-> Parser Text -> Parser (Text -> CognitoConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"UserPool")
Parser (Text -> CognitoConfig)
-> Parser Text -> Parser CognitoConfig
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
"ClientId")
)
instance Prelude.Hashable CognitoConfig
instance Prelude.NFData CognitoConfig
instance Core.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
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"UserPool" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
userPool),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ClientId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
clientId)
]
)