{-# 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.OpenSearch.Types.CognitoOptions where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data CognitoOptions = CognitoOptions'
{
CognitoOptions -> Maybe Text
identityPoolId :: Prelude.Maybe Prelude.Text,
CognitoOptions -> Maybe Bool
enabled :: Prelude.Maybe Prelude.Bool,
CognitoOptions -> Maybe Text
userPoolId :: Prelude.Maybe Prelude.Text,
CognitoOptions -> Maybe Text
roleArn :: Prelude.Maybe Prelude.Text
}
deriving (CognitoOptions -> CognitoOptions -> Bool
(CognitoOptions -> CognitoOptions -> Bool)
-> (CognitoOptions -> CognitoOptions -> Bool) -> Eq CognitoOptions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CognitoOptions -> CognitoOptions -> Bool
$c/= :: CognitoOptions -> CognitoOptions -> Bool
== :: CognitoOptions -> CognitoOptions -> Bool
$c== :: CognitoOptions -> CognitoOptions -> Bool
Prelude.Eq, ReadPrec [CognitoOptions]
ReadPrec CognitoOptions
Int -> ReadS CognitoOptions
ReadS [CognitoOptions]
(Int -> ReadS CognitoOptions)
-> ReadS [CognitoOptions]
-> ReadPrec CognitoOptions
-> ReadPrec [CognitoOptions]
-> Read CognitoOptions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CognitoOptions]
$creadListPrec :: ReadPrec [CognitoOptions]
readPrec :: ReadPrec CognitoOptions
$creadPrec :: ReadPrec CognitoOptions
readList :: ReadS [CognitoOptions]
$creadList :: ReadS [CognitoOptions]
readsPrec :: Int -> ReadS CognitoOptions
$creadsPrec :: Int -> ReadS CognitoOptions
Prelude.Read, Int -> CognitoOptions -> ShowS
[CognitoOptions] -> ShowS
CognitoOptions -> String
(Int -> CognitoOptions -> ShowS)
-> (CognitoOptions -> String)
-> ([CognitoOptions] -> ShowS)
-> Show CognitoOptions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CognitoOptions] -> ShowS
$cshowList :: [CognitoOptions] -> ShowS
show :: CognitoOptions -> String
$cshow :: CognitoOptions -> String
showsPrec :: Int -> CognitoOptions -> ShowS
$cshowsPrec :: Int -> CognitoOptions -> ShowS
Prelude.Show, (forall x. CognitoOptions -> Rep CognitoOptions x)
-> (forall x. Rep CognitoOptions x -> CognitoOptions)
-> Generic CognitoOptions
forall x. Rep CognitoOptions x -> CognitoOptions
forall x. CognitoOptions -> Rep CognitoOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CognitoOptions x -> CognitoOptions
$cfrom :: forall x. CognitoOptions -> Rep CognitoOptions x
Prelude.Generic)
newCognitoOptions ::
CognitoOptions
newCognitoOptions :: CognitoOptions
newCognitoOptions =
CognitoOptions' :: Maybe Text
-> Maybe Bool -> Maybe Text -> Maybe Text -> CognitoOptions
CognitoOptions'
{ $sel:identityPoolId:CognitoOptions' :: Maybe Text
identityPoolId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:enabled:CognitoOptions' :: Maybe Bool
enabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:userPoolId:CognitoOptions' :: Maybe Text
userPoolId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:roleArn:CognitoOptions' :: Maybe Text
roleArn = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
cognitoOptions_identityPoolId :: Lens.Lens' CognitoOptions (Prelude.Maybe Prelude.Text)
cognitoOptions_identityPoolId :: (Maybe Text -> f (Maybe Text))
-> CognitoOptions -> f CognitoOptions
cognitoOptions_identityPoolId = (CognitoOptions -> Maybe Text)
-> (CognitoOptions -> Maybe Text -> CognitoOptions)
-> Lens CognitoOptions CognitoOptions (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CognitoOptions' {Maybe Text
identityPoolId :: Maybe Text
$sel:identityPoolId:CognitoOptions' :: CognitoOptions -> Maybe Text
identityPoolId} -> Maybe Text
identityPoolId) (\s :: CognitoOptions
s@CognitoOptions' {} Maybe Text
a -> CognitoOptions
s {$sel:identityPoolId:CognitoOptions' :: Maybe Text
identityPoolId = Maybe Text
a} :: CognitoOptions)
cognitoOptions_enabled :: Lens.Lens' CognitoOptions (Prelude.Maybe Prelude.Bool)
cognitoOptions_enabled :: (Maybe Bool -> f (Maybe Bool))
-> CognitoOptions -> f CognitoOptions
cognitoOptions_enabled = (CognitoOptions -> Maybe Bool)
-> (CognitoOptions -> Maybe Bool -> CognitoOptions)
-> Lens CognitoOptions CognitoOptions (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CognitoOptions' {Maybe Bool
enabled :: Maybe Bool
$sel:enabled:CognitoOptions' :: CognitoOptions -> Maybe Bool
enabled} -> Maybe Bool
enabled) (\s :: CognitoOptions
s@CognitoOptions' {} Maybe Bool
a -> CognitoOptions
s {$sel:enabled:CognitoOptions' :: Maybe Bool
enabled = Maybe Bool
a} :: CognitoOptions)
cognitoOptions_userPoolId :: Lens.Lens' CognitoOptions (Prelude.Maybe Prelude.Text)
cognitoOptions_userPoolId :: (Maybe Text -> f (Maybe Text))
-> CognitoOptions -> f CognitoOptions
cognitoOptions_userPoolId = (CognitoOptions -> Maybe Text)
-> (CognitoOptions -> Maybe Text -> CognitoOptions)
-> Lens CognitoOptions CognitoOptions (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CognitoOptions' {Maybe Text
userPoolId :: Maybe Text
$sel:userPoolId:CognitoOptions' :: CognitoOptions -> Maybe Text
userPoolId} -> Maybe Text
userPoolId) (\s :: CognitoOptions
s@CognitoOptions' {} Maybe Text
a -> CognitoOptions
s {$sel:userPoolId:CognitoOptions' :: Maybe Text
userPoolId = Maybe Text
a} :: CognitoOptions)
cognitoOptions_roleArn :: Lens.Lens' CognitoOptions (Prelude.Maybe Prelude.Text)
cognitoOptions_roleArn :: (Maybe Text -> f (Maybe Text))
-> CognitoOptions -> f CognitoOptions
cognitoOptions_roleArn = (CognitoOptions -> Maybe Text)
-> (CognitoOptions -> Maybe Text -> CognitoOptions)
-> Lens CognitoOptions CognitoOptions (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CognitoOptions' {Maybe Text
roleArn :: Maybe Text
$sel:roleArn:CognitoOptions' :: CognitoOptions -> Maybe Text
roleArn} -> Maybe Text
roleArn) (\s :: CognitoOptions
s@CognitoOptions' {} Maybe Text
a -> CognitoOptions
s {$sel:roleArn:CognitoOptions' :: Maybe Text
roleArn = Maybe Text
a} :: CognitoOptions)
instance Core.FromJSON CognitoOptions where
parseJSON :: Value -> Parser CognitoOptions
parseJSON =
String
-> (Object -> Parser CognitoOptions)
-> Value
-> Parser CognitoOptions
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"CognitoOptions"
( \Object
x ->
Maybe Text
-> Maybe Bool -> Maybe Text -> Maybe Text -> CognitoOptions
CognitoOptions'
(Maybe Text
-> Maybe Bool -> Maybe Text -> Maybe Text -> CognitoOptions)
-> Parser (Maybe Text)
-> Parser
(Maybe Bool -> Maybe Text -> Maybe Text -> CognitoOptions)
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
"IdentityPoolId")
Parser (Maybe Bool -> Maybe Text -> Maybe Text -> CognitoOptions)
-> Parser (Maybe Bool)
-> Parser (Maybe Text -> Maybe Text -> CognitoOptions)
forall (f :: * -> *) a b. Applicative f => 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
"Enabled")
Parser (Maybe Text -> Maybe Text -> CognitoOptions)
-> Parser (Maybe Text) -> Parser (Maybe Text -> CognitoOptions)
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
"UserPoolId")
Parser (Maybe Text -> CognitoOptions)
-> Parser (Maybe Text) -> Parser CognitoOptions
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
"RoleArn")
)
instance Prelude.Hashable CognitoOptions
instance Prelude.NFData CognitoOptions
instance Core.ToJSON CognitoOptions where
toJSON :: CognitoOptions -> Value
toJSON CognitoOptions' {Maybe Bool
Maybe Text
roleArn :: Maybe Text
userPoolId :: Maybe Text
enabled :: Maybe Bool
identityPoolId :: Maybe Text
$sel:roleArn:CognitoOptions' :: CognitoOptions -> Maybe Text
$sel:userPoolId:CognitoOptions' :: CognitoOptions -> Maybe Text
$sel:enabled:CognitoOptions' :: CognitoOptions -> Maybe Bool
$sel:identityPoolId:CognitoOptions' :: CognitoOptions -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"IdentityPoolId" 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
identityPoolId,
(Text
"Enabled" 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
enabled,
(Text
"UserPoolId" 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
userPoolId,
(Text
"RoleArn" 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
roleArn
]
)