{-# 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.SWF.Types.ScheduleLambdaFunctionDecisionAttributes
-- 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.SWF.Types.ScheduleLambdaFunctionDecisionAttributes where

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

-- | Decision attributes specified in
-- @scheduleLambdaFunctionDecisionAttributes@ within the list of decisions
-- @decisions@ passed to RespondDecisionTaskCompleted.
--
-- /See:/ 'newScheduleLambdaFunctionDecisionAttributes' smart constructor.
data ScheduleLambdaFunctionDecisionAttributes = ScheduleLambdaFunctionDecisionAttributes'
  { -- | The data attached to the event that the decider can use in subsequent
    -- workflow tasks. This data isn\'t sent to the Lambda task.
    ScheduleLambdaFunctionDecisionAttributes -> Maybe Text
control :: Prelude.Maybe Prelude.Text,
    -- | The optional input data to be supplied to the Lambda function.
    ScheduleLambdaFunctionDecisionAttributes -> Maybe Text
input :: Prelude.Maybe Prelude.Text,
    -- | The timeout value, in seconds, after which the Lambda function is
    -- considered to be failed once it has started. This can be any integer
    -- from 1-300 (1s-5m). If no value is supplied, than a default value of
    -- 300s is assumed.
    ScheduleLambdaFunctionDecisionAttributes -> Maybe Text
startToCloseTimeout :: Prelude.Maybe Prelude.Text,
    -- | A string that identifies the Lambda function execution in the event
    -- history.
    ScheduleLambdaFunctionDecisionAttributes -> Text
id :: Prelude.Text,
    -- | The name, or ARN, of the Lambda function to schedule.
    ScheduleLambdaFunctionDecisionAttributes -> Text
name :: Prelude.Text
  }
  deriving (ScheduleLambdaFunctionDecisionAttributes
-> ScheduleLambdaFunctionDecisionAttributes -> Bool
(ScheduleLambdaFunctionDecisionAttributes
 -> ScheduleLambdaFunctionDecisionAttributes -> Bool)
-> (ScheduleLambdaFunctionDecisionAttributes
    -> ScheduleLambdaFunctionDecisionAttributes -> Bool)
-> Eq ScheduleLambdaFunctionDecisionAttributes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ScheduleLambdaFunctionDecisionAttributes
-> ScheduleLambdaFunctionDecisionAttributes -> Bool
$c/= :: ScheduleLambdaFunctionDecisionAttributes
-> ScheduleLambdaFunctionDecisionAttributes -> Bool
== :: ScheduleLambdaFunctionDecisionAttributes
-> ScheduleLambdaFunctionDecisionAttributes -> Bool
$c== :: ScheduleLambdaFunctionDecisionAttributes
-> ScheduleLambdaFunctionDecisionAttributes -> Bool
Prelude.Eq, ReadPrec [ScheduleLambdaFunctionDecisionAttributes]
ReadPrec ScheduleLambdaFunctionDecisionAttributes
Int -> ReadS ScheduleLambdaFunctionDecisionAttributes
ReadS [ScheduleLambdaFunctionDecisionAttributes]
(Int -> ReadS ScheduleLambdaFunctionDecisionAttributes)
-> ReadS [ScheduleLambdaFunctionDecisionAttributes]
-> ReadPrec ScheduleLambdaFunctionDecisionAttributes
-> ReadPrec [ScheduleLambdaFunctionDecisionAttributes]
-> Read ScheduleLambdaFunctionDecisionAttributes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ScheduleLambdaFunctionDecisionAttributes]
$creadListPrec :: ReadPrec [ScheduleLambdaFunctionDecisionAttributes]
readPrec :: ReadPrec ScheduleLambdaFunctionDecisionAttributes
$creadPrec :: ReadPrec ScheduleLambdaFunctionDecisionAttributes
readList :: ReadS [ScheduleLambdaFunctionDecisionAttributes]
$creadList :: ReadS [ScheduleLambdaFunctionDecisionAttributes]
readsPrec :: Int -> ReadS ScheduleLambdaFunctionDecisionAttributes
$creadsPrec :: Int -> ReadS ScheduleLambdaFunctionDecisionAttributes
Prelude.Read, Int -> ScheduleLambdaFunctionDecisionAttributes -> ShowS
[ScheduleLambdaFunctionDecisionAttributes] -> ShowS
ScheduleLambdaFunctionDecisionAttributes -> String
(Int -> ScheduleLambdaFunctionDecisionAttributes -> ShowS)
-> (ScheduleLambdaFunctionDecisionAttributes -> String)
-> ([ScheduleLambdaFunctionDecisionAttributes] -> ShowS)
-> Show ScheduleLambdaFunctionDecisionAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ScheduleLambdaFunctionDecisionAttributes] -> ShowS
$cshowList :: [ScheduleLambdaFunctionDecisionAttributes] -> ShowS
show :: ScheduleLambdaFunctionDecisionAttributes -> String
$cshow :: ScheduleLambdaFunctionDecisionAttributes -> String
showsPrec :: Int -> ScheduleLambdaFunctionDecisionAttributes -> ShowS
$cshowsPrec :: Int -> ScheduleLambdaFunctionDecisionAttributes -> ShowS
Prelude.Show, (forall x.
 ScheduleLambdaFunctionDecisionAttributes
 -> Rep ScheduleLambdaFunctionDecisionAttributes x)
-> (forall x.
    Rep ScheduleLambdaFunctionDecisionAttributes x
    -> ScheduleLambdaFunctionDecisionAttributes)
-> Generic ScheduleLambdaFunctionDecisionAttributes
forall x.
Rep ScheduleLambdaFunctionDecisionAttributes x
-> ScheduleLambdaFunctionDecisionAttributes
forall x.
ScheduleLambdaFunctionDecisionAttributes
-> Rep ScheduleLambdaFunctionDecisionAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ScheduleLambdaFunctionDecisionAttributes x
-> ScheduleLambdaFunctionDecisionAttributes
$cfrom :: forall x.
ScheduleLambdaFunctionDecisionAttributes
-> Rep ScheduleLambdaFunctionDecisionAttributes x
Prelude.Generic)

-- |
-- Create a value of 'ScheduleLambdaFunctionDecisionAttributes' 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:
--
-- 'control', 'scheduleLambdaFunctionDecisionAttributes_control' - The data attached to the event that the decider can use in subsequent
-- workflow tasks. This data isn\'t sent to the Lambda task.
--
-- 'input', 'scheduleLambdaFunctionDecisionAttributes_input' - The optional input data to be supplied to the Lambda function.
--
-- 'startToCloseTimeout', 'scheduleLambdaFunctionDecisionAttributes_startToCloseTimeout' - The timeout value, in seconds, after which the Lambda function is
-- considered to be failed once it has started. This can be any integer
-- from 1-300 (1s-5m). If no value is supplied, than a default value of
-- 300s is assumed.
--
-- 'id', 'scheduleLambdaFunctionDecisionAttributes_id' - A string that identifies the Lambda function execution in the event
-- history.
--
-- 'name', 'scheduleLambdaFunctionDecisionAttributes_name' - The name, or ARN, of the Lambda function to schedule.
newScheduleLambdaFunctionDecisionAttributes ::
  -- | 'id'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  ScheduleLambdaFunctionDecisionAttributes
newScheduleLambdaFunctionDecisionAttributes :: Text -> Text -> ScheduleLambdaFunctionDecisionAttributes
newScheduleLambdaFunctionDecisionAttributes
  Text
pId_
  Text
pName_ =
    ScheduleLambdaFunctionDecisionAttributes' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Text
-> Text
-> ScheduleLambdaFunctionDecisionAttributes
ScheduleLambdaFunctionDecisionAttributes'
      { $sel:control:ScheduleLambdaFunctionDecisionAttributes' :: Maybe Text
control =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:input:ScheduleLambdaFunctionDecisionAttributes' :: Maybe Text
input = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:startToCloseTimeout:ScheduleLambdaFunctionDecisionAttributes' :: Maybe Text
startToCloseTimeout =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:id:ScheduleLambdaFunctionDecisionAttributes' :: Text
id = Text
pId_,
        $sel:name:ScheduleLambdaFunctionDecisionAttributes' :: Text
name = Text
pName_
      }

-- | The data attached to the event that the decider can use in subsequent
-- workflow tasks. This data isn\'t sent to the Lambda task.
scheduleLambdaFunctionDecisionAttributes_control :: Lens.Lens' ScheduleLambdaFunctionDecisionAttributes (Prelude.Maybe Prelude.Text)
scheduleLambdaFunctionDecisionAttributes_control :: (Maybe Text -> f (Maybe Text))
-> ScheduleLambdaFunctionDecisionAttributes
-> f ScheduleLambdaFunctionDecisionAttributes
scheduleLambdaFunctionDecisionAttributes_control = (ScheduleLambdaFunctionDecisionAttributes -> Maybe Text)
-> (ScheduleLambdaFunctionDecisionAttributes
    -> Maybe Text -> ScheduleLambdaFunctionDecisionAttributes)
-> Lens
     ScheduleLambdaFunctionDecisionAttributes
     ScheduleLambdaFunctionDecisionAttributes
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduleLambdaFunctionDecisionAttributes' {Maybe Text
control :: Maybe Text
$sel:control:ScheduleLambdaFunctionDecisionAttributes' :: ScheduleLambdaFunctionDecisionAttributes -> Maybe Text
control} -> Maybe Text
control) (\s :: ScheduleLambdaFunctionDecisionAttributes
s@ScheduleLambdaFunctionDecisionAttributes' {} Maybe Text
a -> ScheduleLambdaFunctionDecisionAttributes
s {$sel:control:ScheduleLambdaFunctionDecisionAttributes' :: Maybe Text
control = Maybe Text
a} :: ScheduleLambdaFunctionDecisionAttributes)

-- | The optional input data to be supplied to the Lambda function.
scheduleLambdaFunctionDecisionAttributes_input :: Lens.Lens' ScheduleLambdaFunctionDecisionAttributes (Prelude.Maybe Prelude.Text)
scheduleLambdaFunctionDecisionAttributes_input :: (Maybe Text -> f (Maybe Text))
-> ScheduleLambdaFunctionDecisionAttributes
-> f ScheduleLambdaFunctionDecisionAttributes
scheduleLambdaFunctionDecisionAttributes_input = (ScheduleLambdaFunctionDecisionAttributes -> Maybe Text)
-> (ScheduleLambdaFunctionDecisionAttributes
    -> Maybe Text -> ScheduleLambdaFunctionDecisionAttributes)
-> Lens
     ScheduleLambdaFunctionDecisionAttributes
     ScheduleLambdaFunctionDecisionAttributes
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduleLambdaFunctionDecisionAttributes' {Maybe Text
input :: Maybe Text
$sel:input:ScheduleLambdaFunctionDecisionAttributes' :: ScheduleLambdaFunctionDecisionAttributes -> Maybe Text
input} -> Maybe Text
input) (\s :: ScheduleLambdaFunctionDecisionAttributes
s@ScheduleLambdaFunctionDecisionAttributes' {} Maybe Text
a -> ScheduleLambdaFunctionDecisionAttributes
s {$sel:input:ScheduleLambdaFunctionDecisionAttributes' :: Maybe Text
input = Maybe Text
a} :: ScheduleLambdaFunctionDecisionAttributes)

-- | The timeout value, in seconds, after which the Lambda function is
-- considered to be failed once it has started. This can be any integer
-- from 1-300 (1s-5m). If no value is supplied, than a default value of
-- 300s is assumed.
scheduleLambdaFunctionDecisionAttributes_startToCloseTimeout :: Lens.Lens' ScheduleLambdaFunctionDecisionAttributes (Prelude.Maybe Prelude.Text)
scheduleLambdaFunctionDecisionAttributes_startToCloseTimeout :: (Maybe Text -> f (Maybe Text))
-> ScheduleLambdaFunctionDecisionAttributes
-> f ScheduleLambdaFunctionDecisionAttributes
scheduleLambdaFunctionDecisionAttributes_startToCloseTimeout = (ScheduleLambdaFunctionDecisionAttributes -> Maybe Text)
-> (ScheduleLambdaFunctionDecisionAttributes
    -> Maybe Text -> ScheduleLambdaFunctionDecisionAttributes)
-> Lens
     ScheduleLambdaFunctionDecisionAttributes
     ScheduleLambdaFunctionDecisionAttributes
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduleLambdaFunctionDecisionAttributes' {Maybe Text
startToCloseTimeout :: Maybe Text
$sel:startToCloseTimeout:ScheduleLambdaFunctionDecisionAttributes' :: ScheduleLambdaFunctionDecisionAttributes -> Maybe Text
startToCloseTimeout} -> Maybe Text
startToCloseTimeout) (\s :: ScheduleLambdaFunctionDecisionAttributes
s@ScheduleLambdaFunctionDecisionAttributes' {} Maybe Text
a -> ScheduleLambdaFunctionDecisionAttributes
s {$sel:startToCloseTimeout:ScheduleLambdaFunctionDecisionAttributes' :: Maybe Text
startToCloseTimeout = Maybe Text
a} :: ScheduleLambdaFunctionDecisionAttributes)

-- | A string that identifies the Lambda function execution in the event
-- history.
scheduleLambdaFunctionDecisionAttributes_id :: Lens.Lens' ScheduleLambdaFunctionDecisionAttributes Prelude.Text
scheduleLambdaFunctionDecisionAttributes_id :: (Text -> f Text)
-> ScheduleLambdaFunctionDecisionAttributes
-> f ScheduleLambdaFunctionDecisionAttributes
scheduleLambdaFunctionDecisionAttributes_id = (ScheduleLambdaFunctionDecisionAttributes -> Text)
-> (ScheduleLambdaFunctionDecisionAttributes
    -> Text -> ScheduleLambdaFunctionDecisionAttributes)
-> Lens
     ScheduleLambdaFunctionDecisionAttributes
     ScheduleLambdaFunctionDecisionAttributes
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduleLambdaFunctionDecisionAttributes' {Text
id :: Text
$sel:id:ScheduleLambdaFunctionDecisionAttributes' :: ScheduleLambdaFunctionDecisionAttributes -> Text
id} -> Text
id) (\s :: ScheduleLambdaFunctionDecisionAttributes
s@ScheduleLambdaFunctionDecisionAttributes' {} Text
a -> ScheduleLambdaFunctionDecisionAttributes
s {$sel:id:ScheduleLambdaFunctionDecisionAttributes' :: Text
id = Text
a} :: ScheduleLambdaFunctionDecisionAttributes)

-- | The name, or ARN, of the Lambda function to schedule.
scheduleLambdaFunctionDecisionAttributes_name :: Lens.Lens' ScheduleLambdaFunctionDecisionAttributes Prelude.Text
scheduleLambdaFunctionDecisionAttributes_name :: (Text -> f Text)
-> ScheduleLambdaFunctionDecisionAttributes
-> f ScheduleLambdaFunctionDecisionAttributes
scheduleLambdaFunctionDecisionAttributes_name = (ScheduleLambdaFunctionDecisionAttributes -> Text)
-> (ScheduleLambdaFunctionDecisionAttributes
    -> Text -> ScheduleLambdaFunctionDecisionAttributes)
-> Lens
     ScheduleLambdaFunctionDecisionAttributes
     ScheduleLambdaFunctionDecisionAttributes
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduleLambdaFunctionDecisionAttributes' {Text
name :: Text
$sel:name:ScheduleLambdaFunctionDecisionAttributes' :: ScheduleLambdaFunctionDecisionAttributes -> Text
name} -> Text
name) (\s :: ScheduleLambdaFunctionDecisionAttributes
s@ScheduleLambdaFunctionDecisionAttributes' {} Text
a -> ScheduleLambdaFunctionDecisionAttributes
s {$sel:name:ScheduleLambdaFunctionDecisionAttributes' :: Text
name = Text
a} :: ScheduleLambdaFunctionDecisionAttributes)

instance
  Prelude.Hashable
    ScheduleLambdaFunctionDecisionAttributes

instance
  Prelude.NFData
    ScheduleLambdaFunctionDecisionAttributes

instance
  Core.ToJSON
    ScheduleLambdaFunctionDecisionAttributes
  where
  toJSON :: ScheduleLambdaFunctionDecisionAttributes -> Value
toJSON ScheduleLambdaFunctionDecisionAttributes' {Maybe Text
Text
name :: Text
id :: Text
startToCloseTimeout :: Maybe Text
input :: Maybe Text
control :: Maybe Text
$sel:name:ScheduleLambdaFunctionDecisionAttributes' :: ScheduleLambdaFunctionDecisionAttributes -> Text
$sel:id:ScheduleLambdaFunctionDecisionAttributes' :: ScheduleLambdaFunctionDecisionAttributes -> Text
$sel:startToCloseTimeout:ScheduleLambdaFunctionDecisionAttributes' :: ScheduleLambdaFunctionDecisionAttributes -> Maybe Text
$sel:input:ScheduleLambdaFunctionDecisionAttributes' :: ScheduleLambdaFunctionDecisionAttributes -> Maybe Text
$sel:control:ScheduleLambdaFunctionDecisionAttributes' :: ScheduleLambdaFunctionDecisionAttributes -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"control" 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
control,
            (Text
"input" 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
input,
            (Text
"startToCloseTimeout" 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
startToCloseTimeout,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"id" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
id),
            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)
          ]
      )