{-# 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.KinesisAnalyticsV2.Types.SnapshotDetails
-- 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.KinesisAnalyticsV2.Types.SnapshotDetails where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.KinesisAnalyticsV2.Types.SnapshotStatus
import qualified Amazonka.Prelude as Prelude

-- | Provides details about a snapshot of application state.
--
-- /See:/ 'newSnapshotDetails' smart constructor.
data SnapshotDetails = SnapshotDetails'
  { -- | The timestamp of the application snapshot.
    SnapshotDetails -> Maybe POSIX
snapshotCreationTimestamp :: Prelude.Maybe Data.POSIX,
    -- | The identifier for the application snapshot.
    SnapshotDetails -> Text
snapshotName :: Prelude.Text,
    -- | The status of the application snapshot.
    SnapshotDetails -> SnapshotStatus
snapshotStatus :: SnapshotStatus,
    -- | The current application version ID when the snapshot was created.
    SnapshotDetails -> Natural
applicationVersionId :: Prelude.Natural
  }
  deriving (SnapshotDetails -> SnapshotDetails -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SnapshotDetails -> SnapshotDetails -> Bool
$c/= :: SnapshotDetails -> SnapshotDetails -> Bool
== :: SnapshotDetails -> SnapshotDetails -> Bool
$c== :: SnapshotDetails -> SnapshotDetails -> Bool
Prelude.Eq, ReadPrec [SnapshotDetails]
ReadPrec SnapshotDetails
Int -> ReadS SnapshotDetails
ReadS [SnapshotDetails]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SnapshotDetails]
$creadListPrec :: ReadPrec [SnapshotDetails]
readPrec :: ReadPrec SnapshotDetails
$creadPrec :: ReadPrec SnapshotDetails
readList :: ReadS [SnapshotDetails]
$creadList :: ReadS [SnapshotDetails]
readsPrec :: Int -> ReadS SnapshotDetails
$creadsPrec :: Int -> ReadS SnapshotDetails
Prelude.Read, Int -> SnapshotDetails -> ShowS
[SnapshotDetails] -> ShowS
SnapshotDetails -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SnapshotDetails] -> ShowS
$cshowList :: [SnapshotDetails] -> ShowS
show :: SnapshotDetails -> String
$cshow :: SnapshotDetails -> String
showsPrec :: Int -> SnapshotDetails -> ShowS
$cshowsPrec :: Int -> SnapshotDetails -> ShowS
Prelude.Show, forall x. Rep SnapshotDetails x -> SnapshotDetails
forall x. SnapshotDetails -> Rep SnapshotDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SnapshotDetails x -> SnapshotDetails
$cfrom :: forall x. SnapshotDetails -> Rep SnapshotDetails x
Prelude.Generic)

-- |
-- Create a value of 'SnapshotDetails' 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:
--
-- 'snapshotCreationTimestamp', 'snapshotDetails_snapshotCreationTimestamp' - The timestamp of the application snapshot.
--
-- 'snapshotName', 'snapshotDetails_snapshotName' - The identifier for the application snapshot.
--
-- 'snapshotStatus', 'snapshotDetails_snapshotStatus' - The status of the application snapshot.
--
-- 'applicationVersionId', 'snapshotDetails_applicationVersionId' - The current application version ID when the snapshot was created.
newSnapshotDetails ::
  -- | 'snapshotName'
  Prelude.Text ->
  -- | 'snapshotStatus'
  SnapshotStatus ->
  -- | 'applicationVersionId'
  Prelude.Natural ->
  SnapshotDetails
newSnapshotDetails :: Text -> SnapshotStatus -> Natural -> SnapshotDetails
newSnapshotDetails
  Text
pSnapshotName_
  SnapshotStatus
pSnapshotStatus_
  Natural
pApplicationVersionId_ =
    SnapshotDetails'
      { $sel:snapshotCreationTimestamp:SnapshotDetails' :: Maybe POSIX
snapshotCreationTimestamp =
          forall a. Maybe a
Prelude.Nothing,
        $sel:snapshotName:SnapshotDetails' :: Text
snapshotName = Text
pSnapshotName_,
        $sel:snapshotStatus:SnapshotDetails' :: SnapshotStatus
snapshotStatus = SnapshotStatus
pSnapshotStatus_,
        $sel:applicationVersionId:SnapshotDetails' :: Natural
applicationVersionId = Natural
pApplicationVersionId_
      }

-- | The timestamp of the application snapshot.
snapshotDetails_snapshotCreationTimestamp :: Lens.Lens' SnapshotDetails (Prelude.Maybe Prelude.UTCTime)
snapshotDetails_snapshotCreationTimestamp :: Lens' SnapshotDetails (Maybe UTCTime)
snapshotDetails_snapshotCreationTimestamp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SnapshotDetails' {Maybe POSIX
snapshotCreationTimestamp :: Maybe POSIX
$sel:snapshotCreationTimestamp:SnapshotDetails' :: SnapshotDetails -> Maybe POSIX
snapshotCreationTimestamp} -> Maybe POSIX
snapshotCreationTimestamp) (\s :: SnapshotDetails
s@SnapshotDetails' {} Maybe POSIX
a -> SnapshotDetails
s {$sel:snapshotCreationTimestamp:SnapshotDetails' :: Maybe POSIX
snapshotCreationTimestamp = Maybe POSIX
a} :: SnapshotDetails) 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 identifier for the application snapshot.
snapshotDetails_snapshotName :: Lens.Lens' SnapshotDetails Prelude.Text
snapshotDetails_snapshotName :: Lens' SnapshotDetails Text
snapshotDetails_snapshotName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SnapshotDetails' {Text
snapshotName :: Text
$sel:snapshotName:SnapshotDetails' :: SnapshotDetails -> Text
snapshotName} -> Text
snapshotName) (\s :: SnapshotDetails
s@SnapshotDetails' {} Text
a -> SnapshotDetails
s {$sel:snapshotName:SnapshotDetails' :: Text
snapshotName = Text
a} :: SnapshotDetails)

-- | The status of the application snapshot.
snapshotDetails_snapshotStatus :: Lens.Lens' SnapshotDetails SnapshotStatus
snapshotDetails_snapshotStatus :: Lens' SnapshotDetails SnapshotStatus
snapshotDetails_snapshotStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SnapshotDetails' {SnapshotStatus
snapshotStatus :: SnapshotStatus
$sel:snapshotStatus:SnapshotDetails' :: SnapshotDetails -> SnapshotStatus
snapshotStatus} -> SnapshotStatus
snapshotStatus) (\s :: SnapshotDetails
s@SnapshotDetails' {} SnapshotStatus
a -> SnapshotDetails
s {$sel:snapshotStatus:SnapshotDetails' :: SnapshotStatus
snapshotStatus = SnapshotStatus
a} :: SnapshotDetails)

-- | The current application version ID when the snapshot was created.
snapshotDetails_applicationVersionId :: Lens.Lens' SnapshotDetails Prelude.Natural
snapshotDetails_applicationVersionId :: Lens' SnapshotDetails Natural
snapshotDetails_applicationVersionId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SnapshotDetails' {Natural
applicationVersionId :: Natural
$sel:applicationVersionId:SnapshotDetails' :: SnapshotDetails -> Natural
applicationVersionId} -> Natural
applicationVersionId) (\s :: SnapshotDetails
s@SnapshotDetails' {} Natural
a -> SnapshotDetails
s {$sel:applicationVersionId:SnapshotDetails' :: Natural
applicationVersionId = Natural
a} :: SnapshotDetails)

instance Data.FromJSON SnapshotDetails where
  parseJSON :: Value -> Parser SnapshotDetails
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SnapshotDetails"
      ( \Object
x ->
          Maybe POSIX -> Text -> SnapshotStatus -> Natural -> SnapshotDetails
SnapshotDetails'
            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
"SnapshotCreationTimestamp")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"SnapshotName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"SnapshotStatus")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"ApplicationVersionId")
      )

instance Prelude.Hashable SnapshotDetails where
  hashWithSalt :: Int -> SnapshotDetails -> Int
hashWithSalt Int
_salt SnapshotDetails' {Natural
Maybe POSIX
Text
SnapshotStatus
applicationVersionId :: Natural
snapshotStatus :: SnapshotStatus
snapshotName :: Text
snapshotCreationTimestamp :: Maybe POSIX
$sel:applicationVersionId:SnapshotDetails' :: SnapshotDetails -> Natural
$sel:snapshotStatus:SnapshotDetails' :: SnapshotDetails -> SnapshotStatus
$sel:snapshotName:SnapshotDetails' :: SnapshotDetails -> Text
$sel:snapshotCreationTimestamp:SnapshotDetails' :: SnapshotDetails -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
snapshotCreationTimestamp
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
snapshotName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` SnapshotStatus
snapshotStatus
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
applicationVersionId

instance Prelude.NFData SnapshotDetails where
  rnf :: SnapshotDetails -> ()
rnf SnapshotDetails' {Natural
Maybe POSIX
Text
SnapshotStatus
applicationVersionId :: Natural
snapshotStatus :: SnapshotStatus
snapshotName :: Text
snapshotCreationTimestamp :: Maybe POSIX
$sel:applicationVersionId:SnapshotDetails' :: SnapshotDetails -> Natural
$sel:snapshotStatus:SnapshotDetails' :: SnapshotDetails -> SnapshotStatus
$sel:snapshotName:SnapshotDetails' :: SnapshotDetails -> Text
$sel:snapshotCreationTimestamp:SnapshotDetails' :: SnapshotDetails -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
snapshotCreationTimestamp
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
snapshotName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf SnapshotStatus
snapshotStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Natural
applicationVersionId