{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.IAM.GenerateServiceLastAccessedDetails
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Generates a report that includes details about when an IAM resource
-- (user, group, role, or policy) was last used in an attempt to access
-- Amazon Web Services services. Recent activity usually appears within
-- four hours. IAM reports activity for the last 365 days, or less if your
-- Region began supporting this feature within the last year. For more
-- information, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_access-advisor.html#access-advisor_tracking-period Regions where data is tracked>.
--
-- The service last accessed data includes all attempts to access an Amazon
-- Web Services API, not just the successful ones. This includes all
-- attempts that were made using the Amazon Web Services Management
-- Console, the Amazon Web Services API through any of the SDKs, or any of
-- the command line tools. An unexpected entry in the service last accessed
-- data does not mean that your account has been compromised, because the
-- request might have been denied. Refer to your CloudTrail logs as the
-- authoritative source for information about all API calls and whether
-- they were successful or denied access. For more information,
-- see <https://docs.aws.amazon.com/IAM/latest/UserGuide/cloudtrail-integration.html Logging IAM events with CloudTrail>
-- in the /IAM User Guide/.
--
-- The @GenerateServiceLastAccessedDetails@ operation returns a @JobId@.
-- Use this parameter in the following operations to retrieve the following
-- details from your report:
--
-- -   GetServiceLastAccessedDetails – Use this operation for users,
--     groups, roles, or policies to list every Amazon Web Services service
--     that the resource could access using permissions policies. For each
--     service, the response includes information about the most recent
--     access attempt.
--
--     The @JobId@ returned by @GenerateServiceLastAccessedDetail@ must be
--     used by the same role within a session, or by the same user when
--     used to call @GetServiceLastAccessedDetail@.
--
-- -   GetServiceLastAccessedDetailsWithEntities – Use this operation for
--     groups and policies to list information about the associated
--     entities (users or roles) that attempted to access a specific Amazon
--     Web Services service.
--
-- To check the status of the @GenerateServiceLastAccessedDetails@ request,
-- use the @JobId@ parameter in the same operations and test the
-- @JobStatus@ response parameter.
--
-- For additional information about the permissions policies that allow an
-- identity (user, group, or role) to access specific services, use the
-- ListPoliciesGrantingServiceAccess operation.
--
-- Service last accessed data does not use other policy types when
-- determining whether a resource could access a service. These other
-- policy types include resource-based policies, access control lists,
-- Organizations policies, IAM permissions boundaries, and STS assume role
-- policies. It only applies permissions policy logic. For more about the
-- evaluation of policy types, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_evaluation-logic.html#policy-eval-basics Evaluating policies>
-- in the /IAM User Guide/.
--
-- For more information about service and action last accessed data, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_access-advisor.html Reducing permissions using service last accessed data>
-- in the /IAM User Guide/.
module Amazonka.IAM.GenerateServiceLastAccessedDetails
  ( -- * Creating a Request
    GenerateServiceLastAccessedDetails (..),
    newGenerateServiceLastAccessedDetails,

    -- * Request Lenses
    generateServiceLastAccessedDetails_granularity,
    generateServiceLastAccessedDetails_arn,

    -- * Destructuring the Response
    GenerateServiceLastAccessedDetailsResponse (..),
    newGenerateServiceLastAccessedDetailsResponse,

    -- * Response Lenses
    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

-- | /See:/ 'newGenerateServiceLastAccessedDetails' smart constructor.
data GenerateServiceLastAccessedDetails = GenerateServiceLastAccessedDetails'
  { -- | The level of detail that you want to generate. You can specify whether
    -- you want to generate information about the last attempt to access
    -- services or actions. If you specify service-level granularity, this
    -- operation generates only service data. If you specify action-level
    -- granularity, it generates service and action data. If you don\'t include
    -- this optional parameter, the operation generates service data.
    GenerateServiceLastAccessedDetails
-> Maybe AccessAdvisorUsageGranularityType
granularity :: Prelude.Maybe AccessAdvisorUsageGranularityType,
    -- | The ARN of the IAM resource (user, group, role, or managed policy) used
    -- to generate information about when the resource was last used in an
    -- attempt to access an Amazon Web Services service.
    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)

-- |
-- Create a value of 'GenerateServiceLastAccessedDetails' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'granularity', 'generateServiceLastAccessedDetails_granularity' - The level of detail that you want to generate. You can specify whether
-- you want to generate information about the last attempt to access
-- services or actions. If you specify service-level granularity, this
-- operation generates only service data. If you specify action-level
-- granularity, it generates service and action data. If you don\'t include
-- this optional parameter, the operation generates service data.
--
-- 'arn', 'generateServiceLastAccessedDetails_arn' - The ARN of the IAM resource (user, group, role, or managed policy) used
-- to generate information about when the resource was last used in an
-- attempt to access an Amazon Web Services service.
newGenerateServiceLastAccessedDetails ::
  -- | 'arn'
  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_
    }

-- | The level of detail that you want to generate. You can specify whether
-- you want to generate information about the last attempt to access
-- services or actions. If you specify service-level granularity, this
-- operation generates only service data. If you specify action-level
-- granularity, it generates service and action data. If you don\'t include
-- this optional parameter, the operation generates service data.
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)

-- | The ARN of the IAM resource (user, group, role, or managed policy) used
-- to generate information about when the resource was last used in an
-- attempt to access an Amazon Web Services service.
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
      ]

-- | /See:/ 'newGenerateServiceLastAccessedDetailsResponse' smart constructor.
data GenerateServiceLastAccessedDetailsResponse = GenerateServiceLastAccessedDetailsResponse'
  { -- | The @JobId@ that you can use in the GetServiceLastAccessedDetails or
    -- GetServiceLastAccessedDetailsWithEntities operations. The @JobId@
    -- returned by @GenerateServiceLastAccessedDetail@ must be used by the same
    -- role within a session, or by the same user when used to call
    -- @GetServiceLastAccessedDetail@.
    GenerateServiceLastAccessedDetailsResponse -> Maybe Text
jobId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    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)

-- |
-- Create a value of 'GenerateServiceLastAccessedDetailsResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'jobId', 'generateServiceLastAccessedDetailsResponse_jobId' - The @JobId@ that you can use in the GetServiceLastAccessedDetails or
-- GetServiceLastAccessedDetailsWithEntities operations. The @JobId@
-- returned by @GenerateServiceLastAccessedDetail@ must be used by the same
-- role within a session, or by the same user when used to call
-- @GetServiceLastAccessedDetail@.
--
-- 'httpStatus', 'generateServiceLastAccessedDetailsResponse_httpStatus' - The response's http status code.
newGenerateServiceLastAccessedDetailsResponse ::
  -- | 'httpStatus'
  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_
      }

-- | The @JobId@ that you can use in the GetServiceLastAccessedDetails or
-- GetServiceLastAccessedDetailsWithEntities operations. The @JobId@
-- returned by @GenerateServiceLastAccessedDetail@ must be used by the same
-- role within a session, or by the same user when used to call
-- @GetServiceLastAccessedDetail@.
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)

-- | The response's http status code.
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