{-# 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.ListAWSServiceAccessForOrganization
-- 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)
--
-- Returns a list of the AWS services that you enabled to integrate with
-- your organization. After a service on this list creates the resources
-- that it requires for the integration, it can perform operations on your
-- organization and its accounts.
--
-- For more information about integrating other services with AWS
-- Organizations, including the list of services that currently work with
-- Organizations, see
-- <http://docs.aws.amazon.com/organizations/latest/userguide/orgs_integrate_services.html Integrating AWS Organizations with Other AWS Services>
-- in the /AWS Organizations User Guide./
--
-- 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.ListAWSServiceAccessForOrganization
  ( -- * Creating a Request
    ListAWSServiceAccessForOrganization (..),
    newListAWSServiceAccessForOrganization,

    -- * Request Lenses
    listAWSServiceAccessForOrganization_nextToken,
    listAWSServiceAccessForOrganization_maxResults,

    -- * Destructuring the Response
    ListAWSServiceAccessForOrganizationResponse (..),
    newListAWSServiceAccessForOrganizationResponse,

    -- * Response Lenses
    listAWSServiceAccessForOrganizationResponse_nextToken,
    listAWSServiceAccessForOrganizationResponse_enabledServicePrincipals,
    listAWSServiceAccessForOrganizationResponse_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:/ 'newListAWSServiceAccessForOrganization' smart constructor.
data ListAWSServiceAccessForOrganization = ListAWSServiceAccessForOrganization'
  { -- | 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.
    ListAWSServiceAccessForOrganization -> 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.
    ListAWSServiceAccessForOrganization -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (ListAWSServiceAccessForOrganization
-> ListAWSServiceAccessForOrganization -> Bool
(ListAWSServiceAccessForOrganization
 -> ListAWSServiceAccessForOrganization -> Bool)
-> (ListAWSServiceAccessForOrganization
    -> ListAWSServiceAccessForOrganization -> Bool)
-> Eq ListAWSServiceAccessForOrganization
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAWSServiceAccessForOrganization
-> ListAWSServiceAccessForOrganization -> Bool
$c/= :: ListAWSServiceAccessForOrganization
-> ListAWSServiceAccessForOrganization -> Bool
== :: ListAWSServiceAccessForOrganization
-> ListAWSServiceAccessForOrganization -> Bool
$c== :: ListAWSServiceAccessForOrganization
-> ListAWSServiceAccessForOrganization -> Bool
Prelude.Eq, ReadPrec [ListAWSServiceAccessForOrganization]
ReadPrec ListAWSServiceAccessForOrganization
Int -> ReadS ListAWSServiceAccessForOrganization
ReadS [ListAWSServiceAccessForOrganization]
(Int -> ReadS ListAWSServiceAccessForOrganization)
-> ReadS [ListAWSServiceAccessForOrganization]
-> ReadPrec ListAWSServiceAccessForOrganization
-> ReadPrec [ListAWSServiceAccessForOrganization]
-> Read ListAWSServiceAccessForOrganization
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAWSServiceAccessForOrganization]
$creadListPrec :: ReadPrec [ListAWSServiceAccessForOrganization]
readPrec :: ReadPrec ListAWSServiceAccessForOrganization
$creadPrec :: ReadPrec ListAWSServiceAccessForOrganization
readList :: ReadS [ListAWSServiceAccessForOrganization]
$creadList :: ReadS [ListAWSServiceAccessForOrganization]
readsPrec :: Int -> ReadS ListAWSServiceAccessForOrganization
$creadsPrec :: Int -> ReadS ListAWSServiceAccessForOrganization
Prelude.Read, Int -> ListAWSServiceAccessForOrganization -> ShowS
[ListAWSServiceAccessForOrganization] -> ShowS
ListAWSServiceAccessForOrganization -> String
(Int -> ListAWSServiceAccessForOrganization -> ShowS)
-> (ListAWSServiceAccessForOrganization -> String)
-> ([ListAWSServiceAccessForOrganization] -> ShowS)
-> Show ListAWSServiceAccessForOrganization
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAWSServiceAccessForOrganization] -> ShowS
$cshowList :: [ListAWSServiceAccessForOrganization] -> ShowS
show :: ListAWSServiceAccessForOrganization -> String
$cshow :: ListAWSServiceAccessForOrganization -> String
showsPrec :: Int -> ListAWSServiceAccessForOrganization -> ShowS
$cshowsPrec :: Int -> ListAWSServiceAccessForOrganization -> ShowS
Prelude.Show, (forall x.
 ListAWSServiceAccessForOrganization
 -> Rep ListAWSServiceAccessForOrganization x)
-> (forall x.
    Rep ListAWSServiceAccessForOrganization x
    -> ListAWSServiceAccessForOrganization)
-> Generic ListAWSServiceAccessForOrganization
forall x.
Rep ListAWSServiceAccessForOrganization x
-> ListAWSServiceAccessForOrganization
forall x.
ListAWSServiceAccessForOrganization
-> Rep ListAWSServiceAccessForOrganization x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListAWSServiceAccessForOrganization x
-> ListAWSServiceAccessForOrganization
$cfrom :: forall x.
ListAWSServiceAccessForOrganization
-> Rep ListAWSServiceAccessForOrganization x
Prelude.Generic)

-- |
-- Create a value of 'ListAWSServiceAccessForOrganization' 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', 'listAWSServiceAccessForOrganization_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', 'listAWSServiceAccessForOrganization_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.
newListAWSServiceAccessForOrganization ::
  ListAWSServiceAccessForOrganization
newListAWSServiceAccessForOrganization :: ListAWSServiceAccessForOrganization
newListAWSServiceAccessForOrganization =
  ListAWSServiceAccessForOrganization' :: Maybe Text -> Maybe Natural -> ListAWSServiceAccessForOrganization
ListAWSServiceAccessForOrganization'
    { $sel:nextToken:ListAWSServiceAccessForOrganization' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListAWSServiceAccessForOrganization' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | 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.
listAWSServiceAccessForOrganization_nextToken :: Lens.Lens' ListAWSServiceAccessForOrganization (Prelude.Maybe Prelude.Text)
listAWSServiceAccessForOrganization_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListAWSServiceAccessForOrganization
-> f ListAWSServiceAccessForOrganization
listAWSServiceAccessForOrganization_nextToken = (ListAWSServiceAccessForOrganization -> Maybe Text)
-> (ListAWSServiceAccessForOrganization
    -> Maybe Text -> ListAWSServiceAccessForOrganization)
-> Lens
     ListAWSServiceAccessForOrganization
     ListAWSServiceAccessForOrganization
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAWSServiceAccessForOrganization' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAWSServiceAccessForOrganization' :: ListAWSServiceAccessForOrganization -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAWSServiceAccessForOrganization
s@ListAWSServiceAccessForOrganization' {} Maybe Text
a -> ListAWSServiceAccessForOrganization
s {$sel:nextToken:ListAWSServiceAccessForOrganization' :: Maybe Text
nextToken = Maybe Text
a} :: ListAWSServiceAccessForOrganization)

-- | 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.
listAWSServiceAccessForOrganization_maxResults :: Lens.Lens' ListAWSServiceAccessForOrganization (Prelude.Maybe Prelude.Natural)
listAWSServiceAccessForOrganization_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListAWSServiceAccessForOrganization
-> f ListAWSServiceAccessForOrganization
listAWSServiceAccessForOrganization_maxResults = (ListAWSServiceAccessForOrganization -> Maybe Natural)
-> (ListAWSServiceAccessForOrganization
    -> Maybe Natural -> ListAWSServiceAccessForOrganization)
-> Lens
     ListAWSServiceAccessForOrganization
     ListAWSServiceAccessForOrganization
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAWSServiceAccessForOrganization' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListAWSServiceAccessForOrganization' :: ListAWSServiceAccessForOrganization -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListAWSServiceAccessForOrganization
s@ListAWSServiceAccessForOrganization' {} Maybe Natural
a -> ListAWSServiceAccessForOrganization
s {$sel:maxResults:ListAWSServiceAccessForOrganization' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListAWSServiceAccessForOrganization)

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

instance
  Prelude.NFData
    ListAWSServiceAccessForOrganization

instance
  Core.ToHeaders
    ListAWSServiceAccessForOrganization
  where
  toHeaders :: ListAWSServiceAccessForOrganization -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> ListAWSServiceAccessForOrganization -> 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.ListAWSServiceAccessForOrganization" ::
                          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
    ListAWSServiceAccessForOrganization
  where
  toJSON :: ListAWSServiceAccessForOrganization -> Value
toJSON ListAWSServiceAccessForOrganization' {Maybe Natural
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:maxResults:ListAWSServiceAccessForOrganization' :: ListAWSServiceAccessForOrganization -> Maybe Natural
$sel:nextToken:ListAWSServiceAccessForOrganization' :: ListAWSServiceAccessForOrganization -> 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
          ]
      )

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

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

-- | /See:/ 'newListAWSServiceAccessForOrganizationResponse' smart constructor.
data ListAWSServiceAccessForOrganizationResponse = ListAWSServiceAccessForOrganizationResponse'
  { -- | 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@.
    ListAWSServiceAccessForOrganizationResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | A list of the service principals for the services that are enabled to
    -- integrate with your organization. Each principal is a structure that
    -- includes the name and the date that it was enabled for integration with
    -- AWS Organizations.
    ListAWSServiceAccessForOrganizationResponse
-> Maybe [EnabledServicePrincipal]
enabledServicePrincipals :: Prelude.Maybe [EnabledServicePrincipal],
    -- | The response's http status code.
    ListAWSServiceAccessForOrganizationResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListAWSServiceAccessForOrganizationResponse
-> ListAWSServiceAccessForOrganizationResponse -> Bool
(ListAWSServiceAccessForOrganizationResponse
 -> ListAWSServiceAccessForOrganizationResponse -> Bool)
-> (ListAWSServiceAccessForOrganizationResponse
    -> ListAWSServiceAccessForOrganizationResponse -> Bool)
-> Eq ListAWSServiceAccessForOrganizationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAWSServiceAccessForOrganizationResponse
-> ListAWSServiceAccessForOrganizationResponse -> Bool
$c/= :: ListAWSServiceAccessForOrganizationResponse
-> ListAWSServiceAccessForOrganizationResponse -> Bool
== :: ListAWSServiceAccessForOrganizationResponse
-> ListAWSServiceAccessForOrganizationResponse -> Bool
$c== :: ListAWSServiceAccessForOrganizationResponse
-> ListAWSServiceAccessForOrganizationResponse -> Bool
Prelude.Eq, ReadPrec [ListAWSServiceAccessForOrganizationResponse]
ReadPrec ListAWSServiceAccessForOrganizationResponse
Int -> ReadS ListAWSServiceAccessForOrganizationResponse
ReadS [ListAWSServiceAccessForOrganizationResponse]
(Int -> ReadS ListAWSServiceAccessForOrganizationResponse)
-> ReadS [ListAWSServiceAccessForOrganizationResponse]
-> ReadPrec ListAWSServiceAccessForOrganizationResponse
-> ReadPrec [ListAWSServiceAccessForOrganizationResponse]
-> Read ListAWSServiceAccessForOrganizationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAWSServiceAccessForOrganizationResponse]
$creadListPrec :: ReadPrec [ListAWSServiceAccessForOrganizationResponse]
readPrec :: ReadPrec ListAWSServiceAccessForOrganizationResponse
$creadPrec :: ReadPrec ListAWSServiceAccessForOrganizationResponse
readList :: ReadS [ListAWSServiceAccessForOrganizationResponse]
$creadList :: ReadS [ListAWSServiceAccessForOrganizationResponse]
readsPrec :: Int -> ReadS ListAWSServiceAccessForOrganizationResponse
$creadsPrec :: Int -> ReadS ListAWSServiceAccessForOrganizationResponse
Prelude.Read, Int -> ListAWSServiceAccessForOrganizationResponse -> ShowS
[ListAWSServiceAccessForOrganizationResponse] -> ShowS
ListAWSServiceAccessForOrganizationResponse -> String
(Int -> ListAWSServiceAccessForOrganizationResponse -> ShowS)
-> (ListAWSServiceAccessForOrganizationResponse -> String)
-> ([ListAWSServiceAccessForOrganizationResponse] -> ShowS)
-> Show ListAWSServiceAccessForOrganizationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAWSServiceAccessForOrganizationResponse] -> ShowS
$cshowList :: [ListAWSServiceAccessForOrganizationResponse] -> ShowS
show :: ListAWSServiceAccessForOrganizationResponse -> String
$cshow :: ListAWSServiceAccessForOrganizationResponse -> String
showsPrec :: Int -> ListAWSServiceAccessForOrganizationResponse -> ShowS
$cshowsPrec :: Int -> ListAWSServiceAccessForOrganizationResponse -> ShowS
Prelude.Show, (forall x.
 ListAWSServiceAccessForOrganizationResponse
 -> Rep ListAWSServiceAccessForOrganizationResponse x)
-> (forall x.
    Rep ListAWSServiceAccessForOrganizationResponse x
    -> ListAWSServiceAccessForOrganizationResponse)
-> Generic ListAWSServiceAccessForOrganizationResponse
forall x.
Rep ListAWSServiceAccessForOrganizationResponse x
-> ListAWSServiceAccessForOrganizationResponse
forall x.
ListAWSServiceAccessForOrganizationResponse
-> Rep ListAWSServiceAccessForOrganizationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListAWSServiceAccessForOrganizationResponse x
-> ListAWSServiceAccessForOrganizationResponse
$cfrom :: forall x.
ListAWSServiceAccessForOrganizationResponse
-> Rep ListAWSServiceAccessForOrganizationResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListAWSServiceAccessForOrganizationResponse' 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', 'listAWSServiceAccessForOrganizationResponse_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@.
--
-- 'enabledServicePrincipals', 'listAWSServiceAccessForOrganizationResponse_enabledServicePrincipals' - A list of the service principals for the services that are enabled to
-- integrate with your organization. Each principal is a structure that
-- includes the name and the date that it was enabled for integration with
-- AWS Organizations.
--
-- 'httpStatus', 'listAWSServiceAccessForOrganizationResponse_httpStatus' - The response's http status code.
newListAWSServiceAccessForOrganizationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListAWSServiceAccessForOrganizationResponse
newListAWSServiceAccessForOrganizationResponse :: Int -> ListAWSServiceAccessForOrganizationResponse
newListAWSServiceAccessForOrganizationResponse
  Int
pHttpStatus_ =
    ListAWSServiceAccessForOrganizationResponse' :: Maybe Text
-> Maybe [EnabledServicePrincipal]
-> Int
-> ListAWSServiceAccessForOrganizationResponse
ListAWSServiceAccessForOrganizationResponse'
      { $sel:nextToken:ListAWSServiceAccessForOrganizationResponse' :: Maybe Text
nextToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:enabledServicePrincipals:ListAWSServiceAccessForOrganizationResponse' :: Maybe [EnabledServicePrincipal]
enabledServicePrincipals =
          Maybe [EnabledServicePrincipal]
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:ListAWSServiceAccessForOrganizationResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | 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@.
listAWSServiceAccessForOrganizationResponse_nextToken :: Lens.Lens' ListAWSServiceAccessForOrganizationResponse (Prelude.Maybe Prelude.Text)
listAWSServiceAccessForOrganizationResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListAWSServiceAccessForOrganizationResponse
-> f ListAWSServiceAccessForOrganizationResponse
listAWSServiceAccessForOrganizationResponse_nextToken = (ListAWSServiceAccessForOrganizationResponse -> Maybe Text)
-> (ListAWSServiceAccessForOrganizationResponse
    -> Maybe Text -> ListAWSServiceAccessForOrganizationResponse)
-> Lens' ListAWSServiceAccessForOrganizationResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAWSServiceAccessForOrganizationResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAWSServiceAccessForOrganizationResponse' :: ListAWSServiceAccessForOrganizationResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAWSServiceAccessForOrganizationResponse
s@ListAWSServiceAccessForOrganizationResponse' {} Maybe Text
a -> ListAWSServiceAccessForOrganizationResponse
s {$sel:nextToken:ListAWSServiceAccessForOrganizationResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListAWSServiceAccessForOrganizationResponse)

-- | A list of the service principals for the services that are enabled to
-- integrate with your organization. Each principal is a structure that
-- includes the name and the date that it was enabled for integration with
-- AWS Organizations.
listAWSServiceAccessForOrganizationResponse_enabledServicePrincipals :: Lens.Lens' ListAWSServiceAccessForOrganizationResponse (Prelude.Maybe [EnabledServicePrincipal])
listAWSServiceAccessForOrganizationResponse_enabledServicePrincipals :: (Maybe [EnabledServicePrincipal]
 -> f (Maybe [EnabledServicePrincipal]))
-> ListAWSServiceAccessForOrganizationResponse
-> f ListAWSServiceAccessForOrganizationResponse
listAWSServiceAccessForOrganizationResponse_enabledServicePrincipals = (ListAWSServiceAccessForOrganizationResponse
 -> Maybe [EnabledServicePrincipal])
-> (ListAWSServiceAccessForOrganizationResponse
    -> Maybe [EnabledServicePrincipal]
    -> ListAWSServiceAccessForOrganizationResponse)
-> Lens'
     ListAWSServiceAccessForOrganizationResponse
     (Maybe [EnabledServicePrincipal])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAWSServiceAccessForOrganizationResponse' {Maybe [EnabledServicePrincipal]
enabledServicePrincipals :: Maybe [EnabledServicePrincipal]
$sel:enabledServicePrincipals:ListAWSServiceAccessForOrganizationResponse' :: ListAWSServiceAccessForOrganizationResponse
-> Maybe [EnabledServicePrincipal]
enabledServicePrincipals} -> Maybe [EnabledServicePrincipal]
enabledServicePrincipals) (\s :: ListAWSServiceAccessForOrganizationResponse
s@ListAWSServiceAccessForOrganizationResponse' {} Maybe [EnabledServicePrincipal]
a -> ListAWSServiceAccessForOrganizationResponse
s {$sel:enabledServicePrincipals:ListAWSServiceAccessForOrganizationResponse' :: Maybe [EnabledServicePrincipal]
enabledServicePrincipals = Maybe [EnabledServicePrincipal]
a} :: ListAWSServiceAccessForOrganizationResponse) ((Maybe [EnabledServicePrincipal]
  -> f (Maybe [EnabledServicePrincipal]))
 -> ListAWSServiceAccessForOrganizationResponse
 -> f ListAWSServiceAccessForOrganizationResponse)
-> ((Maybe [EnabledServicePrincipal]
     -> f (Maybe [EnabledServicePrincipal]))
    -> Maybe [EnabledServicePrincipal]
    -> f (Maybe [EnabledServicePrincipal]))
-> (Maybe [EnabledServicePrincipal]
    -> f (Maybe [EnabledServicePrincipal]))
-> ListAWSServiceAccessForOrganizationResponse
-> f ListAWSServiceAccessForOrganizationResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [EnabledServicePrincipal]
  [EnabledServicePrincipal]
  [EnabledServicePrincipal]
  [EnabledServicePrincipal]
-> Iso
     (Maybe [EnabledServicePrincipal])
     (Maybe [EnabledServicePrincipal])
     (Maybe [EnabledServicePrincipal])
     (Maybe [EnabledServicePrincipal])
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
  [EnabledServicePrincipal]
  [EnabledServicePrincipal]
  [EnabledServicePrincipal]
  [EnabledServicePrincipal]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    ListAWSServiceAccessForOrganizationResponse