{-# 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.DocumentDB.DescribeGlobalClusters
-- 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 information about Amazon DocumentDB global clusters. This API
-- supports pagination.
--
-- This action only applies to Amazon DocumentDB clusters.
--
-- This operation returns paginated results.
module Amazonka.DocumentDB.DescribeGlobalClusters
  ( -- * Creating a Request
    DescribeGlobalClusters (..),
    newDescribeGlobalClusters,

    -- * Request Lenses
    describeGlobalClusters_globalClusterIdentifier,
    describeGlobalClusters_filters,
    describeGlobalClusters_marker,
    describeGlobalClusters_maxRecords,

    -- * Destructuring the Response
    DescribeGlobalClustersResponse (..),
    newDescribeGlobalClustersResponse,

    -- * Response Lenses
    describeGlobalClustersResponse_globalClusters,
    describeGlobalClustersResponse_marker,
    describeGlobalClustersResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.DocumentDB.Types
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:/ 'newDescribeGlobalClusters' smart constructor.
data DescribeGlobalClusters = DescribeGlobalClusters'
  { -- | The user-supplied cluster identifier. If this parameter is specified,
    -- information from only the specific cluster is returned. This parameter
    -- isn\'t case-sensitive.
    DescribeGlobalClusters -> Maybe Text
globalClusterIdentifier :: Prelude.Maybe Prelude.Text,
    -- | A filter that specifies one or more global DB clusters to describe.
    --
    -- Supported filters: @db-cluster-id@ accepts cluster identifiers and
    -- cluster Amazon Resource Names (ARNs). The results list will only include
    -- information about the clusters identified by these ARNs.
    DescribeGlobalClusters -> Maybe [Filter]
filters :: Prelude.Maybe [Filter],
    -- | An optional pagination token provided by a previous
    -- @DescribeGlobalClusters@ request. If this parameter is specified, the
    -- response includes only records beyond the marker, up to the value
    -- specified by @MaxRecords@.
    DescribeGlobalClusters -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of records to include in the response. If more
    -- records exist than the specified @MaxRecords@ value, a pagination token
    -- called a marker is included in the response so that you can retrieve the
    -- remaining results.
    DescribeGlobalClusters -> Maybe Int
maxRecords :: Prelude.Maybe Prelude.Int
  }
  deriving (DescribeGlobalClusters -> DescribeGlobalClusters -> Bool
(DescribeGlobalClusters -> DescribeGlobalClusters -> Bool)
-> (DescribeGlobalClusters -> DescribeGlobalClusters -> Bool)
-> Eq DescribeGlobalClusters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeGlobalClusters -> DescribeGlobalClusters -> Bool
$c/= :: DescribeGlobalClusters -> DescribeGlobalClusters -> Bool
== :: DescribeGlobalClusters -> DescribeGlobalClusters -> Bool
$c== :: DescribeGlobalClusters -> DescribeGlobalClusters -> Bool
Prelude.Eq, ReadPrec [DescribeGlobalClusters]
ReadPrec DescribeGlobalClusters
Int -> ReadS DescribeGlobalClusters
ReadS [DescribeGlobalClusters]
(Int -> ReadS DescribeGlobalClusters)
-> ReadS [DescribeGlobalClusters]
-> ReadPrec DescribeGlobalClusters
-> ReadPrec [DescribeGlobalClusters]
-> Read DescribeGlobalClusters
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeGlobalClusters]
$creadListPrec :: ReadPrec [DescribeGlobalClusters]
readPrec :: ReadPrec DescribeGlobalClusters
$creadPrec :: ReadPrec DescribeGlobalClusters
readList :: ReadS [DescribeGlobalClusters]
$creadList :: ReadS [DescribeGlobalClusters]
readsPrec :: Int -> ReadS DescribeGlobalClusters
$creadsPrec :: Int -> ReadS DescribeGlobalClusters
Prelude.Read, Int -> DescribeGlobalClusters -> ShowS
[DescribeGlobalClusters] -> ShowS
DescribeGlobalClusters -> String
(Int -> DescribeGlobalClusters -> ShowS)
-> (DescribeGlobalClusters -> String)
-> ([DescribeGlobalClusters] -> ShowS)
-> Show DescribeGlobalClusters
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeGlobalClusters] -> ShowS
$cshowList :: [DescribeGlobalClusters] -> ShowS
show :: DescribeGlobalClusters -> String
$cshow :: DescribeGlobalClusters -> String
showsPrec :: Int -> DescribeGlobalClusters -> ShowS
$cshowsPrec :: Int -> DescribeGlobalClusters -> ShowS
Prelude.Show, (forall x. DescribeGlobalClusters -> Rep DescribeGlobalClusters x)
-> (forall x.
    Rep DescribeGlobalClusters x -> DescribeGlobalClusters)
-> Generic DescribeGlobalClusters
forall x. Rep DescribeGlobalClusters x -> DescribeGlobalClusters
forall x. DescribeGlobalClusters -> Rep DescribeGlobalClusters x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeGlobalClusters x -> DescribeGlobalClusters
$cfrom :: forall x. DescribeGlobalClusters -> Rep DescribeGlobalClusters x
Prelude.Generic)

-- |
-- Create a value of 'DescribeGlobalClusters' 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:
--
-- 'globalClusterIdentifier', 'describeGlobalClusters_globalClusterIdentifier' - The user-supplied cluster identifier. If this parameter is specified,
-- information from only the specific cluster is returned. This parameter
-- isn\'t case-sensitive.
--
-- 'filters', 'describeGlobalClusters_filters' - A filter that specifies one or more global DB clusters to describe.
--
-- Supported filters: @db-cluster-id@ accepts cluster identifiers and
-- cluster Amazon Resource Names (ARNs). The results list will only include
-- information about the clusters identified by these ARNs.
--
-- 'marker', 'describeGlobalClusters_marker' - An optional pagination token provided by a previous
-- @DescribeGlobalClusters@ request. If this parameter is specified, the
-- response includes only records beyond the marker, up to the value
-- specified by @MaxRecords@.
--
-- 'maxRecords', 'describeGlobalClusters_maxRecords' - The maximum number of records to include in the response. If more
-- records exist than the specified @MaxRecords@ value, a pagination token
-- called a marker is included in the response so that you can retrieve the
-- remaining results.
newDescribeGlobalClusters ::
  DescribeGlobalClusters
newDescribeGlobalClusters :: DescribeGlobalClusters
newDescribeGlobalClusters =
  DescribeGlobalClusters' :: Maybe Text
-> Maybe [Filter]
-> Maybe Text
-> Maybe Int
-> DescribeGlobalClusters
DescribeGlobalClusters'
    { $sel:globalClusterIdentifier:DescribeGlobalClusters' :: Maybe Text
globalClusterIdentifier =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:filters:DescribeGlobalClusters' :: Maybe [Filter]
filters = Maybe [Filter]
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:DescribeGlobalClusters' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxRecords:DescribeGlobalClusters' :: Maybe Int
maxRecords = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | The user-supplied cluster identifier. If this parameter is specified,
-- information from only the specific cluster is returned. This parameter
-- isn\'t case-sensitive.
describeGlobalClusters_globalClusterIdentifier :: Lens.Lens' DescribeGlobalClusters (Prelude.Maybe Prelude.Text)
describeGlobalClusters_globalClusterIdentifier :: (Maybe Text -> f (Maybe Text))
-> DescribeGlobalClusters -> f DescribeGlobalClusters
describeGlobalClusters_globalClusterIdentifier = (DescribeGlobalClusters -> Maybe Text)
-> (DescribeGlobalClusters -> Maybe Text -> DescribeGlobalClusters)
-> Lens
     DescribeGlobalClusters
     DescribeGlobalClusters
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeGlobalClusters' {Maybe Text
globalClusterIdentifier :: Maybe Text
$sel:globalClusterIdentifier:DescribeGlobalClusters' :: DescribeGlobalClusters -> Maybe Text
globalClusterIdentifier} -> Maybe Text
globalClusterIdentifier) (\s :: DescribeGlobalClusters
s@DescribeGlobalClusters' {} Maybe Text
a -> DescribeGlobalClusters
s {$sel:globalClusterIdentifier:DescribeGlobalClusters' :: Maybe Text
globalClusterIdentifier = Maybe Text
a} :: DescribeGlobalClusters)

-- | A filter that specifies one or more global DB clusters to describe.
--
-- Supported filters: @db-cluster-id@ accepts cluster identifiers and
-- cluster Amazon Resource Names (ARNs). The results list will only include
-- information about the clusters identified by these ARNs.
describeGlobalClusters_filters :: Lens.Lens' DescribeGlobalClusters (Prelude.Maybe [Filter])
describeGlobalClusters_filters :: (Maybe [Filter] -> f (Maybe [Filter]))
-> DescribeGlobalClusters -> f DescribeGlobalClusters
describeGlobalClusters_filters = (DescribeGlobalClusters -> Maybe [Filter])
-> (DescribeGlobalClusters
    -> Maybe [Filter] -> DescribeGlobalClusters)
-> Lens
     DescribeGlobalClusters
     DescribeGlobalClusters
     (Maybe [Filter])
     (Maybe [Filter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeGlobalClusters' {Maybe [Filter]
filters :: Maybe [Filter]
$sel:filters:DescribeGlobalClusters' :: DescribeGlobalClusters -> Maybe [Filter]
filters} -> Maybe [Filter]
filters) (\s :: DescribeGlobalClusters
s@DescribeGlobalClusters' {} Maybe [Filter]
a -> DescribeGlobalClusters
s {$sel:filters:DescribeGlobalClusters' :: Maybe [Filter]
filters = Maybe [Filter]
a} :: DescribeGlobalClusters) ((Maybe [Filter] -> f (Maybe [Filter]))
 -> DescribeGlobalClusters -> f DescribeGlobalClusters)
-> ((Maybe [Filter] -> f (Maybe [Filter]))
    -> Maybe [Filter] -> f (Maybe [Filter]))
-> (Maybe [Filter] -> f (Maybe [Filter]))
-> DescribeGlobalClusters
-> f DescribeGlobalClusters
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Filter] [Filter] [Filter] [Filter]
-> Iso
     (Maybe [Filter]) (Maybe [Filter]) (Maybe [Filter]) (Maybe [Filter])
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 [Filter] [Filter] [Filter] [Filter]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | An optional pagination token provided by a previous
-- @DescribeGlobalClusters@ request. If this parameter is specified, the
-- response includes only records beyond the marker, up to the value
-- specified by @MaxRecords@.
describeGlobalClusters_marker :: Lens.Lens' DescribeGlobalClusters (Prelude.Maybe Prelude.Text)
describeGlobalClusters_marker :: (Maybe Text -> f (Maybe Text))
-> DescribeGlobalClusters -> f DescribeGlobalClusters
describeGlobalClusters_marker = (DescribeGlobalClusters -> Maybe Text)
-> (DescribeGlobalClusters -> Maybe Text -> DescribeGlobalClusters)
-> Lens
     DescribeGlobalClusters
     DescribeGlobalClusters
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeGlobalClusters' {Maybe Text
marker :: Maybe Text
$sel:marker:DescribeGlobalClusters' :: DescribeGlobalClusters -> Maybe Text
marker} -> Maybe Text
marker) (\s :: DescribeGlobalClusters
s@DescribeGlobalClusters' {} Maybe Text
a -> DescribeGlobalClusters
s {$sel:marker:DescribeGlobalClusters' :: Maybe Text
marker = Maybe Text
a} :: DescribeGlobalClusters)

-- | The maximum number of records to include in the response. If more
-- records exist than the specified @MaxRecords@ value, a pagination token
-- called a marker is included in the response so that you can retrieve the
-- remaining results.
describeGlobalClusters_maxRecords :: Lens.Lens' DescribeGlobalClusters (Prelude.Maybe Prelude.Int)
describeGlobalClusters_maxRecords :: (Maybe Int -> f (Maybe Int))
-> DescribeGlobalClusters -> f DescribeGlobalClusters
describeGlobalClusters_maxRecords = (DescribeGlobalClusters -> Maybe Int)
-> (DescribeGlobalClusters -> Maybe Int -> DescribeGlobalClusters)
-> Lens
     DescribeGlobalClusters
     DescribeGlobalClusters
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeGlobalClusters' {Maybe Int
maxRecords :: Maybe Int
$sel:maxRecords:DescribeGlobalClusters' :: DescribeGlobalClusters -> Maybe Int
maxRecords} -> Maybe Int
maxRecords) (\s :: DescribeGlobalClusters
s@DescribeGlobalClusters' {} Maybe Int
a -> DescribeGlobalClusters
s {$sel:maxRecords:DescribeGlobalClusters' :: Maybe Int
maxRecords = Maybe Int
a} :: DescribeGlobalClusters)

instance Core.AWSPager DescribeGlobalClusters where
  page :: DescribeGlobalClusters
-> AWSResponse DescribeGlobalClusters
-> Maybe DescribeGlobalClusters
page DescribeGlobalClusters
rq AWSResponse DescribeGlobalClusters
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeGlobalClusters
DescribeGlobalClustersResponse
rs
            DescribeGlobalClustersResponse
-> Getting (First Text) DescribeGlobalClustersResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeGlobalClustersResponse
-> Const (First Text) DescribeGlobalClustersResponse
Lens' DescribeGlobalClustersResponse (Maybe Text)
describeGlobalClustersResponse_marker
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeGlobalClustersResponse
 -> Const (First Text) DescribeGlobalClustersResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeGlobalClustersResponse 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 DescribeGlobalClusters
forall a. Maybe a
Prelude.Nothing
    | Maybe [GlobalCluster] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeGlobalClusters
DescribeGlobalClustersResponse
rs
            DescribeGlobalClustersResponse
-> Getting
     (First [GlobalCluster])
     DescribeGlobalClustersResponse
     [GlobalCluster]
-> Maybe [GlobalCluster]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [GlobalCluster]
 -> Const (First [GlobalCluster]) (Maybe [GlobalCluster]))
-> DescribeGlobalClustersResponse
-> Const (First [GlobalCluster]) DescribeGlobalClustersResponse
Lens' DescribeGlobalClustersResponse (Maybe [GlobalCluster])
describeGlobalClustersResponse_globalClusters
              ((Maybe [GlobalCluster]
  -> Const (First [GlobalCluster]) (Maybe [GlobalCluster]))
 -> DescribeGlobalClustersResponse
 -> Const (First [GlobalCluster]) DescribeGlobalClustersResponse)
-> (([GlobalCluster]
     -> Const (First [GlobalCluster]) [GlobalCluster])
    -> Maybe [GlobalCluster]
    -> Const (First [GlobalCluster]) (Maybe [GlobalCluster]))
-> Getting
     (First [GlobalCluster])
     DescribeGlobalClustersResponse
     [GlobalCluster]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([GlobalCluster] -> Const (First [GlobalCluster]) [GlobalCluster])
-> Maybe [GlobalCluster]
-> Const (First [GlobalCluster]) (Maybe [GlobalCluster])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe DescribeGlobalClusters
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      DescribeGlobalClusters -> Maybe DescribeGlobalClusters
forall a. a -> Maybe a
Prelude.Just (DescribeGlobalClusters -> Maybe DescribeGlobalClusters)
-> DescribeGlobalClusters -> Maybe DescribeGlobalClusters
forall a b. (a -> b) -> a -> b
Prelude.$
        DescribeGlobalClusters
rq
          DescribeGlobalClusters
-> (DescribeGlobalClusters -> DescribeGlobalClusters)
-> DescribeGlobalClusters
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> DescribeGlobalClusters -> Identity DescribeGlobalClusters
Lens
  DescribeGlobalClusters
  DescribeGlobalClusters
  (Maybe Text)
  (Maybe Text)
describeGlobalClusters_marker
          ((Maybe Text -> Identity (Maybe Text))
 -> DescribeGlobalClusters -> Identity DescribeGlobalClusters)
-> Maybe Text -> DescribeGlobalClusters -> DescribeGlobalClusters
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeGlobalClusters
DescribeGlobalClustersResponse
rs
          DescribeGlobalClustersResponse
-> Getting (First Text) DescribeGlobalClustersResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeGlobalClustersResponse
-> Const (First Text) DescribeGlobalClustersResponse
Lens' DescribeGlobalClustersResponse (Maybe Text)
describeGlobalClustersResponse_marker
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeGlobalClustersResponse
 -> Const (First Text) DescribeGlobalClustersResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeGlobalClustersResponse 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 DescribeGlobalClusters where
  type
    AWSResponse DescribeGlobalClusters =
      DescribeGlobalClustersResponse
  request :: DescribeGlobalClusters -> Request DescribeGlobalClusters
request = Service -> DescribeGlobalClusters -> Request DescribeGlobalClusters
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeGlobalClusters
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeGlobalClusters)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse DescribeGlobalClusters))
-> Logger
-> Service
-> Proxy DescribeGlobalClusters
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeGlobalClusters)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"DescribeGlobalClustersResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe [GlobalCluster]
-> Maybe Text -> Int -> DescribeGlobalClustersResponse
DescribeGlobalClustersResponse'
            (Maybe [GlobalCluster]
 -> Maybe Text -> Int -> DescribeGlobalClustersResponse)
-> Either String (Maybe [GlobalCluster])
-> Either
     String (Maybe Text -> Int -> DescribeGlobalClustersResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"GlobalClusters" Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
                            Either String [Node]
-> ([Node] -> Either String (Maybe [GlobalCluster]))
-> Either String (Maybe [GlobalCluster])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [GlobalCluster])
-> [Node] -> Either String (Maybe [GlobalCluster])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [GlobalCluster]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"GlobalClusterMember")
                        )
            Either String (Maybe Text -> Int -> DescribeGlobalClustersResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DescribeGlobalClustersResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Marker")
            Either String (Int -> DescribeGlobalClustersResponse)
-> Either String Int
-> Either String DescribeGlobalClustersResponse
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 DescribeGlobalClusters

instance Prelude.NFData DescribeGlobalClusters

instance Core.ToHeaders DescribeGlobalClusters where
  toHeaders :: DescribeGlobalClusters -> ResponseHeaders
toHeaders = ResponseHeaders -> DescribeGlobalClusters -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

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

instance Core.ToQuery DescribeGlobalClusters where
  toQuery :: DescribeGlobalClusters -> QueryString
toQuery DescribeGlobalClusters' {Maybe Int
Maybe [Filter]
Maybe Text
maxRecords :: Maybe Int
marker :: Maybe Text
filters :: Maybe [Filter]
globalClusterIdentifier :: Maybe Text
$sel:maxRecords:DescribeGlobalClusters' :: DescribeGlobalClusters -> Maybe Int
$sel:marker:DescribeGlobalClusters' :: DescribeGlobalClusters -> Maybe Text
$sel:filters:DescribeGlobalClusters' :: DescribeGlobalClusters -> Maybe [Filter]
$sel:globalClusterIdentifier:DescribeGlobalClusters' :: DescribeGlobalClusters -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"DescribeGlobalClusters" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2014-10-31" :: Prelude.ByteString),
        ByteString
"GlobalClusterIdentifier"
          ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
globalClusterIdentifier,
        ByteString
"Filters"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            (ByteString -> [Filter] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"Filter" ([Filter] -> QueryString) -> Maybe [Filter] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Filter]
filters),
        ByteString
"Marker" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
marker,
        ByteString
"MaxRecords" ByteString -> Maybe Int -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Int
maxRecords
      ]

-- | /See:/ 'newDescribeGlobalClustersResponse' smart constructor.
data DescribeGlobalClustersResponse = DescribeGlobalClustersResponse'
  { DescribeGlobalClustersResponse -> Maybe [GlobalCluster]
globalClusters :: Prelude.Maybe [GlobalCluster],
    DescribeGlobalClustersResponse -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeGlobalClustersResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeGlobalClustersResponse
-> DescribeGlobalClustersResponse -> Bool
(DescribeGlobalClustersResponse
 -> DescribeGlobalClustersResponse -> Bool)
-> (DescribeGlobalClustersResponse
    -> DescribeGlobalClustersResponse -> Bool)
-> Eq DescribeGlobalClustersResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeGlobalClustersResponse
-> DescribeGlobalClustersResponse -> Bool
$c/= :: DescribeGlobalClustersResponse
-> DescribeGlobalClustersResponse -> Bool
== :: DescribeGlobalClustersResponse
-> DescribeGlobalClustersResponse -> Bool
$c== :: DescribeGlobalClustersResponse
-> DescribeGlobalClustersResponse -> Bool
Prelude.Eq, ReadPrec [DescribeGlobalClustersResponse]
ReadPrec DescribeGlobalClustersResponse
Int -> ReadS DescribeGlobalClustersResponse
ReadS [DescribeGlobalClustersResponse]
(Int -> ReadS DescribeGlobalClustersResponse)
-> ReadS [DescribeGlobalClustersResponse]
-> ReadPrec DescribeGlobalClustersResponse
-> ReadPrec [DescribeGlobalClustersResponse]
-> Read DescribeGlobalClustersResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeGlobalClustersResponse]
$creadListPrec :: ReadPrec [DescribeGlobalClustersResponse]
readPrec :: ReadPrec DescribeGlobalClustersResponse
$creadPrec :: ReadPrec DescribeGlobalClustersResponse
readList :: ReadS [DescribeGlobalClustersResponse]
$creadList :: ReadS [DescribeGlobalClustersResponse]
readsPrec :: Int -> ReadS DescribeGlobalClustersResponse
$creadsPrec :: Int -> ReadS DescribeGlobalClustersResponse
Prelude.Read, Int -> DescribeGlobalClustersResponse -> ShowS
[DescribeGlobalClustersResponse] -> ShowS
DescribeGlobalClustersResponse -> String
(Int -> DescribeGlobalClustersResponse -> ShowS)
-> (DescribeGlobalClustersResponse -> String)
-> ([DescribeGlobalClustersResponse] -> ShowS)
-> Show DescribeGlobalClustersResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeGlobalClustersResponse] -> ShowS
$cshowList :: [DescribeGlobalClustersResponse] -> ShowS
show :: DescribeGlobalClustersResponse -> String
$cshow :: DescribeGlobalClustersResponse -> String
showsPrec :: Int -> DescribeGlobalClustersResponse -> ShowS
$cshowsPrec :: Int -> DescribeGlobalClustersResponse -> ShowS
Prelude.Show, (forall x.
 DescribeGlobalClustersResponse
 -> Rep DescribeGlobalClustersResponse x)
-> (forall x.
    Rep DescribeGlobalClustersResponse x
    -> DescribeGlobalClustersResponse)
-> Generic DescribeGlobalClustersResponse
forall x.
Rep DescribeGlobalClustersResponse x
-> DescribeGlobalClustersResponse
forall x.
DescribeGlobalClustersResponse
-> Rep DescribeGlobalClustersResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeGlobalClustersResponse x
-> DescribeGlobalClustersResponse
$cfrom :: forall x.
DescribeGlobalClustersResponse
-> Rep DescribeGlobalClustersResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeGlobalClustersResponse' 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:
--
-- 'globalClusters', 'describeGlobalClustersResponse_globalClusters' -
--
-- 'marker', 'describeGlobalClustersResponse_marker' -
--
-- 'httpStatus', 'describeGlobalClustersResponse_httpStatus' - The response's http status code.
newDescribeGlobalClustersResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeGlobalClustersResponse
newDescribeGlobalClustersResponse :: Int -> DescribeGlobalClustersResponse
newDescribeGlobalClustersResponse Int
pHttpStatus_ =
  DescribeGlobalClustersResponse' :: Maybe [GlobalCluster]
-> Maybe Text -> Int -> DescribeGlobalClustersResponse
DescribeGlobalClustersResponse'
    { $sel:globalClusters:DescribeGlobalClustersResponse' :: Maybe [GlobalCluster]
globalClusters =
        Maybe [GlobalCluster]
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:DescribeGlobalClustersResponse' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeGlobalClustersResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- |
describeGlobalClustersResponse_globalClusters :: Lens.Lens' DescribeGlobalClustersResponse (Prelude.Maybe [GlobalCluster])
describeGlobalClustersResponse_globalClusters :: (Maybe [GlobalCluster] -> f (Maybe [GlobalCluster]))
-> DescribeGlobalClustersResponse
-> f DescribeGlobalClustersResponse
describeGlobalClustersResponse_globalClusters = (DescribeGlobalClustersResponse -> Maybe [GlobalCluster])
-> (DescribeGlobalClustersResponse
    -> Maybe [GlobalCluster] -> DescribeGlobalClustersResponse)
-> Lens' DescribeGlobalClustersResponse (Maybe [GlobalCluster])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeGlobalClustersResponse' {Maybe [GlobalCluster]
globalClusters :: Maybe [GlobalCluster]
$sel:globalClusters:DescribeGlobalClustersResponse' :: DescribeGlobalClustersResponse -> Maybe [GlobalCluster]
globalClusters} -> Maybe [GlobalCluster]
globalClusters) (\s :: DescribeGlobalClustersResponse
s@DescribeGlobalClustersResponse' {} Maybe [GlobalCluster]
a -> DescribeGlobalClustersResponse
s {$sel:globalClusters:DescribeGlobalClustersResponse' :: Maybe [GlobalCluster]
globalClusters = Maybe [GlobalCluster]
a} :: DescribeGlobalClustersResponse) ((Maybe [GlobalCluster] -> f (Maybe [GlobalCluster]))
 -> DescribeGlobalClustersResponse
 -> f DescribeGlobalClustersResponse)
-> ((Maybe [GlobalCluster] -> f (Maybe [GlobalCluster]))
    -> Maybe [GlobalCluster] -> f (Maybe [GlobalCluster]))
-> (Maybe [GlobalCluster] -> f (Maybe [GlobalCluster]))
-> DescribeGlobalClustersResponse
-> f DescribeGlobalClustersResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [GlobalCluster] [GlobalCluster] [GlobalCluster] [GlobalCluster]
-> Iso
     (Maybe [GlobalCluster])
     (Maybe [GlobalCluster])
     (Maybe [GlobalCluster])
     (Maybe [GlobalCluster])
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
  [GlobalCluster] [GlobalCluster] [GlobalCluster] [GlobalCluster]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- |
describeGlobalClustersResponse_marker :: Lens.Lens' DescribeGlobalClustersResponse (Prelude.Maybe Prelude.Text)
describeGlobalClustersResponse_marker :: (Maybe Text -> f (Maybe Text))
-> DescribeGlobalClustersResponse
-> f DescribeGlobalClustersResponse
describeGlobalClustersResponse_marker = (DescribeGlobalClustersResponse -> Maybe Text)
-> (DescribeGlobalClustersResponse
    -> Maybe Text -> DescribeGlobalClustersResponse)
-> Lens' DescribeGlobalClustersResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeGlobalClustersResponse' {Maybe Text
marker :: Maybe Text
$sel:marker:DescribeGlobalClustersResponse' :: DescribeGlobalClustersResponse -> Maybe Text
marker} -> Maybe Text
marker) (\s :: DescribeGlobalClustersResponse
s@DescribeGlobalClustersResponse' {} Maybe Text
a -> DescribeGlobalClustersResponse
s {$sel:marker:DescribeGlobalClustersResponse' :: Maybe Text
marker = Maybe Text
a} :: DescribeGlobalClustersResponse)

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

instance
  Prelude.NFData
    DescribeGlobalClustersResponse