{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# 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.Types.GlobalReplicationGroupInfo
-- 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)
module Amazonka.ElastiCache.Types.GlobalReplicationGroupInfo where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The name of the Global datastore and role of this replication group in
-- the Global datastore.
--
-- /See:/ 'newGlobalReplicationGroupInfo' smart constructor.
data GlobalReplicationGroupInfo = GlobalReplicationGroupInfo'
  { -- | The role of the replication group in a Global datastore. Can be primary
    -- or secondary.
    GlobalReplicationGroupInfo -> Maybe Text
globalReplicationGroupMemberRole :: Prelude.Maybe Prelude.Text,
    -- | The name of the Global datastore
    GlobalReplicationGroupInfo -> Maybe Text
globalReplicationGroupId :: Prelude.Maybe Prelude.Text
  }
  deriving (GlobalReplicationGroupInfo -> GlobalReplicationGroupInfo -> Bool
(GlobalReplicationGroupInfo -> GlobalReplicationGroupInfo -> Bool)
-> (GlobalReplicationGroupInfo
    -> GlobalReplicationGroupInfo -> Bool)
-> Eq GlobalReplicationGroupInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GlobalReplicationGroupInfo -> GlobalReplicationGroupInfo -> Bool
$c/= :: GlobalReplicationGroupInfo -> GlobalReplicationGroupInfo -> Bool
== :: GlobalReplicationGroupInfo -> GlobalReplicationGroupInfo -> Bool
$c== :: GlobalReplicationGroupInfo -> GlobalReplicationGroupInfo -> Bool
Prelude.Eq, ReadPrec [GlobalReplicationGroupInfo]
ReadPrec GlobalReplicationGroupInfo
Int -> ReadS GlobalReplicationGroupInfo
ReadS [GlobalReplicationGroupInfo]
(Int -> ReadS GlobalReplicationGroupInfo)
-> ReadS [GlobalReplicationGroupInfo]
-> ReadPrec GlobalReplicationGroupInfo
-> ReadPrec [GlobalReplicationGroupInfo]
-> Read GlobalReplicationGroupInfo
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GlobalReplicationGroupInfo]
$creadListPrec :: ReadPrec [GlobalReplicationGroupInfo]
readPrec :: ReadPrec GlobalReplicationGroupInfo
$creadPrec :: ReadPrec GlobalReplicationGroupInfo
readList :: ReadS [GlobalReplicationGroupInfo]
$creadList :: ReadS [GlobalReplicationGroupInfo]
readsPrec :: Int -> ReadS GlobalReplicationGroupInfo
$creadsPrec :: Int -> ReadS GlobalReplicationGroupInfo
Prelude.Read, Int -> GlobalReplicationGroupInfo -> ShowS
[GlobalReplicationGroupInfo] -> ShowS
GlobalReplicationGroupInfo -> String
(Int -> GlobalReplicationGroupInfo -> ShowS)
-> (GlobalReplicationGroupInfo -> String)
-> ([GlobalReplicationGroupInfo] -> ShowS)
-> Show GlobalReplicationGroupInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GlobalReplicationGroupInfo] -> ShowS
$cshowList :: [GlobalReplicationGroupInfo] -> ShowS
show :: GlobalReplicationGroupInfo -> String
$cshow :: GlobalReplicationGroupInfo -> String
showsPrec :: Int -> GlobalReplicationGroupInfo -> ShowS
$cshowsPrec :: Int -> GlobalReplicationGroupInfo -> ShowS
Prelude.Show, (forall x.
 GlobalReplicationGroupInfo -> Rep GlobalReplicationGroupInfo x)
-> (forall x.
    Rep GlobalReplicationGroupInfo x -> GlobalReplicationGroupInfo)
-> Generic GlobalReplicationGroupInfo
forall x.
Rep GlobalReplicationGroupInfo x -> GlobalReplicationGroupInfo
forall x.
GlobalReplicationGroupInfo -> Rep GlobalReplicationGroupInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GlobalReplicationGroupInfo x -> GlobalReplicationGroupInfo
$cfrom :: forall x.
GlobalReplicationGroupInfo -> Rep GlobalReplicationGroupInfo x
Prelude.Generic)

-- |
-- Create a value of 'GlobalReplicationGroupInfo' 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:
--
-- 'globalReplicationGroupMemberRole', 'globalReplicationGroupInfo_globalReplicationGroupMemberRole' - The role of the replication group in a Global datastore. Can be primary
-- or secondary.
--
-- 'globalReplicationGroupId', 'globalReplicationGroupInfo_globalReplicationGroupId' - The name of the Global datastore
newGlobalReplicationGroupInfo ::
  GlobalReplicationGroupInfo
newGlobalReplicationGroupInfo :: GlobalReplicationGroupInfo
newGlobalReplicationGroupInfo =
  GlobalReplicationGroupInfo' :: Maybe Text -> Maybe Text -> GlobalReplicationGroupInfo
GlobalReplicationGroupInfo'
    { $sel:globalReplicationGroupMemberRole:GlobalReplicationGroupInfo' :: Maybe Text
globalReplicationGroupMemberRole =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:globalReplicationGroupId:GlobalReplicationGroupInfo' :: Maybe Text
globalReplicationGroupId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The role of the replication group in a Global datastore. Can be primary
-- or secondary.
globalReplicationGroupInfo_globalReplicationGroupMemberRole :: Lens.Lens' GlobalReplicationGroupInfo (Prelude.Maybe Prelude.Text)
globalReplicationGroupInfo_globalReplicationGroupMemberRole :: (Maybe Text -> f (Maybe Text))
-> GlobalReplicationGroupInfo -> f GlobalReplicationGroupInfo
globalReplicationGroupInfo_globalReplicationGroupMemberRole = (GlobalReplicationGroupInfo -> Maybe Text)
-> (GlobalReplicationGroupInfo
    -> Maybe Text -> GlobalReplicationGroupInfo)
-> Lens
     GlobalReplicationGroupInfo
     GlobalReplicationGroupInfo
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GlobalReplicationGroupInfo' {Maybe Text
globalReplicationGroupMemberRole :: Maybe Text
$sel:globalReplicationGroupMemberRole:GlobalReplicationGroupInfo' :: GlobalReplicationGroupInfo -> Maybe Text
globalReplicationGroupMemberRole} -> Maybe Text
globalReplicationGroupMemberRole) (\s :: GlobalReplicationGroupInfo
s@GlobalReplicationGroupInfo' {} Maybe Text
a -> GlobalReplicationGroupInfo
s {$sel:globalReplicationGroupMemberRole:GlobalReplicationGroupInfo' :: Maybe Text
globalReplicationGroupMemberRole = Maybe Text
a} :: GlobalReplicationGroupInfo)

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

instance Core.FromXML GlobalReplicationGroupInfo where
  parseXML :: [Node] -> Either String GlobalReplicationGroupInfo
parseXML [Node]
x =
    Maybe Text -> Maybe Text -> GlobalReplicationGroupInfo
GlobalReplicationGroupInfo'
      (Maybe Text -> Maybe Text -> GlobalReplicationGroupInfo)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> GlobalReplicationGroupInfo)
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
"GlobalReplicationGroupMemberRole")
      Either String (Maybe Text -> GlobalReplicationGroupInfo)
-> Either String (Maybe Text)
-> Either String GlobalReplicationGroupInfo
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
"GlobalReplicationGroupId")

instance Prelude.Hashable GlobalReplicationGroupInfo

instance Prelude.NFData GlobalReplicationGroupInfo