{-# 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.Chime.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 the Amazon Chime accounts under the administrator\'s AWS account.
-- You can filter accounts by account name prefix. To find out which Amazon
-- Chime account a user belongs to, you can filter by the user\'s email
-- address, which returns one account result.
--
-- This operation returns paginated results.
module Amazonka.Chime.ListAccounts
  ( -- * Creating a Request
    ListAccounts (..),
    newListAccounts,

    -- * Request Lenses
    listAccounts_nextToken,
    listAccounts_name,
    listAccounts_userEmail,
    listAccounts_maxResults,

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

    -- * Response Lenses
    listAccountsResponse_accounts,
    listAccountsResponse_nextToken,
    listAccountsResponse_httpStatus,
  )
where

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

-- | /See:/ 'newListAccounts' smart constructor.
data ListAccounts = ListAccounts'
  { -- | The token to use to retrieve the next page of results.
    ListAccounts -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | Amazon Chime account name prefix with which to filter results.
    ListAccounts -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | User email address with which to filter results.
    ListAccounts -> Maybe (Sensitive Text)
userEmail :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The maximum number of results to return in a single call. Defaults to
    -- 100.
    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, 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 token to use to retrieve the next page of results.
--
-- 'name', 'listAccounts_name' - Amazon Chime account name prefix with which to filter results.
--
-- 'userEmail', 'listAccounts_userEmail' - User email address with which to filter results.
--
-- 'maxResults', 'listAccounts_maxResults' - The maximum number of results to return in a single call. Defaults to
-- 100.
newListAccounts ::
  ListAccounts
newListAccounts :: ListAccounts
newListAccounts =
  ListAccounts' :: Maybe Text
-> Maybe Text
-> Maybe (Sensitive Text)
-> Maybe Natural
-> ListAccounts
ListAccounts'
    { $sel:nextToken:ListAccounts' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:ListAccounts' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:userEmail:ListAccounts' :: Maybe (Sensitive Text)
userEmail = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListAccounts' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | The token to use to retrieve the next page of results.
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)

-- | Amazon Chime account name prefix with which to filter results.
listAccounts_name :: Lens.Lens' ListAccounts (Prelude.Maybe Prelude.Text)
listAccounts_name :: (Maybe Text -> f (Maybe Text)) -> ListAccounts -> f ListAccounts
listAccounts_name = (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
name :: Maybe Text
$sel:name:ListAccounts' :: ListAccounts -> Maybe Text
name} -> Maybe Text
name) (\s :: ListAccounts
s@ListAccounts' {} Maybe Text
a -> ListAccounts
s {$sel:name:ListAccounts' :: Maybe Text
name = Maybe Text
a} :: ListAccounts)

-- | User email address with which to filter results.
listAccounts_userEmail :: Lens.Lens' ListAccounts (Prelude.Maybe Prelude.Text)
listAccounts_userEmail :: (Maybe Text -> f (Maybe Text)) -> ListAccounts -> f ListAccounts
listAccounts_userEmail = (ListAccounts -> Maybe (Sensitive Text))
-> (ListAccounts -> Maybe (Sensitive Text) -> ListAccounts)
-> Lens
     ListAccounts
     ListAccounts
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccounts' {Maybe (Sensitive Text)
userEmail :: Maybe (Sensitive Text)
$sel:userEmail:ListAccounts' :: ListAccounts -> Maybe (Sensitive Text)
userEmail} -> Maybe (Sensitive Text)
userEmail) (\s :: ListAccounts
s@ListAccounts' {} Maybe (Sensitive Text)
a -> ListAccounts
s {$sel:userEmail:ListAccounts' :: Maybe (Sensitive Text)
userEmail = Maybe (Sensitive Text)
a} :: ListAccounts) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> ListAccounts -> f ListAccounts)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> ListAccounts
-> f ListAccounts
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
     (Maybe Text)
     (Maybe Text)
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 (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | The maximum number of results to return in a single call. Defaults to
-- 100.
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 => Service -> a -> Request a
Request.get 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
forall a. Monoid a => a
Prelude.mempty

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

instance Core.ToQuery ListAccounts where
  toQuery :: ListAccounts -> QueryString
toQuery ListAccounts' {Maybe Natural
Maybe Text
Maybe (Sensitive Text)
maxResults :: Maybe Natural
userEmail :: Maybe (Sensitive Text)
name :: Maybe Text
nextToken :: Maybe Text
$sel:maxResults:ListAccounts' :: ListAccounts -> Maybe Natural
$sel:userEmail:ListAccounts' :: ListAccounts -> Maybe (Sensitive Text)
$sel:name:ListAccounts' :: ListAccounts -> Maybe Text
$sel:nextToken:ListAccounts' :: ListAccounts -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"next-token" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
        ByteString
"name" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
name,
        ByteString
"user-email" ByteString -> Maybe (Sensitive Text) -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe (Sensitive Text)
userEmail,
        ByteString
"max-results" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxResults
      ]

-- | /See:/ 'newListAccountsResponse' smart constructor.
data ListAccountsResponse = ListAccountsResponse'
  { -- | List of Amazon Chime accounts and account details.
    ListAccountsResponse -> Maybe [Account]
accounts :: Prelude.Maybe [Account],
    -- | The token to use to retrieve the next page of results.
    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, ReadPrec [ListAccountsResponse]
ReadPrec ListAccountsResponse
Int -> ReadS ListAccountsResponse
ReadS [ListAccountsResponse]
(Int -> ReadS ListAccountsResponse)
-> ReadS [ListAccountsResponse]
-> ReadPrec ListAccountsResponse
-> ReadPrec [ListAccountsResponse]
-> Read ListAccountsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAccountsResponse]
$creadListPrec :: ReadPrec [ListAccountsResponse]
readPrec :: ReadPrec ListAccountsResponse
$creadPrec :: ReadPrec ListAccountsResponse
readList :: ReadS [ListAccountsResponse]
$creadList :: ReadS [ListAccountsResponse]
readsPrec :: Int -> ReadS ListAccountsResponse
$creadsPrec :: Int -> ReadS ListAccountsResponse
Prelude.Read, 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' - List of Amazon Chime accounts and account details.
--
-- 'nextToken', 'listAccountsResponse_nextToken' - The token to use to retrieve the next page of results.
--
-- '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_
    }

-- | List of Amazon Chime accounts and account details.
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

-- | The token to use to retrieve the next page of results.
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