{-# 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.QuickSight.DescribeUser
(
DescribeUser (..),
newDescribeUser,
describeUser_userName,
describeUser_awsAccountId,
describeUser_namespace,
DescribeUserResponse (..),
newDescribeUserResponse,
describeUserResponse_requestId,
describeUserResponse_user,
describeUserResponse_status,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.QuickSight.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data DescribeUser = DescribeUser'
{
DescribeUser -> Text
userName :: Prelude.Text,
DescribeUser -> Text
awsAccountId :: Prelude.Text,
DescribeUser -> Text
namespace :: 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 ->
Prelude.Text ->
DescribeUser
newDescribeUser :: Text -> Text -> Text -> DescribeUser
newDescribeUser Text
pUserName_ Text
pAwsAccountId_ Text
pNamespace_ =
DescribeUser' :: Text -> Text -> Text -> DescribeUser
DescribeUser'
{ $sel:userName:DescribeUser' :: Text
userName = Text
pUserName_,
$sel:awsAccountId:DescribeUser' :: Text
awsAccountId = Text
pAwsAccountId_,
$sel:namespace:DescribeUser' :: Text
namespace = Text
pNamespace_
}
describeUser_userName :: Lens.Lens' DescribeUser Prelude.Text
describeUser_userName :: (Text -> f Text) -> DescribeUser -> f DescribeUser
describeUser_userName = (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
userName :: Text
$sel:userName:DescribeUser' :: DescribeUser -> Text
userName} -> Text
userName) (\s :: DescribeUser
s@DescribeUser' {} Text
a -> DescribeUser
s {$sel:userName:DescribeUser' :: Text
userName = Text
a} :: DescribeUser)
describeUser_awsAccountId :: Lens.Lens' DescribeUser Prelude.Text
describeUser_awsAccountId :: (Text -> f Text) -> DescribeUser -> f DescribeUser
describeUser_awsAccountId = (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
awsAccountId :: Text
$sel:awsAccountId:DescribeUser' :: DescribeUser -> Text
awsAccountId} -> Text
awsAccountId) (\s :: DescribeUser
s@DescribeUser' {} Text
a -> DescribeUser
s {$sel:awsAccountId:DescribeUser' :: Text
awsAccountId = Text
a} :: DescribeUser)
describeUser_namespace :: Lens.Lens' DescribeUser Prelude.Text
describeUser_namespace :: (Text -> f Text) -> DescribeUser -> f DescribeUser
describeUser_namespace = (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
namespace :: Text
$sel:namespace:DescribeUser' :: DescribeUser -> Text
namespace} -> Text
namespace) (\s :: DescribeUser
s@DescribeUser' {} Text
a -> DescribeUser
s {$sel:namespace:DescribeUser' :: Text
namespace = 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 => Service -> a -> Request a
Request.get 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 ->
Maybe Text -> Maybe User -> Int -> DescribeUserResponse
DescribeUserResponse'
(Maybe Text -> Maybe User -> Int -> DescribeUserResponse)
-> Either String (Maybe Text)
-> Either String (Maybe User -> Int -> DescribeUserResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"RequestId")
Either String (Maybe User -> Int -> DescribeUserResponse)
-> Either String (Maybe User)
-> Either String (Int -> DescribeUserResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe User)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"User")
Either String (Int -> DescribeUserResponse)
-> Either String Int -> Either String DescribeUserResponse
forall (f :: * -> *) a b. Applicative f => 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))
)
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
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.0" ::
Prelude.ByteString
)
]
)
instance Core.ToPath DescribeUser where
toPath :: DescribeUser -> ByteString
toPath DescribeUser' {Text
namespace :: Text
awsAccountId :: Text
userName :: Text
$sel:namespace:DescribeUser' :: DescribeUser -> Text
$sel:awsAccountId:DescribeUser' :: DescribeUser -> Text
$sel:userName:DescribeUser' :: DescribeUser -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/accounts/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
awsAccountId,
ByteString
"/namespaces/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
namespace,
ByteString
"/users/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
userName
]
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 -> Maybe Text
requestId :: Prelude.Maybe Prelude.Text,
DescribeUserResponse -> Maybe User
user :: Prelude.Maybe User,
DescribeUserResponse -> Int
status :: Prelude.Int
}
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, ReadPrec [DescribeUserResponse]
ReadPrec DescribeUserResponse
Int -> ReadS DescribeUserResponse
ReadS [DescribeUserResponse]
(Int -> ReadS DescribeUserResponse)
-> ReadS [DescribeUserResponse]
-> ReadPrec DescribeUserResponse
-> ReadPrec [DescribeUserResponse]
-> Read DescribeUserResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeUserResponse]
$creadListPrec :: ReadPrec [DescribeUserResponse]
readPrec :: ReadPrec DescribeUserResponse
$creadPrec :: ReadPrec DescribeUserResponse
readList :: ReadS [DescribeUserResponse]
$creadList :: ReadS [DescribeUserResponse]
readsPrec :: Int -> ReadS DescribeUserResponse
$creadsPrec :: Int -> ReadS DescribeUserResponse
Prelude.Read, 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 ->
DescribeUserResponse
newDescribeUserResponse :: Int -> DescribeUserResponse
newDescribeUserResponse Int
pStatus_ =
DescribeUserResponse' :: Maybe Text -> Maybe User -> Int -> DescribeUserResponse
DescribeUserResponse'
{ $sel:requestId:DescribeUserResponse' :: Maybe Text
requestId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:user:DescribeUserResponse' :: Maybe User
user = Maybe User
forall a. Maybe a
Prelude.Nothing,
$sel:status:DescribeUserResponse' :: Int
status = Int
pStatus_
}
describeUserResponse_requestId :: Lens.Lens' DescribeUserResponse (Prelude.Maybe Prelude.Text)
describeUserResponse_requestId :: (Maybe Text -> f (Maybe Text))
-> DescribeUserResponse -> f DescribeUserResponse
describeUserResponse_requestId = (DescribeUserResponse -> Maybe Text)
-> (DescribeUserResponse -> Maybe Text -> DescribeUserResponse)
-> Lens
DescribeUserResponse DescribeUserResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeUserResponse' {Maybe Text
requestId :: Maybe Text
$sel:requestId:DescribeUserResponse' :: DescribeUserResponse -> Maybe Text
requestId} -> Maybe Text
requestId) (\s :: DescribeUserResponse
s@DescribeUserResponse' {} Maybe Text
a -> DescribeUserResponse
s {$sel:requestId:DescribeUserResponse' :: Maybe Text
requestId = Maybe Text
a} :: DescribeUserResponse)
describeUserResponse_user :: Lens.Lens' DescribeUserResponse (Prelude.Maybe User)
describeUserResponse_user :: (Maybe User -> f (Maybe User))
-> DescribeUserResponse -> f DescribeUserResponse
describeUserResponse_user = (DescribeUserResponse -> Maybe User)
-> (DescribeUserResponse -> Maybe User -> DescribeUserResponse)
-> Lens
DescribeUserResponse DescribeUserResponse (Maybe User) (Maybe User)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeUserResponse' {Maybe User
user :: Maybe User
$sel:user:DescribeUserResponse' :: DescribeUserResponse -> Maybe User
user} -> Maybe User
user) (\s :: DescribeUserResponse
s@DescribeUserResponse' {} Maybe User
a -> DescribeUserResponse
s {$sel:user:DescribeUserResponse' :: Maybe User
user = Maybe User
a} :: DescribeUserResponse)
describeUserResponse_status :: Lens.Lens' DescribeUserResponse Prelude.Int
describeUserResponse_status :: (Int -> f Int) -> DescribeUserResponse -> f DescribeUserResponse
describeUserResponse_status = (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
status :: Int
$sel:status:DescribeUserResponse' :: DescribeUserResponse -> Int
status} -> Int
status) (\s :: DescribeUserResponse
s@DescribeUserResponse' {} Int
a -> DescribeUserResponse
s {$sel:status:DescribeUserResponse' :: Int
status = Int
a} :: DescribeUserResponse)
instance Prelude.NFData DescribeUserResponse