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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 Lightsail resource type (e.g., @ExportSnapshotRecord@).
    CloudFormationStackRecordSourceInfo
-> Maybe CloudFormationStackRecordSourceType
resourceType :: Prelude.Maybe CloudFormationStackRecordSourceType,
    -- | 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
  }
  deriving (CloudFormationStackRecordSourceInfo
-> CloudFormationStackRecordSourceInfo -> Bool
(CloudFormationStackRecordSourceInfo
 -> CloudFormationStackRecordSourceInfo -> Bool)
-> (CloudFormationStackRecordSourceInfo
    -> CloudFormationStackRecordSourceInfo -> Bool)
-> Eq CloudFormationStackRecordSourceInfo
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]
(Int -> ReadS CloudFormationStackRecordSourceInfo)
-> ReadS [CloudFormationStackRecordSourceInfo]
-> ReadPrec CloudFormationStackRecordSourceInfo
-> ReadPrec [CloudFormationStackRecordSourceInfo]
-> Read 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
(Int -> CloudFormationStackRecordSourceInfo -> ShowS)
-> (CloudFormationStackRecordSourceInfo -> String)
-> ([CloudFormationStackRecordSourceInfo] -> ShowS)
-> Show CloudFormationStackRecordSourceInfo
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.
 CloudFormationStackRecordSourceInfo
 -> Rep CloudFormationStackRecordSourceInfo x)
-> (forall x.
    Rep CloudFormationStackRecordSourceInfo x
    -> CloudFormationStackRecordSourceInfo)
-> Generic CloudFormationStackRecordSourceInfo
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:
--
-- 'resourceType', 'cloudFormationStackRecordSourceInfo_resourceType' - The Lightsail resource type (e.g., @ExportSnapshotRecord@).
--
-- 'arn', 'cloudFormationStackRecordSourceInfo_arn' - The Amazon Resource Name (ARN) of the export snapshot record.
--
-- 'name', 'cloudFormationStackRecordSourceInfo_name' - The name of the record.
newCloudFormationStackRecordSourceInfo ::
  CloudFormationStackRecordSourceInfo
newCloudFormationStackRecordSourceInfo :: CloudFormationStackRecordSourceInfo
newCloudFormationStackRecordSourceInfo =
  CloudFormationStackRecordSourceInfo' :: Maybe CloudFormationStackRecordSourceType
-> Maybe Text -> Maybe Text -> CloudFormationStackRecordSourceInfo
CloudFormationStackRecordSourceInfo'
    { $sel:resourceType:CloudFormationStackRecordSourceInfo' :: Maybe CloudFormationStackRecordSourceType
resourceType =
        Maybe CloudFormationStackRecordSourceType
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:CloudFormationStackRecordSourceInfo' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:CloudFormationStackRecordSourceInfo' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The Lightsail resource type (e.g., @ExportSnapshotRecord@).
cloudFormationStackRecordSourceInfo_resourceType :: Lens.Lens' CloudFormationStackRecordSourceInfo (Prelude.Maybe CloudFormationStackRecordSourceType)
cloudFormationStackRecordSourceInfo_resourceType :: (Maybe CloudFormationStackRecordSourceType
 -> f (Maybe CloudFormationStackRecordSourceType))
-> CloudFormationStackRecordSourceInfo
-> f CloudFormationStackRecordSourceInfo
cloudFormationStackRecordSourceInfo_resourceType = (CloudFormationStackRecordSourceInfo
 -> Maybe CloudFormationStackRecordSourceType)
-> (CloudFormationStackRecordSourceInfo
    -> Maybe CloudFormationStackRecordSourceType
    -> CloudFormationStackRecordSourceInfo)
-> Lens
     CloudFormationStackRecordSourceInfo
     CloudFormationStackRecordSourceInfo
     (Maybe CloudFormationStackRecordSourceType)
     (Maybe CloudFormationStackRecordSourceType)
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)

-- | The Amazon Resource Name (ARN) of the export snapshot record.
cloudFormationStackRecordSourceInfo_arn :: Lens.Lens' CloudFormationStackRecordSourceInfo (Prelude.Maybe Prelude.Text)
cloudFormationStackRecordSourceInfo_arn :: (Maybe Text -> f (Maybe Text))
-> CloudFormationStackRecordSourceInfo
-> f CloudFormationStackRecordSourceInfo
cloudFormationStackRecordSourceInfo_arn = (CloudFormationStackRecordSourceInfo -> Maybe Text)
-> (CloudFormationStackRecordSourceInfo
    -> Maybe Text -> CloudFormationStackRecordSourceInfo)
-> Lens
     CloudFormationStackRecordSourceInfo
     CloudFormationStackRecordSourceInfo
     (Maybe Text)
     (Maybe Text)
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 :: (Maybe Text -> f (Maybe Text))
-> CloudFormationStackRecordSourceInfo
-> f CloudFormationStackRecordSourceInfo
cloudFormationStackRecordSourceInfo_name = (CloudFormationStackRecordSourceInfo -> Maybe Text)
-> (CloudFormationStackRecordSourceInfo
    -> Maybe Text -> CloudFormationStackRecordSourceInfo)
-> Lens
     CloudFormationStackRecordSourceInfo
     CloudFormationStackRecordSourceInfo
     (Maybe Text)
     (Maybe Text)
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)

instance
  Core.FromJSON
    CloudFormationStackRecordSourceInfo
  where
  parseJSON :: Value -> Parser CloudFormationStackRecordSourceInfo
parseJSON =
    String
-> (Object -> Parser CloudFormationStackRecordSourceInfo)
-> Value
-> Parser CloudFormationStackRecordSourceInfo
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"CloudFormationStackRecordSourceInfo"
      ( \Object
x ->
          Maybe CloudFormationStackRecordSourceType
-> Maybe Text -> Maybe Text -> CloudFormationStackRecordSourceInfo
CloudFormationStackRecordSourceInfo'
            (Maybe CloudFormationStackRecordSourceType
 -> Maybe Text -> Maybe Text -> CloudFormationStackRecordSourceInfo)
-> Parser (Maybe CloudFormationStackRecordSourceType)
-> Parser
     (Maybe Text -> Maybe Text -> CloudFormationStackRecordSourceInfo)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text -> Parser (Maybe CloudFormationStackRecordSourceType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"resourceType")
            Parser
  (Maybe Text -> Maybe Text -> CloudFormationStackRecordSourceInfo)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> CloudFormationStackRecordSourceInfo)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"arn")
            Parser (Maybe Text -> CloudFormationStackRecordSourceInfo)
-> Parser (Maybe Text)
-> Parser CloudFormationStackRecordSourceInfo
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"name")
      )

instance
  Prelude.Hashable
    CloudFormationStackRecordSourceInfo

instance
  Prelude.NFData
    CloudFormationStackRecordSourceInfo