{-# 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-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.Output 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 Output data type.
--
-- /See:/ 'newOutput' smart constructor.
data Output = Output'
  { -- | User defined description associated with the output.
    Output -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The name of the export associated with the output.
    Output -> Maybe Text
exportName :: Prelude.Maybe Prelude.Text,
    -- | The key associated with the output.
    Output -> Maybe Text
outputKey :: Prelude.Maybe Prelude.Text,
    -- | The value associated with the output.
    Output -> Maybe Text
outputValue :: Prelude.Maybe Prelude.Text
  }
  deriving (Output -> Output -> Bool
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]
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
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. 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:
--
-- 'description', 'output_description' - User defined description associated with the output.
--
-- 'exportName', 'output_exportName' - The name of the export associated with the output.
--
-- 'outputKey', 'output_outputKey' - The key associated with the output.
--
-- 'outputValue', 'output_outputValue' - The value associated with the output.
newOutput ::
  Output
newOutput :: Output
newOutput =
  Output'
    { $sel:description:Output' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:exportName:Output' :: Maybe Text
exportName = forall a. Maybe a
Prelude.Nothing,
      $sel:outputKey:Output' :: Maybe Text
outputKey = forall a. Maybe a
Prelude.Nothing,
      $sel:outputValue:Output' :: Maybe Text
outputValue = forall a. Maybe a
Prelude.Nothing
    }

-- | User defined description associated with the output.
output_description :: Lens.Lens' Output (Prelude.Maybe Prelude.Text)
output_description :: Lens' Output (Maybe Text)
output_description = 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)

-- | The name of the export associated with the output.
output_exportName :: Lens.Lens' Output (Prelude.Maybe Prelude.Text)
output_exportName :: Lens' Output (Maybe Text)
output_exportName = 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)

-- | The key associated with the output.
output_outputKey :: Lens.Lens' Output (Prelude.Maybe Prelude.Text)
output_outputKey :: Lens' Output (Maybe Text)
output_outputKey = 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 value associated with the output.
output_outputValue :: Lens.Lens' Output (Prelude.Maybe Prelude.Text)
output_outputValue :: Lens' Output (Maybe Text)
output_outputValue = 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)

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

instance Prelude.Hashable Output where
  hashWithSalt :: Int -> Output -> Int
hashWithSalt Int
_salt Output' {Maybe Text
outputValue :: Maybe Text
outputKey :: Maybe Text
exportName :: Maybe Text
description :: Maybe Text
$sel:outputValue:Output' :: Output -> Maybe Text
$sel:outputKey:Output' :: Output -> Maybe Text
$sel:exportName:Output' :: Output -> Maybe Text
$sel:description:Output' :: Output -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
exportName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
outputKey
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
outputValue

instance Prelude.NFData Output where
  rnf :: Output -> ()
rnf Output' {Maybe Text
outputValue :: Maybe Text
outputKey :: Maybe Text
exportName :: Maybe Text
description :: Maybe Text
$sel:outputValue:Output' :: Output -> Maybe Text
$sel:outputKey:Output' :: Output -> Maybe Text
$sel:exportName:Output' :: Output -> Maybe Text
$sel:description:Output' :: Output -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
exportName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
outputKey
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
outputValue