{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Network.AWS.STS.GetCallerIdentity
(
getCallerIdentity
, GetCallerIdentity
, getCallerIdentityResponse
, GetCallerIdentityResponse
, gcirsARN
, gcirsAccount
, gcirsUserId
, gcirsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
import Network.AWS.STS.Types
import Network.AWS.STS.Types.Product
data GetCallerIdentity =
GetCallerIdentity'
deriving (Eq, Read, Show, Data, Typeable, Generic)
getCallerIdentity
:: GetCallerIdentity
getCallerIdentity = GetCallerIdentity'
instance AWSRequest GetCallerIdentity where
type Rs GetCallerIdentity = GetCallerIdentityResponse
request = postQuery sts
response
= receiveXMLWrapper "GetCallerIdentityResult"
(\ s h x ->
GetCallerIdentityResponse' <$>
(x .@? "Arn") <*> (x .@? "Account") <*>
(x .@? "UserId")
<*> (pure (fromEnum s)))
instance Hashable GetCallerIdentity where
instance NFData GetCallerIdentity where
instance ToHeaders GetCallerIdentity where
toHeaders = const mempty
instance ToPath GetCallerIdentity where
toPath = const "/"
instance ToQuery GetCallerIdentity where
toQuery
= const
(mconcat
["Action" =: ("GetCallerIdentity" :: ByteString),
"Version" =: ("2011-06-15" :: ByteString)])
data GetCallerIdentityResponse = GetCallerIdentityResponse'
{ _gcirsARN :: !(Maybe Text)
, _gcirsAccount :: !(Maybe Text)
, _gcirsUserId :: !(Maybe Text)
, _gcirsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getCallerIdentityResponse
:: Int
-> GetCallerIdentityResponse
getCallerIdentityResponse pResponseStatus_ =
GetCallerIdentityResponse'
{ _gcirsARN = Nothing
, _gcirsAccount = Nothing
, _gcirsUserId = Nothing
, _gcirsResponseStatus = pResponseStatus_
}
gcirsARN :: Lens' GetCallerIdentityResponse (Maybe Text)
gcirsARN = lens _gcirsARN (\ s a -> s{_gcirsARN = a})
gcirsAccount :: Lens' GetCallerIdentityResponse (Maybe Text)
gcirsAccount = lens _gcirsAccount (\ s a -> s{_gcirsAccount = a})
gcirsUserId :: Lens' GetCallerIdentityResponse (Maybe Text)
gcirsUserId = lens _gcirsUserId (\ s a -> s{_gcirsUserId = a})
gcirsResponseStatus :: Lens' GetCallerIdentityResponse Int
gcirsResponseStatus = lens _gcirsResponseStatus (\ s a -> s{_gcirsResponseStatus = a})
instance NFData GetCallerIdentityResponse where