{-# 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.RegionalConfiguration
-- 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.RegionalConfiguration where

import qualified Amazonka.Core as Core
import Amazonka.ElastiCache.Types.ReshardingConfiguration
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A list of the replication groups
--
-- /See:/ 'newRegionalConfiguration' smart constructor.
data RegionalConfiguration = RegionalConfiguration'
  { -- | The name of the secondary cluster
    RegionalConfiguration -> Text
replicationGroupId :: Prelude.Text,
    -- | The Amazon region where the cluster is stored
    RegionalConfiguration -> Text
replicationGroupRegion :: Prelude.Text,
    -- | A list of @PreferredAvailabilityZones@ objects that specifies the
    -- configuration of a node group in the resharded cluster.
    RegionalConfiguration -> [ReshardingConfiguration]
reshardingConfiguration :: [ReshardingConfiguration]
  }
  deriving (RegionalConfiguration -> RegionalConfiguration -> Bool
(RegionalConfiguration -> RegionalConfiguration -> Bool)
-> (RegionalConfiguration -> RegionalConfiguration -> Bool)
-> Eq RegionalConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RegionalConfiguration -> RegionalConfiguration -> Bool
$c/= :: RegionalConfiguration -> RegionalConfiguration -> Bool
== :: RegionalConfiguration -> RegionalConfiguration -> Bool
$c== :: RegionalConfiguration -> RegionalConfiguration -> Bool
Prelude.Eq, ReadPrec [RegionalConfiguration]
ReadPrec RegionalConfiguration
Int -> ReadS RegionalConfiguration
ReadS [RegionalConfiguration]
(Int -> ReadS RegionalConfiguration)
-> ReadS [RegionalConfiguration]
-> ReadPrec RegionalConfiguration
-> ReadPrec [RegionalConfiguration]
-> Read RegionalConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RegionalConfiguration]
$creadListPrec :: ReadPrec [RegionalConfiguration]
readPrec :: ReadPrec RegionalConfiguration
$creadPrec :: ReadPrec RegionalConfiguration
readList :: ReadS [RegionalConfiguration]
$creadList :: ReadS [RegionalConfiguration]
readsPrec :: Int -> ReadS RegionalConfiguration
$creadsPrec :: Int -> ReadS RegionalConfiguration
Prelude.Read, Int -> RegionalConfiguration -> ShowS
[RegionalConfiguration] -> ShowS
RegionalConfiguration -> String
(Int -> RegionalConfiguration -> ShowS)
-> (RegionalConfiguration -> String)
-> ([RegionalConfiguration] -> ShowS)
-> Show RegionalConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RegionalConfiguration] -> ShowS
$cshowList :: [RegionalConfiguration] -> ShowS
show :: RegionalConfiguration -> String
$cshow :: RegionalConfiguration -> String
showsPrec :: Int -> RegionalConfiguration -> ShowS
$cshowsPrec :: Int -> RegionalConfiguration -> ShowS
Prelude.Show, (forall x. RegionalConfiguration -> Rep RegionalConfiguration x)
-> (forall x. Rep RegionalConfiguration x -> RegionalConfiguration)
-> Generic RegionalConfiguration
forall x. Rep RegionalConfiguration x -> RegionalConfiguration
forall x. RegionalConfiguration -> Rep RegionalConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RegionalConfiguration x -> RegionalConfiguration
$cfrom :: forall x. RegionalConfiguration -> Rep RegionalConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'RegionalConfiguration' 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:
--
-- 'replicationGroupId', 'regionalConfiguration_replicationGroupId' - The name of the secondary cluster
--
-- 'replicationGroupRegion', 'regionalConfiguration_replicationGroupRegion' - The Amazon region where the cluster is stored
--
-- 'reshardingConfiguration', 'regionalConfiguration_reshardingConfiguration' - A list of @PreferredAvailabilityZones@ objects that specifies the
-- configuration of a node group in the resharded cluster.
newRegionalConfiguration ::
  -- | 'replicationGroupId'
  Prelude.Text ->
  -- | 'replicationGroupRegion'
  Prelude.Text ->
  RegionalConfiguration
newRegionalConfiguration :: Text -> Text -> RegionalConfiguration
newRegionalConfiguration
  Text
pReplicationGroupId_
  Text
pReplicationGroupRegion_ =
    RegionalConfiguration' :: Text -> Text -> [ReshardingConfiguration] -> RegionalConfiguration
RegionalConfiguration'
      { $sel:replicationGroupId:RegionalConfiguration' :: Text
replicationGroupId =
          Text
pReplicationGroupId_,
        $sel:replicationGroupRegion:RegionalConfiguration' :: Text
replicationGroupRegion = Text
pReplicationGroupRegion_,
        $sel:reshardingConfiguration:RegionalConfiguration' :: [ReshardingConfiguration]
reshardingConfiguration = [ReshardingConfiguration]
forall a. Monoid a => a
Prelude.mempty
      }

-- | The name of the secondary cluster
regionalConfiguration_replicationGroupId :: Lens.Lens' RegionalConfiguration Prelude.Text
regionalConfiguration_replicationGroupId :: (Text -> f Text)
-> RegionalConfiguration -> f RegionalConfiguration
regionalConfiguration_replicationGroupId = (RegionalConfiguration -> Text)
-> (RegionalConfiguration -> Text -> RegionalConfiguration)
-> Lens RegionalConfiguration RegionalConfiguration Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegionalConfiguration' {Text
replicationGroupId :: Text
$sel:replicationGroupId:RegionalConfiguration' :: RegionalConfiguration -> Text
replicationGroupId} -> Text
replicationGroupId) (\s :: RegionalConfiguration
s@RegionalConfiguration' {} Text
a -> RegionalConfiguration
s {$sel:replicationGroupId:RegionalConfiguration' :: Text
replicationGroupId = Text
a} :: RegionalConfiguration)

-- | The Amazon region where the cluster is stored
regionalConfiguration_replicationGroupRegion :: Lens.Lens' RegionalConfiguration Prelude.Text
regionalConfiguration_replicationGroupRegion :: (Text -> f Text)
-> RegionalConfiguration -> f RegionalConfiguration
regionalConfiguration_replicationGroupRegion = (RegionalConfiguration -> Text)
-> (RegionalConfiguration -> Text -> RegionalConfiguration)
-> Lens RegionalConfiguration RegionalConfiguration Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegionalConfiguration' {Text
replicationGroupRegion :: Text
$sel:replicationGroupRegion:RegionalConfiguration' :: RegionalConfiguration -> Text
replicationGroupRegion} -> Text
replicationGroupRegion) (\s :: RegionalConfiguration
s@RegionalConfiguration' {} Text
a -> RegionalConfiguration
s {$sel:replicationGroupRegion:RegionalConfiguration' :: Text
replicationGroupRegion = Text
a} :: RegionalConfiguration)

-- | A list of @PreferredAvailabilityZones@ objects that specifies the
-- configuration of a node group in the resharded cluster.
regionalConfiguration_reshardingConfiguration :: Lens.Lens' RegionalConfiguration [ReshardingConfiguration]
regionalConfiguration_reshardingConfiguration :: ([ReshardingConfiguration] -> f [ReshardingConfiguration])
-> RegionalConfiguration -> f RegionalConfiguration
regionalConfiguration_reshardingConfiguration = (RegionalConfiguration -> [ReshardingConfiguration])
-> (RegionalConfiguration
    -> [ReshardingConfiguration] -> RegionalConfiguration)
-> Lens
     RegionalConfiguration
     RegionalConfiguration
     [ReshardingConfiguration]
     [ReshardingConfiguration]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegionalConfiguration' {[ReshardingConfiguration]
reshardingConfiguration :: [ReshardingConfiguration]
$sel:reshardingConfiguration:RegionalConfiguration' :: RegionalConfiguration -> [ReshardingConfiguration]
reshardingConfiguration} -> [ReshardingConfiguration]
reshardingConfiguration) (\s :: RegionalConfiguration
s@RegionalConfiguration' {} [ReshardingConfiguration]
a -> RegionalConfiguration
s {$sel:reshardingConfiguration:RegionalConfiguration' :: [ReshardingConfiguration]
reshardingConfiguration = [ReshardingConfiguration]
a} :: RegionalConfiguration) (([ReshardingConfiguration] -> f [ReshardingConfiguration])
 -> RegionalConfiguration -> f RegionalConfiguration)
-> (([ReshardingConfiguration] -> f [ReshardingConfiguration])
    -> [ReshardingConfiguration] -> f [ReshardingConfiguration])
-> ([ReshardingConfiguration] -> f [ReshardingConfiguration])
-> RegionalConfiguration
-> f RegionalConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ReshardingConfiguration] -> f [ReshardingConfiguration])
-> [ReshardingConfiguration] -> f [ReshardingConfiguration]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.Hashable RegionalConfiguration

instance Prelude.NFData RegionalConfiguration

instance Core.ToQuery RegionalConfiguration where
  toQuery :: RegionalConfiguration -> QueryString
toQuery RegionalConfiguration' {[ReshardingConfiguration]
Text
reshardingConfiguration :: [ReshardingConfiguration]
replicationGroupRegion :: Text
replicationGroupId :: Text
$sel:reshardingConfiguration:RegionalConfiguration' :: RegionalConfiguration -> [ReshardingConfiguration]
$sel:replicationGroupRegion:RegionalConfiguration' :: RegionalConfiguration -> Text
$sel:replicationGroupId:RegionalConfiguration' :: RegionalConfiguration -> Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"ReplicationGroupId" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
replicationGroupId,
        ByteString
"ReplicationGroupRegion"
          ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
replicationGroupRegion,
        ByteString
"ReshardingConfiguration"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: ByteString -> [ReshardingConfiguration] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList
            ByteString
"ReshardingConfiguration"
            [ReshardingConfiguration]
reshardingConfiguration
      ]