{-# 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.ReshardingConfiguration
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.ElastiCache.Types.ReshardingConfiguration where

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

-- | A list of @PreferredAvailabilityZones@ objects that specifies the
-- configuration of a node group in the resharded cluster.
--
-- /See:/ 'newReshardingConfiguration' smart constructor.
data ReshardingConfiguration = ReshardingConfiguration'
  { -- | Either the ElastiCache for Redis supplied 4-digit id or a user supplied
    -- id for the node group these configuration values apply to.
    ReshardingConfiguration -> Maybe Text
nodeGroupId :: Prelude.Maybe Prelude.Text,
    -- | A list of preferred availability zones for the nodes in this cluster.
    ReshardingConfiguration -> Maybe [Text]
preferredAvailabilityZones :: Prelude.Maybe [Prelude.Text]
  }
  deriving (ReshardingConfiguration -> ReshardingConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ReshardingConfiguration -> ReshardingConfiguration -> Bool
$c/= :: ReshardingConfiguration -> ReshardingConfiguration -> Bool
== :: ReshardingConfiguration -> ReshardingConfiguration -> Bool
$c== :: ReshardingConfiguration -> ReshardingConfiguration -> Bool
Prelude.Eq, ReadPrec [ReshardingConfiguration]
ReadPrec ReshardingConfiguration
Int -> ReadS ReshardingConfiguration
ReadS [ReshardingConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ReshardingConfiguration]
$creadListPrec :: ReadPrec [ReshardingConfiguration]
readPrec :: ReadPrec ReshardingConfiguration
$creadPrec :: ReadPrec ReshardingConfiguration
readList :: ReadS [ReshardingConfiguration]
$creadList :: ReadS [ReshardingConfiguration]
readsPrec :: Int -> ReadS ReshardingConfiguration
$creadsPrec :: Int -> ReadS ReshardingConfiguration
Prelude.Read, Int -> ReshardingConfiguration -> ShowS
[ReshardingConfiguration] -> ShowS
ReshardingConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ReshardingConfiguration] -> ShowS
$cshowList :: [ReshardingConfiguration] -> ShowS
show :: ReshardingConfiguration -> String
$cshow :: ReshardingConfiguration -> String
showsPrec :: Int -> ReshardingConfiguration -> ShowS
$cshowsPrec :: Int -> ReshardingConfiguration -> ShowS
Prelude.Show, forall x. Rep ReshardingConfiguration x -> ReshardingConfiguration
forall x. ReshardingConfiguration -> Rep ReshardingConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ReshardingConfiguration x -> ReshardingConfiguration
$cfrom :: forall x. ReshardingConfiguration -> Rep ReshardingConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'ReshardingConfiguration' 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:
--
-- 'nodeGroupId', 'reshardingConfiguration_nodeGroupId' - Either the ElastiCache for Redis supplied 4-digit id or a user supplied
-- id for the node group these configuration values apply to.
--
-- 'preferredAvailabilityZones', 'reshardingConfiguration_preferredAvailabilityZones' - A list of preferred availability zones for the nodes in this cluster.
newReshardingConfiguration ::
  ReshardingConfiguration
newReshardingConfiguration :: ReshardingConfiguration
newReshardingConfiguration =
  ReshardingConfiguration'
    { $sel:nodeGroupId:ReshardingConfiguration' :: Maybe Text
nodeGroupId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:preferredAvailabilityZones:ReshardingConfiguration' :: Maybe [Text]
preferredAvailabilityZones = forall a. Maybe a
Prelude.Nothing
    }

-- | Either the ElastiCache for Redis supplied 4-digit id or a user supplied
-- id for the node group these configuration values apply to.
reshardingConfiguration_nodeGroupId :: Lens.Lens' ReshardingConfiguration (Prelude.Maybe Prelude.Text)
reshardingConfiguration_nodeGroupId :: Lens' ReshardingConfiguration (Maybe Text)
reshardingConfiguration_nodeGroupId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReshardingConfiguration' {Maybe Text
nodeGroupId :: Maybe Text
$sel:nodeGroupId:ReshardingConfiguration' :: ReshardingConfiguration -> Maybe Text
nodeGroupId} -> Maybe Text
nodeGroupId) (\s :: ReshardingConfiguration
s@ReshardingConfiguration' {} Maybe Text
a -> ReshardingConfiguration
s {$sel:nodeGroupId:ReshardingConfiguration' :: Maybe Text
nodeGroupId = Maybe Text
a} :: ReshardingConfiguration)

-- | A list of preferred availability zones for the nodes in this cluster.
reshardingConfiguration_preferredAvailabilityZones :: Lens.Lens' ReshardingConfiguration (Prelude.Maybe [Prelude.Text])
reshardingConfiguration_preferredAvailabilityZones :: Lens' ReshardingConfiguration (Maybe [Text])
reshardingConfiguration_preferredAvailabilityZones = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReshardingConfiguration' {Maybe [Text]
preferredAvailabilityZones :: Maybe [Text]
$sel:preferredAvailabilityZones:ReshardingConfiguration' :: ReshardingConfiguration -> Maybe [Text]
preferredAvailabilityZones} -> Maybe [Text]
preferredAvailabilityZones) (\s :: ReshardingConfiguration
s@ReshardingConfiguration' {} Maybe [Text]
a -> ReshardingConfiguration
s {$sel:preferredAvailabilityZones:ReshardingConfiguration' :: Maybe [Text]
preferredAvailabilityZones = Maybe [Text]
a} :: ReshardingConfiguration) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.Hashable ReshardingConfiguration where
  hashWithSalt :: Int -> ReshardingConfiguration -> Int
hashWithSalt Int
_salt ReshardingConfiguration' {Maybe [Text]
Maybe Text
preferredAvailabilityZones :: Maybe [Text]
nodeGroupId :: Maybe Text
$sel:preferredAvailabilityZones:ReshardingConfiguration' :: ReshardingConfiguration -> Maybe [Text]
$sel:nodeGroupId:ReshardingConfiguration' :: ReshardingConfiguration -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nodeGroupId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
preferredAvailabilityZones

instance Prelude.NFData ReshardingConfiguration where
  rnf :: ReshardingConfiguration -> ()
rnf ReshardingConfiguration' {Maybe [Text]
Maybe Text
preferredAvailabilityZones :: Maybe [Text]
nodeGroupId :: Maybe Text
$sel:preferredAvailabilityZones:ReshardingConfiguration' :: ReshardingConfiguration -> Maybe [Text]
$sel:nodeGroupId:ReshardingConfiguration' :: ReshardingConfiguration -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nodeGroupId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
preferredAvailabilityZones

instance Data.ToQuery ReshardingConfiguration where
  toQuery :: ReshardingConfiguration -> QueryString
toQuery ReshardingConfiguration' {Maybe [Text]
Maybe Text
preferredAvailabilityZones :: Maybe [Text]
nodeGroupId :: Maybe Text
$sel:preferredAvailabilityZones:ReshardingConfiguration' :: ReshardingConfiguration -> Maybe [Text]
$sel:nodeGroupId:ReshardingConfiguration' :: ReshardingConfiguration -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"NodeGroupId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
nodeGroupId,
        ByteString
"PreferredAvailabilityZones"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: forall a. ToQuery a => a -> QueryString
Data.toQuery
            ( forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Data.toQueryList ByteString
"AvailabilityZone"
                forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
preferredAvailabilityZones
            )
      ]