{-# 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.ServerlessApplicationRepository.Types.ParameterValue
-- 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.ServerlessApplicationRepository.Types.ParameterValue where

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

-- | Parameter value of the application.
--
-- /See:/ 'newParameterValue' smart constructor.
data ParameterValue = ParameterValue'
  { -- | The input value associated with the parameter.
    ParameterValue -> Text
value :: Prelude.Text,
    -- | The key associated with the parameter. If you don\'t specify a key and
    -- value for a particular parameter, AWS CloudFormation uses the default
    -- value that is specified in your template.
    ParameterValue -> Text
name :: Prelude.Text
  }
  deriving (ParameterValue -> ParameterValue -> Bool
(ParameterValue -> ParameterValue -> Bool)
-> (ParameterValue -> ParameterValue -> Bool) -> Eq ParameterValue
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ParameterValue -> ParameterValue -> Bool
$c/= :: ParameterValue -> ParameterValue -> Bool
== :: ParameterValue -> ParameterValue -> Bool
$c== :: ParameterValue -> ParameterValue -> Bool
Prelude.Eq, ReadPrec [ParameterValue]
ReadPrec ParameterValue
Int -> ReadS ParameterValue
ReadS [ParameterValue]
(Int -> ReadS ParameterValue)
-> ReadS [ParameterValue]
-> ReadPrec ParameterValue
-> ReadPrec [ParameterValue]
-> Read ParameterValue
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ParameterValue]
$creadListPrec :: ReadPrec [ParameterValue]
readPrec :: ReadPrec ParameterValue
$creadPrec :: ReadPrec ParameterValue
readList :: ReadS [ParameterValue]
$creadList :: ReadS [ParameterValue]
readsPrec :: Int -> ReadS ParameterValue
$creadsPrec :: Int -> ReadS ParameterValue
Prelude.Read, Int -> ParameterValue -> ShowS
[ParameterValue] -> ShowS
ParameterValue -> String
(Int -> ParameterValue -> ShowS)
-> (ParameterValue -> String)
-> ([ParameterValue] -> ShowS)
-> Show ParameterValue
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ParameterValue] -> ShowS
$cshowList :: [ParameterValue] -> ShowS
show :: ParameterValue -> String
$cshow :: ParameterValue -> String
showsPrec :: Int -> ParameterValue -> ShowS
$cshowsPrec :: Int -> ParameterValue -> ShowS
Prelude.Show, (forall x. ParameterValue -> Rep ParameterValue x)
-> (forall x. Rep ParameterValue x -> ParameterValue)
-> Generic ParameterValue
forall x. Rep ParameterValue x -> ParameterValue
forall x. ParameterValue -> Rep ParameterValue x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ParameterValue x -> ParameterValue
$cfrom :: forall x. ParameterValue -> Rep ParameterValue x
Prelude.Generic)

-- |
-- Create a value of 'ParameterValue' 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:
--
-- 'value', 'parameterValue_value' - The input value associated with the parameter.
--
-- 'name', 'parameterValue_name' - The key associated with the parameter. If you don\'t specify a key and
-- value for a particular parameter, AWS CloudFormation uses the default
-- value that is specified in your template.
newParameterValue ::
  -- | 'value'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  ParameterValue
newParameterValue :: Text -> Text -> ParameterValue
newParameterValue Text
pValue_ Text
pName_ =
  ParameterValue' :: Text -> Text -> ParameterValue
ParameterValue' {$sel:value:ParameterValue' :: Text
value = Text
pValue_, $sel:name:ParameterValue' :: Text
name = Text
pName_}

-- | The input value associated with the parameter.
parameterValue_value :: Lens.Lens' ParameterValue Prelude.Text
parameterValue_value :: (Text -> f Text) -> ParameterValue -> f ParameterValue
parameterValue_value = (ParameterValue -> Text)
-> (ParameterValue -> Text -> ParameterValue)
-> Lens ParameterValue ParameterValue Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParameterValue' {Text
value :: Text
$sel:value:ParameterValue' :: ParameterValue -> Text
value} -> Text
value) (\s :: ParameterValue
s@ParameterValue' {} Text
a -> ParameterValue
s {$sel:value:ParameterValue' :: Text
value = Text
a} :: ParameterValue)

-- | The key associated with the parameter. If you don\'t specify a key and
-- value for a particular parameter, AWS CloudFormation uses the default
-- value that is specified in your template.
parameterValue_name :: Lens.Lens' ParameterValue Prelude.Text
parameterValue_name :: (Text -> f Text) -> ParameterValue -> f ParameterValue
parameterValue_name = (ParameterValue -> Text)
-> (ParameterValue -> Text -> ParameterValue)
-> Lens ParameterValue ParameterValue Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParameterValue' {Text
name :: Text
$sel:name:ParameterValue' :: ParameterValue -> Text
name} -> Text
name) (\s :: ParameterValue
s@ParameterValue' {} Text
a -> ParameterValue
s {$sel:name:ParameterValue' :: Text
name = Text
a} :: ParameterValue)

instance Prelude.Hashable ParameterValue

instance Prelude.NFData ParameterValue

instance Core.ToJSON ParameterValue where
  toJSON :: ParameterValue -> Value
toJSON ParameterValue' {Text
name :: Text
value :: Text
$sel:name:ParameterValue' :: ParameterValue -> Text
$sel:value:ParameterValue' :: ParameterValue -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"value" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
value),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name)
          ]
      )