{-# 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.ElastiCache.DescribeGlobalReplicationGroups
-- 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 a particular global replication group. If no
-- identifier is specified, returns information about all Global
-- datastores.
--
-- This operation returns paginated results.
module Amazonka.ElastiCache.DescribeGlobalReplicationGroups
  ( -- * Creating a Request
    DescribeGlobalReplicationGroups (..),
    newDescribeGlobalReplicationGroups,

    -- * Request Lenses
    describeGlobalReplicationGroups_showMemberInfo,
    describeGlobalReplicationGroups_marker,
    describeGlobalReplicationGroups_maxRecords,
    describeGlobalReplicationGroups_globalReplicationGroupId,

    -- * Destructuring the Response
    DescribeGlobalReplicationGroupsResponse (..),
    newDescribeGlobalReplicationGroupsResponse,

    -- * Response Lenses
    describeGlobalReplicationGroupsResponse_marker,
    describeGlobalReplicationGroupsResponse_globalReplicationGroups,
    describeGlobalReplicationGroupsResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.ElastiCache.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:/ 'newDescribeGlobalReplicationGroups' smart constructor.
data DescribeGlobalReplicationGroups = DescribeGlobalReplicationGroups'
  { -- | Returns the list of members that comprise the Global datastore.
    DescribeGlobalReplicationGroups -> Maybe Bool
showMemberInfo :: Prelude.Maybe Prelude.Bool,
    -- | An optional marker returned from a prior request. Use this marker for
    -- pagination of results from this operation. If this parameter is
    -- specified, the response includes only records beyond the marker, up to
    -- the value specified by @MaxRecords@.
    DescribeGlobalReplicationGroups -> 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 marker is included
    -- in the response so that the remaining results can be retrieved.
    DescribeGlobalReplicationGroups -> Maybe Int
maxRecords :: Prelude.Maybe Prelude.Int,
    -- | The name of the Global datastore
    DescribeGlobalReplicationGroups -> Maybe Text
globalReplicationGroupId :: Prelude.Maybe Prelude.Text
  }
  deriving (DescribeGlobalReplicationGroups
-> DescribeGlobalReplicationGroups -> Bool
(DescribeGlobalReplicationGroups
 -> DescribeGlobalReplicationGroups -> Bool)
-> (DescribeGlobalReplicationGroups
    -> DescribeGlobalReplicationGroups -> Bool)
-> Eq DescribeGlobalReplicationGroups
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeGlobalReplicationGroups
-> DescribeGlobalReplicationGroups -> Bool
$c/= :: DescribeGlobalReplicationGroups
-> DescribeGlobalReplicationGroups -> Bool
== :: DescribeGlobalReplicationGroups
-> DescribeGlobalReplicationGroups -> Bool
$c== :: DescribeGlobalReplicationGroups
-> DescribeGlobalReplicationGroups -> Bool
Prelude.Eq, ReadPrec [DescribeGlobalReplicationGroups]
ReadPrec DescribeGlobalReplicationGroups
Int -> ReadS DescribeGlobalReplicationGroups
ReadS [DescribeGlobalReplicationGroups]
(Int -> ReadS DescribeGlobalReplicationGroups)
-> ReadS [DescribeGlobalReplicationGroups]
-> ReadPrec DescribeGlobalReplicationGroups
-> ReadPrec [DescribeGlobalReplicationGroups]
-> Read DescribeGlobalReplicationGroups
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeGlobalReplicationGroups]
$creadListPrec :: ReadPrec [DescribeGlobalReplicationGroups]
readPrec :: ReadPrec DescribeGlobalReplicationGroups
$creadPrec :: ReadPrec DescribeGlobalReplicationGroups
readList :: ReadS [DescribeGlobalReplicationGroups]
$creadList :: ReadS [DescribeGlobalReplicationGroups]
readsPrec :: Int -> ReadS DescribeGlobalReplicationGroups
$creadsPrec :: Int -> ReadS DescribeGlobalReplicationGroups
Prelude.Read, Int -> DescribeGlobalReplicationGroups -> ShowS
[DescribeGlobalReplicationGroups] -> ShowS
DescribeGlobalReplicationGroups -> String
(Int -> DescribeGlobalReplicationGroups -> ShowS)
-> (DescribeGlobalReplicationGroups -> String)
-> ([DescribeGlobalReplicationGroups] -> ShowS)
-> Show DescribeGlobalReplicationGroups
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeGlobalReplicationGroups] -> ShowS
$cshowList :: [DescribeGlobalReplicationGroups] -> ShowS
show :: DescribeGlobalReplicationGroups -> String
$cshow :: DescribeGlobalReplicationGroups -> String
showsPrec :: Int -> DescribeGlobalReplicationGroups -> ShowS
$cshowsPrec :: Int -> DescribeGlobalReplicationGroups -> ShowS
Prelude.Show, (forall x.
 DescribeGlobalReplicationGroups
 -> Rep DescribeGlobalReplicationGroups x)
-> (forall x.
    Rep DescribeGlobalReplicationGroups x
    -> DescribeGlobalReplicationGroups)
-> Generic DescribeGlobalReplicationGroups
forall x.
Rep DescribeGlobalReplicationGroups x
-> DescribeGlobalReplicationGroups
forall x.
DescribeGlobalReplicationGroups
-> Rep DescribeGlobalReplicationGroups x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeGlobalReplicationGroups x
-> DescribeGlobalReplicationGroups
$cfrom :: forall x.
DescribeGlobalReplicationGroups
-> Rep DescribeGlobalReplicationGroups x
Prelude.Generic)

-- |
-- Create a value of 'DescribeGlobalReplicationGroups' 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:
--
-- 'showMemberInfo', 'describeGlobalReplicationGroups_showMemberInfo' - Returns the list of members that comprise the Global datastore.
--
-- 'marker', 'describeGlobalReplicationGroups_marker' - An optional marker returned from a prior request. Use this marker for
-- pagination of results from this operation. If this parameter is
-- specified, the response includes only records beyond the marker, up to
-- the value specified by @MaxRecords@.
--
-- 'maxRecords', 'describeGlobalReplicationGroups_maxRecords' - The maximum number of records to include in the response. If more
-- records exist than the specified MaxRecords value, a marker is included
-- in the response so that the remaining results can be retrieved.
--
-- 'globalReplicationGroupId', 'describeGlobalReplicationGroups_globalReplicationGroupId' - The name of the Global datastore
newDescribeGlobalReplicationGroups ::
  DescribeGlobalReplicationGroups
newDescribeGlobalReplicationGroups :: DescribeGlobalReplicationGroups
newDescribeGlobalReplicationGroups =
  DescribeGlobalReplicationGroups' :: Maybe Bool
-> Maybe Text
-> Maybe Int
-> Maybe Text
-> DescribeGlobalReplicationGroups
DescribeGlobalReplicationGroups'
    { $sel:showMemberInfo:DescribeGlobalReplicationGroups' :: Maybe Bool
showMemberInfo =
        Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:DescribeGlobalReplicationGroups' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxRecords:DescribeGlobalReplicationGroups' :: Maybe Int
maxRecords = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:globalReplicationGroupId:DescribeGlobalReplicationGroups' :: Maybe Text
globalReplicationGroupId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Returns the list of members that comprise the Global datastore.
describeGlobalReplicationGroups_showMemberInfo :: Lens.Lens' DescribeGlobalReplicationGroups (Prelude.Maybe Prelude.Bool)
describeGlobalReplicationGroups_showMemberInfo :: (Maybe Bool -> f (Maybe Bool))
-> DescribeGlobalReplicationGroups
-> f DescribeGlobalReplicationGroups
describeGlobalReplicationGroups_showMemberInfo = (DescribeGlobalReplicationGroups -> Maybe Bool)
-> (DescribeGlobalReplicationGroups
    -> Maybe Bool -> DescribeGlobalReplicationGroups)
-> Lens
     DescribeGlobalReplicationGroups
     DescribeGlobalReplicationGroups
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeGlobalReplicationGroups' {Maybe Bool
showMemberInfo :: Maybe Bool
$sel:showMemberInfo:DescribeGlobalReplicationGroups' :: DescribeGlobalReplicationGroups -> Maybe Bool
showMemberInfo} -> Maybe Bool
showMemberInfo) (\s :: DescribeGlobalReplicationGroups
s@DescribeGlobalReplicationGroups' {} Maybe Bool
a -> DescribeGlobalReplicationGroups
s {$sel:showMemberInfo:DescribeGlobalReplicationGroups' :: Maybe Bool
showMemberInfo = Maybe Bool
a} :: DescribeGlobalReplicationGroups)

-- | An optional marker returned from a prior request. Use this marker for
-- pagination of results from this operation. If this parameter is
-- specified, the response includes only records beyond the marker, up to
-- the value specified by @MaxRecords@.
describeGlobalReplicationGroups_marker :: Lens.Lens' DescribeGlobalReplicationGroups (Prelude.Maybe Prelude.Text)
describeGlobalReplicationGroups_marker :: (Maybe Text -> f (Maybe Text))
-> DescribeGlobalReplicationGroups
-> f DescribeGlobalReplicationGroups
describeGlobalReplicationGroups_marker = (DescribeGlobalReplicationGroups -> Maybe Text)
-> (DescribeGlobalReplicationGroups
    -> Maybe Text -> DescribeGlobalReplicationGroups)
-> Lens
     DescribeGlobalReplicationGroups
     DescribeGlobalReplicationGroups
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeGlobalReplicationGroups' {Maybe Text
marker :: Maybe Text
$sel:marker:DescribeGlobalReplicationGroups' :: DescribeGlobalReplicationGroups -> Maybe Text
marker} -> Maybe Text
marker) (\s :: DescribeGlobalReplicationGroups
s@DescribeGlobalReplicationGroups' {} Maybe Text
a -> DescribeGlobalReplicationGroups
s {$sel:marker:DescribeGlobalReplicationGroups' :: Maybe Text
marker = Maybe Text
a} :: DescribeGlobalReplicationGroups)

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

-- | The name of the Global datastore
describeGlobalReplicationGroups_globalReplicationGroupId :: Lens.Lens' DescribeGlobalReplicationGroups (Prelude.Maybe Prelude.Text)
describeGlobalReplicationGroups_globalReplicationGroupId :: (Maybe Text -> f (Maybe Text))
-> DescribeGlobalReplicationGroups
-> f DescribeGlobalReplicationGroups
describeGlobalReplicationGroups_globalReplicationGroupId = (DescribeGlobalReplicationGroups -> Maybe Text)
-> (DescribeGlobalReplicationGroups
    -> Maybe Text -> DescribeGlobalReplicationGroups)
-> Lens
     DescribeGlobalReplicationGroups
     DescribeGlobalReplicationGroups
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeGlobalReplicationGroups' {Maybe Text
globalReplicationGroupId :: Maybe Text
$sel:globalReplicationGroupId:DescribeGlobalReplicationGroups' :: DescribeGlobalReplicationGroups -> Maybe Text
globalReplicationGroupId} -> Maybe Text
globalReplicationGroupId) (\s :: DescribeGlobalReplicationGroups
s@DescribeGlobalReplicationGroups' {} Maybe Text
a -> DescribeGlobalReplicationGroups
s {$sel:globalReplicationGroupId:DescribeGlobalReplicationGroups' :: Maybe Text
globalReplicationGroupId = Maybe Text
a} :: DescribeGlobalReplicationGroups)

instance
  Core.AWSPager
    DescribeGlobalReplicationGroups
  where
  page :: DescribeGlobalReplicationGroups
-> AWSResponse DescribeGlobalReplicationGroups
-> Maybe DescribeGlobalReplicationGroups
page DescribeGlobalReplicationGroups
rq AWSResponse DescribeGlobalReplicationGroups
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeGlobalReplicationGroups
DescribeGlobalReplicationGroupsResponse
rs
            DescribeGlobalReplicationGroupsResponse
-> Getting
     (First Text) DescribeGlobalReplicationGroupsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeGlobalReplicationGroupsResponse
-> Const (First Text) DescribeGlobalReplicationGroupsResponse
Lens' DescribeGlobalReplicationGroupsResponse (Maybe Text)
describeGlobalReplicationGroupsResponse_marker
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeGlobalReplicationGroupsResponse
 -> Const (First Text) DescribeGlobalReplicationGroupsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting
     (First Text) DescribeGlobalReplicationGroupsResponse 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 DescribeGlobalReplicationGroups
forall a. Maybe a
Prelude.Nothing
    | Maybe [GlobalReplicationGroup] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeGlobalReplicationGroups
DescribeGlobalReplicationGroupsResponse
rs
            DescribeGlobalReplicationGroupsResponse
-> Getting
     (First [GlobalReplicationGroup])
     DescribeGlobalReplicationGroupsResponse
     [GlobalReplicationGroup]
-> Maybe [GlobalReplicationGroup]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [GlobalReplicationGroup]
 -> Const
      (First [GlobalReplicationGroup]) (Maybe [GlobalReplicationGroup]))
-> DescribeGlobalReplicationGroupsResponse
-> Const
     (First [GlobalReplicationGroup])
     DescribeGlobalReplicationGroupsResponse
Lens'
  DescribeGlobalReplicationGroupsResponse
  (Maybe [GlobalReplicationGroup])
describeGlobalReplicationGroupsResponse_globalReplicationGroups
              ((Maybe [GlobalReplicationGroup]
  -> Const
       (First [GlobalReplicationGroup]) (Maybe [GlobalReplicationGroup]))
 -> DescribeGlobalReplicationGroupsResponse
 -> Const
      (First [GlobalReplicationGroup])
      DescribeGlobalReplicationGroupsResponse)
-> (([GlobalReplicationGroup]
     -> Const (First [GlobalReplicationGroup]) [GlobalReplicationGroup])
    -> Maybe [GlobalReplicationGroup]
    -> Const
         (First [GlobalReplicationGroup]) (Maybe [GlobalReplicationGroup]))
-> Getting
     (First [GlobalReplicationGroup])
     DescribeGlobalReplicationGroupsResponse
     [GlobalReplicationGroup]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([GlobalReplicationGroup]
 -> Const (First [GlobalReplicationGroup]) [GlobalReplicationGroup])
-> Maybe [GlobalReplicationGroup]
-> Const
     (First [GlobalReplicationGroup]) (Maybe [GlobalReplicationGroup])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe DescribeGlobalReplicationGroups
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      DescribeGlobalReplicationGroups
-> Maybe DescribeGlobalReplicationGroups
forall a. a -> Maybe a
Prelude.Just (DescribeGlobalReplicationGroups
 -> Maybe DescribeGlobalReplicationGroups)
-> DescribeGlobalReplicationGroups
-> Maybe DescribeGlobalReplicationGroups
forall a b. (a -> b) -> a -> b
Prelude.$
        DescribeGlobalReplicationGroups
rq
          DescribeGlobalReplicationGroups
-> (DescribeGlobalReplicationGroups
    -> DescribeGlobalReplicationGroups)
-> DescribeGlobalReplicationGroups
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> DescribeGlobalReplicationGroups
-> Identity DescribeGlobalReplicationGroups
Lens
  DescribeGlobalReplicationGroups
  DescribeGlobalReplicationGroups
  (Maybe Text)
  (Maybe Text)
describeGlobalReplicationGroups_marker
          ((Maybe Text -> Identity (Maybe Text))
 -> DescribeGlobalReplicationGroups
 -> Identity DescribeGlobalReplicationGroups)
-> Maybe Text
-> DescribeGlobalReplicationGroups
-> DescribeGlobalReplicationGroups
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeGlobalReplicationGroups
DescribeGlobalReplicationGroupsResponse
rs
          DescribeGlobalReplicationGroupsResponse
-> Getting
     (First Text) DescribeGlobalReplicationGroupsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeGlobalReplicationGroupsResponse
-> Const (First Text) DescribeGlobalReplicationGroupsResponse
Lens' DescribeGlobalReplicationGroupsResponse (Maybe Text)
describeGlobalReplicationGroupsResponse_marker
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeGlobalReplicationGroupsResponse
 -> Const (First Text) DescribeGlobalReplicationGroupsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting
     (First Text) DescribeGlobalReplicationGroupsResponse 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
    DescribeGlobalReplicationGroups
  where
  type
    AWSResponse DescribeGlobalReplicationGroups =
      DescribeGlobalReplicationGroupsResponse
  request :: DescribeGlobalReplicationGroups
-> Request DescribeGlobalReplicationGroups
request = Service
-> DescribeGlobalReplicationGroups
-> Request DescribeGlobalReplicationGroups
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeGlobalReplicationGroups
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DescribeGlobalReplicationGroups)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse DescribeGlobalReplicationGroups))
-> Logger
-> Service
-> Proxy DescribeGlobalReplicationGroups
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DescribeGlobalReplicationGroups)))
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
"DescribeGlobalReplicationGroupsResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe Text
-> Maybe [GlobalReplicationGroup]
-> Int
-> DescribeGlobalReplicationGroupsResponse
DescribeGlobalReplicationGroupsResponse'
            (Maybe Text
 -> Maybe [GlobalReplicationGroup]
 -> Int
 -> DescribeGlobalReplicationGroupsResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe [GlobalReplicationGroup]
      -> Int -> DescribeGlobalReplicationGroupsResponse)
forall (f :: * -> *) a b. Functor 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
  (Maybe [GlobalReplicationGroup]
   -> Int -> DescribeGlobalReplicationGroupsResponse)
-> Either String (Maybe [GlobalReplicationGroup])
-> Either String (Int -> DescribeGlobalReplicationGroupsResponse)
forall (f :: * -> *) a b. Applicative f => 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
"GlobalReplicationGroups"
                            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 [GlobalReplicationGroup]))
-> Either String (Maybe [GlobalReplicationGroup])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [GlobalReplicationGroup])
-> [Node] -> Either String (Maybe [GlobalReplicationGroup])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may
                              (Text -> [Node] -> Either String [GlobalReplicationGroup]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"GlobalReplicationGroup")
                        )
            Either String (Int -> DescribeGlobalReplicationGroupsResponse)
-> Either String Int
-> Either String DescribeGlobalReplicationGroupsResponse
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
    DescribeGlobalReplicationGroups

instance
  Prelude.NFData
    DescribeGlobalReplicationGroups

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

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

instance Core.ToQuery DescribeGlobalReplicationGroups where
  toQuery :: DescribeGlobalReplicationGroups -> QueryString
toQuery DescribeGlobalReplicationGroups' {Maybe Bool
Maybe Int
Maybe Text
globalReplicationGroupId :: Maybe Text
maxRecords :: Maybe Int
marker :: Maybe Text
showMemberInfo :: Maybe Bool
$sel:globalReplicationGroupId:DescribeGlobalReplicationGroups' :: DescribeGlobalReplicationGroups -> Maybe Text
$sel:maxRecords:DescribeGlobalReplicationGroups' :: DescribeGlobalReplicationGroups -> Maybe Int
$sel:marker:DescribeGlobalReplicationGroups' :: DescribeGlobalReplicationGroups -> Maybe Text
$sel:showMemberInfo:DescribeGlobalReplicationGroups' :: DescribeGlobalReplicationGroups -> Maybe Bool
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: ( ByteString
"DescribeGlobalReplicationGroups" ::
                      Prelude.ByteString
                  ),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2015-02-02" :: Prelude.ByteString),
        ByteString
"ShowMemberInfo" ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
showMemberInfo,
        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,
        ByteString
"GlobalReplicationGroupId"
          ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
globalReplicationGroupId
      ]

-- | /See:/ 'newDescribeGlobalReplicationGroupsResponse' smart constructor.
data DescribeGlobalReplicationGroupsResponse = DescribeGlobalReplicationGroupsResponse'
  { -- | An optional marker returned from a prior request. Use this marker for
    -- pagination of results from this operation. If this parameter is
    -- specified, the response includes only records beyond the marker, up to
    -- the value specified by MaxRecords. >
    DescribeGlobalReplicationGroupsResponse -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | Indicates the slot configuration and global identifier for each slice
    -- group.
    DescribeGlobalReplicationGroupsResponse
-> Maybe [GlobalReplicationGroup]
globalReplicationGroups :: Prelude.Maybe [GlobalReplicationGroup],
    -- | The response's http status code.
    DescribeGlobalReplicationGroupsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeGlobalReplicationGroupsResponse
-> DescribeGlobalReplicationGroupsResponse -> Bool
(DescribeGlobalReplicationGroupsResponse
 -> DescribeGlobalReplicationGroupsResponse -> Bool)
-> (DescribeGlobalReplicationGroupsResponse
    -> DescribeGlobalReplicationGroupsResponse -> Bool)
-> Eq DescribeGlobalReplicationGroupsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeGlobalReplicationGroupsResponse
-> DescribeGlobalReplicationGroupsResponse -> Bool
$c/= :: DescribeGlobalReplicationGroupsResponse
-> DescribeGlobalReplicationGroupsResponse -> Bool
== :: DescribeGlobalReplicationGroupsResponse
-> DescribeGlobalReplicationGroupsResponse -> Bool
$c== :: DescribeGlobalReplicationGroupsResponse
-> DescribeGlobalReplicationGroupsResponse -> Bool
Prelude.Eq, ReadPrec [DescribeGlobalReplicationGroupsResponse]
ReadPrec DescribeGlobalReplicationGroupsResponse
Int -> ReadS DescribeGlobalReplicationGroupsResponse
ReadS [DescribeGlobalReplicationGroupsResponse]
(Int -> ReadS DescribeGlobalReplicationGroupsResponse)
-> ReadS [DescribeGlobalReplicationGroupsResponse]
-> ReadPrec DescribeGlobalReplicationGroupsResponse
-> ReadPrec [DescribeGlobalReplicationGroupsResponse]
-> Read DescribeGlobalReplicationGroupsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeGlobalReplicationGroupsResponse]
$creadListPrec :: ReadPrec [DescribeGlobalReplicationGroupsResponse]
readPrec :: ReadPrec DescribeGlobalReplicationGroupsResponse
$creadPrec :: ReadPrec DescribeGlobalReplicationGroupsResponse
readList :: ReadS [DescribeGlobalReplicationGroupsResponse]
$creadList :: ReadS [DescribeGlobalReplicationGroupsResponse]
readsPrec :: Int -> ReadS DescribeGlobalReplicationGroupsResponse
$creadsPrec :: Int -> ReadS DescribeGlobalReplicationGroupsResponse
Prelude.Read, Int -> DescribeGlobalReplicationGroupsResponse -> ShowS
[DescribeGlobalReplicationGroupsResponse] -> ShowS
DescribeGlobalReplicationGroupsResponse -> String
(Int -> DescribeGlobalReplicationGroupsResponse -> ShowS)
-> (DescribeGlobalReplicationGroupsResponse -> String)
-> ([DescribeGlobalReplicationGroupsResponse] -> ShowS)
-> Show DescribeGlobalReplicationGroupsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeGlobalReplicationGroupsResponse] -> ShowS
$cshowList :: [DescribeGlobalReplicationGroupsResponse] -> ShowS
show :: DescribeGlobalReplicationGroupsResponse -> String
$cshow :: DescribeGlobalReplicationGroupsResponse -> String
showsPrec :: Int -> DescribeGlobalReplicationGroupsResponse -> ShowS
$cshowsPrec :: Int -> DescribeGlobalReplicationGroupsResponse -> ShowS
Prelude.Show, (forall x.
 DescribeGlobalReplicationGroupsResponse
 -> Rep DescribeGlobalReplicationGroupsResponse x)
-> (forall x.
    Rep DescribeGlobalReplicationGroupsResponse x
    -> DescribeGlobalReplicationGroupsResponse)
-> Generic DescribeGlobalReplicationGroupsResponse
forall x.
Rep DescribeGlobalReplicationGroupsResponse x
-> DescribeGlobalReplicationGroupsResponse
forall x.
DescribeGlobalReplicationGroupsResponse
-> Rep DescribeGlobalReplicationGroupsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeGlobalReplicationGroupsResponse x
-> DescribeGlobalReplicationGroupsResponse
$cfrom :: forall x.
DescribeGlobalReplicationGroupsResponse
-> Rep DescribeGlobalReplicationGroupsResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeGlobalReplicationGroupsResponse' 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:
--
-- 'marker', 'describeGlobalReplicationGroupsResponse_marker' - An optional marker returned from a prior request. Use this marker for
-- pagination of results from this operation. If this parameter is
-- specified, the response includes only records beyond the marker, up to
-- the value specified by MaxRecords. >
--
-- 'globalReplicationGroups', 'describeGlobalReplicationGroupsResponse_globalReplicationGroups' - Indicates the slot configuration and global identifier for each slice
-- group.
--
-- 'httpStatus', 'describeGlobalReplicationGroupsResponse_httpStatus' - The response's http status code.
newDescribeGlobalReplicationGroupsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeGlobalReplicationGroupsResponse
newDescribeGlobalReplicationGroupsResponse :: Int -> DescribeGlobalReplicationGroupsResponse
newDescribeGlobalReplicationGroupsResponse
  Int
pHttpStatus_ =
    DescribeGlobalReplicationGroupsResponse' :: Maybe Text
-> Maybe [GlobalReplicationGroup]
-> Int
-> DescribeGlobalReplicationGroupsResponse
DescribeGlobalReplicationGroupsResponse'
      { $sel:marker:DescribeGlobalReplicationGroupsResponse' :: Maybe Text
marker =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:globalReplicationGroups:DescribeGlobalReplicationGroupsResponse' :: Maybe [GlobalReplicationGroup]
globalReplicationGroups =
          Maybe [GlobalReplicationGroup]
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:DescribeGlobalReplicationGroupsResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | An optional marker returned from a prior request. Use this marker for
-- pagination of results from this operation. If this parameter is
-- specified, the response includes only records beyond the marker, up to
-- the value specified by MaxRecords. >
describeGlobalReplicationGroupsResponse_marker :: Lens.Lens' DescribeGlobalReplicationGroupsResponse (Prelude.Maybe Prelude.Text)
describeGlobalReplicationGroupsResponse_marker :: (Maybe Text -> f (Maybe Text))
-> DescribeGlobalReplicationGroupsResponse
-> f DescribeGlobalReplicationGroupsResponse
describeGlobalReplicationGroupsResponse_marker = (DescribeGlobalReplicationGroupsResponse -> Maybe Text)
-> (DescribeGlobalReplicationGroupsResponse
    -> Maybe Text -> DescribeGlobalReplicationGroupsResponse)
-> Lens' DescribeGlobalReplicationGroupsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeGlobalReplicationGroupsResponse' {Maybe Text
marker :: Maybe Text
$sel:marker:DescribeGlobalReplicationGroupsResponse' :: DescribeGlobalReplicationGroupsResponse -> Maybe Text
marker} -> Maybe Text
marker) (\s :: DescribeGlobalReplicationGroupsResponse
s@DescribeGlobalReplicationGroupsResponse' {} Maybe Text
a -> DescribeGlobalReplicationGroupsResponse
s {$sel:marker:DescribeGlobalReplicationGroupsResponse' :: Maybe Text
marker = Maybe Text
a} :: DescribeGlobalReplicationGroupsResponse)

-- | Indicates the slot configuration and global identifier for each slice
-- group.
describeGlobalReplicationGroupsResponse_globalReplicationGroups :: Lens.Lens' DescribeGlobalReplicationGroupsResponse (Prelude.Maybe [GlobalReplicationGroup])
describeGlobalReplicationGroupsResponse_globalReplicationGroups :: (Maybe [GlobalReplicationGroup]
 -> f (Maybe [GlobalReplicationGroup]))
-> DescribeGlobalReplicationGroupsResponse
-> f DescribeGlobalReplicationGroupsResponse
describeGlobalReplicationGroupsResponse_globalReplicationGroups = (DescribeGlobalReplicationGroupsResponse
 -> Maybe [GlobalReplicationGroup])
-> (DescribeGlobalReplicationGroupsResponse
    -> Maybe [GlobalReplicationGroup]
    -> DescribeGlobalReplicationGroupsResponse)
-> Lens'
     DescribeGlobalReplicationGroupsResponse
     (Maybe [GlobalReplicationGroup])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeGlobalReplicationGroupsResponse' {Maybe [GlobalReplicationGroup]
globalReplicationGroups :: Maybe [GlobalReplicationGroup]
$sel:globalReplicationGroups:DescribeGlobalReplicationGroupsResponse' :: DescribeGlobalReplicationGroupsResponse
-> Maybe [GlobalReplicationGroup]
globalReplicationGroups} -> Maybe [GlobalReplicationGroup]
globalReplicationGroups) (\s :: DescribeGlobalReplicationGroupsResponse
s@DescribeGlobalReplicationGroupsResponse' {} Maybe [GlobalReplicationGroup]
a -> DescribeGlobalReplicationGroupsResponse
s {$sel:globalReplicationGroups:DescribeGlobalReplicationGroupsResponse' :: Maybe [GlobalReplicationGroup]
globalReplicationGroups = Maybe [GlobalReplicationGroup]
a} :: DescribeGlobalReplicationGroupsResponse) ((Maybe [GlobalReplicationGroup]
  -> f (Maybe [GlobalReplicationGroup]))
 -> DescribeGlobalReplicationGroupsResponse
 -> f DescribeGlobalReplicationGroupsResponse)
-> ((Maybe [GlobalReplicationGroup]
     -> f (Maybe [GlobalReplicationGroup]))
    -> Maybe [GlobalReplicationGroup]
    -> f (Maybe [GlobalReplicationGroup]))
-> (Maybe [GlobalReplicationGroup]
    -> f (Maybe [GlobalReplicationGroup]))
-> DescribeGlobalReplicationGroupsResponse
-> f DescribeGlobalReplicationGroupsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [GlobalReplicationGroup]
  [GlobalReplicationGroup]
  [GlobalReplicationGroup]
  [GlobalReplicationGroup]
-> Iso
     (Maybe [GlobalReplicationGroup])
     (Maybe [GlobalReplicationGroup])
     (Maybe [GlobalReplicationGroup])
     (Maybe [GlobalReplicationGroup])
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
  [GlobalReplicationGroup]
  [GlobalReplicationGroup]
  [GlobalReplicationGroup]
  [GlobalReplicationGroup]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    DescribeGlobalReplicationGroupsResponse