{-# 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.Organizations.ListDelegatedAdministrators
-- 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 AWS accounts that are designated as delegated administrators
-- in this organization.
--
-- This operation can be called only from the organization\'s management
-- account or by a member account that is a delegated administrator for an
-- AWS service.
--
-- This operation returns paginated results.
module Amazonka.Organizations.ListDelegatedAdministrators
  ( -- * Creating a Request
    ListDelegatedAdministrators (..),
    newListDelegatedAdministrators,

    -- * Request Lenses
    listDelegatedAdministrators_servicePrincipal,
    listDelegatedAdministrators_nextToken,
    listDelegatedAdministrators_maxResults,

    -- * Destructuring the Response
    ListDelegatedAdministratorsResponse (..),
    newListDelegatedAdministratorsResponse,

    -- * Response Lenses
    listDelegatedAdministratorsResponse_delegatedAdministrators,
    listDelegatedAdministratorsResponse_nextToken,
    listDelegatedAdministratorsResponse_httpStatus,
  )
where

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

-- | /See:/ 'newListDelegatedAdministrators' smart constructor.
data ListDelegatedAdministrators = ListDelegatedAdministrators'
  { -- | Specifies a service principal name. If specified, then the operation
    -- lists the delegated administrators only for the specified service.
    --
    -- If you don\'t specify a service principal, the operation lists all
    -- delegated administrators for all services in your organization.
    ListDelegatedAdministrators -> Maybe Text
servicePrincipal :: Prelude.Maybe Prelude.Text,
    -- | The parameter for receiving additional results if you receive a
    -- @NextToken@ response in a previous request. A @NextToken@ response
    -- indicates that more output is available. Set this parameter to the value
    -- of the previous call\'s @NextToken@ response to indicate where the
    -- output should continue from.
    ListDelegatedAdministrators -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The total number of results that you want included on each page of the
    -- response. If you do not include this parameter, it defaults to a value
    -- that is specific to the operation. If additional items exist beyond the
    -- maximum you specify, the @NextToken@ response element is present and has
    -- a value (is not null). Include that value as the @NextToken@ request
    -- parameter in the next call to the operation to get the next part of the
    -- results. Note that Organizations might return fewer results than the
    -- maximum even when there are more results available. You should check
    -- @NextToken@ after every operation to ensure that you receive all of the
    -- results.
    ListDelegatedAdministrators -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (ListDelegatedAdministrators -> ListDelegatedAdministrators -> Bool
(ListDelegatedAdministrators
 -> ListDelegatedAdministrators -> Bool)
-> (ListDelegatedAdministrators
    -> ListDelegatedAdministrators -> Bool)
-> Eq ListDelegatedAdministrators
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListDelegatedAdministrators -> ListDelegatedAdministrators -> Bool
$c/= :: ListDelegatedAdministrators -> ListDelegatedAdministrators -> Bool
== :: ListDelegatedAdministrators -> ListDelegatedAdministrators -> Bool
$c== :: ListDelegatedAdministrators -> ListDelegatedAdministrators -> Bool
Prelude.Eq, ReadPrec [ListDelegatedAdministrators]
ReadPrec ListDelegatedAdministrators
Int -> ReadS ListDelegatedAdministrators
ReadS [ListDelegatedAdministrators]
(Int -> ReadS ListDelegatedAdministrators)
-> ReadS [ListDelegatedAdministrators]
-> ReadPrec ListDelegatedAdministrators
-> ReadPrec [ListDelegatedAdministrators]
-> Read ListDelegatedAdministrators
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListDelegatedAdministrators]
$creadListPrec :: ReadPrec [ListDelegatedAdministrators]
readPrec :: ReadPrec ListDelegatedAdministrators
$creadPrec :: ReadPrec ListDelegatedAdministrators
readList :: ReadS [ListDelegatedAdministrators]
$creadList :: ReadS [ListDelegatedAdministrators]
readsPrec :: Int -> ReadS ListDelegatedAdministrators
$creadsPrec :: Int -> ReadS ListDelegatedAdministrators
Prelude.Read, Int -> ListDelegatedAdministrators -> ShowS
[ListDelegatedAdministrators] -> ShowS
ListDelegatedAdministrators -> String
(Int -> ListDelegatedAdministrators -> ShowS)
-> (ListDelegatedAdministrators -> String)
-> ([ListDelegatedAdministrators] -> ShowS)
-> Show ListDelegatedAdministrators
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListDelegatedAdministrators] -> ShowS
$cshowList :: [ListDelegatedAdministrators] -> ShowS
show :: ListDelegatedAdministrators -> String
$cshow :: ListDelegatedAdministrators -> String
showsPrec :: Int -> ListDelegatedAdministrators -> ShowS
$cshowsPrec :: Int -> ListDelegatedAdministrators -> ShowS
Prelude.Show, (forall x.
 ListDelegatedAdministrators -> Rep ListDelegatedAdministrators x)
-> (forall x.
    Rep ListDelegatedAdministrators x -> ListDelegatedAdministrators)
-> Generic ListDelegatedAdministrators
forall x.
Rep ListDelegatedAdministrators x -> ListDelegatedAdministrators
forall x.
ListDelegatedAdministrators -> Rep ListDelegatedAdministrators x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListDelegatedAdministrators x -> ListDelegatedAdministrators
$cfrom :: forall x.
ListDelegatedAdministrators -> Rep ListDelegatedAdministrators x
Prelude.Generic)

-- |
-- Create a value of 'ListDelegatedAdministrators' 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:
--
-- 'servicePrincipal', 'listDelegatedAdministrators_servicePrincipal' - Specifies a service principal name. If specified, then the operation
-- lists the delegated administrators only for the specified service.
--
-- If you don\'t specify a service principal, the operation lists all
-- delegated administrators for all services in your organization.
--
-- 'nextToken', 'listDelegatedAdministrators_nextToken' - The parameter for receiving additional results if you receive a
-- @NextToken@ response in a previous request. A @NextToken@ response
-- indicates that more output is available. Set this parameter to the value
-- of the previous call\'s @NextToken@ response to indicate where the
-- output should continue from.
--
-- 'maxResults', 'listDelegatedAdministrators_maxResults' - The total number of results that you want included on each page of the
-- response. If you do not include this parameter, it defaults to a value
-- that is specific to the operation. If additional items exist beyond the
-- maximum you specify, the @NextToken@ response element is present and has
-- a value (is not null). Include that value as the @NextToken@ request
-- parameter in the next call to the operation to get the next part of the
-- results. Note that Organizations might return fewer results than the
-- maximum even when there are more results available. You should check
-- @NextToken@ after every operation to ensure that you receive all of the
-- results.
newListDelegatedAdministrators ::
  ListDelegatedAdministrators
newListDelegatedAdministrators :: ListDelegatedAdministrators
newListDelegatedAdministrators =
  ListDelegatedAdministrators' :: Maybe Text
-> Maybe Text -> Maybe Natural -> ListDelegatedAdministrators
ListDelegatedAdministrators'
    { $sel:servicePrincipal:ListDelegatedAdministrators' :: Maybe Text
servicePrincipal =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListDelegatedAdministrators' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListDelegatedAdministrators' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies a service principal name. If specified, then the operation
-- lists the delegated administrators only for the specified service.
--
-- If you don\'t specify a service principal, the operation lists all
-- delegated administrators for all services in your organization.
listDelegatedAdministrators_servicePrincipal :: Lens.Lens' ListDelegatedAdministrators (Prelude.Maybe Prelude.Text)
listDelegatedAdministrators_servicePrincipal :: (Maybe Text -> f (Maybe Text))
-> ListDelegatedAdministrators -> f ListDelegatedAdministrators
listDelegatedAdministrators_servicePrincipal = (ListDelegatedAdministrators -> Maybe Text)
-> (ListDelegatedAdministrators
    -> Maybe Text -> ListDelegatedAdministrators)
-> Lens
     ListDelegatedAdministrators
     ListDelegatedAdministrators
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDelegatedAdministrators' {Maybe Text
servicePrincipal :: Maybe Text
$sel:servicePrincipal:ListDelegatedAdministrators' :: ListDelegatedAdministrators -> Maybe Text
servicePrincipal} -> Maybe Text
servicePrincipal) (\s :: ListDelegatedAdministrators
s@ListDelegatedAdministrators' {} Maybe Text
a -> ListDelegatedAdministrators
s {$sel:servicePrincipal:ListDelegatedAdministrators' :: Maybe Text
servicePrincipal = Maybe Text
a} :: ListDelegatedAdministrators)

-- | The parameter for receiving additional results if you receive a
-- @NextToken@ response in a previous request. A @NextToken@ response
-- indicates that more output is available. Set this parameter to the value
-- of the previous call\'s @NextToken@ response to indicate where the
-- output should continue from.
listDelegatedAdministrators_nextToken :: Lens.Lens' ListDelegatedAdministrators (Prelude.Maybe Prelude.Text)
listDelegatedAdministrators_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListDelegatedAdministrators -> f ListDelegatedAdministrators
listDelegatedAdministrators_nextToken = (ListDelegatedAdministrators -> Maybe Text)
-> (ListDelegatedAdministrators
    -> Maybe Text -> ListDelegatedAdministrators)
-> Lens
     ListDelegatedAdministrators
     ListDelegatedAdministrators
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDelegatedAdministrators' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListDelegatedAdministrators' :: ListDelegatedAdministrators -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListDelegatedAdministrators
s@ListDelegatedAdministrators' {} Maybe Text
a -> ListDelegatedAdministrators
s {$sel:nextToken:ListDelegatedAdministrators' :: Maybe Text
nextToken = Maybe Text
a} :: ListDelegatedAdministrators)

-- | The total number of results that you want included on each page of the
-- response. If you do not include this parameter, it defaults to a value
-- that is specific to the operation. If additional items exist beyond the
-- maximum you specify, the @NextToken@ response element is present and has
-- a value (is not null). Include that value as the @NextToken@ request
-- parameter in the next call to the operation to get the next part of the
-- results. Note that Organizations might return fewer results than the
-- maximum even when there are more results available. You should check
-- @NextToken@ after every operation to ensure that you receive all of the
-- results.
listDelegatedAdministrators_maxResults :: Lens.Lens' ListDelegatedAdministrators (Prelude.Maybe Prelude.Natural)
listDelegatedAdministrators_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListDelegatedAdministrators -> f ListDelegatedAdministrators
listDelegatedAdministrators_maxResults = (ListDelegatedAdministrators -> Maybe Natural)
-> (ListDelegatedAdministrators
    -> Maybe Natural -> ListDelegatedAdministrators)
-> Lens
     ListDelegatedAdministrators
     ListDelegatedAdministrators
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDelegatedAdministrators' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListDelegatedAdministrators' :: ListDelegatedAdministrators -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListDelegatedAdministrators
s@ListDelegatedAdministrators' {} Maybe Natural
a -> ListDelegatedAdministrators
s {$sel:maxResults:ListDelegatedAdministrators' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListDelegatedAdministrators)

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

instance Prelude.NFData ListDelegatedAdministrators

instance Core.ToHeaders ListDelegatedAdministrators where
  toHeaders :: ListDelegatedAdministrators -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListDelegatedAdministrators -> 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
"AWSOrganizationsV20161128.ListDelegatedAdministrators" ::
                          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 ListDelegatedAdministrators where
  toJSON :: ListDelegatedAdministrators -> Value
toJSON ListDelegatedAdministrators' {Maybe Natural
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
servicePrincipal :: Maybe Text
$sel:maxResults:ListDelegatedAdministrators' :: ListDelegatedAdministrators -> Maybe Natural
$sel:nextToken:ListDelegatedAdministrators' :: ListDelegatedAdministrators -> Maybe Text
$sel:servicePrincipal:ListDelegatedAdministrators' :: ListDelegatedAdministrators -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ServicePrincipal" 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
servicePrincipal,
            (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
          ]
      )

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

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

-- | /See:/ 'newListDelegatedAdministratorsResponse' smart constructor.
data ListDelegatedAdministratorsResponse = ListDelegatedAdministratorsResponse'
  { -- | The list of delegated administrators in your organization.
    ListDelegatedAdministratorsResponse
-> Maybe [DelegatedAdministrator]
delegatedAdministrators :: Prelude.Maybe [DelegatedAdministrator],
    -- | If present, indicates that more output is available than is included in
    -- the current response. Use this value in the @NextToken@ request
    -- parameter in a subsequent call to the operation to get the next part of
    -- the output. You should repeat this until the @NextToken@ response
    -- element comes back as @null@.
    ListDelegatedAdministratorsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListDelegatedAdministratorsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListDelegatedAdministratorsResponse
-> ListDelegatedAdministratorsResponse -> Bool
(ListDelegatedAdministratorsResponse
 -> ListDelegatedAdministratorsResponse -> Bool)
-> (ListDelegatedAdministratorsResponse
    -> ListDelegatedAdministratorsResponse -> Bool)
-> Eq ListDelegatedAdministratorsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListDelegatedAdministratorsResponse
-> ListDelegatedAdministratorsResponse -> Bool
$c/= :: ListDelegatedAdministratorsResponse
-> ListDelegatedAdministratorsResponse -> Bool
== :: ListDelegatedAdministratorsResponse
-> ListDelegatedAdministratorsResponse -> Bool
$c== :: ListDelegatedAdministratorsResponse
-> ListDelegatedAdministratorsResponse -> Bool
Prelude.Eq, Int -> ListDelegatedAdministratorsResponse -> ShowS
[ListDelegatedAdministratorsResponse] -> ShowS
ListDelegatedAdministratorsResponse -> String
(Int -> ListDelegatedAdministratorsResponse -> ShowS)
-> (ListDelegatedAdministratorsResponse -> String)
-> ([ListDelegatedAdministratorsResponse] -> ShowS)
-> Show ListDelegatedAdministratorsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListDelegatedAdministratorsResponse] -> ShowS
$cshowList :: [ListDelegatedAdministratorsResponse] -> ShowS
show :: ListDelegatedAdministratorsResponse -> String
$cshow :: ListDelegatedAdministratorsResponse -> String
showsPrec :: Int -> ListDelegatedAdministratorsResponse -> ShowS
$cshowsPrec :: Int -> ListDelegatedAdministratorsResponse -> ShowS
Prelude.Show, (forall x.
 ListDelegatedAdministratorsResponse
 -> Rep ListDelegatedAdministratorsResponse x)
-> (forall x.
    Rep ListDelegatedAdministratorsResponse x
    -> ListDelegatedAdministratorsResponse)
-> Generic ListDelegatedAdministratorsResponse
forall x.
Rep ListDelegatedAdministratorsResponse x
-> ListDelegatedAdministratorsResponse
forall x.
ListDelegatedAdministratorsResponse
-> Rep ListDelegatedAdministratorsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListDelegatedAdministratorsResponse x
-> ListDelegatedAdministratorsResponse
$cfrom :: forall x.
ListDelegatedAdministratorsResponse
-> Rep ListDelegatedAdministratorsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListDelegatedAdministratorsResponse' 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:
--
-- 'delegatedAdministrators', 'listDelegatedAdministratorsResponse_delegatedAdministrators' - The list of delegated administrators in your organization.
--
-- 'nextToken', 'listDelegatedAdministratorsResponse_nextToken' - If present, indicates that more output is available than is included in
-- the current response. Use this value in the @NextToken@ request
-- parameter in a subsequent call to the operation to get the next part of
-- the output. You should repeat this until the @NextToken@ response
-- element comes back as @null@.
--
-- 'httpStatus', 'listDelegatedAdministratorsResponse_httpStatus' - The response's http status code.
newListDelegatedAdministratorsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListDelegatedAdministratorsResponse
newListDelegatedAdministratorsResponse :: Int -> ListDelegatedAdministratorsResponse
newListDelegatedAdministratorsResponse Int
pHttpStatus_ =
  ListDelegatedAdministratorsResponse' :: Maybe [DelegatedAdministrator]
-> Maybe Text -> Int -> ListDelegatedAdministratorsResponse
ListDelegatedAdministratorsResponse'
    { $sel:delegatedAdministrators:ListDelegatedAdministratorsResponse' :: Maybe [DelegatedAdministrator]
delegatedAdministrators =
        Maybe [DelegatedAdministrator]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListDelegatedAdministratorsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListDelegatedAdministratorsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The list of delegated administrators in your organization.
listDelegatedAdministratorsResponse_delegatedAdministrators :: Lens.Lens' ListDelegatedAdministratorsResponse (Prelude.Maybe [DelegatedAdministrator])
listDelegatedAdministratorsResponse_delegatedAdministrators :: (Maybe [DelegatedAdministrator]
 -> f (Maybe [DelegatedAdministrator]))
-> ListDelegatedAdministratorsResponse
-> f ListDelegatedAdministratorsResponse
listDelegatedAdministratorsResponse_delegatedAdministrators = (ListDelegatedAdministratorsResponse
 -> Maybe [DelegatedAdministrator])
-> (ListDelegatedAdministratorsResponse
    -> Maybe [DelegatedAdministrator]
    -> ListDelegatedAdministratorsResponse)
-> Lens'
     ListDelegatedAdministratorsResponse
     (Maybe [DelegatedAdministrator])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDelegatedAdministratorsResponse' {Maybe [DelegatedAdministrator]
delegatedAdministrators :: Maybe [DelegatedAdministrator]
$sel:delegatedAdministrators:ListDelegatedAdministratorsResponse' :: ListDelegatedAdministratorsResponse
-> Maybe [DelegatedAdministrator]
delegatedAdministrators} -> Maybe [DelegatedAdministrator]
delegatedAdministrators) (\s :: ListDelegatedAdministratorsResponse
s@ListDelegatedAdministratorsResponse' {} Maybe [DelegatedAdministrator]
a -> ListDelegatedAdministratorsResponse
s {$sel:delegatedAdministrators:ListDelegatedAdministratorsResponse' :: Maybe [DelegatedAdministrator]
delegatedAdministrators = Maybe [DelegatedAdministrator]
a} :: ListDelegatedAdministratorsResponse) ((Maybe [DelegatedAdministrator]
  -> f (Maybe [DelegatedAdministrator]))
 -> ListDelegatedAdministratorsResponse
 -> f ListDelegatedAdministratorsResponse)
-> ((Maybe [DelegatedAdministrator]
     -> f (Maybe [DelegatedAdministrator]))
    -> Maybe [DelegatedAdministrator]
    -> f (Maybe [DelegatedAdministrator]))
-> (Maybe [DelegatedAdministrator]
    -> f (Maybe [DelegatedAdministrator]))
-> ListDelegatedAdministratorsResponse
-> f ListDelegatedAdministratorsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [DelegatedAdministrator]
  [DelegatedAdministrator]
  [DelegatedAdministrator]
  [DelegatedAdministrator]
-> Iso
     (Maybe [DelegatedAdministrator])
     (Maybe [DelegatedAdministrator])
     (Maybe [DelegatedAdministrator])
     (Maybe [DelegatedAdministrator])
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
  [DelegatedAdministrator]
  [DelegatedAdministrator]
  [DelegatedAdministrator]
  [DelegatedAdministrator]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | If present, indicates that more output is available than is included in
-- the current response. Use this value in the @NextToken@ request
-- parameter in a subsequent call to the operation to get the next part of
-- the output. You should repeat this until the @NextToken@ response
-- element comes back as @null@.
listDelegatedAdministratorsResponse_nextToken :: Lens.Lens' ListDelegatedAdministratorsResponse (Prelude.Maybe Prelude.Text)
listDelegatedAdministratorsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListDelegatedAdministratorsResponse
-> f ListDelegatedAdministratorsResponse
listDelegatedAdministratorsResponse_nextToken = (ListDelegatedAdministratorsResponse -> Maybe Text)
-> (ListDelegatedAdministratorsResponse
    -> Maybe Text -> ListDelegatedAdministratorsResponse)
-> Lens' ListDelegatedAdministratorsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDelegatedAdministratorsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListDelegatedAdministratorsResponse' :: ListDelegatedAdministratorsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListDelegatedAdministratorsResponse
s@ListDelegatedAdministratorsResponse' {} Maybe Text
a -> ListDelegatedAdministratorsResponse
s {$sel:nextToken:ListDelegatedAdministratorsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListDelegatedAdministratorsResponse)

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

instance
  Prelude.NFData
    ListDelegatedAdministratorsResponse