{-# 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.CloudWatchEvents.Types.SageMakerPipelineParameter
-- 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.CloudWatchEvents.Types.SageMakerPipelineParameter where

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

-- | Name\/Value pair of a parameter to start execution of a SageMaker Model
-- Building Pipeline.
--
-- /See:/ 'newSageMakerPipelineParameter' smart constructor.
data SageMakerPipelineParameter = SageMakerPipelineParameter'
  { -- | Name of parameter to start execution of a SageMaker Model Building
    -- Pipeline.
    SageMakerPipelineParameter -> Text
name :: Prelude.Text,
    -- | Value of parameter to start execution of a SageMaker Model Building
    -- Pipeline.
    SageMakerPipelineParameter -> Text
value :: Prelude.Text
  }
  deriving (SageMakerPipelineParameter -> SageMakerPipelineParameter -> Bool
(SageMakerPipelineParameter -> SageMakerPipelineParameter -> Bool)
-> (SageMakerPipelineParameter
    -> SageMakerPipelineParameter -> Bool)
-> Eq SageMakerPipelineParameter
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SageMakerPipelineParameter -> SageMakerPipelineParameter -> Bool
$c/= :: SageMakerPipelineParameter -> SageMakerPipelineParameter -> Bool
== :: SageMakerPipelineParameter -> SageMakerPipelineParameter -> Bool
$c== :: SageMakerPipelineParameter -> SageMakerPipelineParameter -> Bool
Prelude.Eq, ReadPrec [SageMakerPipelineParameter]
ReadPrec SageMakerPipelineParameter
Int -> ReadS SageMakerPipelineParameter
ReadS [SageMakerPipelineParameter]
(Int -> ReadS SageMakerPipelineParameter)
-> ReadS [SageMakerPipelineParameter]
-> ReadPrec SageMakerPipelineParameter
-> ReadPrec [SageMakerPipelineParameter]
-> Read SageMakerPipelineParameter
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SageMakerPipelineParameter]
$creadListPrec :: ReadPrec [SageMakerPipelineParameter]
readPrec :: ReadPrec SageMakerPipelineParameter
$creadPrec :: ReadPrec SageMakerPipelineParameter
readList :: ReadS [SageMakerPipelineParameter]
$creadList :: ReadS [SageMakerPipelineParameter]
readsPrec :: Int -> ReadS SageMakerPipelineParameter
$creadsPrec :: Int -> ReadS SageMakerPipelineParameter
Prelude.Read, Int -> SageMakerPipelineParameter -> ShowS
[SageMakerPipelineParameter] -> ShowS
SageMakerPipelineParameter -> String
(Int -> SageMakerPipelineParameter -> ShowS)
-> (SageMakerPipelineParameter -> String)
-> ([SageMakerPipelineParameter] -> ShowS)
-> Show SageMakerPipelineParameter
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SageMakerPipelineParameter] -> ShowS
$cshowList :: [SageMakerPipelineParameter] -> ShowS
show :: SageMakerPipelineParameter -> String
$cshow :: SageMakerPipelineParameter -> String
showsPrec :: Int -> SageMakerPipelineParameter -> ShowS
$cshowsPrec :: Int -> SageMakerPipelineParameter -> ShowS
Prelude.Show, (forall x.
 SageMakerPipelineParameter -> Rep SageMakerPipelineParameter x)
-> (forall x.
    Rep SageMakerPipelineParameter x -> SageMakerPipelineParameter)
-> Generic SageMakerPipelineParameter
forall x.
Rep SageMakerPipelineParameter x -> SageMakerPipelineParameter
forall x.
SageMakerPipelineParameter -> Rep SageMakerPipelineParameter x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SageMakerPipelineParameter x -> SageMakerPipelineParameter
$cfrom :: forall x.
SageMakerPipelineParameter -> Rep SageMakerPipelineParameter x
Prelude.Generic)

-- |
-- Create a value of 'SageMakerPipelineParameter' 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:
--
-- 'name', 'sageMakerPipelineParameter_name' - Name of parameter to start execution of a SageMaker Model Building
-- Pipeline.
--
-- 'value', 'sageMakerPipelineParameter_value' - Value of parameter to start execution of a SageMaker Model Building
-- Pipeline.
newSageMakerPipelineParameter ::
  -- | 'name'
  Prelude.Text ->
  -- | 'value'
  Prelude.Text ->
  SageMakerPipelineParameter
newSageMakerPipelineParameter :: Text -> Text -> SageMakerPipelineParameter
newSageMakerPipelineParameter Text
pName_ Text
pValue_ =
  SageMakerPipelineParameter' :: Text -> Text -> SageMakerPipelineParameter
SageMakerPipelineParameter'
    { $sel:name:SageMakerPipelineParameter' :: Text
name = Text
pName_,
      $sel:value:SageMakerPipelineParameter' :: Text
value = Text
pValue_
    }

-- | Name of parameter to start execution of a SageMaker Model Building
-- Pipeline.
sageMakerPipelineParameter_name :: Lens.Lens' SageMakerPipelineParameter Prelude.Text
sageMakerPipelineParameter_name :: (Text -> f Text)
-> SageMakerPipelineParameter -> f SageMakerPipelineParameter
sageMakerPipelineParameter_name = (SageMakerPipelineParameter -> Text)
-> (SageMakerPipelineParameter
    -> Text -> SageMakerPipelineParameter)
-> Lens
     SageMakerPipelineParameter SageMakerPipelineParameter Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SageMakerPipelineParameter' {Text
name :: Text
$sel:name:SageMakerPipelineParameter' :: SageMakerPipelineParameter -> Text
name} -> Text
name) (\s :: SageMakerPipelineParameter
s@SageMakerPipelineParameter' {} Text
a -> SageMakerPipelineParameter
s {$sel:name:SageMakerPipelineParameter' :: Text
name = Text
a} :: SageMakerPipelineParameter)

-- | Value of parameter to start execution of a SageMaker Model Building
-- Pipeline.
sageMakerPipelineParameter_value :: Lens.Lens' SageMakerPipelineParameter Prelude.Text
sageMakerPipelineParameter_value :: (Text -> f Text)
-> SageMakerPipelineParameter -> f SageMakerPipelineParameter
sageMakerPipelineParameter_value = (SageMakerPipelineParameter -> Text)
-> (SageMakerPipelineParameter
    -> Text -> SageMakerPipelineParameter)
-> Lens
     SageMakerPipelineParameter SageMakerPipelineParameter Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SageMakerPipelineParameter' {Text
value :: Text
$sel:value:SageMakerPipelineParameter' :: SageMakerPipelineParameter -> Text
value} -> Text
value) (\s :: SageMakerPipelineParameter
s@SageMakerPipelineParameter' {} Text
a -> SageMakerPipelineParameter
s {$sel:value:SageMakerPipelineParameter' :: Text
value = Text
a} :: SageMakerPipelineParameter)

instance Core.FromJSON SageMakerPipelineParameter where
  parseJSON :: Value -> Parser SageMakerPipelineParameter
parseJSON =
    String
-> (Object -> Parser SageMakerPipelineParameter)
-> Value
-> Parser SageMakerPipelineParameter
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SageMakerPipelineParameter"
      ( \Object
x ->
          Text -> Text -> SageMakerPipelineParameter
SageMakerPipelineParameter'
            (Text -> Text -> SageMakerPipelineParameter)
-> Parser Text -> Parser (Text -> SageMakerPipelineParameter)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Name") Parser (Text -> SageMakerPipelineParameter)
-> Parser Text -> Parser SageMakerPipelineParameter
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Value")
      )

instance Prelude.Hashable SageMakerPipelineParameter

instance Prelude.NFData SageMakerPipelineParameter

instance Core.ToJSON SageMakerPipelineParameter where
  toJSON :: SageMakerPipelineParameter -> Value
toJSON SageMakerPipelineParameter' {Text
value :: Text
name :: Text
$sel:value:SageMakerPipelineParameter' :: SageMakerPipelineParameter -> Text
$sel:name:SageMakerPipelineParameter' :: SageMakerPipelineParameter -> 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
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
            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)
          ]
      )