{-# 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.QuickSight.ListIAMPolicyAssignmentsForUser
-- 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 all the IAMpolicy assignments, including the Amazon Resource Names
-- (ARNs) for the IAM policies assigned to the specified user and group or
-- groups that the user belongs to.
module Amazonka.QuickSight.ListIAMPolicyAssignmentsForUser
  ( -- * Creating a Request
    ListIAMPolicyAssignmentsForUser (..),
    newListIAMPolicyAssignmentsForUser,

    -- * Request Lenses
    listIAMPolicyAssignmentsForUser_nextToken,
    listIAMPolicyAssignmentsForUser_maxResults,
    listIAMPolicyAssignmentsForUser_awsAccountId,
    listIAMPolicyAssignmentsForUser_userName,
    listIAMPolicyAssignmentsForUser_namespace,

    -- * Destructuring the Response
    ListIAMPolicyAssignmentsForUserResponse (..),
    newListIAMPolicyAssignmentsForUserResponse,

    -- * Response Lenses
    listIAMPolicyAssignmentsForUserResponse_requestId,
    listIAMPolicyAssignmentsForUserResponse_activeAssignments,
    listIAMPolicyAssignmentsForUserResponse_nextToken,
    listIAMPolicyAssignmentsForUserResponse_status,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.QuickSight.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newListIAMPolicyAssignmentsForUser' smart constructor.
data ListIAMPolicyAssignmentsForUser = ListIAMPolicyAssignmentsForUser'
  { -- | The token for the next set of results, or null if there are no more
    -- results.
    ListIAMPolicyAssignmentsForUser -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to be returned per request.
    ListIAMPolicyAssignmentsForUser -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The ID of the Amazon Web Services account that contains the assignments.
    ListIAMPolicyAssignmentsForUser -> Text
awsAccountId :: Prelude.Text,
    -- | The name of the user.
    ListIAMPolicyAssignmentsForUser -> Text
userName :: Prelude.Text,
    -- | The namespace of the assignment.
    ListIAMPolicyAssignmentsForUser -> Text
namespace :: Prelude.Text
  }
  deriving (ListIAMPolicyAssignmentsForUser
-> ListIAMPolicyAssignmentsForUser -> Bool
(ListIAMPolicyAssignmentsForUser
 -> ListIAMPolicyAssignmentsForUser -> Bool)
-> (ListIAMPolicyAssignmentsForUser
    -> ListIAMPolicyAssignmentsForUser -> Bool)
-> Eq ListIAMPolicyAssignmentsForUser
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListIAMPolicyAssignmentsForUser
-> ListIAMPolicyAssignmentsForUser -> Bool
$c/= :: ListIAMPolicyAssignmentsForUser
-> ListIAMPolicyAssignmentsForUser -> Bool
== :: ListIAMPolicyAssignmentsForUser
-> ListIAMPolicyAssignmentsForUser -> Bool
$c== :: ListIAMPolicyAssignmentsForUser
-> ListIAMPolicyAssignmentsForUser -> Bool
Prelude.Eq, ReadPrec [ListIAMPolicyAssignmentsForUser]
ReadPrec ListIAMPolicyAssignmentsForUser
Int -> ReadS ListIAMPolicyAssignmentsForUser
ReadS [ListIAMPolicyAssignmentsForUser]
(Int -> ReadS ListIAMPolicyAssignmentsForUser)
-> ReadS [ListIAMPolicyAssignmentsForUser]
-> ReadPrec ListIAMPolicyAssignmentsForUser
-> ReadPrec [ListIAMPolicyAssignmentsForUser]
-> Read ListIAMPolicyAssignmentsForUser
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListIAMPolicyAssignmentsForUser]
$creadListPrec :: ReadPrec [ListIAMPolicyAssignmentsForUser]
readPrec :: ReadPrec ListIAMPolicyAssignmentsForUser
$creadPrec :: ReadPrec ListIAMPolicyAssignmentsForUser
readList :: ReadS [ListIAMPolicyAssignmentsForUser]
$creadList :: ReadS [ListIAMPolicyAssignmentsForUser]
readsPrec :: Int -> ReadS ListIAMPolicyAssignmentsForUser
$creadsPrec :: Int -> ReadS ListIAMPolicyAssignmentsForUser
Prelude.Read, Int -> ListIAMPolicyAssignmentsForUser -> ShowS
[ListIAMPolicyAssignmentsForUser] -> ShowS
ListIAMPolicyAssignmentsForUser -> String
(Int -> ListIAMPolicyAssignmentsForUser -> ShowS)
-> (ListIAMPolicyAssignmentsForUser -> String)
-> ([ListIAMPolicyAssignmentsForUser] -> ShowS)
-> Show ListIAMPolicyAssignmentsForUser
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListIAMPolicyAssignmentsForUser] -> ShowS
$cshowList :: [ListIAMPolicyAssignmentsForUser] -> ShowS
show :: ListIAMPolicyAssignmentsForUser -> String
$cshow :: ListIAMPolicyAssignmentsForUser -> String
showsPrec :: Int -> ListIAMPolicyAssignmentsForUser -> ShowS
$cshowsPrec :: Int -> ListIAMPolicyAssignmentsForUser -> ShowS
Prelude.Show, (forall x.
 ListIAMPolicyAssignmentsForUser
 -> Rep ListIAMPolicyAssignmentsForUser x)
-> (forall x.
    Rep ListIAMPolicyAssignmentsForUser x
    -> ListIAMPolicyAssignmentsForUser)
-> Generic ListIAMPolicyAssignmentsForUser
forall x.
Rep ListIAMPolicyAssignmentsForUser x
-> ListIAMPolicyAssignmentsForUser
forall x.
ListIAMPolicyAssignmentsForUser
-> Rep ListIAMPolicyAssignmentsForUser x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListIAMPolicyAssignmentsForUser x
-> ListIAMPolicyAssignmentsForUser
$cfrom :: forall x.
ListIAMPolicyAssignmentsForUser
-> Rep ListIAMPolicyAssignmentsForUser x
Prelude.Generic)

-- |
-- Create a value of 'ListIAMPolicyAssignmentsForUser' 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', 'listIAMPolicyAssignmentsForUser_nextToken' - The token for the next set of results, or null if there are no more
-- results.
--
-- 'maxResults', 'listIAMPolicyAssignmentsForUser_maxResults' - The maximum number of results to be returned per request.
--
-- 'awsAccountId', 'listIAMPolicyAssignmentsForUser_awsAccountId' - The ID of the Amazon Web Services account that contains the assignments.
--
-- 'userName', 'listIAMPolicyAssignmentsForUser_userName' - The name of the user.
--
-- 'namespace', 'listIAMPolicyAssignmentsForUser_namespace' - The namespace of the assignment.
newListIAMPolicyAssignmentsForUser ::
  -- | 'awsAccountId'
  Prelude.Text ->
  -- | 'userName'
  Prelude.Text ->
  -- | 'namespace'
  Prelude.Text ->
  ListIAMPolicyAssignmentsForUser
newListIAMPolicyAssignmentsForUser :: Text -> Text -> Text -> ListIAMPolicyAssignmentsForUser
newListIAMPolicyAssignmentsForUser
  Text
pAwsAccountId_
  Text
pUserName_
  Text
pNamespace_ =
    ListIAMPolicyAssignmentsForUser' :: Maybe Text
-> Maybe Natural
-> Text
-> Text
-> Text
-> ListIAMPolicyAssignmentsForUser
ListIAMPolicyAssignmentsForUser'
      { $sel:nextToken:ListIAMPolicyAssignmentsForUser' :: Maybe Text
nextToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:maxResults:ListIAMPolicyAssignmentsForUser' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
        $sel:awsAccountId:ListIAMPolicyAssignmentsForUser' :: Text
awsAccountId = Text
pAwsAccountId_,
        $sel:userName:ListIAMPolicyAssignmentsForUser' :: Text
userName = Text
pUserName_,
        $sel:namespace:ListIAMPolicyAssignmentsForUser' :: Text
namespace = Text
pNamespace_
      }

-- | The token for the next set of results, or null if there are no more
-- results.
listIAMPolicyAssignmentsForUser_nextToken :: Lens.Lens' ListIAMPolicyAssignmentsForUser (Prelude.Maybe Prelude.Text)
listIAMPolicyAssignmentsForUser_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListIAMPolicyAssignmentsForUser
-> f ListIAMPolicyAssignmentsForUser
listIAMPolicyAssignmentsForUser_nextToken = (ListIAMPolicyAssignmentsForUser -> Maybe Text)
-> (ListIAMPolicyAssignmentsForUser
    -> Maybe Text -> ListIAMPolicyAssignmentsForUser)
-> Lens
     ListIAMPolicyAssignmentsForUser
     ListIAMPolicyAssignmentsForUser
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListIAMPolicyAssignmentsForUser' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListIAMPolicyAssignmentsForUser' :: ListIAMPolicyAssignmentsForUser -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListIAMPolicyAssignmentsForUser
s@ListIAMPolicyAssignmentsForUser' {} Maybe Text
a -> ListIAMPolicyAssignmentsForUser
s {$sel:nextToken:ListIAMPolicyAssignmentsForUser' :: Maybe Text
nextToken = Maybe Text
a} :: ListIAMPolicyAssignmentsForUser)

-- | The maximum number of results to be returned per request.
listIAMPolicyAssignmentsForUser_maxResults :: Lens.Lens' ListIAMPolicyAssignmentsForUser (Prelude.Maybe Prelude.Natural)
listIAMPolicyAssignmentsForUser_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListIAMPolicyAssignmentsForUser
-> f ListIAMPolicyAssignmentsForUser
listIAMPolicyAssignmentsForUser_maxResults = (ListIAMPolicyAssignmentsForUser -> Maybe Natural)
-> (ListIAMPolicyAssignmentsForUser
    -> Maybe Natural -> ListIAMPolicyAssignmentsForUser)
-> Lens
     ListIAMPolicyAssignmentsForUser
     ListIAMPolicyAssignmentsForUser
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListIAMPolicyAssignmentsForUser' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListIAMPolicyAssignmentsForUser' :: ListIAMPolicyAssignmentsForUser -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListIAMPolicyAssignmentsForUser
s@ListIAMPolicyAssignmentsForUser' {} Maybe Natural
a -> ListIAMPolicyAssignmentsForUser
s {$sel:maxResults:ListIAMPolicyAssignmentsForUser' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListIAMPolicyAssignmentsForUser)

-- | The ID of the Amazon Web Services account that contains the assignments.
listIAMPolicyAssignmentsForUser_awsAccountId :: Lens.Lens' ListIAMPolicyAssignmentsForUser Prelude.Text
listIAMPolicyAssignmentsForUser_awsAccountId :: (Text -> f Text)
-> ListIAMPolicyAssignmentsForUser
-> f ListIAMPolicyAssignmentsForUser
listIAMPolicyAssignmentsForUser_awsAccountId = (ListIAMPolicyAssignmentsForUser -> Text)
-> (ListIAMPolicyAssignmentsForUser
    -> Text -> ListIAMPolicyAssignmentsForUser)
-> Lens
     ListIAMPolicyAssignmentsForUser
     ListIAMPolicyAssignmentsForUser
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListIAMPolicyAssignmentsForUser' {Text
awsAccountId :: Text
$sel:awsAccountId:ListIAMPolicyAssignmentsForUser' :: ListIAMPolicyAssignmentsForUser -> Text
awsAccountId} -> Text
awsAccountId) (\s :: ListIAMPolicyAssignmentsForUser
s@ListIAMPolicyAssignmentsForUser' {} Text
a -> ListIAMPolicyAssignmentsForUser
s {$sel:awsAccountId:ListIAMPolicyAssignmentsForUser' :: Text
awsAccountId = Text
a} :: ListIAMPolicyAssignmentsForUser)

-- | The name of the user.
listIAMPolicyAssignmentsForUser_userName :: Lens.Lens' ListIAMPolicyAssignmentsForUser Prelude.Text
listIAMPolicyAssignmentsForUser_userName :: (Text -> f Text)
-> ListIAMPolicyAssignmentsForUser
-> f ListIAMPolicyAssignmentsForUser
listIAMPolicyAssignmentsForUser_userName = (ListIAMPolicyAssignmentsForUser -> Text)
-> (ListIAMPolicyAssignmentsForUser
    -> Text -> ListIAMPolicyAssignmentsForUser)
-> Lens
     ListIAMPolicyAssignmentsForUser
     ListIAMPolicyAssignmentsForUser
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListIAMPolicyAssignmentsForUser' {Text
userName :: Text
$sel:userName:ListIAMPolicyAssignmentsForUser' :: ListIAMPolicyAssignmentsForUser -> Text
userName} -> Text
userName) (\s :: ListIAMPolicyAssignmentsForUser
s@ListIAMPolicyAssignmentsForUser' {} Text
a -> ListIAMPolicyAssignmentsForUser
s {$sel:userName:ListIAMPolicyAssignmentsForUser' :: Text
userName = Text
a} :: ListIAMPolicyAssignmentsForUser)

-- | The namespace of the assignment.
listIAMPolicyAssignmentsForUser_namespace :: Lens.Lens' ListIAMPolicyAssignmentsForUser Prelude.Text
listIAMPolicyAssignmentsForUser_namespace :: (Text -> f Text)
-> ListIAMPolicyAssignmentsForUser
-> f ListIAMPolicyAssignmentsForUser
listIAMPolicyAssignmentsForUser_namespace = (ListIAMPolicyAssignmentsForUser -> Text)
-> (ListIAMPolicyAssignmentsForUser
    -> Text -> ListIAMPolicyAssignmentsForUser)
-> Lens
     ListIAMPolicyAssignmentsForUser
     ListIAMPolicyAssignmentsForUser
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListIAMPolicyAssignmentsForUser' {Text
namespace :: Text
$sel:namespace:ListIAMPolicyAssignmentsForUser' :: ListIAMPolicyAssignmentsForUser -> Text
namespace} -> Text
namespace) (\s :: ListIAMPolicyAssignmentsForUser
s@ListIAMPolicyAssignmentsForUser' {} Text
a -> ListIAMPolicyAssignmentsForUser
s {$sel:namespace:ListIAMPolicyAssignmentsForUser' :: Text
namespace = Text
a} :: ListIAMPolicyAssignmentsForUser)

instance
  Core.AWSRequest
    ListIAMPolicyAssignmentsForUser
  where
  type
    AWSResponse ListIAMPolicyAssignmentsForUser =
      ListIAMPolicyAssignmentsForUserResponse
  request :: ListIAMPolicyAssignmentsForUser
-> Request ListIAMPolicyAssignmentsForUser
request = Service
-> ListIAMPolicyAssignmentsForUser
-> Request ListIAMPolicyAssignmentsForUser
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy ListIAMPolicyAssignmentsForUser
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse ListIAMPolicyAssignmentsForUser)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListIAMPolicyAssignmentsForUser))
-> Logger
-> Service
-> Proxy ListIAMPolicyAssignmentsForUser
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse ListIAMPolicyAssignmentsForUser)))
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 Text
-> Maybe [ActiveIAMPolicyAssignment]
-> Maybe Text
-> Int
-> ListIAMPolicyAssignmentsForUserResponse
ListIAMPolicyAssignmentsForUserResponse'
            (Maybe Text
 -> Maybe [ActiveIAMPolicyAssignment]
 -> Maybe Text
 -> Int
 -> ListIAMPolicyAssignmentsForUserResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe [ActiveIAMPolicyAssignment]
      -> Maybe Text -> Int -> ListIAMPolicyAssignmentsForUserResponse)
forall (f :: * -> *) a b. Functor 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
"RequestId")
            Either
  String
  (Maybe [ActiveIAMPolicyAssignment]
   -> Maybe Text -> Int -> ListIAMPolicyAssignmentsForUserResponse)
-> Either String (Maybe [ActiveIAMPolicyAssignment])
-> Either
     String
     (Maybe Text -> Int -> ListIAMPolicyAssignmentsForUserResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object
-> Text
-> Either String (Maybe (Maybe [ActiveIAMPolicyAssignment]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ActiveAssignments"
                            Either String (Maybe (Maybe [ActiveIAMPolicyAssignment]))
-> Maybe [ActiveIAMPolicyAssignment]
-> Either String (Maybe [ActiveIAMPolicyAssignment])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [ActiveIAMPolicyAssignment]
forall a. Monoid a => a
Prelude.mempty
                        )
            Either
  String
  (Maybe Text -> Int -> ListIAMPolicyAssignmentsForUserResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListIAMPolicyAssignmentsForUserResponse)
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 -> ListIAMPolicyAssignmentsForUserResponse)
-> Either String Int
-> Either String ListIAMPolicyAssignmentsForUserResponse
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
    ListIAMPolicyAssignmentsForUser

instance
  Prelude.NFData
    ListIAMPolicyAssignmentsForUser

instance
  Core.ToHeaders
    ListIAMPolicyAssignmentsForUser
  where
  toHeaders :: ListIAMPolicyAssignmentsForUser -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> ListIAMPolicyAssignmentsForUser -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.0" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToPath ListIAMPolicyAssignmentsForUser where
  toPath :: ListIAMPolicyAssignmentsForUser -> ByteString
toPath ListIAMPolicyAssignmentsForUser' {Maybe Natural
Maybe Text
Text
namespace :: Text
userName :: Text
awsAccountId :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:namespace:ListIAMPolicyAssignmentsForUser' :: ListIAMPolicyAssignmentsForUser -> Text
$sel:userName:ListIAMPolicyAssignmentsForUser' :: ListIAMPolicyAssignmentsForUser -> Text
$sel:awsAccountId:ListIAMPolicyAssignmentsForUser' :: ListIAMPolicyAssignmentsForUser -> Text
$sel:maxResults:ListIAMPolicyAssignmentsForUser' :: ListIAMPolicyAssignmentsForUser -> Maybe Natural
$sel:nextToken:ListIAMPolicyAssignmentsForUser' :: ListIAMPolicyAssignmentsForUser -> Maybe Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/accounts/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
awsAccountId,
        ByteString
"/namespaces/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
namespace,
        ByteString
"/users/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
userName,
        ByteString
"/iam-policy-assignments"
      ]

instance Core.ToQuery ListIAMPolicyAssignmentsForUser where
  toQuery :: ListIAMPolicyAssignmentsForUser -> QueryString
toQuery ListIAMPolicyAssignmentsForUser' {Maybe Natural
Maybe Text
Text
namespace :: Text
userName :: Text
awsAccountId :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:namespace:ListIAMPolicyAssignmentsForUser' :: ListIAMPolicyAssignmentsForUser -> Text
$sel:userName:ListIAMPolicyAssignmentsForUser' :: ListIAMPolicyAssignmentsForUser -> Text
$sel:awsAccountId:ListIAMPolicyAssignmentsForUser' :: ListIAMPolicyAssignmentsForUser -> Text
$sel:maxResults:ListIAMPolicyAssignmentsForUser' :: ListIAMPolicyAssignmentsForUser -> Maybe Natural
$sel:nextToken:ListIAMPolicyAssignmentsForUser' :: ListIAMPolicyAssignmentsForUser -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"next-token" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
        ByteString
"max-results" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxResults
      ]

-- | /See:/ 'newListIAMPolicyAssignmentsForUserResponse' smart constructor.
data ListIAMPolicyAssignmentsForUserResponse = ListIAMPolicyAssignmentsForUserResponse'
  { -- | The Amazon Web Services request ID for this operation.
    ListIAMPolicyAssignmentsForUserResponse -> Maybe Text
requestId :: Prelude.Maybe Prelude.Text,
    -- | The active assignments for this user.
    ListIAMPolicyAssignmentsForUserResponse
-> Maybe [ActiveIAMPolicyAssignment]
activeAssignments :: Prelude.Maybe [ActiveIAMPolicyAssignment],
    -- | The token for the next set of results, or null if there are no more
    -- results.
    ListIAMPolicyAssignmentsForUserResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The HTTP status of the request.
    ListIAMPolicyAssignmentsForUserResponse -> Int
status :: Prelude.Int
  }
  deriving (ListIAMPolicyAssignmentsForUserResponse
-> ListIAMPolicyAssignmentsForUserResponse -> Bool
(ListIAMPolicyAssignmentsForUserResponse
 -> ListIAMPolicyAssignmentsForUserResponse -> Bool)
-> (ListIAMPolicyAssignmentsForUserResponse
    -> ListIAMPolicyAssignmentsForUserResponse -> Bool)
-> Eq ListIAMPolicyAssignmentsForUserResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListIAMPolicyAssignmentsForUserResponse
-> ListIAMPolicyAssignmentsForUserResponse -> Bool
$c/= :: ListIAMPolicyAssignmentsForUserResponse
-> ListIAMPolicyAssignmentsForUserResponse -> Bool
== :: ListIAMPolicyAssignmentsForUserResponse
-> ListIAMPolicyAssignmentsForUserResponse -> Bool
$c== :: ListIAMPolicyAssignmentsForUserResponse
-> ListIAMPolicyAssignmentsForUserResponse -> Bool
Prelude.Eq, ReadPrec [ListIAMPolicyAssignmentsForUserResponse]
ReadPrec ListIAMPolicyAssignmentsForUserResponse
Int -> ReadS ListIAMPolicyAssignmentsForUserResponse
ReadS [ListIAMPolicyAssignmentsForUserResponse]
(Int -> ReadS ListIAMPolicyAssignmentsForUserResponse)
-> ReadS [ListIAMPolicyAssignmentsForUserResponse]
-> ReadPrec ListIAMPolicyAssignmentsForUserResponse
-> ReadPrec [ListIAMPolicyAssignmentsForUserResponse]
-> Read ListIAMPolicyAssignmentsForUserResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListIAMPolicyAssignmentsForUserResponse]
$creadListPrec :: ReadPrec [ListIAMPolicyAssignmentsForUserResponse]
readPrec :: ReadPrec ListIAMPolicyAssignmentsForUserResponse
$creadPrec :: ReadPrec ListIAMPolicyAssignmentsForUserResponse
readList :: ReadS [ListIAMPolicyAssignmentsForUserResponse]
$creadList :: ReadS [ListIAMPolicyAssignmentsForUserResponse]
readsPrec :: Int -> ReadS ListIAMPolicyAssignmentsForUserResponse
$creadsPrec :: Int -> ReadS ListIAMPolicyAssignmentsForUserResponse
Prelude.Read, Int -> ListIAMPolicyAssignmentsForUserResponse -> ShowS
[ListIAMPolicyAssignmentsForUserResponse] -> ShowS
ListIAMPolicyAssignmentsForUserResponse -> String
(Int -> ListIAMPolicyAssignmentsForUserResponse -> ShowS)
-> (ListIAMPolicyAssignmentsForUserResponse -> String)
-> ([ListIAMPolicyAssignmentsForUserResponse] -> ShowS)
-> Show ListIAMPolicyAssignmentsForUserResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListIAMPolicyAssignmentsForUserResponse] -> ShowS
$cshowList :: [ListIAMPolicyAssignmentsForUserResponse] -> ShowS
show :: ListIAMPolicyAssignmentsForUserResponse -> String
$cshow :: ListIAMPolicyAssignmentsForUserResponse -> String
showsPrec :: Int -> ListIAMPolicyAssignmentsForUserResponse -> ShowS
$cshowsPrec :: Int -> ListIAMPolicyAssignmentsForUserResponse -> ShowS
Prelude.Show, (forall x.
 ListIAMPolicyAssignmentsForUserResponse
 -> Rep ListIAMPolicyAssignmentsForUserResponse x)
-> (forall x.
    Rep ListIAMPolicyAssignmentsForUserResponse x
    -> ListIAMPolicyAssignmentsForUserResponse)
-> Generic ListIAMPolicyAssignmentsForUserResponse
forall x.
Rep ListIAMPolicyAssignmentsForUserResponse x
-> ListIAMPolicyAssignmentsForUserResponse
forall x.
ListIAMPolicyAssignmentsForUserResponse
-> Rep ListIAMPolicyAssignmentsForUserResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListIAMPolicyAssignmentsForUserResponse x
-> ListIAMPolicyAssignmentsForUserResponse
$cfrom :: forall x.
ListIAMPolicyAssignmentsForUserResponse
-> Rep ListIAMPolicyAssignmentsForUserResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListIAMPolicyAssignmentsForUserResponse' 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:
--
-- 'requestId', 'listIAMPolicyAssignmentsForUserResponse_requestId' - The Amazon Web Services request ID for this operation.
--
-- 'activeAssignments', 'listIAMPolicyAssignmentsForUserResponse_activeAssignments' - The active assignments for this user.
--
-- 'nextToken', 'listIAMPolicyAssignmentsForUserResponse_nextToken' - The token for the next set of results, or null if there are no more
-- results.
--
-- 'status', 'listIAMPolicyAssignmentsForUserResponse_status' - The HTTP status of the request.
newListIAMPolicyAssignmentsForUserResponse ::
  -- | 'status'
  Prelude.Int ->
  ListIAMPolicyAssignmentsForUserResponse
newListIAMPolicyAssignmentsForUserResponse :: Int -> ListIAMPolicyAssignmentsForUserResponse
newListIAMPolicyAssignmentsForUserResponse Int
pStatus_ =
  ListIAMPolicyAssignmentsForUserResponse' :: Maybe Text
-> Maybe [ActiveIAMPolicyAssignment]
-> Maybe Text
-> Int
-> ListIAMPolicyAssignmentsForUserResponse
ListIAMPolicyAssignmentsForUserResponse'
    { $sel:requestId:ListIAMPolicyAssignmentsForUserResponse' :: Maybe Text
requestId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:activeAssignments:ListIAMPolicyAssignmentsForUserResponse' :: Maybe [ActiveIAMPolicyAssignment]
activeAssignments =
        Maybe [ActiveIAMPolicyAssignment]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListIAMPolicyAssignmentsForUserResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:status:ListIAMPolicyAssignmentsForUserResponse' :: Int
status = Int
pStatus_
    }

-- | The Amazon Web Services request ID for this operation.
listIAMPolicyAssignmentsForUserResponse_requestId :: Lens.Lens' ListIAMPolicyAssignmentsForUserResponse (Prelude.Maybe Prelude.Text)
listIAMPolicyAssignmentsForUserResponse_requestId :: (Maybe Text -> f (Maybe Text))
-> ListIAMPolicyAssignmentsForUserResponse
-> f ListIAMPolicyAssignmentsForUserResponse
listIAMPolicyAssignmentsForUserResponse_requestId = (ListIAMPolicyAssignmentsForUserResponse -> Maybe Text)
-> (ListIAMPolicyAssignmentsForUserResponse
    -> Maybe Text -> ListIAMPolicyAssignmentsForUserResponse)
-> Lens
     ListIAMPolicyAssignmentsForUserResponse
     ListIAMPolicyAssignmentsForUserResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListIAMPolicyAssignmentsForUserResponse' {Maybe Text
requestId :: Maybe Text
$sel:requestId:ListIAMPolicyAssignmentsForUserResponse' :: ListIAMPolicyAssignmentsForUserResponse -> Maybe Text
requestId} -> Maybe Text
requestId) (\s :: ListIAMPolicyAssignmentsForUserResponse
s@ListIAMPolicyAssignmentsForUserResponse' {} Maybe Text
a -> ListIAMPolicyAssignmentsForUserResponse
s {$sel:requestId:ListIAMPolicyAssignmentsForUserResponse' :: Maybe Text
requestId = Maybe Text
a} :: ListIAMPolicyAssignmentsForUserResponse)

-- | The active assignments for this user.
listIAMPolicyAssignmentsForUserResponse_activeAssignments :: Lens.Lens' ListIAMPolicyAssignmentsForUserResponse (Prelude.Maybe [ActiveIAMPolicyAssignment])
listIAMPolicyAssignmentsForUserResponse_activeAssignments :: (Maybe [ActiveIAMPolicyAssignment]
 -> f (Maybe [ActiveIAMPolicyAssignment]))
-> ListIAMPolicyAssignmentsForUserResponse
-> f ListIAMPolicyAssignmentsForUserResponse
listIAMPolicyAssignmentsForUserResponse_activeAssignments = (ListIAMPolicyAssignmentsForUserResponse
 -> Maybe [ActiveIAMPolicyAssignment])
-> (ListIAMPolicyAssignmentsForUserResponse
    -> Maybe [ActiveIAMPolicyAssignment]
    -> ListIAMPolicyAssignmentsForUserResponse)
-> Lens
     ListIAMPolicyAssignmentsForUserResponse
     ListIAMPolicyAssignmentsForUserResponse
     (Maybe [ActiveIAMPolicyAssignment])
     (Maybe [ActiveIAMPolicyAssignment])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListIAMPolicyAssignmentsForUserResponse' {Maybe [ActiveIAMPolicyAssignment]
activeAssignments :: Maybe [ActiveIAMPolicyAssignment]
$sel:activeAssignments:ListIAMPolicyAssignmentsForUserResponse' :: ListIAMPolicyAssignmentsForUserResponse
-> Maybe [ActiveIAMPolicyAssignment]
activeAssignments} -> Maybe [ActiveIAMPolicyAssignment]
activeAssignments) (\s :: ListIAMPolicyAssignmentsForUserResponse
s@ListIAMPolicyAssignmentsForUserResponse' {} Maybe [ActiveIAMPolicyAssignment]
a -> ListIAMPolicyAssignmentsForUserResponse
s {$sel:activeAssignments:ListIAMPolicyAssignmentsForUserResponse' :: Maybe [ActiveIAMPolicyAssignment]
activeAssignments = Maybe [ActiveIAMPolicyAssignment]
a} :: ListIAMPolicyAssignmentsForUserResponse) ((Maybe [ActiveIAMPolicyAssignment]
  -> f (Maybe [ActiveIAMPolicyAssignment]))
 -> ListIAMPolicyAssignmentsForUserResponse
 -> f ListIAMPolicyAssignmentsForUserResponse)
-> ((Maybe [ActiveIAMPolicyAssignment]
     -> f (Maybe [ActiveIAMPolicyAssignment]))
    -> Maybe [ActiveIAMPolicyAssignment]
    -> f (Maybe [ActiveIAMPolicyAssignment]))
-> (Maybe [ActiveIAMPolicyAssignment]
    -> f (Maybe [ActiveIAMPolicyAssignment]))
-> ListIAMPolicyAssignmentsForUserResponse
-> f ListIAMPolicyAssignmentsForUserResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ActiveIAMPolicyAssignment]
  [ActiveIAMPolicyAssignment]
  [ActiveIAMPolicyAssignment]
  [ActiveIAMPolicyAssignment]
-> Iso
     (Maybe [ActiveIAMPolicyAssignment])
     (Maybe [ActiveIAMPolicyAssignment])
     (Maybe [ActiveIAMPolicyAssignment])
     (Maybe [ActiveIAMPolicyAssignment])
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
  [ActiveIAMPolicyAssignment]
  [ActiveIAMPolicyAssignment]
  [ActiveIAMPolicyAssignment]
  [ActiveIAMPolicyAssignment]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The token for the next set of results, or null if there are no more
-- results.
listIAMPolicyAssignmentsForUserResponse_nextToken :: Lens.Lens' ListIAMPolicyAssignmentsForUserResponse (Prelude.Maybe Prelude.Text)
listIAMPolicyAssignmentsForUserResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListIAMPolicyAssignmentsForUserResponse
-> f ListIAMPolicyAssignmentsForUserResponse
listIAMPolicyAssignmentsForUserResponse_nextToken = (ListIAMPolicyAssignmentsForUserResponse -> Maybe Text)
-> (ListIAMPolicyAssignmentsForUserResponse
    -> Maybe Text -> ListIAMPolicyAssignmentsForUserResponse)
-> Lens
     ListIAMPolicyAssignmentsForUserResponse
     ListIAMPolicyAssignmentsForUserResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListIAMPolicyAssignmentsForUserResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListIAMPolicyAssignmentsForUserResponse' :: ListIAMPolicyAssignmentsForUserResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListIAMPolicyAssignmentsForUserResponse
s@ListIAMPolicyAssignmentsForUserResponse' {} Maybe Text
a -> ListIAMPolicyAssignmentsForUserResponse
s {$sel:nextToken:ListIAMPolicyAssignmentsForUserResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListIAMPolicyAssignmentsForUserResponse)

-- | The HTTP status of the request.
listIAMPolicyAssignmentsForUserResponse_status :: Lens.Lens' ListIAMPolicyAssignmentsForUserResponse Prelude.Int
listIAMPolicyAssignmentsForUserResponse_status :: (Int -> f Int)
-> ListIAMPolicyAssignmentsForUserResponse
-> f ListIAMPolicyAssignmentsForUserResponse
listIAMPolicyAssignmentsForUserResponse_status = (ListIAMPolicyAssignmentsForUserResponse -> Int)
-> (ListIAMPolicyAssignmentsForUserResponse
    -> Int -> ListIAMPolicyAssignmentsForUserResponse)
-> Lens
     ListIAMPolicyAssignmentsForUserResponse
     ListIAMPolicyAssignmentsForUserResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListIAMPolicyAssignmentsForUserResponse' {Int
status :: Int
$sel:status:ListIAMPolicyAssignmentsForUserResponse' :: ListIAMPolicyAssignmentsForUserResponse -> Int
status} -> Int
status) (\s :: ListIAMPolicyAssignmentsForUserResponse
s@ListIAMPolicyAssignmentsForUserResponse' {} Int
a -> ListIAMPolicyAssignmentsForUserResponse
s {$sel:status:ListIAMPolicyAssignmentsForUserResponse' :: Int
status = Int
a} :: ListIAMPolicyAssignmentsForUserResponse)

instance
  Prelude.NFData
    ListIAMPolicyAssignmentsForUserResponse