{-# 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.ListGroupsForUser
-- 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 the specified IAM user belongs to.
--
-- You can paginate the results using the @MaxItems@ and @Marker@
-- parameters.
--
-- This operation returns paginated results.
module Amazonka.IAM.ListGroupsForUser
  ( -- * Creating a Request
    ListGroupsForUser (..),
    newListGroupsForUser,

    -- * Request Lenses
    listGroupsForUser_marker,
    listGroupsForUser_maxItems,
    listGroupsForUser_userName,

    -- * Destructuring the Response
    ListGroupsForUserResponse (..),
    newListGroupsForUserResponse,

    -- * Response Lenses
    listGroupsForUserResponse_marker,
    listGroupsForUserResponse_isTruncated,
    listGroupsForUserResponse_httpStatus,
    listGroupsForUserResponse_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:/ 'newListGroupsForUser' smart constructor.
data ListGroupsForUser = ListGroupsForUser'
  { -- | 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.
    ListGroupsForUser -> 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.
    ListGroupsForUser -> Maybe Natural
maxItems :: Prelude.Maybe Prelude.Natural,
    -- | The name of the user to list groups 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: _+=,.\@-
    ListGroupsForUser -> Text
userName :: Prelude.Text
  }
  deriving (ListGroupsForUser -> ListGroupsForUser -> Bool
(ListGroupsForUser -> ListGroupsForUser -> Bool)
-> (ListGroupsForUser -> ListGroupsForUser -> Bool)
-> Eq ListGroupsForUser
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListGroupsForUser -> ListGroupsForUser -> Bool
$c/= :: ListGroupsForUser -> ListGroupsForUser -> Bool
== :: ListGroupsForUser -> ListGroupsForUser -> Bool
$c== :: ListGroupsForUser -> ListGroupsForUser -> Bool
Prelude.Eq, ReadPrec [ListGroupsForUser]
ReadPrec ListGroupsForUser
Int -> ReadS ListGroupsForUser
ReadS [ListGroupsForUser]
(Int -> ReadS ListGroupsForUser)
-> ReadS [ListGroupsForUser]
-> ReadPrec ListGroupsForUser
-> ReadPrec [ListGroupsForUser]
-> Read ListGroupsForUser
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListGroupsForUser]
$creadListPrec :: ReadPrec [ListGroupsForUser]
readPrec :: ReadPrec ListGroupsForUser
$creadPrec :: ReadPrec ListGroupsForUser
readList :: ReadS [ListGroupsForUser]
$creadList :: ReadS [ListGroupsForUser]
readsPrec :: Int -> ReadS ListGroupsForUser
$creadsPrec :: Int -> ReadS ListGroupsForUser
Prelude.Read, Int -> ListGroupsForUser -> ShowS
[ListGroupsForUser] -> ShowS
ListGroupsForUser -> String
(Int -> ListGroupsForUser -> ShowS)
-> (ListGroupsForUser -> String)
-> ([ListGroupsForUser] -> ShowS)
-> Show ListGroupsForUser
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListGroupsForUser] -> ShowS
$cshowList :: [ListGroupsForUser] -> ShowS
show :: ListGroupsForUser -> String
$cshow :: ListGroupsForUser -> String
showsPrec :: Int -> ListGroupsForUser -> ShowS
$cshowsPrec :: Int -> ListGroupsForUser -> ShowS
Prelude.Show, (forall x. ListGroupsForUser -> Rep ListGroupsForUser x)
-> (forall x. Rep ListGroupsForUser x -> ListGroupsForUser)
-> Generic ListGroupsForUser
forall x. Rep ListGroupsForUser x -> ListGroupsForUser
forall x. ListGroupsForUser -> Rep ListGroupsForUser x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListGroupsForUser x -> ListGroupsForUser
$cfrom :: forall x. ListGroupsForUser -> Rep ListGroupsForUser x
Prelude.Generic)

-- |
-- Create a value of 'ListGroupsForUser' 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', 'listGroupsForUser_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', 'listGroupsForUser_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.
--
-- 'userName', 'listGroupsForUser_userName' - The name of the user to list groups 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: _+=,.\@-
newListGroupsForUser ::
  -- | 'userName'
  Prelude.Text ->
  ListGroupsForUser
newListGroupsForUser :: Text -> ListGroupsForUser
newListGroupsForUser Text
pUserName_ =
  ListGroupsForUser' :: Maybe Text -> Maybe Natural -> Text -> ListGroupsForUser
ListGroupsForUser'
    { $sel:marker:ListGroupsForUser' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxItems:ListGroupsForUser' :: Maybe Natural
maxItems = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:userName:ListGroupsForUser' :: Text
userName = Text
pUserName_
    }

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

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

-- | The name of the user to list groups 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: _+=,.\@-
listGroupsForUser_userName :: Lens.Lens' ListGroupsForUser Prelude.Text
listGroupsForUser_userName :: (Text -> f Text) -> ListGroupsForUser -> f ListGroupsForUser
listGroupsForUser_userName = (ListGroupsForUser -> Text)
-> (ListGroupsForUser -> Text -> ListGroupsForUser)
-> Lens ListGroupsForUser ListGroupsForUser Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListGroupsForUser' {Text
userName :: Text
$sel:userName:ListGroupsForUser' :: ListGroupsForUser -> Text
userName} -> Text
userName) (\s :: ListGroupsForUser
s@ListGroupsForUser' {} Text
a -> ListGroupsForUser
s {$sel:userName:ListGroupsForUser' :: Text
userName = Text
a} :: ListGroupsForUser)

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

instance Prelude.NFData ListGroupsForUser

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

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

instance Core.ToQuery ListGroupsForUser where
  toQuery :: ListGroupsForUser -> QueryString
toQuery ListGroupsForUser' {Maybe Natural
Maybe Text
Text
userName :: Text
maxItems :: Maybe Natural
marker :: Maybe Text
$sel:userName:ListGroupsForUser' :: ListGroupsForUser -> Text
$sel:maxItems:ListGroupsForUser' :: ListGroupsForUser -> Maybe Natural
$sel:marker:ListGroupsForUser' :: ListGroupsForUser -> 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
"ListGroupsForUser" :: 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
"UserName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
userName
      ]

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

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

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

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

-- | A list of groups.
listGroupsForUserResponse_groups :: Lens.Lens' ListGroupsForUserResponse [Group]
listGroupsForUserResponse_groups :: ([Group] -> f [Group])
-> ListGroupsForUserResponse -> f ListGroupsForUserResponse
listGroupsForUserResponse_groups = (ListGroupsForUserResponse -> [Group])
-> (ListGroupsForUserResponse
    -> [Group] -> ListGroupsForUserResponse)
-> Lens
     ListGroupsForUserResponse ListGroupsForUserResponse [Group] [Group]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListGroupsForUserResponse' {[Group]
groups :: [Group]
$sel:groups:ListGroupsForUserResponse' :: ListGroupsForUserResponse -> [Group]
groups} -> [Group]
groups) (\s :: ListGroupsForUserResponse
s@ListGroupsForUserResponse' {} [Group]
a -> ListGroupsForUserResponse
s {$sel:groups:ListGroupsForUserResponse' :: [Group]
groups = [Group]
a} :: ListGroupsForUserResponse) (([Group] -> f [Group])
 -> ListGroupsForUserResponse -> f ListGroupsForUserResponse)
-> (([Group] -> f [Group]) -> [Group] -> f [Group])
-> ([Group] -> f [Group])
-> ListGroupsForUserResponse
-> f ListGroupsForUserResponse
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 ListGroupsForUserResponse