{-# 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.ListAccountsForProvisionedPermissionSet
-- 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 Amazon Web Services accounts where the specified
-- permission set is provisioned.
--
-- This operation returns paginated results.
module Amazonka.SSOAdmin.ListAccountsForProvisionedPermissionSet
  ( -- * Creating a Request
    ListAccountsForProvisionedPermissionSet (..),
    newListAccountsForProvisionedPermissionSet,

    -- * Request Lenses
    listAccountsForProvisionedPermissionSet_provisioningStatus,
    listAccountsForProvisionedPermissionSet_nextToken,
    listAccountsForProvisionedPermissionSet_maxResults,
    listAccountsForProvisionedPermissionSet_instanceArn,
    listAccountsForProvisionedPermissionSet_permissionSetArn,

    -- * Destructuring the Response
    ListAccountsForProvisionedPermissionSetResponse (..),
    newListAccountsForProvisionedPermissionSetResponse,

    -- * Response Lenses
    listAccountsForProvisionedPermissionSetResponse_accountIds,
    listAccountsForProvisionedPermissionSetResponse_nextToken,
    listAccountsForProvisionedPermissionSetResponse_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:/ 'newListAccountsForProvisionedPermissionSet' smart constructor.
data ListAccountsForProvisionedPermissionSet = ListAccountsForProvisionedPermissionSet'
  { -- | The permission set provisioning status for an Amazon Web Services
    -- account.
    ListAccountsForProvisionedPermissionSet -> 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.
    ListAccountsForProvisionedPermissionSet -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to display for the PermissionSet.
    ListAccountsForProvisionedPermissionSet -> 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/.
    ListAccountsForProvisionedPermissionSet -> Text
instanceArn :: Prelude.Text,
    -- | The ARN of the PermissionSet from which the associated Amazon Web
    -- Services accounts will be listed.
    ListAccountsForProvisionedPermissionSet -> Text
permissionSetArn :: Prelude.Text
  }
  deriving (ListAccountsForProvisionedPermissionSet
-> ListAccountsForProvisionedPermissionSet -> Bool
(ListAccountsForProvisionedPermissionSet
 -> ListAccountsForProvisionedPermissionSet -> Bool)
-> (ListAccountsForProvisionedPermissionSet
    -> ListAccountsForProvisionedPermissionSet -> Bool)
-> Eq ListAccountsForProvisionedPermissionSet
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAccountsForProvisionedPermissionSet
-> ListAccountsForProvisionedPermissionSet -> Bool
$c/= :: ListAccountsForProvisionedPermissionSet
-> ListAccountsForProvisionedPermissionSet -> Bool
== :: ListAccountsForProvisionedPermissionSet
-> ListAccountsForProvisionedPermissionSet -> Bool
$c== :: ListAccountsForProvisionedPermissionSet
-> ListAccountsForProvisionedPermissionSet -> Bool
Prelude.Eq, ReadPrec [ListAccountsForProvisionedPermissionSet]
ReadPrec ListAccountsForProvisionedPermissionSet
Int -> ReadS ListAccountsForProvisionedPermissionSet
ReadS [ListAccountsForProvisionedPermissionSet]
(Int -> ReadS ListAccountsForProvisionedPermissionSet)
-> ReadS [ListAccountsForProvisionedPermissionSet]
-> ReadPrec ListAccountsForProvisionedPermissionSet
-> ReadPrec [ListAccountsForProvisionedPermissionSet]
-> Read ListAccountsForProvisionedPermissionSet
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAccountsForProvisionedPermissionSet]
$creadListPrec :: ReadPrec [ListAccountsForProvisionedPermissionSet]
readPrec :: ReadPrec ListAccountsForProvisionedPermissionSet
$creadPrec :: ReadPrec ListAccountsForProvisionedPermissionSet
readList :: ReadS [ListAccountsForProvisionedPermissionSet]
$creadList :: ReadS [ListAccountsForProvisionedPermissionSet]
readsPrec :: Int -> ReadS ListAccountsForProvisionedPermissionSet
$creadsPrec :: Int -> ReadS ListAccountsForProvisionedPermissionSet
Prelude.Read, Int -> ListAccountsForProvisionedPermissionSet -> ShowS
[ListAccountsForProvisionedPermissionSet] -> ShowS
ListAccountsForProvisionedPermissionSet -> String
(Int -> ListAccountsForProvisionedPermissionSet -> ShowS)
-> (ListAccountsForProvisionedPermissionSet -> String)
-> ([ListAccountsForProvisionedPermissionSet] -> ShowS)
-> Show ListAccountsForProvisionedPermissionSet
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAccountsForProvisionedPermissionSet] -> ShowS
$cshowList :: [ListAccountsForProvisionedPermissionSet] -> ShowS
show :: ListAccountsForProvisionedPermissionSet -> String
$cshow :: ListAccountsForProvisionedPermissionSet -> String
showsPrec :: Int -> ListAccountsForProvisionedPermissionSet -> ShowS
$cshowsPrec :: Int -> ListAccountsForProvisionedPermissionSet -> ShowS
Prelude.Show, (forall x.
 ListAccountsForProvisionedPermissionSet
 -> Rep ListAccountsForProvisionedPermissionSet x)
-> (forall x.
    Rep ListAccountsForProvisionedPermissionSet x
    -> ListAccountsForProvisionedPermissionSet)
-> Generic ListAccountsForProvisionedPermissionSet
forall x.
Rep ListAccountsForProvisionedPermissionSet x
-> ListAccountsForProvisionedPermissionSet
forall x.
ListAccountsForProvisionedPermissionSet
-> Rep ListAccountsForProvisionedPermissionSet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListAccountsForProvisionedPermissionSet x
-> ListAccountsForProvisionedPermissionSet
$cfrom :: forall x.
ListAccountsForProvisionedPermissionSet
-> Rep ListAccountsForProvisionedPermissionSet x
Prelude.Generic)

-- |
-- Create a value of 'ListAccountsForProvisionedPermissionSet' 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', 'listAccountsForProvisionedPermissionSet_provisioningStatus' - The permission set provisioning status for an Amazon Web Services
-- account.
--
-- 'nextToken', 'listAccountsForProvisionedPermissionSet_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', 'listAccountsForProvisionedPermissionSet_maxResults' - The maximum number of results to display for the PermissionSet.
--
-- 'instanceArn', 'listAccountsForProvisionedPermissionSet_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/.
--
-- 'permissionSetArn', 'listAccountsForProvisionedPermissionSet_permissionSetArn' - The ARN of the PermissionSet from which the associated Amazon Web
-- Services accounts will be listed.
newListAccountsForProvisionedPermissionSet ::
  -- | 'instanceArn'
  Prelude.Text ->
  -- | 'permissionSetArn'
  Prelude.Text ->
  ListAccountsForProvisionedPermissionSet
newListAccountsForProvisionedPermissionSet :: Text -> Text -> ListAccountsForProvisionedPermissionSet
newListAccountsForProvisionedPermissionSet
  Text
pInstanceArn_
  Text
pPermissionSetArn_ =
    ListAccountsForProvisionedPermissionSet' :: Maybe ProvisioningStatus
-> Maybe Text
-> Maybe Natural
-> Text
-> Text
-> ListAccountsForProvisionedPermissionSet
ListAccountsForProvisionedPermissionSet'
      { $sel:provisioningStatus:ListAccountsForProvisionedPermissionSet' :: Maybe ProvisioningStatus
provisioningStatus =
          Maybe ProvisioningStatus
forall a. Maybe a
Prelude.Nothing,
        $sel:nextToken:ListAccountsForProvisionedPermissionSet' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:maxResults:ListAccountsForProvisionedPermissionSet' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
        $sel:instanceArn:ListAccountsForProvisionedPermissionSet' :: Text
instanceArn = Text
pInstanceArn_,
        $sel:permissionSetArn:ListAccountsForProvisionedPermissionSet' :: Text
permissionSetArn =
          Text
pPermissionSetArn_
      }

-- | The permission set provisioning status for an Amazon Web Services
-- account.
listAccountsForProvisionedPermissionSet_provisioningStatus :: Lens.Lens' ListAccountsForProvisionedPermissionSet (Prelude.Maybe ProvisioningStatus)
listAccountsForProvisionedPermissionSet_provisioningStatus :: (Maybe ProvisioningStatus -> f (Maybe ProvisioningStatus))
-> ListAccountsForProvisionedPermissionSet
-> f ListAccountsForProvisionedPermissionSet
listAccountsForProvisionedPermissionSet_provisioningStatus = (ListAccountsForProvisionedPermissionSet
 -> Maybe ProvisioningStatus)
-> (ListAccountsForProvisionedPermissionSet
    -> Maybe ProvisioningStatus
    -> ListAccountsForProvisionedPermissionSet)
-> Lens
     ListAccountsForProvisionedPermissionSet
     ListAccountsForProvisionedPermissionSet
     (Maybe ProvisioningStatus)
     (Maybe ProvisioningStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccountsForProvisionedPermissionSet' {Maybe ProvisioningStatus
provisioningStatus :: Maybe ProvisioningStatus
$sel:provisioningStatus:ListAccountsForProvisionedPermissionSet' :: ListAccountsForProvisionedPermissionSet -> Maybe ProvisioningStatus
provisioningStatus} -> Maybe ProvisioningStatus
provisioningStatus) (\s :: ListAccountsForProvisionedPermissionSet
s@ListAccountsForProvisionedPermissionSet' {} Maybe ProvisioningStatus
a -> ListAccountsForProvisionedPermissionSet
s {$sel:provisioningStatus:ListAccountsForProvisionedPermissionSet' :: Maybe ProvisioningStatus
provisioningStatus = Maybe ProvisioningStatus
a} :: ListAccountsForProvisionedPermissionSet)

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

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

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

-- | The ARN of the PermissionSet from which the associated Amazon Web
-- Services accounts will be listed.
listAccountsForProvisionedPermissionSet_permissionSetArn :: Lens.Lens' ListAccountsForProvisionedPermissionSet Prelude.Text
listAccountsForProvisionedPermissionSet_permissionSetArn :: (Text -> f Text)
-> ListAccountsForProvisionedPermissionSet
-> f ListAccountsForProvisionedPermissionSet
listAccountsForProvisionedPermissionSet_permissionSetArn = (ListAccountsForProvisionedPermissionSet -> Text)
-> (ListAccountsForProvisionedPermissionSet
    -> Text -> ListAccountsForProvisionedPermissionSet)
-> Lens
     ListAccountsForProvisionedPermissionSet
     ListAccountsForProvisionedPermissionSet
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccountsForProvisionedPermissionSet' {Text
permissionSetArn :: Text
$sel:permissionSetArn:ListAccountsForProvisionedPermissionSet' :: ListAccountsForProvisionedPermissionSet -> Text
permissionSetArn} -> Text
permissionSetArn) (\s :: ListAccountsForProvisionedPermissionSet
s@ListAccountsForProvisionedPermissionSet' {} Text
a -> ListAccountsForProvisionedPermissionSet
s {$sel:permissionSetArn:ListAccountsForProvisionedPermissionSet' :: Text
permissionSetArn = Text
a} :: ListAccountsForProvisionedPermissionSet)

instance
  Core.AWSPager
    ListAccountsForProvisionedPermissionSet
  where
  page :: ListAccountsForProvisionedPermissionSet
-> AWSResponse ListAccountsForProvisionedPermissionSet
-> Maybe ListAccountsForProvisionedPermissionSet
page ListAccountsForProvisionedPermissionSet
rq AWSResponse ListAccountsForProvisionedPermissionSet
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListAccountsForProvisionedPermissionSet
ListAccountsForProvisionedPermissionSetResponse
rs
            ListAccountsForProvisionedPermissionSetResponse
-> Getting
     (First Text) ListAccountsForProvisionedPermissionSetResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListAccountsForProvisionedPermissionSetResponse
-> Const
     (First Text) ListAccountsForProvisionedPermissionSetResponse
Lens' ListAccountsForProvisionedPermissionSetResponse (Maybe Text)
listAccountsForProvisionedPermissionSetResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListAccountsForProvisionedPermissionSetResponse
 -> Const
      (First Text) ListAccountsForProvisionedPermissionSetResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting
     (First Text) ListAccountsForProvisionedPermissionSetResponse 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 ListAccountsForProvisionedPermissionSet
forall a. Maybe a
Prelude.Nothing
    | Maybe [Text] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListAccountsForProvisionedPermissionSet
ListAccountsForProvisionedPermissionSetResponse
rs
            ListAccountsForProvisionedPermissionSetResponse
-> Getting
     (First [Text])
     ListAccountsForProvisionedPermissionSetResponse
     [Text]
-> Maybe [Text]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [Text] -> Const (First [Text]) (Maybe [Text]))
-> ListAccountsForProvisionedPermissionSetResponse
-> Const
     (First [Text]) ListAccountsForProvisionedPermissionSetResponse
Lens'
  ListAccountsForProvisionedPermissionSetResponse (Maybe [Text])
listAccountsForProvisionedPermissionSetResponse_accountIds
              ((Maybe [Text] -> Const (First [Text]) (Maybe [Text]))
 -> ListAccountsForProvisionedPermissionSetResponse
 -> Const
      (First [Text]) ListAccountsForProvisionedPermissionSetResponse)
-> (([Text] -> Const (First [Text]) [Text])
    -> Maybe [Text] -> Const (First [Text]) (Maybe [Text]))
-> Getting
     (First [Text])
     ListAccountsForProvisionedPermissionSetResponse
     [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 ListAccountsForProvisionedPermissionSet
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListAccountsForProvisionedPermissionSet
-> Maybe ListAccountsForProvisionedPermissionSet
forall a. a -> Maybe a
Prelude.Just (ListAccountsForProvisionedPermissionSet
 -> Maybe ListAccountsForProvisionedPermissionSet)
-> ListAccountsForProvisionedPermissionSet
-> Maybe ListAccountsForProvisionedPermissionSet
forall a b. (a -> b) -> a -> b
Prelude.$
        ListAccountsForProvisionedPermissionSet
rq
          ListAccountsForProvisionedPermissionSet
-> (ListAccountsForProvisionedPermissionSet
    -> ListAccountsForProvisionedPermissionSet)
-> ListAccountsForProvisionedPermissionSet
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListAccountsForProvisionedPermissionSet
-> Identity ListAccountsForProvisionedPermissionSet
Lens
  ListAccountsForProvisionedPermissionSet
  ListAccountsForProvisionedPermissionSet
  (Maybe Text)
  (Maybe Text)
listAccountsForProvisionedPermissionSet_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListAccountsForProvisionedPermissionSet
 -> Identity ListAccountsForProvisionedPermissionSet)
-> Maybe Text
-> ListAccountsForProvisionedPermissionSet
-> ListAccountsForProvisionedPermissionSet
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListAccountsForProvisionedPermissionSet
ListAccountsForProvisionedPermissionSetResponse
rs
            ListAccountsForProvisionedPermissionSetResponse
-> Getting
     (First Text) ListAccountsForProvisionedPermissionSetResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListAccountsForProvisionedPermissionSetResponse
-> Const
     (First Text) ListAccountsForProvisionedPermissionSetResponse
Lens' ListAccountsForProvisionedPermissionSetResponse (Maybe Text)
listAccountsForProvisionedPermissionSetResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListAccountsForProvisionedPermissionSetResponse
 -> Const
      (First Text) ListAccountsForProvisionedPermissionSetResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting
     (First Text) ListAccountsForProvisionedPermissionSetResponse 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
    ListAccountsForProvisionedPermissionSet
  where
  type
    AWSResponse
      ListAccountsForProvisionedPermissionSet =
      ListAccountsForProvisionedPermissionSetResponse
  request :: ListAccountsForProvisionedPermissionSet
-> Request ListAccountsForProvisionedPermissionSet
request = Service
-> ListAccountsForProvisionedPermissionSet
-> Request ListAccountsForProvisionedPermissionSet
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListAccountsForProvisionedPermissionSet
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse ListAccountsForProvisionedPermissionSet)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either
      String (AWSResponse ListAccountsForProvisionedPermissionSet))
-> Logger
-> Service
-> Proxy ListAccountsForProvisionedPermissionSet
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse ListAccountsForProvisionedPermissionSet)))
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
-> ListAccountsForProvisionedPermissionSetResponse
ListAccountsForProvisionedPermissionSetResponse'
            (Maybe [Text]
 -> Maybe Text
 -> Int
 -> ListAccountsForProvisionedPermissionSetResponse)
-> Either String (Maybe [Text])
-> Either
     String
     (Maybe Text
      -> Int -> ListAccountsForProvisionedPermissionSetResponse)
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
"AccountIds" 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 -> ListAccountsForProvisionedPermissionSetResponse)
-> Either String (Maybe Text)
-> Either
     String (Int -> ListAccountsForProvisionedPermissionSetResponse)
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 -> ListAccountsForProvisionedPermissionSetResponse)
-> Either String Int
-> Either String ListAccountsForProvisionedPermissionSetResponse
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
    ListAccountsForProvisionedPermissionSet

instance
  Prelude.NFData
    ListAccountsForProvisionedPermissionSet

instance
  Core.ToHeaders
    ListAccountsForProvisionedPermissionSet
  where
  toHeaders :: ListAccountsForProvisionedPermissionSet -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> ListAccountsForProvisionedPermissionSet -> 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.ListAccountsForProvisionedPermissionSet" ::
                          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
    ListAccountsForProvisionedPermissionSet
  where
  toJSON :: ListAccountsForProvisionedPermissionSet -> Value
toJSON ListAccountsForProvisionedPermissionSet' {Maybe Natural
Maybe Text
Maybe ProvisioningStatus
Text
permissionSetArn :: Text
instanceArn :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
provisioningStatus :: Maybe ProvisioningStatus
$sel:permissionSetArn:ListAccountsForProvisionedPermissionSet' :: ListAccountsForProvisionedPermissionSet -> Text
$sel:instanceArn:ListAccountsForProvisionedPermissionSet' :: ListAccountsForProvisionedPermissionSet -> Text
$sel:maxResults:ListAccountsForProvisionedPermissionSet' :: ListAccountsForProvisionedPermissionSet -> Maybe Natural
$sel:nextToken:ListAccountsForProvisionedPermissionSet' :: ListAccountsForProvisionedPermissionSet -> Maybe Text
$sel:provisioningStatus:ListAccountsForProvisionedPermissionSet' :: ListAccountsForProvisionedPermissionSet -> 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
"PermissionSetArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
permissionSetArn)
          ]
      )

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

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

-- | /See:/ 'newListAccountsForProvisionedPermissionSetResponse' smart constructor.
data ListAccountsForProvisionedPermissionSetResponse = ListAccountsForProvisionedPermissionSetResponse'
  { -- | The list of Amazon Web Services @AccountIds@.
    ListAccountsForProvisionedPermissionSetResponse -> Maybe [Text]
accountIds :: 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.
    ListAccountsForProvisionedPermissionSetResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListAccountsForProvisionedPermissionSetResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListAccountsForProvisionedPermissionSetResponse
-> ListAccountsForProvisionedPermissionSetResponse -> Bool
(ListAccountsForProvisionedPermissionSetResponse
 -> ListAccountsForProvisionedPermissionSetResponse -> Bool)
-> (ListAccountsForProvisionedPermissionSetResponse
    -> ListAccountsForProvisionedPermissionSetResponse -> Bool)
-> Eq ListAccountsForProvisionedPermissionSetResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAccountsForProvisionedPermissionSetResponse
-> ListAccountsForProvisionedPermissionSetResponse -> Bool
$c/= :: ListAccountsForProvisionedPermissionSetResponse
-> ListAccountsForProvisionedPermissionSetResponse -> Bool
== :: ListAccountsForProvisionedPermissionSetResponse
-> ListAccountsForProvisionedPermissionSetResponse -> Bool
$c== :: ListAccountsForProvisionedPermissionSetResponse
-> ListAccountsForProvisionedPermissionSetResponse -> Bool
Prelude.Eq, ReadPrec [ListAccountsForProvisionedPermissionSetResponse]
ReadPrec ListAccountsForProvisionedPermissionSetResponse
Int -> ReadS ListAccountsForProvisionedPermissionSetResponse
ReadS [ListAccountsForProvisionedPermissionSetResponse]
(Int -> ReadS ListAccountsForProvisionedPermissionSetResponse)
-> ReadS [ListAccountsForProvisionedPermissionSetResponse]
-> ReadPrec ListAccountsForProvisionedPermissionSetResponse
-> ReadPrec [ListAccountsForProvisionedPermissionSetResponse]
-> Read ListAccountsForProvisionedPermissionSetResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAccountsForProvisionedPermissionSetResponse]
$creadListPrec :: ReadPrec [ListAccountsForProvisionedPermissionSetResponse]
readPrec :: ReadPrec ListAccountsForProvisionedPermissionSetResponse
$creadPrec :: ReadPrec ListAccountsForProvisionedPermissionSetResponse
readList :: ReadS [ListAccountsForProvisionedPermissionSetResponse]
$creadList :: ReadS [ListAccountsForProvisionedPermissionSetResponse]
readsPrec :: Int -> ReadS ListAccountsForProvisionedPermissionSetResponse
$creadsPrec :: Int -> ReadS ListAccountsForProvisionedPermissionSetResponse
Prelude.Read, Int -> ListAccountsForProvisionedPermissionSetResponse -> ShowS
[ListAccountsForProvisionedPermissionSetResponse] -> ShowS
ListAccountsForProvisionedPermissionSetResponse -> String
(Int -> ListAccountsForProvisionedPermissionSetResponse -> ShowS)
-> (ListAccountsForProvisionedPermissionSetResponse -> String)
-> ([ListAccountsForProvisionedPermissionSetResponse] -> ShowS)
-> Show ListAccountsForProvisionedPermissionSetResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAccountsForProvisionedPermissionSetResponse] -> ShowS
$cshowList :: [ListAccountsForProvisionedPermissionSetResponse] -> ShowS
show :: ListAccountsForProvisionedPermissionSetResponse -> String
$cshow :: ListAccountsForProvisionedPermissionSetResponse -> String
showsPrec :: Int -> ListAccountsForProvisionedPermissionSetResponse -> ShowS
$cshowsPrec :: Int -> ListAccountsForProvisionedPermissionSetResponse -> ShowS
Prelude.Show, (forall x.
 ListAccountsForProvisionedPermissionSetResponse
 -> Rep ListAccountsForProvisionedPermissionSetResponse x)
-> (forall x.
    Rep ListAccountsForProvisionedPermissionSetResponse x
    -> ListAccountsForProvisionedPermissionSetResponse)
-> Generic ListAccountsForProvisionedPermissionSetResponse
forall x.
Rep ListAccountsForProvisionedPermissionSetResponse x
-> ListAccountsForProvisionedPermissionSetResponse
forall x.
ListAccountsForProvisionedPermissionSetResponse
-> Rep ListAccountsForProvisionedPermissionSetResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListAccountsForProvisionedPermissionSetResponse x
-> ListAccountsForProvisionedPermissionSetResponse
$cfrom :: forall x.
ListAccountsForProvisionedPermissionSetResponse
-> Rep ListAccountsForProvisionedPermissionSetResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListAccountsForProvisionedPermissionSetResponse' 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:
--
-- 'accountIds', 'listAccountsForProvisionedPermissionSetResponse_accountIds' - The list of Amazon Web Services @AccountIds@.
--
-- 'nextToken', 'listAccountsForProvisionedPermissionSetResponse_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', 'listAccountsForProvisionedPermissionSetResponse_httpStatus' - The response's http status code.
newListAccountsForProvisionedPermissionSetResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListAccountsForProvisionedPermissionSetResponse
newListAccountsForProvisionedPermissionSetResponse :: Int -> ListAccountsForProvisionedPermissionSetResponse
newListAccountsForProvisionedPermissionSetResponse
  Int
pHttpStatus_ =
    ListAccountsForProvisionedPermissionSetResponse' :: Maybe [Text]
-> Maybe Text
-> Int
-> ListAccountsForProvisionedPermissionSetResponse
ListAccountsForProvisionedPermissionSetResponse'
      { $sel:accountIds:ListAccountsForProvisionedPermissionSetResponse' :: Maybe [Text]
accountIds =
          Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
        $sel:nextToken:ListAccountsForProvisionedPermissionSetResponse' :: Maybe Text
nextToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:ListAccountsForProvisionedPermissionSetResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | The list of Amazon Web Services @AccountIds@.
listAccountsForProvisionedPermissionSetResponse_accountIds :: Lens.Lens' ListAccountsForProvisionedPermissionSetResponse (Prelude.Maybe [Prelude.Text])
listAccountsForProvisionedPermissionSetResponse_accountIds :: (Maybe [Text] -> f (Maybe [Text]))
-> ListAccountsForProvisionedPermissionSetResponse
-> f ListAccountsForProvisionedPermissionSetResponse
listAccountsForProvisionedPermissionSetResponse_accountIds = (ListAccountsForProvisionedPermissionSetResponse -> Maybe [Text])
-> (ListAccountsForProvisionedPermissionSetResponse
    -> Maybe [Text] -> ListAccountsForProvisionedPermissionSetResponse)
-> Lens'
     ListAccountsForProvisionedPermissionSetResponse (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccountsForProvisionedPermissionSetResponse' {Maybe [Text]
accountIds :: Maybe [Text]
$sel:accountIds:ListAccountsForProvisionedPermissionSetResponse' :: ListAccountsForProvisionedPermissionSetResponse -> Maybe [Text]
accountIds} -> Maybe [Text]
accountIds) (\s :: ListAccountsForProvisionedPermissionSetResponse
s@ListAccountsForProvisionedPermissionSetResponse' {} Maybe [Text]
a -> ListAccountsForProvisionedPermissionSetResponse
s {$sel:accountIds:ListAccountsForProvisionedPermissionSetResponse' :: Maybe [Text]
accountIds = Maybe [Text]
a} :: ListAccountsForProvisionedPermissionSetResponse) ((Maybe [Text] -> f (Maybe [Text]))
 -> ListAccountsForProvisionedPermissionSetResponse
 -> f ListAccountsForProvisionedPermissionSetResponse)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> ListAccountsForProvisionedPermissionSetResponse
-> f ListAccountsForProvisionedPermissionSetResponse
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.
listAccountsForProvisionedPermissionSetResponse_nextToken :: Lens.Lens' ListAccountsForProvisionedPermissionSetResponse (Prelude.Maybe Prelude.Text)
listAccountsForProvisionedPermissionSetResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListAccountsForProvisionedPermissionSetResponse
-> f ListAccountsForProvisionedPermissionSetResponse
listAccountsForProvisionedPermissionSetResponse_nextToken = (ListAccountsForProvisionedPermissionSetResponse -> Maybe Text)
-> (ListAccountsForProvisionedPermissionSetResponse
    -> Maybe Text -> ListAccountsForProvisionedPermissionSetResponse)
-> Lens'
     ListAccountsForProvisionedPermissionSetResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccountsForProvisionedPermissionSetResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAccountsForProvisionedPermissionSetResponse' :: ListAccountsForProvisionedPermissionSetResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAccountsForProvisionedPermissionSetResponse
s@ListAccountsForProvisionedPermissionSetResponse' {} Maybe Text
a -> ListAccountsForProvisionedPermissionSetResponse
s {$sel:nextToken:ListAccountsForProvisionedPermissionSetResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListAccountsForProvisionedPermissionSetResponse)

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

instance
  Prelude.NFData
    ListAccountsForProvisionedPermissionSetResponse