{-# 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.ListRoles
-- 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 IAM roles that have the specified path prefix. If there are
-- none, the operation returns an empty list. For more information about
-- roles, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/WorkingWithRoles.html Working with roles>.
--
-- IAM resource-listing operations return a subset of the available
-- attributes for the resource. For example, this operation does not return
-- tags, even though they are an attribute of the returned object. To view
-- all of the information for a role, see GetRole.
--
-- You can paginate the results using the @MaxItems@ and @Marker@
-- parameters.
--
-- This operation returns paginated results.
module Amazonka.IAM.ListRoles
  ( -- * Creating a Request
    ListRoles (..),
    newListRoles,

    -- * Request Lenses
    listRoles_pathPrefix,
    listRoles_marker,
    listRoles_maxItems,

    -- * Destructuring the Response
    ListRolesResponse (..),
    newListRolesResponse,

    -- * Response Lenses
    listRolesResponse_marker,
    listRolesResponse_isTruncated,
    listRolesResponse_httpStatus,
    listRolesResponse_roles,
  )
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:/ 'newListRoles' smart constructor.
data ListRoles = ListRoles'
  { -- | The path prefix for filtering the results. For example, the prefix
    -- @\/application_abc\/component_xyz\/@ gets all roles whose path starts
    -- with @\/application_abc\/component_xyz\/@.
    --
    -- This parameter is optional. If it is not included, it defaults to a
    -- slash (\/), listing all roles. 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.
    ListRoles -> Maybe Text
pathPrefix :: Prelude.Maybe Prelude.Text,
    -- | 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.
    ListRoles -> 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.
    ListRoles -> Maybe Natural
maxItems :: Prelude.Maybe Prelude.Natural
  }
  deriving (ListRoles -> ListRoles -> Bool
(ListRoles -> ListRoles -> Bool)
-> (ListRoles -> ListRoles -> Bool) -> Eq ListRoles
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListRoles -> ListRoles -> Bool
$c/= :: ListRoles -> ListRoles -> Bool
== :: ListRoles -> ListRoles -> Bool
$c== :: ListRoles -> ListRoles -> Bool
Prelude.Eq, ReadPrec [ListRoles]
ReadPrec ListRoles
Int -> ReadS ListRoles
ReadS [ListRoles]
(Int -> ReadS ListRoles)
-> ReadS [ListRoles]
-> ReadPrec ListRoles
-> ReadPrec [ListRoles]
-> Read ListRoles
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListRoles]
$creadListPrec :: ReadPrec [ListRoles]
readPrec :: ReadPrec ListRoles
$creadPrec :: ReadPrec ListRoles
readList :: ReadS [ListRoles]
$creadList :: ReadS [ListRoles]
readsPrec :: Int -> ReadS ListRoles
$creadsPrec :: Int -> ReadS ListRoles
Prelude.Read, Int -> ListRoles -> ShowS
[ListRoles] -> ShowS
ListRoles -> String
(Int -> ListRoles -> ShowS)
-> (ListRoles -> String)
-> ([ListRoles] -> ShowS)
-> Show ListRoles
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListRoles] -> ShowS
$cshowList :: [ListRoles] -> ShowS
show :: ListRoles -> String
$cshow :: ListRoles -> String
showsPrec :: Int -> ListRoles -> ShowS
$cshowsPrec :: Int -> ListRoles -> ShowS
Prelude.Show, (forall x. ListRoles -> Rep ListRoles x)
-> (forall x. Rep ListRoles x -> ListRoles) -> Generic ListRoles
forall x. Rep ListRoles x -> ListRoles
forall x. ListRoles -> Rep ListRoles x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListRoles x -> ListRoles
$cfrom :: forall x. ListRoles -> Rep ListRoles x
Prelude.Generic)

-- |
-- Create a value of 'ListRoles' 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:
--
-- 'pathPrefix', 'listRoles_pathPrefix' - The path prefix for filtering the results. For example, the prefix
-- @\/application_abc\/component_xyz\/@ gets all roles whose path starts
-- with @\/application_abc\/component_xyz\/@.
--
-- This parameter is optional. If it is not included, it defaults to a
-- slash (\/), listing all roles. 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.
--
-- 'marker', 'listRoles_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', 'listRoles_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.
newListRoles ::
  ListRoles
newListRoles :: ListRoles
newListRoles =
  ListRoles' :: Maybe Text -> Maybe Text -> Maybe Natural -> ListRoles
ListRoles'
    { $sel:pathPrefix:ListRoles' :: Maybe Text
pathPrefix = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:ListRoles' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxItems:ListRoles' :: Maybe Natural
maxItems = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | The path prefix for filtering the results. For example, the prefix
-- @\/application_abc\/component_xyz\/@ gets all roles whose path starts
-- with @\/application_abc\/component_xyz\/@.
--
-- This parameter is optional. If it is not included, it defaults to a
-- slash (\/), listing all roles. 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.
listRoles_pathPrefix :: Lens.Lens' ListRoles (Prelude.Maybe Prelude.Text)
listRoles_pathPrefix :: (Maybe Text -> f (Maybe Text)) -> ListRoles -> f ListRoles
listRoles_pathPrefix = (ListRoles -> Maybe Text)
-> (ListRoles -> Maybe Text -> ListRoles)
-> Lens ListRoles ListRoles (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRoles' {Maybe Text
pathPrefix :: Maybe Text
$sel:pathPrefix:ListRoles' :: ListRoles -> Maybe Text
pathPrefix} -> Maybe Text
pathPrefix) (\s :: ListRoles
s@ListRoles' {} Maybe Text
a -> ListRoles
s {$sel:pathPrefix:ListRoles' :: Maybe Text
pathPrefix = Maybe Text
a} :: ListRoles)

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

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

instance Core.AWSPager ListRoles where
  page :: ListRoles -> AWSResponse ListRoles -> Maybe ListRoles
page ListRoles
rq AWSResponse ListRoles
rs
    | Maybe Bool -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListRoles
ListRolesResponse
rs
            ListRolesResponse
-> Getting (First Bool) ListRolesResponse Bool -> Maybe Bool
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Bool -> Const (First Bool) (Maybe Bool))
-> ListRolesResponse -> Const (First Bool) ListRolesResponse
Lens' ListRolesResponse (Maybe Bool)
listRolesResponse_isTruncated ((Maybe Bool -> Const (First Bool) (Maybe Bool))
 -> ListRolesResponse -> Const (First Bool) ListRolesResponse)
-> ((Bool -> Const (First Bool) Bool)
    -> Maybe Bool -> Const (First Bool) (Maybe Bool))
-> Getting (First Bool) ListRolesResponse 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 ListRoles
forall a. Maybe a
Prelude.Nothing
    | Maybe Text -> Bool
forall a. Maybe a -> Bool
Prelude.isNothing
        ( AWSResponse ListRoles
ListRolesResponse
rs
            ListRolesResponse
-> Getting (First Text) ListRolesResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListRolesResponse -> Const (First Text) ListRolesResponse
Lens' ListRolesResponse (Maybe Text)
listRolesResponse_marker ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListRolesResponse -> Const (First Text) ListRolesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListRolesResponse 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 ListRoles
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListRoles -> Maybe ListRoles
forall a. a -> Maybe a
Prelude.Just (ListRoles -> Maybe ListRoles) -> ListRoles -> Maybe ListRoles
forall a b. (a -> b) -> a -> b
Prelude.$
        ListRoles
rq
          ListRoles -> (ListRoles -> ListRoles) -> ListRoles
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListRoles -> Identity ListRoles
Lens ListRoles ListRoles (Maybe Text) (Maybe Text)
listRoles_marker
          ((Maybe Text -> Identity (Maybe Text))
 -> ListRoles -> Identity ListRoles)
-> Maybe Text -> ListRoles -> ListRoles
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListRoles
ListRolesResponse
rs
          ListRolesResponse
-> Getting (First Text) ListRolesResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListRolesResponse -> Const (First Text) ListRolesResponse
Lens' ListRolesResponse (Maybe Text)
listRolesResponse_marker ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListRolesResponse -> Const (First Text) ListRolesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListRolesResponse 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 ListRoles where
  type AWSResponse ListRoles = ListRolesResponse
  request :: ListRoles -> Request ListRoles
request = Service -> ListRoles -> Request ListRoles
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy ListRoles
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListRoles)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse ListRoles))
-> Logger
-> Service
-> Proxy ListRoles
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListRoles)))
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
"ListRolesResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe Text -> Maybe Bool -> Int -> [Role] -> ListRolesResponse
ListRolesResponse'
            (Maybe Text -> Maybe Bool -> Int -> [Role] -> ListRolesResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Bool -> Int -> [Role] -> ListRolesResponse)
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 -> [Role] -> ListRolesResponse)
-> Either String (Maybe Bool)
-> Either String (Int -> [Role] -> ListRolesResponse)
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 -> [Role] -> ListRolesResponse)
-> Either String Int -> Either String ([Role] -> ListRolesResponse)
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 ([Role] -> ListRolesResponse)
-> Either String [Role] -> Either String ListRolesResponse
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
"Roles" 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 [Role]) -> Either String [Role]
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= Text -> [Node] -> Either String [Role]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member"
                        )
      )

instance Prelude.Hashable ListRoles

instance Prelude.NFData ListRoles

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

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

instance Core.ToQuery ListRoles where
  toQuery :: ListRoles -> QueryString
toQuery ListRoles' {Maybe Natural
Maybe Text
maxItems :: Maybe Natural
marker :: Maybe Text
pathPrefix :: Maybe Text
$sel:maxItems:ListRoles' :: ListRoles -> Maybe Natural
$sel:marker:ListRoles' :: ListRoles -> Maybe Text
$sel:pathPrefix:ListRoles' :: ListRoles -> 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
"ListRoles" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-05-08" :: Prelude.ByteString),
        ByteString
"PathPrefix" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
pathPrefix,
        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
      ]

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

-- |
-- Create a value of 'ListRolesResponse' 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', 'listRolesResponse_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', 'listRolesResponse_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', 'listRolesResponse_httpStatus' - The response's http status code.
--
-- 'roles', 'listRolesResponse_roles' - A list of roles.
newListRolesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListRolesResponse
newListRolesResponse :: Int -> ListRolesResponse
newListRolesResponse Int
pHttpStatus_ =
  ListRolesResponse' :: Maybe Text -> Maybe Bool -> Int -> [Role] -> ListRolesResponse
ListRolesResponse'
    { $sel:marker:ListRolesResponse' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:isTruncated:ListRolesResponse' :: Maybe Bool
isTruncated = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListRolesResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:roles:ListRolesResponse' :: [Role]
roles = [Role]
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.
listRolesResponse_marker :: Lens.Lens' ListRolesResponse (Prelude.Maybe Prelude.Text)
listRolesResponse_marker :: (Maybe Text -> f (Maybe Text))
-> ListRolesResponse -> f ListRolesResponse
listRolesResponse_marker = (ListRolesResponse -> Maybe Text)
-> (ListRolesResponse -> Maybe Text -> ListRolesResponse)
-> Lens' ListRolesResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRolesResponse' {Maybe Text
marker :: Maybe Text
$sel:marker:ListRolesResponse' :: ListRolesResponse -> Maybe Text
marker} -> Maybe Text
marker) (\s :: ListRolesResponse
s@ListRolesResponse' {} Maybe Text
a -> ListRolesResponse
s {$sel:marker:ListRolesResponse' :: Maybe Text
marker = Maybe Text
a} :: ListRolesResponse)

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

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

-- | A list of roles.
listRolesResponse_roles :: Lens.Lens' ListRolesResponse [Role]
listRolesResponse_roles :: ([Role] -> f [Role]) -> ListRolesResponse -> f ListRolesResponse
listRolesResponse_roles = (ListRolesResponse -> [Role])
-> (ListRolesResponse -> [Role] -> ListRolesResponse)
-> Lens ListRolesResponse ListRolesResponse [Role] [Role]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRolesResponse' {[Role]
roles :: [Role]
$sel:roles:ListRolesResponse' :: ListRolesResponse -> [Role]
roles} -> [Role]
roles) (\s :: ListRolesResponse
s@ListRolesResponse' {} [Role]
a -> ListRolesResponse
s {$sel:roles:ListRolesResponse' :: [Role]
roles = [Role]
a} :: ListRolesResponse) (([Role] -> f [Role]) -> ListRolesResponse -> f ListRolesResponse)
-> (([Role] -> f [Role]) -> [Role] -> f [Role])
-> ([Role] -> f [Role])
-> ListRolesResponse
-> f ListRolesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Role] -> f [Role]) -> [Role] -> f [Role]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.NFData ListRolesResponse