{-# 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.GenerateServiceLastAccessedDetails
(
GenerateServiceLastAccessedDetails (..),
newGenerateServiceLastAccessedDetails,
generateServiceLastAccessedDetails_granularity,
generateServiceLastAccessedDetails_arn,
GenerateServiceLastAccessedDetailsResponse (..),
newGenerateServiceLastAccessedDetailsResponse,
generateServiceLastAccessedDetailsResponse_jobId,
generateServiceLastAccessedDetailsResponse_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 GenerateServiceLastAccessedDetails = GenerateServiceLastAccessedDetails'
{
GenerateServiceLastAccessedDetails
-> Maybe AccessAdvisorUsageGranularityType
granularity :: Prelude.Maybe AccessAdvisorUsageGranularityType,
GenerateServiceLastAccessedDetails -> Text
arn :: Prelude.Text
}
deriving (GenerateServiceLastAccessedDetails
-> GenerateServiceLastAccessedDetails -> Bool
(GenerateServiceLastAccessedDetails
-> GenerateServiceLastAccessedDetails -> Bool)
-> (GenerateServiceLastAccessedDetails
-> GenerateServiceLastAccessedDetails -> Bool)
-> Eq GenerateServiceLastAccessedDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GenerateServiceLastAccessedDetails
-> GenerateServiceLastAccessedDetails -> Bool
$c/= :: GenerateServiceLastAccessedDetails
-> GenerateServiceLastAccessedDetails -> Bool
== :: GenerateServiceLastAccessedDetails
-> GenerateServiceLastAccessedDetails -> Bool
$c== :: GenerateServiceLastAccessedDetails
-> GenerateServiceLastAccessedDetails -> Bool
Prelude.Eq, ReadPrec [GenerateServiceLastAccessedDetails]
ReadPrec GenerateServiceLastAccessedDetails
Int -> ReadS GenerateServiceLastAccessedDetails
ReadS [GenerateServiceLastAccessedDetails]
(Int -> ReadS GenerateServiceLastAccessedDetails)
-> ReadS [GenerateServiceLastAccessedDetails]
-> ReadPrec GenerateServiceLastAccessedDetails
-> ReadPrec [GenerateServiceLastAccessedDetails]
-> Read GenerateServiceLastAccessedDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GenerateServiceLastAccessedDetails]
$creadListPrec :: ReadPrec [GenerateServiceLastAccessedDetails]
readPrec :: ReadPrec GenerateServiceLastAccessedDetails
$creadPrec :: ReadPrec GenerateServiceLastAccessedDetails
readList :: ReadS [GenerateServiceLastAccessedDetails]
$creadList :: ReadS [GenerateServiceLastAccessedDetails]
readsPrec :: Int -> ReadS GenerateServiceLastAccessedDetails
$creadsPrec :: Int -> ReadS GenerateServiceLastAccessedDetails
Prelude.Read, Int -> GenerateServiceLastAccessedDetails -> ShowS
[GenerateServiceLastAccessedDetails] -> ShowS
GenerateServiceLastAccessedDetails -> String
(Int -> GenerateServiceLastAccessedDetails -> ShowS)
-> (GenerateServiceLastAccessedDetails -> String)
-> ([GenerateServiceLastAccessedDetails] -> ShowS)
-> Show GenerateServiceLastAccessedDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GenerateServiceLastAccessedDetails] -> ShowS
$cshowList :: [GenerateServiceLastAccessedDetails] -> ShowS
show :: GenerateServiceLastAccessedDetails -> String
$cshow :: GenerateServiceLastAccessedDetails -> String
showsPrec :: Int -> GenerateServiceLastAccessedDetails -> ShowS
$cshowsPrec :: Int -> GenerateServiceLastAccessedDetails -> ShowS
Prelude.Show, (forall x.
GenerateServiceLastAccessedDetails
-> Rep GenerateServiceLastAccessedDetails x)
-> (forall x.
Rep GenerateServiceLastAccessedDetails x
-> GenerateServiceLastAccessedDetails)
-> Generic GenerateServiceLastAccessedDetails
forall x.
Rep GenerateServiceLastAccessedDetails x
-> GenerateServiceLastAccessedDetails
forall x.
GenerateServiceLastAccessedDetails
-> Rep GenerateServiceLastAccessedDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GenerateServiceLastAccessedDetails x
-> GenerateServiceLastAccessedDetails
$cfrom :: forall x.
GenerateServiceLastAccessedDetails
-> Rep GenerateServiceLastAccessedDetails x
Prelude.Generic)
newGenerateServiceLastAccessedDetails ::
Prelude.Text ->
GenerateServiceLastAccessedDetails
newGenerateServiceLastAccessedDetails :: Text -> GenerateServiceLastAccessedDetails
newGenerateServiceLastAccessedDetails Text
pArn_ =
GenerateServiceLastAccessedDetails' :: Maybe AccessAdvisorUsageGranularityType
-> Text -> GenerateServiceLastAccessedDetails
GenerateServiceLastAccessedDetails'
{ $sel:granularity:GenerateServiceLastAccessedDetails' :: Maybe AccessAdvisorUsageGranularityType
granularity =
Maybe AccessAdvisorUsageGranularityType
forall a. Maybe a
Prelude.Nothing,
$sel:arn:GenerateServiceLastAccessedDetails' :: Text
arn = Text
pArn_
}
generateServiceLastAccessedDetails_granularity :: Lens.Lens' GenerateServiceLastAccessedDetails (Prelude.Maybe AccessAdvisorUsageGranularityType)
generateServiceLastAccessedDetails_granularity :: (Maybe AccessAdvisorUsageGranularityType
-> f (Maybe AccessAdvisorUsageGranularityType))
-> GenerateServiceLastAccessedDetails
-> f GenerateServiceLastAccessedDetails
generateServiceLastAccessedDetails_granularity = (GenerateServiceLastAccessedDetails
-> Maybe AccessAdvisorUsageGranularityType)
-> (GenerateServiceLastAccessedDetails
-> Maybe AccessAdvisorUsageGranularityType
-> GenerateServiceLastAccessedDetails)
-> Lens
GenerateServiceLastAccessedDetails
GenerateServiceLastAccessedDetails
(Maybe AccessAdvisorUsageGranularityType)
(Maybe AccessAdvisorUsageGranularityType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GenerateServiceLastAccessedDetails' {Maybe AccessAdvisorUsageGranularityType
granularity :: Maybe AccessAdvisorUsageGranularityType
$sel:granularity:GenerateServiceLastAccessedDetails' :: GenerateServiceLastAccessedDetails
-> Maybe AccessAdvisorUsageGranularityType
granularity} -> Maybe AccessAdvisorUsageGranularityType
granularity) (\s :: GenerateServiceLastAccessedDetails
s@GenerateServiceLastAccessedDetails' {} Maybe AccessAdvisorUsageGranularityType
a -> GenerateServiceLastAccessedDetails
s {$sel:granularity:GenerateServiceLastAccessedDetails' :: Maybe AccessAdvisorUsageGranularityType
granularity = Maybe AccessAdvisorUsageGranularityType
a} :: GenerateServiceLastAccessedDetails)
generateServiceLastAccessedDetails_arn :: Lens.Lens' GenerateServiceLastAccessedDetails Prelude.Text
generateServiceLastAccessedDetails_arn :: (Text -> f Text)
-> GenerateServiceLastAccessedDetails
-> f GenerateServiceLastAccessedDetails
generateServiceLastAccessedDetails_arn = (GenerateServiceLastAccessedDetails -> Text)
-> (GenerateServiceLastAccessedDetails
-> Text -> GenerateServiceLastAccessedDetails)
-> Lens
GenerateServiceLastAccessedDetails
GenerateServiceLastAccessedDetails
Text
Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GenerateServiceLastAccessedDetails' {Text
arn :: Text
$sel:arn:GenerateServiceLastAccessedDetails' :: GenerateServiceLastAccessedDetails -> Text
arn} -> Text
arn) (\s :: GenerateServiceLastAccessedDetails
s@GenerateServiceLastAccessedDetails' {} Text
a -> GenerateServiceLastAccessedDetails
s {$sel:arn:GenerateServiceLastAccessedDetails' :: Text
arn = Text
a} :: GenerateServiceLastAccessedDetails)
instance
Core.AWSRequest
GenerateServiceLastAccessedDetails
where
type
AWSResponse GenerateServiceLastAccessedDetails =
GenerateServiceLastAccessedDetailsResponse
request :: GenerateServiceLastAccessedDetails
-> Request GenerateServiceLastAccessedDetails
request = Service
-> GenerateServiceLastAccessedDetails
-> Request GenerateServiceLastAccessedDetails
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy GenerateServiceLastAccessedDetails
-> ClientResponse ClientBody
-> m (Either
Error
(ClientResponse (AWSResponse GenerateServiceLastAccessedDetails)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse GenerateServiceLastAccessedDetails))
-> Logger
-> Service
-> Proxy GenerateServiceLastAccessedDetails
-> ClientResponse ClientBody
-> m (Either
Error
(ClientResponse (AWSResponse GenerateServiceLastAccessedDetails)))
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
"GenerateServiceLastAccessedDetailsResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe Text -> Int -> GenerateServiceLastAccessedDetailsResponse
GenerateServiceLastAccessedDetailsResponse'
(Maybe Text -> Int -> GenerateServiceLastAccessedDetailsResponse)
-> Either String (Maybe Text)
-> Either
String (Int -> GenerateServiceLastAccessedDetailsResponse)
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
"JobId")
Either String (Int -> GenerateServiceLastAccessedDetailsResponse)
-> Either String Int
-> Either String GenerateServiceLastAccessedDetailsResponse
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
GenerateServiceLastAccessedDetails
instance
Prelude.NFData
GenerateServiceLastAccessedDetails
instance
Core.ToHeaders
GenerateServiceLastAccessedDetails
where
toHeaders :: GenerateServiceLastAccessedDetails -> ResponseHeaders
toHeaders = ResponseHeaders
-> GenerateServiceLastAccessedDetails -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance
Core.ToPath
GenerateServiceLastAccessedDetails
where
toPath :: GenerateServiceLastAccessedDetails -> ByteString
toPath = ByteString -> GenerateServiceLastAccessedDetails -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance
Core.ToQuery
GenerateServiceLastAccessedDetails
where
toQuery :: GenerateServiceLastAccessedDetails -> QueryString
toQuery GenerateServiceLastAccessedDetails' {Maybe AccessAdvisorUsageGranularityType
Text
arn :: Text
granularity :: Maybe AccessAdvisorUsageGranularityType
$sel:arn:GenerateServiceLastAccessedDetails' :: GenerateServiceLastAccessedDetails -> Text
$sel:granularity:GenerateServiceLastAccessedDetails' :: GenerateServiceLastAccessedDetails
-> Maybe AccessAdvisorUsageGranularityType
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: ( ByteString
"GenerateServiceLastAccessedDetails" ::
Prelude.ByteString
),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-05-08" :: Prelude.ByteString),
ByteString
"Granularity" ByteString
-> Maybe AccessAdvisorUsageGranularityType -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe AccessAdvisorUsageGranularityType
granularity,
ByteString
"Arn" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
arn
]
data GenerateServiceLastAccessedDetailsResponse = GenerateServiceLastAccessedDetailsResponse'
{
GenerateServiceLastAccessedDetailsResponse -> Maybe Text
jobId :: Prelude.Maybe Prelude.Text,
GenerateServiceLastAccessedDetailsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GenerateServiceLastAccessedDetailsResponse
-> GenerateServiceLastAccessedDetailsResponse -> Bool
(GenerateServiceLastAccessedDetailsResponse
-> GenerateServiceLastAccessedDetailsResponse -> Bool)
-> (GenerateServiceLastAccessedDetailsResponse
-> GenerateServiceLastAccessedDetailsResponse -> Bool)
-> Eq GenerateServiceLastAccessedDetailsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GenerateServiceLastAccessedDetailsResponse
-> GenerateServiceLastAccessedDetailsResponse -> Bool
$c/= :: GenerateServiceLastAccessedDetailsResponse
-> GenerateServiceLastAccessedDetailsResponse -> Bool
== :: GenerateServiceLastAccessedDetailsResponse
-> GenerateServiceLastAccessedDetailsResponse -> Bool
$c== :: GenerateServiceLastAccessedDetailsResponse
-> GenerateServiceLastAccessedDetailsResponse -> Bool
Prelude.Eq, ReadPrec [GenerateServiceLastAccessedDetailsResponse]
ReadPrec GenerateServiceLastAccessedDetailsResponse
Int -> ReadS GenerateServiceLastAccessedDetailsResponse
ReadS [GenerateServiceLastAccessedDetailsResponse]
(Int -> ReadS GenerateServiceLastAccessedDetailsResponse)
-> ReadS [GenerateServiceLastAccessedDetailsResponse]
-> ReadPrec GenerateServiceLastAccessedDetailsResponse
-> ReadPrec [GenerateServiceLastAccessedDetailsResponse]
-> Read GenerateServiceLastAccessedDetailsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GenerateServiceLastAccessedDetailsResponse]
$creadListPrec :: ReadPrec [GenerateServiceLastAccessedDetailsResponse]
readPrec :: ReadPrec GenerateServiceLastAccessedDetailsResponse
$creadPrec :: ReadPrec GenerateServiceLastAccessedDetailsResponse
readList :: ReadS [GenerateServiceLastAccessedDetailsResponse]
$creadList :: ReadS [GenerateServiceLastAccessedDetailsResponse]
readsPrec :: Int -> ReadS GenerateServiceLastAccessedDetailsResponse
$creadsPrec :: Int -> ReadS GenerateServiceLastAccessedDetailsResponse
Prelude.Read, Int -> GenerateServiceLastAccessedDetailsResponse -> ShowS
[GenerateServiceLastAccessedDetailsResponse] -> ShowS
GenerateServiceLastAccessedDetailsResponse -> String
(Int -> GenerateServiceLastAccessedDetailsResponse -> ShowS)
-> (GenerateServiceLastAccessedDetailsResponse -> String)
-> ([GenerateServiceLastAccessedDetailsResponse] -> ShowS)
-> Show GenerateServiceLastAccessedDetailsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GenerateServiceLastAccessedDetailsResponse] -> ShowS
$cshowList :: [GenerateServiceLastAccessedDetailsResponse] -> ShowS
show :: GenerateServiceLastAccessedDetailsResponse -> String
$cshow :: GenerateServiceLastAccessedDetailsResponse -> String
showsPrec :: Int -> GenerateServiceLastAccessedDetailsResponse -> ShowS
$cshowsPrec :: Int -> GenerateServiceLastAccessedDetailsResponse -> ShowS
Prelude.Show, (forall x.
GenerateServiceLastAccessedDetailsResponse
-> Rep GenerateServiceLastAccessedDetailsResponse x)
-> (forall x.
Rep GenerateServiceLastAccessedDetailsResponse x
-> GenerateServiceLastAccessedDetailsResponse)
-> Generic GenerateServiceLastAccessedDetailsResponse
forall x.
Rep GenerateServiceLastAccessedDetailsResponse x
-> GenerateServiceLastAccessedDetailsResponse
forall x.
GenerateServiceLastAccessedDetailsResponse
-> Rep GenerateServiceLastAccessedDetailsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GenerateServiceLastAccessedDetailsResponse x
-> GenerateServiceLastAccessedDetailsResponse
$cfrom :: forall x.
GenerateServiceLastAccessedDetailsResponse
-> Rep GenerateServiceLastAccessedDetailsResponse x
Prelude.Generic)
newGenerateServiceLastAccessedDetailsResponse ::
Prelude.Int ->
GenerateServiceLastAccessedDetailsResponse
newGenerateServiceLastAccessedDetailsResponse :: Int -> GenerateServiceLastAccessedDetailsResponse
newGenerateServiceLastAccessedDetailsResponse
Int
pHttpStatus_ =
GenerateServiceLastAccessedDetailsResponse' :: Maybe Text -> Int -> GenerateServiceLastAccessedDetailsResponse
GenerateServiceLastAccessedDetailsResponse'
{ $sel:jobId:GenerateServiceLastAccessedDetailsResponse' :: Maybe Text
jobId =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GenerateServiceLastAccessedDetailsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
generateServiceLastAccessedDetailsResponse_jobId :: Lens.Lens' GenerateServiceLastAccessedDetailsResponse (Prelude.Maybe Prelude.Text)
generateServiceLastAccessedDetailsResponse_jobId :: (Maybe Text -> f (Maybe Text))
-> GenerateServiceLastAccessedDetailsResponse
-> f GenerateServiceLastAccessedDetailsResponse
generateServiceLastAccessedDetailsResponse_jobId = (GenerateServiceLastAccessedDetailsResponse -> Maybe Text)
-> (GenerateServiceLastAccessedDetailsResponse
-> Maybe Text -> GenerateServiceLastAccessedDetailsResponse)
-> Lens
GenerateServiceLastAccessedDetailsResponse
GenerateServiceLastAccessedDetailsResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GenerateServiceLastAccessedDetailsResponse' {Maybe Text
jobId :: Maybe Text
$sel:jobId:GenerateServiceLastAccessedDetailsResponse' :: GenerateServiceLastAccessedDetailsResponse -> Maybe Text
jobId} -> Maybe Text
jobId) (\s :: GenerateServiceLastAccessedDetailsResponse
s@GenerateServiceLastAccessedDetailsResponse' {} Maybe Text
a -> GenerateServiceLastAccessedDetailsResponse
s {$sel:jobId:GenerateServiceLastAccessedDetailsResponse' :: Maybe Text
jobId = Maybe Text
a} :: GenerateServiceLastAccessedDetailsResponse)
generateServiceLastAccessedDetailsResponse_httpStatus :: Lens.Lens' GenerateServiceLastAccessedDetailsResponse Prelude.Int
generateServiceLastAccessedDetailsResponse_httpStatus :: (Int -> f Int)
-> GenerateServiceLastAccessedDetailsResponse
-> f GenerateServiceLastAccessedDetailsResponse
generateServiceLastAccessedDetailsResponse_httpStatus = (GenerateServiceLastAccessedDetailsResponse -> Int)
-> (GenerateServiceLastAccessedDetailsResponse
-> Int -> GenerateServiceLastAccessedDetailsResponse)
-> Lens
GenerateServiceLastAccessedDetailsResponse
GenerateServiceLastAccessedDetailsResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GenerateServiceLastAccessedDetailsResponse' {Int
httpStatus :: Int
$sel:httpStatus:GenerateServiceLastAccessedDetailsResponse' :: GenerateServiceLastAccessedDetailsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GenerateServiceLastAccessedDetailsResponse
s@GenerateServiceLastAccessedDetailsResponse' {} Int
a -> GenerateServiceLastAccessedDetailsResponse
s {$sel:httpStatus:GenerateServiceLastAccessedDetailsResponse' :: Int
httpStatus = Int
a} :: GenerateServiceLastAccessedDetailsResponse)
instance
Prelude.NFData
GenerateServiceLastAccessedDetailsResponse