{-# 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.MemoryDb.Types.ShardDetail
-- 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.MemoryDb.Types.ShardDetail where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MemoryDb.Types.ShardConfiguration
import qualified Amazonka.Prelude as Prelude

-- | Provides details of a shard in a snapshot
--
-- /See:/ 'newShardDetail' smart constructor.
data ShardDetail = ShardDetail'
  { -- | The configuration details of the shard
    ShardDetail -> Maybe ShardConfiguration
configuration :: Prelude.Maybe ShardConfiguration,
    -- | The name of the shard
    ShardDetail -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The size of the shard\'s snapshot
    ShardDetail -> Maybe Text
size :: Prelude.Maybe Prelude.Text,
    -- | The date and time that the shard\'s snapshot was created
    ShardDetail -> Maybe POSIX
snapshotCreationTime :: Prelude.Maybe Data.POSIX
  }
  deriving (ShardDetail -> ShardDetail -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ShardDetail -> ShardDetail -> Bool
$c/= :: ShardDetail -> ShardDetail -> Bool
== :: ShardDetail -> ShardDetail -> Bool
$c== :: ShardDetail -> ShardDetail -> Bool
Prelude.Eq, ReadPrec [ShardDetail]
ReadPrec ShardDetail
Int -> ReadS ShardDetail
ReadS [ShardDetail]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ShardDetail]
$creadListPrec :: ReadPrec [ShardDetail]
readPrec :: ReadPrec ShardDetail
$creadPrec :: ReadPrec ShardDetail
readList :: ReadS [ShardDetail]
$creadList :: ReadS [ShardDetail]
readsPrec :: Int -> ReadS ShardDetail
$creadsPrec :: Int -> ReadS ShardDetail
Prelude.Read, Int -> ShardDetail -> ShowS
[ShardDetail] -> ShowS
ShardDetail -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ShardDetail] -> ShowS
$cshowList :: [ShardDetail] -> ShowS
show :: ShardDetail -> String
$cshow :: ShardDetail -> String
showsPrec :: Int -> ShardDetail -> ShowS
$cshowsPrec :: Int -> ShardDetail -> ShowS
Prelude.Show, forall x. Rep ShardDetail x -> ShardDetail
forall x. ShardDetail -> Rep ShardDetail x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ShardDetail x -> ShardDetail
$cfrom :: forall x. ShardDetail -> Rep ShardDetail x
Prelude.Generic)

-- |
-- Create a value of 'ShardDetail' 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:
--
-- 'configuration', 'shardDetail_configuration' - The configuration details of the shard
--
-- 'name', 'shardDetail_name' - The name of the shard
--
-- 'size', 'shardDetail_size' - The size of the shard\'s snapshot
--
-- 'snapshotCreationTime', 'shardDetail_snapshotCreationTime' - The date and time that the shard\'s snapshot was created
newShardDetail ::
  ShardDetail
newShardDetail :: ShardDetail
newShardDetail =
  ShardDetail'
    { $sel:configuration:ShardDetail' :: Maybe ShardConfiguration
configuration = forall a. Maybe a
Prelude.Nothing,
      $sel:name:ShardDetail' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:size:ShardDetail' :: Maybe Text
size = forall a. Maybe a
Prelude.Nothing,
      $sel:snapshotCreationTime:ShardDetail' :: Maybe POSIX
snapshotCreationTime = forall a. Maybe a
Prelude.Nothing
    }

-- | The configuration details of the shard
shardDetail_configuration :: Lens.Lens' ShardDetail (Prelude.Maybe ShardConfiguration)
shardDetail_configuration :: Lens' ShardDetail (Maybe ShardConfiguration)
shardDetail_configuration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ShardDetail' {Maybe ShardConfiguration
configuration :: Maybe ShardConfiguration
$sel:configuration:ShardDetail' :: ShardDetail -> Maybe ShardConfiguration
configuration} -> Maybe ShardConfiguration
configuration) (\s :: ShardDetail
s@ShardDetail' {} Maybe ShardConfiguration
a -> ShardDetail
s {$sel:configuration:ShardDetail' :: Maybe ShardConfiguration
configuration = Maybe ShardConfiguration
a} :: ShardDetail)

-- | The name of the shard
shardDetail_name :: Lens.Lens' ShardDetail (Prelude.Maybe Prelude.Text)
shardDetail_name :: Lens' ShardDetail (Maybe Text)
shardDetail_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ShardDetail' {Maybe Text
name :: Maybe Text
$sel:name:ShardDetail' :: ShardDetail -> Maybe Text
name} -> Maybe Text
name) (\s :: ShardDetail
s@ShardDetail' {} Maybe Text
a -> ShardDetail
s {$sel:name:ShardDetail' :: Maybe Text
name = Maybe Text
a} :: ShardDetail)

-- | The size of the shard\'s snapshot
shardDetail_size :: Lens.Lens' ShardDetail (Prelude.Maybe Prelude.Text)
shardDetail_size :: Lens' ShardDetail (Maybe Text)
shardDetail_size = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ShardDetail' {Maybe Text
size :: Maybe Text
$sel:size:ShardDetail' :: ShardDetail -> Maybe Text
size} -> Maybe Text
size) (\s :: ShardDetail
s@ShardDetail' {} Maybe Text
a -> ShardDetail
s {$sel:size:ShardDetail' :: Maybe Text
size = Maybe Text
a} :: ShardDetail)

-- | The date and time that the shard\'s snapshot was created
shardDetail_snapshotCreationTime :: Lens.Lens' ShardDetail (Prelude.Maybe Prelude.UTCTime)
shardDetail_snapshotCreationTime :: Lens' ShardDetail (Maybe UTCTime)
shardDetail_snapshotCreationTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ShardDetail' {Maybe POSIX
snapshotCreationTime :: Maybe POSIX
$sel:snapshotCreationTime:ShardDetail' :: ShardDetail -> Maybe POSIX
snapshotCreationTime} -> Maybe POSIX
snapshotCreationTime) (\s :: ShardDetail
s@ShardDetail' {} Maybe POSIX
a -> ShardDetail
s {$sel:snapshotCreationTime:ShardDetail' :: Maybe POSIX
snapshotCreationTime = Maybe POSIX
a} :: ShardDetail) 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.FromJSON ShardDetail where
  parseJSON :: Value -> Parser ShardDetail
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ShardDetail"
      ( \Object
x ->
          Maybe ShardConfiguration
-> Maybe Text -> Maybe Text -> Maybe POSIX -> ShardDetail
ShardDetail'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Configuration")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Name")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Size")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"SnapshotCreationTime")
      )

instance Prelude.Hashable ShardDetail where
  hashWithSalt :: Int -> ShardDetail -> Int
hashWithSalt Int
_salt ShardDetail' {Maybe Text
Maybe POSIX
Maybe ShardConfiguration
snapshotCreationTime :: Maybe POSIX
size :: Maybe Text
name :: Maybe Text
configuration :: Maybe ShardConfiguration
$sel:snapshotCreationTime:ShardDetail' :: ShardDetail -> Maybe POSIX
$sel:size:ShardDetail' :: ShardDetail -> Maybe Text
$sel:name:ShardDetail' :: ShardDetail -> Maybe Text
$sel:configuration:ShardDetail' :: ShardDetail -> Maybe ShardConfiguration
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ShardConfiguration
configuration
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
size
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
snapshotCreationTime

instance Prelude.NFData ShardDetail where
  rnf :: ShardDetail -> ()
rnf ShardDetail' {Maybe Text
Maybe POSIX
Maybe ShardConfiguration
snapshotCreationTime :: Maybe POSIX
size :: Maybe Text
name :: Maybe Text
configuration :: Maybe ShardConfiguration
$sel:snapshotCreationTime:ShardDetail' :: ShardDetail -> Maybe POSIX
$sel:size:ShardDetail' :: ShardDetail -> Maybe Text
$sel:name:ShardDetail' :: ShardDetail -> Maybe Text
$sel:configuration:ShardDetail' :: ShardDetail -> Maybe ShardConfiguration
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ShardConfiguration
configuration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
size
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
snapshotCreationTime