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

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

-- | Node group (shard) configuration options. Each node group (shard)
-- configuration has the following: @Slots@, @PrimaryAvailabilityZone@,
-- @ReplicaAvailabilityZones@, @ReplicaCount@.
--
-- /See:/ 'newNodeGroupConfiguration' smart constructor.
data NodeGroupConfiguration = NodeGroupConfiguration'
  { -- | A string that specifies the keyspace for a particular node group.
    -- Keyspaces range from 0 to 16,383. The string is in the format
    -- @startkey-endkey@.
    --
    -- Example: @\"0-3999\"@
    NodeGroupConfiguration -> Maybe Text
slots :: Prelude.Maybe Prelude.Text,
    -- | The outpost ARN of the node replicas.
    NodeGroupConfiguration -> Maybe [Text]
replicaOutpostArns :: Prelude.Maybe [Prelude.Text],
    -- | The number of read replica nodes in this node group (shard).
    NodeGroupConfiguration -> Maybe Int
replicaCount :: Prelude.Maybe Prelude.Int,
    -- | The Availability Zone where the primary node of this node group (shard)
    -- is launched.
    NodeGroupConfiguration -> Maybe Text
primaryAvailabilityZone :: Prelude.Maybe Prelude.Text,
    -- | A list of Availability Zones to be used for the read replicas. The
    -- number of Availability Zones in this list must match the value of
    -- @ReplicaCount@ or @ReplicasPerNodeGroup@ if not specified.
    NodeGroupConfiguration -> Maybe [Text]
replicaAvailabilityZones :: Prelude.Maybe [Prelude.Text],
    -- | The outpost ARN of the primary node.
    NodeGroupConfiguration -> Maybe Text
primaryOutpostArn :: Prelude.Maybe Prelude.Text,
    -- | Either the ElastiCache for Redis supplied 4-digit id or a user supplied
    -- id for the node group these configuration values apply to.
    NodeGroupConfiguration -> Maybe Text
nodeGroupId :: Prelude.Maybe Prelude.Text
  }
  deriving (NodeGroupConfiguration -> NodeGroupConfiguration -> Bool
(NodeGroupConfiguration -> NodeGroupConfiguration -> Bool)
-> (NodeGroupConfiguration -> NodeGroupConfiguration -> Bool)
-> Eq NodeGroupConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NodeGroupConfiguration -> NodeGroupConfiguration -> Bool
$c/= :: NodeGroupConfiguration -> NodeGroupConfiguration -> Bool
== :: NodeGroupConfiguration -> NodeGroupConfiguration -> Bool
$c== :: NodeGroupConfiguration -> NodeGroupConfiguration -> Bool
Prelude.Eq, ReadPrec [NodeGroupConfiguration]
ReadPrec NodeGroupConfiguration
Int -> ReadS NodeGroupConfiguration
ReadS [NodeGroupConfiguration]
(Int -> ReadS NodeGroupConfiguration)
-> ReadS [NodeGroupConfiguration]
-> ReadPrec NodeGroupConfiguration
-> ReadPrec [NodeGroupConfiguration]
-> Read NodeGroupConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NodeGroupConfiguration]
$creadListPrec :: ReadPrec [NodeGroupConfiguration]
readPrec :: ReadPrec NodeGroupConfiguration
$creadPrec :: ReadPrec NodeGroupConfiguration
readList :: ReadS [NodeGroupConfiguration]
$creadList :: ReadS [NodeGroupConfiguration]
readsPrec :: Int -> ReadS NodeGroupConfiguration
$creadsPrec :: Int -> ReadS NodeGroupConfiguration
Prelude.Read, Int -> NodeGroupConfiguration -> ShowS
[NodeGroupConfiguration] -> ShowS
NodeGroupConfiguration -> String
(Int -> NodeGroupConfiguration -> ShowS)
-> (NodeGroupConfiguration -> String)
-> ([NodeGroupConfiguration] -> ShowS)
-> Show NodeGroupConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NodeGroupConfiguration] -> ShowS
$cshowList :: [NodeGroupConfiguration] -> ShowS
show :: NodeGroupConfiguration -> String
$cshow :: NodeGroupConfiguration -> String
showsPrec :: Int -> NodeGroupConfiguration -> ShowS
$cshowsPrec :: Int -> NodeGroupConfiguration -> ShowS
Prelude.Show, (forall x. NodeGroupConfiguration -> Rep NodeGroupConfiguration x)
-> (forall x.
    Rep NodeGroupConfiguration x -> NodeGroupConfiguration)
-> Generic NodeGroupConfiguration
forall x. Rep NodeGroupConfiguration x -> NodeGroupConfiguration
forall x. NodeGroupConfiguration -> Rep NodeGroupConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NodeGroupConfiguration x -> NodeGroupConfiguration
$cfrom :: forall x. NodeGroupConfiguration -> Rep NodeGroupConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'NodeGroupConfiguration' 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:
--
-- 'slots', 'nodeGroupConfiguration_slots' - A string that specifies the keyspace for a particular node group.
-- Keyspaces range from 0 to 16,383. The string is in the format
-- @startkey-endkey@.
--
-- Example: @\"0-3999\"@
--
-- 'replicaOutpostArns', 'nodeGroupConfiguration_replicaOutpostArns' - The outpost ARN of the node replicas.
--
-- 'replicaCount', 'nodeGroupConfiguration_replicaCount' - The number of read replica nodes in this node group (shard).
--
-- 'primaryAvailabilityZone', 'nodeGroupConfiguration_primaryAvailabilityZone' - The Availability Zone where the primary node of this node group (shard)
-- is launched.
--
-- 'replicaAvailabilityZones', 'nodeGroupConfiguration_replicaAvailabilityZones' - A list of Availability Zones to be used for the read replicas. The
-- number of Availability Zones in this list must match the value of
-- @ReplicaCount@ or @ReplicasPerNodeGroup@ if not specified.
--
-- 'primaryOutpostArn', 'nodeGroupConfiguration_primaryOutpostArn' - The outpost ARN of the primary node.
--
-- 'nodeGroupId', 'nodeGroupConfiguration_nodeGroupId' - Either the ElastiCache for Redis supplied 4-digit id or a user supplied
-- id for the node group these configuration values apply to.
newNodeGroupConfiguration ::
  NodeGroupConfiguration
newNodeGroupConfiguration :: NodeGroupConfiguration
newNodeGroupConfiguration =
  NodeGroupConfiguration' :: Maybe Text
-> Maybe [Text]
-> Maybe Int
-> Maybe Text
-> Maybe [Text]
-> Maybe Text
-> Maybe Text
-> NodeGroupConfiguration
NodeGroupConfiguration'
    { $sel:slots:NodeGroupConfiguration' :: Maybe Text
slots = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:replicaOutpostArns:NodeGroupConfiguration' :: Maybe [Text]
replicaOutpostArns = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:replicaCount:NodeGroupConfiguration' :: Maybe Int
replicaCount = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:primaryAvailabilityZone:NodeGroupConfiguration' :: Maybe Text
primaryAvailabilityZone = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:replicaAvailabilityZones:NodeGroupConfiguration' :: Maybe [Text]
replicaAvailabilityZones = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:primaryOutpostArn:NodeGroupConfiguration' :: Maybe Text
primaryOutpostArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nodeGroupId:NodeGroupConfiguration' :: Maybe Text
nodeGroupId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | A string that specifies the keyspace for a particular node group.
-- Keyspaces range from 0 to 16,383. The string is in the format
-- @startkey-endkey@.
--
-- Example: @\"0-3999\"@
nodeGroupConfiguration_slots :: Lens.Lens' NodeGroupConfiguration (Prelude.Maybe Prelude.Text)
nodeGroupConfiguration_slots :: (Maybe Text -> f (Maybe Text))
-> NodeGroupConfiguration -> f NodeGroupConfiguration
nodeGroupConfiguration_slots = (NodeGroupConfiguration -> Maybe Text)
-> (NodeGroupConfiguration -> Maybe Text -> NodeGroupConfiguration)
-> Lens
     NodeGroupConfiguration
     NodeGroupConfiguration
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeGroupConfiguration' {Maybe Text
slots :: Maybe Text
$sel:slots:NodeGroupConfiguration' :: NodeGroupConfiguration -> Maybe Text
slots} -> Maybe Text
slots) (\s :: NodeGroupConfiguration
s@NodeGroupConfiguration' {} Maybe Text
a -> NodeGroupConfiguration
s {$sel:slots:NodeGroupConfiguration' :: Maybe Text
slots = Maybe Text
a} :: NodeGroupConfiguration)

-- | The outpost ARN of the node replicas.
nodeGroupConfiguration_replicaOutpostArns :: Lens.Lens' NodeGroupConfiguration (Prelude.Maybe [Prelude.Text])
nodeGroupConfiguration_replicaOutpostArns :: (Maybe [Text] -> f (Maybe [Text]))
-> NodeGroupConfiguration -> f NodeGroupConfiguration
nodeGroupConfiguration_replicaOutpostArns = (NodeGroupConfiguration -> Maybe [Text])
-> (NodeGroupConfiguration
    -> Maybe [Text] -> NodeGroupConfiguration)
-> Lens
     NodeGroupConfiguration
     NodeGroupConfiguration
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeGroupConfiguration' {Maybe [Text]
replicaOutpostArns :: Maybe [Text]
$sel:replicaOutpostArns:NodeGroupConfiguration' :: NodeGroupConfiguration -> Maybe [Text]
replicaOutpostArns} -> Maybe [Text]
replicaOutpostArns) (\s :: NodeGroupConfiguration
s@NodeGroupConfiguration' {} Maybe [Text]
a -> NodeGroupConfiguration
s {$sel:replicaOutpostArns:NodeGroupConfiguration' :: Maybe [Text]
replicaOutpostArns = Maybe [Text]
a} :: NodeGroupConfiguration) ((Maybe [Text] -> f (Maybe [Text]))
 -> NodeGroupConfiguration -> f NodeGroupConfiguration)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> NodeGroupConfiguration
-> f NodeGroupConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The number of read replica nodes in this node group (shard).
nodeGroupConfiguration_replicaCount :: Lens.Lens' NodeGroupConfiguration (Prelude.Maybe Prelude.Int)
nodeGroupConfiguration_replicaCount :: (Maybe Int -> f (Maybe Int))
-> NodeGroupConfiguration -> f NodeGroupConfiguration
nodeGroupConfiguration_replicaCount = (NodeGroupConfiguration -> Maybe Int)
-> (NodeGroupConfiguration -> Maybe Int -> NodeGroupConfiguration)
-> Lens
     NodeGroupConfiguration
     NodeGroupConfiguration
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeGroupConfiguration' {Maybe Int
replicaCount :: Maybe Int
$sel:replicaCount:NodeGroupConfiguration' :: NodeGroupConfiguration -> Maybe Int
replicaCount} -> Maybe Int
replicaCount) (\s :: NodeGroupConfiguration
s@NodeGroupConfiguration' {} Maybe Int
a -> NodeGroupConfiguration
s {$sel:replicaCount:NodeGroupConfiguration' :: Maybe Int
replicaCount = Maybe Int
a} :: NodeGroupConfiguration)

-- | The Availability Zone where the primary node of this node group (shard)
-- is launched.
nodeGroupConfiguration_primaryAvailabilityZone :: Lens.Lens' NodeGroupConfiguration (Prelude.Maybe Prelude.Text)
nodeGroupConfiguration_primaryAvailabilityZone :: (Maybe Text -> f (Maybe Text))
-> NodeGroupConfiguration -> f NodeGroupConfiguration
nodeGroupConfiguration_primaryAvailabilityZone = (NodeGroupConfiguration -> Maybe Text)
-> (NodeGroupConfiguration -> Maybe Text -> NodeGroupConfiguration)
-> Lens
     NodeGroupConfiguration
     NodeGroupConfiguration
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeGroupConfiguration' {Maybe Text
primaryAvailabilityZone :: Maybe Text
$sel:primaryAvailabilityZone:NodeGroupConfiguration' :: NodeGroupConfiguration -> Maybe Text
primaryAvailabilityZone} -> Maybe Text
primaryAvailabilityZone) (\s :: NodeGroupConfiguration
s@NodeGroupConfiguration' {} Maybe Text
a -> NodeGroupConfiguration
s {$sel:primaryAvailabilityZone:NodeGroupConfiguration' :: Maybe Text
primaryAvailabilityZone = Maybe Text
a} :: NodeGroupConfiguration)

-- | A list of Availability Zones to be used for the read replicas. The
-- number of Availability Zones in this list must match the value of
-- @ReplicaCount@ or @ReplicasPerNodeGroup@ if not specified.
nodeGroupConfiguration_replicaAvailabilityZones :: Lens.Lens' NodeGroupConfiguration (Prelude.Maybe [Prelude.Text])
nodeGroupConfiguration_replicaAvailabilityZones :: (Maybe [Text] -> f (Maybe [Text]))
-> NodeGroupConfiguration -> f NodeGroupConfiguration
nodeGroupConfiguration_replicaAvailabilityZones = (NodeGroupConfiguration -> Maybe [Text])
-> (NodeGroupConfiguration
    -> Maybe [Text] -> NodeGroupConfiguration)
-> Lens
     NodeGroupConfiguration
     NodeGroupConfiguration
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeGroupConfiguration' {Maybe [Text]
replicaAvailabilityZones :: Maybe [Text]
$sel:replicaAvailabilityZones:NodeGroupConfiguration' :: NodeGroupConfiguration -> Maybe [Text]
replicaAvailabilityZones} -> Maybe [Text]
replicaAvailabilityZones) (\s :: NodeGroupConfiguration
s@NodeGroupConfiguration' {} Maybe [Text]
a -> NodeGroupConfiguration
s {$sel:replicaAvailabilityZones:NodeGroupConfiguration' :: Maybe [Text]
replicaAvailabilityZones = Maybe [Text]
a} :: NodeGroupConfiguration) ((Maybe [Text] -> f (Maybe [Text]))
 -> NodeGroupConfiguration -> f NodeGroupConfiguration)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> NodeGroupConfiguration
-> f NodeGroupConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The outpost ARN of the primary node.
nodeGroupConfiguration_primaryOutpostArn :: Lens.Lens' NodeGroupConfiguration (Prelude.Maybe Prelude.Text)
nodeGroupConfiguration_primaryOutpostArn :: (Maybe Text -> f (Maybe Text))
-> NodeGroupConfiguration -> f NodeGroupConfiguration
nodeGroupConfiguration_primaryOutpostArn = (NodeGroupConfiguration -> Maybe Text)
-> (NodeGroupConfiguration -> Maybe Text -> NodeGroupConfiguration)
-> Lens
     NodeGroupConfiguration
     NodeGroupConfiguration
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeGroupConfiguration' {Maybe Text
primaryOutpostArn :: Maybe Text
$sel:primaryOutpostArn:NodeGroupConfiguration' :: NodeGroupConfiguration -> Maybe Text
primaryOutpostArn} -> Maybe Text
primaryOutpostArn) (\s :: NodeGroupConfiguration
s@NodeGroupConfiguration' {} Maybe Text
a -> NodeGroupConfiguration
s {$sel:primaryOutpostArn:NodeGroupConfiguration' :: Maybe Text
primaryOutpostArn = Maybe Text
a} :: NodeGroupConfiguration)

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

instance Core.FromXML NodeGroupConfiguration where
  parseXML :: [Node] -> Either String NodeGroupConfiguration
parseXML [Node]
x =
    Maybe Text
-> Maybe [Text]
-> Maybe Int
-> Maybe Text
-> Maybe [Text]
-> Maybe Text
-> Maybe Text
-> NodeGroupConfiguration
NodeGroupConfiguration'
      (Maybe Text
 -> Maybe [Text]
 -> Maybe Int
 -> Maybe Text
 -> Maybe [Text]
 -> Maybe Text
 -> Maybe Text
 -> NodeGroupConfiguration)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe [Text]
      -> Maybe Int
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe Text
      -> Maybe Text
      -> NodeGroupConfiguration)
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
"Slots")
      Either
  String
  (Maybe [Text]
   -> Maybe Int
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe Text
   -> Maybe Text
   -> NodeGroupConfiguration)
-> Either String (Maybe [Text])
-> Either
     String
     (Maybe Int
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe Text
      -> Maybe Text
      -> NodeGroupConfiguration)
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
"ReplicaOutpostArns"
                      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 [Text]))
-> Either String (Maybe [Text])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [Text])
-> [Node] -> Either String (Maybe [Text])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [Text]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"OutpostArn")
                  )
      Either
  String
  (Maybe Int
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe Text
   -> Maybe Text
   -> NodeGroupConfiguration)
-> Either String (Maybe Int)
-> Either
     String
     (Maybe Text
      -> Maybe [Text]
      -> Maybe Text
      -> Maybe Text
      -> NodeGroupConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Int)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"ReplicaCount")
      Either
  String
  (Maybe Text
   -> Maybe [Text]
   -> Maybe Text
   -> Maybe Text
   -> NodeGroupConfiguration)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe [Text]
      -> Maybe Text -> Maybe Text -> NodeGroupConfiguration)
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
"PrimaryAvailabilityZone")
      Either
  String
  (Maybe [Text]
   -> Maybe Text -> Maybe Text -> NodeGroupConfiguration)
-> Either String (Maybe [Text])
-> Either
     String (Maybe Text -> Maybe Text -> NodeGroupConfiguration)
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
"ReplicaAvailabilityZones"
                      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 [Text]))
-> Either String (Maybe [Text])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [Text])
-> [Node] -> Either String (Maybe [Text])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [Text]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"AvailabilityZone")
                  )
      Either String (Maybe Text -> Maybe Text -> NodeGroupConfiguration)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> NodeGroupConfiguration)
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
"PrimaryOutpostArn")
      Either String (Maybe Text -> NodeGroupConfiguration)
-> Either String (Maybe Text)
-> Either String NodeGroupConfiguration
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
"NodeGroupId")

instance Prelude.Hashable NodeGroupConfiguration

instance Prelude.NFData NodeGroupConfiguration

instance Core.ToQuery NodeGroupConfiguration where
  toQuery :: NodeGroupConfiguration -> QueryString
toQuery NodeGroupConfiguration' {Maybe Int
Maybe [Text]
Maybe Text
nodeGroupId :: Maybe Text
primaryOutpostArn :: Maybe Text
replicaAvailabilityZones :: Maybe [Text]
primaryAvailabilityZone :: Maybe Text
replicaCount :: Maybe Int
replicaOutpostArns :: Maybe [Text]
slots :: Maybe Text
$sel:nodeGroupId:NodeGroupConfiguration' :: NodeGroupConfiguration -> Maybe Text
$sel:primaryOutpostArn:NodeGroupConfiguration' :: NodeGroupConfiguration -> Maybe Text
$sel:replicaAvailabilityZones:NodeGroupConfiguration' :: NodeGroupConfiguration -> Maybe [Text]
$sel:primaryAvailabilityZone:NodeGroupConfiguration' :: NodeGroupConfiguration -> Maybe Text
$sel:replicaCount:NodeGroupConfiguration' :: NodeGroupConfiguration -> Maybe Int
$sel:replicaOutpostArns:NodeGroupConfiguration' :: NodeGroupConfiguration -> Maybe [Text]
$sel:slots:NodeGroupConfiguration' :: NodeGroupConfiguration -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Slots" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
slots,
        ByteString
"ReplicaOutpostArns"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            ( ByteString -> [Text] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"OutpostArn"
                ([Text] -> QueryString) -> Maybe [Text] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
replicaOutpostArns
            ),
        ByteString
"ReplicaCount" ByteString -> Maybe Int -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Int
replicaCount,
        ByteString
"PrimaryAvailabilityZone"
          ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
primaryAvailabilityZone,
        ByteString
"ReplicaAvailabilityZones"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            ( ByteString -> [Text] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"AvailabilityZone"
                ([Text] -> QueryString) -> Maybe [Text] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
replicaAvailabilityZones
            ),
        ByteString
"PrimaryOutpostArn" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
primaryOutpostArn,
        ByteString
"NodeGroupId" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nodeGroupId
      ]