{-# 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.ListCreateAccountStatus
-- 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 account creation requests that match the specified status that
-- is currently being tracked for the organization.
--
-- Always check the @NextToken@ response parameter for a @null@ value when
-- calling a @List*@ operation. These operations can occasionally return an
-- empty set of results even when there are more results available. The
-- @NextToken@ response parameter value is @null@ /only/ when there are no
-- more results to display.
--
-- 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.ListCreateAccountStatus
  ( -- * Creating a Request
    ListCreateAccountStatus (..),
    newListCreateAccountStatus,

    -- * Request Lenses
    listCreateAccountStatus_states,
    listCreateAccountStatus_nextToken,
    listCreateAccountStatus_maxResults,

    -- * Destructuring the Response
    ListCreateAccountStatusResponse (..),
    newListCreateAccountStatusResponse,

    -- * Response Lenses
    listCreateAccountStatusResponse_createAccountStatuses,
    listCreateAccountStatusResponse_nextToken,
    listCreateAccountStatusResponse_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:/ 'newListCreateAccountStatus' smart constructor.
data ListCreateAccountStatus = ListCreateAccountStatus'
  { -- | A list of one or more states that you want included in the response. If
    -- this parameter isn\'t present, all requests are included in the
    -- response.
    ListCreateAccountStatus -> Maybe [CreateAccountState]
states :: Prelude.Maybe [CreateAccountState],
    -- | 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.
    ListCreateAccountStatus -> 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.
    ListCreateAccountStatus -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (ListCreateAccountStatus -> ListCreateAccountStatus -> Bool
(ListCreateAccountStatus -> ListCreateAccountStatus -> Bool)
-> (ListCreateAccountStatus -> ListCreateAccountStatus -> Bool)
-> Eq ListCreateAccountStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListCreateAccountStatus -> ListCreateAccountStatus -> Bool
$c/= :: ListCreateAccountStatus -> ListCreateAccountStatus -> Bool
== :: ListCreateAccountStatus -> ListCreateAccountStatus -> Bool
$c== :: ListCreateAccountStatus -> ListCreateAccountStatus -> Bool
Prelude.Eq, ReadPrec [ListCreateAccountStatus]
ReadPrec ListCreateAccountStatus
Int -> ReadS ListCreateAccountStatus
ReadS [ListCreateAccountStatus]
(Int -> ReadS ListCreateAccountStatus)
-> ReadS [ListCreateAccountStatus]
-> ReadPrec ListCreateAccountStatus
-> ReadPrec [ListCreateAccountStatus]
-> Read ListCreateAccountStatus
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListCreateAccountStatus]
$creadListPrec :: ReadPrec [ListCreateAccountStatus]
readPrec :: ReadPrec ListCreateAccountStatus
$creadPrec :: ReadPrec ListCreateAccountStatus
readList :: ReadS [ListCreateAccountStatus]
$creadList :: ReadS [ListCreateAccountStatus]
readsPrec :: Int -> ReadS ListCreateAccountStatus
$creadsPrec :: Int -> ReadS ListCreateAccountStatus
Prelude.Read, Int -> ListCreateAccountStatus -> ShowS
[ListCreateAccountStatus] -> ShowS
ListCreateAccountStatus -> String
(Int -> ListCreateAccountStatus -> ShowS)
-> (ListCreateAccountStatus -> String)
-> ([ListCreateAccountStatus] -> ShowS)
-> Show ListCreateAccountStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListCreateAccountStatus] -> ShowS
$cshowList :: [ListCreateAccountStatus] -> ShowS
show :: ListCreateAccountStatus -> String
$cshow :: ListCreateAccountStatus -> String
showsPrec :: Int -> ListCreateAccountStatus -> ShowS
$cshowsPrec :: Int -> ListCreateAccountStatus -> ShowS
Prelude.Show, (forall x.
 ListCreateAccountStatus -> Rep ListCreateAccountStatus x)
-> (forall x.
    Rep ListCreateAccountStatus x -> ListCreateAccountStatus)
-> Generic ListCreateAccountStatus
forall x. Rep ListCreateAccountStatus x -> ListCreateAccountStatus
forall x. ListCreateAccountStatus -> Rep ListCreateAccountStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListCreateAccountStatus x -> ListCreateAccountStatus
$cfrom :: forall x. ListCreateAccountStatus -> Rep ListCreateAccountStatus x
Prelude.Generic)

-- |
-- Create a value of 'ListCreateAccountStatus' 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:
--
-- 'states', 'listCreateAccountStatus_states' - A list of one or more states that you want included in the response. If
-- this parameter isn\'t present, all requests are included in the
-- response.
--
-- 'nextToken', 'listCreateAccountStatus_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', 'listCreateAccountStatus_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.
newListCreateAccountStatus ::
  ListCreateAccountStatus
newListCreateAccountStatus :: ListCreateAccountStatus
newListCreateAccountStatus =
  ListCreateAccountStatus' :: Maybe [CreateAccountState]
-> Maybe Text -> Maybe Natural -> ListCreateAccountStatus
ListCreateAccountStatus'
    { $sel:states:ListCreateAccountStatus' :: Maybe [CreateAccountState]
states = Maybe [CreateAccountState]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListCreateAccountStatus' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListCreateAccountStatus' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | A list of one or more states that you want included in the response. If
-- this parameter isn\'t present, all requests are included in the
-- response.
listCreateAccountStatus_states :: Lens.Lens' ListCreateAccountStatus (Prelude.Maybe [CreateAccountState])
listCreateAccountStatus_states :: (Maybe [CreateAccountState] -> f (Maybe [CreateAccountState]))
-> ListCreateAccountStatus -> f ListCreateAccountStatus
listCreateAccountStatus_states = (ListCreateAccountStatus -> Maybe [CreateAccountState])
-> (ListCreateAccountStatus
    -> Maybe [CreateAccountState] -> ListCreateAccountStatus)
-> Lens
     ListCreateAccountStatus
     ListCreateAccountStatus
     (Maybe [CreateAccountState])
     (Maybe [CreateAccountState])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCreateAccountStatus' {Maybe [CreateAccountState]
states :: Maybe [CreateAccountState]
$sel:states:ListCreateAccountStatus' :: ListCreateAccountStatus -> Maybe [CreateAccountState]
states} -> Maybe [CreateAccountState]
states) (\s :: ListCreateAccountStatus
s@ListCreateAccountStatus' {} Maybe [CreateAccountState]
a -> ListCreateAccountStatus
s {$sel:states:ListCreateAccountStatus' :: Maybe [CreateAccountState]
states = Maybe [CreateAccountState]
a} :: ListCreateAccountStatus) ((Maybe [CreateAccountState] -> f (Maybe [CreateAccountState]))
 -> ListCreateAccountStatus -> f ListCreateAccountStatus)
-> ((Maybe [CreateAccountState] -> f (Maybe [CreateAccountState]))
    -> Maybe [CreateAccountState] -> f (Maybe [CreateAccountState]))
-> (Maybe [CreateAccountState] -> f (Maybe [CreateAccountState]))
-> ListCreateAccountStatus
-> f ListCreateAccountStatus
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [CreateAccountState]
  [CreateAccountState]
  [CreateAccountState]
  [CreateAccountState]
-> Iso
     (Maybe [CreateAccountState])
     (Maybe [CreateAccountState])
     (Maybe [CreateAccountState])
     (Maybe [CreateAccountState])
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
  [CreateAccountState]
  [CreateAccountState]
  [CreateAccountState]
  [CreateAccountState]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

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

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

instance Prelude.NFData ListCreateAccountStatus

instance Core.ToHeaders ListCreateAccountStatus where
  toHeaders :: ListCreateAccountStatus -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListCreateAccountStatus -> 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.ListCreateAccountStatus" ::
                          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 ListCreateAccountStatus where
  toJSON :: ListCreateAccountStatus -> Value
toJSON ListCreateAccountStatus' {Maybe Natural
Maybe [CreateAccountState]
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
states :: Maybe [CreateAccountState]
$sel:maxResults:ListCreateAccountStatus' :: ListCreateAccountStatus -> Maybe Natural
$sel:nextToken:ListCreateAccountStatus' :: ListCreateAccountStatus -> Maybe Text
$sel:states:ListCreateAccountStatus' :: ListCreateAccountStatus -> Maybe [CreateAccountState]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"States" Text -> [CreateAccountState] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([CreateAccountState] -> Pair)
-> Maybe [CreateAccountState] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [CreateAccountState]
states,
            (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 ListCreateAccountStatus where
  toPath :: ListCreateAccountStatus -> ByteString
toPath = ByteString -> ListCreateAccountStatus -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

-- | /See:/ 'newListCreateAccountStatusResponse' smart constructor.
data ListCreateAccountStatusResponse = ListCreateAccountStatusResponse'
  { -- | A list of objects with details about the requests. Certain elements,
    -- such as the accountId number, are present in the output only after the
    -- account has been successfully created.
    ListCreateAccountStatusResponse -> Maybe [CreateAccountStatus]
createAccountStatuses :: Prelude.Maybe [CreateAccountStatus],
    -- | 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@.
    ListCreateAccountStatusResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListCreateAccountStatusResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListCreateAccountStatusResponse
-> ListCreateAccountStatusResponse -> Bool
(ListCreateAccountStatusResponse
 -> ListCreateAccountStatusResponse -> Bool)
-> (ListCreateAccountStatusResponse
    -> ListCreateAccountStatusResponse -> Bool)
-> Eq ListCreateAccountStatusResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListCreateAccountStatusResponse
-> ListCreateAccountStatusResponse -> Bool
$c/= :: ListCreateAccountStatusResponse
-> ListCreateAccountStatusResponse -> Bool
== :: ListCreateAccountStatusResponse
-> ListCreateAccountStatusResponse -> Bool
$c== :: ListCreateAccountStatusResponse
-> ListCreateAccountStatusResponse -> Bool
Prelude.Eq, Int -> ListCreateAccountStatusResponse -> ShowS
[ListCreateAccountStatusResponse] -> ShowS
ListCreateAccountStatusResponse -> String
(Int -> ListCreateAccountStatusResponse -> ShowS)
-> (ListCreateAccountStatusResponse -> String)
-> ([ListCreateAccountStatusResponse] -> ShowS)
-> Show ListCreateAccountStatusResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListCreateAccountStatusResponse] -> ShowS
$cshowList :: [ListCreateAccountStatusResponse] -> ShowS
show :: ListCreateAccountStatusResponse -> String
$cshow :: ListCreateAccountStatusResponse -> String
showsPrec :: Int -> ListCreateAccountStatusResponse -> ShowS
$cshowsPrec :: Int -> ListCreateAccountStatusResponse -> ShowS
Prelude.Show, (forall x.
 ListCreateAccountStatusResponse
 -> Rep ListCreateAccountStatusResponse x)
-> (forall x.
    Rep ListCreateAccountStatusResponse x
    -> ListCreateAccountStatusResponse)
-> Generic ListCreateAccountStatusResponse
forall x.
Rep ListCreateAccountStatusResponse x
-> ListCreateAccountStatusResponse
forall x.
ListCreateAccountStatusResponse
-> Rep ListCreateAccountStatusResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListCreateAccountStatusResponse x
-> ListCreateAccountStatusResponse
$cfrom :: forall x.
ListCreateAccountStatusResponse
-> Rep ListCreateAccountStatusResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListCreateAccountStatusResponse' 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:
--
-- 'createAccountStatuses', 'listCreateAccountStatusResponse_createAccountStatuses' - A list of objects with details about the requests. Certain elements,
-- such as the accountId number, are present in the output only after the
-- account has been successfully created.
--
-- 'nextToken', 'listCreateAccountStatusResponse_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', 'listCreateAccountStatusResponse_httpStatus' - The response's http status code.
newListCreateAccountStatusResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListCreateAccountStatusResponse
newListCreateAccountStatusResponse :: Int -> ListCreateAccountStatusResponse
newListCreateAccountStatusResponse Int
pHttpStatus_ =
  ListCreateAccountStatusResponse' :: Maybe [CreateAccountStatus]
-> Maybe Text -> Int -> ListCreateAccountStatusResponse
ListCreateAccountStatusResponse'
    { $sel:createAccountStatuses:ListCreateAccountStatusResponse' :: Maybe [CreateAccountStatus]
createAccountStatuses =
        Maybe [CreateAccountStatus]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListCreateAccountStatusResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListCreateAccountStatusResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A list of objects with details about the requests. Certain elements,
-- such as the accountId number, are present in the output only after the
-- account has been successfully created.
listCreateAccountStatusResponse_createAccountStatuses :: Lens.Lens' ListCreateAccountStatusResponse (Prelude.Maybe [CreateAccountStatus])
listCreateAccountStatusResponse_createAccountStatuses :: (Maybe [CreateAccountStatus] -> f (Maybe [CreateAccountStatus]))
-> ListCreateAccountStatusResponse
-> f ListCreateAccountStatusResponse
listCreateAccountStatusResponse_createAccountStatuses = (ListCreateAccountStatusResponse -> Maybe [CreateAccountStatus])
-> (ListCreateAccountStatusResponse
    -> Maybe [CreateAccountStatus] -> ListCreateAccountStatusResponse)
-> Lens'
     ListCreateAccountStatusResponse (Maybe [CreateAccountStatus])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCreateAccountStatusResponse' {Maybe [CreateAccountStatus]
createAccountStatuses :: Maybe [CreateAccountStatus]
$sel:createAccountStatuses:ListCreateAccountStatusResponse' :: ListCreateAccountStatusResponse -> Maybe [CreateAccountStatus]
createAccountStatuses} -> Maybe [CreateAccountStatus]
createAccountStatuses) (\s :: ListCreateAccountStatusResponse
s@ListCreateAccountStatusResponse' {} Maybe [CreateAccountStatus]
a -> ListCreateAccountStatusResponse
s {$sel:createAccountStatuses:ListCreateAccountStatusResponse' :: Maybe [CreateAccountStatus]
createAccountStatuses = Maybe [CreateAccountStatus]
a} :: ListCreateAccountStatusResponse) ((Maybe [CreateAccountStatus] -> f (Maybe [CreateAccountStatus]))
 -> ListCreateAccountStatusResponse
 -> f ListCreateAccountStatusResponse)
-> ((Maybe [CreateAccountStatus]
     -> f (Maybe [CreateAccountStatus]))
    -> Maybe [CreateAccountStatus] -> f (Maybe [CreateAccountStatus]))
-> (Maybe [CreateAccountStatus] -> f (Maybe [CreateAccountStatus]))
-> ListCreateAccountStatusResponse
-> f ListCreateAccountStatusResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [CreateAccountStatus]
  [CreateAccountStatus]
  [CreateAccountStatus]
  [CreateAccountStatus]
-> Iso
     (Maybe [CreateAccountStatus])
     (Maybe [CreateAccountStatus])
     (Maybe [CreateAccountStatus])
     (Maybe [CreateAccountStatus])
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
  [CreateAccountStatus]
  [CreateAccountStatus]
  [CreateAccountStatus]
  [CreateAccountStatus]
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@.
listCreateAccountStatusResponse_nextToken :: Lens.Lens' ListCreateAccountStatusResponse (Prelude.Maybe Prelude.Text)
listCreateAccountStatusResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListCreateAccountStatusResponse
-> f ListCreateAccountStatusResponse
listCreateAccountStatusResponse_nextToken = (ListCreateAccountStatusResponse -> Maybe Text)
-> (ListCreateAccountStatusResponse
    -> Maybe Text -> ListCreateAccountStatusResponse)
-> Lens' ListCreateAccountStatusResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCreateAccountStatusResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListCreateAccountStatusResponse' :: ListCreateAccountStatusResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListCreateAccountStatusResponse
s@ListCreateAccountStatusResponse' {} Maybe Text
a -> ListCreateAccountStatusResponse
s {$sel:nextToken:ListCreateAccountStatusResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListCreateAccountStatusResponse)

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

instance
  Prelude.NFData
    ListCreateAccountStatusResponse