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