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

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

-- | A key value pair used when you provision a project as a service catalog
-- product. For information, see
-- <https://docs.aws.amazon.com/servicecatalog/latest/adminguide/introduction.html What is Amazon Web Services Service Catalog>.
--
-- /See:/ 'newProvisioningParameter' smart constructor.
data ProvisioningParameter = ProvisioningParameter'
  { -- | The value of the provisioning parameter.
    ProvisioningParameter -> Maybe Text
value :: Prelude.Maybe Prelude.Text,
    -- | The key that identifies a provisioning parameter.
    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 value of the provisioning parameter.
--
-- 'key', 'provisioningParameter_key' - The key that identifies a provisioning parameter.
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 value of the provisioning parameter.
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 key that identifies a provisioning parameter.
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 Core.FromJSON ProvisioningParameter where
  parseJSON :: Value -> Parser ProvisioningParameter
parseJSON =
    String
-> (Object -> Parser ProvisioningParameter)
-> Value
-> Parser ProvisioningParameter
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ProvisioningParameter"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> ProvisioningParameter
ProvisioningParameter'
            (Maybe Text -> Maybe Text -> ProvisioningParameter)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> ProvisioningParameter)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Value") Parser (Maybe Text -> ProvisioningParameter)
-> Parser (Maybe Text) -> Parser ProvisioningParameter
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Key")
      )

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
          ]
      )