{-# 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.StepFunctions.Types.TaskScheduledEventDetails
-- 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.StepFunctions.Types.TaskScheduledEventDetails where

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

-- | Contains details about a task scheduled during an execution.
--
-- /See:/ 'newTaskScheduledEventDetails' smart constructor.
data TaskScheduledEventDetails = TaskScheduledEventDetails'
  { -- | The maximum allowed duration between two heartbeats for the task.
    TaskScheduledEventDetails -> Maybe Integer
heartbeatInSeconds :: Prelude.Maybe Prelude.Integer,
    -- | The maximum allowed duration of the task.
    TaskScheduledEventDetails -> Maybe Integer
timeoutInSeconds :: Prelude.Maybe Prelude.Integer,
    -- | The action of the resource called by a task state.
    TaskScheduledEventDetails -> Text
resourceType :: Prelude.Text,
    -- | The service name of the resource in a task state.
    TaskScheduledEventDetails -> Text
resource :: Prelude.Text,
    -- | The region of the scheduled task
    TaskScheduledEventDetails -> Text
region :: Prelude.Text,
    -- | The JSON data passed to the resource referenced in a task state. Length
    -- constraints apply to the payload size, and are expressed as bytes in
    -- UTF-8 encoding.
    TaskScheduledEventDetails -> Sensitive Text
parameters :: Core.Sensitive Prelude.Text
  }
  deriving (TaskScheduledEventDetails -> TaskScheduledEventDetails -> Bool
(TaskScheduledEventDetails -> TaskScheduledEventDetails -> Bool)
-> (TaskScheduledEventDetails -> TaskScheduledEventDetails -> Bool)
-> Eq TaskScheduledEventDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TaskScheduledEventDetails -> TaskScheduledEventDetails -> Bool
$c/= :: TaskScheduledEventDetails -> TaskScheduledEventDetails -> Bool
== :: TaskScheduledEventDetails -> TaskScheduledEventDetails -> Bool
$c== :: TaskScheduledEventDetails -> TaskScheduledEventDetails -> Bool
Prelude.Eq, Int -> TaskScheduledEventDetails -> ShowS
[TaskScheduledEventDetails] -> ShowS
TaskScheduledEventDetails -> String
(Int -> TaskScheduledEventDetails -> ShowS)
-> (TaskScheduledEventDetails -> String)
-> ([TaskScheduledEventDetails] -> ShowS)
-> Show TaskScheduledEventDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TaskScheduledEventDetails] -> ShowS
$cshowList :: [TaskScheduledEventDetails] -> ShowS
show :: TaskScheduledEventDetails -> String
$cshow :: TaskScheduledEventDetails -> String
showsPrec :: Int -> TaskScheduledEventDetails -> ShowS
$cshowsPrec :: Int -> TaskScheduledEventDetails -> ShowS
Prelude.Show, (forall x.
 TaskScheduledEventDetails -> Rep TaskScheduledEventDetails x)
-> (forall x.
    Rep TaskScheduledEventDetails x -> TaskScheduledEventDetails)
-> Generic TaskScheduledEventDetails
forall x.
Rep TaskScheduledEventDetails x -> TaskScheduledEventDetails
forall x.
TaskScheduledEventDetails -> Rep TaskScheduledEventDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep TaskScheduledEventDetails x -> TaskScheduledEventDetails
$cfrom :: forall x.
TaskScheduledEventDetails -> Rep TaskScheduledEventDetails x
Prelude.Generic)

-- |
-- Create a value of 'TaskScheduledEventDetails' 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:
--
-- 'heartbeatInSeconds', 'taskScheduledEventDetails_heartbeatInSeconds' - The maximum allowed duration between two heartbeats for the task.
--
-- 'timeoutInSeconds', 'taskScheduledEventDetails_timeoutInSeconds' - The maximum allowed duration of the task.
--
-- 'resourceType', 'taskScheduledEventDetails_resourceType' - The action of the resource called by a task state.
--
-- 'resource', 'taskScheduledEventDetails_resource' - The service name of the resource in a task state.
--
-- 'region', 'taskScheduledEventDetails_region' - The region of the scheduled task
--
-- 'parameters', 'taskScheduledEventDetails_parameters' - The JSON data passed to the resource referenced in a task state. Length
-- constraints apply to the payload size, and are expressed as bytes in
-- UTF-8 encoding.
newTaskScheduledEventDetails ::
  -- | 'resourceType'
  Prelude.Text ->
  -- | 'resource'
  Prelude.Text ->
  -- | 'region'
  Prelude.Text ->
  -- | 'parameters'
  Prelude.Text ->
  TaskScheduledEventDetails
newTaskScheduledEventDetails :: Text -> Text -> Text -> Text -> TaskScheduledEventDetails
newTaskScheduledEventDetails
  Text
pResourceType_
  Text
pResource_
  Text
pRegion_
  Text
pParameters_ =
    TaskScheduledEventDetails' :: Maybe Integer
-> Maybe Integer
-> Text
-> Text
-> Text
-> Sensitive Text
-> TaskScheduledEventDetails
TaskScheduledEventDetails'
      { $sel:heartbeatInSeconds:TaskScheduledEventDetails' :: Maybe Integer
heartbeatInSeconds =
          Maybe Integer
forall a. Maybe a
Prelude.Nothing,
        $sel:timeoutInSeconds:TaskScheduledEventDetails' :: Maybe Integer
timeoutInSeconds = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
        $sel:resourceType:TaskScheduledEventDetails' :: Text
resourceType = Text
pResourceType_,
        $sel:resource:TaskScheduledEventDetails' :: Text
resource = Text
pResource_,
        $sel:region:TaskScheduledEventDetails' :: Text
region = Text
pRegion_,
        $sel:parameters:TaskScheduledEventDetails' :: Sensitive Text
parameters = Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text))
forall a. Iso' (Sensitive a) a
Core._Sensitive (Tagged Text (Identity Text)
 -> Tagged (Sensitive Text) (Identity (Sensitive Text)))
-> Text -> Sensitive Text
forall t b. AReview t b -> b -> t
Lens.# Text
pParameters_
      }

-- | The maximum allowed duration between two heartbeats for the task.
taskScheduledEventDetails_heartbeatInSeconds :: Lens.Lens' TaskScheduledEventDetails (Prelude.Maybe Prelude.Integer)
taskScheduledEventDetails_heartbeatInSeconds :: (Maybe Integer -> f (Maybe Integer))
-> TaskScheduledEventDetails -> f TaskScheduledEventDetails
taskScheduledEventDetails_heartbeatInSeconds = (TaskScheduledEventDetails -> Maybe Integer)
-> (TaskScheduledEventDetails
    -> Maybe Integer -> TaskScheduledEventDetails)
-> Lens
     TaskScheduledEventDetails
     TaskScheduledEventDetails
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TaskScheduledEventDetails' {Maybe Integer
heartbeatInSeconds :: Maybe Integer
$sel:heartbeatInSeconds:TaskScheduledEventDetails' :: TaskScheduledEventDetails -> Maybe Integer
heartbeatInSeconds} -> Maybe Integer
heartbeatInSeconds) (\s :: TaskScheduledEventDetails
s@TaskScheduledEventDetails' {} Maybe Integer
a -> TaskScheduledEventDetails
s {$sel:heartbeatInSeconds:TaskScheduledEventDetails' :: Maybe Integer
heartbeatInSeconds = Maybe Integer
a} :: TaskScheduledEventDetails)

-- | The maximum allowed duration of the task.
taskScheduledEventDetails_timeoutInSeconds :: Lens.Lens' TaskScheduledEventDetails (Prelude.Maybe Prelude.Integer)
taskScheduledEventDetails_timeoutInSeconds :: (Maybe Integer -> f (Maybe Integer))
-> TaskScheduledEventDetails -> f TaskScheduledEventDetails
taskScheduledEventDetails_timeoutInSeconds = (TaskScheduledEventDetails -> Maybe Integer)
-> (TaskScheduledEventDetails
    -> Maybe Integer -> TaskScheduledEventDetails)
-> Lens
     TaskScheduledEventDetails
     TaskScheduledEventDetails
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TaskScheduledEventDetails' {Maybe Integer
timeoutInSeconds :: Maybe Integer
$sel:timeoutInSeconds:TaskScheduledEventDetails' :: TaskScheduledEventDetails -> Maybe Integer
timeoutInSeconds} -> Maybe Integer
timeoutInSeconds) (\s :: TaskScheduledEventDetails
s@TaskScheduledEventDetails' {} Maybe Integer
a -> TaskScheduledEventDetails
s {$sel:timeoutInSeconds:TaskScheduledEventDetails' :: Maybe Integer
timeoutInSeconds = Maybe Integer
a} :: TaskScheduledEventDetails)

-- | The action of the resource called by a task state.
taskScheduledEventDetails_resourceType :: Lens.Lens' TaskScheduledEventDetails Prelude.Text
taskScheduledEventDetails_resourceType :: (Text -> f Text)
-> TaskScheduledEventDetails -> f TaskScheduledEventDetails
taskScheduledEventDetails_resourceType = (TaskScheduledEventDetails -> Text)
-> (TaskScheduledEventDetails -> Text -> TaskScheduledEventDetails)
-> Lens
     TaskScheduledEventDetails TaskScheduledEventDetails Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TaskScheduledEventDetails' {Text
resourceType :: Text
$sel:resourceType:TaskScheduledEventDetails' :: TaskScheduledEventDetails -> Text
resourceType} -> Text
resourceType) (\s :: TaskScheduledEventDetails
s@TaskScheduledEventDetails' {} Text
a -> TaskScheduledEventDetails
s {$sel:resourceType:TaskScheduledEventDetails' :: Text
resourceType = Text
a} :: TaskScheduledEventDetails)

-- | The service name of the resource in a task state.
taskScheduledEventDetails_resource :: Lens.Lens' TaskScheduledEventDetails Prelude.Text
taskScheduledEventDetails_resource :: (Text -> f Text)
-> TaskScheduledEventDetails -> f TaskScheduledEventDetails
taskScheduledEventDetails_resource = (TaskScheduledEventDetails -> Text)
-> (TaskScheduledEventDetails -> Text -> TaskScheduledEventDetails)
-> Lens
     TaskScheduledEventDetails TaskScheduledEventDetails Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TaskScheduledEventDetails' {Text
resource :: Text
$sel:resource:TaskScheduledEventDetails' :: TaskScheduledEventDetails -> Text
resource} -> Text
resource) (\s :: TaskScheduledEventDetails
s@TaskScheduledEventDetails' {} Text
a -> TaskScheduledEventDetails
s {$sel:resource:TaskScheduledEventDetails' :: Text
resource = Text
a} :: TaskScheduledEventDetails)

-- | The region of the scheduled task
taskScheduledEventDetails_region :: Lens.Lens' TaskScheduledEventDetails Prelude.Text
taskScheduledEventDetails_region :: (Text -> f Text)
-> TaskScheduledEventDetails -> f TaskScheduledEventDetails
taskScheduledEventDetails_region = (TaskScheduledEventDetails -> Text)
-> (TaskScheduledEventDetails -> Text -> TaskScheduledEventDetails)
-> Lens
     TaskScheduledEventDetails TaskScheduledEventDetails Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TaskScheduledEventDetails' {Text
region :: Text
$sel:region:TaskScheduledEventDetails' :: TaskScheduledEventDetails -> Text
region} -> Text
region) (\s :: TaskScheduledEventDetails
s@TaskScheduledEventDetails' {} Text
a -> TaskScheduledEventDetails
s {$sel:region:TaskScheduledEventDetails' :: Text
region = Text
a} :: TaskScheduledEventDetails)

-- | The JSON data passed to the resource referenced in a task state. Length
-- constraints apply to the payload size, and are expressed as bytes in
-- UTF-8 encoding.
taskScheduledEventDetails_parameters :: Lens.Lens' TaskScheduledEventDetails Prelude.Text
taskScheduledEventDetails_parameters :: (Text -> f Text)
-> TaskScheduledEventDetails -> f TaskScheduledEventDetails
taskScheduledEventDetails_parameters = (TaskScheduledEventDetails -> Sensitive Text)
-> (TaskScheduledEventDetails
    -> Sensitive Text -> TaskScheduledEventDetails)
-> Lens
     TaskScheduledEventDetails
     TaskScheduledEventDetails
     (Sensitive Text)
     (Sensitive Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TaskScheduledEventDetails' {Sensitive Text
parameters :: Sensitive Text
$sel:parameters:TaskScheduledEventDetails' :: TaskScheduledEventDetails -> Sensitive Text
parameters} -> Sensitive Text
parameters) (\s :: TaskScheduledEventDetails
s@TaskScheduledEventDetails' {} Sensitive Text
a -> TaskScheduledEventDetails
s {$sel:parameters:TaskScheduledEventDetails' :: Sensitive Text
parameters = Sensitive Text
a} :: TaskScheduledEventDetails) ((Sensitive Text -> f (Sensitive Text))
 -> TaskScheduledEventDetails -> f TaskScheduledEventDetails)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> TaskScheduledEventDetails
-> f TaskScheduledEventDetails
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> f Text) -> Sensitive Text -> f (Sensitive Text)
forall a. Iso' (Sensitive a) a
Core._Sensitive

instance Core.FromJSON TaskScheduledEventDetails where
  parseJSON :: Value -> Parser TaskScheduledEventDetails
parseJSON =
    String
-> (Object -> Parser TaskScheduledEventDetails)
-> Value
-> Parser TaskScheduledEventDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"TaskScheduledEventDetails"
      ( \Object
x ->
          Maybe Integer
-> Maybe Integer
-> Text
-> Text
-> Text
-> Sensitive Text
-> TaskScheduledEventDetails
TaskScheduledEventDetails'
            (Maybe Integer
 -> Maybe Integer
 -> Text
 -> Text
 -> Text
 -> Sensitive Text
 -> TaskScheduledEventDetails)
-> Parser (Maybe Integer)
-> Parser
     (Maybe Integer
      -> Text
      -> Text
      -> Text
      -> Sensitive Text
      -> TaskScheduledEventDetails)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"heartbeatInSeconds")
            Parser
  (Maybe Integer
   -> Text
   -> Text
   -> Text
   -> Sensitive Text
   -> TaskScheduledEventDetails)
-> Parser (Maybe Integer)
-> Parser
     (Text
      -> Text -> Text -> Sensitive Text -> TaskScheduledEventDetails)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"timeoutInSeconds")
            Parser
  (Text
   -> Text -> Text -> Sensitive Text -> TaskScheduledEventDetails)
-> Parser Text
-> Parser
     (Text -> Text -> Sensitive Text -> TaskScheduledEventDetails)
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
"resourceType")
            Parser
  (Text -> Text -> Sensitive Text -> TaskScheduledEventDetails)
-> Parser Text
-> Parser (Text -> Sensitive Text -> TaskScheduledEventDetails)
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
"resource")
            Parser (Text -> Sensitive Text -> TaskScheduledEventDetails)
-> Parser Text
-> Parser (Sensitive Text -> TaskScheduledEventDetails)
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
"region")
            Parser (Sensitive Text -> TaskScheduledEventDetails)
-> Parser (Sensitive Text) -> Parser TaskScheduledEventDetails
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Sensitive Text)
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"parameters")
      )

instance Prelude.Hashable TaskScheduledEventDetails

instance Prelude.NFData TaskScheduledEventDetails