{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.IdentityStore.DescribeUser
(
DescribeUser (..),
newDescribeUser,
describeUser_identityStoreId,
describeUser_userId,
DescribeUserResponse (..),
newDescribeUserResponse,
describeUserResponse_httpStatus,
describeUserResponse_userName,
describeUserResponse_userId,
)
where
import qualified Amazonka.Core as Core
import Amazonka.IdentityStore.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data DescribeUser = DescribeUser'
{
DescribeUser -> Text
identityStoreId :: Prelude.Text,
DescribeUser -> Text
userId :: Prelude.Text
}
deriving (DescribeUser -> DescribeUser -> Bool
(DescribeUser -> DescribeUser -> Bool)
-> (DescribeUser -> DescribeUser -> Bool) -> Eq DescribeUser
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeUser -> DescribeUser -> Bool
$c/= :: DescribeUser -> DescribeUser -> Bool
== :: DescribeUser -> DescribeUser -> Bool
$c== :: DescribeUser -> DescribeUser -> Bool
Prelude.Eq, ReadPrec [DescribeUser]
ReadPrec DescribeUser
Int -> ReadS DescribeUser
ReadS [DescribeUser]
(Int -> ReadS DescribeUser)
-> ReadS [DescribeUser]
-> ReadPrec DescribeUser
-> ReadPrec [DescribeUser]
-> Read DescribeUser
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeUser]
$creadListPrec :: ReadPrec [DescribeUser]
readPrec :: ReadPrec DescribeUser
$creadPrec :: ReadPrec DescribeUser
readList :: ReadS [DescribeUser]
$creadList :: ReadS [DescribeUser]
readsPrec :: Int -> ReadS DescribeUser
$creadsPrec :: Int -> ReadS DescribeUser
Prelude.Read, Int -> DescribeUser -> ShowS
[DescribeUser] -> ShowS
DescribeUser -> String
(Int -> DescribeUser -> ShowS)
-> (DescribeUser -> String)
-> ([DescribeUser] -> ShowS)
-> Show DescribeUser
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeUser] -> ShowS
$cshowList :: [DescribeUser] -> ShowS
show :: DescribeUser -> String
$cshow :: DescribeUser -> String
showsPrec :: Int -> DescribeUser -> ShowS
$cshowsPrec :: Int -> DescribeUser -> ShowS
Prelude.Show, (forall x. DescribeUser -> Rep DescribeUser x)
-> (forall x. Rep DescribeUser x -> DescribeUser)
-> Generic DescribeUser
forall x. Rep DescribeUser x -> DescribeUser
forall x. DescribeUser -> Rep DescribeUser x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeUser x -> DescribeUser
$cfrom :: forall x. DescribeUser -> Rep DescribeUser x
Prelude.Generic)
newDescribeUser ::
Prelude.Text ->
Prelude.Text ->
DescribeUser
newDescribeUser :: Text -> Text -> DescribeUser
newDescribeUser Text
pIdentityStoreId_ Text
pUserId_ =
DescribeUser' :: Text -> Text -> DescribeUser
DescribeUser'
{ $sel:identityStoreId:DescribeUser' :: Text
identityStoreId = Text
pIdentityStoreId_,
$sel:userId:DescribeUser' :: Text
userId = Text
pUserId_
}
describeUser_identityStoreId :: Lens.Lens' DescribeUser Prelude.Text
describeUser_identityStoreId :: (Text -> f Text) -> DescribeUser -> f DescribeUser
describeUser_identityStoreId = (DescribeUser -> Text)
-> (DescribeUser -> Text -> DescribeUser)
-> Lens DescribeUser DescribeUser Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeUser' {Text
identityStoreId :: Text
$sel:identityStoreId:DescribeUser' :: DescribeUser -> Text
identityStoreId} -> Text
identityStoreId) (\s :: DescribeUser
s@DescribeUser' {} Text
a -> DescribeUser
s {$sel:identityStoreId:DescribeUser' :: Text
identityStoreId = Text
a} :: DescribeUser)
describeUser_userId :: Lens.Lens' DescribeUser Prelude.Text
describeUser_userId :: (Text -> f Text) -> DescribeUser -> f DescribeUser
describeUser_userId = (DescribeUser -> Text)
-> (DescribeUser -> Text -> DescribeUser)
-> Lens DescribeUser DescribeUser Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeUser' {Text
userId :: Text
$sel:userId:DescribeUser' :: DescribeUser -> Text
userId} -> Text
userId) (\s :: DescribeUser
s@DescribeUser' {} Text
a -> DescribeUser
s {$sel:userId:DescribeUser' :: Text
userId = Text
a} :: DescribeUser)
instance Core.AWSRequest DescribeUser where
type AWSResponse DescribeUser = DescribeUserResponse
request :: DescribeUser -> Request DescribeUser
request = Service -> DescribeUser -> Request DescribeUser
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeUser
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeUser)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeUser))
-> Logger
-> Service
-> Proxy DescribeUser
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeUser)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Int -> Sensitive Text -> Text -> DescribeUserResponse
DescribeUserResponse'
(Int -> Sensitive Text -> Text -> DescribeUserResponse)
-> Either String Int
-> Either String (Sensitive Text -> Text -> DescribeUserResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
Either String (Sensitive Text -> Text -> DescribeUserResponse)
-> Either String (Sensitive Text)
-> Either String (Text -> DescribeUserResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Sensitive Text)
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"UserName")
Either String (Text -> DescribeUserResponse)
-> Either String Text -> Either String DescribeUserResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"UserId")
)
instance Prelude.Hashable DescribeUser
instance Prelude.NFData DescribeUser
instance Core.ToHeaders DescribeUser where
toHeaders :: DescribeUser -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeUser -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AWSIdentityStore.DescribeUser" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON DescribeUser where
toJSON :: DescribeUser -> Value
toJSON DescribeUser' {Text
userId :: Text
identityStoreId :: Text
$sel:userId:DescribeUser' :: DescribeUser -> Text
$sel:identityStoreId:DescribeUser' :: DescribeUser -> 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
"IdentityStoreId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
identityStoreId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"UserId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
userId)
]
)
instance Core.ToPath DescribeUser where
toPath :: DescribeUser -> ByteString
toPath = ByteString -> DescribeUser -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DescribeUser where
toQuery :: DescribeUser -> QueryString
toQuery = QueryString -> DescribeUser -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeUserResponse = DescribeUserResponse'
{
DescribeUserResponse -> Int
httpStatus :: Prelude.Int,
DescribeUserResponse -> Sensitive Text
userName :: Core.Sensitive Prelude.Text,
DescribeUserResponse -> Text
userId :: Prelude.Text
}
deriving (DescribeUserResponse -> DescribeUserResponse -> Bool
(DescribeUserResponse -> DescribeUserResponse -> Bool)
-> (DescribeUserResponse -> DescribeUserResponse -> Bool)
-> Eq DescribeUserResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeUserResponse -> DescribeUserResponse -> Bool
$c/= :: DescribeUserResponse -> DescribeUserResponse -> Bool
== :: DescribeUserResponse -> DescribeUserResponse -> Bool
$c== :: DescribeUserResponse -> DescribeUserResponse -> Bool
Prelude.Eq, Int -> DescribeUserResponse -> ShowS
[DescribeUserResponse] -> ShowS
DescribeUserResponse -> String
(Int -> DescribeUserResponse -> ShowS)
-> (DescribeUserResponse -> String)
-> ([DescribeUserResponse] -> ShowS)
-> Show DescribeUserResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeUserResponse] -> ShowS
$cshowList :: [DescribeUserResponse] -> ShowS
show :: DescribeUserResponse -> String
$cshow :: DescribeUserResponse -> String
showsPrec :: Int -> DescribeUserResponse -> ShowS
$cshowsPrec :: Int -> DescribeUserResponse -> ShowS
Prelude.Show, (forall x. DescribeUserResponse -> Rep DescribeUserResponse x)
-> (forall x. Rep DescribeUserResponse x -> DescribeUserResponse)
-> Generic DescribeUserResponse
forall x. Rep DescribeUserResponse x -> DescribeUserResponse
forall x. DescribeUserResponse -> Rep DescribeUserResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeUserResponse x -> DescribeUserResponse
$cfrom :: forall x. DescribeUserResponse -> Rep DescribeUserResponse x
Prelude.Generic)
newDescribeUserResponse ::
Prelude.Int ->
Prelude.Text ->
Prelude.Text ->
DescribeUserResponse
newDescribeUserResponse :: Int -> Text -> Text -> DescribeUserResponse
newDescribeUserResponse
Int
pHttpStatus_
Text
pUserName_
Text
pUserId_ =
DescribeUserResponse' :: Int -> Sensitive Text -> Text -> DescribeUserResponse
DescribeUserResponse'
{ $sel:httpStatus:DescribeUserResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:userName:DescribeUserResponse' :: Sensitive Text
userName = Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text))
forall a. Iso' (Sensitive a) a
Core._Sensitive (Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text)))
-> Text -> Sensitive Text
forall t b. AReview t b -> b -> t
Lens.# Text
pUserName_,
$sel:userId:DescribeUserResponse' :: Text
userId = Text
pUserId_
}
describeUserResponse_httpStatus :: Lens.Lens' DescribeUserResponse Prelude.Int
describeUserResponse_httpStatus :: (Int -> f Int) -> DescribeUserResponse -> f DescribeUserResponse
describeUserResponse_httpStatus = (DescribeUserResponse -> Int)
-> (DescribeUserResponse -> Int -> DescribeUserResponse)
-> Lens DescribeUserResponse DescribeUserResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeUserResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeUserResponse' :: DescribeUserResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeUserResponse
s@DescribeUserResponse' {} Int
a -> DescribeUserResponse
s {$sel:httpStatus:DescribeUserResponse' :: Int
httpStatus = Int
a} :: DescribeUserResponse)
describeUserResponse_userName :: Lens.Lens' DescribeUserResponse Prelude.Text
describeUserResponse_userName :: (Text -> f Text) -> DescribeUserResponse -> f DescribeUserResponse
describeUserResponse_userName = (DescribeUserResponse -> Sensitive Text)
-> (DescribeUserResponse -> Sensitive Text -> DescribeUserResponse)
-> Lens
DescribeUserResponse
DescribeUserResponse
(Sensitive Text)
(Sensitive Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeUserResponse' {Sensitive Text
userName :: Sensitive Text
$sel:userName:DescribeUserResponse' :: DescribeUserResponse -> Sensitive Text
userName} -> Sensitive Text
userName) (\s :: DescribeUserResponse
s@DescribeUserResponse' {} Sensitive Text
a -> DescribeUserResponse
s {$sel:userName:DescribeUserResponse' :: Sensitive Text
userName = Sensitive Text
a} :: DescribeUserResponse) ((Sensitive Text -> f (Sensitive Text))
-> DescribeUserResponse -> f DescribeUserResponse)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> DescribeUserResponse
-> f DescribeUserResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> f Text) -> Sensitive Text -> f (Sensitive Text)
forall a. Iso' (Sensitive a) a
Core._Sensitive
describeUserResponse_userId :: Lens.Lens' DescribeUserResponse Prelude.Text
describeUserResponse_userId :: (Text -> f Text) -> DescribeUserResponse -> f DescribeUserResponse
describeUserResponse_userId = (DescribeUserResponse -> Text)
-> (DescribeUserResponse -> Text -> DescribeUserResponse)
-> Lens DescribeUserResponse DescribeUserResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeUserResponse' {Text
userId :: Text
$sel:userId:DescribeUserResponse' :: DescribeUserResponse -> Text
userId} -> Text
userId) (\s :: DescribeUserResponse
s@DescribeUserResponse' {} Text
a -> DescribeUserResponse
s {$sel:userId:DescribeUserResponse' :: Text
userId = Text
a} :: DescribeUserResponse)
instance Prelude.NFData DescribeUserResponse