{-# 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.CloudFormationStackRecordSourceInfo
-- 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.CloudFormationStackRecordSourceInfo 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.CloudFormationStackRecordSourceType
import qualified Amazonka.Prelude as Prelude

-- | Describes the source of a CloudFormation stack record (i.e., the export
-- snapshot record).
--
-- /See:/ 'newCloudFormationStackRecordSourceInfo' smart constructor.
data CloudFormationStackRecordSourceInfo = CloudFormationStackRecordSourceInfo'
  { -- | The Amazon Resource Name (ARN) of the export snapshot record.
    CloudFormationStackRecordSourceInfo -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The name of the record.
    CloudFormationStackRecordSourceInfo -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The Lightsail resource type (e.g., @ExportSnapshotRecord@).
    CloudFormationStackRecordSourceInfo
-> Maybe CloudFormationStackRecordSourceType
resourceType :: Prelude.Maybe CloudFormationStackRecordSourceType
  }
  deriving (CloudFormationStackRecordSourceInfo
-> CloudFormationStackRecordSourceInfo -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CloudFormationStackRecordSourceInfo
-> CloudFormationStackRecordSourceInfo -> Bool
$c/= :: CloudFormationStackRecordSourceInfo
-> CloudFormationStackRecordSourceInfo -> Bool
== :: CloudFormationStackRecordSourceInfo
-> CloudFormationStackRecordSourceInfo -> Bool
$c== :: CloudFormationStackRecordSourceInfo
-> CloudFormationStackRecordSourceInfo -> Bool
Prelude.Eq, ReadPrec [CloudFormationStackRecordSourceInfo]
ReadPrec CloudFormationStackRecordSourceInfo
Int -> ReadS CloudFormationStackRecordSourceInfo
ReadS [CloudFormationStackRecordSourceInfo]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CloudFormationStackRecordSourceInfo]
$creadListPrec :: ReadPrec [CloudFormationStackRecordSourceInfo]
readPrec :: ReadPrec CloudFormationStackRecordSourceInfo
$creadPrec :: ReadPrec CloudFormationStackRecordSourceInfo
readList :: ReadS [CloudFormationStackRecordSourceInfo]
$creadList :: ReadS [CloudFormationStackRecordSourceInfo]
readsPrec :: Int -> ReadS CloudFormationStackRecordSourceInfo
$creadsPrec :: Int -> ReadS CloudFormationStackRecordSourceInfo
Prelude.Read, Int -> CloudFormationStackRecordSourceInfo -> ShowS
[CloudFormationStackRecordSourceInfo] -> ShowS
CloudFormationStackRecordSourceInfo -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CloudFormationStackRecordSourceInfo] -> ShowS
$cshowList :: [CloudFormationStackRecordSourceInfo] -> ShowS
show :: CloudFormationStackRecordSourceInfo -> String
$cshow :: CloudFormationStackRecordSourceInfo -> String
showsPrec :: Int -> CloudFormationStackRecordSourceInfo -> ShowS
$cshowsPrec :: Int -> CloudFormationStackRecordSourceInfo -> ShowS
Prelude.Show, forall x.
Rep CloudFormationStackRecordSourceInfo x
-> CloudFormationStackRecordSourceInfo
forall x.
CloudFormationStackRecordSourceInfo
-> Rep CloudFormationStackRecordSourceInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CloudFormationStackRecordSourceInfo x
-> CloudFormationStackRecordSourceInfo
$cfrom :: forall x.
CloudFormationStackRecordSourceInfo
-> Rep CloudFormationStackRecordSourceInfo x
Prelude.Generic)

-- |
-- Create a value of 'CloudFormationStackRecordSourceInfo' 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', 'cloudFormationStackRecordSourceInfo_arn' - The Amazon Resource Name (ARN) of the export snapshot record.
--
-- 'name', 'cloudFormationStackRecordSourceInfo_name' - The name of the record.
--
-- 'resourceType', 'cloudFormationStackRecordSourceInfo_resourceType' - The Lightsail resource type (e.g., @ExportSnapshotRecord@).
newCloudFormationStackRecordSourceInfo ::
  CloudFormationStackRecordSourceInfo
newCloudFormationStackRecordSourceInfo :: CloudFormationStackRecordSourceInfo
newCloudFormationStackRecordSourceInfo =
  CloudFormationStackRecordSourceInfo'
    { $sel:arn:CloudFormationStackRecordSourceInfo' :: Maybe Text
arn =
        forall a. Maybe a
Prelude.Nothing,
      $sel:name:CloudFormationStackRecordSourceInfo' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:resourceType:CloudFormationStackRecordSourceInfo' :: Maybe CloudFormationStackRecordSourceType
resourceType = forall a. Maybe a
Prelude.Nothing
    }

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

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

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

instance
  Data.FromJSON
    CloudFormationStackRecordSourceInfo
  where
  parseJSON :: Value -> Parser CloudFormationStackRecordSourceInfo
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"CloudFormationStackRecordSourceInfo"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe CloudFormationStackRecordSourceType
-> CloudFormationStackRecordSourceInfo
CloudFormationStackRecordSourceInfo'
            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
"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")
      )

instance
  Prelude.Hashable
    CloudFormationStackRecordSourceInfo
  where
  hashWithSalt :: Int -> CloudFormationStackRecordSourceInfo -> Int
hashWithSalt
    Int
_salt
    CloudFormationStackRecordSourceInfo' {Maybe Text
Maybe CloudFormationStackRecordSourceType
resourceType :: Maybe CloudFormationStackRecordSourceType
name :: Maybe Text
arn :: Maybe Text
$sel:resourceType:CloudFormationStackRecordSourceInfo' :: CloudFormationStackRecordSourceInfo
-> Maybe CloudFormationStackRecordSourceType
$sel:name:CloudFormationStackRecordSourceInfo' :: CloudFormationStackRecordSourceInfo -> Maybe Text
$sel:arn:CloudFormationStackRecordSourceInfo' :: CloudFormationStackRecordSourceInfo -> 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 Text
name
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CloudFormationStackRecordSourceType
resourceType

instance
  Prelude.NFData
    CloudFormationStackRecordSourceInfo
  where
  rnf :: CloudFormationStackRecordSourceInfo -> ()
rnf CloudFormationStackRecordSourceInfo' {Maybe Text
Maybe CloudFormationStackRecordSourceType
resourceType :: Maybe CloudFormationStackRecordSourceType
name :: Maybe Text
arn :: Maybe Text
$sel:resourceType:CloudFormationStackRecordSourceInfo' :: CloudFormationStackRecordSourceInfo
-> Maybe CloudFormationStackRecordSourceType
$sel:name:CloudFormationStackRecordSourceInfo' :: CloudFormationStackRecordSourceInfo -> Maybe Text
$sel:arn:CloudFormationStackRecordSourceInfo' :: CloudFormationStackRecordSourceInfo -> 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 Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe CloudFormationStackRecordSourceType
resourceType