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

import qualified Amazonka.Core as Core
import Amazonka.KinesisAnalyticsV2.Types.SnapshotStatus
import qualified Amazonka.Lens as Lens
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 Core.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
(SnapshotDetails -> SnapshotDetails -> Bool)
-> (SnapshotDetails -> SnapshotDetails -> Bool)
-> Eq SnapshotDetails
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]
(Int -> ReadS SnapshotDetails)
-> ReadS [SnapshotDetails]
-> ReadPrec SnapshotDetails
-> ReadPrec [SnapshotDetails]
-> Read 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
(Int -> SnapshotDetails -> ShowS)
-> (SnapshotDetails -> String)
-> ([SnapshotDetails] -> ShowS)
-> Show SnapshotDetails
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. SnapshotDetails -> Rep SnapshotDetails x)
-> (forall x. Rep SnapshotDetails x -> SnapshotDetails)
-> Generic SnapshotDetails
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' :: Maybe POSIX -> Text -> SnapshotStatus -> Natural -> SnapshotDetails
SnapshotDetails'
      { $sel:snapshotCreationTimestamp:SnapshotDetails' :: Maybe POSIX
snapshotCreationTimestamp =
          Maybe POSIX
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 :: (Maybe UTCTime -> f (Maybe UTCTime))
-> SnapshotDetails -> f SnapshotDetails
snapshotDetails_snapshotCreationTimestamp = (SnapshotDetails -> Maybe POSIX)
-> (SnapshotDetails -> Maybe POSIX -> SnapshotDetails)
-> Lens SnapshotDetails SnapshotDetails (Maybe POSIX) (Maybe POSIX)
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) ((Maybe POSIX -> f (Maybe POSIX))
 -> SnapshotDetails -> f SnapshotDetails)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> SnapshotDetails
-> f SnapshotDetails
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The identifier for the application snapshot.
snapshotDetails_snapshotName :: Lens.Lens' SnapshotDetails Prelude.Text
snapshotDetails_snapshotName :: (Text -> f Text) -> SnapshotDetails -> f SnapshotDetails
snapshotDetails_snapshotName = (SnapshotDetails -> Text)
-> (SnapshotDetails -> Text -> SnapshotDetails)
-> Lens SnapshotDetails SnapshotDetails Text Text
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 :: (SnapshotStatus -> f SnapshotStatus)
-> SnapshotDetails -> f SnapshotDetails
snapshotDetails_snapshotStatus = (SnapshotDetails -> SnapshotStatus)
-> (SnapshotDetails -> SnapshotStatus -> SnapshotDetails)
-> Lens
     SnapshotDetails SnapshotDetails SnapshotStatus 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 :: (Natural -> f Natural) -> SnapshotDetails -> f SnapshotDetails
snapshotDetails_applicationVersionId = (SnapshotDetails -> Natural)
-> (SnapshotDetails -> Natural -> SnapshotDetails)
-> Lens SnapshotDetails SnapshotDetails Natural Natural
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 Core.FromJSON SnapshotDetails where
  parseJSON :: Value -> Parser SnapshotDetails
parseJSON =
    String
-> (Object -> Parser SnapshotDetails)
-> Value
-> Parser SnapshotDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SnapshotDetails"
      ( \Object
x ->
          Maybe POSIX -> Text -> SnapshotStatus -> Natural -> SnapshotDetails
SnapshotDetails'
            (Maybe POSIX
 -> Text -> SnapshotStatus -> Natural -> SnapshotDetails)
-> Parser (Maybe POSIX)
-> Parser (Text -> SnapshotStatus -> Natural -> SnapshotDetails)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SnapshotCreationTimestamp")
            Parser (Text -> SnapshotStatus -> Natural -> SnapshotDetails)
-> Parser Text
-> Parser (SnapshotStatus -> Natural -> SnapshotDetails)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"SnapshotName")
            Parser (SnapshotStatus -> Natural -> SnapshotDetails)
-> Parser SnapshotStatus -> Parser (Natural -> SnapshotDetails)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser SnapshotStatus
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"SnapshotStatus")
            Parser (Natural -> SnapshotDetails)
-> Parser Natural -> Parser SnapshotDetails
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Natural
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ApplicationVersionId")
      )

instance Prelude.Hashable SnapshotDetails

instance Prelude.NFData SnapshotDetails