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

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

-- | Contains input values for a task.
--
-- /See:/ 'newRenderableTask' smart constructor.
data RenderableTask = RenderableTask'
  { -- | A JSON object that contains values for the variables defined in the
    -- template. It is made available to the template under the substitution
    -- variable @task.input@. For example, if you define a variable
    -- @task.input.text@ in your template, you can supply the variable in the
    -- JSON object as @\"text\": \"sample text\"@.
    RenderableTask -> Text
input :: Prelude.Text
  }
  deriving (RenderableTask -> RenderableTask -> Bool
(RenderableTask -> RenderableTask -> Bool)
-> (RenderableTask -> RenderableTask -> Bool) -> Eq RenderableTask
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RenderableTask -> RenderableTask -> Bool
$c/= :: RenderableTask -> RenderableTask -> Bool
== :: RenderableTask -> RenderableTask -> Bool
$c== :: RenderableTask -> RenderableTask -> Bool
Prelude.Eq, ReadPrec [RenderableTask]
ReadPrec RenderableTask
Int -> ReadS RenderableTask
ReadS [RenderableTask]
(Int -> ReadS RenderableTask)
-> ReadS [RenderableTask]
-> ReadPrec RenderableTask
-> ReadPrec [RenderableTask]
-> Read RenderableTask
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RenderableTask]
$creadListPrec :: ReadPrec [RenderableTask]
readPrec :: ReadPrec RenderableTask
$creadPrec :: ReadPrec RenderableTask
readList :: ReadS [RenderableTask]
$creadList :: ReadS [RenderableTask]
readsPrec :: Int -> ReadS RenderableTask
$creadsPrec :: Int -> ReadS RenderableTask
Prelude.Read, Int -> RenderableTask -> ShowS
[RenderableTask] -> ShowS
RenderableTask -> String
(Int -> RenderableTask -> ShowS)
-> (RenderableTask -> String)
-> ([RenderableTask] -> ShowS)
-> Show RenderableTask
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RenderableTask] -> ShowS
$cshowList :: [RenderableTask] -> ShowS
show :: RenderableTask -> String
$cshow :: RenderableTask -> String
showsPrec :: Int -> RenderableTask -> ShowS
$cshowsPrec :: Int -> RenderableTask -> ShowS
Prelude.Show, (forall x. RenderableTask -> Rep RenderableTask x)
-> (forall x. Rep RenderableTask x -> RenderableTask)
-> Generic RenderableTask
forall x. Rep RenderableTask x -> RenderableTask
forall x. RenderableTask -> Rep RenderableTask x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RenderableTask x -> RenderableTask
$cfrom :: forall x. RenderableTask -> Rep RenderableTask x
Prelude.Generic)

-- |
-- Create a value of 'RenderableTask' 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:
--
-- 'input', 'renderableTask_input' - A JSON object that contains values for the variables defined in the
-- template. It is made available to the template under the substitution
-- variable @task.input@. For example, if you define a variable
-- @task.input.text@ in your template, you can supply the variable in the
-- JSON object as @\"text\": \"sample text\"@.
newRenderableTask ::
  -- | 'input'
  Prelude.Text ->
  RenderableTask
newRenderableTask :: Text -> RenderableTask
newRenderableTask Text
pInput_ =
  RenderableTask' :: Text -> RenderableTask
RenderableTask' {$sel:input:RenderableTask' :: Text
input = Text
pInput_}

-- | A JSON object that contains values for the variables defined in the
-- template. It is made available to the template under the substitution
-- variable @task.input@. For example, if you define a variable
-- @task.input.text@ in your template, you can supply the variable in the
-- JSON object as @\"text\": \"sample text\"@.
renderableTask_input :: Lens.Lens' RenderableTask Prelude.Text
renderableTask_input :: (Text -> f Text) -> RenderableTask -> f RenderableTask
renderableTask_input = (RenderableTask -> Text)
-> (RenderableTask -> Text -> RenderableTask)
-> Lens RenderableTask RenderableTask Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RenderableTask' {Text
input :: Text
$sel:input:RenderableTask' :: RenderableTask -> Text
input} -> Text
input) (\s :: RenderableTask
s@RenderableTask' {} Text
a -> RenderableTask
s {$sel:input:RenderableTask' :: Text
input = Text
a} :: RenderableTask)

instance Prelude.Hashable RenderableTask

instance Prelude.NFData RenderableTask

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