{-# 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.ListPolicyVersions
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Lists information about the versions of the specified managed policy,
-- including the version that is currently set as the policy\'s default
-- version.
--
-- For more information about managed policies, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/policies-managed-vs-inline.html Managed policies and inline policies>
-- in the /IAM User Guide/.
--
-- This operation returns paginated results.
module Amazonka.IAM.ListPolicyVersions
  ( -- * Creating a Request
    ListPolicyVersions (..),
    newListPolicyVersions,

    -- * Request Lenses
    listPolicyVersions_marker,
    listPolicyVersions_maxItems,
    listPolicyVersions_policyArn,

    -- * Destructuring the Response
    ListPolicyVersionsResponse (..),
    newListPolicyVersionsResponse,

    -- * Response Lenses
    listPolicyVersionsResponse_isTruncated,
    listPolicyVersionsResponse_marker,
    listPolicyVersionsResponse_versions,
    listPolicyVersionsResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IAM.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newListPolicyVersions' smart constructor.
data ListPolicyVersions = ListPolicyVersions'
  { -- | Use this parameter only when paginating results and only after you
    -- receive a response indicating that the results are truncated. Set it to
    -- the value of the @Marker@ element in the response that you received to
    -- indicate where the next call should start.
    ListPolicyVersions -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | Use this only when paginating results to indicate the maximum number of
    -- items you want in the response. If additional items exist beyond the
    -- maximum you specify, the @IsTruncated@ response element is @true@.
    --
    -- If you do not include this parameter, the number of items defaults to
    -- 100. Note that IAM might return fewer results, even when there are more
    -- results available. In that case, the @IsTruncated@ response element
    -- returns @true@, and @Marker@ contains a value to include in the
    -- subsequent call that tells the service where to continue from.
    ListPolicyVersions -> Maybe Natural
maxItems :: Prelude.Maybe Prelude.Natural,
    -- | The Amazon Resource Name (ARN) of the IAM policy for which you want the
    -- versions.
    --
    -- For more information about ARNs, see
    -- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html Amazon Resource Names (ARNs)>
    -- in the /Amazon Web Services General Reference/.
    ListPolicyVersions -> Text
policyArn :: Prelude.Text
  }
  deriving (ListPolicyVersions -> ListPolicyVersions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListPolicyVersions -> ListPolicyVersions -> Bool
$c/= :: ListPolicyVersions -> ListPolicyVersions -> Bool
== :: ListPolicyVersions -> ListPolicyVersions -> Bool
$c== :: ListPolicyVersions -> ListPolicyVersions -> Bool
Prelude.Eq, ReadPrec [ListPolicyVersions]
ReadPrec ListPolicyVersions
Int -> ReadS ListPolicyVersions
ReadS [ListPolicyVersions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListPolicyVersions]
$creadListPrec :: ReadPrec [ListPolicyVersions]
readPrec :: ReadPrec ListPolicyVersions
$creadPrec :: ReadPrec ListPolicyVersions
readList :: ReadS [ListPolicyVersions]
$creadList :: ReadS [ListPolicyVersions]
readsPrec :: Int -> ReadS ListPolicyVersions
$creadsPrec :: Int -> ReadS ListPolicyVersions
Prelude.Read, Int -> ListPolicyVersions -> ShowS
[ListPolicyVersions] -> ShowS
ListPolicyVersions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListPolicyVersions] -> ShowS
$cshowList :: [ListPolicyVersions] -> ShowS
show :: ListPolicyVersions -> String
$cshow :: ListPolicyVersions -> String
showsPrec :: Int -> ListPolicyVersions -> ShowS
$cshowsPrec :: Int -> ListPolicyVersions -> ShowS
Prelude.Show, forall x. Rep ListPolicyVersions x -> ListPolicyVersions
forall x. ListPolicyVersions -> Rep ListPolicyVersions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListPolicyVersions x -> ListPolicyVersions
$cfrom :: forall x. ListPolicyVersions -> Rep ListPolicyVersions x
Prelude.Generic)

-- |
-- Create a value of 'ListPolicyVersions' 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:
--
-- 'marker', 'listPolicyVersions_marker' - Use this parameter only when paginating results and only after you
-- receive a response indicating that the results are truncated. Set it to
-- the value of the @Marker@ element in the response that you received to
-- indicate where the next call should start.
--
-- 'maxItems', 'listPolicyVersions_maxItems' - Use this only when paginating results to indicate the maximum number of
-- items you want in the response. If additional items exist beyond the
-- maximum you specify, the @IsTruncated@ response element is @true@.
--
-- If you do not include this parameter, the number of items defaults to
-- 100. Note that IAM might return fewer results, even when there are more
-- results available. In that case, the @IsTruncated@ response element
-- returns @true@, and @Marker@ contains a value to include in the
-- subsequent call that tells the service where to continue from.
--
-- 'policyArn', 'listPolicyVersions_policyArn' - The Amazon Resource Name (ARN) of the IAM policy for which you want the
-- versions.
--
-- For more information about ARNs, see
-- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html Amazon Resource Names (ARNs)>
-- in the /Amazon Web Services General Reference/.
newListPolicyVersions ::
  -- | 'policyArn'
  Prelude.Text ->
  ListPolicyVersions
newListPolicyVersions :: Text -> ListPolicyVersions
newListPolicyVersions Text
pPolicyArn_ =
  ListPolicyVersions'
    { $sel:marker:ListPolicyVersions' :: Maybe Text
marker = forall a. Maybe a
Prelude.Nothing,
      $sel:maxItems:ListPolicyVersions' :: Maybe Natural
maxItems = forall a. Maybe a
Prelude.Nothing,
      $sel:policyArn:ListPolicyVersions' :: Text
policyArn = Text
pPolicyArn_
    }

-- | Use this parameter only when paginating results and only after you
-- receive a response indicating that the results are truncated. Set it to
-- the value of the @Marker@ element in the response that you received to
-- indicate where the next call should start.
listPolicyVersions_marker :: Lens.Lens' ListPolicyVersions (Prelude.Maybe Prelude.Text)
listPolicyVersions_marker :: Lens' ListPolicyVersions (Maybe Text)
listPolicyVersions_marker = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPolicyVersions' {Maybe Text
marker :: Maybe Text
$sel:marker:ListPolicyVersions' :: ListPolicyVersions -> Maybe Text
marker} -> Maybe Text
marker) (\s :: ListPolicyVersions
s@ListPolicyVersions' {} Maybe Text
a -> ListPolicyVersions
s {$sel:marker:ListPolicyVersions' :: Maybe Text
marker = Maybe Text
a} :: ListPolicyVersions)

-- | Use this only when paginating results to indicate the maximum number of
-- items you want in the response. If additional items exist beyond the
-- maximum you specify, the @IsTruncated@ response element is @true@.
--
-- If you do not include this parameter, the number of items defaults to
-- 100. Note that IAM might return fewer results, even when there are more
-- results available. In that case, the @IsTruncated@ response element
-- returns @true@, and @Marker@ contains a value to include in the
-- subsequent call that tells the service where to continue from.
listPolicyVersions_maxItems :: Lens.Lens' ListPolicyVersions (Prelude.Maybe Prelude.Natural)
listPolicyVersions_maxItems :: Lens' ListPolicyVersions (Maybe Natural)
listPolicyVersions_maxItems = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPolicyVersions' {Maybe Natural
maxItems :: Maybe Natural
$sel:maxItems:ListPolicyVersions' :: ListPolicyVersions -> Maybe Natural
maxItems} -> Maybe Natural
maxItems) (\s :: ListPolicyVersions
s@ListPolicyVersions' {} Maybe Natural
a -> ListPolicyVersions
s {$sel:maxItems:ListPolicyVersions' :: Maybe Natural
maxItems = Maybe Natural
a} :: ListPolicyVersions)

-- | The Amazon Resource Name (ARN) of the IAM policy for which you want the
-- versions.
--
-- For more information about ARNs, see
-- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html Amazon Resource Names (ARNs)>
-- in the /Amazon Web Services General Reference/.
listPolicyVersions_policyArn :: Lens.Lens' ListPolicyVersions Prelude.Text
listPolicyVersions_policyArn :: Lens' ListPolicyVersions Text
listPolicyVersions_policyArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPolicyVersions' {Text
policyArn :: Text
$sel:policyArn:ListPolicyVersions' :: ListPolicyVersions -> Text
policyArn} -> Text
policyArn) (\s :: ListPolicyVersions
s@ListPolicyVersions' {} Text
a -> ListPolicyVersions
s {$sel:policyArn:ListPolicyVersions' :: Text
policyArn = Text
a} :: ListPolicyVersions)

instance Core.AWSPager ListPolicyVersions where
  page :: ListPolicyVersions
-> AWSResponse ListPolicyVersions -> Maybe ListPolicyVersions
page ListPolicyVersions
rq AWSResponse ListPolicyVersions
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListPolicyVersions
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListPolicyVersionsResponse (Maybe Bool)
listPolicyVersionsResponse_isTruncated
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | forall a. Maybe a -> Bool
Prelude.isNothing
        ( AWSResponse ListPolicyVersions
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListPolicyVersionsResponse (Maybe Text)
listPolicyVersionsResponse_marker
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
        forall a. a -> Maybe a
Prelude.Just
          forall a b. (a -> b) -> a -> b
Prelude.$ ListPolicyVersions
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListPolicyVersions (Maybe Text)
listPolicyVersions_marker
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListPolicyVersions
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListPolicyVersionsResponse (Maybe Text)
listPolicyVersionsResponse_marker
          forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest ListPolicyVersions where
  type
    AWSResponse ListPolicyVersions =
      ListPolicyVersionsResponse
  request :: (Service -> Service)
-> ListPolicyVersions -> Request ListPolicyVersions
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListPolicyVersions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListPolicyVersions)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"ListPolicyVersionsResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe Bool
-> Maybe Text
-> Maybe [PolicyVersion]
-> Int
-> ListPolicyVersionsResponse
ListPolicyVersionsResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"IsTruncated")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Marker")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x
                            forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Versions"
                            forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                            forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"member")
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable ListPolicyVersions where
  hashWithSalt :: Int -> ListPolicyVersions -> Int
hashWithSalt Int
_salt ListPolicyVersions' {Maybe Natural
Maybe Text
Text
policyArn :: Text
maxItems :: Maybe Natural
marker :: Maybe Text
$sel:policyArn:ListPolicyVersions' :: ListPolicyVersions -> Text
$sel:maxItems:ListPolicyVersions' :: ListPolicyVersions -> Maybe Natural
$sel:marker:ListPolicyVersions' :: ListPolicyVersions -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
marker
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxItems
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
policyArn

instance Prelude.NFData ListPolicyVersions where
  rnf :: ListPolicyVersions -> ()
rnf ListPolicyVersions' {Maybe Natural
Maybe Text
Text
policyArn :: Text
maxItems :: Maybe Natural
marker :: Maybe Text
$sel:policyArn:ListPolicyVersions' :: ListPolicyVersions -> Text
$sel:maxItems:ListPolicyVersions' :: ListPolicyVersions -> Maybe Natural
$sel:marker:ListPolicyVersions' :: ListPolicyVersions -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
marker
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxItems
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
policyArn

instance Data.ToHeaders ListPolicyVersions where
  toHeaders :: ListPolicyVersions -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

instance Data.ToPath ListPolicyVersions where
  toPath :: ListPolicyVersions -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Data.ToQuery ListPolicyVersions where
  toQuery :: ListPolicyVersions -> QueryString
toQuery ListPolicyVersions' {Maybe Natural
Maybe Text
Text
policyArn :: Text
maxItems :: Maybe Natural
marker :: Maybe Text
$sel:policyArn:ListPolicyVersions' :: ListPolicyVersions -> Text
$sel:maxItems:ListPolicyVersions' :: ListPolicyVersions -> Maybe Natural
$sel:marker:ListPolicyVersions' :: ListPolicyVersions -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"ListPolicyVersions" :: Prelude.ByteString),
        ByteString
"Version"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2010-05-08" :: Prelude.ByteString),
        ByteString
"Marker" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
marker,
        ByteString
"MaxItems" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Natural
maxItems,
        ByteString
"PolicyArn" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
policyArn
      ]

-- | Contains the response to a successful ListPolicyVersions request.
--
-- /See:/ 'newListPolicyVersionsResponse' smart constructor.
data ListPolicyVersionsResponse = ListPolicyVersionsResponse'
  { -- | A flag that indicates whether there are more items to return. If your
    -- results were truncated, you can make a subsequent pagination request
    -- using the @Marker@ request parameter to retrieve more items. Note that
    -- IAM might return fewer than the @MaxItems@ number of results even when
    -- there are more results available. We recommend that you check
    -- @IsTruncated@ after every call to ensure that you receive all your
    -- results.
    ListPolicyVersionsResponse -> Maybe Bool
isTruncated :: Prelude.Maybe Prelude.Bool,
    -- | When @IsTruncated@ is @true@, this element is present and contains the
    -- value to use for the @Marker@ parameter in a subsequent pagination
    -- request.
    ListPolicyVersionsResponse -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | A list of policy versions.
    --
    -- For more information about managed policy versions, see
    -- <https://docs.aws.amazon.com/IAM/latest/UserGuide/policies-managed-versions.html Versioning for managed policies>
    -- in the /IAM User Guide/.
    ListPolicyVersionsResponse -> Maybe [PolicyVersion]
versions :: Prelude.Maybe [PolicyVersion],
    -- | The response's http status code.
    ListPolicyVersionsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListPolicyVersionsResponse -> ListPolicyVersionsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListPolicyVersionsResponse -> ListPolicyVersionsResponse -> Bool
$c/= :: ListPolicyVersionsResponse -> ListPolicyVersionsResponse -> Bool
== :: ListPolicyVersionsResponse -> ListPolicyVersionsResponse -> Bool
$c== :: ListPolicyVersionsResponse -> ListPolicyVersionsResponse -> Bool
Prelude.Eq, ReadPrec [ListPolicyVersionsResponse]
ReadPrec ListPolicyVersionsResponse
Int -> ReadS ListPolicyVersionsResponse
ReadS [ListPolicyVersionsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListPolicyVersionsResponse]
$creadListPrec :: ReadPrec [ListPolicyVersionsResponse]
readPrec :: ReadPrec ListPolicyVersionsResponse
$creadPrec :: ReadPrec ListPolicyVersionsResponse
readList :: ReadS [ListPolicyVersionsResponse]
$creadList :: ReadS [ListPolicyVersionsResponse]
readsPrec :: Int -> ReadS ListPolicyVersionsResponse
$creadsPrec :: Int -> ReadS ListPolicyVersionsResponse
Prelude.Read, Int -> ListPolicyVersionsResponse -> ShowS
[ListPolicyVersionsResponse] -> ShowS
ListPolicyVersionsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListPolicyVersionsResponse] -> ShowS
$cshowList :: [ListPolicyVersionsResponse] -> ShowS
show :: ListPolicyVersionsResponse -> String
$cshow :: ListPolicyVersionsResponse -> String
showsPrec :: Int -> ListPolicyVersionsResponse -> ShowS
$cshowsPrec :: Int -> ListPolicyVersionsResponse -> ShowS
Prelude.Show, forall x.
Rep ListPolicyVersionsResponse x -> ListPolicyVersionsResponse
forall x.
ListPolicyVersionsResponse -> Rep ListPolicyVersionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListPolicyVersionsResponse x -> ListPolicyVersionsResponse
$cfrom :: forall x.
ListPolicyVersionsResponse -> Rep ListPolicyVersionsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListPolicyVersionsResponse' 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:
--
-- 'isTruncated', 'listPolicyVersionsResponse_isTruncated' - A flag that indicates whether there are more items to return. If your
-- results were truncated, you can make a subsequent pagination request
-- using the @Marker@ request parameter to retrieve more items. Note that
-- IAM might return fewer than the @MaxItems@ number of results even when
-- there are more results available. We recommend that you check
-- @IsTruncated@ after every call to ensure that you receive all your
-- results.
--
-- 'marker', 'listPolicyVersionsResponse_marker' - When @IsTruncated@ is @true@, this element is present and contains the
-- value to use for the @Marker@ parameter in a subsequent pagination
-- request.
--
-- 'versions', 'listPolicyVersionsResponse_versions' - A list of policy versions.
--
-- For more information about managed policy versions, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/policies-managed-versions.html Versioning for managed policies>
-- in the /IAM User Guide/.
--
-- 'httpStatus', 'listPolicyVersionsResponse_httpStatus' - The response's http status code.
newListPolicyVersionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListPolicyVersionsResponse
newListPolicyVersionsResponse :: Int -> ListPolicyVersionsResponse
newListPolicyVersionsResponse Int
pHttpStatus_ =
  ListPolicyVersionsResponse'
    { $sel:isTruncated:ListPolicyVersionsResponse' :: Maybe Bool
isTruncated =
        forall a. Maybe a
Prelude.Nothing,
      $sel:marker:ListPolicyVersionsResponse' :: Maybe Text
marker = forall a. Maybe a
Prelude.Nothing,
      $sel:versions:ListPolicyVersionsResponse' :: Maybe [PolicyVersion]
versions = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListPolicyVersionsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A flag that indicates whether there are more items to return. If your
-- results were truncated, you can make a subsequent pagination request
-- using the @Marker@ request parameter to retrieve more items. Note that
-- IAM might return fewer than the @MaxItems@ number of results even when
-- there are more results available. We recommend that you check
-- @IsTruncated@ after every call to ensure that you receive all your
-- results.
listPolicyVersionsResponse_isTruncated :: Lens.Lens' ListPolicyVersionsResponse (Prelude.Maybe Prelude.Bool)
listPolicyVersionsResponse_isTruncated :: Lens' ListPolicyVersionsResponse (Maybe Bool)
listPolicyVersionsResponse_isTruncated = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPolicyVersionsResponse' {Maybe Bool
isTruncated :: Maybe Bool
$sel:isTruncated:ListPolicyVersionsResponse' :: ListPolicyVersionsResponse -> Maybe Bool
isTruncated} -> Maybe Bool
isTruncated) (\s :: ListPolicyVersionsResponse
s@ListPolicyVersionsResponse' {} Maybe Bool
a -> ListPolicyVersionsResponse
s {$sel:isTruncated:ListPolicyVersionsResponse' :: Maybe Bool
isTruncated = Maybe Bool
a} :: ListPolicyVersionsResponse)

-- | When @IsTruncated@ is @true@, this element is present and contains the
-- value to use for the @Marker@ parameter in a subsequent pagination
-- request.
listPolicyVersionsResponse_marker :: Lens.Lens' ListPolicyVersionsResponse (Prelude.Maybe Prelude.Text)
listPolicyVersionsResponse_marker :: Lens' ListPolicyVersionsResponse (Maybe Text)
listPolicyVersionsResponse_marker = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPolicyVersionsResponse' {Maybe Text
marker :: Maybe Text
$sel:marker:ListPolicyVersionsResponse' :: ListPolicyVersionsResponse -> Maybe Text
marker} -> Maybe Text
marker) (\s :: ListPolicyVersionsResponse
s@ListPolicyVersionsResponse' {} Maybe Text
a -> ListPolicyVersionsResponse
s {$sel:marker:ListPolicyVersionsResponse' :: Maybe Text
marker = Maybe Text
a} :: ListPolicyVersionsResponse)

-- | A list of policy versions.
--
-- For more information about managed policy versions, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/policies-managed-versions.html Versioning for managed policies>
-- in the /IAM User Guide/.
listPolicyVersionsResponse_versions :: Lens.Lens' ListPolicyVersionsResponse (Prelude.Maybe [PolicyVersion])
listPolicyVersionsResponse_versions :: Lens' ListPolicyVersionsResponse (Maybe [PolicyVersion])
listPolicyVersionsResponse_versions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPolicyVersionsResponse' {Maybe [PolicyVersion]
versions :: Maybe [PolicyVersion]
$sel:versions:ListPolicyVersionsResponse' :: ListPolicyVersionsResponse -> Maybe [PolicyVersion]
versions} -> Maybe [PolicyVersion]
versions) (\s :: ListPolicyVersionsResponse
s@ListPolicyVersionsResponse' {} Maybe [PolicyVersion]
a -> ListPolicyVersionsResponse
s {$sel:versions:ListPolicyVersionsResponse' :: Maybe [PolicyVersion]
versions = Maybe [PolicyVersion]
a} :: ListPolicyVersionsResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData ListPolicyVersionsResponse where
  rnf :: ListPolicyVersionsResponse -> ()
rnf ListPolicyVersionsResponse' {Int
Maybe Bool
Maybe [PolicyVersion]
Maybe Text
httpStatus :: Int
versions :: Maybe [PolicyVersion]
marker :: Maybe Text
isTruncated :: Maybe Bool
$sel:httpStatus:ListPolicyVersionsResponse' :: ListPolicyVersionsResponse -> Int
$sel:versions:ListPolicyVersionsResponse' :: ListPolicyVersionsResponse -> Maybe [PolicyVersion]
$sel:marker:ListPolicyVersionsResponse' :: ListPolicyVersionsResponse -> Maybe Text
$sel:isTruncated:ListPolicyVersionsResponse' :: ListPolicyVersionsResponse -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
isTruncated
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
marker
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [PolicyVersion]
versions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus