{-# 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.ListManagedPoliciesInPermissionSet
-- 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 IAM managed policy that is attached to a specified permission
-- set.
--
-- This operation returns paginated results.
module Amazonka.SSOAdmin.ListManagedPoliciesInPermissionSet
  ( -- * Creating a Request
    ListManagedPoliciesInPermissionSet (..),
    newListManagedPoliciesInPermissionSet,

    -- * Request Lenses
    listManagedPoliciesInPermissionSet_nextToken,
    listManagedPoliciesInPermissionSet_maxResults,
    listManagedPoliciesInPermissionSet_instanceArn,
    listManagedPoliciesInPermissionSet_permissionSetArn,

    -- * Destructuring the Response
    ListManagedPoliciesInPermissionSetResponse (..),
    newListManagedPoliciesInPermissionSetResponse,

    -- * Response Lenses
    listManagedPoliciesInPermissionSetResponse_nextToken,
    listManagedPoliciesInPermissionSetResponse_attachedManagedPolicies,
    listManagedPoliciesInPermissionSetResponse_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:/ 'newListManagedPoliciesInPermissionSet' smart constructor.
data ListManagedPoliciesInPermissionSet = ListManagedPoliciesInPermissionSet'
  { -- | The pagination token for the list API. Initially the value is null. Use
    -- the output of previous API calls to make subsequent calls.
    ListManagedPoliciesInPermissionSet -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to display for the PermissionSet.
    ListManagedPoliciesInPermissionSet -> 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/.
    ListManagedPoliciesInPermissionSet -> Text
instanceArn :: Prelude.Text,
    -- | The ARN of the PermissionSet whose managed policies will be listed.
    ListManagedPoliciesInPermissionSet -> Text
permissionSetArn :: Prelude.Text
  }
  deriving (ListManagedPoliciesInPermissionSet
-> ListManagedPoliciesInPermissionSet -> Bool
(ListManagedPoliciesInPermissionSet
 -> ListManagedPoliciesInPermissionSet -> Bool)
-> (ListManagedPoliciesInPermissionSet
    -> ListManagedPoliciesInPermissionSet -> Bool)
-> Eq ListManagedPoliciesInPermissionSet
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListManagedPoliciesInPermissionSet
-> ListManagedPoliciesInPermissionSet -> Bool
$c/= :: ListManagedPoliciesInPermissionSet
-> ListManagedPoliciesInPermissionSet -> Bool
== :: ListManagedPoliciesInPermissionSet
-> ListManagedPoliciesInPermissionSet -> Bool
$c== :: ListManagedPoliciesInPermissionSet
-> ListManagedPoliciesInPermissionSet -> Bool
Prelude.Eq, ReadPrec [ListManagedPoliciesInPermissionSet]
ReadPrec ListManagedPoliciesInPermissionSet
Int -> ReadS ListManagedPoliciesInPermissionSet
ReadS [ListManagedPoliciesInPermissionSet]
(Int -> ReadS ListManagedPoliciesInPermissionSet)
-> ReadS [ListManagedPoliciesInPermissionSet]
-> ReadPrec ListManagedPoliciesInPermissionSet
-> ReadPrec [ListManagedPoliciesInPermissionSet]
-> Read ListManagedPoliciesInPermissionSet
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListManagedPoliciesInPermissionSet]
$creadListPrec :: ReadPrec [ListManagedPoliciesInPermissionSet]
readPrec :: ReadPrec ListManagedPoliciesInPermissionSet
$creadPrec :: ReadPrec ListManagedPoliciesInPermissionSet
readList :: ReadS [ListManagedPoliciesInPermissionSet]
$creadList :: ReadS [ListManagedPoliciesInPermissionSet]
readsPrec :: Int -> ReadS ListManagedPoliciesInPermissionSet
$creadsPrec :: Int -> ReadS ListManagedPoliciesInPermissionSet
Prelude.Read, Int -> ListManagedPoliciesInPermissionSet -> ShowS
[ListManagedPoliciesInPermissionSet] -> ShowS
ListManagedPoliciesInPermissionSet -> String
(Int -> ListManagedPoliciesInPermissionSet -> ShowS)
-> (ListManagedPoliciesInPermissionSet -> String)
-> ([ListManagedPoliciesInPermissionSet] -> ShowS)
-> Show ListManagedPoliciesInPermissionSet
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListManagedPoliciesInPermissionSet] -> ShowS
$cshowList :: [ListManagedPoliciesInPermissionSet] -> ShowS
show :: ListManagedPoliciesInPermissionSet -> String
$cshow :: ListManagedPoliciesInPermissionSet -> String
showsPrec :: Int -> ListManagedPoliciesInPermissionSet -> ShowS
$cshowsPrec :: Int -> ListManagedPoliciesInPermissionSet -> ShowS
Prelude.Show, (forall x.
 ListManagedPoliciesInPermissionSet
 -> Rep ListManagedPoliciesInPermissionSet x)
-> (forall x.
    Rep ListManagedPoliciesInPermissionSet x
    -> ListManagedPoliciesInPermissionSet)
-> Generic ListManagedPoliciesInPermissionSet
forall x.
Rep ListManagedPoliciesInPermissionSet x
-> ListManagedPoliciesInPermissionSet
forall x.
ListManagedPoliciesInPermissionSet
-> Rep ListManagedPoliciesInPermissionSet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListManagedPoliciesInPermissionSet x
-> ListManagedPoliciesInPermissionSet
$cfrom :: forall x.
ListManagedPoliciesInPermissionSet
-> Rep ListManagedPoliciesInPermissionSet x
Prelude.Generic)

-- |
-- Create a value of 'ListManagedPoliciesInPermissionSet' 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', 'listManagedPoliciesInPermissionSet_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', 'listManagedPoliciesInPermissionSet_maxResults' - The maximum number of results to display for the PermissionSet.
--
-- 'instanceArn', 'listManagedPoliciesInPermissionSet_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', 'listManagedPoliciesInPermissionSet_permissionSetArn' - The ARN of the PermissionSet whose managed policies will be listed.
newListManagedPoliciesInPermissionSet ::
  -- | 'instanceArn'
  Prelude.Text ->
  -- | 'permissionSetArn'
  Prelude.Text ->
  ListManagedPoliciesInPermissionSet
newListManagedPoliciesInPermissionSet :: Text -> Text -> ListManagedPoliciesInPermissionSet
newListManagedPoliciesInPermissionSet
  Text
pInstanceArn_
  Text
pPermissionSetArn_ =
    ListManagedPoliciesInPermissionSet' :: Maybe Text
-> Maybe Natural
-> Text
-> Text
-> ListManagedPoliciesInPermissionSet
ListManagedPoliciesInPermissionSet'
      { $sel:nextToken:ListManagedPoliciesInPermissionSet' :: Maybe Text
nextToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:maxResults:ListManagedPoliciesInPermissionSet' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
        $sel:instanceArn:ListManagedPoliciesInPermissionSet' :: Text
instanceArn = Text
pInstanceArn_,
        $sel:permissionSetArn:ListManagedPoliciesInPermissionSet' :: 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.
listManagedPoliciesInPermissionSet_nextToken :: Lens.Lens' ListManagedPoliciesInPermissionSet (Prelude.Maybe Prelude.Text)
listManagedPoliciesInPermissionSet_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListManagedPoliciesInPermissionSet
-> f ListManagedPoliciesInPermissionSet
listManagedPoliciesInPermissionSet_nextToken = (ListManagedPoliciesInPermissionSet -> Maybe Text)
-> (ListManagedPoliciesInPermissionSet
    -> Maybe Text -> ListManagedPoliciesInPermissionSet)
-> Lens
     ListManagedPoliciesInPermissionSet
     ListManagedPoliciesInPermissionSet
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListManagedPoliciesInPermissionSet' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListManagedPoliciesInPermissionSet' :: ListManagedPoliciesInPermissionSet -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListManagedPoliciesInPermissionSet
s@ListManagedPoliciesInPermissionSet' {} Maybe Text
a -> ListManagedPoliciesInPermissionSet
s {$sel:nextToken:ListManagedPoliciesInPermissionSet' :: Maybe Text
nextToken = Maybe Text
a} :: ListManagedPoliciesInPermissionSet)

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

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

-- | The ARN of the PermissionSet whose managed policies will be listed.
listManagedPoliciesInPermissionSet_permissionSetArn :: Lens.Lens' ListManagedPoliciesInPermissionSet Prelude.Text
listManagedPoliciesInPermissionSet_permissionSetArn :: (Text -> f Text)
-> ListManagedPoliciesInPermissionSet
-> f ListManagedPoliciesInPermissionSet
listManagedPoliciesInPermissionSet_permissionSetArn = (ListManagedPoliciesInPermissionSet -> Text)
-> (ListManagedPoliciesInPermissionSet
    -> Text -> ListManagedPoliciesInPermissionSet)
-> Lens
     ListManagedPoliciesInPermissionSet
     ListManagedPoliciesInPermissionSet
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListManagedPoliciesInPermissionSet' {Text
permissionSetArn :: Text
$sel:permissionSetArn:ListManagedPoliciesInPermissionSet' :: ListManagedPoliciesInPermissionSet -> Text
permissionSetArn} -> Text
permissionSetArn) (\s :: ListManagedPoliciesInPermissionSet
s@ListManagedPoliciesInPermissionSet' {} Text
a -> ListManagedPoliciesInPermissionSet
s {$sel:permissionSetArn:ListManagedPoliciesInPermissionSet' :: Text
permissionSetArn = Text
a} :: ListManagedPoliciesInPermissionSet)

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

instance
  Prelude.NFData
    ListManagedPoliciesInPermissionSet

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

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

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

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

-- |
-- Create a value of 'ListManagedPoliciesInPermissionSetResponse' 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', 'listManagedPoliciesInPermissionSetResponse_nextToken' - The pagination token for the list API. Initially the value is null. Use
-- the output of previous API calls to make subsequent calls.
--
-- 'attachedManagedPolicies', 'listManagedPoliciesInPermissionSetResponse_attachedManagedPolicies' - The array of the AttachedManagedPolicy data type object.
--
-- 'httpStatus', 'listManagedPoliciesInPermissionSetResponse_httpStatus' - The response's http status code.
newListManagedPoliciesInPermissionSetResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListManagedPoliciesInPermissionSetResponse
newListManagedPoliciesInPermissionSetResponse :: Int -> ListManagedPoliciesInPermissionSetResponse
newListManagedPoliciesInPermissionSetResponse
  Int
pHttpStatus_ =
    ListManagedPoliciesInPermissionSetResponse' :: Maybe Text
-> Maybe [AttachedManagedPolicy]
-> Int
-> ListManagedPoliciesInPermissionSetResponse
ListManagedPoliciesInPermissionSetResponse'
      { $sel:nextToken:ListManagedPoliciesInPermissionSetResponse' :: Maybe Text
nextToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:attachedManagedPolicies:ListManagedPoliciesInPermissionSetResponse' :: Maybe [AttachedManagedPolicy]
attachedManagedPolicies =
          Maybe [AttachedManagedPolicy]
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:ListManagedPoliciesInPermissionSetResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

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

-- | The array of the AttachedManagedPolicy data type object.
listManagedPoliciesInPermissionSetResponse_attachedManagedPolicies :: Lens.Lens' ListManagedPoliciesInPermissionSetResponse (Prelude.Maybe [AttachedManagedPolicy])
listManagedPoliciesInPermissionSetResponse_attachedManagedPolicies :: (Maybe [AttachedManagedPolicy]
 -> f (Maybe [AttachedManagedPolicy]))
-> ListManagedPoliciesInPermissionSetResponse
-> f ListManagedPoliciesInPermissionSetResponse
listManagedPoliciesInPermissionSetResponse_attachedManagedPolicies = (ListManagedPoliciesInPermissionSetResponse
 -> Maybe [AttachedManagedPolicy])
-> (ListManagedPoliciesInPermissionSetResponse
    -> Maybe [AttachedManagedPolicy]
    -> ListManagedPoliciesInPermissionSetResponse)
-> Lens'
     ListManagedPoliciesInPermissionSetResponse
     (Maybe [AttachedManagedPolicy])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListManagedPoliciesInPermissionSetResponse' {Maybe [AttachedManagedPolicy]
attachedManagedPolicies :: Maybe [AttachedManagedPolicy]
$sel:attachedManagedPolicies:ListManagedPoliciesInPermissionSetResponse' :: ListManagedPoliciesInPermissionSetResponse
-> Maybe [AttachedManagedPolicy]
attachedManagedPolicies} -> Maybe [AttachedManagedPolicy]
attachedManagedPolicies) (\s :: ListManagedPoliciesInPermissionSetResponse
s@ListManagedPoliciesInPermissionSetResponse' {} Maybe [AttachedManagedPolicy]
a -> ListManagedPoliciesInPermissionSetResponse
s {$sel:attachedManagedPolicies:ListManagedPoliciesInPermissionSetResponse' :: Maybe [AttachedManagedPolicy]
attachedManagedPolicies = Maybe [AttachedManagedPolicy]
a} :: ListManagedPoliciesInPermissionSetResponse) ((Maybe [AttachedManagedPolicy]
  -> f (Maybe [AttachedManagedPolicy]))
 -> ListManagedPoliciesInPermissionSetResponse
 -> f ListManagedPoliciesInPermissionSetResponse)
-> ((Maybe [AttachedManagedPolicy]
     -> f (Maybe [AttachedManagedPolicy]))
    -> Maybe [AttachedManagedPolicy]
    -> f (Maybe [AttachedManagedPolicy]))
-> (Maybe [AttachedManagedPolicy]
    -> f (Maybe [AttachedManagedPolicy]))
-> ListManagedPoliciesInPermissionSetResponse
-> f ListManagedPoliciesInPermissionSetResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [AttachedManagedPolicy]
  [AttachedManagedPolicy]
  [AttachedManagedPolicy]
  [AttachedManagedPolicy]
-> Iso
     (Maybe [AttachedManagedPolicy])
     (Maybe [AttachedManagedPolicy])
     (Maybe [AttachedManagedPolicy])
     (Maybe [AttachedManagedPolicy])
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
  [AttachedManagedPolicy]
  [AttachedManagedPolicy]
  [AttachedManagedPolicy]
  [AttachedManagedPolicy]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    ListManagedPoliciesInPermissionSetResponse