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

import Amazonka.CloudFormation.Types.ParameterConstraints
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The ParameterDeclaration data type.
--
-- /See:/ 'newParameterDeclaration' smart constructor.
data ParameterDeclaration = ParameterDeclaration'
  { -- | The name that is associated with the parameter.
    ParameterDeclaration -> Maybe Text
parameterKey :: Prelude.Maybe Prelude.Text,
    -- | The type of parameter.
    ParameterDeclaration -> Maybe Text
parameterType :: Prelude.Maybe Prelude.Text,
    -- | The criteria that CloudFormation uses to validate parameter values.
    ParameterDeclaration -> Maybe ParameterConstraints
parameterConstraints :: Prelude.Maybe ParameterConstraints,
    -- | The default value of the parameter.
    ParameterDeclaration -> Maybe Text
defaultValue :: Prelude.Maybe Prelude.Text,
    -- | Flag that indicates whether the parameter value is shown as plain text
    -- in logs and in the Amazon Web Services Management Console.
    ParameterDeclaration -> Maybe Bool
noEcho :: Prelude.Maybe Prelude.Bool,
    -- | The description that is associate with the parameter.
    ParameterDeclaration -> Maybe Text
description :: Prelude.Maybe Prelude.Text
  }
  deriving (ParameterDeclaration -> ParameterDeclaration -> Bool
(ParameterDeclaration -> ParameterDeclaration -> Bool)
-> (ParameterDeclaration -> ParameterDeclaration -> Bool)
-> Eq ParameterDeclaration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ParameterDeclaration -> ParameterDeclaration -> Bool
$c/= :: ParameterDeclaration -> ParameterDeclaration -> Bool
== :: ParameterDeclaration -> ParameterDeclaration -> Bool
$c== :: ParameterDeclaration -> ParameterDeclaration -> Bool
Prelude.Eq, ReadPrec [ParameterDeclaration]
ReadPrec ParameterDeclaration
Int -> ReadS ParameterDeclaration
ReadS [ParameterDeclaration]
(Int -> ReadS ParameterDeclaration)
-> ReadS [ParameterDeclaration]
-> ReadPrec ParameterDeclaration
-> ReadPrec [ParameterDeclaration]
-> Read ParameterDeclaration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ParameterDeclaration]
$creadListPrec :: ReadPrec [ParameterDeclaration]
readPrec :: ReadPrec ParameterDeclaration
$creadPrec :: ReadPrec ParameterDeclaration
readList :: ReadS [ParameterDeclaration]
$creadList :: ReadS [ParameterDeclaration]
readsPrec :: Int -> ReadS ParameterDeclaration
$creadsPrec :: Int -> ReadS ParameterDeclaration
Prelude.Read, Int -> ParameterDeclaration -> ShowS
[ParameterDeclaration] -> ShowS
ParameterDeclaration -> String
(Int -> ParameterDeclaration -> ShowS)
-> (ParameterDeclaration -> String)
-> ([ParameterDeclaration] -> ShowS)
-> Show ParameterDeclaration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ParameterDeclaration] -> ShowS
$cshowList :: [ParameterDeclaration] -> ShowS
show :: ParameterDeclaration -> String
$cshow :: ParameterDeclaration -> String
showsPrec :: Int -> ParameterDeclaration -> ShowS
$cshowsPrec :: Int -> ParameterDeclaration -> ShowS
Prelude.Show, (forall x. ParameterDeclaration -> Rep ParameterDeclaration x)
-> (forall x. Rep ParameterDeclaration x -> ParameterDeclaration)
-> Generic ParameterDeclaration
forall x. Rep ParameterDeclaration x -> ParameterDeclaration
forall x. ParameterDeclaration -> Rep ParameterDeclaration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ParameterDeclaration x -> ParameterDeclaration
$cfrom :: forall x. ParameterDeclaration -> Rep ParameterDeclaration x
Prelude.Generic)

-- |
-- Create a value of 'ParameterDeclaration' 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', 'parameterDeclaration_parameterKey' - The name that is associated with the parameter.
--
-- 'parameterType', 'parameterDeclaration_parameterType' - The type of parameter.
--
-- 'parameterConstraints', 'parameterDeclaration_parameterConstraints' - The criteria that CloudFormation uses to validate parameter values.
--
-- 'defaultValue', 'parameterDeclaration_defaultValue' - The default value of the parameter.
--
-- 'noEcho', 'parameterDeclaration_noEcho' - Flag that indicates whether the parameter value is shown as plain text
-- in logs and in the Amazon Web Services Management Console.
--
-- 'description', 'parameterDeclaration_description' - The description that is associate with the parameter.
newParameterDeclaration ::
  ParameterDeclaration
newParameterDeclaration :: ParameterDeclaration
newParameterDeclaration =
  ParameterDeclaration' :: Maybe Text
-> Maybe Text
-> Maybe ParameterConstraints
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> ParameterDeclaration
ParameterDeclaration'
    { $sel:parameterKey:ParameterDeclaration' :: Maybe Text
parameterKey =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:parameterType:ParameterDeclaration' :: Maybe Text
parameterType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:parameterConstraints:ParameterDeclaration' :: Maybe ParameterConstraints
parameterConstraints = Maybe ParameterConstraints
forall a. Maybe a
Prelude.Nothing,
      $sel:defaultValue:ParameterDeclaration' :: Maybe Text
defaultValue = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:noEcho:ParameterDeclaration' :: Maybe Bool
noEcho = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:description:ParameterDeclaration' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

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

-- | The type of parameter.
parameterDeclaration_parameterType :: Lens.Lens' ParameterDeclaration (Prelude.Maybe Prelude.Text)
parameterDeclaration_parameterType :: (Maybe Text -> f (Maybe Text))
-> ParameterDeclaration -> f ParameterDeclaration
parameterDeclaration_parameterType = (ParameterDeclaration -> Maybe Text)
-> (ParameterDeclaration -> Maybe Text -> ParameterDeclaration)
-> Lens
     ParameterDeclaration ParameterDeclaration (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParameterDeclaration' {Maybe Text
parameterType :: Maybe Text
$sel:parameterType:ParameterDeclaration' :: ParameterDeclaration -> Maybe Text
parameterType} -> Maybe Text
parameterType) (\s :: ParameterDeclaration
s@ParameterDeclaration' {} Maybe Text
a -> ParameterDeclaration
s {$sel:parameterType:ParameterDeclaration' :: Maybe Text
parameterType = Maybe Text
a} :: ParameterDeclaration)

-- | The criteria that CloudFormation uses to validate parameter values.
parameterDeclaration_parameterConstraints :: Lens.Lens' ParameterDeclaration (Prelude.Maybe ParameterConstraints)
parameterDeclaration_parameterConstraints :: (Maybe ParameterConstraints -> f (Maybe ParameterConstraints))
-> ParameterDeclaration -> f ParameterDeclaration
parameterDeclaration_parameterConstraints = (ParameterDeclaration -> Maybe ParameterConstraints)
-> (ParameterDeclaration
    -> Maybe ParameterConstraints -> ParameterDeclaration)
-> Lens
     ParameterDeclaration
     ParameterDeclaration
     (Maybe ParameterConstraints)
     (Maybe ParameterConstraints)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParameterDeclaration' {Maybe ParameterConstraints
parameterConstraints :: Maybe ParameterConstraints
$sel:parameterConstraints:ParameterDeclaration' :: ParameterDeclaration -> Maybe ParameterConstraints
parameterConstraints} -> Maybe ParameterConstraints
parameterConstraints) (\s :: ParameterDeclaration
s@ParameterDeclaration' {} Maybe ParameterConstraints
a -> ParameterDeclaration
s {$sel:parameterConstraints:ParameterDeclaration' :: Maybe ParameterConstraints
parameterConstraints = Maybe ParameterConstraints
a} :: ParameterDeclaration)

-- | The default value of the parameter.
parameterDeclaration_defaultValue :: Lens.Lens' ParameterDeclaration (Prelude.Maybe Prelude.Text)
parameterDeclaration_defaultValue :: (Maybe Text -> f (Maybe Text))
-> ParameterDeclaration -> f ParameterDeclaration
parameterDeclaration_defaultValue = (ParameterDeclaration -> Maybe Text)
-> (ParameterDeclaration -> Maybe Text -> ParameterDeclaration)
-> Lens
     ParameterDeclaration ParameterDeclaration (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParameterDeclaration' {Maybe Text
defaultValue :: Maybe Text
$sel:defaultValue:ParameterDeclaration' :: ParameterDeclaration -> Maybe Text
defaultValue} -> Maybe Text
defaultValue) (\s :: ParameterDeclaration
s@ParameterDeclaration' {} Maybe Text
a -> ParameterDeclaration
s {$sel:defaultValue:ParameterDeclaration' :: Maybe Text
defaultValue = Maybe Text
a} :: ParameterDeclaration)

-- | Flag that indicates whether the parameter value is shown as plain text
-- in logs and in the Amazon Web Services Management Console.
parameterDeclaration_noEcho :: Lens.Lens' ParameterDeclaration (Prelude.Maybe Prelude.Bool)
parameterDeclaration_noEcho :: (Maybe Bool -> f (Maybe Bool))
-> ParameterDeclaration -> f ParameterDeclaration
parameterDeclaration_noEcho = (ParameterDeclaration -> Maybe Bool)
-> (ParameterDeclaration -> Maybe Bool -> ParameterDeclaration)
-> Lens
     ParameterDeclaration ParameterDeclaration (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParameterDeclaration' {Maybe Bool
noEcho :: Maybe Bool
$sel:noEcho:ParameterDeclaration' :: ParameterDeclaration -> Maybe Bool
noEcho} -> Maybe Bool
noEcho) (\s :: ParameterDeclaration
s@ParameterDeclaration' {} Maybe Bool
a -> ParameterDeclaration
s {$sel:noEcho:ParameterDeclaration' :: Maybe Bool
noEcho = Maybe Bool
a} :: ParameterDeclaration)

-- | The description that is associate with the parameter.
parameterDeclaration_description :: Lens.Lens' ParameterDeclaration (Prelude.Maybe Prelude.Text)
parameterDeclaration_description :: (Maybe Text -> f (Maybe Text))
-> ParameterDeclaration -> f ParameterDeclaration
parameterDeclaration_description = (ParameterDeclaration -> Maybe Text)
-> (ParameterDeclaration -> Maybe Text -> ParameterDeclaration)
-> Lens
     ParameterDeclaration ParameterDeclaration (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParameterDeclaration' {Maybe Text
description :: Maybe Text
$sel:description:ParameterDeclaration' :: ParameterDeclaration -> Maybe Text
description} -> Maybe Text
description) (\s :: ParameterDeclaration
s@ParameterDeclaration' {} Maybe Text
a -> ParameterDeclaration
s {$sel:description:ParameterDeclaration' :: Maybe Text
description = Maybe Text
a} :: ParameterDeclaration)

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

instance Prelude.NFData ParameterDeclaration