{-# 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.ServiceCatalog.Types.ProvisioningParameter
-- 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.ServiceCatalog.Types.ProvisioningParameter where

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

-- | Information about a parameter used to provision a product.
--
-- /See:/ 'newProvisioningParameter' smart constructor.
data ProvisioningParameter = ProvisioningParameter'
  { -- | The parameter value.
    ProvisioningParameter -> Maybe Text
value :: Prelude.Maybe Prelude.Text,
    -- | The parameter key.
    ProvisioningParameter -> Maybe Text
key :: Prelude.Maybe Prelude.Text
  }
  deriving (ProvisioningParameter -> ProvisioningParameter -> Bool
(ProvisioningParameter -> ProvisioningParameter -> Bool)
-> (ProvisioningParameter -> ProvisioningParameter -> Bool)
-> Eq ProvisioningParameter
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProvisioningParameter -> ProvisioningParameter -> Bool
$c/= :: ProvisioningParameter -> ProvisioningParameter -> Bool
== :: ProvisioningParameter -> ProvisioningParameter -> Bool
$c== :: ProvisioningParameter -> ProvisioningParameter -> Bool
Prelude.Eq, ReadPrec [ProvisioningParameter]
ReadPrec ProvisioningParameter
Int -> ReadS ProvisioningParameter
ReadS [ProvisioningParameter]
(Int -> ReadS ProvisioningParameter)
-> ReadS [ProvisioningParameter]
-> ReadPrec ProvisioningParameter
-> ReadPrec [ProvisioningParameter]
-> Read ProvisioningParameter
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProvisioningParameter]
$creadListPrec :: ReadPrec [ProvisioningParameter]
readPrec :: ReadPrec ProvisioningParameter
$creadPrec :: ReadPrec ProvisioningParameter
readList :: ReadS [ProvisioningParameter]
$creadList :: ReadS [ProvisioningParameter]
readsPrec :: Int -> ReadS ProvisioningParameter
$creadsPrec :: Int -> ReadS ProvisioningParameter
Prelude.Read, Int -> ProvisioningParameter -> ShowS
[ProvisioningParameter] -> ShowS
ProvisioningParameter -> String
(Int -> ProvisioningParameter -> ShowS)
-> (ProvisioningParameter -> String)
-> ([ProvisioningParameter] -> ShowS)
-> Show ProvisioningParameter
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProvisioningParameter] -> ShowS
$cshowList :: [ProvisioningParameter] -> ShowS
show :: ProvisioningParameter -> String
$cshow :: ProvisioningParameter -> String
showsPrec :: Int -> ProvisioningParameter -> ShowS
$cshowsPrec :: Int -> ProvisioningParameter -> ShowS
Prelude.Show, (forall x. ProvisioningParameter -> Rep ProvisioningParameter x)
-> (forall x. Rep ProvisioningParameter x -> ProvisioningParameter)
-> Generic ProvisioningParameter
forall x. Rep ProvisioningParameter x -> ProvisioningParameter
forall x. ProvisioningParameter -> Rep ProvisioningParameter x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ProvisioningParameter x -> ProvisioningParameter
$cfrom :: forall x. ProvisioningParameter -> Rep ProvisioningParameter x
Prelude.Generic)

-- |
-- Create a value of 'ProvisioningParameter' 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', 'provisioningParameter_value' - The parameter value.
--
-- 'key', 'provisioningParameter_key' - The parameter key.
newProvisioningParameter ::
  ProvisioningParameter
newProvisioningParameter :: ProvisioningParameter
newProvisioningParameter =
  ProvisioningParameter' :: Maybe Text -> Maybe Text -> ProvisioningParameter
ProvisioningParameter'
    { $sel:value:ProvisioningParameter' :: Maybe Text
value = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:key:ProvisioningParameter' :: Maybe Text
key = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The parameter value.
provisioningParameter_value :: Lens.Lens' ProvisioningParameter (Prelude.Maybe Prelude.Text)
provisioningParameter_value :: (Maybe Text -> f (Maybe Text))
-> ProvisioningParameter -> f ProvisioningParameter
provisioningParameter_value = (ProvisioningParameter -> Maybe Text)
-> (ProvisioningParameter -> Maybe Text -> ProvisioningParameter)
-> Lens
     ProvisioningParameter
     ProvisioningParameter
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProvisioningParameter' {Maybe Text
value :: Maybe Text
$sel:value:ProvisioningParameter' :: ProvisioningParameter -> Maybe Text
value} -> Maybe Text
value) (\s :: ProvisioningParameter
s@ProvisioningParameter' {} Maybe Text
a -> ProvisioningParameter
s {$sel:value:ProvisioningParameter' :: Maybe Text
value = Maybe Text
a} :: ProvisioningParameter)

-- | The parameter key.
provisioningParameter_key :: Lens.Lens' ProvisioningParameter (Prelude.Maybe Prelude.Text)
provisioningParameter_key :: (Maybe Text -> f (Maybe Text))
-> ProvisioningParameter -> f ProvisioningParameter
provisioningParameter_key = (ProvisioningParameter -> Maybe Text)
-> (ProvisioningParameter -> Maybe Text -> ProvisioningParameter)
-> Lens
     ProvisioningParameter
     ProvisioningParameter
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProvisioningParameter' {Maybe Text
key :: Maybe Text
$sel:key:ProvisioningParameter' :: ProvisioningParameter -> Maybe Text
key} -> Maybe Text
key) (\s :: ProvisioningParameter
s@ProvisioningParameter' {} Maybe Text
a -> ProvisioningParameter
s {$sel:key:ProvisioningParameter' :: Maybe Text
key = Maybe Text
a} :: ProvisioningParameter)

instance Prelude.Hashable ProvisioningParameter

instance Prelude.NFData ProvisioningParameter

instance Core.ToJSON ProvisioningParameter where
  toJSON :: ProvisioningParameter -> Value
toJSON ProvisioningParameter' {Maybe Text
key :: Maybe Text
value :: Maybe Text
$sel:key:ProvisioningParameter' :: ProvisioningParameter -> Maybe Text
$sel:value:ProvisioningParameter' :: ProvisioningParameter -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Value" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
value,
            (Text
"Key" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
key
          ]
      )