{-# 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.ListRolePolicies
-- 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 the names of the inline policies that are embedded in the
-- specified IAM role.
--
-- An IAM role can also have managed policies attached to it. To list the
-- managed policies that are attached to a role, use
-- ListAttachedRolePolicies. For more information about 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/.
--
-- You can paginate the results using the @MaxItems@ and @Marker@
-- parameters. If there are no inline policies embedded with the specified
-- role, the operation returns an empty list.
--
-- This operation returns paginated results.
module Amazonka.IAM.ListRolePolicies
  ( -- * Creating a Request
    ListRolePolicies (..),
    newListRolePolicies,

    -- * Request Lenses
    listRolePolicies_marker,
    listRolePolicies_maxItems,
    listRolePolicies_roleName,

    -- * Destructuring the Response
    ListRolePoliciesResponse (..),
    newListRolePoliciesResponse,

    -- * Response Lenses
    listRolePoliciesResponse_marker,
    listRolePoliciesResponse_isTruncated,
    listRolePoliciesResponse_httpStatus,
    listRolePoliciesResponse_policyNames,
  )
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:/ 'newListRolePolicies' smart constructor.
data ListRolePolicies = ListRolePolicies'
  { -- | 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.
    ListRolePolicies -> 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.
    ListRolePolicies -> Maybe Natural
maxItems :: Prelude.Maybe Prelude.Natural,
    -- | The name of the role to list policies for.
    --
    -- This parameter allows (through its
    -- <http://wikipedia.org/wiki/regex regex pattern>) a string of characters
    -- consisting of upper and lowercase alphanumeric characters with no
    -- spaces. You can also include any of the following characters: _+=,.\@-
    ListRolePolicies -> Text
roleName :: Prelude.Text
  }
  deriving (ListRolePolicies -> ListRolePolicies -> Bool
(ListRolePolicies -> ListRolePolicies -> Bool)
-> (ListRolePolicies -> ListRolePolicies -> Bool)
-> Eq ListRolePolicies
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListRolePolicies -> ListRolePolicies -> Bool
$c/= :: ListRolePolicies -> ListRolePolicies -> Bool
== :: ListRolePolicies -> ListRolePolicies -> Bool
$c== :: ListRolePolicies -> ListRolePolicies -> Bool
Prelude.Eq, ReadPrec [ListRolePolicies]
ReadPrec ListRolePolicies
Int -> ReadS ListRolePolicies
ReadS [ListRolePolicies]
(Int -> ReadS ListRolePolicies)
-> ReadS [ListRolePolicies]
-> ReadPrec ListRolePolicies
-> ReadPrec [ListRolePolicies]
-> Read ListRolePolicies
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListRolePolicies]
$creadListPrec :: ReadPrec [ListRolePolicies]
readPrec :: ReadPrec ListRolePolicies
$creadPrec :: ReadPrec ListRolePolicies
readList :: ReadS [ListRolePolicies]
$creadList :: ReadS [ListRolePolicies]
readsPrec :: Int -> ReadS ListRolePolicies
$creadsPrec :: Int -> ReadS ListRolePolicies
Prelude.Read, Int -> ListRolePolicies -> ShowS
[ListRolePolicies] -> ShowS
ListRolePolicies -> String
(Int -> ListRolePolicies -> ShowS)
-> (ListRolePolicies -> String)
-> ([ListRolePolicies] -> ShowS)
-> Show ListRolePolicies
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListRolePolicies] -> ShowS
$cshowList :: [ListRolePolicies] -> ShowS
show :: ListRolePolicies -> String
$cshow :: ListRolePolicies -> String
showsPrec :: Int -> ListRolePolicies -> ShowS
$cshowsPrec :: Int -> ListRolePolicies -> ShowS
Prelude.Show, (forall x. ListRolePolicies -> Rep ListRolePolicies x)
-> (forall x. Rep ListRolePolicies x -> ListRolePolicies)
-> Generic ListRolePolicies
forall x. Rep ListRolePolicies x -> ListRolePolicies
forall x. ListRolePolicies -> Rep ListRolePolicies x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListRolePolicies x -> ListRolePolicies
$cfrom :: forall x. ListRolePolicies -> Rep ListRolePolicies x
Prelude.Generic)

-- |
-- Create a value of 'ListRolePolicies' 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', 'listRolePolicies_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', 'listRolePolicies_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.
--
-- 'roleName', 'listRolePolicies_roleName' - The name of the role to list policies for.
--
-- This parameter allows (through its
-- <http://wikipedia.org/wiki/regex regex pattern>) a string of characters
-- consisting of upper and lowercase alphanumeric characters with no
-- spaces. You can also include any of the following characters: _+=,.\@-
newListRolePolicies ::
  -- | 'roleName'
  Prelude.Text ->
  ListRolePolicies
newListRolePolicies :: Text -> ListRolePolicies
newListRolePolicies Text
pRoleName_ =
  ListRolePolicies' :: Maybe Text -> Maybe Natural -> Text -> ListRolePolicies
ListRolePolicies'
    { $sel:marker:ListRolePolicies' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxItems:ListRolePolicies' :: Maybe Natural
maxItems = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:roleName:ListRolePolicies' :: Text
roleName = Text
pRoleName_
    }

-- | 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.
listRolePolicies_marker :: Lens.Lens' ListRolePolicies (Prelude.Maybe Prelude.Text)
listRolePolicies_marker :: (Maybe Text -> f (Maybe Text))
-> ListRolePolicies -> f ListRolePolicies
listRolePolicies_marker = (ListRolePolicies -> Maybe Text)
-> (ListRolePolicies -> Maybe Text -> ListRolePolicies)
-> Lens ListRolePolicies ListRolePolicies (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRolePolicies' {Maybe Text
marker :: Maybe Text
$sel:marker:ListRolePolicies' :: ListRolePolicies -> Maybe Text
marker} -> Maybe Text
marker) (\s :: ListRolePolicies
s@ListRolePolicies' {} Maybe Text
a -> ListRolePolicies
s {$sel:marker:ListRolePolicies' :: Maybe Text
marker = Maybe Text
a} :: ListRolePolicies)

-- | 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.
listRolePolicies_maxItems :: Lens.Lens' ListRolePolicies (Prelude.Maybe Prelude.Natural)
listRolePolicies_maxItems :: (Maybe Natural -> f (Maybe Natural))
-> ListRolePolicies -> f ListRolePolicies
listRolePolicies_maxItems = (ListRolePolicies -> Maybe Natural)
-> (ListRolePolicies -> Maybe Natural -> ListRolePolicies)
-> Lens
     ListRolePolicies ListRolePolicies (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRolePolicies' {Maybe Natural
maxItems :: Maybe Natural
$sel:maxItems:ListRolePolicies' :: ListRolePolicies -> Maybe Natural
maxItems} -> Maybe Natural
maxItems) (\s :: ListRolePolicies
s@ListRolePolicies' {} Maybe Natural
a -> ListRolePolicies
s {$sel:maxItems:ListRolePolicies' :: Maybe Natural
maxItems = Maybe Natural
a} :: ListRolePolicies)

-- | The name of the role to list policies for.
--
-- This parameter allows (through its
-- <http://wikipedia.org/wiki/regex regex pattern>) a string of characters
-- consisting of upper and lowercase alphanumeric characters with no
-- spaces. You can also include any of the following characters: _+=,.\@-
listRolePolicies_roleName :: Lens.Lens' ListRolePolicies Prelude.Text
listRolePolicies_roleName :: (Text -> f Text) -> ListRolePolicies -> f ListRolePolicies
listRolePolicies_roleName = (ListRolePolicies -> Text)
-> (ListRolePolicies -> Text -> ListRolePolicies)
-> Lens ListRolePolicies ListRolePolicies Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRolePolicies' {Text
roleName :: Text
$sel:roleName:ListRolePolicies' :: ListRolePolicies -> Text
roleName} -> Text
roleName) (\s :: ListRolePolicies
s@ListRolePolicies' {} Text
a -> ListRolePolicies
s {$sel:roleName:ListRolePolicies' :: Text
roleName = Text
a} :: ListRolePolicies)

instance Core.AWSPager ListRolePolicies where
  page :: ListRolePolicies
-> AWSResponse ListRolePolicies -> Maybe ListRolePolicies
page ListRolePolicies
rq AWSResponse ListRolePolicies
rs
    | Maybe Bool -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListRolePolicies
ListRolePoliciesResponse
rs
            ListRolePoliciesResponse
-> Getting (First Bool) ListRolePoliciesResponse Bool -> Maybe Bool
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Bool -> Const (First Bool) (Maybe Bool))
-> ListRolePoliciesResponse
-> Const (First Bool) ListRolePoliciesResponse
Lens' ListRolePoliciesResponse (Maybe Bool)
listRolePoliciesResponse_isTruncated
              ((Maybe Bool -> Const (First Bool) (Maybe Bool))
 -> ListRolePoliciesResponse
 -> Const (First Bool) ListRolePoliciesResponse)
-> ((Bool -> Const (First Bool) Bool)
    -> Maybe Bool -> Const (First Bool) (Maybe Bool))
-> Getting (First Bool) ListRolePoliciesResponse Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Bool -> Const (First Bool) Bool)
-> Maybe Bool -> Const (First Bool) (Maybe Bool)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListRolePolicies
forall a. Maybe a
Prelude.Nothing
    | Maybe Text -> Bool
forall a. Maybe a -> Bool
Prelude.isNothing
        ( AWSResponse ListRolePolicies
ListRolePoliciesResponse
rs
            ListRolePoliciesResponse
-> Getting (First Text) ListRolePoliciesResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListRolePoliciesResponse
-> Const (First Text) ListRolePoliciesResponse
Lens' ListRolePoliciesResponse (Maybe Text)
listRolePoliciesResponse_marker ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListRolePoliciesResponse
 -> Const (First Text) ListRolePoliciesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListRolePoliciesResponse 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 ListRolePolicies
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListRolePolicies -> Maybe ListRolePolicies
forall a. a -> Maybe a
Prelude.Just (ListRolePolicies -> Maybe ListRolePolicies)
-> ListRolePolicies -> Maybe ListRolePolicies
forall a b. (a -> b) -> a -> b
Prelude.$
        ListRolePolicies
rq
          ListRolePolicies
-> (ListRolePolicies -> ListRolePolicies) -> ListRolePolicies
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListRolePolicies -> Identity ListRolePolicies
Lens ListRolePolicies ListRolePolicies (Maybe Text) (Maybe Text)
listRolePolicies_marker
          ((Maybe Text -> Identity (Maybe Text))
 -> ListRolePolicies -> Identity ListRolePolicies)
-> Maybe Text -> ListRolePolicies -> ListRolePolicies
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListRolePolicies
ListRolePoliciesResponse
rs
          ListRolePoliciesResponse
-> Getting (First Text) ListRolePoliciesResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListRolePoliciesResponse
-> Const (First Text) ListRolePoliciesResponse
Lens' ListRolePoliciesResponse (Maybe Text)
listRolePoliciesResponse_marker ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListRolePoliciesResponse
 -> Const (First Text) ListRolePoliciesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListRolePoliciesResponse 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 ListRolePolicies where
  type
    AWSResponse ListRolePolicies =
      ListRolePoliciesResponse
  request :: ListRolePolicies -> Request ListRolePolicies
request = Service -> ListRolePolicies -> Request ListRolePolicies
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy ListRolePolicies
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListRolePolicies)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse ListRolePolicies))
-> Logger
-> Service
-> Proxy ListRolePolicies
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListRolePolicies)))
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
"ListRolePoliciesResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe Text
-> Maybe Bool -> Int -> [Text] -> ListRolePoliciesResponse
ListRolePoliciesResponse'
            (Maybe Text
 -> Maybe Bool -> Int -> [Text] -> ListRolePoliciesResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe Bool -> Int -> [Text] -> ListRolePoliciesResponse)
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
"Marker")
            Either
  String (Maybe Bool -> Int -> [Text] -> ListRolePoliciesResponse)
-> Either String (Maybe Bool)
-> Either String (Int -> [Text] -> ListRolePoliciesResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Bool)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"IsTruncated")
            Either String (Int -> [Text] -> ListRolePoliciesResponse)
-> Either String Int
-> Either String ([Text] -> ListRolePoliciesResponse)
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 ([Text] -> ListRolePoliciesResponse)
-> Either String [Text] -> Either String ListRolePoliciesResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"PolicyNames" Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
                            Either String [Node]
-> ([Node] -> Either String [Text]) -> Either String [Text]
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= Text -> [Node] -> Either String [Text]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member"
                        )
      )

instance Prelude.Hashable ListRolePolicies

instance Prelude.NFData ListRolePolicies

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

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

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

-- | Contains the response to a successful ListRolePolicies request.
--
-- /See:/ 'newListRolePoliciesResponse' smart constructor.
data ListRolePoliciesResponse = ListRolePoliciesResponse'
  { -- | When @IsTruncated@ is @true@, this element is present and contains the
    -- value to use for the @Marker@ parameter in a subsequent pagination
    -- request.
    ListRolePoliciesResponse -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | 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.
    ListRolePoliciesResponse -> Maybe Bool
isTruncated :: Prelude.Maybe Prelude.Bool,
    -- | The response's http status code.
    ListRolePoliciesResponse -> Int
httpStatus :: Prelude.Int,
    -- | A list of policy names.
    ListRolePoliciesResponse -> [Text]
policyNames :: [Prelude.Text]
  }
  deriving (ListRolePoliciesResponse -> ListRolePoliciesResponse -> Bool
(ListRolePoliciesResponse -> ListRolePoliciesResponse -> Bool)
-> (ListRolePoliciesResponse -> ListRolePoliciesResponse -> Bool)
-> Eq ListRolePoliciesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListRolePoliciesResponse -> ListRolePoliciesResponse -> Bool
$c/= :: ListRolePoliciesResponse -> ListRolePoliciesResponse -> Bool
== :: ListRolePoliciesResponse -> ListRolePoliciesResponse -> Bool
$c== :: ListRolePoliciesResponse -> ListRolePoliciesResponse -> Bool
Prelude.Eq, ReadPrec [ListRolePoliciesResponse]
ReadPrec ListRolePoliciesResponse
Int -> ReadS ListRolePoliciesResponse
ReadS [ListRolePoliciesResponse]
(Int -> ReadS ListRolePoliciesResponse)
-> ReadS [ListRolePoliciesResponse]
-> ReadPrec ListRolePoliciesResponse
-> ReadPrec [ListRolePoliciesResponse]
-> Read ListRolePoliciesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListRolePoliciesResponse]
$creadListPrec :: ReadPrec [ListRolePoliciesResponse]
readPrec :: ReadPrec ListRolePoliciesResponse
$creadPrec :: ReadPrec ListRolePoliciesResponse
readList :: ReadS [ListRolePoliciesResponse]
$creadList :: ReadS [ListRolePoliciesResponse]
readsPrec :: Int -> ReadS ListRolePoliciesResponse
$creadsPrec :: Int -> ReadS ListRolePoliciesResponse
Prelude.Read, Int -> ListRolePoliciesResponse -> ShowS
[ListRolePoliciesResponse] -> ShowS
ListRolePoliciesResponse -> String
(Int -> ListRolePoliciesResponse -> ShowS)
-> (ListRolePoliciesResponse -> String)
-> ([ListRolePoliciesResponse] -> ShowS)
-> Show ListRolePoliciesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListRolePoliciesResponse] -> ShowS
$cshowList :: [ListRolePoliciesResponse] -> ShowS
show :: ListRolePoliciesResponse -> String
$cshow :: ListRolePoliciesResponse -> String
showsPrec :: Int -> ListRolePoliciesResponse -> ShowS
$cshowsPrec :: Int -> ListRolePoliciesResponse -> ShowS
Prelude.Show, (forall x.
 ListRolePoliciesResponse -> Rep ListRolePoliciesResponse x)
-> (forall x.
    Rep ListRolePoliciesResponse x -> ListRolePoliciesResponse)
-> Generic ListRolePoliciesResponse
forall x.
Rep ListRolePoliciesResponse x -> ListRolePoliciesResponse
forall x.
ListRolePoliciesResponse -> Rep ListRolePoliciesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListRolePoliciesResponse x -> ListRolePoliciesResponse
$cfrom :: forall x.
ListRolePoliciesResponse -> Rep ListRolePoliciesResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListRolePoliciesResponse' 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', 'listRolePoliciesResponse_marker' - When @IsTruncated@ is @true@, this element is present and contains the
-- value to use for the @Marker@ parameter in a subsequent pagination
-- request.
--
-- 'isTruncated', 'listRolePoliciesResponse_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.
--
-- 'httpStatus', 'listRolePoliciesResponse_httpStatus' - The response's http status code.
--
-- 'policyNames', 'listRolePoliciesResponse_policyNames' - A list of policy names.
newListRolePoliciesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListRolePoliciesResponse
newListRolePoliciesResponse :: Int -> ListRolePoliciesResponse
newListRolePoliciesResponse Int
pHttpStatus_ =
  ListRolePoliciesResponse' :: Maybe Text
-> Maybe Bool -> Int -> [Text] -> ListRolePoliciesResponse
ListRolePoliciesResponse'
    { $sel:marker:ListRolePoliciesResponse' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:isTruncated:ListRolePoliciesResponse' :: Maybe Bool
isTruncated = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListRolePoliciesResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:policyNames:ListRolePoliciesResponse' :: [Text]
policyNames = [Text]
forall a. Monoid a => a
Prelude.mempty
    }

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

-- | 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.
listRolePoliciesResponse_isTruncated :: Lens.Lens' ListRolePoliciesResponse (Prelude.Maybe Prelude.Bool)
listRolePoliciesResponse_isTruncated :: (Maybe Bool -> f (Maybe Bool))
-> ListRolePoliciesResponse -> f ListRolePoliciesResponse
listRolePoliciesResponse_isTruncated = (ListRolePoliciesResponse -> Maybe Bool)
-> (ListRolePoliciesResponse
    -> Maybe Bool -> ListRolePoliciesResponse)
-> Lens' ListRolePoliciesResponse (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRolePoliciesResponse' {Maybe Bool
isTruncated :: Maybe Bool
$sel:isTruncated:ListRolePoliciesResponse' :: ListRolePoliciesResponse -> Maybe Bool
isTruncated} -> Maybe Bool
isTruncated) (\s :: ListRolePoliciesResponse
s@ListRolePoliciesResponse' {} Maybe Bool
a -> ListRolePoliciesResponse
s {$sel:isTruncated:ListRolePoliciesResponse' :: Maybe Bool
isTruncated = Maybe Bool
a} :: ListRolePoliciesResponse)

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

-- | A list of policy names.
listRolePoliciesResponse_policyNames :: Lens.Lens' ListRolePoliciesResponse [Prelude.Text]
listRolePoliciesResponse_policyNames :: ([Text] -> f [Text])
-> ListRolePoliciesResponse -> f ListRolePoliciesResponse
listRolePoliciesResponse_policyNames = (ListRolePoliciesResponse -> [Text])
-> (ListRolePoliciesResponse -> [Text] -> ListRolePoliciesResponse)
-> Lens
     ListRolePoliciesResponse ListRolePoliciesResponse [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRolePoliciesResponse' {[Text]
policyNames :: [Text]
$sel:policyNames:ListRolePoliciesResponse' :: ListRolePoliciesResponse -> [Text]
policyNames} -> [Text]
policyNames) (\s :: ListRolePoliciesResponse
s@ListRolePoliciesResponse' {} [Text]
a -> ListRolePoliciesResponse
s {$sel:policyNames:ListRolePoliciesResponse' :: [Text]
policyNames = [Text]
a} :: ListRolePoliciesResponse) (([Text] -> f [Text])
 -> ListRolePoliciesResponse -> f ListRolePoliciesResponse)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> ListRolePoliciesResponse
-> f ListRolePoliciesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.NFData ListRolePoliciesResponse