{-# 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.ListPermissionSetsProvisionedToAccount
-- 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 permission sets that are provisioned to a specified Amazon
-- Web Services account.
--
-- This operation returns paginated results.
module Amazonka.SSOAdmin.ListPermissionSetsProvisionedToAccount
  ( -- * Creating a Request
    ListPermissionSetsProvisionedToAccount (..),
    newListPermissionSetsProvisionedToAccount,

    -- * Request Lenses
    listPermissionSetsProvisionedToAccount_provisioningStatus,
    listPermissionSetsProvisionedToAccount_nextToken,
    listPermissionSetsProvisionedToAccount_maxResults,
    listPermissionSetsProvisionedToAccount_instanceArn,
    listPermissionSetsProvisionedToAccount_accountId,

    -- * Destructuring the Response
    ListPermissionSetsProvisionedToAccountResponse (..),
    newListPermissionSetsProvisionedToAccountResponse,

    -- * Response Lenses
    listPermissionSetsProvisionedToAccountResponse_permissionSets,
    listPermissionSetsProvisionedToAccountResponse_nextToken,
    listPermissionSetsProvisionedToAccountResponse_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:/ 'newListPermissionSetsProvisionedToAccount' smart constructor.
data ListPermissionSetsProvisionedToAccount = ListPermissionSetsProvisionedToAccount'
  { -- | The status object for the permission set provisioning operation.
    ListPermissionSetsProvisionedToAccount -> Maybe ProvisioningStatus
provisioningStatus :: Prelude.Maybe ProvisioningStatus,
    -- | The pagination token for the list API. Initially the value is null. Use
    -- the output of previous API calls to make subsequent calls.
    ListPermissionSetsProvisionedToAccount -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to display for the assignment.
    ListPermissionSetsProvisionedToAccount -> 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/.
    ListPermissionSetsProvisionedToAccount -> Text
instanceArn :: Prelude.Text,
    -- | The identifier of the Amazon Web Services account from which to list the
    -- assignments.
    ListPermissionSetsProvisionedToAccount -> Text
accountId :: Prelude.Text
  }
  deriving (ListPermissionSetsProvisionedToAccount
-> ListPermissionSetsProvisionedToAccount -> Bool
(ListPermissionSetsProvisionedToAccount
 -> ListPermissionSetsProvisionedToAccount -> Bool)
-> (ListPermissionSetsProvisionedToAccount
    -> ListPermissionSetsProvisionedToAccount -> Bool)
-> Eq ListPermissionSetsProvisionedToAccount
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListPermissionSetsProvisionedToAccount
-> ListPermissionSetsProvisionedToAccount -> Bool
$c/= :: ListPermissionSetsProvisionedToAccount
-> ListPermissionSetsProvisionedToAccount -> Bool
== :: ListPermissionSetsProvisionedToAccount
-> ListPermissionSetsProvisionedToAccount -> Bool
$c== :: ListPermissionSetsProvisionedToAccount
-> ListPermissionSetsProvisionedToAccount -> Bool
Prelude.Eq, ReadPrec [ListPermissionSetsProvisionedToAccount]
ReadPrec ListPermissionSetsProvisionedToAccount
Int -> ReadS ListPermissionSetsProvisionedToAccount
ReadS [ListPermissionSetsProvisionedToAccount]
(Int -> ReadS ListPermissionSetsProvisionedToAccount)
-> ReadS [ListPermissionSetsProvisionedToAccount]
-> ReadPrec ListPermissionSetsProvisionedToAccount
-> ReadPrec [ListPermissionSetsProvisionedToAccount]
-> Read ListPermissionSetsProvisionedToAccount
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListPermissionSetsProvisionedToAccount]
$creadListPrec :: ReadPrec [ListPermissionSetsProvisionedToAccount]
readPrec :: ReadPrec ListPermissionSetsProvisionedToAccount
$creadPrec :: ReadPrec ListPermissionSetsProvisionedToAccount
readList :: ReadS [ListPermissionSetsProvisionedToAccount]
$creadList :: ReadS [ListPermissionSetsProvisionedToAccount]
readsPrec :: Int -> ReadS ListPermissionSetsProvisionedToAccount
$creadsPrec :: Int -> ReadS ListPermissionSetsProvisionedToAccount
Prelude.Read, Int -> ListPermissionSetsProvisionedToAccount -> ShowS
[ListPermissionSetsProvisionedToAccount] -> ShowS
ListPermissionSetsProvisionedToAccount -> String
(Int -> ListPermissionSetsProvisionedToAccount -> ShowS)
-> (ListPermissionSetsProvisionedToAccount -> String)
-> ([ListPermissionSetsProvisionedToAccount] -> ShowS)
-> Show ListPermissionSetsProvisionedToAccount
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListPermissionSetsProvisionedToAccount] -> ShowS
$cshowList :: [ListPermissionSetsProvisionedToAccount] -> ShowS
show :: ListPermissionSetsProvisionedToAccount -> String
$cshow :: ListPermissionSetsProvisionedToAccount -> String
showsPrec :: Int -> ListPermissionSetsProvisionedToAccount -> ShowS
$cshowsPrec :: Int -> ListPermissionSetsProvisionedToAccount -> ShowS
Prelude.Show, (forall x.
 ListPermissionSetsProvisionedToAccount
 -> Rep ListPermissionSetsProvisionedToAccount x)
-> (forall x.
    Rep ListPermissionSetsProvisionedToAccount x
    -> ListPermissionSetsProvisionedToAccount)
-> Generic ListPermissionSetsProvisionedToAccount
forall x.
Rep ListPermissionSetsProvisionedToAccount x
-> ListPermissionSetsProvisionedToAccount
forall x.
ListPermissionSetsProvisionedToAccount
-> Rep ListPermissionSetsProvisionedToAccount x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListPermissionSetsProvisionedToAccount x
-> ListPermissionSetsProvisionedToAccount
$cfrom :: forall x.
ListPermissionSetsProvisionedToAccount
-> Rep ListPermissionSetsProvisionedToAccount x
Prelude.Generic)

-- |
-- Create a value of 'ListPermissionSetsProvisionedToAccount' 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:
--
-- 'provisioningStatus', 'listPermissionSetsProvisionedToAccount_provisioningStatus' - The status object for the permission set provisioning operation.
--
-- 'nextToken', 'listPermissionSetsProvisionedToAccount_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', 'listPermissionSetsProvisionedToAccount_maxResults' - The maximum number of results to display for the assignment.
--
-- 'instanceArn', 'listPermissionSetsProvisionedToAccount_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', 'listPermissionSetsProvisionedToAccount_accountId' - The identifier of the Amazon Web Services account from which to list the
-- assignments.
newListPermissionSetsProvisionedToAccount ::
  -- | 'instanceArn'
  Prelude.Text ->
  -- | 'accountId'
  Prelude.Text ->
  ListPermissionSetsProvisionedToAccount
newListPermissionSetsProvisionedToAccount :: Text -> Text -> ListPermissionSetsProvisionedToAccount
newListPermissionSetsProvisionedToAccount
  Text
pInstanceArn_
  Text
pAccountId_ =
    ListPermissionSetsProvisionedToAccount' :: Maybe ProvisioningStatus
-> Maybe Text
-> Maybe Natural
-> Text
-> Text
-> ListPermissionSetsProvisionedToAccount
ListPermissionSetsProvisionedToAccount'
      { $sel:provisioningStatus:ListPermissionSetsProvisionedToAccount' :: Maybe ProvisioningStatus
provisioningStatus =
          Maybe ProvisioningStatus
forall a. Maybe a
Prelude.Nothing,
        $sel:nextToken:ListPermissionSetsProvisionedToAccount' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:maxResults:ListPermissionSetsProvisionedToAccount' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
        $sel:instanceArn:ListPermissionSetsProvisionedToAccount' :: Text
instanceArn = Text
pInstanceArn_,
        $sel:accountId:ListPermissionSetsProvisionedToAccount' :: Text
accountId = Text
pAccountId_
      }

-- | The status object for the permission set provisioning operation.
listPermissionSetsProvisionedToAccount_provisioningStatus :: Lens.Lens' ListPermissionSetsProvisionedToAccount (Prelude.Maybe ProvisioningStatus)
listPermissionSetsProvisionedToAccount_provisioningStatus :: (Maybe ProvisioningStatus -> f (Maybe ProvisioningStatus))
-> ListPermissionSetsProvisionedToAccount
-> f ListPermissionSetsProvisionedToAccount
listPermissionSetsProvisionedToAccount_provisioningStatus = (ListPermissionSetsProvisionedToAccount
 -> Maybe ProvisioningStatus)
-> (ListPermissionSetsProvisionedToAccount
    -> Maybe ProvisioningStatus
    -> ListPermissionSetsProvisionedToAccount)
-> Lens
     ListPermissionSetsProvisionedToAccount
     ListPermissionSetsProvisionedToAccount
     (Maybe ProvisioningStatus)
     (Maybe ProvisioningStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPermissionSetsProvisionedToAccount' {Maybe ProvisioningStatus
provisioningStatus :: Maybe ProvisioningStatus
$sel:provisioningStatus:ListPermissionSetsProvisionedToAccount' :: ListPermissionSetsProvisionedToAccount -> Maybe ProvisioningStatus
provisioningStatus} -> Maybe ProvisioningStatus
provisioningStatus) (\s :: ListPermissionSetsProvisionedToAccount
s@ListPermissionSetsProvisionedToAccount' {} Maybe ProvisioningStatus
a -> ListPermissionSetsProvisionedToAccount
s {$sel:provisioningStatus:ListPermissionSetsProvisionedToAccount' :: Maybe ProvisioningStatus
provisioningStatus = Maybe ProvisioningStatus
a} :: ListPermissionSetsProvisionedToAccount)

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

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

-- | 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/.
listPermissionSetsProvisionedToAccount_instanceArn :: Lens.Lens' ListPermissionSetsProvisionedToAccount Prelude.Text
listPermissionSetsProvisionedToAccount_instanceArn :: (Text -> f Text)
-> ListPermissionSetsProvisionedToAccount
-> f ListPermissionSetsProvisionedToAccount
listPermissionSetsProvisionedToAccount_instanceArn = (ListPermissionSetsProvisionedToAccount -> Text)
-> (ListPermissionSetsProvisionedToAccount
    -> Text -> ListPermissionSetsProvisionedToAccount)
-> Lens
     ListPermissionSetsProvisionedToAccount
     ListPermissionSetsProvisionedToAccount
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPermissionSetsProvisionedToAccount' {Text
instanceArn :: Text
$sel:instanceArn:ListPermissionSetsProvisionedToAccount' :: ListPermissionSetsProvisionedToAccount -> Text
instanceArn} -> Text
instanceArn) (\s :: ListPermissionSetsProvisionedToAccount
s@ListPermissionSetsProvisionedToAccount' {} Text
a -> ListPermissionSetsProvisionedToAccount
s {$sel:instanceArn:ListPermissionSetsProvisionedToAccount' :: Text
instanceArn = Text
a} :: ListPermissionSetsProvisionedToAccount)

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

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

instance
  Prelude.NFData
    ListPermissionSetsProvisionedToAccount

instance
  Core.ToHeaders
    ListPermissionSetsProvisionedToAccount
  where
  toHeaders :: ListPermissionSetsProvisionedToAccount -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> ListPermissionSetsProvisionedToAccount -> 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.ListPermissionSetsProvisionedToAccount" ::
                          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
    ListPermissionSetsProvisionedToAccount
  where
  toJSON :: ListPermissionSetsProvisionedToAccount -> Value
toJSON ListPermissionSetsProvisionedToAccount' {Maybe Natural
Maybe Text
Maybe ProvisioningStatus
Text
accountId :: Text
instanceArn :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
provisioningStatus :: Maybe ProvisioningStatus
$sel:accountId:ListPermissionSetsProvisionedToAccount' :: ListPermissionSetsProvisionedToAccount -> Text
$sel:instanceArn:ListPermissionSetsProvisionedToAccount' :: ListPermissionSetsProvisionedToAccount -> Text
$sel:maxResults:ListPermissionSetsProvisionedToAccount' :: ListPermissionSetsProvisionedToAccount -> Maybe Natural
$sel:nextToken:ListPermissionSetsProvisionedToAccount' :: ListPermissionSetsProvisionedToAccount -> Maybe Text
$sel:provisioningStatus:ListPermissionSetsProvisionedToAccount' :: ListPermissionSetsProvisionedToAccount -> Maybe ProvisioningStatus
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ProvisioningStatus" Text -> ProvisioningStatus -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ProvisioningStatus -> Pair)
-> Maybe ProvisioningStatus -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ProvisioningStatus
provisioningStatus,
            (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)
          ]
      )

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

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

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

-- |
-- Create a value of 'ListPermissionSetsProvisionedToAccountResponse' 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:
--
-- 'permissionSets', 'listPermissionSetsProvisionedToAccountResponse_permissionSets' - Defines the level of access that an Amazon Web Services account has.
--
-- 'nextToken', 'listPermissionSetsProvisionedToAccountResponse_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', 'listPermissionSetsProvisionedToAccountResponse_httpStatus' - The response's http status code.
newListPermissionSetsProvisionedToAccountResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListPermissionSetsProvisionedToAccountResponse
newListPermissionSetsProvisionedToAccountResponse :: Int -> ListPermissionSetsProvisionedToAccountResponse
newListPermissionSetsProvisionedToAccountResponse
  Int
pHttpStatus_ =
    ListPermissionSetsProvisionedToAccountResponse' :: Maybe [Text]
-> Maybe Text
-> Int
-> ListPermissionSetsProvisionedToAccountResponse
ListPermissionSetsProvisionedToAccountResponse'
      { $sel:permissionSets:ListPermissionSetsProvisionedToAccountResponse' :: Maybe [Text]
permissionSets =
          Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
        $sel:nextToken:ListPermissionSetsProvisionedToAccountResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:ListPermissionSetsProvisionedToAccountResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | Defines the level of access that an Amazon Web Services account has.
listPermissionSetsProvisionedToAccountResponse_permissionSets :: Lens.Lens' ListPermissionSetsProvisionedToAccountResponse (Prelude.Maybe [Prelude.Text])
listPermissionSetsProvisionedToAccountResponse_permissionSets :: (Maybe [Text] -> f (Maybe [Text]))
-> ListPermissionSetsProvisionedToAccountResponse
-> f ListPermissionSetsProvisionedToAccountResponse
listPermissionSetsProvisionedToAccountResponse_permissionSets = (ListPermissionSetsProvisionedToAccountResponse -> Maybe [Text])
-> (ListPermissionSetsProvisionedToAccountResponse
    -> Maybe [Text] -> ListPermissionSetsProvisionedToAccountResponse)
-> Lens'
     ListPermissionSetsProvisionedToAccountResponse (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPermissionSetsProvisionedToAccountResponse' {Maybe [Text]
permissionSets :: Maybe [Text]
$sel:permissionSets:ListPermissionSetsProvisionedToAccountResponse' :: ListPermissionSetsProvisionedToAccountResponse -> Maybe [Text]
permissionSets} -> Maybe [Text]
permissionSets) (\s :: ListPermissionSetsProvisionedToAccountResponse
s@ListPermissionSetsProvisionedToAccountResponse' {} Maybe [Text]
a -> ListPermissionSetsProvisionedToAccountResponse
s {$sel:permissionSets:ListPermissionSetsProvisionedToAccountResponse' :: Maybe [Text]
permissionSets = Maybe [Text]
a} :: ListPermissionSetsProvisionedToAccountResponse) ((Maybe [Text] -> f (Maybe [Text]))
 -> ListPermissionSetsProvisionedToAccountResponse
 -> f ListPermissionSetsProvisionedToAccountResponse)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> ListPermissionSetsProvisionedToAccountResponse
-> f ListPermissionSetsProvisionedToAccountResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
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.
listPermissionSetsProvisionedToAccountResponse_nextToken :: Lens.Lens' ListPermissionSetsProvisionedToAccountResponse (Prelude.Maybe Prelude.Text)
listPermissionSetsProvisionedToAccountResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListPermissionSetsProvisionedToAccountResponse
-> f ListPermissionSetsProvisionedToAccountResponse
listPermissionSetsProvisionedToAccountResponse_nextToken = (ListPermissionSetsProvisionedToAccountResponse -> Maybe Text)
-> (ListPermissionSetsProvisionedToAccountResponse
    -> Maybe Text -> ListPermissionSetsProvisionedToAccountResponse)
-> Lens'
     ListPermissionSetsProvisionedToAccountResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPermissionSetsProvisionedToAccountResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListPermissionSetsProvisionedToAccountResponse' :: ListPermissionSetsProvisionedToAccountResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListPermissionSetsProvisionedToAccountResponse
s@ListPermissionSetsProvisionedToAccountResponse' {} Maybe Text
a -> ListPermissionSetsProvisionedToAccountResponse
s {$sel:nextToken:ListPermissionSetsProvisionedToAccountResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListPermissionSetsProvisionedToAccountResponse)

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

instance
  Prelude.NFData
    ListPermissionSetsProvisionedToAccountResponse