{-# 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.TemplateParameter
-- 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.TemplateParameter 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 TemplateParameter data type.
--
-- /See:/ 'newTemplateParameter' smart constructor.
data TemplateParameter = TemplateParameter'
  { -- | The default value associated with the parameter.
    TemplateParameter -> Maybe Text
defaultValue :: Prelude.Maybe Prelude.Text,
    -- | User defined description associated with the parameter.
    TemplateParameter -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | Flag indicating whether the parameter should be displayed as plain text
    -- in logs and UIs.
    TemplateParameter -> Maybe Bool
noEcho :: Prelude.Maybe Prelude.Bool,
    -- | The name associated with the parameter.
    TemplateParameter -> Maybe Text
parameterKey :: Prelude.Maybe Prelude.Text
  }
  deriving (TemplateParameter -> TemplateParameter -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TemplateParameter -> TemplateParameter -> Bool
$c/= :: TemplateParameter -> TemplateParameter -> Bool
== :: TemplateParameter -> TemplateParameter -> Bool
$c== :: TemplateParameter -> TemplateParameter -> Bool
Prelude.Eq, ReadPrec [TemplateParameter]
ReadPrec TemplateParameter
Int -> ReadS TemplateParameter
ReadS [TemplateParameter]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TemplateParameter]
$creadListPrec :: ReadPrec [TemplateParameter]
readPrec :: ReadPrec TemplateParameter
$creadPrec :: ReadPrec TemplateParameter
readList :: ReadS [TemplateParameter]
$creadList :: ReadS [TemplateParameter]
readsPrec :: Int -> ReadS TemplateParameter
$creadsPrec :: Int -> ReadS TemplateParameter
Prelude.Read, Int -> TemplateParameter -> ShowS
[TemplateParameter] -> ShowS
TemplateParameter -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TemplateParameter] -> ShowS
$cshowList :: [TemplateParameter] -> ShowS
show :: TemplateParameter -> String
$cshow :: TemplateParameter -> String
showsPrec :: Int -> TemplateParameter -> ShowS
$cshowsPrec :: Int -> TemplateParameter -> ShowS
Prelude.Show, forall x. Rep TemplateParameter x -> TemplateParameter
forall x. TemplateParameter -> Rep TemplateParameter x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TemplateParameter x -> TemplateParameter
$cfrom :: forall x. TemplateParameter -> Rep TemplateParameter x
Prelude.Generic)

-- |
-- Create a value of 'TemplateParameter' 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:
--
-- 'defaultValue', 'templateParameter_defaultValue' - The default value associated with the parameter.
--
-- 'description', 'templateParameter_description' - User defined description associated with the parameter.
--
-- 'noEcho', 'templateParameter_noEcho' - Flag indicating whether the parameter should be displayed as plain text
-- in logs and UIs.
--
-- 'parameterKey', 'templateParameter_parameterKey' - The name associated with the parameter.
newTemplateParameter ::
  TemplateParameter
newTemplateParameter :: TemplateParameter
newTemplateParameter =
  TemplateParameter'
    { $sel:defaultValue:TemplateParameter' :: Maybe Text
defaultValue = forall a. Maybe a
Prelude.Nothing,
      $sel:description:TemplateParameter' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:noEcho:TemplateParameter' :: Maybe Bool
noEcho = forall a. Maybe a
Prelude.Nothing,
      $sel:parameterKey:TemplateParameter' :: Maybe Text
parameterKey = forall a. Maybe a
Prelude.Nothing
    }

-- | The default value associated with the parameter.
templateParameter_defaultValue :: Lens.Lens' TemplateParameter (Prelude.Maybe Prelude.Text)
templateParameter_defaultValue :: Lens' TemplateParameter (Maybe Text)
templateParameter_defaultValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TemplateParameter' {Maybe Text
defaultValue :: Maybe Text
$sel:defaultValue:TemplateParameter' :: TemplateParameter -> Maybe Text
defaultValue} -> Maybe Text
defaultValue) (\s :: TemplateParameter
s@TemplateParameter' {} Maybe Text
a -> TemplateParameter
s {$sel:defaultValue:TemplateParameter' :: Maybe Text
defaultValue = Maybe Text
a} :: TemplateParameter)

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

-- | Flag indicating whether the parameter should be displayed as plain text
-- in logs and UIs.
templateParameter_noEcho :: Lens.Lens' TemplateParameter (Prelude.Maybe Prelude.Bool)
templateParameter_noEcho :: Lens' TemplateParameter (Maybe Bool)
templateParameter_noEcho = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TemplateParameter' {Maybe Bool
noEcho :: Maybe Bool
$sel:noEcho:TemplateParameter' :: TemplateParameter -> Maybe Bool
noEcho} -> Maybe Bool
noEcho) (\s :: TemplateParameter
s@TemplateParameter' {} Maybe Bool
a -> TemplateParameter
s {$sel:noEcho:TemplateParameter' :: Maybe Bool
noEcho = Maybe Bool
a} :: TemplateParameter)

-- | The name associated with the parameter.
templateParameter_parameterKey :: Lens.Lens' TemplateParameter (Prelude.Maybe Prelude.Text)
templateParameter_parameterKey :: Lens' TemplateParameter (Maybe Text)
templateParameter_parameterKey = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TemplateParameter' {Maybe Text
parameterKey :: Maybe Text
$sel:parameterKey:TemplateParameter' :: TemplateParameter -> Maybe Text
parameterKey} -> Maybe Text
parameterKey) (\s :: TemplateParameter
s@TemplateParameter' {} Maybe Text
a -> TemplateParameter
s {$sel:parameterKey:TemplateParameter' :: Maybe Text
parameterKey = Maybe Text
a} :: TemplateParameter)

instance Data.FromXML TemplateParameter where
  parseXML :: [Node] -> Either String TemplateParameter
parseXML [Node]
x =
    Maybe Text
-> Maybe Text -> Maybe Bool -> Maybe Text -> TemplateParameter
TemplateParameter'
      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
"DefaultValue")
      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
"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
"NoEcho")
      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
"ParameterKey")

instance Prelude.Hashable TemplateParameter where
  hashWithSalt :: Int -> TemplateParameter -> Int
hashWithSalt Int
_salt TemplateParameter' {Maybe Bool
Maybe Text
parameterKey :: Maybe Text
noEcho :: Maybe Bool
description :: Maybe Text
defaultValue :: Maybe Text
$sel:parameterKey:TemplateParameter' :: TemplateParameter -> Maybe Text
$sel:noEcho:TemplateParameter' :: TemplateParameter -> Maybe Bool
$sel:description:TemplateParameter' :: TemplateParameter -> Maybe Text
$sel:defaultValue:TemplateParameter' :: TemplateParameter -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
defaultValue
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
noEcho
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
parameterKey

instance Prelude.NFData TemplateParameter where
  rnf :: TemplateParameter -> ()
rnf TemplateParameter' {Maybe Bool
Maybe Text
parameterKey :: Maybe Text
noEcho :: Maybe Bool
description :: Maybe Text
defaultValue :: Maybe Text
$sel:parameterKey:TemplateParameter' :: TemplateParameter -> Maybe Text
$sel:noEcho:TemplateParameter' :: TemplateParameter -> Maybe Bool
$sel:description:TemplateParameter' :: TemplateParameter -> Maybe Text
$sel:defaultValue:TemplateParameter' :: TemplateParameter -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
defaultValue
      seq :: forall a b. a -> b -> b
`Prelude.seq` 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 Bool
noEcho
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
parameterKey