{-# 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.ListAttachedRolePolicies
-- 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 all managed policies that are attached to the specified IAM role.
--
-- An IAM role can also have inline policies embedded with it. To list the
-- inline policies for a role, use ListRolePolicies. For 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. You can use the @PathPrefix@ parameter to limit the list of
-- policies to only those matching the specified path prefix. If there are
-- no policies attached to the specified role (or none that match the
-- specified path prefix), the operation returns an empty list.
--
-- This operation returns paginated results.
module Amazonka.IAM.ListAttachedRolePolicies
  ( -- * Creating a Request
    ListAttachedRolePolicies (..),
    newListAttachedRolePolicies,

    -- * Request Lenses
    listAttachedRolePolicies_marker,
    listAttachedRolePolicies_maxItems,
    listAttachedRolePolicies_pathPrefix,
    listAttachedRolePolicies_roleName,

    -- * Destructuring the Response
    ListAttachedRolePoliciesResponse (..),
    newListAttachedRolePoliciesResponse,

    -- * Response Lenses
    listAttachedRolePoliciesResponse_attachedPolicies,
    listAttachedRolePoliciesResponse_isTruncated,
    listAttachedRolePoliciesResponse_marker,
    listAttachedRolePoliciesResponse_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:/ 'newListAttachedRolePolicies' smart constructor.
data ListAttachedRolePolicies = ListAttachedRolePolicies'
  { -- | 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.
    ListAttachedRolePolicies -> 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.
    ListAttachedRolePolicies -> Maybe Natural
maxItems :: Prelude.Maybe Prelude.Natural,
    -- | The path prefix for filtering the results. This parameter is optional.
    -- If it is not included, it defaults to a slash (\/), listing all
    -- policies.
    --
    -- This parameter allows (through its
    -- <http://wikipedia.org/wiki/regex regex pattern>) a string of characters
    -- consisting of either a forward slash (\/) by itself or a string that
    -- must begin and end with forward slashes. In addition, it can contain any
    -- ASCII character from the ! (@\\u0021@) through the DEL character
    -- (@\\u007F@), including most punctuation characters, digits, and upper
    -- and lowercased letters.
    ListAttachedRolePolicies -> Maybe Text
pathPrefix :: Prelude.Maybe Prelude.Text,
    -- | The name (friendly name, not ARN) of the role to list attached 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: _+=,.\@-
    ListAttachedRolePolicies -> Text
roleName :: Prelude.Text
  }
  deriving (ListAttachedRolePolicies -> ListAttachedRolePolicies -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAttachedRolePolicies -> ListAttachedRolePolicies -> Bool
$c/= :: ListAttachedRolePolicies -> ListAttachedRolePolicies -> Bool
== :: ListAttachedRolePolicies -> ListAttachedRolePolicies -> Bool
$c== :: ListAttachedRolePolicies -> ListAttachedRolePolicies -> Bool
Prelude.Eq, ReadPrec [ListAttachedRolePolicies]
ReadPrec ListAttachedRolePolicies
Int -> ReadS ListAttachedRolePolicies
ReadS [ListAttachedRolePolicies]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAttachedRolePolicies]
$creadListPrec :: ReadPrec [ListAttachedRolePolicies]
readPrec :: ReadPrec ListAttachedRolePolicies
$creadPrec :: ReadPrec ListAttachedRolePolicies
readList :: ReadS [ListAttachedRolePolicies]
$creadList :: ReadS [ListAttachedRolePolicies]
readsPrec :: Int -> ReadS ListAttachedRolePolicies
$creadsPrec :: Int -> ReadS ListAttachedRolePolicies
Prelude.Read, Int -> ListAttachedRolePolicies -> ShowS
[ListAttachedRolePolicies] -> ShowS
ListAttachedRolePolicies -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAttachedRolePolicies] -> ShowS
$cshowList :: [ListAttachedRolePolicies] -> ShowS
show :: ListAttachedRolePolicies -> String
$cshow :: ListAttachedRolePolicies -> String
showsPrec :: Int -> ListAttachedRolePolicies -> ShowS
$cshowsPrec :: Int -> ListAttachedRolePolicies -> ShowS
Prelude.Show, forall x.
Rep ListAttachedRolePolicies x -> ListAttachedRolePolicies
forall x.
ListAttachedRolePolicies -> Rep ListAttachedRolePolicies x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListAttachedRolePolicies x -> ListAttachedRolePolicies
$cfrom :: forall x.
ListAttachedRolePolicies -> Rep ListAttachedRolePolicies x
Prelude.Generic)

-- |
-- Create a value of 'ListAttachedRolePolicies' 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', 'listAttachedRolePolicies_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', 'listAttachedRolePolicies_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.
--
-- 'pathPrefix', 'listAttachedRolePolicies_pathPrefix' - The path prefix for filtering the results. This parameter is optional.
-- If it is not included, it defaults to a slash (\/), listing all
-- policies.
--
-- This parameter allows (through its
-- <http://wikipedia.org/wiki/regex regex pattern>) a string of characters
-- consisting of either a forward slash (\/) by itself or a string that
-- must begin and end with forward slashes. In addition, it can contain any
-- ASCII character from the ! (@\\u0021@) through the DEL character
-- (@\\u007F@), including most punctuation characters, digits, and upper
-- and lowercased letters.
--
-- 'roleName', 'listAttachedRolePolicies_roleName' - The name (friendly name, not ARN) of the role to list attached 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: _+=,.\@-
newListAttachedRolePolicies ::
  -- | 'roleName'
  Prelude.Text ->
  ListAttachedRolePolicies
newListAttachedRolePolicies :: Text -> ListAttachedRolePolicies
newListAttachedRolePolicies Text
pRoleName_ =
  ListAttachedRolePolicies'
    { $sel:marker:ListAttachedRolePolicies' :: Maybe Text
marker = forall a. Maybe a
Prelude.Nothing,
      $sel:maxItems:ListAttachedRolePolicies' :: Maybe Natural
maxItems = forall a. Maybe a
Prelude.Nothing,
      $sel:pathPrefix:ListAttachedRolePolicies' :: Maybe Text
pathPrefix = forall a. Maybe a
Prelude.Nothing,
      $sel:roleName:ListAttachedRolePolicies' :: 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.
listAttachedRolePolicies_marker :: Lens.Lens' ListAttachedRolePolicies (Prelude.Maybe Prelude.Text)
listAttachedRolePolicies_marker :: Lens' ListAttachedRolePolicies (Maybe Text)
listAttachedRolePolicies_marker = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAttachedRolePolicies' {Maybe Text
marker :: Maybe Text
$sel:marker:ListAttachedRolePolicies' :: ListAttachedRolePolicies -> Maybe Text
marker} -> Maybe Text
marker) (\s :: ListAttachedRolePolicies
s@ListAttachedRolePolicies' {} Maybe Text
a -> ListAttachedRolePolicies
s {$sel:marker:ListAttachedRolePolicies' :: Maybe Text
marker = Maybe Text
a} :: ListAttachedRolePolicies)

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

-- | The path prefix for filtering the results. This parameter is optional.
-- If it is not included, it defaults to a slash (\/), listing all
-- policies.
--
-- This parameter allows (through its
-- <http://wikipedia.org/wiki/regex regex pattern>) a string of characters
-- consisting of either a forward slash (\/) by itself or a string that
-- must begin and end with forward slashes. In addition, it can contain any
-- ASCII character from the ! (@\\u0021@) through the DEL character
-- (@\\u007F@), including most punctuation characters, digits, and upper
-- and lowercased letters.
listAttachedRolePolicies_pathPrefix :: Lens.Lens' ListAttachedRolePolicies (Prelude.Maybe Prelude.Text)
listAttachedRolePolicies_pathPrefix :: Lens' ListAttachedRolePolicies (Maybe Text)
listAttachedRolePolicies_pathPrefix = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAttachedRolePolicies' {Maybe Text
pathPrefix :: Maybe Text
$sel:pathPrefix:ListAttachedRolePolicies' :: ListAttachedRolePolicies -> Maybe Text
pathPrefix} -> Maybe Text
pathPrefix) (\s :: ListAttachedRolePolicies
s@ListAttachedRolePolicies' {} Maybe Text
a -> ListAttachedRolePolicies
s {$sel:pathPrefix:ListAttachedRolePolicies' :: Maybe Text
pathPrefix = Maybe Text
a} :: ListAttachedRolePolicies)

-- | The name (friendly name, not ARN) of the role to list attached 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: _+=,.\@-
listAttachedRolePolicies_roleName :: Lens.Lens' ListAttachedRolePolicies Prelude.Text
listAttachedRolePolicies_roleName :: Lens' ListAttachedRolePolicies Text
listAttachedRolePolicies_roleName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAttachedRolePolicies' {Text
roleName :: Text
$sel:roleName:ListAttachedRolePolicies' :: ListAttachedRolePolicies -> Text
roleName} -> Text
roleName) (\s :: ListAttachedRolePolicies
s@ListAttachedRolePolicies' {} Text
a -> ListAttachedRolePolicies
s {$sel:roleName:ListAttachedRolePolicies' :: Text
roleName = Text
a} :: ListAttachedRolePolicies)

instance Core.AWSPager ListAttachedRolePolicies where
  page :: ListAttachedRolePolicies
-> AWSResponse ListAttachedRolePolicies
-> Maybe ListAttachedRolePolicies
page ListAttachedRolePolicies
rq AWSResponse ListAttachedRolePolicies
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListAttachedRolePolicies
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListAttachedRolePoliciesResponse (Maybe Bool)
listAttachedRolePoliciesResponse_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 ListAttachedRolePolicies
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListAttachedRolePoliciesResponse (Maybe Text)
listAttachedRolePoliciesResponse_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.$ ListAttachedRolePolicies
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListAttachedRolePolicies (Maybe Text)
listAttachedRolePolicies_marker
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListAttachedRolePolicies
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListAttachedRolePoliciesResponse (Maybe Text)
listAttachedRolePoliciesResponse_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 ListAttachedRolePolicies where
  type
    AWSResponse ListAttachedRolePolicies =
      ListAttachedRolePoliciesResponse
  request :: (Service -> Service)
-> ListAttachedRolePolicies -> Request ListAttachedRolePolicies
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 ListAttachedRolePolicies
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListAttachedRolePolicies)))
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
"ListAttachedRolePoliciesResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe [AttachedPolicy]
-> Maybe Bool
-> Maybe Text
-> Int
-> ListAttachedRolePoliciesResponse
ListAttachedRolePoliciesResponse'
            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
"AttachedPolicies"
                            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.<*> ([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.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable ListAttachedRolePolicies where
  hashWithSalt :: Int -> ListAttachedRolePolicies -> Int
hashWithSalt Int
_salt ListAttachedRolePolicies' {Maybe Natural
Maybe Text
Text
roleName :: Text
pathPrefix :: Maybe Text
maxItems :: Maybe Natural
marker :: Maybe Text
$sel:roleName:ListAttachedRolePolicies' :: ListAttachedRolePolicies -> Text
$sel:pathPrefix:ListAttachedRolePolicies' :: ListAttachedRolePolicies -> Maybe Text
$sel:maxItems:ListAttachedRolePolicies' :: ListAttachedRolePolicies -> Maybe Natural
$sel:marker:ListAttachedRolePolicies' :: ListAttachedRolePolicies -> 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` Maybe Text
pathPrefix
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
roleName

instance Prelude.NFData ListAttachedRolePolicies where
  rnf :: ListAttachedRolePolicies -> ()
rnf ListAttachedRolePolicies' {Maybe Natural
Maybe Text
Text
roleName :: Text
pathPrefix :: Maybe Text
maxItems :: Maybe Natural
marker :: Maybe Text
$sel:roleName:ListAttachedRolePolicies' :: ListAttachedRolePolicies -> Text
$sel:pathPrefix:ListAttachedRolePolicies' :: ListAttachedRolePolicies -> Maybe Text
$sel:maxItems:ListAttachedRolePolicies' :: ListAttachedRolePolicies -> Maybe Natural
$sel:marker:ListAttachedRolePolicies' :: ListAttachedRolePolicies -> 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 Maybe Text
pathPrefix
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
roleName

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

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

instance Data.ToQuery ListAttachedRolePolicies where
  toQuery :: ListAttachedRolePolicies -> QueryString
toQuery ListAttachedRolePolicies' {Maybe Natural
Maybe Text
Text
roleName :: Text
pathPrefix :: Maybe Text
maxItems :: Maybe Natural
marker :: Maybe Text
$sel:roleName:ListAttachedRolePolicies' :: ListAttachedRolePolicies -> Text
$sel:pathPrefix:ListAttachedRolePolicies' :: ListAttachedRolePolicies -> Maybe Text
$sel:maxItems:ListAttachedRolePolicies' :: ListAttachedRolePolicies -> Maybe Natural
$sel:marker:ListAttachedRolePolicies' :: ListAttachedRolePolicies -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"ListAttachedRolePolicies" :: 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
"PathPrefix" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
pathPrefix,
        ByteString
"RoleName" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
roleName
      ]

-- | Contains the response to a successful ListAttachedRolePolicies request.
--
-- /See:/ 'newListAttachedRolePoliciesResponse' smart constructor.
data ListAttachedRolePoliciesResponse = ListAttachedRolePoliciesResponse'
  { -- | A list of the attached policies.
    ListAttachedRolePoliciesResponse -> Maybe [AttachedPolicy]
attachedPolicies :: Prelude.Maybe [AttachedPolicy],
    -- | 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.
    ListAttachedRolePoliciesResponse -> 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.
    ListAttachedRolePoliciesResponse -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListAttachedRolePoliciesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListAttachedRolePoliciesResponse
-> ListAttachedRolePoliciesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAttachedRolePoliciesResponse
-> ListAttachedRolePoliciesResponse -> Bool
$c/= :: ListAttachedRolePoliciesResponse
-> ListAttachedRolePoliciesResponse -> Bool
== :: ListAttachedRolePoliciesResponse
-> ListAttachedRolePoliciesResponse -> Bool
$c== :: ListAttachedRolePoliciesResponse
-> ListAttachedRolePoliciesResponse -> Bool
Prelude.Eq, ReadPrec [ListAttachedRolePoliciesResponse]
ReadPrec ListAttachedRolePoliciesResponse
Int -> ReadS ListAttachedRolePoliciesResponse
ReadS [ListAttachedRolePoliciesResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAttachedRolePoliciesResponse]
$creadListPrec :: ReadPrec [ListAttachedRolePoliciesResponse]
readPrec :: ReadPrec ListAttachedRolePoliciesResponse
$creadPrec :: ReadPrec ListAttachedRolePoliciesResponse
readList :: ReadS [ListAttachedRolePoliciesResponse]
$creadList :: ReadS [ListAttachedRolePoliciesResponse]
readsPrec :: Int -> ReadS ListAttachedRolePoliciesResponse
$creadsPrec :: Int -> ReadS ListAttachedRolePoliciesResponse
Prelude.Read, Int -> ListAttachedRolePoliciesResponse -> ShowS
[ListAttachedRolePoliciesResponse] -> ShowS
ListAttachedRolePoliciesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAttachedRolePoliciesResponse] -> ShowS
$cshowList :: [ListAttachedRolePoliciesResponse] -> ShowS
show :: ListAttachedRolePoliciesResponse -> String
$cshow :: ListAttachedRolePoliciesResponse -> String
showsPrec :: Int -> ListAttachedRolePoliciesResponse -> ShowS
$cshowsPrec :: Int -> ListAttachedRolePoliciesResponse -> ShowS
Prelude.Show, forall x.
Rep ListAttachedRolePoliciesResponse x
-> ListAttachedRolePoliciesResponse
forall x.
ListAttachedRolePoliciesResponse
-> Rep ListAttachedRolePoliciesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListAttachedRolePoliciesResponse x
-> ListAttachedRolePoliciesResponse
$cfrom :: forall x.
ListAttachedRolePoliciesResponse
-> Rep ListAttachedRolePoliciesResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListAttachedRolePoliciesResponse' 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:
--
-- 'attachedPolicies', 'listAttachedRolePoliciesResponse_attachedPolicies' - A list of the attached policies.
--
-- 'isTruncated', 'listAttachedRolePoliciesResponse_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', 'listAttachedRolePoliciesResponse_marker' - When @IsTruncated@ is @true@, this element is present and contains the
-- value to use for the @Marker@ parameter in a subsequent pagination
-- request.
--
-- 'httpStatus', 'listAttachedRolePoliciesResponse_httpStatus' - The response's http status code.
newListAttachedRolePoliciesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListAttachedRolePoliciesResponse
newListAttachedRolePoliciesResponse :: Int -> ListAttachedRolePoliciesResponse
newListAttachedRolePoliciesResponse Int
pHttpStatus_ =
  ListAttachedRolePoliciesResponse'
    { $sel:attachedPolicies:ListAttachedRolePoliciesResponse' :: Maybe [AttachedPolicy]
attachedPolicies =
        forall a. Maybe a
Prelude.Nothing,
      $sel:isTruncated:ListAttachedRolePoliciesResponse' :: Maybe Bool
isTruncated = forall a. Maybe a
Prelude.Nothing,
      $sel:marker:ListAttachedRolePoliciesResponse' :: Maybe Text
marker = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListAttachedRolePoliciesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A list of the attached policies.
listAttachedRolePoliciesResponse_attachedPolicies :: Lens.Lens' ListAttachedRolePoliciesResponse (Prelude.Maybe [AttachedPolicy])
listAttachedRolePoliciesResponse_attachedPolicies :: Lens' ListAttachedRolePoliciesResponse (Maybe [AttachedPolicy])
listAttachedRolePoliciesResponse_attachedPolicies = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAttachedRolePoliciesResponse' {Maybe [AttachedPolicy]
attachedPolicies :: Maybe [AttachedPolicy]
$sel:attachedPolicies:ListAttachedRolePoliciesResponse' :: ListAttachedRolePoliciesResponse -> Maybe [AttachedPolicy]
attachedPolicies} -> Maybe [AttachedPolicy]
attachedPolicies) (\s :: ListAttachedRolePoliciesResponse
s@ListAttachedRolePoliciesResponse' {} Maybe [AttachedPolicy]
a -> ListAttachedRolePoliciesResponse
s {$sel:attachedPolicies:ListAttachedRolePoliciesResponse' :: Maybe [AttachedPolicy]
attachedPolicies = Maybe [AttachedPolicy]
a} :: ListAttachedRolePoliciesResponse) 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

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

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

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

instance
  Prelude.NFData
    ListAttachedRolePoliciesResponse
  where
  rnf :: ListAttachedRolePoliciesResponse -> ()
rnf ListAttachedRolePoliciesResponse' {Int
Maybe Bool
Maybe [AttachedPolicy]
Maybe Text
httpStatus :: Int
marker :: Maybe Text
isTruncated :: Maybe Bool
attachedPolicies :: Maybe [AttachedPolicy]
$sel:httpStatus:ListAttachedRolePoliciesResponse' :: ListAttachedRolePoliciesResponse -> Int
$sel:marker:ListAttachedRolePoliciesResponse' :: ListAttachedRolePoliciesResponse -> Maybe Text
$sel:isTruncated:ListAttachedRolePoliciesResponse' :: ListAttachedRolePoliciesResponse -> Maybe Bool
$sel:attachedPolicies:ListAttachedRolePoliciesResponse' :: ListAttachedRolePoliciesResponse -> Maybe [AttachedPolicy]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [AttachedPolicy]
attachedPolicies
      seq :: forall a b. a -> b -> b
`Prelude.seq` 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 Int
httpStatus