{-# 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.IAM.GetAccountSummary
(
GetAccountSummary (..),
newGetAccountSummary,
GetAccountSummaryResponse (..),
newGetAccountSummaryResponse,
getAccountSummaryResponse_summaryMap,
getAccountSummaryResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.IAM.Types
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 GetAccountSummary = GetAccountSummary'
{
}
deriving (GetAccountSummary -> GetAccountSummary -> Bool
(GetAccountSummary -> GetAccountSummary -> Bool)
-> (GetAccountSummary -> GetAccountSummary -> Bool)
-> Eq GetAccountSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetAccountSummary -> GetAccountSummary -> Bool
$c/= :: GetAccountSummary -> GetAccountSummary -> Bool
== :: GetAccountSummary -> GetAccountSummary -> Bool
$c== :: GetAccountSummary -> GetAccountSummary -> Bool
Prelude.Eq, ReadPrec [GetAccountSummary]
ReadPrec GetAccountSummary
Int -> ReadS GetAccountSummary
ReadS [GetAccountSummary]
(Int -> ReadS GetAccountSummary)
-> ReadS [GetAccountSummary]
-> ReadPrec GetAccountSummary
-> ReadPrec [GetAccountSummary]
-> Read GetAccountSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetAccountSummary]
$creadListPrec :: ReadPrec [GetAccountSummary]
readPrec :: ReadPrec GetAccountSummary
$creadPrec :: ReadPrec GetAccountSummary
readList :: ReadS [GetAccountSummary]
$creadList :: ReadS [GetAccountSummary]
readsPrec :: Int -> ReadS GetAccountSummary
$creadsPrec :: Int -> ReadS GetAccountSummary
Prelude.Read, Int -> GetAccountSummary -> ShowS
[GetAccountSummary] -> ShowS
GetAccountSummary -> String
(Int -> GetAccountSummary -> ShowS)
-> (GetAccountSummary -> String)
-> ([GetAccountSummary] -> ShowS)
-> Show GetAccountSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetAccountSummary] -> ShowS
$cshowList :: [GetAccountSummary] -> ShowS
show :: GetAccountSummary -> String
$cshow :: GetAccountSummary -> String
showsPrec :: Int -> GetAccountSummary -> ShowS
$cshowsPrec :: Int -> GetAccountSummary -> ShowS
Prelude.Show, (forall x. GetAccountSummary -> Rep GetAccountSummary x)
-> (forall x. Rep GetAccountSummary x -> GetAccountSummary)
-> Generic GetAccountSummary
forall x. Rep GetAccountSummary x -> GetAccountSummary
forall x. GetAccountSummary -> Rep GetAccountSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetAccountSummary x -> GetAccountSummary
$cfrom :: forall x. GetAccountSummary -> Rep GetAccountSummary x
Prelude.Generic)
newGetAccountSummary ::
GetAccountSummary
newGetAccountSummary :: GetAccountSummary
newGetAccountSummary = GetAccountSummary
GetAccountSummary'
instance Core.AWSRequest GetAccountSummary where
type
AWSResponse GetAccountSummary =
GetAccountSummaryResponse
request :: GetAccountSummary -> Request GetAccountSummary
request = Service -> GetAccountSummary -> Request GetAccountSummary
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy GetAccountSummary
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetAccountSummary)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse GetAccountSummary))
-> Logger
-> Service
-> Proxy GetAccountSummary
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetAccountSummary)))
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
"GetAccountSummaryResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe (HashMap SummaryKeyType Int)
-> Int -> GetAccountSummaryResponse
GetAccountSummaryResponse'
(Maybe (HashMap SummaryKeyType Int)
-> Int -> GetAccountSummaryResponse)
-> Either String (Maybe (HashMap SummaryKeyType Int))
-> Either String (Int -> GetAccountSummaryResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"SummaryMap" Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
Either String [Node]
-> ([Node] -> Either String (Maybe (HashMap SummaryKeyType Int)))
-> Either String (Maybe (HashMap SummaryKeyType Int))
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String (HashMap SummaryKeyType Int))
-> [Node] -> Either String (Maybe (HashMap SummaryKeyType Int))
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text
-> Text
-> Text
-> [Node]
-> Either String (HashMap SummaryKeyType Int)
forall k v.
(Eq k, Hashable k, FromText k, FromXML v) =>
Text -> Text -> Text -> [Node] -> Either String (HashMap k v)
Core.parseXMLMap Text
"entry" Text
"key" Text
"value")
)
Either String (Int -> GetAccountSummaryResponse)
-> Either String Int -> Either String GetAccountSummaryResponse
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 GetAccountSummary
instance Prelude.NFData GetAccountSummary
instance Core.ToHeaders GetAccountSummary where
toHeaders :: GetAccountSummary -> ResponseHeaders
toHeaders = ResponseHeaders -> GetAccountSummary -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath GetAccountSummary where
toPath :: GetAccountSummary -> ByteString
toPath = ByteString -> GetAccountSummary -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetAccountSummary where
toQuery :: GetAccountSummary -> QueryString
toQuery =
QueryString -> GetAccountSummary -> 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
"GetAccountSummary" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-05-08" :: Prelude.ByteString)
]
)
data GetAccountSummaryResponse = GetAccountSummaryResponse'
{
GetAccountSummaryResponse -> Maybe (HashMap SummaryKeyType Int)
summaryMap :: Prelude.Maybe (Prelude.HashMap SummaryKeyType Prelude.Int),
GetAccountSummaryResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetAccountSummaryResponse -> GetAccountSummaryResponse -> Bool
(GetAccountSummaryResponse -> GetAccountSummaryResponse -> Bool)
-> (GetAccountSummaryResponse -> GetAccountSummaryResponse -> Bool)
-> Eq GetAccountSummaryResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetAccountSummaryResponse -> GetAccountSummaryResponse -> Bool
$c/= :: GetAccountSummaryResponse -> GetAccountSummaryResponse -> Bool
== :: GetAccountSummaryResponse -> GetAccountSummaryResponse -> Bool
$c== :: GetAccountSummaryResponse -> GetAccountSummaryResponse -> Bool
Prelude.Eq, ReadPrec [GetAccountSummaryResponse]
ReadPrec GetAccountSummaryResponse
Int -> ReadS GetAccountSummaryResponse
ReadS [GetAccountSummaryResponse]
(Int -> ReadS GetAccountSummaryResponse)
-> ReadS [GetAccountSummaryResponse]
-> ReadPrec GetAccountSummaryResponse
-> ReadPrec [GetAccountSummaryResponse]
-> Read GetAccountSummaryResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetAccountSummaryResponse]
$creadListPrec :: ReadPrec [GetAccountSummaryResponse]
readPrec :: ReadPrec GetAccountSummaryResponse
$creadPrec :: ReadPrec GetAccountSummaryResponse
readList :: ReadS [GetAccountSummaryResponse]
$creadList :: ReadS [GetAccountSummaryResponse]
readsPrec :: Int -> ReadS GetAccountSummaryResponse
$creadsPrec :: Int -> ReadS GetAccountSummaryResponse
Prelude.Read, Int -> GetAccountSummaryResponse -> ShowS
[GetAccountSummaryResponse] -> ShowS
GetAccountSummaryResponse -> String
(Int -> GetAccountSummaryResponse -> ShowS)
-> (GetAccountSummaryResponse -> String)
-> ([GetAccountSummaryResponse] -> ShowS)
-> Show GetAccountSummaryResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetAccountSummaryResponse] -> ShowS
$cshowList :: [GetAccountSummaryResponse] -> ShowS
show :: GetAccountSummaryResponse -> String
$cshow :: GetAccountSummaryResponse -> String
showsPrec :: Int -> GetAccountSummaryResponse -> ShowS
$cshowsPrec :: Int -> GetAccountSummaryResponse -> ShowS
Prelude.Show, (forall x.
GetAccountSummaryResponse -> Rep GetAccountSummaryResponse x)
-> (forall x.
Rep GetAccountSummaryResponse x -> GetAccountSummaryResponse)
-> Generic GetAccountSummaryResponse
forall x.
Rep GetAccountSummaryResponse x -> GetAccountSummaryResponse
forall x.
GetAccountSummaryResponse -> Rep GetAccountSummaryResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetAccountSummaryResponse x -> GetAccountSummaryResponse
$cfrom :: forall x.
GetAccountSummaryResponse -> Rep GetAccountSummaryResponse x
Prelude.Generic)
newGetAccountSummaryResponse ::
Prelude.Int ->
GetAccountSummaryResponse
newGetAccountSummaryResponse :: Int -> GetAccountSummaryResponse
newGetAccountSummaryResponse Int
pHttpStatus_ =
GetAccountSummaryResponse' :: Maybe (HashMap SummaryKeyType Int)
-> Int -> GetAccountSummaryResponse
GetAccountSummaryResponse'
{ $sel:summaryMap:GetAccountSummaryResponse' :: Maybe (HashMap SummaryKeyType Int)
summaryMap =
Maybe (HashMap SummaryKeyType Int)
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetAccountSummaryResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getAccountSummaryResponse_summaryMap :: Lens.Lens' GetAccountSummaryResponse (Prelude.Maybe (Prelude.HashMap SummaryKeyType Prelude.Int))
getAccountSummaryResponse_summaryMap :: (Maybe (HashMap SummaryKeyType Int)
-> f (Maybe (HashMap SummaryKeyType Int)))
-> GetAccountSummaryResponse -> f GetAccountSummaryResponse
getAccountSummaryResponse_summaryMap = (GetAccountSummaryResponse -> Maybe (HashMap SummaryKeyType Int))
-> (GetAccountSummaryResponse
-> Maybe (HashMap SummaryKeyType Int) -> GetAccountSummaryResponse)
-> Lens
GetAccountSummaryResponse
GetAccountSummaryResponse
(Maybe (HashMap SummaryKeyType Int))
(Maybe (HashMap SummaryKeyType Int))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAccountSummaryResponse' {Maybe (HashMap SummaryKeyType Int)
summaryMap :: Maybe (HashMap SummaryKeyType Int)
$sel:summaryMap:GetAccountSummaryResponse' :: GetAccountSummaryResponse -> Maybe (HashMap SummaryKeyType Int)
summaryMap} -> Maybe (HashMap SummaryKeyType Int)
summaryMap) (\s :: GetAccountSummaryResponse
s@GetAccountSummaryResponse' {} Maybe (HashMap SummaryKeyType Int)
a -> GetAccountSummaryResponse
s {$sel:summaryMap:GetAccountSummaryResponse' :: Maybe (HashMap SummaryKeyType Int)
summaryMap = Maybe (HashMap SummaryKeyType Int)
a} :: GetAccountSummaryResponse) ((Maybe (HashMap SummaryKeyType Int)
-> f (Maybe (HashMap SummaryKeyType Int)))
-> GetAccountSummaryResponse -> f GetAccountSummaryResponse)
-> ((Maybe (HashMap SummaryKeyType Int)
-> f (Maybe (HashMap SummaryKeyType Int)))
-> Maybe (HashMap SummaryKeyType Int)
-> f (Maybe (HashMap SummaryKeyType Int)))
-> (Maybe (HashMap SummaryKeyType Int)
-> f (Maybe (HashMap SummaryKeyType Int)))
-> GetAccountSummaryResponse
-> f GetAccountSummaryResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap SummaryKeyType Int)
(HashMap SummaryKeyType Int)
(HashMap SummaryKeyType Int)
(HashMap SummaryKeyType Int)
-> Iso
(Maybe (HashMap SummaryKeyType Int))
(Maybe (HashMap SummaryKeyType Int))
(Maybe (HashMap SummaryKeyType Int))
(Maybe (HashMap SummaryKeyType Int))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
(HashMap SummaryKeyType Int)
(HashMap SummaryKeyType Int)
(HashMap SummaryKeyType Int)
(HashMap SummaryKeyType Int)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getAccountSummaryResponse_httpStatus :: Lens.Lens' GetAccountSummaryResponse Prelude.Int
getAccountSummaryResponse_httpStatus :: (Int -> f Int)
-> GetAccountSummaryResponse -> f GetAccountSummaryResponse
getAccountSummaryResponse_httpStatus = (GetAccountSummaryResponse -> Int)
-> (GetAccountSummaryResponse -> Int -> GetAccountSummaryResponse)
-> Lens GetAccountSummaryResponse GetAccountSummaryResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAccountSummaryResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetAccountSummaryResponse' :: GetAccountSummaryResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetAccountSummaryResponse
s@GetAccountSummaryResponse' {} Int
a -> GetAccountSummaryResponse
s {$sel:httpStatus:GetAccountSummaryResponse' :: Int
httpStatus = Int
a} :: GetAccountSummaryResponse)
instance Prelude.NFData GetAccountSummaryResponse