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

import Amazonka.CloudFormation.Types.ParameterConstraints
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 ParameterDeclaration data type.
--
-- /See:/ 'newParameterDeclaration' smart constructor.
data ParameterDeclaration = ParameterDeclaration'
  { -- | The default value of the parameter.
    ParameterDeclaration -> Maybe Text
defaultValue :: Prelude.Maybe Prelude.Text,
    -- | The description that\'s associate with the parameter.
    ParameterDeclaration -> Maybe Text
description :: 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 criteria that CloudFormation uses to validate parameter values.
    ParameterDeclaration -> Maybe ParameterConstraints
parameterConstraints :: Prelude.Maybe ParameterConstraints,
    -- | The name that\'s associated with the parameter.
    ParameterDeclaration -> Maybe Text
parameterKey :: Prelude.Maybe Prelude.Text,
    -- | The type of parameter.
    ParameterDeclaration -> Maybe Text
parameterType :: Prelude.Maybe Prelude.Text
  }
  deriving (ParameterDeclaration -> ParameterDeclaration -> Bool
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]
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
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. 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:
--
-- 'defaultValue', 'parameterDeclaration_defaultValue' - The default value of the parameter.
--
-- 'description', 'parameterDeclaration_description' - The description that\'s associate with 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.
--
-- 'parameterConstraints', 'parameterDeclaration_parameterConstraints' - The criteria that CloudFormation uses to validate parameter values.
--
-- 'parameterKey', 'parameterDeclaration_parameterKey' - The name that\'s associated with the parameter.
--
-- 'parameterType', 'parameterDeclaration_parameterType' - The type of parameter.
newParameterDeclaration ::
  ParameterDeclaration
newParameterDeclaration :: ParameterDeclaration
newParameterDeclaration =
  ParameterDeclaration'
    { $sel:defaultValue:ParameterDeclaration' :: Maybe Text
defaultValue =
        forall a. Maybe a
Prelude.Nothing,
      $sel:description:ParameterDeclaration' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:noEcho:ParameterDeclaration' :: Maybe Bool
noEcho = forall a. Maybe a
Prelude.Nothing,
      $sel:parameterConstraints:ParameterDeclaration' :: Maybe ParameterConstraints
parameterConstraints = forall a. Maybe a
Prelude.Nothing,
      $sel:parameterKey:ParameterDeclaration' :: Maybe Text
parameterKey = forall a. Maybe a
Prelude.Nothing,
      $sel:parameterType:ParameterDeclaration' :: Maybe Text
parameterType = forall a. Maybe a
Prelude.Nothing
    }

-- | The default value of the parameter.
parameterDeclaration_defaultValue :: Lens.Lens' ParameterDeclaration (Prelude.Maybe Prelude.Text)
parameterDeclaration_defaultValue :: Lens' ParameterDeclaration (Maybe Text)
parameterDeclaration_defaultValue = 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)

-- | The description that\'s associate with the parameter.
parameterDeclaration_description :: Lens.Lens' ParameterDeclaration (Prelude.Maybe Prelude.Text)
parameterDeclaration_description :: Lens' ParameterDeclaration (Maybe Text)
parameterDeclaration_description = 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)

-- | 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 :: Lens' ParameterDeclaration (Maybe Bool)
parameterDeclaration_noEcho = 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 criteria that CloudFormation uses to validate parameter values.
parameterDeclaration_parameterConstraints :: Lens.Lens' ParameterDeclaration (Prelude.Maybe ParameterConstraints)
parameterDeclaration_parameterConstraints :: Lens' ParameterDeclaration (Maybe ParameterConstraints)
parameterDeclaration_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 name that\'s associated with the parameter.
parameterDeclaration_parameterKey :: Lens.Lens' ParameterDeclaration (Prelude.Maybe Prelude.Text)
parameterDeclaration_parameterKey :: Lens' ParameterDeclaration (Maybe Text)
parameterDeclaration_parameterKey = 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 :: Lens' ParameterDeclaration (Maybe Text)
parameterDeclaration_parameterType = 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)

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

instance Prelude.Hashable ParameterDeclaration where
  hashWithSalt :: Int -> ParameterDeclaration -> Int
hashWithSalt Int
_salt ParameterDeclaration' {Maybe Bool
Maybe Text
Maybe ParameterConstraints
parameterType :: Maybe Text
parameterKey :: Maybe Text
parameterConstraints :: Maybe ParameterConstraints
noEcho :: Maybe Bool
description :: Maybe Text
defaultValue :: Maybe Text
$sel:parameterType:ParameterDeclaration' :: ParameterDeclaration -> Maybe Text
$sel:parameterKey:ParameterDeclaration' :: ParameterDeclaration -> Maybe Text
$sel:parameterConstraints:ParameterDeclaration' :: ParameterDeclaration -> Maybe ParameterConstraints
$sel:noEcho:ParameterDeclaration' :: ParameterDeclaration -> Maybe Bool
$sel:description:ParameterDeclaration' :: ParameterDeclaration -> Maybe Text
$sel:defaultValue:ParameterDeclaration' :: ParameterDeclaration -> 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 ParameterConstraints
parameterConstraints
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
parameterKey
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
parameterType

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