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

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

-- | Represents an individual cache node in a snapshot of a cluster.
--
-- /See:/ 'newNodeSnapshot' smart constructor.
data NodeSnapshot = NodeSnapshot'
  { -- | A unique identifier for the source cluster.
    NodeSnapshot -> Maybe Text
cacheClusterId :: Prelude.Maybe Prelude.Text,
    -- | The date and time when the cache node was created in the source cluster.
    NodeSnapshot -> Maybe ISO8601
cacheNodeCreateTime :: Prelude.Maybe Data.ISO8601,
    -- | The cache node identifier for the node in the source cluster.
    NodeSnapshot -> Maybe Text
cacheNodeId :: Prelude.Maybe Prelude.Text,
    -- | The size of the cache on the source cache node.
    NodeSnapshot -> Maybe Text
cacheSize :: Prelude.Maybe Prelude.Text,
    -- | The configuration for the source node group (shard).
    NodeSnapshot -> Maybe NodeGroupConfiguration
nodeGroupConfiguration :: Prelude.Maybe NodeGroupConfiguration,
    -- | 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 Data.ISO8601
  }
  deriving (NodeSnapshot -> NodeSnapshot -> Bool
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]
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
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. 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:
--
-- 'cacheClusterId', 'nodeSnapshot_cacheClusterId' - A unique identifier for the source cluster.
--
-- 'cacheNodeCreateTime', 'nodeSnapshot_cacheNodeCreateTime' - The date and time when the cache node was created in the source cluster.
--
-- 'cacheNodeId', 'nodeSnapshot_cacheNodeId' - The cache node identifier for the node in the source cluster.
--
-- 'cacheSize', 'nodeSnapshot_cacheSize' - The size of the cache on the source cache node.
--
-- 'nodeGroupConfiguration', 'nodeSnapshot_nodeGroupConfiguration' - The configuration for the source node group (shard).
--
-- '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.
newNodeSnapshot ::
  NodeSnapshot
newNodeSnapshot :: NodeSnapshot
newNodeSnapshot =
  NodeSnapshot'
    { $sel:cacheClusterId:NodeSnapshot' :: Maybe Text
cacheClusterId = forall a. Maybe a
Prelude.Nothing,
      $sel:cacheNodeCreateTime:NodeSnapshot' :: Maybe ISO8601
cacheNodeCreateTime = forall a. Maybe a
Prelude.Nothing,
      $sel:cacheNodeId:NodeSnapshot' :: Maybe Text
cacheNodeId = forall a. Maybe a
Prelude.Nothing,
      $sel:cacheSize:NodeSnapshot' :: Maybe Text
cacheSize = forall a. Maybe a
Prelude.Nothing,
      $sel:nodeGroupConfiguration:NodeSnapshot' :: Maybe NodeGroupConfiguration
nodeGroupConfiguration = forall a. Maybe a
Prelude.Nothing,
      $sel:nodeGroupId:NodeSnapshot' :: Maybe Text
nodeGroupId = forall a. Maybe a
Prelude.Nothing,
      $sel:snapshotCreateTime:NodeSnapshot' :: Maybe ISO8601
snapshotCreateTime = forall a. Maybe a
Prelude.Nothing
    }

-- | A unique identifier for the source cluster.
nodeSnapshot_cacheClusterId :: Lens.Lens' NodeSnapshot (Prelude.Maybe Prelude.Text)
nodeSnapshot_cacheClusterId :: Lens' NodeSnapshot (Maybe Text)
nodeSnapshot_cacheClusterId = 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 date and time when the cache node was created in the source cluster.
nodeSnapshot_cacheNodeCreateTime :: Lens.Lens' NodeSnapshot (Prelude.Maybe Prelude.UTCTime)
nodeSnapshot_cacheNodeCreateTime :: Lens' NodeSnapshot (Maybe UTCTime)
nodeSnapshot_cacheNodeCreateTime = 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) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The cache node identifier for the node in the source cluster.
nodeSnapshot_cacheNodeId :: Lens.Lens' NodeSnapshot (Prelude.Maybe Prelude.Text)
nodeSnapshot_cacheNodeId :: Lens' NodeSnapshot (Maybe Text)
nodeSnapshot_cacheNodeId = 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)

-- | The size of the cache on the source cache node.
nodeSnapshot_cacheSize :: Lens.Lens' NodeSnapshot (Prelude.Maybe Prelude.Text)
nodeSnapshot_cacheSize :: Lens' NodeSnapshot (Maybe Text)
nodeSnapshot_cacheSize = 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)

-- | The configuration for the source node group (shard).
nodeSnapshot_nodeGroupConfiguration :: Lens.Lens' NodeSnapshot (Prelude.Maybe NodeGroupConfiguration)
nodeSnapshot_nodeGroupConfiguration :: Lens' NodeSnapshot (Maybe NodeGroupConfiguration)
nodeSnapshot_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)

-- | A unique identifier for the source node group (shard).
nodeSnapshot_nodeGroupId :: Lens.Lens' NodeSnapshot (Prelude.Maybe Prelude.Text)
nodeSnapshot_nodeGroupId :: Lens' NodeSnapshot (Maybe Text)
nodeSnapshot_nodeGroupId = 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 :: Lens' NodeSnapshot (Maybe UTCTime)
nodeSnapshot_snapshotCreateTime = 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) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time

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

instance Prelude.Hashable NodeSnapshot where
  hashWithSalt :: Int -> NodeSnapshot -> Int
hashWithSalt Int
_salt NodeSnapshot' {Maybe Text
Maybe ISO8601
Maybe NodeGroupConfiguration
snapshotCreateTime :: Maybe ISO8601
nodeGroupId :: Maybe Text
nodeGroupConfiguration :: Maybe NodeGroupConfiguration
cacheSize :: Maybe Text
cacheNodeId :: Maybe Text
cacheNodeCreateTime :: Maybe ISO8601
cacheClusterId :: Maybe Text
$sel:snapshotCreateTime:NodeSnapshot' :: NodeSnapshot -> Maybe ISO8601
$sel:nodeGroupId:NodeSnapshot' :: NodeSnapshot -> Maybe Text
$sel:nodeGroupConfiguration:NodeSnapshot' :: NodeSnapshot -> Maybe NodeGroupConfiguration
$sel:cacheSize:NodeSnapshot' :: NodeSnapshot -> Maybe Text
$sel:cacheNodeId:NodeSnapshot' :: NodeSnapshot -> Maybe Text
$sel:cacheNodeCreateTime:NodeSnapshot' :: NodeSnapshot -> Maybe ISO8601
$sel:cacheClusterId:NodeSnapshot' :: NodeSnapshot -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
cacheClusterId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ISO8601
cacheNodeCreateTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
cacheNodeId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
cacheSize
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe NodeGroupConfiguration
nodeGroupConfiguration
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nodeGroupId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ISO8601
snapshotCreateTime

instance Prelude.NFData NodeSnapshot where
  rnf :: NodeSnapshot -> ()
rnf NodeSnapshot' {Maybe Text
Maybe ISO8601
Maybe NodeGroupConfiguration
snapshotCreateTime :: Maybe ISO8601
nodeGroupId :: Maybe Text
nodeGroupConfiguration :: Maybe NodeGroupConfiguration
cacheSize :: Maybe Text
cacheNodeId :: Maybe Text
cacheNodeCreateTime :: Maybe ISO8601
cacheClusterId :: Maybe Text
$sel:snapshotCreateTime:NodeSnapshot' :: NodeSnapshot -> Maybe ISO8601
$sel:nodeGroupId:NodeSnapshot' :: NodeSnapshot -> Maybe Text
$sel:nodeGroupConfiguration:NodeSnapshot' :: NodeSnapshot -> Maybe NodeGroupConfiguration
$sel:cacheSize:NodeSnapshot' :: NodeSnapshot -> Maybe Text
$sel:cacheNodeId:NodeSnapshot' :: NodeSnapshot -> Maybe Text
$sel:cacheNodeCreateTime:NodeSnapshot' :: NodeSnapshot -> Maybe ISO8601
$sel:cacheClusterId:NodeSnapshot' :: NodeSnapshot -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
cacheClusterId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ISO8601
cacheNodeCreateTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
cacheNodeId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
cacheSize
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe NodeGroupConfiguration
nodeGroupConfiguration
      seq :: forall a b. a -> b -> b
`Prelude.seq` 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 ISO8601
snapshotCreateTime