{-# 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.SSOAdmin.ListAccountAssignments
-- 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 assignee of the specified Amazon Web Services account with the
-- specified permission set.
--
-- This operation returns paginated results.
module Amazonka.SSOAdmin.ListAccountAssignments
  ( -- * Creating a Request
    ListAccountAssignments (..),
    newListAccountAssignments,

    -- * Request Lenses
    listAccountAssignments_nextToken,
    listAccountAssignments_maxResults,
    listAccountAssignments_instanceArn,
    listAccountAssignments_accountId,
    listAccountAssignments_permissionSetArn,

    -- * Destructuring the Response
    ListAccountAssignmentsResponse (..),
    newListAccountAssignmentsResponse,

    -- * Response Lenses
    listAccountAssignmentsResponse_accountAssignments,
    listAccountAssignmentsResponse_nextToken,
    listAccountAssignmentsResponse_httpStatus,
  )
where

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
import Amazonka.SSOAdmin.Types

-- | /See:/ 'newListAccountAssignments' smart constructor.
data ListAccountAssignments = ListAccountAssignments'
  { -- | The pagination token for the list API. Initially the value is null. Use
    -- the output of previous API calls to make subsequent calls.
    ListAccountAssignments -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to display for the assignment.
    ListAccountAssignments -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The ARN of the SSO instance under which the operation will be executed.
    -- For more information about ARNs, see
    -- </general/latest/gr/aws-arns-and-namespaces.html Amazon Resource Names (ARNs) and Amazon Web Services Service Namespaces>
    -- in the /Amazon Web Services General Reference/.
    ListAccountAssignments -> Text
instanceArn :: Prelude.Text,
    -- | The identifier of the Amazon Web Services account from which to list the
    -- assignments.
    ListAccountAssignments -> Text
accountId :: Prelude.Text,
    -- | The ARN of the permission set from which to list assignments.
    ListAccountAssignments -> Text
permissionSetArn :: Prelude.Text
  }
  deriving (ListAccountAssignments -> ListAccountAssignments -> Bool
(ListAccountAssignments -> ListAccountAssignments -> Bool)
-> (ListAccountAssignments -> ListAccountAssignments -> Bool)
-> Eq ListAccountAssignments
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAccountAssignments -> ListAccountAssignments -> Bool
$c/= :: ListAccountAssignments -> ListAccountAssignments -> Bool
== :: ListAccountAssignments -> ListAccountAssignments -> Bool
$c== :: ListAccountAssignments -> ListAccountAssignments -> Bool
Prelude.Eq, ReadPrec [ListAccountAssignments]
ReadPrec ListAccountAssignments
Int -> ReadS ListAccountAssignments
ReadS [ListAccountAssignments]
(Int -> ReadS ListAccountAssignments)
-> ReadS [ListAccountAssignments]
-> ReadPrec ListAccountAssignments
-> ReadPrec [ListAccountAssignments]
-> Read ListAccountAssignments
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAccountAssignments]
$creadListPrec :: ReadPrec [ListAccountAssignments]
readPrec :: ReadPrec ListAccountAssignments
$creadPrec :: ReadPrec ListAccountAssignments
readList :: ReadS [ListAccountAssignments]
$creadList :: ReadS [ListAccountAssignments]
readsPrec :: Int -> ReadS ListAccountAssignments
$creadsPrec :: Int -> ReadS ListAccountAssignments
Prelude.Read, Int -> ListAccountAssignments -> ShowS
[ListAccountAssignments] -> ShowS
ListAccountAssignments -> String
(Int -> ListAccountAssignments -> ShowS)
-> (ListAccountAssignments -> String)
-> ([ListAccountAssignments] -> ShowS)
-> Show ListAccountAssignments
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAccountAssignments] -> ShowS
$cshowList :: [ListAccountAssignments] -> ShowS
show :: ListAccountAssignments -> String
$cshow :: ListAccountAssignments -> String
showsPrec :: Int -> ListAccountAssignments -> ShowS
$cshowsPrec :: Int -> ListAccountAssignments -> ShowS
Prelude.Show, (forall x. ListAccountAssignments -> Rep ListAccountAssignments x)
-> (forall x.
    Rep ListAccountAssignments x -> ListAccountAssignments)
-> Generic ListAccountAssignments
forall x. Rep ListAccountAssignments x -> ListAccountAssignments
forall x. ListAccountAssignments -> Rep ListAccountAssignments x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListAccountAssignments x -> ListAccountAssignments
$cfrom :: forall x. ListAccountAssignments -> Rep ListAccountAssignments x
Prelude.Generic)

-- |
-- Create a value of 'ListAccountAssignments' 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', 'listAccountAssignments_nextToken' - The pagination token for the list API. Initially the value is null. Use
-- the output of previous API calls to make subsequent calls.
--
-- 'maxResults', 'listAccountAssignments_maxResults' - The maximum number of results to display for the assignment.
--
-- 'instanceArn', 'listAccountAssignments_instanceArn' - The ARN of the SSO instance under which the operation will be executed.
-- For more information about ARNs, see
-- </general/latest/gr/aws-arns-and-namespaces.html Amazon Resource Names (ARNs) and Amazon Web Services Service Namespaces>
-- in the /Amazon Web Services General Reference/.
--
-- 'accountId', 'listAccountAssignments_accountId' - The identifier of the Amazon Web Services account from which to list the
-- assignments.
--
-- 'permissionSetArn', 'listAccountAssignments_permissionSetArn' - The ARN of the permission set from which to list assignments.
newListAccountAssignments ::
  -- | 'instanceArn'
  Prelude.Text ->
  -- | 'accountId'
  Prelude.Text ->
  -- | 'permissionSetArn'
  Prelude.Text ->
  ListAccountAssignments
newListAccountAssignments :: Text -> Text -> Text -> ListAccountAssignments
newListAccountAssignments
  Text
pInstanceArn_
  Text
pAccountId_
  Text
pPermissionSetArn_ =
    ListAccountAssignments' :: Maybe Text
-> Maybe Natural -> Text -> Text -> Text -> ListAccountAssignments
ListAccountAssignments'
      { $sel:nextToken:ListAccountAssignments' :: Maybe Text
nextToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:maxResults:ListAccountAssignments' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
        $sel:instanceArn:ListAccountAssignments' :: Text
instanceArn = Text
pInstanceArn_,
        $sel:accountId:ListAccountAssignments' :: Text
accountId = Text
pAccountId_,
        $sel:permissionSetArn:ListAccountAssignments' :: Text
permissionSetArn = Text
pPermissionSetArn_
      }

-- | The pagination token for the list API. Initially the value is null. Use
-- the output of previous API calls to make subsequent calls.
listAccountAssignments_nextToken :: Lens.Lens' ListAccountAssignments (Prelude.Maybe Prelude.Text)
listAccountAssignments_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListAccountAssignments -> f ListAccountAssignments
listAccountAssignments_nextToken = (ListAccountAssignments -> Maybe Text)
-> (ListAccountAssignments -> Maybe Text -> ListAccountAssignments)
-> Lens
     ListAccountAssignments
     ListAccountAssignments
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccountAssignments' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAccountAssignments' :: ListAccountAssignments -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAccountAssignments
s@ListAccountAssignments' {} Maybe Text
a -> ListAccountAssignments
s {$sel:nextToken:ListAccountAssignments' :: Maybe Text
nextToken = Maybe Text
a} :: ListAccountAssignments)

-- | The maximum number of results to display for the assignment.
listAccountAssignments_maxResults :: Lens.Lens' ListAccountAssignments (Prelude.Maybe Prelude.Natural)
listAccountAssignments_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListAccountAssignments -> f ListAccountAssignments
listAccountAssignments_maxResults = (ListAccountAssignments -> Maybe Natural)
-> (ListAccountAssignments
    -> Maybe Natural -> ListAccountAssignments)
-> Lens
     ListAccountAssignments
     ListAccountAssignments
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccountAssignments' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListAccountAssignments' :: ListAccountAssignments -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListAccountAssignments
s@ListAccountAssignments' {} Maybe Natural
a -> ListAccountAssignments
s {$sel:maxResults:ListAccountAssignments' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListAccountAssignments)

-- | The ARN of the SSO instance under which the operation will be executed.
-- For more information about ARNs, see
-- </general/latest/gr/aws-arns-and-namespaces.html Amazon Resource Names (ARNs) and Amazon Web Services Service Namespaces>
-- in the /Amazon Web Services General Reference/.
listAccountAssignments_instanceArn :: Lens.Lens' ListAccountAssignments Prelude.Text
listAccountAssignments_instanceArn :: (Text -> f Text)
-> ListAccountAssignments -> f ListAccountAssignments
listAccountAssignments_instanceArn = (ListAccountAssignments -> Text)
-> (ListAccountAssignments -> Text -> ListAccountAssignments)
-> Lens ListAccountAssignments ListAccountAssignments Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccountAssignments' {Text
instanceArn :: Text
$sel:instanceArn:ListAccountAssignments' :: ListAccountAssignments -> Text
instanceArn} -> Text
instanceArn) (\s :: ListAccountAssignments
s@ListAccountAssignments' {} Text
a -> ListAccountAssignments
s {$sel:instanceArn:ListAccountAssignments' :: Text
instanceArn = Text
a} :: ListAccountAssignments)

-- | The identifier of the Amazon Web Services account from which to list the
-- assignments.
listAccountAssignments_accountId :: Lens.Lens' ListAccountAssignments Prelude.Text
listAccountAssignments_accountId :: (Text -> f Text)
-> ListAccountAssignments -> f ListAccountAssignments
listAccountAssignments_accountId = (ListAccountAssignments -> Text)
-> (ListAccountAssignments -> Text -> ListAccountAssignments)
-> Lens ListAccountAssignments ListAccountAssignments Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccountAssignments' {Text
accountId :: Text
$sel:accountId:ListAccountAssignments' :: ListAccountAssignments -> Text
accountId} -> Text
accountId) (\s :: ListAccountAssignments
s@ListAccountAssignments' {} Text
a -> ListAccountAssignments
s {$sel:accountId:ListAccountAssignments' :: Text
accountId = Text
a} :: ListAccountAssignments)

-- | The ARN of the permission set from which to list assignments.
listAccountAssignments_permissionSetArn :: Lens.Lens' ListAccountAssignments Prelude.Text
listAccountAssignments_permissionSetArn :: (Text -> f Text)
-> ListAccountAssignments -> f ListAccountAssignments
listAccountAssignments_permissionSetArn = (ListAccountAssignments -> Text)
-> (ListAccountAssignments -> Text -> ListAccountAssignments)
-> Lens ListAccountAssignments ListAccountAssignments Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccountAssignments' {Text
permissionSetArn :: Text
$sel:permissionSetArn:ListAccountAssignments' :: ListAccountAssignments -> Text
permissionSetArn} -> Text
permissionSetArn) (\s :: ListAccountAssignments
s@ListAccountAssignments' {} Text
a -> ListAccountAssignments
s {$sel:permissionSetArn:ListAccountAssignments' :: Text
permissionSetArn = Text
a} :: ListAccountAssignments)

instance Core.AWSPager ListAccountAssignments where
  page :: ListAccountAssignments
-> AWSResponse ListAccountAssignments
-> Maybe ListAccountAssignments
page ListAccountAssignments
rq AWSResponse ListAccountAssignments
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListAccountAssignments
ListAccountAssignmentsResponse
rs
            ListAccountAssignmentsResponse
-> Getting (First Text) ListAccountAssignmentsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListAccountAssignmentsResponse
-> Const (First Text) ListAccountAssignmentsResponse
Lens' ListAccountAssignmentsResponse (Maybe Text)
listAccountAssignmentsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListAccountAssignmentsResponse
 -> Const (First Text) ListAccountAssignmentsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListAccountAssignmentsResponse 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 ListAccountAssignments
forall a. Maybe a
Prelude.Nothing
    | Maybe [AccountAssignment] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListAccountAssignments
ListAccountAssignmentsResponse
rs
            ListAccountAssignmentsResponse
-> Getting
     (First [AccountAssignment])
     ListAccountAssignmentsResponse
     [AccountAssignment]
-> Maybe [AccountAssignment]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [AccountAssignment]
 -> Const (First [AccountAssignment]) (Maybe [AccountAssignment]))
-> ListAccountAssignmentsResponse
-> Const (First [AccountAssignment]) ListAccountAssignmentsResponse
Lens' ListAccountAssignmentsResponse (Maybe [AccountAssignment])
listAccountAssignmentsResponse_accountAssignments
              ((Maybe [AccountAssignment]
  -> Const (First [AccountAssignment]) (Maybe [AccountAssignment]))
 -> ListAccountAssignmentsResponse
 -> Const
      (First [AccountAssignment]) ListAccountAssignmentsResponse)
-> (([AccountAssignment]
     -> Const (First [AccountAssignment]) [AccountAssignment])
    -> Maybe [AccountAssignment]
    -> Const (First [AccountAssignment]) (Maybe [AccountAssignment]))
-> Getting
     (First [AccountAssignment])
     ListAccountAssignmentsResponse
     [AccountAssignment]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([AccountAssignment]
 -> Const (First [AccountAssignment]) [AccountAssignment])
-> Maybe [AccountAssignment]
-> Const (First [AccountAssignment]) (Maybe [AccountAssignment])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListAccountAssignments
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListAccountAssignments -> Maybe ListAccountAssignments
forall a. a -> Maybe a
Prelude.Just (ListAccountAssignments -> Maybe ListAccountAssignments)
-> ListAccountAssignments -> Maybe ListAccountAssignments
forall a b. (a -> b) -> a -> b
Prelude.$
        ListAccountAssignments
rq
          ListAccountAssignments
-> (ListAccountAssignments -> ListAccountAssignments)
-> ListAccountAssignments
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListAccountAssignments -> Identity ListAccountAssignments
Lens
  ListAccountAssignments
  ListAccountAssignments
  (Maybe Text)
  (Maybe Text)
listAccountAssignments_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListAccountAssignments -> Identity ListAccountAssignments)
-> Maybe Text -> ListAccountAssignments -> ListAccountAssignments
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListAccountAssignments
ListAccountAssignmentsResponse
rs
          ListAccountAssignmentsResponse
-> Getting (First Text) ListAccountAssignmentsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListAccountAssignmentsResponse
-> Const (First Text) ListAccountAssignmentsResponse
Lens' ListAccountAssignmentsResponse (Maybe Text)
listAccountAssignmentsResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListAccountAssignmentsResponse
 -> Const (First Text) ListAccountAssignmentsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListAccountAssignmentsResponse 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 ListAccountAssignments where
  type
    AWSResponse ListAccountAssignments =
      ListAccountAssignmentsResponse
  request :: ListAccountAssignments -> Request ListAccountAssignments
request = Service -> ListAccountAssignments -> Request ListAccountAssignments
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListAccountAssignments
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListAccountAssignments)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListAccountAssignments))
-> Logger
-> Service
-> Proxy ListAccountAssignments
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListAccountAssignments)))
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 [AccountAssignment]
-> Maybe Text -> Int -> ListAccountAssignmentsResponse
ListAccountAssignmentsResponse'
            (Maybe [AccountAssignment]
 -> Maybe Text -> Int -> ListAccountAssignmentsResponse)
-> Either String (Maybe [AccountAssignment])
-> Either
     String (Maybe Text -> Int -> ListAccountAssignmentsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Either String (Maybe (Maybe [AccountAssignment]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"AccountAssignments"
                            Either String (Maybe (Maybe [AccountAssignment]))
-> Maybe [AccountAssignment]
-> Either String (Maybe [AccountAssignment])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [AccountAssignment]
forall a. Monoid a => a
Prelude.mempty
                        )
            Either String (Maybe Text -> Int -> ListAccountAssignmentsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListAccountAssignmentsResponse)
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 -> ListAccountAssignmentsResponse)
-> Either String Int
-> Either String ListAccountAssignmentsResponse
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 ListAccountAssignments

instance Prelude.NFData ListAccountAssignments

instance Core.ToHeaders ListAccountAssignments where
  toHeaders :: ListAccountAssignments -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListAccountAssignments -> 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
"SWBExternalService.ListAccountAssignments" ::
                          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 ListAccountAssignments where
  toJSON :: ListAccountAssignments -> Value
toJSON ListAccountAssignments' {Maybe Natural
Maybe Text
Text
permissionSetArn :: Text
accountId :: Text
instanceArn :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:permissionSetArn:ListAccountAssignments' :: ListAccountAssignments -> Text
$sel:accountId:ListAccountAssignments' :: ListAccountAssignments -> Text
$sel:instanceArn:ListAccountAssignments' :: ListAccountAssignments -> Text
$sel:maxResults:ListAccountAssignments' :: ListAccountAssignments -> Maybe Natural
$sel:nextToken:ListAccountAssignments' :: ListAccountAssignments -> 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
"MaxResults" 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
maxResults,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"InstanceArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
instanceArn),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"AccountId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
accountId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"PermissionSetArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
permissionSetArn)
          ]
      )

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

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

-- | /See:/ 'newListAccountAssignmentsResponse' smart constructor.
data ListAccountAssignmentsResponse = ListAccountAssignmentsResponse'
  { -- | The list of assignments that match the input Amazon Web Services account
    -- and permission set.
    ListAccountAssignmentsResponse -> Maybe [AccountAssignment]
accountAssignments :: Prelude.Maybe [AccountAssignment],
    -- | The pagination token for the list API. Initially the value is null. Use
    -- the output of previous API calls to make subsequent calls.
    ListAccountAssignmentsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListAccountAssignmentsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListAccountAssignmentsResponse
-> ListAccountAssignmentsResponse -> Bool
(ListAccountAssignmentsResponse
 -> ListAccountAssignmentsResponse -> Bool)
-> (ListAccountAssignmentsResponse
    -> ListAccountAssignmentsResponse -> Bool)
-> Eq ListAccountAssignmentsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAccountAssignmentsResponse
-> ListAccountAssignmentsResponse -> Bool
$c/= :: ListAccountAssignmentsResponse
-> ListAccountAssignmentsResponse -> Bool
== :: ListAccountAssignmentsResponse
-> ListAccountAssignmentsResponse -> Bool
$c== :: ListAccountAssignmentsResponse
-> ListAccountAssignmentsResponse -> Bool
Prelude.Eq, ReadPrec [ListAccountAssignmentsResponse]
ReadPrec ListAccountAssignmentsResponse
Int -> ReadS ListAccountAssignmentsResponse
ReadS [ListAccountAssignmentsResponse]
(Int -> ReadS ListAccountAssignmentsResponse)
-> ReadS [ListAccountAssignmentsResponse]
-> ReadPrec ListAccountAssignmentsResponse
-> ReadPrec [ListAccountAssignmentsResponse]
-> Read ListAccountAssignmentsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAccountAssignmentsResponse]
$creadListPrec :: ReadPrec [ListAccountAssignmentsResponse]
readPrec :: ReadPrec ListAccountAssignmentsResponse
$creadPrec :: ReadPrec ListAccountAssignmentsResponse
readList :: ReadS [ListAccountAssignmentsResponse]
$creadList :: ReadS [ListAccountAssignmentsResponse]
readsPrec :: Int -> ReadS ListAccountAssignmentsResponse
$creadsPrec :: Int -> ReadS ListAccountAssignmentsResponse
Prelude.Read, Int -> ListAccountAssignmentsResponse -> ShowS
[ListAccountAssignmentsResponse] -> ShowS
ListAccountAssignmentsResponse -> String
(Int -> ListAccountAssignmentsResponse -> ShowS)
-> (ListAccountAssignmentsResponse -> String)
-> ([ListAccountAssignmentsResponse] -> ShowS)
-> Show ListAccountAssignmentsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAccountAssignmentsResponse] -> ShowS
$cshowList :: [ListAccountAssignmentsResponse] -> ShowS
show :: ListAccountAssignmentsResponse -> String
$cshow :: ListAccountAssignmentsResponse -> String
showsPrec :: Int -> ListAccountAssignmentsResponse -> ShowS
$cshowsPrec :: Int -> ListAccountAssignmentsResponse -> ShowS
Prelude.Show, (forall x.
 ListAccountAssignmentsResponse
 -> Rep ListAccountAssignmentsResponse x)
-> (forall x.
    Rep ListAccountAssignmentsResponse x
    -> ListAccountAssignmentsResponse)
-> Generic ListAccountAssignmentsResponse
forall x.
Rep ListAccountAssignmentsResponse x
-> ListAccountAssignmentsResponse
forall x.
ListAccountAssignmentsResponse
-> Rep ListAccountAssignmentsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListAccountAssignmentsResponse x
-> ListAccountAssignmentsResponse
$cfrom :: forall x.
ListAccountAssignmentsResponse
-> Rep ListAccountAssignmentsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListAccountAssignmentsResponse' 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:
--
-- 'accountAssignments', 'listAccountAssignmentsResponse_accountAssignments' - The list of assignments that match the input Amazon Web Services account
-- and permission set.
--
-- 'nextToken', 'listAccountAssignmentsResponse_nextToken' - The pagination token for the list API. Initially the value is null. Use
-- the output of previous API calls to make subsequent calls.
--
-- 'httpStatus', 'listAccountAssignmentsResponse_httpStatus' - The response's http status code.
newListAccountAssignmentsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListAccountAssignmentsResponse
newListAccountAssignmentsResponse :: Int -> ListAccountAssignmentsResponse
newListAccountAssignmentsResponse Int
pHttpStatus_ =
  ListAccountAssignmentsResponse' :: Maybe [AccountAssignment]
-> Maybe Text -> Int -> ListAccountAssignmentsResponse
ListAccountAssignmentsResponse'
    { $sel:accountAssignments:ListAccountAssignmentsResponse' :: Maybe [AccountAssignment]
accountAssignments =
        Maybe [AccountAssignment]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListAccountAssignmentsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListAccountAssignmentsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The list of assignments that match the input Amazon Web Services account
-- and permission set.
listAccountAssignmentsResponse_accountAssignments :: Lens.Lens' ListAccountAssignmentsResponse (Prelude.Maybe [AccountAssignment])
listAccountAssignmentsResponse_accountAssignments :: (Maybe [AccountAssignment] -> f (Maybe [AccountAssignment]))
-> ListAccountAssignmentsResponse
-> f ListAccountAssignmentsResponse
listAccountAssignmentsResponse_accountAssignments = (ListAccountAssignmentsResponse -> Maybe [AccountAssignment])
-> (ListAccountAssignmentsResponse
    -> Maybe [AccountAssignment] -> ListAccountAssignmentsResponse)
-> Lens' ListAccountAssignmentsResponse (Maybe [AccountAssignment])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccountAssignmentsResponse' {Maybe [AccountAssignment]
accountAssignments :: Maybe [AccountAssignment]
$sel:accountAssignments:ListAccountAssignmentsResponse' :: ListAccountAssignmentsResponse -> Maybe [AccountAssignment]
accountAssignments} -> Maybe [AccountAssignment]
accountAssignments) (\s :: ListAccountAssignmentsResponse
s@ListAccountAssignmentsResponse' {} Maybe [AccountAssignment]
a -> ListAccountAssignmentsResponse
s {$sel:accountAssignments:ListAccountAssignmentsResponse' :: Maybe [AccountAssignment]
accountAssignments = Maybe [AccountAssignment]
a} :: ListAccountAssignmentsResponse) ((Maybe [AccountAssignment] -> f (Maybe [AccountAssignment]))
 -> ListAccountAssignmentsResponse
 -> f ListAccountAssignmentsResponse)
-> ((Maybe [AccountAssignment] -> f (Maybe [AccountAssignment]))
    -> Maybe [AccountAssignment] -> f (Maybe [AccountAssignment]))
-> (Maybe [AccountAssignment] -> f (Maybe [AccountAssignment]))
-> ListAccountAssignmentsResponse
-> f ListAccountAssignmentsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [AccountAssignment]
  [AccountAssignment]
  [AccountAssignment]
  [AccountAssignment]
-> Iso
     (Maybe [AccountAssignment])
     (Maybe [AccountAssignment])
     (Maybe [AccountAssignment])
     (Maybe [AccountAssignment])
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
  [AccountAssignment]
  [AccountAssignment]
  [AccountAssignment]
  [AccountAssignment]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The pagination token for the list API. Initially the value is null. Use
-- the output of previous API calls to make subsequent calls.
listAccountAssignmentsResponse_nextToken :: Lens.Lens' ListAccountAssignmentsResponse (Prelude.Maybe Prelude.Text)
listAccountAssignmentsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListAccountAssignmentsResponse
-> f ListAccountAssignmentsResponse
listAccountAssignmentsResponse_nextToken = (ListAccountAssignmentsResponse -> Maybe Text)
-> (ListAccountAssignmentsResponse
    -> Maybe Text -> ListAccountAssignmentsResponse)
-> Lens' ListAccountAssignmentsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccountAssignmentsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAccountAssignmentsResponse' :: ListAccountAssignmentsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAccountAssignmentsResponse
s@ListAccountAssignmentsResponse' {} Maybe Text
a -> ListAccountAssignmentsResponse
s {$sel:nextToken:ListAccountAssignmentsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListAccountAssignmentsResponse)

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

instance
  Prelude.NFData
    ListAccountAssignmentsResponse