{-# 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.Pinpoint.Types.EndpointUser where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data EndpointUser = EndpointUser'
{
EndpointUser -> Maybe (HashMap Text [Text])
userAttributes :: Prelude.Maybe (Prelude.HashMap Prelude.Text [Prelude.Text]),
EndpointUser -> Maybe Text
userId :: Prelude.Maybe Prelude.Text
}
deriving (EndpointUser -> EndpointUser -> Bool
(EndpointUser -> EndpointUser -> Bool)
-> (EndpointUser -> EndpointUser -> Bool) -> Eq EndpointUser
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EndpointUser -> EndpointUser -> Bool
$c/= :: EndpointUser -> EndpointUser -> Bool
== :: EndpointUser -> EndpointUser -> Bool
$c== :: EndpointUser -> EndpointUser -> Bool
Prelude.Eq, ReadPrec [EndpointUser]
ReadPrec EndpointUser
Int -> ReadS EndpointUser
ReadS [EndpointUser]
(Int -> ReadS EndpointUser)
-> ReadS [EndpointUser]
-> ReadPrec EndpointUser
-> ReadPrec [EndpointUser]
-> Read EndpointUser
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EndpointUser]
$creadListPrec :: ReadPrec [EndpointUser]
readPrec :: ReadPrec EndpointUser
$creadPrec :: ReadPrec EndpointUser
readList :: ReadS [EndpointUser]
$creadList :: ReadS [EndpointUser]
readsPrec :: Int -> ReadS EndpointUser
$creadsPrec :: Int -> ReadS EndpointUser
Prelude.Read, Int -> EndpointUser -> ShowS
[EndpointUser] -> ShowS
EndpointUser -> String
(Int -> EndpointUser -> ShowS)
-> (EndpointUser -> String)
-> ([EndpointUser] -> ShowS)
-> Show EndpointUser
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EndpointUser] -> ShowS
$cshowList :: [EndpointUser] -> ShowS
show :: EndpointUser -> String
$cshow :: EndpointUser -> String
showsPrec :: Int -> EndpointUser -> ShowS
$cshowsPrec :: Int -> EndpointUser -> ShowS
Prelude.Show, (forall x. EndpointUser -> Rep EndpointUser x)
-> (forall x. Rep EndpointUser x -> EndpointUser)
-> Generic EndpointUser
forall x. Rep EndpointUser x -> EndpointUser
forall x. EndpointUser -> Rep EndpointUser x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EndpointUser x -> EndpointUser
$cfrom :: forall x. EndpointUser -> Rep EndpointUser x
Prelude.Generic)
newEndpointUser ::
EndpointUser
newEndpointUser :: EndpointUser
newEndpointUser =
EndpointUser' :: Maybe (HashMap Text [Text]) -> Maybe Text -> EndpointUser
EndpointUser'
{ $sel:userAttributes:EndpointUser' :: Maybe (HashMap Text [Text])
userAttributes = Maybe (HashMap Text [Text])
forall a. Maybe a
Prelude.Nothing,
$sel:userId:EndpointUser' :: Maybe Text
userId = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
endpointUser_userAttributes :: Lens.Lens' EndpointUser (Prelude.Maybe (Prelude.HashMap Prelude.Text [Prelude.Text]))
endpointUser_userAttributes :: (Maybe (HashMap Text [Text]) -> f (Maybe (HashMap Text [Text])))
-> EndpointUser -> f EndpointUser
endpointUser_userAttributes = (EndpointUser -> Maybe (HashMap Text [Text]))
-> (EndpointUser -> Maybe (HashMap Text [Text]) -> EndpointUser)
-> Lens
EndpointUser
EndpointUser
(Maybe (HashMap Text [Text]))
(Maybe (HashMap Text [Text]))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EndpointUser' {Maybe (HashMap Text [Text])
userAttributes :: Maybe (HashMap Text [Text])
$sel:userAttributes:EndpointUser' :: EndpointUser -> Maybe (HashMap Text [Text])
userAttributes} -> Maybe (HashMap Text [Text])
userAttributes) (\s :: EndpointUser
s@EndpointUser' {} Maybe (HashMap Text [Text])
a -> EndpointUser
s {$sel:userAttributes:EndpointUser' :: Maybe (HashMap Text [Text])
userAttributes = Maybe (HashMap Text [Text])
a} :: EndpointUser) ((Maybe (HashMap Text [Text]) -> f (Maybe (HashMap Text [Text])))
-> EndpointUser -> f EndpointUser)
-> ((Maybe (HashMap Text [Text])
-> f (Maybe (HashMap Text [Text])))
-> Maybe (HashMap Text [Text]) -> f (Maybe (HashMap Text [Text])))
-> (Maybe (HashMap Text [Text]) -> f (Maybe (HashMap Text [Text])))
-> EndpointUser
-> f EndpointUser
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text [Text])
(HashMap Text [Text])
(HashMap Text [Text])
(HashMap Text [Text])
-> Iso
(Maybe (HashMap Text [Text]))
(Maybe (HashMap Text [Text]))
(Maybe (HashMap Text [Text]))
(Maybe (HashMap Text [Text]))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
(HashMap Text [Text])
(HashMap Text [Text])
(HashMap Text [Text])
(HashMap Text [Text])
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
endpointUser_userId :: Lens.Lens' EndpointUser (Prelude.Maybe Prelude.Text)
endpointUser_userId :: (Maybe Text -> f (Maybe Text)) -> EndpointUser -> f EndpointUser
endpointUser_userId = (EndpointUser -> Maybe Text)
-> (EndpointUser -> Maybe Text -> EndpointUser)
-> Lens EndpointUser EndpointUser (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EndpointUser' {Maybe Text
userId :: Maybe Text
$sel:userId:EndpointUser' :: EndpointUser -> Maybe Text
userId} -> Maybe Text
userId) (\s :: EndpointUser
s@EndpointUser' {} Maybe Text
a -> EndpointUser
s {$sel:userId:EndpointUser' :: Maybe Text
userId = Maybe Text
a} :: EndpointUser)
instance Core.FromJSON EndpointUser where
parseJSON :: Value -> Parser EndpointUser
parseJSON =
String
-> (Object -> Parser EndpointUser) -> Value -> Parser EndpointUser
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"EndpointUser"
( \Object
x ->
Maybe (HashMap Text [Text]) -> Maybe Text -> EndpointUser
EndpointUser'
(Maybe (HashMap Text [Text]) -> Maybe Text -> EndpointUser)
-> Parser (Maybe (HashMap Text [Text]))
-> Parser (Maybe Text -> EndpointUser)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text [Text])))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"UserAttributes" Parser (Maybe (Maybe (HashMap Text [Text])))
-> Maybe (HashMap Text [Text])
-> Parser (Maybe (HashMap Text [Text]))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text [Text])
forall a. Monoid a => a
Prelude.mempty)
Parser (Maybe Text -> EndpointUser)
-> Parser (Maybe Text) -> Parser EndpointUser
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
"UserId")
)
instance Prelude.Hashable EndpointUser
instance Prelude.NFData EndpointUser
instance Core.ToJSON EndpointUser where
toJSON :: EndpointUser -> Value
toJSON EndpointUser' {Maybe Text
Maybe (HashMap Text [Text])
userId :: Maybe Text
userAttributes :: Maybe (HashMap Text [Text])
$sel:userId:EndpointUser' :: EndpointUser -> Maybe Text
$sel:userAttributes:EndpointUser' :: EndpointUser -> Maybe (HashMap Text [Text])
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"UserAttributes" Text -> HashMap Text [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(HashMap Text [Text] -> Pair)
-> Maybe (HashMap Text [Text]) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text [Text])
userAttributes,
(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
]
)