{-# 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.Lightsail.Types.ExportSnapshotRecord
-- 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.Lightsail.Types.ExportSnapshotRecord where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Lightsail.Types.DestinationInfo
import Amazonka.Lightsail.Types.ExportSnapshotRecordSourceInfo
import Amazonka.Lightsail.Types.RecordState
import Amazonka.Lightsail.Types.ResourceLocation
import Amazonka.Lightsail.Types.ResourceType
import qualified Amazonka.Prelude as Prelude

-- | Describes an export snapshot record.
--
-- /See:/ 'newExportSnapshotRecord' smart constructor.
data ExportSnapshotRecord = ExportSnapshotRecord'
  { -- | The Amazon Resource Name (ARN) of the export snapshot record.
    ExportSnapshotRecord -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The date when the export snapshot record was created.
    ExportSnapshotRecord -> Maybe POSIX
createdAt :: Prelude.Maybe Data.POSIX,
    -- | A list of objects describing the destination of the export snapshot
    -- record.
    ExportSnapshotRecord -> Maybe DestinationInfo
destinationInfo :: Prelude.Maybe DestinationInfo,
    -- | The AWS Region and Availability Zone where the export snapshot record is
    -- located.
    ExportSnapshotRecord -> Maybe ResourceLocation
location :: Prelude.Maybe ResourceLocation,
    -- | The export snapshot record name.
    ExportSnapshotRecord -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The Lightsail resource type (e.g., @ExportSnapshotRecord@).
    ExportSnapshotRecord -> Maybe ResourceType
resourceType :: Prelude.Maybe ResourceType,
    -- | A list of objects describing the source of the export snapshot record.
    ExportSnapshotRecord -> Maybe ExportSnapshotRecordSourceInfo
sourceInfo :: Prelude.Maybe ExportSnapshotRecordSourceInfo,
    -- | The state of the export snapshot record.
    ExportSnapshotRecord -> Maybe RecordState
state :: Prelude.Maybe RecordState
  }
  deriving (ExportSnapshotRecord -> ExportSnapshotRecord -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExportSnapshotRecord -> ExportSnapshotRecord -> Bool
$c/= :: ExportSnapshotRecord -> ExportSnapshotRecord -> Bool
== :: ExportSnapshotRecord -> ExportSnapshotRecord -> Bool
$c== :: ExportSnapshotRecord -> ExportSnapshotRecord -> Bool
Prelude.Eq, ReadPrec [ExportSnapshotRecord]
ReadPrec ExportSnapshotRecord
Int -> ReadS ExportSnapshotRecord
ReadS [ExportSnapshotRecord]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ExportSnapshotRecord]
$creadListPrec :: ReadPrec [ExportSnapshotRecord]
readPrec :: ReadPrec ExportSnapshotRecord
$creadPrec :: ReadPrec ExportSnapshotRecord
readList :: ReadS [ExportSnapshotRecord]
$creadList :: ReadS [ExportSnapshotRecord]
readsPrec :: Int -> ReadS ExportSnapshotRecord
$creadsPrec :: Int -> ReadS ExportSnapshotRecord
Prelude.Read, Int -> ExportSnapshotRecord -> ShowS
[ExportSnapshotRecord] -> ShowS
ExportSnapshotRecord -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExportSnapshotRecord] -> ShowS
$cshowList :: [ExportSnapshotRecord] -> ShowS
show :: ExportSnapshotRecord -> String
$cshow :: ExportSnapshotRecord -> String
showsPrec :: Int -> ExportSnapshotRecord -> ShowS
$cshowsPrec :: Int -> ExportSnapshotRecord -> ShowS
Prelude.Show, forall x. Rep ExportSnapshotRecord x -> ExportSnapshotRecord
forall x. ExportSnapshotRecord -> Rep ExportSnapshotRecord x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ExportSnapshotRecord x -> ExportSnapshotRecord
$cfrom :: forall x. ExportSnapshotRecord -> Rep ExportSnapshotRecord x
Prelude.Generic)

-- |
-- Create a value of 'ExportSnapshotRecord' 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:
--
-- 'arn', 'exportSnapshotRecord_arn' - The Amazon Resource Name (ARN) of the export snapshot record.
--
-- 'createdAt', 'exportSnapshotRecord_createdAt' - The date when the export snapshot record was created.
--
-- 'destinationInfo', 'exportSnapshotRecord_destinationInfo' - A list of objects describing the destination of the export snapshot
-- record.
--
-- 'location', 'exportSnapshotRecord_location' - The AWS Region and Availability Zone where the export snapshot record is
-- located.
--
-- 'name', 'exportSnapshotRecord_name' - The export snapshot record name.
--
-- 'resourceType', 'exportSnapshotRecord_resourceType' - The Lightsail resource type (e.g., @ExportSnapshotRecord@).
--
-- 'sourceInfo', 'exportSnapshotRecord_sourceInfo' - A list of objects describing the source of the export snapshot record.
--
-- 'state', 'exportSnapshotRecord_state' - The state of the export snapshot record.
newExportSnapshotRecord ::
  ExportSnapshotRecord
newExportSnapshotRecord :: ExportSnapshotRecord
newExportSnapshotRecord =
  ExportSnapshotRecord'
    { $sel:arn:ExportSnapshotRecord' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:createdAt:ExportSnapshotRecord' :: Maybe POSIX
createdAt = forall a. Maybe a
Prelude.Nothing,
      $sel:destinationInfo:ExportSnapshotRecord' :: Maybe DestinationInfo
destinationInfo = forall a. Maybe a
Prelude.Nothing,
      $sel:location:ExportSnapshotRecord' :: Maybe ResourceLocation
location = forall a. Maybe a
Prelude.Nothing,
      $sel:name:ExportSnapshotRecord' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:resourceType:ExportSnapshotRecord' :: Maybe ResourceType
resourceType = forall a. Maybe a
Prelude.Nothing,
      $sel:sourceInfo:ExportSnapshotRecord' :: Maybe ExportSnapshotRecordSourceInfo
sourceInfo = forall a. Maybe a
Prelude.Nothing,
      $sel:state:ExportSnapshotRecord' :: Maybe RecordState
state = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) of the export snapshot record.
exportSnapshotRecord_arn :: Lens.Lens' ExportSnapshotRecord (Prelude.Maybe Prelude.Text)
exportSnapshotRecord_arn :: Lens' ExportSnapshotRecord (Maybe Text)
exportSnapshotRecord_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportSnapshotRecord' {Maybe Text
arn :: Maybe Text
$sel:arn:ExportSnapshotRecord' :: ExportSnapshotRecord -> Maybe Text
arn} -> Maybe Text
arn) (\s :: ExportSnapshotRecord
s@ExportSnapshotRecord' {} Maybe Text
a -> ExportSnapshotRecord
s {$sel:arn:ExportSnapshotRecord' :: Maybe Text
arn = Maybe Text
a} :: ExportSnapshotRecord)

-- | The date when the export snapshot record was created.
exportSnapshotRecord_createdAt :: Lens.Lens' ExportSnapshotRecord (Prelude.Maybe Prelude.UTCTime)
exportSnapshotRecord_createdAt :: Lens' ExportSnapshotRecord (Maybe UTCTime)
exportSnapshotRecord_createdAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportSnapshotRecord' {Maybe POSIX
createdAt :: Maybe POSIX
$sel:createdAt:ExportSnapshotRecord' :: ExportSnapshotRecord -> Maybe POSIX
createdAt} -> Maybe POSIX
createdAt) (\s :: ExportSnapshotRecord
s@ExportSnapshotRecord' {} Maybe POSIX
a -> ExportSnapshotRecord
s {$sel:createdAt:ExportSnapshotRecord' :: Maybe POSIX
createdAt = Maybe POSIX
a} :: ExportSnapshotRecord) 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

-- | A list of objects describing the destination of the export snapshot
-- record.
exportSnapshotRecord_destinationInfo :: Lens.Lens' ExportSnapshotRecord (Prelude.Maybe DestinationInfo)
exportSnapshotRecord_destinationInfo :: Lens' ExportSnapshotRecord (Maybe DestinationInfo)
exportSnapshotRecord_destinationInfo = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportSnapshotRecord' {Maybe DestinationInfo
destinationInfo :: Maybe DestinationInfo
$sel:destinationInfo:ExportSnapshotRecord' :: ExportSnapshotRecord -> Maybe DestinationInfo
destinationInfo} -> Maybe DestinationInfo
destinationInfo) (\s :: ExportSnapshotRecord
s@ExportSnapshotRecord' {} Maybe DestinationInfo
a -> ExportSnapshotRecord
s {$sel:destinationInfo:ExportSnapshotRecord' :: Maybe DestinationInfo
destinationInfo = Maybe DestinationInfo
a} :: ExportSnapshotRecord)

-- | The AWS Region and Availability Zone where the export snapshot record is
-- located.
exportSnapshotRecord_location :: Lens.Lens' ExportSnapshotRecord (Prelude.Maybe ResourceLocation)
exportSnapshotRecord_location :: Lens' ExportSnapshotRecord (Maybe ResourceLocation)
exportSnapshotRecord_location = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportSnapshotRecord' {Maybe ResourceLocation
location :: Maybe ResourceLocation
$sel:location:ExportSnapshotRecord' :: ExportSnapshotRecord -> Maybe ResourceLocation
location} -> Maybe ResourceLocation
location) (\s :: ExportSnapshotRecord
s@ExportSnapshotRecord' {} Maybe ResourceLocation
a -> ExportSnapshotRecord
s {$sel:location:ExportSnapshotRecord' :: Maybe ResourceLocation
location = Maybe ResourceLocation
a} :: ExportSnapshotRecord)

-- | The export snapshot record name.
exportSnapshotRecord_name :: Lens.Lens' ExportSnapshotRecord (Prelude.Maybe Prelude.Text)
exportSnapshotRecord_name :: Lens' ExportSnapshotRecord (Maybe Text)
exportSnapshotRecord_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportSnapshotRecord' {Maybe Text
name :: Maybe Text
$sel:name:ExportSnapshotRecord' :: ExportSnapshotRecord -> Maybe Text
name} -> Maybe Text
name) (\s :: ExportSnapshotRecord
s@ExportSnapshotRecord' {} Maybe Text
a -> ExportSnapshotRecord
s {$sel:name:ExportSnapshotRecord' :: Maybe Text
name = Maybe Text
a} :: ExportSnapshotRecord)

-- | The Lightsail resource type (e.g., @ExportSnapshotRecord@).
exportSnapshotRecord_resourceType :: Lens.Lens' ExportSnapshotRecord (Prelude.Maybe ResourceType)
exportSnapshotRecord_resourceType :: Lens' ExportSnapshotRecord (Maybe ResourceType)
exportSnapshotRecord_resourceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportSnapshotRecord' {Maybe ResourceType
resourceType :: Maybe ResourceType
$sel:resourceType:ExportSnapshotRecord' :: ExportSnapshotRecord -> Maybe ResourceType
resourceType} -> Maybe ResourceType
resourceType) (\s :: ExportSnapshotRecord
s@ExportSnapshotRecord' {} Maybe ResourceType
a -> ExportSnapshotRecord
s {$sel:resourceType:ExportSnapshotRecord' :: Maybe ResourceType
resourceType = Maybe ResourceType
a} :: ExportSnapshotRecord)

-- | A list of objects describing the source of the export snapshot record.
exportSnapshotRecord_sourceInfo :: Lens.Lens' ExportSnapshotRecord (Prelude.Maybe ExportSnapshotRecordSourceInfo)
exportSnapshotRecord_sourceInfo :: Lens' ExportSnapshotRecord (Maybe ExportSnapshotRecordSourceInfo)
exportSnapshotRecord_sourceInfo = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportSnapshotRecord' {Maybe ExportSnapshotRecordSourceInfo
sourceInfo :: Maybe ExportSnapshotRecordSourceInfo
$sel:sourceInfo:ExportSnapshotRecord' :: ExportSnapshotRecord -> Maybe ExportSnapshotRecordSourceInfo
sourceInfo} -> Maybe ExportSnapshotRecordSourceInfo
sourceInfo) (\s :: ExportSnapshotRecord
s@ExportSnapshotRecord' {} Maybe ExportSnapshotRecordSourceInfo
a -> ExportSnapshotRecord
s {$sel:sourceInfo:ExportSnapshotRecord' :: Maybe ExportSnapshotRecordSourceInfo
sourceInfo = Maybe ExportSnapshotRecordSourceInfo
a} :: ExportSnapshotRecord)

-- | The state of the export snapshot record.
exportSnapshotRecord_state :: Lens.Lens' ExportSnapshotRecord (Prelude.Maybe RecordState)
exportSnapshotRecord_state :: Lens' ExportSnapshotRecord (Maybe RecordState)
exportSnapshotRecord_state = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportSnapshotRecord' {Maybe RecordState
state :: Maybe RecordState
$sel:state:ExportSnapshotRecord' :: ExportSnapshotRecord -> Maybe RecordState
state} -> Maybe RecordState
state) (\s :: ExportSnapshotRecord
s@ExportSnapshotRecord' {} Maybe RecordState
a -> ExportSnapshotRecord
s {$sel:state:ExportSnapshotRecord' :: Maybe RecordState
state = Maybe RecordState
a} :: ExportSnapshotRecord)

instance Data.FromJSON ExportSnapshotRecord where
  parseJSON :: Value -> Parser ExportSnapshotRecord
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ExportSnapshotRecord"
      ( \Object
x ->
          Maybe Text
-> Maybe POSIX
-> Maybe DestinationInfo
-> Maybe ResourceLocation
-> Maybe Text
-> Maybe ResourceType
-> Maybe ExportSnapshotRecordSourceInfo
-> Maybe RecordState
-> ExportSnapshotRecord
ExportSnapshotRecord'
            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
"arn")
            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
"createdAt")
            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
"destinationInfo")
            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
"location")
            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
"resourceType")
            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
"sourceInfo")
            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
"state")
      )

instance Prelude.Hashable ExportSnapshotRecord where
  hashWithSalt :: Int -> ExportSnapshotRecord -> Int
hashWithSalt Int
_salt ExportSnapshotRecord' {Maybe Text
Maybe POSIX
Maybe DestinationInfo
Maybe ExportSnapshotRecordSourceInfo
Maybe RecordState
Maybe ResourceLocation
Maybe ResourceType
state :: Maybe RecordState
sourceInfo :: Maybe ExportSnapshotRecordSourceInfo
resourceType :: Maybe ResourceType
name :: Maybe Text
location :: Maybe ResourceLocation
destinationInfo :: Maybe DestinationInfo
createdAt :: Maybe POSIX
arn :: Maybe Text
$sel:state:ExportSnapshotRecord' :: ExportSnapshotRecord -> Maybe RecordState
$sel:sourceInfo:ExportSnapshotRecord' :: ExportSnapshotRecord -> Maybe ExportSnapshotRecordSourceInfo
$sel:resourceType:ExportSnapshotRecord' :: ExportSnapshotRecord -> Maybe ResourceType
$sel:name:ExportSnapshotRecord' :: ExportSnapshotRecord -> Maybe Text
$sel:location:ExportSnapshotRecord' :: ExportSnapshotRecord -> Maybe ResourceLocation
$sel:destinationInfo:ExportSnapshotRecord' :: ExportSnapshotRecord -> Maybe DestinationInfo
$sel:createdAt:ExportSnapshotRecord' :: ExportSnapshotRecord -> Maybe POSIX
$sel:arn:ExportSnapshotRecord' :: ExportSnapshotRecord -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
createdAt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe DestinationInfo
destinationInfo
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ResourceLocation
location
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ResourceType
resourceType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ExportSnapshotRecordSourceInfo
sourceInfo
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe RecordState
state

instance Prelude.NFData ExportSnapshotRecord where
  rnf :: ExportSnapshotRecord -> ()
rnf ExportSnapshotRecord' {Maybe Text
Maybe POSIX
Maybe DestinationInfo
Maybe ExportSnapshotRecordSourceInfo
Maybe RecordState
Maybe ResourceLocation
Maybe ResourceType
state :: Maybe RecordState
sourceInfo :: Maybe ExportSnapshotRecordSourceInfo
resourceType :: Maybe ResourceType
name :: Maybe Text
location :: Maybe ResourceLocation
destinationInfo :: Maybe DestinationInfo
createdAt :: Maybe POSIX
arn :: Maybe Text
$sel:state:ExportSnapshotRecord' :: ExportSnapshotRecord -> Maybe RecordState
$sel:sourceInfo:ExportSnapshotRecord' :: ExportSnapshotRecord -> Maybe ExportSnapshotRecordSourceInfo
$sel:resourceType:ExportSnapshotRecord' :: ExportSnapshotRecord -> Maybe ResourceType
$sel:name:ExportSnapshotRecord' :: ExportSnapshotRecord -> Maybe Text
$sel:location:ExportSnapshotRecord' :: ExportSnapshotRecord -> Maybe ResourceLocation
$sel:destinationInfo:ExportSnapshotRecord' :: ExportSnapshotRecord -> Maybe DestinationInfo
$sel:createdAt:ExportSnapshotRecord' :: ExportSnapshotRecord -> Maybe POSIX
$sel:arn:ExportSnapshotRecord' :: ExportSnapshotRecord -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
createdAt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe DestinationInfo
destinationInfo
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ResourceLocation
location
      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 ResourceType
resourceType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ExportSnapshotRecordSourceInfo
sourceInfo
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe RecordState
state