{-# 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.Chime.GetUser
(
GetUser (..),
newGetUser,
getUser_accountId,
getUser_userId,
GetUserResponse (..),
newGetUserResponse,
getUserResponse_user,
getUserResponse_httpStatus,
)
where
import Amazonka.Chime.Types
import qualified Amazonka.Core as Core
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 GetUser = GetUser'
{
GetUser -> Text
accountId :: Prelude.Text,
GetUser -> Text
userId :: Prelude.Text
}
deriving (GetUser -> GetUser -> Bool
(GetUser -> GetUser -> Bool)
-> (GetUser -> GetUser -> Bool) -> Eq GetUser
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetUser -> GetUser -> Bool
$c/= :: GetUser -> GetUser -> Bool
== :: GetUser -> GetUser -> Bool
$c== :: GetUser -> GetUser -> Bool
Prelude.Eq, ReadPrec [GetUser]
ReadPrec GetUser
Int -> ReadS GetUser
ReadS [GetUser]
(Int -> ReadS GetUser)
-> ReadS [GetUser]
-> ReadPrec GetUser
-> ReadPrec [GetUser]
-> Read GetUser
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetUser]
$creadListPrec :: ReadPrec [GetUser]
readPrec :: ReadPrec GetUser
$creadPrec :: ReadPrec GetUser
readList :: ReadS [GetUser]
$creadList :: ReadS [GetUser]
readsPrec :: Int -> ReadS GetUser
$creadsPrec :: Int -> ReadS GetUser
Prelude.Read, Int -> GetUser -> ShowS
[GetUser] -> ShowS
GetUser -> String
(Int -> GetUser -> ShowS)
-> (GetUser -> String) -> ([GetUser] -> ShowS) -> Show GetUser
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetUser] -> ShowS
$cshowList :: [GetUser] -> ShowS
show :: GetUser -> String
$cshow :: GetUser -> String
showsPrec :: Int -> GetUser -> ShowS
$cshowsPrec :: Int -> GetUser -> ShowS
Prelude.Show, (forall x. GetUser -> Rep GetUser x)
-> (forall x. Rep GetUser x -> GetUser) -> Generic GetUser
forall x. Rep GetUser x -> GetUser
forall x. GetUser -> Rep GetUser x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetUser x -> GetUser
$cfrom :: forall x. GetUser -> Rep GetUser x
Prelude.Generic)
newGetUser ::
Prelude.Text ->
Prelude.Text ->
GetUser
newGetUser :: Text -> Text -> GetUser
newGetUser Text
pAccountId_ Text
pUserId_ =
GetUser' :: Text -> Text -> GetUser
GetUser'
{ $sel:accountId:GetUser' :: Text
accountId = Text
pAccountId_,
$sel:userId:GetUser' :: Text
userId = Text
pUserId_
}
getUser_accountId :: Lens.Lens' GetUser Prelude.Text
getUser_accountId :: (Text -> f Text) -> GetUser -> f GetUser
getUser_accountId = (GetUser -> Text)
-> (GetUser -> Text -> GetUser) -> Lens GetUser GetUser Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetUser' {Text
accountId :: Text
$sel:accountId:GetUser' :: GetUser -> Text
accountId} -> Text
accountId) (\s :: GetUser
s@GetUser' {} Text
a -> GetUser
s {$sel:accountId:GetUser' :: Text
accountId = Text
a} :: GetUser)
getUser_userId :: Lens.Lens' GetUser Prelude.Text
getUser_userId :: (Text -> f Text) -> GetUser -> f GetUser
getUser_userId = (GetUser -> Text)
-> (GetUser -> Text -> GetUser) -> Lens GetUser GetUser Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetUser' {Text
userId :: Text
$sel:userId:GetUser' :: GetUser -> Text
userId} -> Text
userId) (\s :: GetUser
s@GetUser' {} Text
a -> GetUser
s {$sel:userId:GetUser' :: Text
userId = Text
a} :: GetUser)
instance Core.AWSRequest GetUser where
type AWSResponse GetUser = GetUserResponse
request :: GetUser -> Request GetUser
request = Service -> GetUser -> Request GetUser
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetUser
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetUser)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetUser))
-> Logger
-> Service
-> Proxy GetUser
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetUser)))
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 User -> Int -> GetUserResponse
GetUserResponse'
(Maybe User -> Int -> GetUserResponse)
-> Either String (Maybe User)
-> Either String (Int -> GetUserResponse)
forall (f :: * -> *) a b. Functor 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 -> GetUserResponse)
-> Either String Int -> Either String GetUserResponse
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 GetUser
instance Prelude.NFData GetUser
instance Core.ToHeaders GetUser where
toHeaders :: GetUser -> ResponseHeaders
toHeaders = ResponseHeaders -> GetUser -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath GetUser where
toPath :: GetUser -> ByteString
toPath GetUser' {Text
userId :: Text
accountId :: Text
$sel:userId:GetUser' :: GetUser -> Text
$sel:accountId:GetUser' :: GetUser -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/accounts/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
accountId,
ByteString
"/users/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
userId
]
instance Core.ToQuery GetUser where
toQuery :: GetUser -> QueryString
toQuery = QueryString -> GetUser -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetUserResponse = GetUserResponse'
{
GetUserResponse -> Maybe User
user :: Prelude.Maybe User,
GetUserResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetUserResponse -> GetUserResponse -> Bool
(GetUserResponse -> GetUserResponse -> Bool)
-> (GetUserResponse -> GetUserResponse -> Bool)
-> Eq GetUserResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetUserResponse -> GetUserResponse -> Bool
$c/= :: GetUserResponse -> GetUserResponse -> Bool
== :: GetUserResponse -> GetUserResponse -> Bool
$c== :: GetUserResponse -> GetUserResponse -> Bool
Prelude.Eq, Int -> GetUserResponse -> ShowS
[GetUserResponse] -> ShowS
GetUserResponse -> String
(Int -> GetUserResponse -> ShowS)
-> (GetUserResponse -> String)
-> ([GetUserResponse] -> ShowS)
-> Show GetUserResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetUserResponse] -> ShowS
$cshowList :: [GetUserResponse] -> ShowS
show :: GetUserResponse -> String
$cshow :: GetUserResponse -> String
showsPrec :: Int -> GetUserResponse -> ShowS
$cshowsPrec :: Int -> GetUserResponse -> ShowS
Prelude.Show, (forall x. GetUserResponse -> Rep GetUserResponse x)
-> (forall x. Rep GetUserResponse x -> GetUserResponse)
-> Generic GetUserResponse
forall x. Rep GetUserResponse x -> GetUserResponse
forall x. GetUserResponse -> Rep GetUserResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetUserResponse x -> GetUserResponse
$cfrom :: forall x. GetUserResponse -> Rep GetUserResponse x
Prelude.Generic)
newGetUserResponse ::
Prelude.Int ->
GetUserResponse
newGetUserResponse :: Int -> GetUserResponse
newGetUserResponse Int
pHttpStatus_ =
GetUserResponse' :: Maybe User -> Int -> GetUserResponse
GetUserResponse'
{ $sel:user:GetUserResponse' :: Maybe User
user = Maybe User
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetUserResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getUserResponse_user :: Lens.Lens' GetUserResponse (Prelude.Maybe User)
getUserResponse_user :: (Maybe User -> f (Maybe User))
-> GetUserResponse -> f GetUserResponse
getUserResponse_user = (GetUserResponse -> Maybe User)
-> (GetUserResponse -> Maybe User -> GetUserResponse)
-> Lens GetUserResponse GetUserResponse (Maybe User) (Maybe User)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetUserResponse' {Maybe User
user :: Maybe User
$sel:user:GetUserResponse' :: GetUserResponse -> Maybe User
user} -> Maybe User
user) (\s :: GetUserResponse
s@GetUserResponse' {} Maybe User
a -> GetUserResponse
s {$sel:user:GetUserResponse' :: Maybe User
user = Maybe User
a} :: GetUserResponse)
getUserResponse_httpStatus :: Lens.Lens' GetUserResponse Prelude.Int
getUserResponse_httpStatus :: (Int -> f Int) -> GetUserResponse -> f GetUserResponse
getUserResponse_httpStatus = (GetUserResponse -> Int)
-> (GetUserResponse -> Int -> GetUserResponse)
-> Lens GetUserResponse GetUserResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetUserResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetUserResponse' :: GetUserResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetUserResponse
s@GetUserResponse' {} Int
a -> GetUserResponse
s {$sel:httpStatus:GetUserResponse' :: Int
httpStatus = Int
a} :: GetUserResponse)
instance Prelude.NFData GetUserResponse