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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SWF.Types.LambdaFunctionTimeoutType

-- | Provides details of the @LambdaFunctionTimedOut@ event.
--
-- /See:/ 'newLambdaFunctionTimedOutEventAttributes' smart constructor.
data LambdaFunctionTimedOutEventAttributes = LambdaFunctionTimedOutEventAttributes'
  { -- | The type of the timeout that caused this event.
    LambdaFunctionTimedOutEventAttributes
-> Maybe LambdaFunctionTimeoutType
timeoutType :: Prelude.Maybe LambdaFunctionTimeoutType,
    -- | The ID of the @LambdaFunctionScheduled@ event that was recorded when
    -- this activity task was scheduled. To help diagnose issues, use this
    -- information to trace back the chain of events leading up to this event.
    LambdaFunctionTimedOutEventAttributes -> Integer
scheduledEventId :: Prelude.Integer,
    -- | The ID of the @ActivityTaskStarted@ event that was recorded when this
    -- activity task started. To help diagnose issues, use this information to
    -- trace back the chain of events leading up to this event.
    LambdaFunctionTimedOutEventAttributes -> Integer
startedEventId :: Prelude.Integer
  }
  deriving (LambdaFunctionTimedOutEventAttributes
-> LambdaFunctionTimedOutEventAttributes -> Bool
(LambdaFunctionTimedOutEventAttributes
 -> LambdaFunctionTimedOutEventAttributes -> Bool)
-> (LambdaFunctionTimedOutEventAttributes
    -> LambdaFunctionTimedOutEventAttributes -> Bool)
-> Eq LambdaFunctionTimedOutEventAttributes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LambdaFunctionTimedOutEventAttributes
-> LambdaFunctionTimedOutEventAttributes -> Bool
$c/= :: LambdaFunctionTimedOutEventAttributes
-> LambdaFunctionTimedOutEventAttributes -> Bool
== :: LambdaFunctionTimedOutEventAttributes
-> LambdaFunctionTimedOutEventAttributes -> Bool
$c== :: LambdaFunctionTimedOutEventAttributes
-> LambdaFunctionTimedOutEventAttributes -> Bool
Prelude.Eq, ReadPrec [LambdaFunctionTimedOutEventAttributes]
ReadPrec LambdaFunctionTimedOutEventAttributes
Int -> ReadS LambdaFunctionTimedOutEventAttributes
ReadS [LambdaFunctionTimedOutEventAttributes]
(Int -> ReadS LambdaFunctionTimedOutEventAttributes)
-> ReadS [LambdaFunctionTimedOutEventAttributes]
-> ReadPrec LambdaFunctionTimedOutEventAttributes
-> ReadPrec [LambdaFunctionTimedOutEventAttributes]
-> Read LambdaFunctionTimedOutEventAttributes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LambdaFunctionTimedOutEventAttributes]
$creadListPrec :: ReadPrec [LambdaFunctionTimedOutEventAttributes]
readPrec :: ReadPrec LambdaFunctionTimedOutEventAttributes
$creadPrec :: ReadPrec LambdaFunctionTimedOutEventAttributes
readList :: ReadS [LambdaFunctionTimedOutEventAttributes]
$creadList :: ReadS [LambdaFunctionTimedOutEventAttributes]
readsPrec :: Int -> ReadS LambdaFunctionTimedOutEventAttributes
$creadsPrec :: Int -> ReadS LambdaFunctionTimedOutEventAttributes
Prelude.Read, Int -> LambdaFunctionTimedOutEventAttributes -> ShowS
[LambdaFunctionTimedOutEventAttributes] -> ShowS
LambdaFunctionTimedOutEventAttributes -> String
(Int -> LambdaFunctionTimedOutEventAttributes -> ShowS)
-> (LambdaFunctionTimedOutEventAttributes -> String)
-> ([LambdaFunctionTimedOutEventAttributes] -> ShowS)
-> Show LambdaFunctionTimedOutEventAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LambdaFunctionTimedOutEventAttributes] -> ShowS
$cshowList :: [LambdaFunctionTimedOutEventAttributes] -> ShowS
show :: LambdaFunctionTimedOutEventAttributes -> String
$cshow :: LambdaFunctionTimedOutEventAttributes -> String
showsPrec :: Int -> LambdaFunctionTimedOutEventAttributes -> ShowS
$cshowsPrec :: Int -> LambdaFunctionTimedOutEventAttributes -> ShowS
Prelude.Show, (forall x.
 LambdaFunctionTimedOutEventAttributes
 -> Rep LambdaFunctionTimedOutEventAttributes x)
-> (forall x.
    Rep LambdaFunctionTimedOutEventAttributes x
    -> LambdaFunctionTimedOutEventAttributes)
-> Generic LambdaFunctionTimedOutEventAttributes
forall x.
Rep LambdaFunctionTimedOutEventAttributes x
-> LambdaFunctionTimedOutEventAttributes
forall x.
LambdaFunctionTimedOutEventAttributes
-> Rep LambdaFunctionTimedOutEventAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep LambdaFunctionTimedOutEventAttributes x
-> LambdaFunctionTimedOutEventAttributes
$cfrom :: forall x.
LambdaFunctionTimedOutEventAttributes
-> Rep LambdaFunctionTimedOutEventAttributes x
Prelude.Generic)

-- |
-- Create a value of 'LambdaFunctionTimedOutEventAttributes' 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', 'lambdaFunctionTimedOutEventAttributes_timeoutType' - The type of the timeout that caused this event.
--
-- 'scheduledEventId', 'lambdaFunctionTimedOutEventAttributes_scheduledEventId' - The ID of the @LambdaFunctionScheduled@ event that was recorded when
-- this activity task was scheduled. To help diagnose issues, use this
-- information to trace back the chain of events leading up to this event.
--
-- 'startedEventId', 'lambdaFunctionTimedOutEventAttributes_startedEventId' - The ID of the @ActivityTaskStarted@ event that was recorded when this
-- activity task started. To help diagnose issues, use this information to
-- trace back the chain of events leading up to this event.
newLambdaFunctionTimedOutEventAttributes ::
  -- | 'scheduledEventId'
  Prelude.Integer ->
  -- | 'startedEventId'
  Prelude.Integer ->
  LambdaFunctionTimedOutEventAttributes
newLambdaFunctionTimedOutEventAttributes :: Integer -> Integer -> LambdaFunctionTimedOutEventAttributes
newLambdaFunctionTimedOutEventAttributes
  Integer
pScheduledEventId_
  Integer
pStartedEventId_ =
    LambdaFunctionTimedOutEventAttributes' :: Maybe LambdaFunctionTimeoutType
-> Integer -> Integer -> LambdaFunctionTimedOutEventAttributes
LambdaFunctionTimedOutEventAttributes'
      { $sel:timeoutType:LambdaFunctionTimedOutEventAttributes' :: Maybe LambdaFunctionTimeoutType
timeoutType =
          Maybe LambdaFunctionTimeoutType
forall a. Maybe a
Prelude.Nothing,
        $sel:scheduledEventId:LambdaFunctionTimedOutEventAttributes' :: Integer
scheduledEventId =
          Integer
pScheduledEventId_,
        $sel:startedEventId:LambdaFunctionTimedOutEventAttributes' :: Integer
startedEventId = Integer
pStartedEventId_
      }

-- | The type of the timeout that caused this event.
lambdaFunctionTimedOutEventAttributes_timeoutType :: Lens.Lens' LambdaFunctionTimedOutEventAttributes (Prelude.Maybe LambdaFunctionTimeoutType)
lambdaFunctionTimedOutEventAttributes_timeoutType :: (Maybe LambdaFunctionTimeoutType
 -> f (Maybe LambdaFunctionTimeoutType))
-> LambdaFunctionTimedOutEventAttributes
-> f LambdaFunctionTimedOutEventAttributes
lambdaFunctionTimedOutEventAttributes_timeoutType = (LambdaFunctionTimedOutEventAttributes
 -> Maybe LambdaFunctionTimeoutType)
-> (LambdaFunctionTimedOutEventAttributes
    -> Maybe LambdaFunctionTimeoutType
    -> LambdaFunctionTimedOutEventAttributes)
-> Lens
     LambdaFunctionTimedOutEventAttributes
     LambdaFunctionTimedOutEventAttributes
     (Maybe LambdaFunctionTimeoutType)
     (Maybe LambdaFunctionTimeoutType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LambdaFunctionTimedOutEventAttributes' {Maybe LambdaFunctionTimeoutType
timeoutType :: Maybe LambdaFunctionTimeoutType
$sel:timeoutType:LambdaFunctionTimedOutEventAttributes' :: LambdaFunctionTimedOutEventAttributes
-> Maybe LambdaFunctionTimeoutType
timeoutType} -> Maybe LambdaFunctionTimeoutType
timeoutType) (\s :: LambdaFunctionTimedOutEventAttributes
s@LambdaFunctionTimedOutEventAttributes' {} Maybe LambdaFunctionTimeoutType
a -> LambdaFunctionTimedOutEventAttributes
s {$sel:timeoutType:LambdaFunctionTimedOutEventAttributes' :: Maybe LambdaFunctionTimeoutType
timeoutType = Maybe LambdaFunctionTimeoutType
a} :: LambdaFunctionTimedOutEventAttributes)

-- | The ID of the @LambdaFunctionScheduled@ event that was recorded when
-- this activity task was scheduled. To help diagnose issues, use this
-- information to trace back the chain of events leading up to this event.
lambdaFunctionTimedOutEventAttributes_scheduledEventId :: Lens.Lens' LambdaFunctionTimedOutEventAttributes Prelude.Integer
lambdaFunctionTimedOutEventAttributes_scheduledEventId :: (Integer -> f Integer)
-> LambdaFunctionTimedOutEventAttributes
-> f LambdaFunctionTimedOutEventAttributes
lambdaFunctionTimedOutEventAttributes_scheduledEventId = (LambdaFunctionTimedOutEventAttributes -> Integer)
-> (LambdaFunctionTimedOutEventAttributes
    -> Integer -> LambdaFunctionTimedOutEventAttributes)
-> Lens
     LambdaFunctionTimedOutEventAttributes
     LambdaFunctionTimedOutEventAttributes
     Integer
     Integer
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LambdaFunctionTimedOutEventAttributes' {Integer
scheduledEventId :: Integer
$sel:scheduledEventId:LambdaFunctionTimedOutEventAttributes' :: LambdaFunctionTimedOutEventAttributes -> Integer
scheduledEventId} -> Integer
scheduledEventId) (\s :: LambdaFunctionTimedOutEventAttributes
s@LambdaFunctionTimedOutEventAttributes' {} Integer
a -> LambdaFunctionTimedOutEventAttributes
s {$sel:scheduledEventId:LambdaFunctionTimedOutEventAttributes' :: Integer
scheduledEventId = Integer
a} :: LambdaFunctionTimedOutEventAttributes)

-- | The ID of the @ActivityTaskStarted@ event that was recorded when this
-- activity task started. To help diagnose issues, use this information to
-- trace back the chain of events leading up to this event.
lambdaFunctionTimedOutEventAttributes_startedEventId :: Lens.Lens' LambdaFunctionTimedOutEventAttributes Prelude.Integer
lambdaFunctionTimedOutEventAttributes_startedEventId :: (Integer -> f Integer)
-> LambdaFunctionTimedOutEventAttributes
-> f LambdaFunctionTimedOutEventAttributes
lambdaFunctionTimedOutEventAttributes_startedEventId = (LambdaFunctionTimedOutEventAttributes -> Integer)
-> (LambdaFunctionTimedOutEventAttributes
    -> Integer -> LambdaFunctionTimedOutEventAttributes)
-> Lens
     LambdaFunctionTimedOutEventAttributes
     LambdaFunctionTimedOutEventAttributes
     Integer
     Integer
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LambdaFunctionTimedOutEventAttributes' {Integer
startedEventId :: Integer
$sel:startedEventId:LambdaFunctionTimedOutEventAttributes' :: LambdaFunctionTimedOutEventAttributes -> Integer
startedEventId} -> Integer
startedEventId) (\s :: LambdaFunctionTimedOutEventAttributes
s@LambdaFunctionTimedOutEventAttributes' {} Integer
a -> LambdaFunctionTimedOutEventAttributes
s {$sel:startedEventId:LambdaFunctionTimedOutEventAttributes' :: Integer
startedEventId = Integer
a} :: LambdaFunctionTimedOutEventAttributes)

instance
  Core.FromJSON
    LambdaFunctionTimedOutEventAttributes
  where
  parseJSON :: Value -> Parser LambdaFunctionTimedOutEventAttributes
parseJSON =
    String
-> (Object -> Parser LambdaFunctionTimedOutEventAttributes)
-> Value
-> Parser LambdaFunctionTimedOutEventAttributes
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"LambdaFunctionTimedOutEventAttributes"
      ( \Object
x ->
          Maybe LambdaFunctionTimeoutType
-> Integer -> Integer -> LambdaFunctionTimedOutEventAttributes
LambdaFunctionTimedOutEventAttributes'
            (Maybe LambdaFunctionTimeoutType
 -> Integer -> Integer -> LambdaFunctionTimedOutEventAttributes)
-> Parser (Maybe LambdaFunctionTimeoutType)
-> Parser
     (Integer -> Integer -> LambdaFunctionTimedOutEventAttributes)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe LambdaFunctionTimeoutType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"timeoutType")
            Parser
  (Integer -> Integer -> LambdaFunctionTimedOutEventAttributes)
-> Parser Integer
-> Parser (Integer -> LambdaFunctionTimedOutEventAttributes)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Integer
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"scheduledEventId")
            Parser (Integer -> LambdaFunctionTimedOutEventAttributes)
-> Parser Integer -> Parser LambdaFunctionTimedOutEventAttributes
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Integer
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"startedEventId")
      )

instance
  Prelude.Hashable
    LambdaFunctionTimedOutEventAttributes

instance
  Prelude.NFData
    LambdaFunctionTimedOutEventAttributes