{-# 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.LambdaFunctionCompletedEventAttributes
-- 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.LambdaFunctionCompletedEventAttributes 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

-- | Provides the details of the @LambdaFunctionCompleted@ event. It isn\'t
-- set for other event types.
--
-- /See:/ 'newLambdaFunctionCompletedEventAttributes' smart constructor.
data LambdaFunctionCompletedEventAttributes = LambdaFunctionCompletedEventAttributes'
  { -- | The results of the Lambda task.
    LambdaFunctionCompletedEventAttributes -> Maybe Text
result :: Prelude.Maybe Prelude.Text,
    -- | The ID of the @LambdaFunctionScheduled@ event that was recorded when
    -- this Lambda task was scheduled. To help diagnose issues, use this
    -- information to trace back the chain of events leading up to this event.
    LambdaFunctionCompletedEventAttributes -> Integer
scheduledEventId :: Prelude.Integer,
    -- | The ID of the @LambdaFunctionStarted@ event 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.
    LambdaFunctionCompletedEventAttributes -> Integer
startedEventId :: Prelude.Integer
  }
  deriving (LambdaFunctionCompletedEventAttributes
-> LambdaFunctionCompletedEventAttributes -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LambdaFunctionCompletedEventAttributes
-> LambdaFunctionCompletedEventAttributes -> Bool
$c/= :: LambdaFunctionCompletedEventAttributes
-> LambdaFunctionCompletedEventAttributes -> Bool
== :: LambdaFunctionCompletedEventAttributes
-> LambdaFunctionCompletedEventAttributes -> Bool
$c== :: LambdaFunctionCompletedEventAttributes
-> LambdaFunctionCompletedEventAttributes -> Bool
Prelude.Eq, ReadPrec [LambdaFunctionCompletedEventAttributes]
ReadPrec LambdaFunctionCompletedEventAttributes
Int -> ReadS LambdaFunctionCompletedEventAttributes
ReadS [LambdaFunctionCompletedEventAttributes]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LambdaFunctionCompletedEventAttributes]
$creadListPrec :: ReadPrec [LambdaFunctionCompletedEventAttributes]
readPrec :: ReadPrec LambdaFunctionCompletedEventAttributes
$creadPrec :: ReadPrec LambdaFunctionCompletedEventAttributes
readList :: ReadS [LambdaFunctionCompletedEventAttributes]
$creadList :: ReadS [LambdaFunctionCompletedEventAttributes]
readsPrec :: Int -> ReadS LambdaFunctionCompletedEventAttributes
$creadsPrec :: Int -> ReadS LambdaFunctionCompletedEventAttributes
Prelude.Read, Int -> LambdaFunctionCompletedEventAttributes -> ShowS
[LambdaFunctionCompletedEventAttributes] -> ShowS
LambdaFunctionCompletedEventAttributes -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LambdaFunctionCompletedEventAttributes] -> ShowS
$cshowList :: [LambdaFunctionCompletedEventAttributes] -> ShowS
show :: LambdaFunctionCompletedEventAttributes -> String
$cshow :: LambdaFunctionCompletedEventAttributes -> String
showsPrec :: Int -> LambdaFunctionCompletedEventAttributes -> ShowS
$cshowsPrec :: Int -> LambdaFunctionCompletedEventAttributes -> ShowS
Prelude.Show, forall x.
Rep LambdaFunctionCompletedEventAttributes x
-> LambdaFunctionCompletedEventAttributes
forall x.
LambdaFunctionCompletedEventAttributes
-> Rep LambdaFunctionCompletedEventAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep LambdaFunctionCompletedEventAttributes x
-> LambdaFunctionCompletedEventAttributes
$cfrom :: forall x.
LambdaFunctionCompletedEventAttributes
-> Rep LambdaFunctionCompletedEventAttributes x
Prelude.Generic)

-- |
-- Create a value of 'LambdaFunctionCompletedEventAttributes' 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:
--
-- 'result', 'lambdaFunctionCompletedEventAttributes_result' - The results of the Lambda task.
--
-- 'scheduledEventId', 'lambdaFunctionCompletedEventAttributes_scheduledEventId' - The ID of the @LambdaFunctionScheduled@ event that was recorded when
-- this Lambda task was scheduled. To help diagnose issues, use this
-- information to trace back the chain of events leading up to this event.
--
-- 'startedEventId', 'lambdaFunctionCompletedEventAttributes_startedEventId' - The ID of the @LambdaFunctionStarted@ event 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.
newLambdaFunctionCompletedEventAttributes ::
  -- | 'scheduledEventId'
  Prelude.Integer ->
  -- | 'startedEventId'
  Prelude.Integer ->
  LambdaFunctionCompletedEventAttributes
newLambdaFunctionCompletedEventAttributes :: Integer -> Integer -> LambdaFunctionCompletedEventAttributes
newLambdaFunctionCompletedEventAttributes
  Integer
pScheduledEventId_
  Integer
pStartedEventId_ =
    LambdaFunctionCompletedEventAttributes'
      { $sel:result:LambdaFunctionCompletedEventAttributes' :: Maybe Text
result =
          forall a. Maybe a
Prelude.Nothing,
        $sel:scheduledEventId:LambdaFunctionCompletedEventAttributes' :: Integer
scheduledEventId =
          Integer
pScheduledEventId_,
        $sel:startedEventId:LambdaFunctionCompletedEventAttributes' :: Integer
startedEventId = Integer
pStartedEventId_
      }

-- | The results of the Lambda task.
lambdaFunctionCompletedEventAttributes_result :: Lens.Lens' LambdaFunctionCompletedEventAttributes (Prelude.Maybe Prelude.Text)
lambdaFunctionCompletedEventAttributes_result :: Lens' LambdaFunctionCompletedEventAttributes (Maybe Text)
lambdaFunctionCompletedEventAttributes_result = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LambdaFunctionCompletedEventAttributes' {Maybe Text
result :: Maybe Text
$sel:result:LambdaFunctionCompletedEventAttributes' :: LambdaFunctionCompletedEventAttributes -> Maybe Text
result} -> Maybe Text
result) (\s :: LambdaFunctionCompletedEventAttributes
s@LambdaFunctionCompletedEventAttributes' {} Maybe Text
a -> LambdaFunctionCompletedEventAttributes
s {$sel:result:LambdaFunctionCompletedEventAttributes' :: Maybe Text
result = Maybe Text
a} :: LambdaFunctionCompletedEventAttributes)

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

-- | The ID of the @LambdaFunctionStarted@ event 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.
lambdaFunctionCompletedEventAttributes_startedEventId :: Lens.Lens' LambdaFunctionCompletedEventAttributes Prelude.Integer
lambdaFunctionCompletedEventAttributes_startedEventId :: Lens' LambdaFunctionCompletedEventAttributes Integer
lambdaFunctionCompletedEventAttributes_startedEventId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LambdaFunctionCompletedEventAttributes' {Integer
startedEventId :: Integer
$sel:startedEventId:LambdaFunctionCompletedEventAttributes' :: LambdaFunctionCompletedEventAttributes -> Integer
startedEventId} -> Integer
startedEventId) (\s :: LambdaFunctionCompletedEventAttributes
s@LambdaFunctionCompletedEventAttributes' {} Integer
a -> LambdaFunctionCompletedEventAttributes
s {$sel:startedEventId:LambdaFunctionCompletedEventAttributes' :: Integer
startedEventId = Integer
a} :: LambdaFunctionCompletedEventAttributes)

instance
  Data.FromJSON
    LambdaFunctionCompletedEventAttributes
  where
  parseJSON :: Value -> Parser LambdaFunctionCompletedEventAttributes
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"LambdaFunctionCompletedEventAttributes"
      ( \Object
x ->
          Maybe Text
-> Integer -> Integer -> LambdaFunctionCompletedEventAttributes
LambdaFunctionCompletedEventAttributes'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"result")
            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
"scheduledEventId")
            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
"startedEventId")
      )

instance
  Prelude.Hashable
    LambdaFunctionCompletedEventAttributes
  where
  hashWithSalt :: Int -> LambdaFunctionCompletedEventAttributes -> Int
hashWithSalt
    Int
_salt
    LambdaFunctionCompletedEventAttributes' {Integer
Maybe Text
startedEventId :: Integer
scheduledEventId :: Integer
result :: Maybe Text
$sel:startedEventId:LambdaFunctionCompletedEventAttributes' :: LambdaFunctionCompletedEventAttributes -> Integer
$sel:scheduledEventId:LambdaFunctionCompletedEventAttributes' :: LambdaFunctionCompletedEventAttributes -> Integer
$sel:result:LambdaFunctionCompletedEventAttributes' :: LambdaFunctionCompletedEventAttributes -> Maybe Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
result
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Integer
scheduledEventId
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Integer
startedEventId

instance
  Prelude.NFData
    LambdaFunctionCompletedEventAttributes
  where
  rnf :: LambdaFunctionCompletedEventAttributes -> ()
rnf LambdaFunctionCompletedEventAttributes' {Integer
Maybe Text
startedEventId :: Integer
scheduledEventId :: Integer
result :: Maybe Text
$sel:startedEventId:LambdaFunctionCompletedEventAttributes' :: LambdaFunctionCompletedEventAttributes -> Integer
$sel:scheduledEventId:LambdaFunctionCompletedEventAttributes' :: LambdaFunctionCompletedEventAttributes -> Integer
$sel:result:LambdaFunctionCompletedEventAttributes' :: LambdaFunctionCompletedEventAttributes -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
result
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Integer
scheduledEventId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Integer
startedEventId