{-# 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.WorkMail.ListOrganizations
-- 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 summaries of the customer\'s organizations.
--
-- This operation returns paginated results.
module Amazonka.WorkMail.ListOrganizations
  ( -- * Creating a Request
    ListOrganizations (..),
    newListOrganizations,

    -- * Request Lenses
    listOrganizations_nextToken,
    listOrganizations_maxResults,

    -- * Destructuring the Response
    ListOrganizationsResponse (..),
    newListOrganizationsResponse,

    -- * Response Lenses
    listOrganizationsResponse_nextToken,
    listOrganizationsResponse_organizationSummaries,
    listOrganizationsResponse_httpStatus,
  )
where

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
import Amazonka.WorkMail.Types

-- | /See:/ 'newListOrganizations' smart constructor.
data ListOrganizations = ListOrganizations'
  { -- | The token to use to retrieve the next page of results. The first call
    -- does not contain any tokens.
    ListOrganizations -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to return in a single call.
    ListOrganizations -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (ListOrganizations -> ListOrganizations -> Bool
(ListOrganizations -> ListOrganizations -> Bool)
-> (ListOrganizations -> ListOrganizations -> Bool)
-> Eq ListOrganizations
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListOrganizations -> ListOrganizations -> Bool
$c/= :: ListOrganizations -> ListOrganizations -> Bool
== :: ListOrganizations -> ListOrganizations -> Bool
$c== :: ListOrganizations -> ListOrganizations -> Bool
Prelude.Eq, ReadPrec [ListOrganizations]
ReadPrec ListOrganizations
Int -> ReadS ListOrganizations
ReadS [ListOrganizations]
(Int -> ReadS ListOrganizations)
-> ReadS [ListOrganizations]
-> ReadPrec ListOrganizations
-> ReadPrec [ListOrganizations]
-> Read ListOrganizations
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListOrganizations]
$creadListPrec :: ReadPrec [ListOrganizations]
readPrec :: ReadPrec ListOrganizations
$creadPrec :: ReadPrec ListOrganizations
readList :: ReadS [ListOrganizations]
$creadList :: ReadS [ListOrganizations]
readsPrec :: Int -> ReadS ListOrganizations
$creadsPrec :: Int -> ReadS ListOrganizations
Prelude.Read, Int -> ListOrganizations -> ShowS
[ListOrganizations] -> ShowS
ListOrganizations -> String
(Int -> ListOrganizations -> ShowS)
-> (ListOrganizations -> String)
-> ([ListOrganizations] -> ShowS)
-> Show ListOrganizations
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListOrganizations] -> ShowS
$cshowList :: [ListOrganizations] -> ShowS
show :: ListOrganizations -> String
$cshow :: ListOrganizations -> String
showsPrec :: Int -> ListOrganizations -> ShowS
$cshowsPrec :: Int -> ListOrganizations -> ShowS
Prelude.Show, (forall x. ListOrganizations -> Rep ListOrganizations x)
-> (forall x. Rep ListOrganizations x -> ListOrganizations)
-> Generic ListOrganizations
forall x. Rep ListOrganizations x -> ListOrganizations
forall x. ListOrganizations -> Rep ListOrganizations x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListOrganizations x -> ListOrganizations
$cfrom :: forall x. ListOrganizations -> Rep ListOrganizations x
Prelude.Generic)

-- |
-- Create a value of 'ListOrganizations' 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', 'listOrganizations_nextToken' - The token to use to retrieve the next page of results. The first call
-- does not contain any tokens.
--
-- 'maxResults', 'listOrganizations_maxResults' - The maximum number of results to return in a single call.
newListOrganizations ::
  ListOrganizations
newListOrganizations :: ListOrganizations
newListOrganizations =
  ListOrganizations' :: Maybe Text -> Maybe Natural -> ListOrganizations
ListOrganizations'
    { $sel:nextToken:ListOrganizations' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListOrganizations' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | The token to use to retrieve the next page of results. The first call
-- does not contain any tokens.
listOrganizations_nextToken :: Lens.Lens' ListOrganizations (Prelude.Maybe Prelude.Text)
listOrganizations_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListOrganizations -> f ListOrganizations
listOrganizations_nextToken = (ListOrganizations -> Maybe Text)
-> (ListOrganizations -> Maybe Text -> ListOrganizations)
-> Lens
     ListOrganizations ListOrganizations (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListOrganizations' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListOrganizations' :: ListOrganizations -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListOrganizations
s@ListOrganizations' {} Maybe Text
a -> ListOrganizations
s {$sel:nextToken:ListOrganizations' :: Maybe Text
nextToken = Maybe Text
a} :: ListOrganizations)

-- | The maximum number of results to return in a single call.
listOrganizations_maxResults :: Lens.Lens' ListOrganizations (Prelude.Maybe Prelude.Natural)
listOrganizations_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListOrganizations -> f ListOrganizations
listOrganizations_maxResults = (ListOrganizations -> Maybe Natural)
-> (ListOrganizations -> Maybe Natural -> ListOrganizations)
-> Lens
     ListOrganizations ListOrganizations (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListOrganizations' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListOrganizations' :: ListOrganizations -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListOrganizations
s@ListOrganizations' {} Maybe Natural
a -> ListOrganizations
s {$sel:maxResults:ListOrganizations' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListOrganizations)

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

instance Prelude.NFData ListOrganizations

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

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

-- | /See:/ 'newListOrganizationsResponse' smart constructor.
data ListOrganizationsResponse = ListOrganizationsResponse'
  { -- | The token to use to retrieve the next page of results. The value is
    -- \"null\" when there are no more results to return.
    ListOrganizationsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The overview of owned organizations presented as a list of organization
    -- summaries.
    ListOrganizationsResponse -> Maybe [OrganizationSummary]
organizationSummaries :: Prelude.Maybe [OrganizationSummary],
    -- | The response's http status code.
    ListOrganizationsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListOrganizationsResponse -> ListOrganizationsResponse -> Bool
(ListOrganizationsResponse -> ListOrganizationsResponse -> Bool)
-> (ListOrganizationsResponse -> ListOrganizationsResponse -> Bool)
-> Eq ListOrganizationsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListOrganizationsResponse -> ListOrganizationsResponse -> Bool
$c/= :: ListOrganizationsResponse -> ListOrganizationsResponse -> Bool
== :: ListOrganizationsResponse -> ListOrganizationsResponse -> Bool
$c== :: ListOrganizationsResponse -> ListOrganizationsResponse -> Bool
Prelude.Eq, ReadPrec [ListOrganizationsResponse]
ReadPrec ListOrganizationsResponse
Int -> ReadS ListOrganizationsResponse
ReadS [ListOrganizationsResponse]
(Int -> ReadS ListOrganizationsResponse)
-> ReadS [ListOrganizationsResponse]
-> ReadPrec ListOrganizationsResponse
-> ReadPrec [ListOrganizationsResponse]
-> Read ListOrganizationsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListOrganizationsResponse]
$creadListPrec :: ReadPrec [ListOrganizationsResponse]
readPrec :: ReadPrec ListOrganizationsResponse
$creadPrec :: ReadPrec ListOrganizationsResponse
readList :: ReadS [ListOrganizationsResponse]
$creadList :: ReadS [ListOrganizationsResponse]
readsPrec :: Int -> ReadS ListOrganizationsResponse
$creadsPrec :: Int -> ReadS ListOrganizationsResponse
Prelude.Read, Int -> ListOrganizationsResponse -> ShowS
[ListOrganizationsResponse] -> ShowS
ListOrganizationsResponse -> String
(Int -> ListOrganizationsResponse -> ShowS)
-> (ListOrganizationsResponse -> String)
-> ([ListOrganizationsResponse] -> ShowS)
-> Show ListOrganizationsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListOrganizationsResponse] -> ShowS
$cshowList :: [ListOrganizationsResponse] -> ShowS
show :: ListOrganizationsResponse -> String
$cshow :: ListOrganizationsResponse -> String
showsPrec :: Int -> ListOrganizationsResponse -> ShowS
$cshowsPrec :: Int -> ListOrganizationsResponse -> ShowS
Prelude.Show, (forall x.
 ListOrganizationsResponse -> Rep ListOrganizationsResponse x)
-> (forall x.
    Rep ListOrganizationsResponse x -> ListOrganizationsResponse)
-> Generic ListOrganizationsResponse
forall x.
Rep ListOrganizationsResponse x -> ListOrganizationsResponse
forall x.
ListOrganizationsResponse -> Rep ListOrganizationsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListOrganizationsResponse x -> ListOrganizationsResponse
$cfrom :: forall x.
ListOrganizationsResponse -> Rep ListOrganizationsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListOrganizationsResponse' 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', 'listOrganizationsResponse_nextToken' - The token to use to retrieve the next page of results. The value is
-- \"null\" when there are no more results to return.
--
-- 'organizationSummaries', 'listOrganizationsResponse_organizationSummaries' - The overview of owned organizations presented as a list of organization
-- summaries.
--
-- 'httpStatus', 'listOrganizationsResponse_httpStatus' - The response's http status code.
newListOrganizationsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListOrganizationsResponse
newListOrganizationsResponse :: Int -> ListOrganizationsResponse
newListOrganizationsResponse Int
pHttpStatus_ =
  ListOrganizationsResponse' :: Maybe Text
-> Maybe [OrganizationSummary] -> Int -> ListOrganizationsResponse
ListOrganizationsResponse'
    { $sel:nextToken:ListOrganizationsResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:organizationSummaries:ListOrganizationsResponse' :: Maybe [OrganizationSummary]
organizationSummaries = Maybe [OrganizationSummary]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListOrganizationsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The token to use to retrieve the next page of results. The value is
-- \"null\" when there are no more results to return.
listOrganizationsResponse_nextToken :: Lens.Lens' ListOrganizationsResponse (Prelude.Maybe Prelude.Text)
listOrganizationsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListOrganizationsResponse -> f ListOrganizationsResponse
listOrganizationsResponse_nextToken = (ListOrganizationsResponse -> Maybe Text)
-> (ListOrganizationsResponse
    -> Maybe Text -> ListOrganizationsResponse)
-> Lens' ListOrganizationsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListOrganizationsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListOrganizationsResponse' :: ListOrganizationsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListOrganizationsResponse
s@ListOrganizationsResponse' {} Maybe Text
a -> ListOrganizationsResponse
s {$sel:nextToken:ListOrganizationsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListOrganizationsResponse)

-- | The overview of owned organizations presented as a list of organization
-- summaries.
listOrganizationsResponse_organizationSummaries :: Lens.Lens' ListOrganizationsResponse (Prelude.Maybe [OrganizationSummary])
listOrganizationsResponse_organizationSummaries :: (Maybe [OrganizationSummary] -> f (Maybe [OrganizationSummary]))
-> ListOrganizationsResponse -> f ListOrganizationsResponse
listOrganizationsResponse_organizationSummaries = (ListOrganizationsResponse -> Maybe [OrganizationSummary])
-> (ListOrganizationsResponse
    -> Maybe [OrganizationSummary] -> ListOrganizationsResponse)
-> Lens' ListOrganizationsResponse (Maybe [OrganizationSummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListOrganizationsResponse' {Maybe [OrganizationSummary]
organizationSummaries :: Maybe [OrganizationSummary]
$sel:organizationSummaries:ListOrganizationsResponse' :: ListOrganizationsResponse -> Maybe [OrganizationSummary]
organizationSummaries} -> Maybe [OrganizationSummary]
organizationSummaries) (\s :: ListOrganizationsResponse
s@ListOrganizationsResponse' {} Maybe [OrganizationSummary]
a -> ListOrganizationsResponse
s {$sel:organizationSummaries:ListOrganizationsResponse' :: Maybe [OrganizationSummary]
organizationSummaries = Maybe [OrganizationSummary]
a} :: ListOrganizationsResponse) ((Maybe [OrganizationSummary] -> f (Maybe [OrganizationSummary]))
 -> ListOrganizationsResponse -> f ListOrganizationsResponse)
-> ((Maybe [OrganizationSummary]
     -> f (Maybe [OrganizationSummary]))
    -> Maybe [OrganizationSummary] -> f (Maybe [OrganizationSummary]))
-> (Maybe [OrganizationSummary] -> f (Maybe [OrganizationSummary]))
-> ListOrganizationsResponse
-> f ListOrganizationsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [OrganizationSummary]
  [OrganizationSummary]
  [OrganizationSummary]
  [OrganizationSummary]
-> Iso
     (Maybe [OrganizationSummary])
     (Maybe [OrganizationSummary])
     (Maybe [OrganizationSummary])
     (Maybe [OrganizationSummary])
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
  [OrganizationSummary]
  [OrganizationSummary]
  [OrganizationSummary]
  [OrganizationSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData ListOrganizationsResponse