{-# 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.Output
-- 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.Output where

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

-- | The Output data type.
--
-- /See:/ 'newOutput' smart constructor.
data Output = Output'
  { -- | The value associated with the output.
    Output -> Maybe Text
outputValue :: Prelude.Maybe Prelude.Text,
    -- | The key associated with the output.
    Output -> Maybe Text
outputKey :: Prelude.Maybe Prelude.Text,
    -- | The name of the export associated with the output.
    Output -> Maybe Text
exportName :: Prelude.Maybe Prelude.Text,
    -- | User defined description associated with the output.
    Output -> Maybe Text
description :: Prelude.Maybe Prelude.Text
  }
  deriving (Output -> Output -> Bool
(Output -> Output -> Bool)
-> (Output -> Output -> Bool) -> Eq Output
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Output -> Output -> Bool
$c/= :: Output -> Output -> Bool
== :: Output -> Output -> Bool
$c== :: Output -> Output -> Bool
Prelude.Eq, ReadPrec [Output]
ReadPrec Output
Int -> ReadS Output
ReadS [Output]
(Int -> ReadS Output)
-> ReadS [Output]
-> ReadPrec Output
-> ReadPrec [Output]
-> Read Output
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Output]
$creadListPrec :: ReadPrec [Output]
readPrec :: ReadPrec Output
$creadPrec :: ReadPrec Output
readList :: ReadS [Output]
$creadList :: ReadS [Output]
readsPrec :: Int -> ReadS Output
$creadsPrec :: Int -> ReadS Output
Prelude.Read, Int -> Output -> ShowS
[Output] -> ShowS
Output -> String
(Int -> Output -> ShowS)
-> (Output -> String) -> ([Output] -> ShowS) -> Show Output
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Output] -> ShowS
$cshowList :: [Output] -> ShowS
show :: Output -> String
$cshow :: Output -> String
showsPrec :: Int -> Output -> ShowS
$cshowsPrec :: Int -> Output -> ShowS
Prelude.Show, (forall x. Output -> Rep Output x)
-> (forall x. Rep Output x -> Output) -> Generic Output
forall x. Rep Output x -> Output
forall x. Output -> Rep Output x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Output x -> Output
$cfrom :: forall x. Output -> Rep Output x
Prelude.Generic)

-- |
-- Create a value of 'Output' 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:
--
-- 'outputValue', 'output_outputValue' - The value associated with the output.
--
-- 'outputKey', 'output_outputKey' - The key associated with the output.
--
-- 'exportName', 'output_exportName' - The name of the export associated with the output.
--
-- 'description', 'output_description' - User defined description associated with the output.
newOutput ::
  Output
newOutput :: Output
newOutput =
  Output' :: Maybe Text -> Maybe Text -> Maybe Text -> Maybe Text -> Output
Output'
    { $sel:outputValue:Output' :: Maybe Text
outputValue = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:outputKey:Output' :: Maybe Text
outputKey = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:exportName:Output' :: Maybe Text
exportName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:Output' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The value associated with the output.
output_outputValue :: Lens.Lens' Output (Prelude.Maybe Prelude.Text)
output_outputValue :: (Maybe Text -> f (Maybe Text)) -> Output -> f Output
output_outputValue = (Output -> Maybe Text)
-> (Output -> Maybe Text -> Output)
-> Lens Output Output (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Output' {Maybe Text
outputValue :: Maybe Text
$sel:outputValue:Output' :: Output -> Maybe Text
outputValue} -> Maybe Text
outputValue) (\s :: Output
s@Output' {} Maybe Text
a -> Output
s {$sel:outputValue:Output' :: Maybe Text
outputValue = Maybe Text
a} :: Output)

-- | The key associated with the output.
output_outputKey :: Lens.Lens' Output (Prelude.Maybe Prelude.Text)
output_outputKey :: (Maybe Text -> f (Maybe Text)) -> Output -> f Output
output_outputKey = (Output -> Maybe Text)
-> (Output -> Maybe Text -> Output)
-> Lens Output Output (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Output' {Maybe Text
outputKey :: Maybe Text
$sel:outputKey:Output' :: Output -> Maybe Text
outputKey} -> Maybe Text
outputKey) (\s :: Output
s@Output' {} Maybe Text
a -> Output
s {$sel:outputKey:Output' :: Maybe Text
outputKey = Maybe Text
a} :: Output)

-- | The name of the export associated with the output.
output_exportName :: Lens.Lens' Output (Prelude.Maybe Prelude.Text)
output_exportName :: (Maybe Text -> f (Maybe Text)) -> Output -> f Output
output_exportName = (Output -> Maybe Text)
-> (Output -> Maybe Text -> Output)
-> Lens Output Output (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Output' {Maybe Text
exportName :: Maybe Text
$sel:exportName:Output' :: Output -> Maybe Text
exportName} -> Maybe Text
exportName) (\s :: Output
s@Output' {} Maybe Text
a -> Output
s {$sel:exportName:Output' :: Maybe Text
exportName = Maybe Text
a} :: Output)

-- | User defined description associated with the output.
output_description :: Lens.Lens' Output (Prelude.Maybe Prelude.Text)
output_description :: (Maybe Text -> f (Maybe Text)) -> Output -> f Output
output_description = (Output -> Maybe Text)
-> (Output -> Maybe Text -> Output)
-> Lens Output Output (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Output' {Maybe Text
description :: Maybe Text
$sel:description:Output' :: Output -> Maybe Text
description} -> Maybe Text
description) (\s :: Output
s@Output' {} Maybe Text
a -> Output
s {$sel:description:Output' :: Maybe Text
description = Maybe Text
a} :: Output)

instance Core.FromXML Output where
  parseXML :: [Node] -> Either String Output
parseXML [Node]
x =
    Maybe Text -> Maybe Text -> Maybe Text -> Maybe Text -> Output
Output'
      (Maybe Text -> Maybe Text -> Maybe Text -> Maybe Text -> Output)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Maybe Text -> Maybe Text -> Output)
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
"OutputValue")
      Either String (Maybe Text -> Maybe Text -> Maybe Text -> Output)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Maybe Text -> Output)
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
"OutputKey")
      Either String (Maybe Text -> Maybe Text -> Output)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Output)
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
"ExportName")
      Either String (Maybe Text -> Output)
-> Either String (Maybe Text) -> Either String Output
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
"Description")

instance Prelude.Hashable Output

instance Prelude.NFData Output