{-# 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.CloudFormation.Types.Export
-- 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.CloudFormation.Types.Export where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | The @Export@ structure describes the exported output values for a stack.
--
-- /See:/ 'newExport' smart constructor.
data Export = Export'
  { -- | The stack that contains the exported output name and value.
    Export -> Maybe Text
exportingStackId :: Prelude.Maybe Prelude.Text,
    -- | The name of exported output value. Use this name and the
    -- @Fn::ImportValue@ function to import the associated value into other
    -- stacks. The name is defined in the @Export@ field in the associated
    -- stack\'s @Outputs@ section.
    Export -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The value of the exported output, such as a resource physical ID. This
    -- value is defined in the @Export@ field in the associated stack\'s
    -- @Outputs@ section.
    Export -> Maybe Text
value :: Prelude.Maybe Prelude.Text
  }
  deriving (Export -> Export -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Export -> Export -> Bool
$c/= :: Export -> Export -> Bool
== :: Export -> Export -> Bool
$c== :: Export -> Export -> Bool
Prelude.Eq, ReadPrec [Export]
ReadPrec Export
Int -> ReadS Export
ReadS [Export]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Export]
$creadListPrec :: ReadPrec [Export]
readPrec :: ReadPrec Export
$creadPrec :: ReadPrec Export
readList :: ReadS [Export]
$creadList :: ReadS [Export]
readsPrec :: Int -> ReadS Export
$creadsPrec :: Int -> ReadS Export
Prelude.Read, Int -> Export -> ShowS
[Export] -> ShowS
Export -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Export] -> ShowS
$cshowList :: [Export] -> ShowS
show :: Export -> String
$cshow :: Export -> String
showsPrec :: Int -> Export -> ShowS
$cshowsPrec :: Int -> Export -> ShowS
Prelude.Show, forall x. Rep Export x -> Export
forall x. Export -> Rep Export x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Export x -> Export
$cfrom :: forall x. Export -> Rep Export x
Prelude.Generic)

-- |
-- Create a value of 'Export' 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:
--
-- 'exportingStackId', 'export_exportingStackId' - The stack that contains the exported output name and value.
--
-- 'name', 'export_name' - The name of exported output value. Use this name and the
-- @Fn::ImportValue@ function to import the associated value into other
-- stacks. The name is defined in the @Export@ field in the associated
-- stack\'s @Outputs@ section.
--
-- 'value', 'export_value' - The value of the exported output, such as a resource physical ID. This
-- value is defined in the @Export@ field in the associated stack\'s
-- @Outputs@ section.
newExport ::
  Export
newExport :: Export
newExport =
  Export'
    { $sel:exportingStackId:Export' :: Maybe Text
exportingStackId = forall a. Maybe a
Prelude.Nothing,
      $sel:name:Export' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:value:Export' :: Maybe Text
value = forall a. Maybe a
Prelude.Nothing
    }

-- | The stack that contains the exported output name and value.
export_exportingStackId :: Lens.Lens' Export (Prelude.Maybe Prelude.Text)
export_exportingStackId :: Lens' Export (Maybe Text)
export_exportingStackId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Export' {Maybe Text
exportingStackId :: Maybe Text
$sel:exportingStackId:Export' :: Export -> Maybe Text
exportingStackId} -> Maybe Text
exportingStackId) (\s :: Export
s@Export' {} Maybe Text
a -> Export
s {$sel:exportingStackId:Export' :: Maybe Text
exportingStackId = Maybe Text
a} :: Export)

-- | The name of exported output value. Use this name and the
-- @Fn::ImportValue@ function to import the associated value into other
-- stacks. The name is defined in the @Export@ field in the associated
-- stack\'s @Outputs@ section.
export_name :: Lens.Lens' Export (Prelude.Maybe Prelude.Text)
export_name :: Lens' Export (Maybe Text)
export_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Export' {Maybe Text
name :: Maybe Text
$sel:name:Export' :: Export -> Maybe Text
name} -> Maybe Text
name) (\s :: Export
s@Export' {} Maybe Text
a -> Export
s {$sel:name:Export' :: Maybe Text
name = Maybe Text
a} :: Export)

-- | The value of the exported output, such as a resource physical ID. This
-- value is defined in the @Export@ field in the associated stack\'s
-- @Outputs@ section.
export_value :: Lens.Lens' Export (Prelude.Maybe Prelude.Text)
export_value :: Lens' Export (Maybe Text)
export_value = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Export' {Maybe Text
value :: Maybe Text
$sel:value:Export' :: Export -> Maybe Text
value} -> Maybe Text
value) (\s :: Export
s@Export' {} Maybe Text
a -> Export
s {$sel:value:Export' :: Maybe Text
value = Maybe Text
a} :: Export)

instance Data.FromXML Export where
  parseXML :: [Node] -> Either String Export
parseXML [Node]
x =
    Maybe Text -> Maybe Text -> Maybe Text -> Export
Export'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"ExportingStackId")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Name")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Value")

instance Prelude.Hashable Export where
  hashWithSalt :: Int -> Export -> Int
hashWithSalt Int
_salt Export' {Maybe Text
value :: Maybe Text
name :: Maybe Text
exportingStackId :: Maybe Text
$sel:value:Export' :: Export -> Maybe Text
$sel:name:Export' :: Export -> Maybe Text
$sel:exportingStackId:Export' :: Export -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
exportingStackId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
value

instance Prelude.NFData Export where
  rnf :: Export -> ()
rnf Export' {Maybe Text
value :: Maybe Text
name :: Maybe Text
exportingStackId :: Maybe Text
$sel:value:Export' :: Export -> Maybe Text
$sel:name:Export' :: Export -> Maybe Text
$sel:exportingStackId:Export' :: Export -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
exportingStackId
      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 Text
value