{-# 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.STS.GetCallerIdentity
(
GetCallerIdentity (..),
newGetCallerIdentity,
GetCallerIdentityResponse (..),
newGetCallerIdentityResponse,
getCallerIdentityResponse_arn,
getCallerIdentityResponse_account,
getCallerIdentityResponse_userId,
getCallerIdentityResponse_httpStatus,
)
where
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
import Amazonka.STS.Types
data GetCallerIdentity = GetCallerIdentity'
{
}
deriving (GetCallerIdentity -> GetCallerIdentity -> Bool
(GetCallerIdentity -> GetCallerIdentity -> Bool)
-> (GetCallerIdentity -> GetCallerIdentity -> Bool)
-> Eq GetCallerIdentity
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCallerIdentity -> GetCallerIdentity -> Bool
$c/= :: GetCallerIdentity -> GetCallerIdentity -> Bool
== :: GetCallerIdentity -> GetCallerIdentity -> Bool
$c== :: GetCallerIdentity -> GetCallerIdentity -> Bool
Prelude.Eq, ReadPrec [GetCallerIdentity]
ReadPrec GetCallerIdentity
Int -> ReadS GetCallerIdentity
ReadS [GetCallerIdentity]
(Int -> ReadS GetCallerIdentity)
-> ReadS [GetCallerIdentity]
-> ReadPrec GetCallerIdentity
-> ReadPrec [GetCallerIdentity]
-> Read GetCallerIdentity
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetCallerIdentity]
$creadListPrec :: ReadPrec [GetCallerIdentity]
readPrec :: ReadPrec GetCallerIdentity
$creadPrec :: ReadPrec GetCallerIdentity
readList :: ReadS [GetCallerIdentity]
$creadList :: ReadS [GetCallerIdentity]
readsPrec :: Int -> ReadS GetCallerIdentity
$creadsPrec :: Int -> ReadS GetCallerIdentity
Prelude.Read, Int -> GetCallerIdentity -> ShowS
[GetCallerIdentity] -> ShowS
GetCallerIdentity -> String
(Int -> GetCallerIdentity -> ShowS)
-> (GetCallerIdentity -> String)
-> ([GetCallerIdentity] -> ShowS)
-> Show GetCallerIdentity
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCallerIdentity] -> ShowS
$cshowList :: [GetCallerIdentity] -> ShowS
show :: GetCallerIdentity -> String
$cshow :: GetCallerIdentity -> String
showsPrec :: Int -> GetCallerIdentity -> ShowS
$cshowsPrec :: Int -> GetCallerIdentity -> ShowS
Prelude.Show, (forall x. GetCallerIdentity -> Rep GetCallerIdentity x)
-> (forall x. Rep GetCallerIdentity x -> GetCallerIdentity)
-> Generic GetCallerIdentity
forall x. Rep GetCallerIdentity x -> GetCallerIdentity
forall x. GetCallerIdentity -> Rep GetCallerIdentity x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetCallerIdentity x -> GetCallerIdentity
$cfrom :: forall x. GetCallerIdentity -> Rep GetCallerIdentity x
Prelude.Generic)
newGetCallerIdentity ::
GetCallerIdentity
newGetCallerIdentity :: GetCallerIdentity
newGetCallerIdentity = GetCallerIdentity
GetCallerIdentity'
instance Core.AWSRequest GetCallerIdentity where
type
AWSResponse GetCallerIdentity =
GetCallerIdentityResponse
request :: GetCallerIdentity -> Request GetCallerIdentity
request = Service -> GetCallerIdentity -> Request GetCallerIdentity
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy GetCallerIdentity
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetCallerIdentity)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse GetCallerIdentity))
-> Logger
-> Service
-> Proxy GetCallerIdentity
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetCallerIdentity)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
-> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
Text
"GetCallerIdentityResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe Text
-> Maybe Text -> Maybe Text -> Int -> GetCallerIdentityResponse
GetCallerIdentityResponse'
(Maybe Text
-> Maybe Text -> Maybe Text -> Int -> GetCallerIdentityResponse)
-> Either String (Maybe Text)
-> Either
String
(Maybe Text -> Maybe Text -> Int -> GetCallerIdentityResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Arn")
Either
String
(Maybe Text -> Maybe Text -> Int -> GetCallerIdentityResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> GetCallerIdentityResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Account")
Either String (Maybe Text -> Int -> GetCallerIdentityResponse)
-> Either String (Maybe Text)
-> Either String (Int -> GetCallerIdentityResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"UserId")
Either String (Int -> GetCallerIdentityResponse)
-> Either String Int -> Either String GetCallerIdentityResponse
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 GetCallerIdentity
instance Prelude.NFData GetCallerIdentity
instance Core.ToHeaders GetCallerIdentity where
toHeaders :: GetCallerIdentity -> ResponseHeaders
toHeaders = ResponseHeaders -> GetCallerIdentity -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath GetCallerIdentity where
toPath :: GetCallerIdentity -> ByteString
toPath = ByteString -> GetCallerIdentity -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetCallerIdentity where
toQuery :: GetCallerIdentity -> QueryString
toQuery =
QueryString -> GetCallerIdentity -> QueryString
forall a b. a -> b -> a
Prelude.const
( [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"GetCallerIdentity" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2011-06-15" :: Prelude.ByteString)
]
)
data GetCallerIdentityResponse = GetCallerIdentityResponse'
{
GetCallerIdentityResponse -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
GetCallerIdentityResponse -> Maybe Text
account :: Prelude.Maybe Prelude.Text,
GetCallerIdentityResponse -> Maybe Text
userId :: Prelude.Maybe Prelude.Text,
GetCallerIdentityResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetCallerIdentityResponse -> GetCallerIdentityResponse -> Bool
(GetCallerIdentityResponse -> GetCallerIdentityResponse -> Bool)
-> (GetCallerIdentityResponse -> GetCallerIdentityResponse -> Bool)
-> Eq GetCallerIdentityResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCallerIdentityResponse -> GetCallerIdentityResponse -> Bool
$c/= :: GetCallerIdentityResponse -> GetCallerIdentityResponse -> Bool
== :: GetCallerIdentityResponse -> GetCallerIdentityResponse -> Bool
$c== :: GetCallerIdentityResponse -> GetCallerIdentityResponse -> Bool
Prelude.Eq, ReadPrec [GetCallerIdentityResponse]
ReadPrec GetCallerIdentityResponse
Int -> ReadS GetCallerIdentityResponse
ReadS [GetCallerIdentityResponse]
(Int -> ReadS GetCallerIdentityResponse)
-> ReadS [GetCallerIdentityResponse]
-> ReadPrec GetCallerIdentityResponse
-> ReadPrec [GetCallerIdentityResponse]
-> Read GetCallerIdentityResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetCallerIdentityResponse]
$creadListPrec :: ReadPrec [GetCallerIdentityResponse]
readPrec :: ReadPrec GetCallerIdentityResponse
$creadPrec :: ReadPrec GetCallerIdentityResponse
readList :: ReadS [GetCallerIdentityResponse]
$creadList :: ReadS [GetCallerIdentityResponse]
readsPrec :: Int -> ReadS GetCallerIdentityResponse
$creadsPrec :: Int -> ReadS GetCallerIdentityResponse
Prelude.Read, Int -> GetCallerIdentityResponse -> ShowS
[GetCallerIdentityResponse] -> ShowS
GetCallerIdentityResponse -> String
(Int -> GetCallerIdentityResponse -> ShowS)
-> (GetCallerIdentityResponse -> String)
-> ([GetCallerIdentityResponse] -> ShowS)
-> Show GetCallerIdentityResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCallerIdentityResponse] -> ShowS
$cshowList :: [GetCallerIdentityResponse] -> ShowS
show :: GetCallerIdentityResponse -> String
$cshow :: GetCallerIdentityResponse -> String
showsPrec :: Int -> GetCallerIdentityResponse -> ShowS
$cshowsPrec :: Int -> GetCallerIdentityResponse -> ShowS
Prelude.Show, (forall x.
GetCallerIdentityResponse -> Rep GetCallerIdentityResponse x)
-> (forall x.
Rep GetCallerIdentityResponse x -> GetCallerIdentityResponse)
-> Generic GetCallerIdentityResponse
forall x.
Rep GetCallerIdentityResponse x -> GetCallerIdentityResponse
forall x.
GetCallerIdentityResponse -> Rep GetCallerIdentityResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetCallerIdentityResponse x -> GetCallerIdentityResponse
$cfrom :: forall x.
GetCallerIdentityResponse -> Rep GetCallerIdentityResponse x
Prelude.Generic)
newGetCallerIdentityResponse ::
Prelude.Int ->
GetCallerIdentityResponse
newGetCallerIdentityResponse :: Int -> GetCallerIdentityResponse
newGetCallerIdentityResponse Int
pHttpStatus_ =
GetCallerIdentityResponse' :: Maybe Text
-> Maybe Text -> Maybe Text -> Int -> GetCallerIdentityResponse
GetCallerIdentityResponse'
{ $sel:arn:GetCallerIdentityResponse' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:account:GetCallerIdentityResponse' :: Maybe Text
account = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:userId:GetCallerIdentityResponse' :: Maybe Text
userId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetCallerIdentityResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getCallerIdentityResponse_arn :: Lens.Lens' GetCallerIdentityResponse (Prelude.Maybe Prelude.Text)
getCallerIdentityResponse_arn :: (Maybe Text -> f (Maybe Text))
-> GetCallerIdentityResponse -> f GetCallerIdentityResponse
getCallerIdentityResponse_arn = (GetCallerIdentityResponse -> Maybe Text)
-> (GetCallerIdentityResponse
-> Maybe Text -> GetCallerIdentityResponse)
-> Lens
GetCallerIdentityResponse
GetCallerIdentityResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCallerIdentityResponse' {Maybe Text
arn :: Maybe Text
$sel:arn:GetCallerIdentityResponse' :: GetCallerIdentityResponse -> Maybe Text
arn} -> Maybe Text
arn) (\s :: GetCallerIdentityResponse
s@GetCallerIdentityResponse' {} Maybe Text
a -> GetCallerIdentityResponse
s {$sel:arn:GetCallerIdentityResponse' :: Maybe Text
arn = Maybe Text
a} :: GetCallerIdentityResponse)
getCallerIdentityResponse_account :: Lens.Lens' GetCallerIdentityResponse (Prelude.Maybe Prelude.Text)
getCallerIdentityResponse_account :: (Maybe Text -> f (Maybe Text))
-> GetCallerIdentityResponse -> f GetCallerIdentityResponse
getCallerIdentityResponse_account = (GetCallerIdentityResponse -> Maybe Text)
-> (GetCallerIdentityResponse
-> Maybe Text -> GetCallerIdentityResponse)
-> Lens
GetCallerIdentityResponse
GetCallerIdentityResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCallerIdentityResponse' {Maybe Text
account :: Maybe Text
$sel:account:GetCallerIdentityResponse' :: GetCallerIdentityResponse -> Maybe Text
account} -> Maybe Text
account) (\s :: GetCallerIdentityResponse
s@GetCallerIdentityResponse' {} Maybe Text
a -> GetCallerIdentityResponse
s {$sel:account:GetCallerIdentityResponse' :: Maybe Text
account = Maybe Text
a} :: GetCallerIdentityResponse)
getCallerIdentityResponse_userId :: Lens.Lens' GetCallerIdentityResponse (Prelude.Maybe Prelude.Text)
getCallerIdentityResponse_userId :: (Maybe Text -> f (Maybe Text))
-> GetCallerIdentityResponse -> f GetCallerIdentityResponse
getCallerIdentityResponse_userId = (GetCallerIdentityResponse -> Maybe Text)
-> (GetCallerIdentityResponse
-> Maybe Text -> GetCallerIdentityResponse)
-> Lens
GetCallerIdentityResponse
GetCallerIdentityResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCallerIdentityResponse' {Maybe Text
userId :: Maybe Text
$sel:userId:GetCallerIdentityResponse' :: GetCallerIdentityResponse -> Maybe Text
userId} -> Maybe Text
userId) (\s :: GetCallerIdentityResponse
s@GetCallerIdentityResponse' {} Maybe Text
a -> GetCallerIdentityResponse
s {$sel:userId:GetCallerIdentityResponse' :: Maybe Text
userId = Maybe Text
a} :: GetCallerIdentityResponse)
getCallerIdentityResponse_httpStatus :: Lens.Lens' GetCallerIdentityResponse Prelude.Int
getCallerIdentityResponse_httpStatus :: (Int -> f Int)
-> GetCallerIdentityResponse -> f GetCallerIdentityResponse
getCallerIdentityResponse_httpStatus = (GetCallerIdentityResponse -> Int)
-> (GetCallerIdentityResponse -> Int -> GetCallerIdentityResponse)
-> Lens GetCallerIdentityResponse GetCallerIdentityResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCallerIdentityResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetCallerIdentityResponse' :: GetCallerIdentityResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetCallerIdentityResponse
s@GetCallerIdentityResponse' {} Int
a -> GetCallerIdentityResponse
s {$sel:httpStatus:GetCallerIdentityResponse' :: Int
httpStatus = Int
a} :: GetCallerIdentityResponse)
instance Prelude.NFData GetCallerIdentityResponse