{-# 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.ListAccounts
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Lists all the accounts in the organization. To request only the accounts
-- in a specified root or organizational unit (OU), use the
-- ListAccountsForParent operation instead.
--
-- 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.ListAccounts
  ( -- * Creating a Request
    ListAccounts (..),
    newListAccounts,

    -- * Request Lenses
    listAccounts_nextToken,
    listAccounts_maxResults,

    -- * Destructuring the Response
    ListAccountsResponse (..),
    newListAccountsResponse,

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

-- |
-- Create a value of 'ListAccounts' 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', 'listAccounts_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', 'listAccounts_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.
newListAccounts ::
  ListAccounts
newListAccounts :: ListAccounts
newListAccounts =
  ListAccounts' :: Maybe Text -> Maybe Natural -> ListAccounts
ListAccounts'
    { $sel:nextToken:ListAccounts' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListAccounts' :: 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.
listAccounts_nextToken :: Lens.Lens' ListAccounts (Prelude.Maybe Prelude.Text)
listAccounts_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListAccounts -> f ListAccounts
listAccounts_nextToken = (ListAccounts -> Maybe Text)
-> (ListAccounts -> Maybe Text -> ListAccounts)
-> Lens ListAccounts ListAccounts (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccounts' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAccounts' :: ListAccounts -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAccounts
s@ListAccounts' {} Maybe Text
a -> ListAccounts
s {$sel:nextToken:ListAccounts' :: Maybe Text
nextToken = Maybe Text
a} :: ListAccounts)

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

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

instance Prelude.NFData ListAccounts

instance Core.ToHeaders ListAccounts where
  toHeaders :: ListAccounts -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListAccounts -> 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.ListAccounts" ::
                          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 ListAccounts where
  toJSON :: ListAccounts -> Value
toJSON ListAccounts' {Maybe Natural
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:maxResults:ListAccounts' :: ListAccounts -> Maybe Natural
$sel:nextToken:ListAccounts' :: ListAccounts -> 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 ListAccounts where
  toPath :: ListAccounts -> ByteString
toPath = ByteString -> ListAccounts -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

-- | /See:/ 'newListAccountsResponse' smart constructor.
data ListAccountsResponse = ListAccountsResponse'
  { -- | A list of objects in the organization.
    ListAccountsResponse -> Maybe [Account]
accounts :: Prelude.Maybe [Account],
    -- | 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@.
    ListAccountsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListAccountsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListAccountsResponse -> ListAccountsResponse -> Bool
(ListAccountsResponse -> ListAccountsResponse -> Bool)
-> (ListAccountsResponse -> ListAccountsResponse -> Bool)
-> Eq ListAccountsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAccountsResponse -> ListAccountsResponse -> Bool
$c/= :: ListAccountsResponse -> ListAccountsResponse -> Bool
== :: ListAccountsResponse -> ListAccountsResponse -> Bool
$c== :: ListAccountsResponse -> ListAccountsResponse -> Bool
Prelude.Eq, Int -> ListAccountsResponse -> ShowS
[ListAccountsResponse] -> ShowS
ListAccountsResponse -> String
(Int -> ListAccountsResponse -> ShowS)
-> (ListAccountsResponse -> String)
-> ([ListAccountsResponse] -> ShowS)
-> Show ListAccountsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAccountsResponse] -> ShowS
$cshowList :: [ListAccountsResponse] -> ShowS
show :: ListAccountsResponse -> String
$cshow :: ListAccountsResponse -> String
showsPrec :: Int -> ListAccountsResponse -> ShowS
$cshowsPrec :: Int -> ListAccountsResponse -> ShowS
Prelude.Show, (forall x. ListAccountsResponse -> Rep ListAccountsResponse x)
-> (forall x. Rep ListAccountsResponse x -> ListAccountsResponse)
-> Generic ListAccountsResponse
forall x. Rep ListAccountsResponse x -> ListAccountsResponse
forall x. ListAccountsResponse -> Rep ListAccountsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListAccountsResponse x -> ListAccountsResponse
$cfrom :: forall x. ListAccountsResponse -> Rep ListAccountsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListAccountsResponse' 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:
--
-- 'accounts', 'listAccountsResponse_accounts' - A list of objects in the organization.
--
-- 'nextToken', 'listAccountsResponse_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', 'listAccountsResponse_httpStatus' - The response's http status code.
newListAccountsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListAccountsResponse
newListAccountsResponse :: Int -> ListAccountsResponse
newListAccountsResponse Int
pHttpStatus_ =
  ListAccountsResponse' :: Maybe [Account] -> Maybe Text -> Int -> ListAccountsResponse
ListAccountsResponse'
    { $sel:accounts:ListAccountsResponse' :: Maybe [Account]
accounts = Maybe [Account]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListAccountsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListAccountsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A list of objects in the organization.
listAccountsResponse_accounts :: Lens.Lens' ListAccountsResponse (Prelude.Maybe [Account])
listAccountsResponse_accounts :: (Maybe [Account] -> f (Maybe [Account]))
-> ListAccountsResponse -> f ListAccountsResponse
listAccountsResponse_accounts = (ListAccountsResponse -> Maybe [Account])
-> (ListAccountsResponse
    -> Maybe [Account] -> ListAccountsResponse)
-> Lens' ListAccountsResponse (Maybe [Account])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccountsResponse' {Maybe [Account]
accounts :: Maybe [Account]
$sel:accounts:ListAccountsResponse' :: ListAccountsResponse -> Maybe [Account]
accounts} -> Maybe [Account]
accounts) (\s :: ListAccountsResponse
s@ListAccountsResponse' {} Maybe [Account]
a -> ListAccountsResponse
s {$sel:accounts:ListAccountsResponse' :: Maybe [Account]
accounts = Maybe [Account]
a} :: ListAccountsResponse) ((Maybe [Account] -> f (Maybe [Account]))
 -> ListAccountsResponse -> f ListAccountsResponse)
-> ((Maybe [Account] -> f (Maybe [Account]))
    -> Maybe [Account] -> f (Maybe [Account]))
-> (Maybe [Account] -> f (Maybe [Account]))
-> ListAccountsResponse
-> f ListAccountsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Account] [Account] [Account] [Account]
-> Iso
     (Maybe [Account])
     (Maybe [Account])
     (Maybe [Account])
     (Maybe [Account])
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 [Account] [Account] [Account] [Account]
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@.
listAccountsResponse_nextToken :: Lens.Lens' ListAccountsResponse (Prelude.Maybe Prelude.Text)
listAccountsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListAccountsResponse -> f ListAccountsResponse
listAccountsResponse_nextToken = (ListAccountsResponse -> Maybe Text)
-> (ListAccountsResponse -> Maybe Text -> ListAccountsResponse)
-> Lens' ListAccountsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccountsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAccountsResponse' :: ListAccountsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAccountsResponse
s@ListAccountsResponse' {} Maybe Text
a -> ListAccountsResponse
s {$sel:nextToken:ListAccountsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListAccountsResponse)

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

instance Prelude.NFData ListAccountsResponse