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

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

-- | Provides the details of the @StartTimer@ decision.
--
-- __Access Control__
--
-- You can use IAM policies to control this decision\'s access to Amazon
-- SWF resources as follows:
--
-- -   Use a @Resource@ element with the domain name to limit the action to
--     only specified domains.
--
-- -   Use an @Action@ element to allow or deny permission to call this
--     action.
--
-- -   You cannot use an IAM policy to constrain this action\'s parameters.
--
-- If the caller doesn\'t have sufficient permissions to invoke the action,
-- or the parameter values fall outside the specified constraints, the
-- action fails. The associated event attribute\'s @cause@ parameter is set
-- to @OPERATION_NOT_PERMITTED@. For details and example IAM policies, see
-- <https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html Using IAM to Manage Access to Amazon SWF Workflows>
-- in the /Amazon SWF Developer Guide/.
--
-- /See:/ 'newStartTimerDecisionAttributes' smart constructor.
data StartTimerDecisionAttributes = StartTimerDecisionAttributes'
  { -- | The data attached to the event that can be used by the decider in
    -- subsequent workflow tasks.
    StartTimerDecisionAttributes -> Maybe Text
control :: Prelude.Maybe Prelude.Text,
    -- | The unique ID of the timer.
    --
    -- The specified string must not start or end with whitespace. It must not
    -- contain a @:@ (colon), @\/@ (slash), @|@ (vertical bar), or any control
    -- characters (@\\u0000-\\u001f@ | @\\u007f-\\u009f@). Also, it must not
    -- contain the literal string @arn@.
    StartTimerDecisionAttributes -> Text
timerId :: Prelude.Text,
    -- | The duration to wait before firing the timer.
    --
    -- The duration is specified in seconds, an integer greater than or equal
    -- to @0@.
    StartTimerDecisionAttributes -> Text
startToFireTimeout :: Prelude.Text
  }
  deriving (StartTimerDecisionAttributes
-> StartTimerDecisionAttributes -> Bool
(StartTimerDecisionAttributes
 -> StartTimerDecisionAttributes -> Bool)
-> (StartTimerDecisionAttributes
    -> StartTimerDecisionAttributes -> Bool)
-> Eq StartTimerDecisionAttributes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartTimerDecisionAttributes
-> StartTimerDecisionAttributes -> Bool
$c/= :: StartTimerDecisionAttributes
-> StartTimerDecisionAttributes -> Bool
== :: StartTimerDecisionAttributes
-> StartTimerDecisionAttributes -> Bool
$c== :: StartTimerDecisionAttributes
-> StartTimerDecisionAttributes -> Bool
Prelude.Eq, ReadPrec [StartTimerDecisionAttributes]
ReadPrec StartTimerDecisionAttributes
Int -> ReadS StartTimerDecisionAttributes
ReadS [StartTimerDecisionAttributes]
(Int -> ReadS StartTimerDecisionAttributes)
-> ReadS [StartTimerDecisionAttributes]
-> ReadPrec StartTimerDecisionAttributes
-> ReadPrec [StartTimerDecisionAttributes]
-> Read StartTimerDecisionAttributes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartTimerDecisionAttributes]
$creadListPrec :: ReadPrec [StartTimerDecisionAttributes]
readPrec :: ReadPrec StartTimerDecisionAttributes
$creadPrec :: ReadPrec StartTimerDecisionAttributes
readList :: ReadS [StartTimerDecisionAttributes]
$creadList :: ReadS [StartTimerDecisionAttributes]
readsPrec :: Int -> ReadS StartTimerDecisionAttributes
$creadsPrec :: Int -> ReadS StartTimerDecisionAttributes
Prelude.Read, Int -> StartTimerDecisionAttributes -> ShowS
[StartTimerDecisionAttributes] -> ShowS
StartTimerDecisionAttributes -> String
(Int -> StartTimerDecisionAttributes -> ShowS)
-> (StartTimerDecisionAttributes -> String)
-> ([StartTimerDecisionAttributes] -> ShowS)
-> Show StartTimerDecisionAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartTimerDecisionAttributes] -> ShowS
$cshowList :: [StartTimerDecisionAttributes] -> ShowS
show :: StartTimerDecisionAttributes -> String
$cshow :: StartTimerDecisionAttributes -> String
showsPrec :: Int -> StartTimerDecisionAttributes -> ShowS
$cshowsPrec :: Int -> StartTimerDecisionAttributes -> ShowS
Prelude.Show, (forall x.
 StartTimerDecisionAttributes -> Rep StartTimerDecisionAttributes x)
-> (forall x.
    Rep StartTimerDecisionAttributes x -> StartTimerDecisionAttributes)
-> Generic StartTimerDecisionAttributes
forall x.
Rep StartTimerDecisionAttributes x -> StartTimerDecisionAttributes
forall x.
StartTimerDecisionAttributes -> Rep StartTimerDecisionAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StartTimerDecisionAttributes x -> StartTimerDecisionAttributes
$cfrom :: forall x.
StartTimerDecisionAttributes -> Rep StartTimerDecisionAttributes x
Prelude.Generic)

-- |
-- Create a value of 'StartTimerDecisionAttributes' 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', 'startTimerDecisionAttributes_control' - The data attached to the event that can be used by the decider in
-- subsequent workflow tasks.
--
-- 'timerId', 'startTimerDecisionAttributes_timerId' - The unique ID of the timer.
--
-- The specified string must not start or end with whitespace. It must not
-- contain a @:@ (colon), @\/@ (slash), @|@ (vertical bar), or any control
-- characters (@\\u0000-\\u001f@ | @\\u007f-\\u009f@). Also, it must not
-- contain the literal string @arn@.
--
-- 'startToFireTimeout', 'startTimerDecisionAttributes_startToFireTimeout' - The duration to wait before firing the timer.
--
-- The duration is specified in seconds, an integer greater than or equal
-- to @0@.
newStartTimerDecisionAttributes ::
  -- | 'timerId'
  Prelude.Text ->
  -- | 'startToFireTimeout'
  Prelude.Text ->
  StartTimerDecisionAttributes
newStartTimerDecisionAttributes :: Text -> Text -> StartTimerDecisionAttributes
newStartTimerDecisionAttributes
  Text
pTimerId_
  Text
pStartToFireTimeout_ =
    StartTimerDecisionAttributes' :: Maybe Text -> Text -> Text -> StartTimerDecisionAttributes
StartTimerDecisionAttributes'
      { $sel:control:StartTimerDecisionAttributes' :: Maybe Text
control =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:timerId:StartTimerDecisionAttributes' :: Text
timerId = Text
pTimerId_,
        $sel:startToFireTimeout:StartTimerDecisionAttributes' :: Text
startToFireTimeout = Text
pStartToFireTimeout_
      }

-- | The data attached to the event that can be used by the decider in
-- subsequent workflow tasks.
startTimerDecisionAttributes_control :: Lens.Lens' StartTimerDecisionAttributes (Prelude.Maybe Prelude.Text)
startTimerDecisionAttributes_control :: (Maybe Text -> f (Maybe Text))
-> StartTimerDecisionAttributes -> f StartTimerDecisionAttributes
startTimerDecisionAttributes_control = (StartTimerDecisionAttributes -> Maybe Text)
-> (StartTimerDecisionAttributes
    -> Maybe Text -> StartTimerDecisionAttributes)
-> Lens
     StartTimerDecisionAttributes
     StartTimerDecisionAttributes
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartTimerDecisionAttributes' {Maybe Text
control :: Maybe Text
$sel:control:StartTimerDecisionAttributes' :: StartTimerDecisionAttributes -> Maybe Text
control} -> Maybe Text
control) (\s :: StartTimerDecisionAttributes
s@StartTimerDecisionAttributes' {} Maybe Text
a -> StartTimerDecisionAttributes
s {$sel:control:StartTimerDecisionAttributes' :: Maybe Text
control = Maybe Text
a} :: StartTimerDecisionAttributes)

-- | The unique ID of the timer.
--
-- The specified string must not start or end with whitespace. It must not
-- contain a @:@ (colon), @\/@ (slash), @|@ (vertical bar), or any control
-- characters (@\\u0000-\\u001f@ | @\\u007f-\\u009f@). Also, it must not
-- contain the literal string @arn@.
startTimerDecisionAttributes_timerId :: Lens.Lens' StartTimerDecisionAttributes Prelude.Text
startTimerDecisionAttributes_timerId :: (Text -> f Text)
-> StartTimerDecisionAttributes -> f StartTimerDecisionAttributes
startTimerDecisionAttributes_timerId = (StartTimerDecisionAttributes -> Text)
-> (StartTimerDecisionAttributes
    -> Text -> StartTimerDecisionAttributes)
-> Lens
     StartTimerDecisionAttributes StartTimerDecisionAttributes Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartTimerDecisionAttributes' {Text
timerId :: Text
$sel:timerId:StartTimerDecisionAttributes' :: StartTimerDecisionAttributes -> Text
timerId} -> Text
timerId) (\s :: StartTimerDecisionAttributes
s@StartTimerDecisionAttributes' {} Text
a -> StartTimerDecisionAttributes
s {$sel:timerId:StartTimerDecisionAttributes' :: Text
timerId = Text
a} :: StartTimerDecisionAttributes)

-- | The duration to wait before firing the timer.
--
-- The duration is specified in seconds, an integer greater than or equal
-- to @0@.
startTimerDecisionAttributes_startToFireTimeout :: Lens.Lens' StartTimerDecisionAttributes Prelude.Text
startTimerDecisionAttributes_startToFireTimeout :: (Text -> f Text)
-> StartTimerDecisionAttributes -> f StartTimerDecisionAttributes
startTimerDecisionAttributes_startToFireTimeout = (StartTimerDecisionAttributes -> Text)
-> (StartTimerDecisionAttributes
    -> Text -> StartTimerDecisionAttributes)
-> Lens
     StartTimerDecisionAttributes StartTimerDecisionAttributes Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartTimerDecisionAttributes' {Text
startToFireTimeout :: Text
$sel:startToFireTimeout:StartTimerDecisionAttributes' :: StartTimerDecisionAttributes -> Text
startToFireTimeout} -> Text
startToFireTimeout) (\s :: StartTimerDecisionAttributes
s@StartTimerDecisionAttributes' {} Text
a -> StartTimerDecisionAttributes
s {$sel:startToFireTimeout:StartTimerDecisionAttributes' :: Text
startToFireTimeout = Text
a} :: StartTimerDecisionAttributes)

instance
  Prelude.Hashable
    StartTimerDecisionAttributes

instance Prelude.NFData StartTimerDecisionAttributes

instance Core.ToJSON StartTimerDecisionAttributes where
  toJSON :: StartTimerDecisionAttributes -> Value
toJSON StartTimerDecisionAttributes' {Maybe Text
Text
startToFireTimeout :: Text
timerId :: Text
control :: Maybe Text
$sel:startToFireTimeout:StartTimerDecisionAttributes' :: StartTimerDecisionAttributes -> Text
$sel:timerId:StartTimerDecisionAttributes' :: StartTimerDecisionAttributes -> Text
$sel:control:StartTimerDecisionAttributes' :: StartTimerDecisionAttributes -> 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,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"timerId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
timerId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"startToFireTimeout" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
startToFireTimeout)
          ]
      )