{-# 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.IoTEvents.Types.SSOIdentity where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data SSOIdentity = SSOIdentity'
{
SSOIdentity -> Maybe Text
userId :: Prelude.Maybe Prelude.Text,
SSOIdentity -> Text
identityStoreId :: Prelude.Text
}
deriving (SSOIdentity -> SSOIdentity -> Bool
(SSOIdentity -> SSOIdentity -> Bool)
-> (SSOIdentity -> SSOIdentity -> Bool) -> Eq SSOIdentity
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SSOIdentity -> SSOIdentity -> Bool
$c/= :: SSOIdentity -> SSOIdentity -> Bool
== :: SSOIdentity -> SSOIdentity -> Bool
$c== :: SSOIdentity -> SSOIdentity -> Bool
Prelude.Eq, ReadPrec [SSOIdentity]
ReadPrec SSOIdentity
Int -> ReadS SSOIdentity
ReadS [SSOIdentity]
(Int -> ReadS SSOIdentity)
-> ReadS [SSOIdentity]
-> ReadPrec SSOIdentity
-> ReadPrec [SSOIdentity]
-> Read SSOIdentity
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SSOIdentity]
$creadListPrec :: ReadPrec [SSOIdentity]
readPrec :: ReadPrec SSOIdentity
$creadPrec :: ReadPrec SSOIdentity
readList :: ReadS [SSOIdentity]
$creadList :: ReadS [SSOIdentity]
readsPrec :: Int -> ReadS SSOIdentity
$creadsPrec :: Int -> ReadS SSOIdentity
Prelude.Read, Int -> SSOIdentity -> ShowS
[SSOIdentity] -> ShowS
SSOIdentity -> String
(Int -> SSOIdentity -> ShowS)
-> (SSOIdentity -> String)
-> ([SSOIdentity] -> ShowS)
-> Show SSOIdentity
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SSOIdentity] -> ShowS
$cshowList :: [SSOIdentity] -> ShowS
show :: SSOIdentity -> String
$cshow :: SSOIdentity -> String
showsPrec :: Int -> SSOIdentity -> ShowS
$cshowsPrec :: Int -> SSOIdentity -> ShowS
Prelude.Show, (forall x. SSOIdentity -> Rep SSOIdentity x)
-> (forall x. Rep SSOIdentity x -> SSOIdentity)
-> Generic SSOIdentity
forall x. Rep SSOIdentity x -> SSOIdentity
forall x. SSOIdentity -> Rep SSOIdentity x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SSOIdentity x -> SSOIdentity
$cfrom :: forall x. SSOIdentity -> Rep SSOIdentity x
Prelude.Generic)
newSSOIdentity ::
Prelude.Text ->
SSOIdentity
newSSOIdentity :: Text -> SSOIdentity
newSSOIdentity Text
pIdentityStoreId_ =
SSOIdentity' :: Maybe Text -> Text -> SSOIdentity
SSOIdentity'
{ $sel:userId:SSOIdentity' :: Maybe Text
userId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:identityStoreId:SSOIdentity' :: Text
identityStoreId = Text
pIdentityStoreId_
}
sSOIdentity_userId :: Lens.Lens' SSOIdentity (Prelude.Maybe Prelude.Text)
sSOIdentity_userId :: (Maybe Text -> f (Maybe Text)) -> SSOIdentity -> f SSOIdentity
sSOIdentity_userId = (SSOIdentity -> Maybe Text)
-> (SSOIdentity -> Maybe Text -> SSOIdentity)
-> Lens SSOIdentity SSOIdentity (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SSOIdentity' {Maybe Text
userId :: Maybe Text
$sel:userId:SSOIdentity' :: SSOIdentity -> Maybe Text
userId} -> Maybe Text
userId) (\s :: SSOIdentity
s@SSOIdentity' {} Maybe Text
a -> SSOIdentity
s {$sel:userId:SSOIdentity' :: Maybe Text
userId = Maybe Text
a} :: SSOIdentity)
sSOIdentity_identityStoreId :: Lens.Lens' SSOIdentity Prelude.Text
sSOIdentity_identityStoreId :: (Text -> f Text) -> SSOIdentity -> f SSOIdentity
sSOIdentity_identityStoreId = (SSOIdentity -> Text)
-> (SSOIdentity -> Text -> SSOIdentity)
-> Lens SSOIdentity SSOIdentity Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SSOIdentity' {Text
identityStoreId :: Text
$sel:identityStoreId:SSOIdentity' :: SSOIdentity -> Text
identityStoreId} -> Text
identityStoreId) (\s :: SSOIdentity
s@SSOIdentity' {} Text
a -> SSOIdentity
s {$sel:identityStoreId:SSOIdentity' :: Text
identityStoreId = Text
a} :: SSOIdentity)
instance Core.FromJSON SSOIdentity where
parseJSON :: Value -> Parser SSOIdentity
parseJSON =
String
-> (Object -> Parser SSOIdentity) -> Value -> Parser SSOIdentity
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"SSOIdentity"
( \Object
x ->
Maybe Text -> Text -> SSOIdentity
SSOIdentity'
(Maybe Text -> Text -> SSOIdentity)
-> Parser (Maybe Text) -> Parser (Text -> SSOIdentity)
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
"userId")
Parser (Text -> SSOIdentity) -> Parser Text -> Parser SSOIdentity
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
"identityStoreId")
)
instance Prelude.Hashable SSOIdentity
instance Prelude.NFData SSOIdentity
instance Core.ToJSON SSOIdentity where
toJSON :: SSOIdentity -> Value
toJSON SSOIdentity' {Maybe Text
Text
identityStoreId :: Text
userId :: Maybe Text
$sel:identityStoreId:SSOIdentity' :: SSOIdentity -> Text
$sel:userId:SSOIdentity' :: SSOIdentity -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"userId" 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
userId,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"identityStoreId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
identityStoreId)
]
)