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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Provides the details of the @ActivityTaskFailed@ event.
--
-- /See:/ 'newActivityTaskFailedEventAttributes' smart constructor.
data ActivityTaskFailedEventAttributes = ActivityTaskFailedEventAttributes'
  { -- | The reason provided for the failure.
    ActivityTaskFailedEventAttributes -> Maybe Text
reason :: Prelude.Maybe Prelude.Text,
    -- | The details of the failure.
    ActivityTaskFailedEventAttributes -> Maybe Text
details :: Prelude.Maybe Prelude.Text,
    -- | The ID of the @ActivityTaskScheduled@ event that was recorded when this
    -- activity task was scheduled. This information can be useful for
    -- diagnosing problems by tracing back the chain of events leading up to
    -- this event.
    ActivityTaskFailedEventAttributes -> Integer
scheduledEventId :: Prelude.Integer,
    -- | The ID of the @ActivityTaskStarted@ event recorded when this activity
    -- task was started. This information can be useful for diagnosing problems
    -- by tracing back the chain of events leading up to this event.
    ActivityTaskFailedEventAttributes -> Integer
startedEventId :: Prelude.Integer
  }
  deriving (ActivityTaskFailedEventAttributes
-> ActivityTaskFailedEventAttributes -> Bool
(ActivityTaskFailedEventAttributes
 -> ActivityTaskFailedEventAttributes -> Bool)
-> (ActivityTaskFailedEventAttributes
    -> ActivityTaskFailedEventAttributes -> Bool)
-> Eq ActivityTaskFailedEventAttributes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ActivityTaskFailedEventAttributes
-> ActivityTaskFailedEventAttributes -> Bool
$c/= :: ActivityTaskFailedEventAttributes
-> ActivityTaskFailedEventAttributes -> Bool
== :: ActivityTaskFailedEventAttributes
-> ActivityTaskFailedEventAttributes -> Bool
$c== :: ActivityTaskFailedEventAttributes
-> ActivityTaskFailedEventAttributes -> Bool
Prelude.Eq, ReadPrec [ActivityTaskFailedEventAttributes]
ReadPrec ActivityTaskFailedEventAttributes
Int -> ReadS ActivityTaskFailedEventAttributes
ReadS [ActivityTaskFailedEventAttributes]
(Int -> ReadS ActivityTaskFailedEventAttributes)
-> ReadS [ActivityTaskFailedEventAttributes]
-> ReadPrec ActivityTaskFailedEventAttributes
-> ReadPrec [ActivityTaskFailedEventAttributes]
-> Read ActivityTaskFailedEventAttributes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ActivityTaskFailedEventAttributes]
$creadListPrec :: ReadPrec [ActivityTaskFailedEventAttributes]
readPrec :: ReadPrec ActivityTaskFailedEventAttributes
$creadPrec :: ReadPrec ActivityTaskFailedEventAttributes
readList :: ReadS [ActivityTaskFailedEventAttributes]
$creadList :: ReadS [ActivityTaskFailedEventAttributes]
readsPrec :: Int -> ReadS ActivityTaskFailedEventAttributes
$creadsPrec :: Int -> ReadS ActivityTaskFailedEventAttributes
Prelude.Read, Int -> ActivityTaskFailedEventAttributes -> ShowS
[ActivityTaskFailedEventAttributes] -> ShowS
ActivityTaskFailedEventAttributes -> String
(Int -> ActivityTaskFailedEventAttributes -> ShowS)
-> (ActivityTaskFailedEventAttributes -> String)
-> ([ActivityTaskFailedEventAttributes] -> ShowS)
-> Show ActivityTaskFailedEventAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ActivityTaskFailedEventAttributes] -> ShowS
$cshowList :: [ActivityTaskFailedEventAttributes] -> ShowS
show :: ActivityTaskFailedEventAttributes -> String
$cshow :: ActivityTaskFailedEventAttributes -> String
showsPrec :: Int -> ActivityTaskFailedEventAttributes -> ShowS
$cshowsPrec :: Int -> ActivityTaskFailedEventAttributes -> ShowS
Prelude.Show, (forall x.
 ActivityTaskFailedEventAttributes
 -> Rep ActivityTaskFailedEventAttributes x)
-> (forall x.
    Rep ActivityTaskFailedEventAttributes x
    -> ActivityTaskFailedEventAttributes)
-> Generic ActivityTaskFailedEventAttributes
forall x.
Rep ActivityTaskFailedEventAttributes x
-> ActivityTaskFailedEventAttributes
forall x.
ActivityTaskFailedEventAttributes
-> Rep ActivityTaskFailedEventAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ActivityTaskFailedEventAttributes x
-> ActivityTaskFailedEventAttributes
$cfrom :: forall x.
ActivityTaskFailedEventAttributes
-> Rep ActivityTaskFailedEventAttributes x
Prelude.Generic)

-- |
-- Create a value of 'ActivityTaskFailedEventAttributes' 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:
--
-- 'reason', 'activityTaskFailedEventAttributes_reason' - The reason provided for the failure.
--
-- 'details', 'activityTaskFailedEventAttributes_details' - The details of the failure.
--
-- 'scheduledEventId', 'activityTaskFailedEventAttributes_scheduledEventId' - The ID of the @ActivityTaskScheduled@ event that was recorded when this
-- activity task was scheduled. This information can be useful for
-- diagnosing problems by tracing back the chain of events leading up to
-- this event.
--
-- 'startedEventId', 'activityTaskFailedEventAttributes_startedEventId' - The ID of the @ActivityTaskStarted@ event recorded when this activity
-- task was started. This information can be useful for diagnosing problems
-- by tracing back the chain of events leading up to this event.
newActivityTaskFailedEventAttributes ::
  -- | 'scheduledEventId'
  Prelude.Integer ->
  -- | 'startedEventId'
  Prelude.Integer ->
  ActivityTaskFailedEventAttributes
newActivityTaskFailedEventAttributes :: Integer -> Integer -> ActivityTaskFailedEventAttributes
newActivityTaskFailedEventAttributes
  Integer
pScheduledEventId_
  Integer
pStartedEventId_ =
    ActivityTaskFailedEventAttributes' :: Maybe Text
-> Maybe Text
-> Integer
-> Integer
-> ActivityTaskFailedEventAttributes
ActivityTaskFailedEventAttributes'
      { $sel:reason:ActivityTaskFailedEventAttributes' :: Maybe Text
reason =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:details:ActivityTaskFailedEventAttributes' :: Maybe Text
details = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:scheduledEventId:ActivityTaskFailedEventAttributes' :: Integer
scheduledEventId = Integer
pScheduledEventId_,
        $sel:startedEventId:ActivityTaskFailedEventAttributes' :: Integer
startedEventId = Integer
pStartedEventId_
      }

-- | The reason provided for the failure.
activityTaskFailedEventAttributes_reason :: Lens.Lens' ActivityTaskFailedEventAttributes (Prelude.Maybe Prelude.Text)
activityTaskFailedEventAttributes_reason :: (Maybe Text -> f (Maybe Text))
-> ActivityTaskFailedEventAttributes
-> f ActivityTaskFailedEventAttributes
activityTaskFailedEventAttributes_reason = (ActivityTaskFailedEventAttributes -> Maybe Text)
-> (ActivityTaskFailedEventAttributes
    -> Maybe Text -> ActivityTaskFailedEventAttributes)
-> Lens
     ActivityTaskFailedEventAttributes
     ActivityTaskFailedEventAttributes
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActivityTaskFailedEventAttributes' {Maybe Text
reason :: Maybe Text
$sel:reason:ActivityTaskFailedEventAttributes' :: ActivityTaskFailedEventAttributes -> Maybe Text
reason} -> Maybe Text
reason) (\s :: ActivityTaskFailedEventAttributes
s@ActivityTaskFailedEventAttributes' {} Maybe Text
a -> ActivityTaskFailedEventAttributes
s {$sel:reason:ActivityTaskFailedEventAttributes' :: Maybe Text
reason = Maybe Text
a} :: ActivityTaskFailedEventAttributes)

-- | The details of the failure.
activityTaskFailedEventAttributes_details :: Lens.Lens' ActivityTaskFailedEventAttributes (Prelude.Maybe Prelude.Text)
activityTaskFailedEventAttributes_details :: (Maybe Text -> f (Maybe Text))
-> ActivityTaskFailedEventAttributes
-> f ActivityTaskFailedEventAttributes
activityTaskFailedEventAttributes_details = (ActivityTaskFailedEventAttributes -> Maybe Text)
-> (ActivityTaskFailedEventAttributes
    -> Maybe Text -> ActivityTaskFailedEventAttributes)
-> Lens
     ActivityTaskFailedEventAttributes
     ActivityTaskFailedEventAttributes
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActivityTaskFailedEventAttributes' {Maybe Text
details :: Maybe Text
$sel:details:ActivityTaskFailedEventAttributes' :: ActivityTaskFailedEventAttributes -> Maybe Text
details} -> Maybe Text
details) (\s :: ActivityTaskFailedEventAttributes
s@ActivityTaskFailedEventAttributes' {} Maybe Text
a -> ActivityTaskFailedEventAttributes
s {$sel:details:ActivityTaskFailedEventAttributes' :: Maybe Text
details = Maybe Text
a} :: ActivityTaskFailedEventAttributes)

-- | The ID of the @ActivityTaskScheduled@ event that was recorded when this
-- activity task was scheduled. This information can be useful for
-- diagnosing problems by tracing back the chain of events leading up to
-- this event.
activityTaskFailedEventAttributes_scheduledEventId :: Lens.Lens' ActivityTaskFailedEventAttributes Prelude.Integer
activityTaskFailedEventAttributes_scheduledEventId :: (Integer -> f Integer)
-> ActivityTaskFailedEventAttributes
-> f ActivityTaskFailedEventAttributes
activityTaskFailedEventAttributes_scheduledEventId = (ActivityTaskFailedEventAttributes -> Integer)
-> (ActivityTaskFailedEventAttributes
    -> Integer -> ActivityTaskFailedEventAttributes)
-> Lens
     ActivityTaskFailedEventAttributes
     ActivityTaskFailedEventAttributes
     Integer
     Integer
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActivityTaskFailedEventAttributes' {Integer
scheduledEventId :: Integer
$sel:scheduledEventId:ActivityTaskFailedEventAttributes' :: ActivityTaskFailedEventAttributes -> Integer
scheduledEventId} -> Integer
scheduledEventId) (\s :: ActivityTaskFailedEventAttributes
s@ActivityTaskFailedEventAttributes' {} Integer
a -> ActivityTaskFailedEventAttributes
s {$sel:scheduledEventId:ActivityTaskFailedEventAttributes' :: Integer
scheduledEventId = Integer
a} :: ActivityTaskFailedEventAttributes)

-- | The ID of the @ActivityTaskStarted@ event recorded when this activity
-- task was started. This information can be useful for diagnosing problems
-- by tracing back the chain of events leading up to this event.
activityTaskFailedEventAttributes_startedEventId :: Lens.Lens' ActivityTaskFailedEventAttributes Prelude.Integer
activityTaskFailedEventAttributes_startedEventId :: (Integer -> f Integer)
-> ActivityTaskFailedEventAttributes
-> f ActivityTaskFailedEventAttributes
activityTaskFailedEventAttributes_startedEventId = (ActivityTaskFailedEventAttributes -> Integer)
-> (ActivityTaskFailedEventAttributes
    -> Integer -> ActivityTaskFailedEventAttributes)
-> Lens
     ActivityTaskFailedEventAttributes
     ActivityTaskFailedEventAttributes
     Integer
     Integer
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActivityTaskFailedEventAttributes' {Integer
startedEventId :: Integer
$sel:startedEventId:ActivityTaskFailedEventAttributes' :: ActivityTaskFailedEventAttributes -> Integer
startedEventId} -> Integer
startedEventId) (\s :: ActivityTaskFailedEventAttributes
s@ActivityTaskFailedEventAttributes' {} Integer
a -> ActivityTaskFailedEventAttributes
s {$sel:startedEventId:ActivityTaskFailedEventAttributes' :: Integer
startedEventId = Integer
a} :: ActivityTaskFailedEventAttributes)

instance
  Core.FromJSON
    ActivityTaskFailedEventAttributes
  where
  parseJSON :: Value -> Parser ActivityTaskFailedEventAttributes
parseJSON =
    String
-> (Object -> Parser ActivityTaskFailedEventAttributes)
-> Value
-> Parser ActivityTaskFailedEventAttributes
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ActivityTaskFailedEventAttributes"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Integer
-> Integer
-> ActivityTaskFailedEventAttributes
ActivityTaskFailedEventAttributes'
            (Maybe Text
 -> Maybe Text
 -> Integer
 -> Integer
 -> ActivityTaskFailedEventAttributes)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Integer -> Integer -> ActivityTaskFailedEventAttributes)
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
"reason")
            Parser
  (Maybe Text
   -> Integer -> Integer -> ActivityTaskFailedEventAttributes)
-> Parser (Maybe Text)
-> Parser (Integer -> Integer -> ActivityTaskFailedEventAttributes)
forall (f :: * -> *) a b. Applicative f => 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
"details")
            Parser (Integer -> Integer -> ActivityTaskFailedEventAttributes)
-> Parser Integer
-> Parser (Integer -> ActivityTaskFailedEventAttributes)
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 -> ActivityTaskFailedEventAttributes)
-> Parser Integer -> Parser ActivityTaskFailedEventAttributes
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
    ActivityTaskFailedEventAttributes

instance
  Prelude.NFData
    ActivityTaskFailedEventAttributes