{-# 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.AccessAnalyzer.ListPolicyGenerations
-- 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)
--
-- Lists all of the policy generations requested in the last seven days.
--
-- This operation returns paginated results.
module Amazonka.AccessAnalyzer.ListPolicyGenerations
  ( -- * Creating a Request
    ListPolicyGenerations (..),
    newListPolicyGenerations,

    -- * Request Lenses
    listPolicyGenerations_nextToken,
    listPolicyGenerations_principalArn,
    listPolicyGenerations_maxResults,

    -- * Destructuring the Response
    ListPolicyGenerationsResponse (..),
    newListPolicyGenerationsResponse,

    -- * Response Lenses
    listPolicyGenerationsResponse_nextToken,
    listPolicyGenerationsResponse_httpStatus,
    listPolicyGenerationsResponse_policyGenerations,
  )
where

import Amazonka.AccessAnalyzer.Types
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

-- | /See:/ 'newListPolicyGenerations' smart constructor.
data ListPolicyGenerations = ListPolicyGenerations'
  { -- | A token used for pagination of results returned.
    ListPolicyGenerations -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the IAM entity (user or role) for which you are generating a
    -- policy. Use this with @ListGeneratedPolicies@ to filter the results to
    -- only include results for a specific principal.
    ListPolicyGenerations -> Maybe Text
principalArn :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to return in the response.
    ListPolicyGenerations -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (ListPolicyGenerations -> ListPolicyGenerations -> Bool
(ListPolicyGenerations -> ListPolicyGenerations -> Bool)
-> (ListPolicyGenerations -> ListPolicyGenerations -> Bool)
-> Eq ListPolicyGenerations
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListPolicyGenerations -> ListPolicyGenerations -> Bool
$c/= :: ListPolicyGenerations -> ListPolicyGenerations -> Bool
== :: ListPolicyGenerations -> ListPolicyGenerations -> Bool
$c== :: ListPolicyGenerations -> ListPolicyGenerations -> Bool
Prelude.Eq, ReadPrec [ListPolicyGenerations]
ReadPrec ListPolicyGenerations
Int -> ReadS ListPolicyGenerations
ReadS [ListPolicyGenerations]
(Int -> ReadS ListPolicyGenerations)
-> ReadS [ListPolicyGenerations]
-> ReadPrec ListPolicyGenerations
-> ReadPrec [ListPolicyGenerations]
-> Read ListPolicyGenerations
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListPolicyGenerations]
$creadListPrec :: ReadPrec [ListPolicyGenerations]
readPrec :: ReadPrec ListPolicyGenerations
$creadPrec :: ReadPrec ListPolicyGenerations
readList :: ReadS [ListPolicyGenerations]
$creadList :: ReadS [ListPolicyGenerations]
readsPrec :: Int -> ReadS ListPolicyGenerations
$creadsPrec :: Int -> ReadS ListPolicyGenerations
Prelude.Read, Int -> ListPolicyGenerations -> ShowS
[ListPolicyGenerations] -> ShowS
ListPolicyGenerations -> String
(Int -> ListPolicyGenerations -> ShowS)
-> (ListPolicyGenerations -> String)
-> ([ListPolicyGenerations] -> ShowS)
-> Show ListPolicyGenerations
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListPolicyGenerations] -> ShowS
$cshowList :: [ListPolicyGenerations] -> ShowS
show :: ListPolicyGenerations -> String
$cshow :: ListPolicyGenerations -> String
showsPrec :: Int -> ListPolicyGenerations -> ShowS
$cshowsPrec :: Int -> ListPolicyGenerations -> ShowS
Prelude.Show, (forall x. ListPolicyGenerations -> Rep ListPolicyGenerations x)
-> (forall x. Rep ListPolicyGenerations x -> ListPolicyGenerations)
-> Generic ListPolicyGenerations
forall x. Rep ListPolicyGenerations x -> ListPolicyGenerations
forall x. ListPolicyGenerations -> Rep ListPolicyGenerations x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListPolicyGenerations x -> ListPolicyGenerations
$cfrom :: forall x. ListPolicyGenerations -> Rep ListPolicyGenerations x
Prelude.Generic)

-- |
-- Create a value of 'ListPolicyGenerations' 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:
--
-- 'nextToken', 'listPolicyGenerations_nextToken' - A token used for pagination of results returned.
--
-- 'principalArn', 'listPolicyGenerations_principalArn' - The ARN of the IAM entity (user or role) for which you are generating a
-- policy. Use this with @ListGeneratedPolicies@ to filter the results to
-- only include results for a specific principal.
--
-- 'maxResults', 'listPolicyGenerations_maxResults' - The maximum number of results to return in the response.
newListPolicyGenerations ::
  ListPolicyGenerations
newListPolicyGenerations :: ListPolicyGenerations
newListPolicyGenerations =
  ListPolicyGenerations' :: Maybe Text -> Maybe Text -> Maybe Natural -> ListPolicyGenerations
ListPolicyGenerations'
    { $sel:nextToken:ListPolicyGenerations' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:principalArn:ListPolicyGenerations' :: Maybe Text
principalArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListPolicyGenerations' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | A token used for pagination of results returned.
listPolicyGenerations_nextToken :: Lens.Lens' ListPolicyGenerations (Prelude.Maybe Prelude.Text)
listPolicyGenerations_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListPolicyGenerations -> f ListPolicyGenerations
listPolicyGenerations_nextToken = (ListPolicyGenerations -> Maybe Text)
-> (ListPolicyGenerations -> Maybe Text -> ListPolicyGenerations)
-> Lens
     ListPolicyGenerations
     ListPolicyGenerations
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPolicyGenerations' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListPolicyGenerations' :: ListPolicyGenerations -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListPolicyGenerations
s@ListPolicyGenerations' {} Maybe Text
a -> ListPolicyGenerations
s {$sel:nextToken:ListPolicyGenerations' :: Maybe Text
nextToken = Maybe Text
a} :: ListPolicyGenerations)

-- | The ARN of the IAM entity (user or role) for which you are generating a
-- policy. Use this with @ListGeneratedPolicies@ to filter the results to
-- only include results for a specific principal.
listPolicyGenerations_principalArn :: Lens.Lens' ListPolicyGenerations (Prelude.Maybe Prelude.Text)
listPolicyGenerations_principalArn :: (Maybe Text -> f (Maybe Text))
-> ListPolicyGenerations -> f ListPolicyGenerations
listPolicyGenerations_principalArn = (ListPolicyGenerations -> Maybe Text)
-> (ListPolicyGenerations -> Maybe Text -> ListPolicyGenerations)
-> Lens
     ListPolicyGenerations
     ListPolicyGenerations
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPolicyGenerations' {Maybe Text
principalArn :: Maybe Text
$sel:principalArn:ListPolicyGenerations' :: ListPolicyGenerations -> Maybe Text
principalArn} -> Maybe Text
principalArn) (\s :: ListPolicyGenerations
s@ListPolicyGenerations' {} Maybe Text
a -> ListPolicyGenerations
s {$sel:principalArn:ListPolicyGenerations' :: Maybe Text
principalArn = Maybe Text
a} :: ListPolicyGenerations)

-- | The maximum number of results to return in the response.
listPolicyGenerations_maxResults :: Lens.Lens' ListPolicyGenerations (Prelude.Maybe Prelude.Natural)
listPolicyGenerations_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListPolicyGenerations -> f ListPolicyGenerations
listPolicyGenerations_maxResults = (ListPolicyGenerations -> Maybe Natural)
-> (ListPolicyGenerations
    -> Maybe Natural -> ListPolicyGenerations)
-> Lens
     ListPolicyGenerations
     ListPolicyGenerations
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPolicyGenerations' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListPolicyGenerations' :: ListPolicyGenerations -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListPolicyGenerations
s@ListPolicyGenerations' {} Maybe Natural
a -> ListPolicyGenerations
s {$sel:maxResults:ListPolicyGenerations' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListPolicyGenerations)

instance Core.AWSPager ListPolicyGenerations where
  page :: ListPolicyGenerations
-> AWSResponse ListPolicyGenerations -> Maybe ListPolicyGenerations
page ListPolicyGenerations
rq AWSResponse ListPolicyGenerations
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListPolicyGenerations
ListPolicyGenerationsResponse
rs
            ListPolicyGenerationsResponse
-> Getting (First Text) ListPolicyGenerationsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListPolicyGenerationsResponse
-> Const (First Text) ListPolicyGenerationsResponse
Lens' ListPolicyGenerationsResponse (Maybe Text)
listPolicyGenerationsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListPolicyGenerationsResponse
 -> Const (First Text) ListPolicyGenerationsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListPolicyGenerationsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListPolicyGenerations
forall a. Maybe a
Prelude.Nothing
    | [PolicyGeneration] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListPolicyGenerations
ListPolicyGenerationsResponse
rs
            ListPolicyGenerationsResponse
-> Getting
     [PolicyGeneration] ListPolicyGenerationsResponse [PolicyGeneration]
-> [PolicyGeneration]
forall s a. s -> Getting a s a -> a
Lens.^. Getting
  [PolicyGeneration] ListPolicyGenerationsResponse [PolicyGeneration]
Lens' ListPolicyGenerationsResponse [PolicyGeneration]
listPolicyGenerationsResponse_policyGenerations
        ) =
      Maybe ListPolicyGenerations
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListPolicyGenerations -> Maybe ListPolicyGenerations
forall a. a -> Maybe a
Prelude.Just (ListPolicyGenerations -> Maybe ListPolicyGenerations)
-> ListPolicyGenerations -> Maybe ListPolicyGenerations
forall a b. (a -> b) -> a -> b
Prelude.$
        ListPolicyGenerations
rq
          ListPolicyGenerations
-> (ListPolicyGenerations -> ListPolicyGenerations)
-> ListPolicyGenerations
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListPolicyGenerations -> Identity ListPolicyGenerations
Lens
  ListPolicyGenerations
  ListPolicyGenerations
  (Maybe Text)
  (Maybe Text)
listPolicyGenerations_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListPolicyGenerations -> Identity ListPolicyGenerations)
-> Maybe Text -> ListPolicyGenerations -> ListPolicyGenerations
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListPolicyGenerations
ListPolicyGenerationsResponse
rs
          ListPolicyGenerationsResponse
-> Getting (First Text) ListPolicyGenerationsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListPolicyGenerationsResponse
-> Const (First Text) ListPolicyGenerationsResponse
Lens' ListPolicyGenerationsResponse (Maybe Text)
listPolicyGenerationsResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListPolicyGenerationsResponse
 -> Const (First Text) ListPolicyGenerationsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListPolicyGenerationsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest ListPolicyGenerations where
  type
    AWSResponse ListPolicyGenerations =
      ListPolicyGenerationsResponse
  request :: ListPolicyGenerations -> Request ListPolicyGenerations
request = Service -> ListPolicyGenerations -> Request ListPolicyGenerations
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy ListPolicyGenerations
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListPolicyGenerations)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListPolicyGenerations))
-> Logger
-> Service
-> Proxy ListPolicyGenerations
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListPolicyGenerations)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Int -> [PolicyGeneration] -> ListPolicyGenerationsResponse
ListPolicyGenerationsResponse'
            (Maybe Text
 -> Int -> [PolicyGeneration] -> ListPolicyGenerationsResponse)
-> Either String (Maybe Text)
-> Either
     String (Int -> [PolicyGeneration] -> ListPolicyGenerationsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"nextToken")
            Either
  String (Int -> [PolicyGeneration] -> ListPolicyGenerationsResponse)
-> Either String Int
-> Either
     String ([PolicyGeneration] -> ListPolicyGenerationsResponse)
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))
            Either String ([PolicyGeneration] -> ListPolicyGenerationsResponse)
-> Either String [PolicyGeneration]
-> Either String ListPolicyGenerationsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Either String (Maybe [PolicyGeneration])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"policyGenerations"
                            Either String (Maybe [PolicyGeneration])
-> [PolicyGeneration] -> Either String [PolicyGeneration]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [PolicyGeneration]
forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable ListPolicyGenerations

instance Prelude.NFData ListPolicyGenerations

instance Core.ToHeaders ListPolicyGenerations where
  toHeaders :: ListPolicyGenerations -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListPolicyGenerations -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToPath ListPolicyGenerations where
  toPath :: ListPolicyGenerations -> ByteString
toPath = ByteString -> ListPolicyGenerations -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/policy/generation"

instance Core.ToQuery ListPolicyGenerations where
  toQuery :: ListPolicyGenerations -> QueryString
toQuery ListPolicyGenerations' {Maybe Natural
Maybe Text
maxResults :: Maybe Natural
principalArn :: Maybe Text
nextToken :: Maybe Text
$sel:maxResults:ListPolicyGenerations' :: ListPolicyGenerations -> Maybe Natural
$sel:principalArn:ListPolicyGenerations' :: ListPolicyGenerations -> Maybe Text
$sel:nextToken:ListPolicyGenerations' :: ListPolicyGenerations -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"nextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
        ByteString
"principalArn" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
principalArn,
        ByteString
"maxResults" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxResults
      ]

-- | /See:/ 'newListPolicyGenerationsResponse' smart constructor.
data ListPolicyGenerationsResponse = ListPolicyGenerationsResponse'
  { -- | A token used for pagination of results returned.
    ListPolicyGenerationsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListPolicyGenerationsResponse -> Int
httpStatus :: Prelude.Int,
    -- | A @PolicyGeneration@ object that contains details about the generated
    -- policy.
    ListPolicyGenerationsResponse -> [PolicyGeneration]
policyGenerations :: [PolicyGeneration]
  }
  deriving (ListPolicyGenerationsResponse
-> ListPolicyGenerationsResponse -> Bool
(ListPolicyGenerationsResponse
 -> ListPolicyGenerationsResponse -> Bool)
-> (ListPolicyGenerationsResponse
    -> ListPolicyGenerationsResponse -> Bool)
-> Eq ListPolicyGenerationsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListPolicyGenerationsResponse
-> ListPolicyGenerationsResponse -> Bool
$c/= :: ListPolicyGenerationsResponse
-> ListPolicyGenerationsResponse -> Bool
== :: ListPolicyGenerationsResponse
-> ListPolicyGenerationsResponse -> Bool
$c== :: ListPolicyGenerationsResponse
-> ListPolicyGenerationsResponse -> Bool
Prelude.Eq, ReadPrec [ListPolicyGenerationsResponse]
ReadPrec ListPolicyGenerationsResponse
Int -> ReadS ListPolicyGenerationsResponse
ReadS [ListPolicyGenerationsResponse]
(Int -> ReadS ListPolicyGenerationsResponse)
-> ReadS [ListPolicyGenerationsResponse]
-> ReadPrec ListPolicyGenerationsResponse
-> ReadPrec [ListPolicyGenerationsResponse]
-> Read ListPolicyGenerationsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListPolicyGenerationsResponse]
$creadListPrec :: ReadPrec [ListPolicyGenerationsResponse]
readPrec :: ReadPrec ListPolicyGenerationsResponse
$creadPrec :: ReadPrec ListPolicyGenerationsResponse
readList :: ReadS [ListPolicyGenerationsResponse]
$creadList :: ReadS [ListPolicyGenerationsResponse]
readsPrec :: Int -> ReadS ListPolicyGenerationsResponse
$creadsPrec :: Int -> ReadS ListPolicyGenerationsResponse
Prelude.Read, Int -> ListPolicyGenerationsResponse -> ShowS
[ListPolicyGenerationsResponse] -> ShowS
ListPolicyGenerationsResponse -> String
(Int -> ListPolicyGenerationsResponse -> ShowS)
-> (ListPolicyGenerationsResponse -> String)
-> ([ListPolicyGenerationsResponse] -> ShowS)
-> Show ListPolicyGenerationsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListPolicyGenerationsResponse] -> ShowS
$cshowList :: [ListPolicyGenerationsResponse] -> ShowS
show :: ListPolicyGenerationsResponse -> String
$cshow :: ListPolicyGenerationsResponse -> String
showsPrec :: Int -> ListPolicyGenerationsResponse -> ShowS
$cshowsPrec :: Int -> ListPolicyGenerationsResponse -> ShowS
Prelude.Show, (forall x.
 ListPolicyGenerationsResponse
 -> Rep ListPolicyGenerationsResponse x)
-> (forall x.
    Rep ListPolicyGenerationsResponse x
    -> ListPolicyGenerationsResponse)
-> Generic ListPolicyGenerationsResponse
forall x.
Rep ListPolicyGenerationsResponse x
-> ListPolicyGenerationsResponse
forall x.
ListPolicyGenerationsResponse
-> Rep ListPolicyGenerationsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListPolicyGenerationsResponse x
-> ListPolicyGenerationsResponse
$cfrom :: forall x.
ListPolicyGenerationsResponse
-> Rep ListPolicyGenerationsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListPolicyGenerationsResponse' 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:
--
-- 'nextToken', 'listPolicyGenerationsResponse_nextToken' - A token used for pagination of results returned.
--
-- 'httpStatus', 'listPolicyGenerationsResponse_httpStatus' - The response's http status code.
--
-- 'policyGenerations', 'listPolicyGenerationsResponse_policyGenerations' - A @PolicyGeneration@ object that contains details about the generated
-- policy.
newListPolicyGenerationsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListPolicyGenerationsResponse
newListPolicyGenerationsResponse :: Int -> ListPolicyGenerationsResponse
newListPolicyGenerationsResponse Int
pHttpStatus_ =
  ListPolicyGenerationsResponse' :: Maybe Text
-> Int -> [PolicyGeneration] -> ListPolicyGenerationsResponse
ListPolicyGenerationsResponse'
    { $sel:nextToken:ListPolicyGenerationsResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListPolicyGenerationsResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:policyGenerations:ListPolicyGenerationsResponse' :: [PolicyGeneration]
policyGenerations = [PolicyGeneration]
forall a. Monoid a => a
Prelude.mempty
    }

-- | A token used for pagination of results returned.
listPolicyGenerationsResponse_nextToken :: Lens.Lens' ListPolicyGenerationsResponse (Prelude.Maybe Prelude.Text)
listPolicyGenerationsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListPolicyGenerationsResponse -> f ListPolicyGenerationsResponse
listPolicyGenerationsResponse_nextToken = (ListPolicyGenerationsResponse -> Maybe Text)
-> (ListPolicyGenerationsResponse
    -> Maybe Text -> ListPolicyGenerationsResponse)
-> Lens' ListPolicyGenerationsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPolicyGenerationsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListPolicyGenerationsResponse' :: ListPolicyGenerationsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListPolicyGenerationsResponse
s@ListPolicyGenerationsResponse' {} Maybe Text
a -> ListPolicyGenerationsResponse
s {$sel:nextToken:ListPolicyGenerationsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListPolicyGenerationsResponse)

-- | The response's http status code.
listPolicyGenerationsResponse_httpStatus :: Lens.Lens' ListPolicyGenerationsResponse Prelude.Int
listPolicyGenerationsResponse_httpStatus :: (Int -> f Int)
-> ListPolicyGenerationsResponse -> f ListPolicyGenerationsResponse
listPolicyGenerationsResponse_httpStatus = (ListPolicyGenerationsResponse -> Int)
-> (ListPolicyGenerationsResponse
    -> Int -> ListPolicyGenerationsResponse)
-> Lens
     ListPolicyGenerationsResponse ListPolicyGenerationsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPolicyGenerationsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListPolicyGenerationsResponse' :: ListPolicyGenerationsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListPolicyGenerationsResponse
s@ListPolicyGenerationsResponse' {} Int
a -> ListPolicyGenerationsResponse
s {$sel:httpStatus:ListPolicyGenerationsResponse' :: Int
httpStatus = Int
a} :: ListPolicyGenerationsResponse)

-- | A @PolicyGeneration@ object that contains details about the generated
-- policy.
listPolicyGenerationsResponse_policyGenerations :: Lens.Lens' ListPolicyGenerationsResponse [PolicyGeneration]
listPolicyGenerationsResponse_policyGenerations :: ([PolicyGeneration] -> f [PolicyGeneration])
-> ListPolicyGenerationsResponse -> f ListPolicyGenerationsResponse
listPolicyGenerationsResponse_policyGenerations = (ListPolicyGenerationsResponse -> [PolicyGeneration])
-> (ListPolicyGenerationsResponse
    -> [PolicyGeneration] -> ListPolicyGenerationsResponse)
-> Lens' ListPolicyGenerationsResponse [PolicyGeneration]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPolicyGenerationsResponse' {[PolicyGeneration]
policyGenerations :: [PolicyGeneration]
$sel:policyGenerations:ListPolicyGenerationsResponse' :: ListPolicyGenerationsResponse -> [PolicyGeneration]
policyGenerations} -> [PolicyGeneration]
policyGenerations) (\s :: ListPolicyGenerationsResponse
s@ListPolicyGenerationsResponse' {} [PolicyGeneration]
a -> ListPolicyGenerationsResponse
s {$sel:policyGenerations:ListPolicyGenerationsResponse' :: [PolicyGeneration]
policyGenerations = [PolicyGeneration]
a} :: ListPolicyGenerationsResponse) (([PolicyGeneration] -> f [PolicyGeneration])
 -> ListPolicyGenerationsResponse
 -> f ListPolicyGenerationsResponse)
-> (([PolicyGeneration] -> f [PolicyGeneration])
    -> [PolicyGeneration] -> f [PolicyGeneration])
-> ([PolicyGeneration] -> f [PolicyGeneration])
-> ListPolicyGenerationsResponse
-> f ListPolicyGenerationsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([PolicyGeneration] -> f [PolicyGeneration])
-> [PolicyGeneration] -> f [PolicyGeneration]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.NFData ListPolicyGenerationsResponse