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

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

-- | The TemplateParameter data type.
--
-- /See:/ 'newTemplateParameter' smart constructor.
data TemplateParameter = TemplateParameter'
  { -- | The name associated with the parameter.
    TemplateParameter -> Maybe Text
parameterKey :: Prelude.Maybe Prelude.Text,
    -- | The default value associated with the parameter.
    TemplateParameter -> Maybe Text
defaultValue :: 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,
    -- | User defined description associated with the parameter.
    TemplateParameter -> Maybe Text
description :: Prelude.Maybe Prelude.Text
  }
  deriving (TemplateParameter -> TemplateParameter -> Bool
(TemplateParameter -> TemplateParameter -> Bool)
-> (TemplateParameter -> TemplateParameter -> Bool)
-> Eq TemplateParameter
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]
(Int -> ReadS TemplateParameter)
-> ReadS [TemplateParameter]
-> ReadPrec TemplateParameter
-> ReadPrec [TemplateParameter]
-> Read 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
(Int -> TemplateParameter -> ShowS)
-> (TemplateParameter -> String)
-> ([TemplateParameter] -> ShowS)
-> Show TemplateParameter
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. TemplateParameter -> Rep TemplateParameter x)
-> (forall x. Rep TemplateParameter x -> TemplateParameter)
-> Generic TemplateParameter
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:
--
-- 'parameterKey', 'templateParameter_parameterKey' - The name associated with the parameter.
--
-- 'defaultValue', 'templateParameter_defaultValue' - The default value associated with the parameter.
--
-- 'noEcho', 'templateParameter_noEcho' - Flag indicating whether the parameter should be displayed as plain text
-- in logs and UIs.
--
-- 'description', 'templateParameter_description' - User defined description associated with the parameter.
newTemplateParameter ::
  TemplateParameter
newTemplateParameter :: TemplateParameter
newTemplateParameter =
  TemplateParameter' :: Maybe Text
-> Maybe Text -> Maybe Bool -> Maybe Text -> TemplateParameter
TemplateParameter'
    { $sel:parameterKey:TemplateParameter' :: Maybe Text
parameterKey = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:defaultValue:TemplateParameter' :: Maybe Text
defaultValue = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:noEcho:TemplateParameter' :: Maybe Bool
noEcho = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:description:TemplateParameter' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The name associated with the parameter.
templateParameter_parameterKey :: Lens.Lens' TemplateParameter (Prelude.Maybe Prelude.Text)
templateParameter_parameterKey :: (Maybe Text -> f (Maybe Text))
-> TemplateParameter -> f TemplateParameter
templateParameter_parameterKey = (TemplateParameter -> Maybe Text)
-> (TemplateParameter -> Maybe Text -> TemplateParameter)
-> Lens
     TemplateParameter TemplateParameter (Maybe Text) (Maybe Text)
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)

-- | The default value associated with the parameter.
templateParameter_defaultValue :: Lens.Lens' TemplateParameter (Prelude.Maybe Prelude.Text)
templateParameter_defaultValue :: (Maybe Text -> f (Maybe Text))
-> TemplateParameter -> f TemplateParameter
templateParameter_defaultValue = (TemplateParameter -> Maybe Text)
-> (TemplateParameter -> Maybe Text -> TemplateParameter)
-> Lens
     TemplateParameter TemplateParameter (Maybe Text) (Maybe Text)
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)

-- | 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 :: (Maybe Bool -> f (Maybe Bool))
-> TemplateParameter -> f TemplateParameter
templateParameter_noEcho = (TemplateParameter -> Maybe Bool)
-> (TemplateParameter -> Maybe Bool -> TemplateParameter)
-> Lens
     TemplateParameter TemplateParameter (Maybe Bool) (Maybe Bool)
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)

-- | User defined description associated with the parameter.
templateParameter_description :: Lens.Lens' TemplateParameter (Prelude.Maybe Prelude.Text)
templateParameter_description :: (Maybe Text -> f (Maybe Text))
-> TemplateParameter -> f TemplateParameter
templateParameter_description = (TemplateParameter -> Maybe Text)
-> (TemplateParameter -> Maybe Text -> TemplateParameter)
-> Lens
     TemplateParameter TemplateParameter (Maybe Text) (Maybe Text)
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)

instance Core.FromXML TemplateParameter where
  parseXML :: [Node] -> Either String TemplateParameter
parseXML [Node]
x =
    Maybe Text
-> Maybe Text -> Maybe Bool -> Maybe Text -> TemplateParameter
TemplateParameter'
      (Maybe Text
 -> Maybe Text -> Maybe Bool -> Maybe Text -> TemplateParameter)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text -> Maybe Bool -> Maybe Text -> TemplateParameter)
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
"ParameterKey")
      Either
  String
  (Maybe Text -> Maybe Bool -> Maybe Text -> TemplateParameter)
-> Either String (Maybe Text)
-> Either String (Maybe Bool -> Maybe Text -> TemplateParameter)
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
"DefaultValue")
      Either String (Maybe Bool -> Maybe Text -> TemplateParameter)
-> Either String (Maybe Bool)
-> Either String (Maybe Text -> TemplateParameter)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Bool)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"NoEcho")
      Either String (Maybe Text -> TemplateParameter)
-> Either String (Maybe Text) -> Either String TemplateParameter
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 TemplateParameter

instance Prelude.NFData TemplateParameter