{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.SageMaker.Types.OutputParameter where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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' {$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 :: Lens' OutputParameter Text
outputParameter_name = 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 :: Lens' OutputParameter Text
outputParameter_value = 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 Data.FromJSON OutputParameter where
  parseJSON :: Value -> Parser OutputParameter
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"OutputParameter"
      ( \Object
x ->
          Text -> Text -> OutputParameter
OutputParameter'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Name")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Value")
      )

instance Prelude.Hashable OutputParameter where
  hashWithSalt :: Int -> OutputParameter -> Int
hashWithSalt Int
_salt OutputParameter' {Text
value :: Text
name :: Text
$sel:value:OutputParameter' :: OutputParameter -> Text
$sel:name:OutputParameter' :: OutputParameter -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
value

instance Prelude.NFData OutputParameter where
  rnf :: OutputParameter -> ()
rnf OutputParameter' {Text
value :: Text
name :: Text
$sel:value:OutputParameter' :: OutputParameter -> Text
$sel:name:OutputParameter' :: OutputParameter -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
name seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
value

instance Data.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
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just (Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name),
            forall a. a -> Maybe a
Prelude.Just (Key
"Value" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
value)
          ]
      )