{-# 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.GetAccessKeyInfo
(
GetAccessKeyInfo (..),
newGetAccessKeyInfo,
getAccessKeyInfo_accessKeyId,
GetAccessKeyInfoResponse (..),
newGetAccessKeyInfoResponse,
getAccessKeyInfoResponse_account,
getAccessKeyInfoResponse_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 GetAccessKeyInfo = GetAccessKeyInfo'
{
GetAccessKeyInfo -> AccessKey
accessKeyId :: Core.AccessKey
}
deriving (GetAccessKeyInfo -> GetAccessKeyInfo -> Bool
(GetAccessKeyInfo -> GetAccessKeyInfo -> Bool)
-> (GetAccessKeyInfo -> GetAccessKeyInfo -> Bool)
-> Eq GetAccessKeyInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetAccessKeyInfo -> GetAccessKeyInfo -> Bool
$c/= :: GetAccessKeyInfo -> GetAccessKeyInfo -> Bool
== :: GetAccessKeyInfo -> GetAccessKeyInfo -> Bool
$c== :: GetAccessKeyInfo -> GetAccessKeyInfo -> Bool
Prelude.Eq, ReadPrec [GetAccessKeyInfo]
ReadPrec GetAccessKeyInfo
Int -> ReadS GetAccessKeyInfo
ReadS [GetAccessKeyInfo]
(Int -> ReadS GetAccessKeyInfo)
-> ReadS [GetAccessKeyInfo]
-> ReadPrec GetAccessKeyInfo
-> ReadPrec [GetAccessKeyInfo]
-> Read GetAccessKeyInfo
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetAccessKeyInfo]
$creadListPrec :: ReadPrec [GetAccessKeyInfo]
readPrec :: ReadPrec GetAccessKeyInfo
$creadPrec :: ReadPrec GetAccessKeyInfo
readList :: ReadS [GetAccessKeyInfo]
$creadList :: ReadS [GetAccessKeyInfo]
readsPrec :: Int -> ReadS GetAccessKeyInfo
$creadsPrec :: Int -> ReadS GetAccessKeyInfo
Prelude.Read, Int -> GetAccessKeyInfo -> ShowS
[GetAccessKeyInfo] -> ShowS
GetAccessKeyInfo -> String
(Int -> GetAccessKeyInfo -> ShowS)
-> (GetAccessKeyInfo -> String)
-> ([GetAccessKeyInfo] -> ShowS)
-> Show GetAccessKeyInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetAccessKeyInfo] -> ShowS
$cshowList :: [GetAccessKeyInfo] -> ShowS
show :: GetAccessKeyInfo -> String
$cshow :: GetAccessKeyInfo -> String
showsPrec :: Int -> GetAccessKeyInfo -> ShowS
$cshowsPrec :: Int -> GetAccessKeyInfo -> ShowS
Prelude.Show, (forall x. GetAccessKeyInfo -> Rep GetAccessKeyInfo x)
-> (forall x. Rep GetAccessKeyInfo x -> GetAccessKeyInfo)
-> Generic GetAccessKeyInfo
forall x. Rep GetAccessKeyInfo x -> GetAccessKeyInfo
forall x. GetAccessKeyInfo -> Rep GetAccessKeyInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetAccessKeyInfo x -> GetAccessKeyInfo
$cfrom :: forall x. GetAccessKeyInfo -> Rep GetAccessKeyInfo x
Prelude.Generic)
newGetAccessKeyInfo ::
Core.AccessKey ->
GetAccessKeyInfo
newGetAccessKeyInfo :: AccessKey -> GetAccessKeyInfo
newGetAccessKeyInfo AccessKey
pAccessKeyId_ =
GetAccessKeyInfo' :: AccessKey -> GetAccessKeyInfo
GetAccessKeyInfo' {$sel:accessKeyId:GetAccessKeyInfo' :: AccessKey
accessKeyId = AccessKey
pAccessKeyId_}
getAccessKeyInfo_accessKeyId :: Lens.Lens' GetAccessKeyInfo Core.AccessKey
getAccessKeyInfo_accessKeyId :: (AccessKey -> f AccessKey)
-> GetAccessKeyInfo -> f GetAccessKeyInfo
getAccessKeyInfo_accessKeyId = (GetAccessKeyInfo -> AccessKey)
-> (GetAccessKeyInfo -> AccessKey -> GetAccessKeyInfo)
-> Lens GetAccessKeyInfo GetAccessKeyInfo AccessKey AccessKey
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAccessKeyInfo' {AccessKey
accessKeyId :: AccessKey
$sel:accessKeyId:GetAccessKeyInfo' :: GetAccessKeyInfo -> AccessKey
accessKeyId} -> AccessKey
accessKeyId) (\s :: GetAccessKeyInfo
s@GetAccessKeyInfo' {} AccessKey
a -> GetAccessKeyInfo
s {$sel:accessKeyId:GetAccessKeyInfo' :: AccessKey
accessKeyId = AccessKey
a} :: GetAccessKeyInfo)
instance Core.AWSRequest GetAccessKeyInfo where
type
AWSResponse GetAccessKeyInfo =
GetAccessKeyInfoResponse
request :: GetAccessKeyInfo -> Request GetAccessKeyInfo
request = Service -> GetAccessKeyInfo -> Request GetAccessKeyInfo
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy GetAccessKeyInfo
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetAccessKeyInfo)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse GetAccessKeyInfo))
-> Logger
-> Service
-> Proxy GetAccessKeyInfo
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetAccessKeyInfo)))
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
"GetAccessKeyInfoResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe Text -> Int -> GetAccessKeyInfoResponse
GetAccessKeyInfoResponse'
(Maybe Text -> Int -> GetAccessKeyInfoResponse)
-> Either String (Maybe Text)
-> Either String (Int -> GetAccessKeyInfoResponse)
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
"Account")
Either String (Int -> GetAccessKeyInfoResponse)
-> Either String Int -> Either String GetAccessKeyInfoResponse
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 GetAccessKeyInfo
instance Prelude.NFData GetAccessKeyInfo
instance Core.ToHeaders GetAccessKeyInfo where
toHeaders :: GetAccessKeyInfo -> ResponseHeaders
toHeaders = ResponseHeaders -> GetAccessKeyInfo -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath GetAccessKeyInfo where
toPath :: GetAccessKeyInfo -> ByteString
toPath = ByteString -> GetAccessKeyInfo -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetAccessKeyInfo where
toQuery :: GetAccessKeyInfo -> QueryString
toQuery GetAccessKeyInfo' {AccessKey
accessKeyId :: AccessKey
$sel:accessKeyId:GetAccessKeyInfo' :: GetAccessKeyInfo -> AccessKey
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"GetAccessKeyInfo" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2011-06-15" :: Prelude.ByteString),
ByteString
"AccessKeyId" ByteString -> AccessKey -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: AccessKey
accessKeyId
]
data GetAccessKeyInfoResponse = GetAccessKeyInfoResponse'
{
GetAccessKeyInfoResponse -> Maybe Text
account :: Prelude.Maybe Prelude.Text,
GetAccessKeyInfoResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetAccessKeyInfoResponse -> GetAccessKeyInfoResponse -> Bool
(GetAccessKeyInfoResponse -> GetAccessKeyInfoResponse -> Bool)
-> (GetAccessKeyInfoResponse -> GetAccessKeyInfoResponse -> Bool)
-> Eq GetAccessKeyInfoResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetAccessKeyInfoResponse -> GetAccessKeyInfoResponse -> Bool
$c/= :: GetAccessKeyInfoResponse -> GetAccessKeyInfoResponse -> Bool
== :: GetAccessKeyInfoResponse -> GetAccessKeyInfoResponse -> Bool
$c== :: GetAccessKeyInfoResponse -> GetAccessKeyInfoResponse -> Bool
Prelude.Eq, ReadPrec [GetAccessKeyInfoResponse]
ReadPrec GetAccessKeyInfoResponse
Int -> ReadS GetAccessKeyInfoResponse
ReadS [GetAccessKeyInfoResponse]
(Int -> ReadS GetAccessKeyInfoResponse)
-> ReadS [GetAccessKeyInfoResponse]
-> ReadPrec GetAccessKeyInfoResponse
-> ReadPrec [GetAccessKeyInfoResponse]
-> Read GetAccessKeyInfoResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetAccessKeyInfoResponse]
$creadListPrec :: ReadPrec [GetAccessKeyInfoResponse]
readPrec :: ReadPrec GetAccessKeyInfoResponse
$creadPrec :: ReadPrec GetAccessKeyInfoResponse
readList :: ReadS [GetAccessKeyInfoResponse]
$creadList :: ReadS [GetAccessKeyInfoResponse]
readsPrec :: Int -> ReadS GetAccessKeyInfoResponse
$creadsPrec :: Int -> ReadS GetAccessKeyInfoResponse
Prelude.Read, Int -> GetAccessKeyInfoResponse -> ShowS
[GetAccessKeyInfoResponse] -> ShowS
GetAccessKeyInfoResponse -> String
(Int -> GetAccessKeyInfoResponse -> ShowS)
-> (GetAccessKeyInfoResponse -> String)
-> ([GetAccessKeyInfoResponse] -> ShowS)
-> Show GetAccessKeyInfoResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetAccessKeyInfoResponse] -> ShowS
$cshowList :: [GetAccessKeyInfoResponse] -> ShowS
show :: GetAccessKeyInfoResponse -> String
$cshow :: GetAccessKeyInfoResponse -> String
showsPrec :: Int -> GetAccessKeyInfoResponse -> ShowS
$cshowsPrec :: Int -> GetAccessKeyInfoResponse -> ShowS
Prelude.Show, (forall x.
GetAccessKeyInfoResponse -> Rep GetAccessKeyInfoResponse x)
-> (forall x.
Rep GetAccessKeyInfoResponse x -> GetAccessKeyInfoResponse)
-> Generic GetAccessKeyInfoResponse
forall x.
Rep GetAccessKeyInfoResponse x -> GetAccessKeyInfoResponse
forall x.
GetAccessKeyInfoResponse -> Rep GetAccessKeyInfoResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetAccessKeyInfoResponse x -> GetAccessKeyInfoResponse
$cfrom :: forall x.
GetAccessKeyInfoResponse -> Rep GetAccessKeyInfoResponse x
Prelude.Generic)
newGetAccessKeyInfoResponse ::
Prelude.Int ->
GetAccessKeyInfoResponse
newGetAccessKeyInfoResponse :: Int -> GetAccessKeyInfoResponse
newGetAccessKeyInfoResponse Int
pHttpStatus_ =
GetAccessKeyInfoResponse' :: Maybe Text -> Int -> GetAccessKeyInfoResponse
GetAccessKeyInfoResponse'
{ $sel:account:GetAccessKeyInfoResponse' :: Maybe Text
account =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetAccessKeyInfoResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getAccessKeyInfoResponse_account :: Lens.Lens' GetAccessKeyInfoResponse (Prelude.Maybe Prelude.Text)
getAccessKeyInfoResponse_account :: (Maybe Text -> f (Maybe Text))
-> GetAccessKeyInfoResponse -> f GetAccessKeyInfoResponse
getAccessKeyInfoResponse_account = (GetAccessKeyInfoResponse -> Maybe Text)
-> (GetAccessKeyInfoResponse
-> Maybe Text -> GetAccessKeyInfoResponse)
-> Lens
GetAccessKeyInfoResponse
GetAccessKeyInfoResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAccessKeyInfoResponse' {Maybe Text
account :: Maybe Text
$sel:account:GetAccessKeyInfoResponse' :: GetAccessKeyInfoResponse -> Maybe Text
account} -> Maybe Text
account) (\s :: GetAccessKeyInfoResponse
s@GetAccessKeyInfoResponse' {} Maybe Text
a -> GetAccessKeyInfoResponse
s {$sel:account:GetAccessKeyInfoResponse' :: Maybe Text
account = Maybe Text
a} :: GetAccessKeyInfoResponse)
getAccessKeyInfoResponse_httpStatus :: Lens.Lens' GetAccessKeyInfoResponse Prelude.Int
getAccessKeyInfoResponse_httpStatus :: (Int -> f Int)
-> GetAccessKeyInfoResponse -> f GetAccessKeyInfoResponse
getAccessKeyInfoResponse_httpStatus = (GetAccessKeyInfoResponse -> Int)
-> (GetAccessKeyInfoResponse -> Int -> GetAccessKeyInfoResponse)
-> Lens GetAccessKeyInfoResponse GetAccessKeyInfoResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAccessKeyInfoResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetAccessKeyInfoResponse' :: GetAccessKeyInfoResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetAccessKeyInfoResponse
s@GetAccessKeyInfoResponse' {} Int
a -> GetAccessKeyInfoResponse
s {$sel:httpStatus:GetAccessKeyInfoResponse' :: Int
httpStatus = Int
a} :: GetAccessKeyInfoResponse)
instance Prelude.NFData GetAccessKeyInfoResponse