{-# 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 #-}
module Amazonka.ElastiCache.Types.NodeGroup where
import qualified Amazonka.Core as Core
import Amazonka.ElastiCache.Types.Endpoint
import Amazonka.ElastiCache.Types.NodeGroupMember
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data NodeGroup = NodeGroup'
{
NodeGroup -> Maybe Text
status :: Prelude.Maybe Prelude.Text,
NodeGroup -> Maybe Endpoint
primaryEndpoint :: Prelude.Maybe Endpoint,
NodeGroup -> Maybe Text
slots :: Prelude.Maybe Prelude.Text,
NodeGroup -> Maybe [NodeGroupMember]
nodeGroupMembers :: Prelude.Maybe [NodeGroupMember],
NodeGroup -> Maybe Text
nodeGroupId :: Prelude.Maybe Prelude.Text,
NodeGroup -> Maybe Endpoint
readerEndpoint :: Prelude.Maybe Endpoint
}
deriving (NodeGroup -> NodeGroup -> Bool
(NodeGroup -> NodeGroup -> Bool)
-> (NodeGroup -> NodeGroup -> Bool) -> Eq NodeGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NodeGroup -> NodeGroup -> Bool
$c/= :: NodeGroup -> NodeGroup -> Bool
== :: NodeGroup -> NodeGroup -> Bool
$c== :: NodeGroup -> NodeGroup -> Bool
Prelude.Eq, ReadPrec [NodeGroup]
ReadPrec NodeGroup
Int -> ReadS NodeGroup
ReadS [NodeGroup]
(Int -> ReadS NodeGroup)
-> ReadS [NodeGroup]
-> ReadPrec NodeGroup
-> ReadPrec [NodeGroup]
-> Read NodeGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NodeGroup]
$creadListPrec :: ReadPrec [NodeGroup]
readPrec :: ReadPrec NodeGroup
$creadPrec :: ReadPrec NodeGroup
readList :: ReadS [NodeGroup]
$creadList :: ReadS [NodeGroup]
readsPrec :: Int -> ReadS NodeGroup
$creadsPrec :: Int -> ReadS NodeGroup
Prelude.Read, Int -> NodeGroup -> ShowS
[NodeGroup] -> ShowS
NodeGroup -> String
(Int -> NodeGroup -> ShowS)
-> (NodeGroup -> String)
-> ([NodeGroup] -> ShowS)
-> Show NodeGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NodeGroup] -> ShowS
$cshowList :: [NodeGroup] -> ShowS
show :: NodeGroup -> String
$cshow :: NodeGroup -> String
showsPrec :: Int -> NodeGroup -> ShowS
$cshowsPrec :: Int -> NodeGroup -> ShowS
Prelude.Show, (forall x. NodeGroup -> Rep NodeGroup x)
-> (forall x. Rep NodeGroup x -> NodeGroup) -> Generic NodeGroup
forall x. Rep NodeGroup x -> NodeGroup
forall x. NodeGroup -> Rep NodeGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NodeGroup x -> NodeGroup
$cfrom :: forall x. NodeGroup -> Rep NodeGroup x
Prelude.Generic)
newNodeGroup ::
NodeGroup
newNodeGroup :: NodeGroup
newNodeGroup =
NodeGroup' :: Maybe Text
-> Maybe Endpoint
-> Maybe Text
-> Maybe [NodeGroupMember]
-> Maybe Text
-> Maybe Endpoint
-> NodeGroup
NodeGroup'
{ $sel:status:NodeGroup' :: Maybe Text
status = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:primaryEndpoint:NodeGroup' :: Maybe Endpoint
primaryEndpoint = Maybe Endpoint
forall a. Maybe a
Prelude.Nothing,
$sel:slots:NodeGroup' :: Maybe Text
slots = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:nodeGroupMembers:NodeGroup' :: Maybe [NodeGroupMember]
nodeGroupMembers = Maybe [NodeGroupMember]
forall a. Maybe a
Prelude.Nothing,
$sel:nodeGroupId:NodeGroup' :: Maybe Text
nodeGroupId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:readerEndpoint:NodeGroup' :: Maybe Endpoint
readerEndpoint = Maybe Endpoint
forall a. Maybe a
Prelude.Nothing
}
nodeGroup_status :: Lens.Lens' NodeGroup (Prelude.Maybe Prelude.Text)
nodeGroup_status :: (Maybe Text -> f (Maybe Text)) -> NodeGroup -> f NodeGroup
nodeGroup_status = (NodeGroup -> Maybe Text)
-> (NodeGroup -> Maybe Text -> NodeGroup)
-> Lens NodeGroup NodeGroup (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeGroup' {Maybe Text
status :: Maybe Text
$sel:status:NodeGroup' :: NodeGroup -> Maybe Text
status} -> Maybe Text
status) (\s :: NodeGroup
s@NodeGroup' {} Maybe Text
a -> NodeGroup
s {$sel:status:NodeGroup' :: Maybe Text
status = Maybe Text
a} :: NodeGroup)
nodeGroup_primaryEndpoint :: Lens.Lens' NodeGroup (Prelude.Maybe Endpoint)
nodeGroup_primaryEndpoint :: (Maybe Endpoint -> f (Maybe Endpoint)) -> NodeGroup -> f NodeGroup
nodeGroup_primaryEndpoint = (NodeGroup -> Maybe Endpoint)
-> (NodeGroup -> Maybe Endpoint -> NodeGroup)
-> Lens NodeGroup NodeGroup (Maybe Endpoint) (Maybe Endpoint)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeGroup' {Maybe Endpoint
primaryEndpoint :: Maybe Endpoint
$sel:primaryEndpoint:NodeGroup' :: NodeGroup -> Maybe Endpoint
primaryEndpoint} -> Maybe Endpoint
primaryEndpoint) (\s :: NodeGroup
s@NodeGroup' {} Maybe Endpoint
a -> NodeGroup
s {$sel:primaryEndpoint:NodeGroup' :: Maybe Endpoint
primaryEndpoint = Maybe Endpoint
a} :: NodeGroup)
nodeGroup_slots :: Lens.Lens' NodeGroup (Prelude.Maybe Prelude.Text)
nodeGroup_slots :: (Maybe Text -> f (Maybe Text)) -> NodeGroup -> f NodeGroup
nodeGroup_slots = (NodeGroup -> Maybe Text)
-> (NodeGroup -> Maybe Text -> NodeGroup)
-> Lens NodeGroup NodeGroup (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeGroup' {Maybe Text
slots :: Maybe Text
$sel:slots:NodeGroup' :: NodeGroup -> Maybe Text
slots} -> Maybe Text
slots) (\s :: NodeGroup
s@NodeGroup' {} Maybe Text
a -> NodeGroup
s {$sel:slots:NodeGroup' :: Maybe Text
slots = Maybe Text
a} :: NodeGroup)
nodeGroup_nodeGroupMembers :: Lens.Lens' NodeGroup (Prelude.Maybe [NodeGroupMember])
nodeGroup_nodeGroupMembers :: (Maybe [NodeGroupMember] -> f (Maybe [NodeGroupMember]))
-> NodeGroup -> f NodeGroup
nodeGroup_nodeGroupMembers = (NodeGroup -> Maybe [NodeGroupMember])
-> (NodeGroup -> Maybe [NodeGroupMember] -> NodeGroup)
-> Lens
NodeGroup
NodeGroup
(Maybe [NodeGroupMember])
(Maybe [NodeGroupMember])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeGroup' {Maybe [NodeGroupMember]
nodeGroupMembers :: Maybe [NodeGroupMember]
$sel:nodeGroupMembers:NodeGroup' :: NodeGroup -> Maybe [NodeGroupMember]
nodeGroupMembers} -> Maybe [NodeGroupMember]
nodeGroupMembers) (\s :: NodeGroup
s@NodeGroup' {} Maybe [NodeGroupMember]
a -> NodeGroup
s {$sel:nodeGroupMembers:NodeGroup' :: Maybe [NodeGroupMember]
nodeGroupMembers = Maybe [NodeGroupMember]
a} :: NodeGroup) ((Maybe [NodeGroupMember] -> f (Maybe [NodeGroupMember]))
-> NodeGroup -> f NodeGroup)
-> ((Maybe [NodeGroupMember] -> f (Maybe [NodeGroupMember]))
-> Maybe [NodeGroupMember] -> f (Maybe [NodeGroupMember]))
-> (Maybe [NodeGroupMember] -> f (Maybe [NodeGroupMember]))
-> NodeGroup
-> f NodeGroup
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[NodeGroupMember]
[NodeGroupMember]
[NodeGroupMember]
[NodeGroupMember]
-> Iso
(Maybe [NodeGroupMember])
(Maybe [NodeGroupMember])
(Maybe [NodeGroupMember])
(Maybe [NodeGroupMember])
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
[NodeGroupMember]
[NodeGroupMember]
[NodeGroupMember]
[NodeGroupMember]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
nodeGroup_nodeGroupId :: Lens.Lens' NodeGroup (Prelude.Maybe Prelude.Text)
nodeGroup_nodeGroupId :: (Maybe Text -> f (Maybe Text)) -> NodeGroup -> f NodeGroup
nodeGroup_nodeGroupId = (NodeGroup -> Maybe Text)
-> (NodeGroup -> Maybe Text -> NodeGroup)
-> Lens NodeGroup NodeGroup (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeGroup' {Maybe Text
nodeGroupId :: Maybe Text
$sel:nodeGroupId:NodeGroup' :: NodeGroup -> Maybe Text
nodeGroupId} -> Maybe Text
nodeGroupId) (\s :: NodeGroup
s@NodeGroup' {} Maybe Text
a -> NodeGroup
s {$sel:nodeGroupId:NodeGroup' :: Maybe Text
nodeGroupId = Maybe Text
a} :: NodeGroup)
nodeGroup_readerEndpoint :: Lens.Lens' NodeGroup (Prelude.Maybe Endpoint)
nodeGroup_readerEndpoint :: (Maybe Endpoint -> f (Maybe Endpoint)) -> NodeGroup -> f NodeGroup
nodeGroup_readerEndpoint = (NodeGroup -> Maybe Endpoint)
-> (NodeGroup -> Maybe Endpoint -> NodeGroup)
-> Lens NodeGroup NodeGroup (Maybe Endpoint) (Maybe Endpoint)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeGroup' {Maybe Endpoint
readerEndpoint :: Maybe Endpoint
$sel:readerEndpoint:NodeGroup' :: NodeGroup -> Maybe Endpoint
readerEndpoint} -> Maybe Endpoint
readerEndpoint) (\s :: NodeGroup
s@NodeGroup' {} Maybe Endpoint
a -> NodeGroup
s {$sel:readerEndpoint:NodeGroup' :: Maybe Endpoint
readerEndpoint = Maybe Endpoint
a} :: NodeGroup)
instance Core.FromXML NodeGroup where
parseXML :: [Node] -> Either String NodeGroup
parseXML [Node]
x =
Maybe Text
-> Maybe Endpoint
-> Maybe Text
-> Maybe [NodeGroupMember]
-> Maybe Text
-> Maybe Endpoint
-> NodeGroup
NodeGroup'
(Maybe Text
-> Maybe Endpoint
-> Maybe Text
-> Maybe [NodeGroupMember]
-> Maybe Text
-> Maybe Endpoint
-> NodeGroup)
-> Either String (Maybe Text)
-> Either
String
(Maybe Endpoint
-> Maybe Text
-> Maybe [NodeGroupMember]
-> Maybe Text
-> Maybe Endpoint
-> NodeGroup)
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
"Status")
Either
String
(Maybe Endpoint
-> Maybe Text
-> Maybe [NodeGroupMember]
-> Maybe Text
-> Maybe Endpoint
-> NodeGroup)
-> Either String (Maybe Endpoint)
-> Either
String
(Maybe Text
-> Maybe [NodeGroupMember]
-> Maybe Text
-> Maybe Endpoint
-> NodeGroup)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Endpoint)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"PrimaryEndpoint")
Either
String
(Maybe Text
-> Maybe [NodeGroupMember]
-> Maybe Text
-> Maybe Endpoint
-> NodeGroup)
-> Either String (Maybe Text)
-> Either
String
(Maybe [NodeGroupMember]
-> Maybe Text -> Maybe Endpoint -> NodeGroup)
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
"Slots")
Either
String
(Maybe [NodeGroupMember]
-> Maybe Text -> Maybe Endpoint -> NodeGroup)
-> Either String (Maybe [NodeGroupMember])
-> Either String (Maybe Text -> Maybe Endpoint -> NodeGroup)
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
"NodeGroupMembers"
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 [NodeGroupMember]))
-> Either String (Maybe [NodeGroupMember])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [NodeGroupMember])
-> [Node] -> Either String (Maybe [NodeGroupMember])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [NodeGroupMember]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"NodeGroupMember")
)
Either String (Maybe Text -> Maybe Endpoint -> NodeGroup)
-> Either String (Maybe Text)
-> Either String (Maybe Endpoint -> NodeGroup)
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")
Either String (Maybe Endpoint -> NodeGroup)
-> Either String (Maybe Endpoint) -> Either String NodeGroup
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Endpoint)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"ReaderEndpoint")
instance Prelude.Hashable NodeGroup
instance Prelude.NFData NodeGroup