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

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

-- | Represents an individual cache node in a snapshot of a cluster.
--
-- /See:/ 'newNodeSnapshot' smart constructor.
data NodeSnapshot = NodeSnapshot'
  { -- | The configuration for the source node group (shard).
    NodeSnapshot -> Maybe NodeGroupConfiguration
nodeGroupConfiguration :: Prelude.Maybe NodeGroupConfiguration,
    -- | The date and time when the cache node was created in the source cluster.
    NodeSnapshot -> Maybe ISO8601
cacheNodeCreateTime :: Prelude.Maybe Core.ISO8601,
    -- | A unique identifier for the source cluster.
    NodeSnapshot -> Maybe Text
cacheClusterId :: Prelude.Maybe Prelude.Text,
    -- | The cache node identifier for the node in the source cluster.
    NodeSnapshot -> Maybe Text
cacheNodeId :: Prelude.Maybe Prelude.Text,
    -- | A unique identifier for the source node group (shard).
    NodeSnapshot -> Maybe Text
nodeGroupId :: Prelude.Maybe Prelude.Text,
    -- | The date and time when the source node\'s metadata and cache data set
    -- was obtained for the snapshot.
    NodeSnapshot -> Maybe ISO8601
snapshotCreateTime :: Prelude.Maybe Core.ISO8601,
    -- | The size of the cache on the source cache node.
    NodeSnapshot -> Maybe Text
cacheSize :: Prelude.Maybe Prelude.Text
  }
  deriving (NodeSnapshot -> NodeSnapshot -> Bool
(NodeSnapshot -> NodeSnapshot -> Bool)
-> (NodeSnapshot -> NodeSnapshot -> Bool) -> Eq NodeSnapshot
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NodeSnapshot -> NodeSnapshot -> Bool
$c/= :: NodeSnapshot -> NodeSnapshot -> Bool
== :: NodeSnapshot -> NodeSnapshot -> Bool
$c== :: NodeSnapshot -> NodeSnapshot -> Bool
Prelude.Eq, ReadPrec [NodeSnapshot]
ReadPrec NodeSnapshot
Int -> ReadS NodeSnapshot
ReadS [NodeSnapshot]
(Int -> ReadS NodeSnapshot)
-> ReadS [NodeSnapshot]
-> ReadPrec NodeSnapshot
-> ReadPrec [NodeSnapshot]
-> Read NodeSnapshot
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NodeSnapshot]
$creadListPrec :: ReadPrec [NodeSnapshot]
readPrec :: ReadPrec NodeSnapshot
$creadPrec :: ReadPrec NodeSnapshot
readList :: ReadS [NodeSnapshot]
$creadList :: ReadS [NodeSnapshot]
readsPrec :: Int -> ReadS NodeSnapshot
$creadsPrec :: Int -> ReadS NodeSnapshot
Prelude.Read, Int -> NodeSnapshot -> ShowS
[NodeSnapshot] -> ShowS
NodeSnapshot -> String
(Int -> NodeSnapshot -> ShowS)
-> (NodeSnapshot -> String)
-> ([NodeSnapshot] -> ShowS)
-> Show NodeSnapshot
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NodeSnapshot] -> ShowS
$cshowList :: [NodeSnapshot] -> ShowS
show :: NodeSnapshot -> String
$cshow :: NodeSnapshot -> String
showsPrec :: Int -> NodeSnapshot -> ShowS
$cshowsPrec :: Int -> NodeSnapshot -> ShowS
Prelude.Show, (forall x. NodeSnapshot -> Rep NodeSnapshot x)
-> (forall x. Rep NodeSnapshot x -> NodeSnapshot)
-> Generic NodeSnapshot
forall x. Rep NodeSnapshot x -> NodeSnapshot
forall x. NodeSnapshot -> Rep NodeSnapshot x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NodeSnapshot x -> NodeSnapshot
$cfrom :: forall x. NodeSnapshot -> Rep NodeSnapshot x
Prelude.Generic)

-- |
-- Create a value of 'NodeSnapshot' 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:
--
-- 'nodeGroupConfiguration', 'nodeSnapshot_nodeGroupConfiguration' - The configuration for the source node group (shard).
--
-- 'cacheNodeCreateTime', 'nodeSnapshot_cacheNodeCreateTime' - The date and time when the cache node was created in the source cluster.
--
-- 'cacheClusterId', 'nodeSnapshot_cacheClusterId' - A unique identifier for the source cluster.
--
-- 'cacheNodeId', 'nodeSnapshot_cacheNodeId' - The cache node identifier for the node in the source cluster.
--
-- 'nodeGroupId', 'nodeSnapshot_nodeGroupId' - A unique identifier for the source node group (shard).
--
-- 'snapshotCreateTime', 'nodeSnapshot_snapshotCreateTime' - The date and time when the source node\'s metadata and cache data set
-- was obtained for the snapshot.
--
-- 'cacheSize', 'nodeSnapshot_cacheSize' - The size of the cache on the source cache node.
newNodeSnapshot ::
  NodeSnapshot
newNodeSnapshot :: NodeSnapshot
newNodeSnapshot =
  NodeSnapshot' :: Maybe NodeGroupConfiguration
-> Maybe ISO8601
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe ISO8601
-> Maybe Text
-> NodeSnapshot
NodeSnapshot'
    { $sel:nodeGroupConfiguration:NodeSnapshot' :: Maybe NodeGroupConfiguration
nodeGroupConfiguration =
        Maybe NodeGroupConfiguration
forall a. Maybe a
Prelude.Nothing,
      $sel:cacheNodeCreateTime:NodeSnapshot' :: Maybe ISO8601
cacheNodeCreateTime = Maybe ISO8601
forall a. Maybe a
Prelude.Nothing,
      $sel:cacheClusterId:NodeSnapshot' :: Maybe Text
cacheClusterId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:cacheNodeId:NodeSnapshot' :: Maybe Text
cacheNodeId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nodeGroupId:NodeSnapshot' :: Maybe Text
nodeGroupId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:snapshotCreateTime:NodeSnapshot' :: Maybe ISO8601
snapshotCreateTime = Maybe ISO8601
forall a. Maybe a
Prelude.Nothing,
      $sel:cacheSize:NodeSnapshot' :: Maybe Text
cacheSize = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The configuration for the source node group (shard).
nodeSnapshot_nodeGroupConfiguration :: Lens.Lens' NodeSnapshot (Prelude.Maybe NodeGroupConfiguration)
nodeSnapshot_nodeGroupConfiguration :: (Maybe NodeGroupConfiguration -> f (Maybe NodeGroupConfiguration))
-> NodeSnapshot -> f NodeSnapshot
nodeSnapshot_nodeGroupConfiguration = (NodeSnapshot -> Maybe NodeGroupConfiguration)
-> (NodeSnapshot -> Maybe NodeGroupConfiguration -> NodeSnapshot)
-> Lens
     NodeSnapshot
     NodeSnapshot
     (Maybe NodeGroupConfiguration)
     (Maybe NodeGroupConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeSnapshot' {Maybe NodeGroupConfiguration
nodeGroupConfiguration :: Maybe NodeGroupConfiguration
$sel:nodeGroupConfiguration:NodeSnapshot' :: NodeSnapshot -> Maybe NodeGroupConfiguration
nodeGroupConfiguration} -> Maybe NodeGroupConfiguration
nodeGroupConfiguration) (\s :: NodeSnapshot
s@NodeSnapshot' {} Maybe NodeGroupConfiguration
a -> NodeSnapshot
s {$sel:nodeGroupConfiguration:NodeSnapshot' :: Maybe NodeGroupConfiguration
nodeGroupConfiguration = Maybe NodeGroupConfiguration
a} :: NodeSnapshot)

-- | The date and time when the cache node was created in the source cluster.
nodeSnapshot_cacheNodeCreateTime :: Lens.Lens' NodeSnapshot (Prelude.Maybe Prelude.UTCTime)
nodeSnapshot_cacheNodeCreateTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> NodeSnapshot -> f NodeSnapshot
nodeSnapshot_cacheNodeCreateTime = (NodeSnapshot -> Maybe ISO8601)
-> (NodeSnapshot -> Maybe ISO8601 -> NodeSnapshot)
-> Lens NodeSnapshot NodeSnapshot (Maybe ISO8601) (Maybe ISO8601)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeSnapshot' {Maybe ISO8601
cacheNodeCreateTime :: Maybe ISO8601
$sel:cacheNodeCreateTime:NodeSnapshot' :: NodeSnapshot -> Maybe ISO8601
cacheNodeCreateTime} -> Maybe ISO8601
cacheNodeCreateTime) (\s :: NodeSnapshot
s@NodeSnapshot' {} Maybe ISO8601
a -> NodeSnapshot
s {$sel:cacheNodeCreateTime:NodeSnapshot' :: Maybe ISO8601
cacheNodeCreateTime = Maybe ISO8601
a} :: NodeSnapshot) ((Maybe ISO8601 -> f (Maybe ISO8601))
 -> NodeSnapshot -> f NodeSnapshot)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe ISO8601 -> f (Maybe ISO8601))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> NodeSnapshot
-> f NodeSnapshot
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso ISO8601 ISO8601 UTCTime UTCTime
-> Iso
     (Maybe ISO8601) (Maybe ISO8601) (Maybe UTCTime) (Maybe UTCTime)
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 ISO8601 ISO8601 UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | A unique identifier for the source cluster.
nodeSnapshot_cacheClusterId :: Lens.Lens' NodeSnapshot (Prelude.Maybe Prelude.Text)
nodeSnapshot_cacheClusterId :: (Maybe Text -> f (Maybe Text)) -> NodeSnapshot -> f NodeSnapshot
nodeSnapshot_cacheClusterId = (NodeSnapshot -> Maybe Text)
-> (NodeSnapshot -> Maybe Text -> NodeSnapshot)
-> Lens NodeSnapshot NodeSnapshot (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeSnapshot' {Maybe Text
cacheClusterId :: Maybe Text
$sel:cacheClusterId:NodeSnapshot' :: NodeSnapshot -> Maybe Text
cacheClusterId} -> Maybe Text
cacheClusterId) (\s :: NodeSnapshot
s@NodeSnapshot' {} Maybe Text
a -> NodeSnapshot
s {$sel:cacheClusterId:NodeSnapshot' :: Maybe Text
cacheClusterId = Maybe Text
a} :: NodeSnapshot)

-- | The cache node identifier for the node in the source cluster.
nodeSnapshot_cacheNodeId :: Lens.Lens' NodeSnapshot (Prelude.Maybe Prelude.Text)
nodeSnapshot_cacheNodeId :: (Maybe Text -> f (Maybe Text)) -> NodeSnapshot -> f NodeSnapshot
nodeSnapshot_cacheNodeId = (NodeSnapshot -> Maybe Text)
-> (NodeSnapshot -> Maybe Text -> NodeSnapshot)
-> Lens NodeSnapshot NodeSnapshot (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeSnapshot' {Maybe Text
cacheNodeId :: Maybe Text
$sel:cacheNodeId:NodeSnapshot' :: NodeSnapshot -> Maybe Text
cacheNodeId} -> Maybe Text
cacheNodeId) (\s :: NodeSnapshot
s@NodeSnapshot' {} Maybe Text
a -> NodeSnapshot
s {$sel:cacheNodeId:NodeSnapshot' :: Maybe Text
cacheNodeId = Maybe Text
a} :: NodeSnapshot)

-- | A unique identifier for the source node group (shard).
nodeSnapshot_nodeGroupId :: Lens.Lens' NodeSnapshot (Prelude.Maybe Prelude.Text)
nodeSnapshot_nodeGroupId :: (Maybe Text -> f (Maybe Text)) -> NodeSnapshot -> f NodeSnapshot
nodeSnapshot_nodeGroupId = (NodeSnapshot -> Maybe Text)
-> (NodeSnapshot -> Maybe Text -> NodeSnapshot)
-> Lens NodeSnapshot NodeSnapshot (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeSnapshot' {Maybe Text
nodeGroupId :: Maybe Text
$sel:nodeGroupId:NodeSnapshot' :: NodeSnapshot -> Maybe Text
nodeGroupId} -> Maybe Text
nodeGroupId) (\s :: NodeSnapshot
s@NodeSnapshot' {} Maybe Text
a -> NodeSnapshot
s {$sel:nodeGroupId:NodeSnapshot' :: Maybe Text
nodeGroupId = Maybe Text
a} :: NodeSnapshot)

-- | The date and time when the source node\'s metadata and cache data set
-- was obtained for the snapshot.
nodeSnapshot_snapshotCreateTime :: Lens.Lens' NodeSnapshot (Prelude.Maybe Prelude.UTCTime)
nodeSnapshot_snapshotCreateTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> NodeSnapshot -> f NodeSnapshot
nodeSnapshot_snapshotCreateTime = (NodeSnapshot -> Maybe ISO8601)
-> (NodeSnapshot -> Maybe ISO8601 -> NodeSnapshot)
-> Lens NodeSnapshot NodeSnapshot (Maybe ISO8601) (Maybe ISO8601)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeSnapshot' {Maybe ISO8601
snapshotCreateTime :: Maybe ISO8601
$sel:snapshotCreateTime:NodeSnapshot' :: NodeSnapshot -> Maybe ISO8601
snapshotCreateTime} -> Maybe ISO8601
snapshotCreateTime) (\s :: NodeSnapshot
s@NodeSnapshot' {} Maybe ISO8601
a -> NodeSnapshot
s {$sel:snapshotCreateTime:NodeSnapshot' :: Maybe ISO8601
snapshotCreateTime = Maybe ISO8601
a} :: NodeSnapshot) ((Maybe ISO8601 -> f (Maybe ISO8601))
 -> NodeSnapshot -> f NodeSnapshot)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe ISO8601 -> f (Maybe ISO8601))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> NodeSnapshot
-> f NodeSnapshot
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso ISO8601 ISO8601 UTCTime UTCTime
-> Iso
     (Maybe ISO8601) (Maybe ISO8601) (Maybe UTCTime) (Maybe UTCTime)
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 ISO8601 ISO8601 UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The size of the cache on the source cache node.
nodeSnapshot_cacheSize :: Lens.Lens' NodeSnapshot (Prelude.Maybe Prelude.Text)
nodeSnapshot_cacheSize :: (Maybe Text -> f (Maybe Text)) -> NodeSnapshot -> f NodeSnapshot
nodeSnapshot_cacheSize = (NodeSnapshot -> Maybe Text)
-> (NodeSnapshot -> Maybe Text -> NodeSnapshot)
-> Lens NodeSnapshot NodeSnapshot (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeSnapshot' {Maybe Text
cacheSize :: Maybe Text
$sel:cacheSize:NodeSnapshot' :: NodeSnapshot -> Maybe Text
cacheSize} -> Maybe Text
cacheSize) (\s :: NodeSnapshot
s@NodeSnapshot' {} Maybe Text
a -> NodeSnapshot
s {$sel:cacheSize:NodeSnapshot' :: Maybe Text
cacheSize = Maybe Text
a} :: NodeSnapshot)

instance Core.FromXML NodeSnapshot where
  parseXML :: [Node] -> Either String NodeSnapshot
parseXML [Node]
x =
    Maybe NodeGroupConfiguration
-> Maybe ISO8601
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe ISO8601
-> Maybe Text
-> NodeSnapshot
NodeSnapshot'
      (Maybe NodeGroupConfiguration
 -> Maybe ISO8601
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe ISO8601
 -> Maybe Text
 -> NodeSnapshot)
-> Either String (Maybe NodeGroupConfiguration)
-> Either
     String
     (Maybe ISO8601
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe ISO8601
      -> Maybe Text
      -> NodeSnapshot)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe NodeGroupConfiguration)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"NodeGroupConfiguration")
      Either
  String
  (Maybe ISO8601
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe ISO8601
   -> Maybe Text
   -> NodeSnapshot)
-> Either String (Maybe ISO8601)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe ISO8601
      -> Maybe Text
      -> NodeSnapshot)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe ISO8601)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"CacheNodeCreateTime")
      Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe ISO8601
   -> Maybe Text
   -> NodeSnapshot)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text -> Maybe ISO8601 -> Maybe Text -> NodeSnapshot)
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
"CacheClusterId")
      Either
  String
  (Maybe Text
   -> Maybe Text -> Maybe ISO8601 -> Maybe Text -> NodeSnapshot)
-> Either String (Maybe Text)
-> Either
     String (Maybe Text -> Maybe ISO8601 -> Maybe Text -> NodeSnapshot)
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
"CacheNodeId")
      Either
  String (Maybe Text -> Maybe ISO8601 -> Maybe Text -> NodeSnapshot)
-> Either String (Maybe Text)
-> Either String (Maybe ISO8601 -> Maybe Text -> NodeSnapshot)
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 ISO8601 -> Maybe Text -> NodeSnapshot)
-> Either String (Maybe ISO8601)
-> Either String (Maybe Text -> NodeSnapshot)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe ISO8601)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"SnapshotCreateTime")
      Either String (Maybe Text -> NodeSnapshot)
-> Either String (Maybe Text) -> Either String NodeSnapshot
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
"CacheSize")

instance Prelude.Hashable NodeSnapshot

instance Prelude.NFData NodeSnapshot