{-# 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.ListGroups
-- 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 groups that have the specified path prefix.
--
-- You can paginate the results using the @MaxItems@ and @Marker@
-- parameters.
--
-- This operation returns paginated results.
module Amazonka.IAM.ListGroups
  ( -- * Creating a Request
    ListGroups (..),
    newListGroups,

    -- * Request Lenses
    listGroups_pathPrefix,
    listGroups_marker,
    listGroups_maxItems,

    -- * Destructuring the Response
    ListGroupsResponse (..),
    newListGroupsResponse,

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

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

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

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

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

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

instance Prelude.Hashable ListGroups

instance Prelude.NFData ListGroups

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

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

instance Core.ToQuery ListGroups where
  toQuery :: ListGroups -> QueryString
toQuery ListGroups' {Maybe Natural
Maybe Text
maxItems :: Maybe Natural
marker :: Maybe Text
pathPrefix :: Maybe Text
$sel:maxItems:ListGroups' :: ListGroups -> Maybe Natural
$sel:marker:ListGroups' :: ListGroups -> Maybe Text
$sel:pathPrefix:ListGroups' :: ListGroups -> 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
"ListGroups" :: 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 ListGroups request.
--
-- /See:/ 'newListGroupsResponse' smart constructor.
data ListGroupsResponse = ListGroupsResponse'
  { -- | When @IsTruncated@ is @true@, this element is present and contains the
    -- value to use for the @Marker@ parameter in a subsequent pagination
    -- request.
    ListGroupsResponse -> 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.
    ListGroupsResponse -> Maybe Bool
isTruncated :: Prelude.Maybe Prelude.Bool,
    -- | The response's http status code.
    ListGroupsResponse -> Int
httpStatus :: Prelude.Int,
    -- | A list of groups.
    ListGroupsResponse -> [Group]
groups :: [Group]
  }
  deriving (ListGroupsResponse -> ListGroupsResponse -> Bool
(ListGroupsResponse -> ListGroupsResponse -> Bool)
-> (ListGroupsResponse -> ListGroupsResponse -> Bool)
-> Eq ListGroupsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListGroupsResponse -> ListGroupsResponse -> Bool
$c/= :: ListGroupsResponse -> ListGroupsResponse -> Bool
== :: ListGroupsResponse -> ListGroupsResponse -> Bool
$c== :: ListGroupsResponse -> ListGroupsResponse -> Bool
Prelude.Eq, ReadPrec [ListGroupsResponse]
ReadPrec ListGroupsResponse
Int -> ReadS ListGroupsResponse
ReadS [ListGroupsResponse]
(Int -> ReadS ListGroupsResponse)
-> ReadS [ListGroupsResponse]
-> ReadPrec ListGroupsResponse
-> ReadPrec [ListGroupsResponse]
-> Read ListGroupsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListGroupsResponse]
$creadListPrec :: ReadPrec [ListGroupsResponse]
readPrec :: ReadPrec ListGroupsResponse
$creadPrec :: ReadPrec ListGroupsResponse
readList :: ReadS [ListGroupsResponse]
$creadList :: ReadS [ListGroupsResponse]
readsPrec :: Int -> ReadS ListGroupsResponse
$creadsPrec :: Int -> ReadS ListGroupsResponse
Prelude.Read, Int -> ListGroupsResponse -> ShowS
[ListGroupsResponse] -> ShowS
ListGroupsResponse -> String
(Int -> ListGroupsResponse -> ShowS)
-> (ListGroupsResponse -> String)
-> ([ListGroupsResponse] -> ShowS)
-> Show ListGroupsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListGroupsResponse] -> ShowS
$cshowList :: [ListGroupsResponse] -> ShowS
show :: ListGroupsResponse -> String
$cshow :: ListGroupsResponse -> String
showsPrec :: Int -> ListGroupsResponse -> ShowS
$cshowsPrec :: Int -> ListGroupsResponse -> ShowS
Prelude.Show, (forall x. ListGroupsResponse -> Rep ListGroupsResponse x)
-> (forall x. Rep ListGroupsResponse x -> ListGroupsResponse)
-> Generic ListGroupsResponse
forall x. Rep ListGroupsResponse x -> ListGroupsResponse
forall x. ListGroupsResponse -> Rep ListGroupsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListGroupsResponse x -> ListGroupsResponse
$cfrom :: forall x. ListGroupsResponse -> Rep ListGroupsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListGroupsResponse' 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', 'listGroupsResponse_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', 'listGroupsResponse_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', 'listGroupsResponse_httpStatus' - The response's http status code.
--
-- 'groups', 'listGroupsResponse_groups' - A list of groups.
newListGroupsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListGroupsResponse
newListGroupsResponse :: Int -> ListGroupsResponse
newListGroupsResponse Int
pHttpStatus_ =
  ListGroupsResponse' :: Maybe Text -> Maybe Bool -> Int -> [Group] -> ListGroupsResponse
ListGroupsResponse'
    { $sel:marker:ListGroupsResponse' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:isTruncated:ListGroupsResponse' :: Maybe Bool
isTruncated = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListGroupsResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:groups:ListGroupsResponse' :: [Group]
groups = [Group]
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.
listGroupsResponse_marker :: Lens.Lens' ListGroupsResponse (Prelude.Maybe Prelude.Text)
listGroupsResponse_marker :: (Maybe Text -> f (Maybe Text))
-> ListGroupsResponse -> f ListGroupsResponse
listGroupsResponse_marker = (ListGroupsResponse -> Maybe Text)
-> (ListGroupsResponse -> Maybe Text -> ListGroupsResponse)
-> Lens' ListGroupsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListGroupsResponse' {Maybe Text
marker :: Maybe Text
$sel:marker:ListGroupsResponse' :: ListGroupsResponse -> Maybe Text
marker} -> Maybe Text
marker) (\s :: ListGroupsResponse
s@ListGroupsResponse' {} Maybe Text
a -> ListGroupsResponse
s {$sel:marker:ListGroupsResponse' :: Maybe Text
marker = Maybe Text
a} :: ListGroupsResponse)

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

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

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

instance Prelude.NFData ListGroupsResponse