{-# 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.CognitoIdentityProvider.AdminListGroupsForUser
-- 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 groups that the user belongs to.
--
-- Calling this action requires developer credentials.
--
-- This operation returns paginated results.
module Amazonka.CognitoIdentityProvider.AdminListGroupsForUser
  ( -- * Creating a Request
    AdminListGroupsForUser (..),
    newAdminListGroupsForUser,

    -- * Request Lenses
    adminListGroupsForUser_nextToken,
    adminListGroupsForUser_limit,
    adminListGroupsForUser_username,
    adminListGroupsForUser_userPoolId,

    -- * Destructuring the Response
    AdminListGroupsForUserResponse (..),
    newAdminListGroupsForUserResponse,

    -- * Response Lenses
    adminListGroupsForUserResponse_groups,
    adminListGroupsForUserResponse_nextToken,
    adminListGroupsForUserResponse_httpStatus,
  )
where

import Amazonka.CognitoIdentityProvider.Types
import qualified Amazonka.Core as Core
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:/ 'newAdminListGroupsForUser' smart constructor.
data AdminListGroupsForUser = AdminListGroupsForUser'
  { -- | An identifier that was returned from the previous call to this
    -- operation, which can be used to return the next set of items in the
    -- list.
    AdminListGroupsForUser -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The limit of the request to list groups.
    AdminListGroupsForUser -> Maybe Natural
limit :: Prelude.Maybe Prelude.Natural,
    -- | The username for the user.
    AdminListGroupsForUser -> Sensitive Text
username :: Core.Sensitive Prelude.Text,
    -- | The user pool ID for the user pool.
    AdminListGroupsForUser -> Text
userPoolId :: Prelude.Text
  }
  deriving (AdminListGroupsForUser -> AdminListGroupsForUser -> Bool
(AdminListGroupsForUser -> AdminListGroupsForUser -> Bool)
-> (AdminListGroupsForUser -> AdminListGroupsForUser -> Bool)
-> Eq AdminListGroupsForUser
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AdminListGroupsForUser -> AdminListGroupsForUser -> Bool
$c/= :: AdminListGroupsForUser -> AdminListGroupsForUser -> Bool
== :: AdminListGroupsForUser -> AdminListGroupsForUser -> Bool
$c== :: AdminListGroupsForUser -> AdminListGroupsForUser -> Bool
Prelude.Eq, Int -> AdminListGroupsForUser -> ShowS
[AdminListGroupsForUser] -> ShowS
AdminListGroupsForUser -> String
(Int -> AdminListGroupsForUser -> ShowS)
-> (AdminListGroupsForUser -> String)
-> ([AdminListGroupsForUser] -> ShowS)
-> Show AdminListGroupsForUser
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AdminListGroupsForUser] -> ShowS
$cshowList :: [AdminListGroupsForUser] -> ShowS
show :: AdminListGroupsForUser -> String
$cshow :: AdminListGroupsForUser -> String
showsPrec :: Int -> AdminListGroupsForUser -> ShowS
$cshowsPrec :: Int -> AdminListGroupsForUser -> ShowS
Prelude.Show, (forall x. AdminListGroupsForUser -> Rep AdminListGroupsForUser x)
-> (forall x.
    Rep AdminListGroupsForUser x -> AdminListGroupsForUser)
-> Generic AdminListGroupsForUser
forall x. Rep AdminListGroupsForUser x -> AdminListGroupsForUser
forall x. AdminListGroupsForUser -> Rep AdminListGroupsForUser x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AdminListGroupsForUser x -> AdminListGroupsForUser
$cfrom :: forall x. AdminListGroupsForUser -> Rep AdminListGroupsForUser x
Prelude.Generic)

-- |
-- Create a value of 'AdminListGroupsForUser' 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:
--
-- 'nextToken', 'adminListGroupsForUser_nextToken' - An identifier that was returned from the previous call to this
-- operation, which can be used to return the next set of items in the
-- list.
--
-- 'limit', 'adminListGroupsForUser_limit' - The limit of the request to list groups.
--
-- 'username', 'adminListGroupsForUser_username' - The username for the user.
--
-- 'userPoolId', 'adminListGroupsForUser_userPoolId' - The user pool ID for the user pool.
newAdminListGroupsForUser ::
  -- | 'username'
  Prelude.Text ->
  -- | 'userPoolId'
  Prelude.Text ->
  AdminListGroupsForUser
newAdminListGroupsForUser :: Text -> Text -> AdminListGroupsForUser
newAdminListGroupsForUser Text
pUsername_ Text
pUserPoolId_ =
  AdminListGroupsForUser' :: Maybe Text
-> Maybe Natural
-> Sensitive Text
-> Text
-> AdminListGroupsForUser
AdminListGroupsForUser'
    { $sel:nextToken:AdminListGroupsForUser' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:limit:AdminListGroupsForUser' :: Maybe Natural
limit = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:username:AdminListGroupsForUser' :: Sensitive Text
username = Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text))
forall a. Iso' (Sensitive a) a
Core._Sensitive (Tagged Text (Identity Text)
 -> Tagged (Sensitive Text) (Identity (Sensitive Text)))
-> Text -> Sensitive Text
forall t b. AReview t b -> b -> t
Lens.# Text
pUsername_,
      $sel:userPoolId:AdminListGroupsForUser' :: Text
userPoolId = Text
pUserPoolId_
    }

-- | An identifier that was returned from the previous call to this
-- operation, which can be used to return the next set of items in the
-- list.
adminListGroupsForUser_nextToken :: Lens.Lens' AdminListGroupsForUser (Prelude.Maybe Prelude.Text)
adminListGroupsForUser_nextToken :: (Maybe Text -> f (Maybe Text))
-> AdminListGroupsForUser -> f AdminListGroupsForUser
adminListGroupsForUser_nextToken = (AdminListGroupsForUser -> Maybe Text)
-> (AdminListGroupsForUser -> Maybe Text -> AdminListGroupsForUser)
-> Lens
     AdminListGroupsForUser
     AdminListGroupsForUser
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AdminListGroupsForUser' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:AdminListGroupsForUser' :: AdminListGroupsForUser -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: AdminListGroupsForUser
s@AdminListGroupsForUser' {} Maybe Text
a -> AdminListGroupsForUser
s {$sel:nextToken:AdminListGroupsForUser' :: Maybe Text
nextToken = Maybe Text
a} :: AdminListGroupsForUser)

-- | The limit of the request to list groups.
adminListGroupsForUser_limit :: Lens.Lens' AdminListGroupsForUser (Prelude.Maybe Prelude.Natural)
adminListGroupsForUser_limit :: (Maybe Natural -> f (Maybe Natural))
-> AdminListGroupsForUser -> f AdminListGroupsForUser
adminListGroupsForUser_limit = (AdminListGroupsForUser -> Maybe Natural)
-> (AdminListGroupsForUser
    -> Maybe Natural -> AdminListGroupsForUser)
-> Lens
     AdminListGroupsForUser
     AdminListGroupsForUser
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AdminListGroupsForUser' {Maybe Natural
limit :: Maybe Natural
$sel:limit:AdminListGroupsForUser' :: AdminListGroupsForUser -> Maybe Natural
limit} -> Maybe Natural
limit) (\s :: AdminListGroupsForUser
s@AdminListGroupsForUser' {} Maybe Natural
a -> AdminListGroupsForUser
s {$sel:limit:AdminListGroupsForUser' :: Maybe Natural
limit = Maybe Natural
a} :: AdminListGroupsForUser)

-- | The username for the user.
adminListGroupsForUser_username :: Lens.Lens' AdminListGroupsForUser Prelude.Text
adminListGroupsForUser_username :: (Text -> f Text)
-> AdminListGroupsForUser -> f AdminListGroupsForUser
adminListGroupsForUser_username = (AdminListGroupsForUser -> Sensitive Text)
-> (AdminListGroupsForUser
    -> Sensitive Text -> AdminListGroupsForUser)
-> Lens
     AdminListGroupsForUser
     AdminListGroupsForUser
     (Sensitive Text)
     (Sensitive Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AdminListGroupsForUser' {Sensitive Text
username :: Sensitive Text
$sel:username:AdminListGroupsForUser' :: AdminListGroupsForUser -> Sensitive Text
username} -> Sensitive Text
username) (\s :: AdminListGroupsForUser
s@AdminListGroupsForUser' {} Sensitive Text
a -> AdminListGroupsForUser
s {$sel:username:AdminListGroupsForUser' :: Sensitive Text
username = Sensitive Text
a} :: AdminListGroupsForUser) ((Sensitive Text -> f (Sensitive Text))
 -> AdminListGroupsForUser -> f AdminListGroupsForUser)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> AdminListGroupsForUser
-> f AdminListGroupsForUser
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> f Text) -> Sensitive Text -> f (Sensitive Text)
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | The user pool ID for the user pool.
adminListGroupsForUser_userPoolId :: Lens.Lens' AdminListGroupsForUser Prelude.Text
adminListGroupsForUser_userPoolId :: (Text -> f Text)
-> AdminListGroupsForUser -> f AdminListGroupsForUser
adminListGroupsForUser_userPoolId = (AdminListGroupsForUser -> Text)
-> (AdminListGroupsForUser -> Text -> AdminListGroupsForUser)
-> Lens AdminListGroupsForUser AdminListGroupsForUser Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AdminListGroupsForUser' {Text
userPoolId :: Text
$sel:userPoolId:AdminListGroupsForUser' :: AdminListGroupsForUser -> Text
userPoolId} -> Text
userPoolId) (\s :: AdminListGroupsForUser
s@AdminListGroupsForUser' {} Text
a -> AdminListGroupsForUser
s {$sel:userPoolId:AdminListGroupsForUser' :: Text
userPoolId = Text
a} :: AdminListGroupsForUser)

instance Core.AWSPager AdminListGroupsForUser where
  page :: AdminListGroupsForUser
-> AWSResponse AdminListGroupsForUser
-> Maybe AdminListGroupsForUser
page AdminListGroupsForUser
rq AWSResponse AdminListGroupsForUser
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse AdminListGroupsForUser
AdminListGroupsForUserResponse
rs
            AdminListGroupsForUserResponse
-> Getting (First Text) AdminListGroupsForUserResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> AdminListGroupsForUserResponse
-> Const (First Text) AdminListGroupsForUserResponse
Lens' AdminListGroupsForUserResponse (Maybe Text)
adminListGroupsForUserResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> AdminListGroupsForUserResponse
 -> Const (First Text) AdminListGroupsForUserResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) AdminListGroupsForUserResponse 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 AdminListGroupsForUser
forall a. Maybe a
Prelude.Nothing
    | Maybe [GroupType] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse AdminListGroupsForUser
AdminListGroupsForUserResponse
rs
            AdminListGroupsForUserResponse
-> Getting
     (First [GroupType]) AdminListGroupsForUserResponse [GroupType]
-> Maybe [GroupType]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [GroupType]
 -> Const (First [GroupType]) (Maybe [GroupType]))
-> AdminListGroupsForUserResponse
-> Const (First [GroupType]) AdminListGroupsForUserResponse
Lens' AdminListGroupsForUserResponse (Maybe [GroupType])
adminListGroupsForUserResponse_groups
              ((Maybe [GroupType]
  -> Const (First [GroupType]) (Maybe [GroupType]))
 -> AdminListGroupsForUserResponse
 -> Const (First [GroupType]) AdminListGroupsForUserResponse)
-> (([GroupType] -> Const (First [GroupType]) [GroupType])
    -> Maybe [GroupType]
    -> Const (First [GroupType]) (Maybe [GroupType]))
-> Getting
     (First [GroupType]) AdminListGroupsForUserResponse [GroupType]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([GroupType] -> Const (First [GroupType]) [GroupType])
-> Maybe [GroupType]
-> Const (First [GroupType]) (Maybe [GroupType])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe AdminListGroupsForUser
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      AdminListGroupsForUser -> Maybe AdminListGroupsForUser
forall a. a -> Maybe a
Prelude.Just (AdminListGroupsForUser -> Maybe AdminListGroupsForUser)
-> AdminListGroupsForUser -> Maybe AdminListGroupsForUser
forall a b. (a -> b) -> a -> b
Prelude.$
        AdminListGroupsForUser
rq
          AdminListGroupsForUser
-> (AdminListGroupsForUser -> AdminListGroupsForUser)
-> AdminListGroupsForUser
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> AdminListGroupsForUser -> Identity AdminListGroupsForUser
Lens
  AdminListGroupsForUser
  AdminListGroupsForUser
  (Maybe Text)
  (Maybe Text)
adminListGroupsForUser_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> AdminListGroupsForUser -> Identity AdminListGroupsForUser)
-> Maybe Text -> AdminListGroupsForUser -> AdminListGroupsForUser
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse AdminListGroupsForUser
AdminListGroupsForUserResponse
rs
          AdminListGroupsForUserResponse
-> Getting (First Text) AdminListGroupsForUserResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> AdminListGroupsForUserResponse
-> Const (First Text) AdminListGroupsForUserResponse
Lens' AdminListGroupsForUserResponse (Maybe Text)
adminListGroupsForUserResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> AdminListGroupsForUserResponse
 -> Const (First Text) AdminListGroupsForUserResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) AdminListGroupsForUserResponse 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 AdminListGroupsForUser where
  type
    AWSResponse AdminListGroupsForUser =
      AdminListGroupsForUserResponse
  request :: AdminListGroupsForUser -> Request AdminListGroupsForUser
request = Service -> AdminListGroupsForUser -> Request AdminListGroupsForUser
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy AdminListGroupsForUser
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse AdminListGroupsForUser)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse AdminListGroupsForUser))
-> Logger
-> Service
-> Proxy AdminListGroupsForUser
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse AdminListGroupsForUser)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe [GroupType]
-> Maybe Text -> Int -> AdminListGroupsForUserResponse
AdminListGroupsForUserResponse'
            (Maybe [GroupType]
 -> Maybe Text -> Int -> AdminListGroupsForUserResponse)
-> Either String (Maybe [GroupType])
-> Either
     String (Maybe Text -> Int -> AdminListGroupsForUserResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [GroupType]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Groups" Either String (Maybe (Maybe [GroupType]))
-> Maybe [GroupType] -> Either String (Maybe [GroupType])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [GroupType]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Maybe Text -> Int -> AdminListGroupsForUserResponse)
-> Either String (Maybe Text)
-> Either String (Int -> AdminListGroupsForUserResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"NextToken")
            Either String (Int -> AdminListGroupsForUserResponse)
-> Either String Int
-> Either String AdminListGroupsForUserResponse
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))
      )

instance Prelude.Hashable AdminListGroupsForUser

instance Prelude.NFData AdminListGroupsForUser

instance Core.ToHeaders AdminListGroupsForUser where
  toHeaders :: AdminListGroupsForUser -> ResponseHeaders
toHeaders =
    ResponseHeaders -> AdminListGroupsForUser -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AWSCognitoIdentityProviderService.AdminListGroupsForUser" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON AdminListGroupsForUser where
  toJSON :: AdminListGroupsForUser -> Value
toJSON AdminListGroupsForUser' {Maybe Natural
Maybe Text
Text
Sensitive Text
userPoolId :: Text
username :: Sensitive Text
limit :: Maybe Natural
nextToken :: Maybe Text
$sel:userPoolId:AdminListGroupsForUser' :: AdminListGroupsForUser -> Text
$sel:username:AdminListGroupsForUser' :: AdminListGroupsForUser -> Sensitive Text
$sel:limit:AdminListGroupsForUser' :: AdminListGroupsForUser -> Maybe Natural
$sel:nextToken:AdminListGroupsForUser' :: AdminListGroupsForUser -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"NextToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            (Text
"Limit" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
limit,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Username" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Sensitive Text
username),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"UserPoolId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
userPoolId)
          ]
      )

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

instance Core.ToQuery AdminListGroupsForUser where
  toQuery :: AdminListGroupsForUser -> QueryString
toQuery = QueryString -> AdminListGroupsForUser -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newAdminListGroupsForUserResponse' smart constructor.
data AdminListGroupsForUserResponse = AdminListGroupsForUserResponse'
  { -- | The groups that the user belongs to.
    AdminListGroupsForUserResponse -> Maybe [GroupType]
groups :: Prelude.Maybe [GroupType],
    -- | An identifier that was returned from the previous call to this
    -- operation, which can be used to return the next set of items in the
    -- list.
    AdminListGroupsForUserResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    AdminListGroupsForUserResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (AdminListGroupsForUserResponse
-> AdminListGroupsForUserResponse -> Bool
(AdminListGroupsForUserResponse
 -> AdminListGroupsForUserResponse -> Bool)
-> (AdminListGroupsForUserResponse
    -> AdminListGroupsForUserResponse -> Bool)
-> Eq AdminListGroupsForUserResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AdminListGroupsForUserResponse
-> AdminListGroupsForUserResponse -> Bool
$c/= :: AdminListGroupsForUserResponse
-> AdminListGroupsForUserResponse -> Bool
== :: AdminListGroupsForUserResponse
-> AdminListGroupsForUserResponse -> Bool
$c== :: AdminListGroupsForUserResponse
-> AdminListGroupsForUserResponse -> Bool
Prelude.Eq, ReadPrec [AdminListGroupsForUserResponse]
ReadPrec AdminListGroupsForUserResponse
Int -> ReadS AdminListGroupsForUserResponse
ReadS [AdminListGroupsForUserResponse]
(Int -> ReadS AdminListGroupsForUserResponse)
-> ReadS [AdminListGroupsForUserResponse]
-> ReadPrec AdminListGroupsForUserResponse
-> ReadPrec [AdminListGroupsForUserResponse]
-> Read AdminListGroupsForUserResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AdminListGroupsForUserResponse]
$creadListPrec :: ReadPrec [AdminListGroupsForUserResponse]
readPrec :: ReadPrec AdminListGroupsForUserResponse
$creadPrec :: ReadPrec AdminListGroupsForUserResponse
readList :: ReadS [AdminListGroupsForUserResponse]
$creadList :: ReadS [AdminListGroupsForUserResponse]
readsPrec :: Int -> ReadS AdminListGroupsForUserResponse
$creadsPrec :: Int -> ReadS AdminListGroupsForUserResponse
Prelude.Read, Int -> AdminListGroupsForUserResponse -> ShowS
[AdminListGroupsForUserResponse] -> ShowS
AdminListGroupsForUserResponse -> String
(Int -> AdminListGroupsForUserResponse -> ShowS)
-> (AdminListGroupsForUserResponse -> String)
-> ([AdminListGroupsForUserResponse] -> ShowS)
-> Show AdminListGroupsForUserResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AdminListGroupsForUserResponse] -> ShowS
$cshowList :: [AdminListGroupsForUserResponse] -> ShowS
show :: AdminListGroupsForUserResponse -> String
$cshow :: AdminListGroupsForUserResponse -> String
showsPrec :: Int -> AdminListGroupsForUserResponse -> ShowS
$cshowsPrec :: Int -> AdminListGroupsForUserResponse -> ShowS
Prelude.Show, (forall x.
 AdminListGroupsForUserResponse
 -> Rep AdminListGroupsForUserResponse x)
-> (forall x.
    Rep AdminListGroupsForUserResponse x
    -> AdminListGroupsForUserResponse)
-> Generic AdminListGroupsForUserResponse
forall x.
Rep AdminListGroupsForUserResponse x
-> AdminListGroupsForUserResponse
forall x.
AdminListGroupsForUserResponse
-> Rep AdminListGroupsForUserResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AdminListGroupsForUserResponse x
-> AdminListGroupsForUserResponse
$cfrom :: forall x.
AdminListGroupsForUserResponse
-> Rep AdminListGroupsForUserResponse x
Prelude.Generic)

-- |
-- Create a value of 'AdminListGroupsForUserResponse' 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:
--
-- 'groups', 'adminListGroupsForUserResponse_groups' - The groups that the user belongs to.
--
-- 'nextToken', 'adminListGroupsForUserResponse_nextToken' - An identifier that was returned from the previous call to this
-- operation, which can be used to return the next set of items in the
-- list.
--
-- 'httpStatus', 'adminListGroupsForUserResponse_httpStatus' - The response's http status code.
newAdminListGroupsForUserResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  AdminListGroupsForUserResponse
newAdminListGroupsForUserResponse :: Int -> AdminListGroupsForUserResponse
newAdminListGroupsForUserResponse Int
pHttpStatus_ =
  AdminListGroupsForUserResponse' :: Maybe [GroupType]
-> Maybe Text -> Int -> AdminListGroupsForUserResponse
AdminListGroupsForUserResponse'
    { $sel:groups:AdminListGroupsForUserResponse' :: Maybe [GroupType]
groups =
        Maybe [GroupType]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:AdminListGroupsForUserResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:AdminListGroupsForUserResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The groups that the user belongs to.
adminListGroupsForUserResponse_groups :: Lens.Lens' AdminListGroupsForUserResponse (Prelude.Maybe [GroupType])
adminListGroupsForUserResponse_groups :: (Maybe [GroupType] -> f (Maybe [GroupType]))
-> AdminListGroupsForUserResponse
-> f AdminListGroupsForUserResponse
adminListGroupsForUserResponse_groups = (AdminListGroupsForUserResponse -> Maybe [GroupType])
-> (AdminListGroupsForUserResponse
    -> Maybe [GroupType] -> AdminListGroupsForUserResponse)
-> Lens' AdminListGroupsForUserResponse (Maybe [GroupType])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AdminListGroupsForUserResponse' {Maybe [GroupType]
groups :: Maybe [GroupType]
$sel:groups:AdminListGroupsForUserResponse' :: AdminListGroupsForUserResponse -> Maybe [GroupType]
groups} -> Maybe [GroupType]
groups) (\s :: AdminListGroupsForUserResponse
s@AdminListGroupsForUserResponse' {} Maybe [GroupType]
a -> AdminListGroupsForUserResponse
s {$sel:groups:AdminListGroupsForUserResponse' :: Maybe [GroupType]
groups = Maybe [GroupType]
a} :: AdminListGroupsForUserResponse) ((Maybe [GroupType] -> f (Maybe [GroupType]))
 -> AdminListGroupsForUserResponse
 -> f AdminListGroupsForUserResponse)
-> ((Maybe [GroupType] -> f (Maybe [GroupType]))
    -> Maybe [GroupType] -> f (Maybe [GroupType]))
-> (Maybe [GroupType] -> f (Maybe [GroupType]))
-> AdminListGroupsForUserResponse
-> f AdminListGroupsForUserResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [GroupType] [GroupType] [GroupType] [GroupType]
-> Iso
     (Maybe [GroupType])
     (Maybe [GroupType])
     (Maybe [GroupType])
     (Maybe [GroupType])
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 AnIso [GroupType] [GroupType] [GroupType] [GroupType]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | An identifier that was returned from the previous call to this
-- operation, which can be used to return the next set of items in the
-- list.
adminListGroupsForUserResponse_nextToken :: Lens.Lens' AdminListGroupsForUserResponse (Prelude.Maybe Prelude.Text)
adminListGroupsForUserResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> AdminListGroupsForUserResponse
-> f AdminListGroupsForUserResponse
adminListGroupsForUserResponse_nextToken = (AdminListGroupsForUserResponse -> Maybe Text)
-> (AdminListGroupsForUserResponse
    -> Maybe Text -> AdminListGroupsForUserResponse)
-> Lens' AdminListGroupsForUserResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AdminListGroupsForUserResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:AdminListGroupsForUserResponse' :: AdminListGroupsForUserResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: AdminListGroupsForUserResponse
s@AdminListGroupsForUserResponse' {} Maybe Text
a -> AdminListGroupsForUserResponse
s {$sel:nextToken:AdminListGroupsForUserResponse' :: Maybe Text
nextToken = Maybe Text
a} :: AdminListGroupsForUserResponse)

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

instance
  Prelude.NFData
    AdminListGroupsForUserResponse