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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 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,
    -- | 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
  }
  deriving (Export -> Export -> Bool
(Export -> Export -> Bool)
-> (Export -> Export -> Bool) -> Eq Export
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]
(Int -> ReadS Export)
-> ReadS [Export]
-> ReadPrec Export
-> ReadPrec [Export]
-> Read 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
(Int -> Export -> ShowS)
-> (Export -> String) -> ([Export] -> ShowS) -> Show Export
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. Export -> Rep Export x)
-> (forall x. Rep Export x -> Export) -> Generic Export
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:
--
-- '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.
--
-- '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.
newExport ::
  Export
newExport :: Export
newExport =
  Export' :: Maybe Text -> Maybe Text -> Maybe Text -> Export
Export'
    { $sel:value:Export' :: Maybe Text
value = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:exportingStackId:Export' :: Maybe Text
exportingStackId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:Export' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: (Maybe Text -> f (Maybe Text)) -> Export -> f Export
export_value = (Export -> Maybe Text)
-> (Export -> Maybe Text -> Export)
-> Lens Export Export (Maybe Text) (Maybe Text)
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)

-- | The stack that contains the exported output name and value.
export_exportingStackId :: Lens.Lens' Export (Prelude.Maybe Prelude.Text)
export_exportingStackId :: (Maybe Text -> f (Maybe Text)) -> Export -> f Export
export_exportingStackId = (Export -> Maybe Text)
-> (Export -> Maybe Text -> Export)
-> Lens Export Export (Maybe Text) (Maybe Text)
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 :: (Maybe Text -> f (Maybe Text)) -> Export -> f Export
export_name = (Export -> Maybe Text)
-> (Export -> Maybe Text -> Export)
-> Lens Export Export (Maybe Text) (Maybe Text)
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)

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

instance Prelude.Hashable Export

instance Prelude.NFData Export