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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SWF.Types.ChildPolicy
import Amazonka.SWF.Types.WorkflowExecutionTimeoutType

-- | Provides the details of the @WorkflowExecutionTimedOut@ event.
--
-- /See:/ 'newWorkflowExecutionTimedOutEventAttributes' smart constructor.
data WorkflowExecutionTimedOutEventAttributes = WorkflowExecutionTimedOutEventAttributes'
  { -- | The type of timeout that caused this event.
    WorkflowExecutionTimedOutEventAttributes
-> WorkflowExecutionTimeoutType
timeoutType :: WorkflowExecutionTimeoutType,
    -- | The policy used for the child workflow executions of this workflow
    -- execution.
    --
    -- The supported child policies are:
    --
    -- -   @TERMINATE@ – The child executions are terminated.
    --
    -- -   @REQUEST_CANCEL@ – A request to cancel is attempted for each child
    --     execution by recording a @WorkflowExecutionCancelRequested@ event in
    --     its history. It is up to the decider to take appropriate actions
    --     when it receives an execution history with this event.
    --
    -- -   @ABANDON@ – No action is taken. The child executions continue to
    --     run.
    WorkflowExecutionTimedOutEventAttributes -> ChildPolicy
childPolicy :: ChildPolicy
  }
  deriving (WorkflowExecutionTimedOutEventAttributes
-> WorkflowExecutionTimedOutEventAttributes -> Bool
(WorkflowExecutionTimedOutEventAttributes
 -> WorkflowExecutionTimedOutEventAttributes -> Bool)
-> (WorkflowExecutionTimedOutEventAttributes
    -> WorkflowExecutionTimedOutEventAttributes -> Bool)
-> Eq WorkflowExecutionTimedOutEventAttributes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WorkflowExecutionTimedOutEventAttributes
-> WorkflowExecutionTimedOutEventAttributes -> Bool
$c/= :: WorkflowExecutionTimedOutEventAttributes
-> WorkflowExecutionTimedOutEventAttributes -> Bool
== :: WorkflowExecutionTimedOutEventAttributes
-> WorkflowExecutionTimedOutEventAttributes -> Bool
$c== :: WorkflowExecutionTimedOutEventAttributes
-> WorkflowExecutionTimedOutEventAttributes -> Bool
Prelude.Eq, ReadPrec [WorkflowExecutionTimedOutEventAttributes]
ReadPrec WorkflowExecutionTimedOutEventAttributes
Int -> ReadS WorkflowExecutionTimedOutEventAttributes
ReadS [WorkflowExecutionTimedOutEventAttributes]
(Int -> ReadS WorkflowExecutionTimedOutEventAttributes)
-> ReadS [WorkflowExecutionTimedOutEventAttributes]
-> ReadPrec WorkflowExecutionTimedOutEventAttributes
-> ReadPrec [WorkflowExecutionTimedOutEventAttributes]
-> Read WorkflowExecutionTimedOutEventAttributes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WorkflowExecutionTimedOutEventAttributes]
$creadListPrec :: ReadPrec [WorkflowExecutionTimedOutEventAttributes]
readPrec :: ReadPrec WorkflowExecutionTimedOutEventAttributes
$creadPrec :: ReadPrec WorkflowExecutionTimedOutEventAttributes
readList :: ReadS [WorkflowExecutionTimedOutEventAttributes]
$creadList :: ReadS [WorkflowExecutionTimedOutEventAttributes]
readsPrec :: Int -> ReadS WorkflowExecutionTimedOutEventAttributes
$creadsPrec :: Int -> ReadS WorkflowExecutionTimedOutEventAttributes
Prelude.Read, Int -> WorkflowExecutionTimedOutEventAttributes -> ShowS
[WorkflowExecutionTimedOutEventAttributes] -> ShowS
WorkflowExecutionTimedOutEventAttributes -> String
(Int -> WorkflowExecutionTimedOutEventAttributes -> ShowS)
-> (WorkflowExecutionTimedOutEventAttributes -> String)
-> ([WorkflowExecutionTimedOutEventAttributes] -> ShowS)
-> Show WorkflowExecutionTimedOutEventAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WorkflowExecutionTimedOutEventAttributes] -> ShowS
$cshowList :: [WorkflowExecutionTimedOutEventAttributes] -> ShowS
show :: WorkflowExecutionTimedOutEventAttributes -> String
$cshow :: WorkflowExecutionTimedOutEventAttributes -> String
showsPrec :: Int -> WorkflowExecutionTimedOutEventAttributes -> ShowS
$cshowsPrec :: Int -> WorkflowExecutionTimedOutEventAttributes -> ShowS
Prelude.Show, (forall x.
 WorkflowExecutionTimedOutEventAttributes
 -> Rep WorkflowExecutionTimedOutEventAttributes x)
-> (forall x.
    Rep WorkflowExecutionTimedOutEventAttributes x
    -> WorkflowExecutionTimedOutEventAttributes)
-> Generic WorkflowExecutionTimedOutEventAttributes
forall x.
Rep WorkflowExecutionTimedOutEventAttributes x
-> WorkflowExecutionTimedOutEventAttributes
forall x.
WorkflowExecutionTimedOutEventAttributes
-> Rep WorkflowExecutionTimedOutEventAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep WorkflowExecutionTimedOutEventAttributes x
-> WorkflowExecutionTimedOutEventAttributes
$cfrom :: forall x.
WorkflowExecutionTimedOutEventAttributes
-> Rep WorkflowExecutionTimedOutEventAttributes x
Prelude.Generic)

-- |
-- Create a value of 'WorkflowExecutionTimedOutEventAttributes' 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:
--
-- 'timeoutType', 'workflowExecutionTimedOutEventAttributes_timeoutType' - The type of timeout that caused this event.
--
-- 'childPolicy', 'workflowExecutionTimedOutEventAttributes_childPolicy' - The policy used for the child workflow executions of this workflow
-- execution.
--
-- The supported child policies are:
--
-- -   @TERMINATE@ – The child executions are terminated.
--
-- -   @REQUEST_CANCEL@ – A request to cancel is attempted for each child
--     execution by recording a @WorkflowExecutionCancelRequested@ event in
--     its history. It is up to the decider to take appropriate actions
--     when it receives an execution history with this event.
--
-- -   @ABANDON@ – No action is taken. The child executions continue to
--     run.
newWorkflowExecutionTimedOutEventAttributes ::
  -- | 'timeoutType'
  WorkflowExecutionTimeoutType ->
  -- | 'childPolicy'
  ChildPolicy ->
  WorkflowExecutionTimedOutEventAttributes
newWorkflowExecutionTimedOutEventAttributes :: WorkflowExecutionTimeoutType
-> ChildPolicy -> WorkflowExecutionTimedOutEventAttributes
newWorkflowExecutionTimedOutEventAttributes
  WorkflowExecutionTimeoutType
pTimeoutType_
  ChildPolicy
pChildPolicy_ =
    WorkflowExecutionTimedOutEventAttributes' :: WorkflowExecutionTimeoutType
-> ChildPolicy -> WorkflowExecutionTimedOutEventAttributes
WorkflowExecutionTimedOutEventAttributes'
      { $sel:timeoutType:WorkflowExecutionTimedOutEventAttributes' :: WorkflowExecutionTimeoutType
timeoutType =
          WorkflowExecutionTimeoutType
pTimeoutType_,
        $sel:childPolicy:WorkflowExecutionTimedOutEventAttributes' :: ChildPolicy
childPolicy = ChildPolicy
pChildPolicy_
      }

-- | The type of timeout that caused this event.
workflowExecutionTimedOutEventAttributes_timeoutType :: Lens.Lens' WorkflowExecutionTimedOutEventAttributes WorkflowExecutionTimeoutType
workflowExecutionTimedOutEventAttributes_timeoutType :: (WorkflowExecutionTimeoutType -> f WorkflowExecutionTimeoutType)
-> WorkflowExecutionTimedOutEventAttributes
-> f WorkflowExecutionTimedOutEventAttributes
workflowExecutionTimedOutEventAttributes_timeoutType = (WorkflowExecutionTimedOutEventAttributes
 -> WorkflowExecutionTimeoutType)
-> (WorkflowExecutionTimedOutEventAttributes
    -> WorkflowExecutionTimeoutType
    -> WorkflowExecutionTimedOutEventAttributes)
-> Lens
     WorkflowExecutionTimedOutEventAttributes
     WorkflowExecutionTimedOutEventAttributes
     WorkflowExecutionTimeoutType
     WorkflowExecutionTimeoutType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkflowExecutionTimedOutEventAttributes' {WorkflowExecutionTimeoutType
timeoutType :: WorkflowExecutionTimeoutType
$sel:timeoutType:WorkflowExecutionTimedOutEventAttributes' :: WorkflowExecutionTimedOutEventAttributes
-> WorkflowExecutionTimeoutType
timeoutType} -> WorkflowExecutionTimeoutType
timeoutType) (\s :: WorkflowExecutionTimedOutEventAttributes
s@WorkflowExecutionTimedOutEventAttributes' {} WorkflowExecutionTimeoutType
a -> WorkflowExecutionTimedOutEventAttributes
s {$sel:timeoutType:WorkflowExecutionTimedOutEventAttributes' :: WorkflowExecutionTimeoutType
timeoutType = WorkflowExecutionTimeoutType
a} :: WorkflowExecutionTimedOutEventAttributes)

-- | The policy used for the child workflow executions of this workflow
-- execution.
--
-- The supported child policies are:
--
-- -   @TERMINATE@ – The child executions are terminated.
--
-- -   @REQUEST_CANCEL@ – A request to cancel is attempted for each child
--     execution by recording a @WorkflowExecutionCancelRequested@ event in
--     its history. It is up to the decider to take appropriate actions
--     when it receives an execution history with this event.
--
-- -   @ABANDON@ – No action is taken. The child executions continue to
--     run.
workflowExecutionTimedOutEventAttributes_childPolicy :: Lens.Lens' WorkflowExecutionTimedOutEventAttributes ChildPolicy
workflowExecutionTimedOutEventAttributes_childPolicy :: (ChildPolicy -> f ChildPolicy)
-> WorkflowExecutionTimedOutEventAttributes
-> f WorkflowExecutionTimedOutEventAttributes
workflowExecutionTimedOutEventAttributes_childPolicy = (WorkflowExecutionTimedOutEventAttributes -> ChildPolicy)
-> (WorkflowExecutionTimedOutEventAttributes
    -> ChildPolicy -> WorkflowExecutionTimedOutEventAttributes)
-> Lens
     WorkflowExecutionTimedOutEventAttributes
     WorkflowExecutionTimedOutEventAttributes
     ChildPolicy
     ChildPolicy
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkflowExecutionTimedOutEventAttributes' {ChildPolicy
childPolicy :: ChildPolicy
$sel:childPolicy:WorkflowExecutionTimedOutEventAttributes' :: WorkflowExecutionTimedOutEventAttributes -> ChildPolicy
childPolicy} -> ChildPolicy
childPolicy) (\s :: WorkflowExecutionTimedOutEventAttributes
s@WorkflowExecutionTimedOutEventAttributes' {} ChildPolicy
a -> WorkflowExecutionTimedOutEventAttributes
s {$sel:childPolicy:WorkflowExecutionTimedOutEventAttributes' :: ChildPolicy
childPolicy = ChildPolicy
a} :: WorkflowExecutionTimedOutEventAttributes)

instance
  Core.FromJSON
    WorkflowExecutionTimedOutEventAttributes
  where
  parseJSON :: Value -> Parser WorkflowExecutionTimedOutEventAttributes
parseJSON =
    String
-> (Object -> Parser WorkflowExecutionTimedOutEventAttributes)
-> Value
-> Parser WorkflowExecutionTimedOutEventAttributes
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"WorkflowExecutionTimedOutEventAttributes"
      ( \Object
x ->
          WorkflowExecutionTimeoutType
-> ChildPolicy -> WorkflowExecutionTimedOutEventAttributes
WorkflowExecutionTimedOutEventAttributes'
            (WorkflowExecutionTimeoutType
 -> ChildPolicy -> WorkflowExecutionTimedOutEventAttributes)
-> Parser WorkflowExecutionTimeoutType
-> Parser (ChildPolicy -> WorkflowExecutionTimedOutEventAttributes)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser WorkflowExecutionTimeoutType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"timeoutType")
            Parser (ChildPolicy -> WorkflowExecutionTimedOutEventAttributes)
-> Parser ChildPolicy
-> Parser WorkflowExecutionTimedOutEventAttributes
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser ChildPolicy
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"childPolicy")
      )

instance
  Prelude.Hashable
    WorkflowExecutionTimedOutEventAttributes

instance
  Prelude.NFData
    WorkflowExecutionTimedOutEventAttributes