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

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

-- | An output parameter of a pipeline step.
--
-- /See:/ 'newOutputParameter' smart constructor.
data OutputParameter = OutputParameter'
  { -- | The name of the output parameter.
    OutputParameter -> Text
name :: Prelude.Text,
    -- | The value of the output parameter.
    OutputParameter -> Text
value :: Prelude.Text
  }
  deriving (OutputParameter -> OutputParameter -> Bool
(OutputParameter -> OutputParameter -> Bool)
-> (OutputParameter -> OutputParameter -> Bool)
-> Eq OutputParameter
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OutputParameter -> OutputParameter -> Bool
$c/= :: OutputParameter -> OutputParameter -> Bool
== :: OutputParameter -> OutputParameter -> Bool
$c== :: OutputParameter -> OutputParameter -> Bool
Prelude.Eq, ReadPrec [OutputParameter]
ReadPrec OutputParameter
Int -> ReadS OutputParameter
ReadS [OutputParameter]
(Int -> ReadS OutputParameter)
-> ReadS [OutputParameter]
-> ReadPrec OutputParameter
-> ReadPrec [OutputParameter]
-> Read OutputParameter
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OutputParameter]
$creadListPrec :: ReadPrec [OutputParameter]
readPrec :: ReadPrec OutputParameter
$creadPrec :: ReadPrec OutputParameter
readList :: ReadS [OutputParameter]
$creadList :: ReadS [OutputParameter]
readsPrec :: Int -> ReadS OutputParameter
$creadsPrec :: Int -> ReadS OutputParameter
Prelude.Read, Int -> OutputParameter -> ShowS
[OutputParameter] -> ShowS
OutputParameter -> String
(Int -> OutputParameter -> ShowS)
-> (OutputParameter -> String)
-> ([OutputParameter] -> ShowS)
-> Show OutputParameter
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OutputParameter] -> ShowS
$cshowList :: [OutputParameter] -> ShowS
show :: OutputParameter -> String
$cshow :: OutputParameter -> String
showsPrec :: Int -> OutputParameter -> ShowS
$cshowsPrec :: Int -> OutputParameter -> ShowS
Prelude.Show, (forall x. OutputParameter -> Rep OutputParameter x)
-> (forall x. Rep OutputParameter x -> OutputParameter)
-> Generic OutputParameter
forall x. Rep OutputParameter x -> OutputParameter
forall x. OutputParameter -> Rep OutputParameter x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OutputParameter x -> OutputParameter
$cfrom :: forall x. OutputParameter -> Rep OutputParameter x
Prelude.Generic)

-- |
-- Create a value of 'OutputParameter' 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', 'outputParameter_name' - The name of the output parameter.
--
-- 'value', 'outputParameter_value' - The value of the output parameter.
newOutputParameter ::
  -- | 'name'
  Prelude.Text ->
  -- | 'value'
  Prelude.Text ->
  OutputParameter
newOutputParameter :: Text -> Text -> OutputParameter
newOutputParameter Text
pName_ Text
pValue_ =
  OutputParameter' :: Text -> Text -> OutputParameter
OutputParameter' {$sel:name:OutputParameter' :: Text
name = Text
pName_, $sel:value:OutputParameter' :: Text
value = Text
pValue_}

-- | The name of the output parameter.
outputParameter_name :: Lens.Lens' OutputParameter Prelude.Text
outputParameter_name :: (Text -> f Text) -> OutputParameter -> f OutputParameter
outputParameter_name = (OutputParameter -> Text)
-> (OutputParameter -> Text -> OutputParameter)
-> Lens OutputParameter OutputParameter Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputParameter' {Text
name :: Text
$sel:name:OutputParameter' :: OutputParameter -> Text
name} -> Text
name) (\s :: OutputParameter
s@OutputParameter' {} Text
a -> OutputParameter
s {$sel:name:OutputParameter' :: Text
name = Text
a} :: OutputParameter)

-- | The value of the output parameter.
outputParameter_value :: Lens.Lens' OutputParameter Prelude.Text
outputParameter_value :: (Text -> f Text) -> OutputParameter -> f OutputParameter
outputParameter_value = (OutputParameter -> Text)
-> (OutputParameter -> Text -> OutputParameter)
-> Lens OutputParameter OutputParameter Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputParameter' {Text
value :: Text
$sel:value:OutputParameter' :: OutputParameter -> Text
value} -> Text
value) (\s :: OutputParameter
s@OutputParameter' {} Text
a -> OutputParameter
s {$sel:value:OutputParameter' :: Text
value = Text
a} :: OutputParameter)

instance Core.FromJSON OutputParameter where
  parseJSON :: Value -> Parser OutputParameter
parseJSON =
    String
-> (Object -> Parser OutputParameter)
-> Value
-> Parser OutputParameter
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"OutputParameter"
      ( \Object
x ->
          Text -> Text -> OutputParameter
OutputParameter'
            (Text -> Text -> OutputParameter)
-> Parser Text -> Parser (Text -> OutputParameter)
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 -> OutputParameter)
-> Parser Text -> Parser OutputParameter
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 OutputParameter

instance Prelude.NFData OutputParameter

instance Core.ToJSON OutputParameter where
  toJSON :: OutputParameter -> Value
toJSON OutputParameter' {Text
value :: Text
name :: Text
$sel:value:OutputParameter' :: OutputParameter -> Text
$sel:name:OutputParameter' :: OutputParameter -> 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)
          ]
      )