{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.SWF.Types.WorkflowExecutionTimedOutEventAttributes where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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.
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'
      { $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 :: Lens'
  WorkflowExecutionTimedOutEventAttributes
  WorkflowExecutionTimeoutType
workflowExecutionTimedOutEventAttributes_timeoutType = 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 :: Lens' WorkflowExecutionTimedOutEventAttributes ChildPolicy
workflowExecutionTimedOutEventAttributes_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
  Data.FromJSON
    WorkflowExecutionTimedOutEventAttributes
  where
  parseJSON :: Value -> Parser WorkflowExecutionTimedOutEventAttributes
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"WorkflowExecutionTimedOutEventAttributes"
      ( \Object
x ->
          WorkflowExecutionTimeoutType
-> ChildPolicy -> WorkflowExecutionTimedOutEventAttributes
WorkflowExecutionTimedOutEventAttributes'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"timeoutType")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"childPolicy")
      )

instance
  Prelude.Hashable
    WorkflowExecutionTimedOutEventAttributes
  where
  hashWithSalt :: Int -> WorkflowExecutionTimedOutEventAttributes -> Int
hashWithSalt
    Int
_salt
    WorkflowExecutionTimedOutEventAttributes' {ChildPolicy
WorkflowExecutionTimeoutType
childPolicy :: ChildPolicy
timeoutType :: WorkflowExecutionTimeoutType
$sel:childPolicy:WorkflowExecutionTimedOutEventAttributes' :: WorkflowExecutionTimedOutEventAttributes -> ChildPolicy
$sel:timeoutType:WorkflowExecutionTimedOutEventAttributes' :: WorkflowExecutionTimedOutEventAttributes
-> WorkflowExecutionTimeoutType
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` WorkflowExecutionTimeoutType
timeoutType
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ChildPolicy
childPolicy

instance
  Prelude.NFData
    WorkflowExecutionTimedOutEventAttributes
  where
  rnf :: WorkflowExecutionTimedOutEventAttributes -> ()
rnf WorkflowExecutionTimedOutEventAttributes' {ChildPolicy
WorkflowExecutionTimeoutType
childPolicy :: ChildPolicy
timeoutType :: WorkflowExecutionTimeoutType
$sel:childPolicy:WorkflowExecutionTimedOutEventAttributes' :: WorkflowExecutionTimedOutEventAttributes -> ChildPolicy
$sel:timeoutType:WorkflowExecutionTimedOutEventAttributes' :: WorkflowExecutionTimedOutEventAttributes
-> WorkflowExecutionTimeoutType
..} =
    forall a. NFData a => a -> ()
Prelude.rnf WorkflowExecutionTimeoutType
timeoutType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ChildPolicy
childPolicy