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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(LambdaFunctionCompletedEventAttributes
 -> LambdaFunctionCompletedEventAttributes -> Bool)
-> (LambdaFunctionCompletedEventAttributes
    -> LambdaFunctionCompletedEventAttributes -> Bool)
-> Eq LambdaFunctionCompletedEventAttributes
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]
(Int -> ReadS LambdaFunctionCompletedEventAttributes)
-> ReadS [LambdaFunctionCompletedEventAttributes]
-> ReadPrec LambdaFunctionCompletedEventAttributes
-> ReadPrec [LambdaFunctionCompletedEventAttributes]
-> Read 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
(Int -> LambdaFunctionCompletedEventAttributes -> ShowS)
-> (LambdaFunctionCompletedEventAttributes -> String)
-> ([LambdaFunctionCompletedEventAttributes] -> ShowS)
-> Show LambdaFunctionCompletedEventAttributes
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.
 LambdaFunctionCompletedEventAttributes
 -> Rep LambdaFunctionCompletedEventAttributes x)
-> (forall x.
    Rep LambdaFunctionCompletedEventAttributes x
    -> LambdaFunctionCompletedEventAttributes)
-> Generic LambdaFunctionCompletedEventAttributes
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' :: Maybe Text
-> Integer -> Integer -> LambdaFunctionCompletedEventAttributes
LambdaFunctionCompletedEventAttributes'
      { $sel:result:LambdaFunctionCompletedEventAttributes' :: Maybe Text
result =
          Maybe Text
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 :: (Maybe Text -> f (Maybe Text))
-> LambdaFunctionCompletedEventAttributes
-> f LambdaFunctionCompletedEventAttributes
lambdaFunctionCompletedEventAttributes_result = (LambdaFunctionCompletedEventAttributes -> Maybe Text)
-> (LambdaFunctionCompletedEventAttributes
    -> Maybe Text -> LambdaFunctionCompletedEventAttributes)
-> Lens
     LambdaFunctionCompletedEventAttributes
     LambdaFunctionCompletedEventAttributes
     (Maybe Text)
     (Maybe Text)
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 :: (Integer -> f Integer)
-> LambdaFunctionCompletedEventAttributes
-> f LambdaFunctionCompletedEventAttributes
lambdaFunctionCompletedEventAttributes_scheduledEventId = (LambdaFunctionCompletedEventAttributes -> Integer)
-> (LambdaFunctionCompletedEventAttributes
    -> Integer -> LambdaFunctionCompletedEventAttributes)
-> Lens
     LambdaFunctionCompletedEventAttributes
     LambdaFunctionCompletedEventAttributes
     Integer
     Integer
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 :: (Integer -> f Integer)
-> LambdaFunctionCompletedEventAttributes
-> f LambdaFunctionCompletedEventAttributes
lambdaFunctionCompletedEventAttributes_startedEventId = (LambdaFunctionCompletedEventAttributes -> Integer)
-> (LambdaFunctionCompletedEventAttributes
    -> Integer -> LambdaFunctionCompletedEventAttributes)
-> Lens
     LambdaFunctionCompletedEventAttributes
     LambdaFunctionCompletedEventAttributes
     Integer
     Integer
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
  Core.FromJSON
    LambdaFunctionCompletedEventAttributes
  where
  parseJSON :: Value -> Parser LambdaFunctionCompletedEventAttributes
parseJSON =
    String
-> (Object -> Parser LambdaFunctionCompletedEventAttributes)
-> Value
-> Parser LambdaFunctionCompletedEventAttributes
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"LambdaFunctionCompletedEventAttributes"
      ( \Object
x ->
          Maybe Text
-> Integer -> Integer -> LambdaFunctionCompletedEventAttributes
LambdaFunctionCompletedEventAttributes'
            (Maybe Text
 -> Integer -> Integer -> LambdaFunctionCompletedEventAttributes)
-> Parser (Maybe Text)
-> Parser
     (Integer -> Integer -> LambdaFunctionCompletedEventAttributes)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"result")
            Parser
  (Integer -> Integer -> LambdaFunctionCompletedEventAttributes)
-> Parser Integer
-> Parser (Integer -> LambdaFunctionCompletedEventAttributes)
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 -> LambdaFunctionCompletedEventAttributes)
-> Parser Integer -> Parser LambdaFunctionCompletedEventAttributes
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
    LambdaFunctionCompletedEventAttributes

instance
  Prelude.NFData
    LambdaFunctionCompletedEventAttributes