{-# 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.StartTimerFailedEventAttributes
-- 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.StartTimerFailedEventAttributes 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.StartTimerFailedCause

-- | Provides the details of the @StartTimerFailed@ event.
--
-- /See:/ 'newStartTimerFailedEventAttributes' smart constructor.
data StartTimerFailedEventAttributes = StartTimerFailedEventAttributes'
  { -- | The timerId provided in the @StartTimer@ decision that failed.
    StartTimerFailedEventAttributes -> Text
timerId :: Prelude.Text,
    -- | The cause of the failure. This information is generated by the system
    -- and can be useful for diagnostic purposes.
    --
    -- If @cause@ is set to @OPERATION_NOT_PERMITTED@, the decision failed
    -- because it lacked sufficient permissions. For details and example IAM
    -- policies, see
    -- <https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html Using IAM to Manage Access to Amazon SWF Workflows>
    -- in the /Amazon SWF Developer Guide/.
    StartTimerFailedEventAttributes -> StartTimerFailedCause
cause :: StartTimerFailedCause,
    -- | The ID of the @DecisionTaskCompleted@ event corresponding to the
    -- decision task that resulted in the @StartTimer@ decision for this
    -- activity task. This information can be useful for diagnosing problems by
    -- tracing back the chain of events leading up to this event.
    StartTimerFailedEventAttributes -> Integer
decisionTaskCompletedEventId :: Prelude.Integer
  }
  deriving (StartTimerFailedEventAttributes
-> StartTimerFailedEventAttributes -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartTimerFailedEventAttributes
-> StartTimerFailedEventAttributes -> Bool
$c/= :: StartTimerFailedEventAttributes
-> StartTimerFailedEventAttributes -> Bool
== :: StartTimerFailedEventAttributes
-> StartTimerFailedEventAttributes -> Bool
$c== :: StartTimerFailedEventAttributes
-> StartTimerFailedEventAttributes -> Bool
Prelude.Eq, ReadPrec [StartTimerFailedEventAttributes]
ReadPrec StartTimerFailedEventAttributes
Int -> ReadS StartTimerFailedEventAttributes
ReadS [StartTimerFailedEventAttributes]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartTimerFailedEventAttributes]
$creadListPrec :: ReadPrec [StartTimerFailedEventAttributes]
readPrec :: ReadPrec StartTimerFailedEventAttributes
$creadPrec :: ReadPrec StartTimerFailedEventAttributes
readList :: ReadS [StartTimerFailedEventAttributes]
$creadList :: ReadS [StartTimerFailedEventAttributes]
readsPrec :: Int -> ReadS StartTimerFailedEventAttributes
$creadsPrec :: Int -> ReadS StartTimerFailedEventAttributes
Prelude.Read, Int -> StartTimerFailedEventAttributes -> ShowS
[StartTimerFailedEventAttributes] -> ShowS
StartTimerFailedEventAttributes -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartTimerFailedEventAttributes] -> ShowS
$cshowList :: [StartTimerFailedEventAttributes] -> ShowS
show :: StartTimerFailedEventAttributes -> String
$cshow :: StartTimerFailedEventAttributes -> String
showsPrec :: Int -> StartTimerFailedEventAttributes -> ShowS
$cshowsPrec :: Int -> StartTimerFailedEventAttributes -> ShowS
Prelude.Show, forall x.
Rep StartTimerFailedEventAttributes x
-> StartTimerFailedEventAttributes
forall x.
StartTimerFailedEventAttributes
-> Rep StartTimerFailedEventAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StartTimerFailedEventAttributes x
-> StartTimerFailedEventAttributes
$cfrom :: forall x.
StartTimerFailedEventAttributes
-> Rep StartTimerFailedEventAttributes x
Prelude.Generic)

-- |
-- Create a value of 'StartTimerFailedEventAttributes' 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:
--
-- 'timerId', 'startTimerFailedEventAttributes_timerId' - The timerId provided in the @StartTimer@ decision that failed.
--
-- 'cause', 'startTimerFailedEventAttributes_cause' - The cause of the failure. This information is generated by the system
-- and can be useful for diagnostic purposes.
--
-- If @cause@ is set to @OPERATION_NOT_PERMITTED@, the decision failed
-- because it lacked sufficient permissions. For details and example IAM
-- policies, see
-- <https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html Using IAM to Manage Access to Amazon SWF Workflows>
-- in the /Amazon SWF Developer Guide/.
--
-- 'decisionTaskCompletedEventId', 'startTimerFailedEventAttributes_decisionTaskCompletedEventId' - The ID of the @DecisionTaskCompleted@ event corresponding to the
-- decision task that resulted in the @StartTimer@ decision for this
-- activity task. This information can be useful for diagnosing problems by
-- tracing back the chain of events leading up to this event.
newStartTimerFailedEventAttributes ::
  -- | 'timerId'
  Prelude.Text ->
  -- | 'cause'
  StartTimerFailedCause ->
  -- | 'decisionTaskCompletedEventId'
  Prelude.Integer ->
  StartTimerFailedEventAttributes
newStartTimerFailedEventAttributes :: Text
-> StartTimerFailedCause
-> Integer
-> StartTimerFailedEventAttributes
newStartTimerFailedEventAttributes
  Text
pTimerId_
  StartTimerFailedCause
pCause_
  Integer
pDecisionTaskCompletedEventId_ =
    StartTimerFailedEventAttributes'
      { $sel:timerId:StartTimerFailedEventAttributes' :: Text
timerId =
          Text
pTimerId_,
        $sel:cause:StartTimerFailedEventAttributes' :: StartTimerFailedCause
cause = StartTimerFailedCause
pCause_,
        $sel:decisionTaskCompletedEventId:StartTimerFailedEventAttributes' :: Integer
decisionTaskCompletedEventId =
          Integer
pDecisionTaskCompletedEventId_
      }

-- | The timerId provided in the @StartTimer@ decision that failed.
startTimerFailedEventAttributes_timerId :: Lens.Lens' StartTimerFailedEventAttributes Prelude.Text
startTimerFailedEventAttributes_timerId :: Lens' StartTimerFailedEventAttributes Text
startTimerFailedEventAttributes_timerId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartTimerFailedEventAttributes' {Text
timerId :: Text
$sel:timerId:StartTimerFailedEventAttributes' :: StartTimerFailedEventAttributes -> Text
timerId} -> Text
timerId) (\s :: StartTimerFailedEventAttributes
s@StartTimerFailedEventAttributes' {} Text
a -> StartTimerFailedEventAttributes
s {$sel:timerId:StartTimerFailedEventAttributes' :: Text
timerId = Text
a} :: StartTimerFailedEventAttributes)

-- | The cause of the failure. This information is generated by the system
-- and can be useful for diagnostic purposes.
--
-- If @cause@ is set to @OPERATION_NOT_PERMITTED@, the decision failed
-- because it lacked sufficient permissions. For details and example IAM
-- policies, see
-- <https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html Using IAM to Manage Access to Amazon SWF Workflows>
-- in the /Amazon SWF Developer Guide/.
startTimerFailedEventAttributes_cause :: Lens.Lens' StartTimerFailedEventAttributes StartTimerFailedCause
startTimerFailedEventAttributes_cause :: Lens' StartTimerFailedEventAttributes StartTimerFailedCause
startTimerFailedEventAttributes_cause = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartTimerFailedEventAttributes' {StartTimerFailedCause
cause :: StartTimerFailedCause
$sel:cause:StartTimerFailedEventAttributes' :: StartTimerFailedEventAttributes -> StartTimerFailedCause
cause} -> StartTimerFailedCause
cause) (\s :: StartTimerFailedEventAttributes
s@StartTimerFailedEventAttributes' {} StartTimerFailedCause
a -> StartTimerFailedEventAttributes
s {$sel:cause:StartTimerFailedEventAttributes' :: StartTimerFailedCause
cause = StartTimerFailedCause
a} :: StartTimerFailedEventAttributes)

-- | The ID of the @DecisionTaskCompleted@ event corresponding to the
-- decision task that resulted in the @StartTimer@ decision for this
-- activity task. This information can be useful for diagnosing problems by
-- tracing back the chain of events leading up to this event.
startTimerFailedEventAttributes_decisionTaskCompletedEventId :: Lens.Lens' StartTimerFailedEventAttributes Prelude.Integer
startTimerFailedEventAttributes_decisionTaskCompletedEventId :: Lens' StartTimerFailedEventAttributes Integer
startTimerFailedEventAttributes_decisionTaskCompletedEventId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartTimerFailedEventAttributes' {Integer
decisionTaskCompletedEventId :: Integer
$sel:decisionTaskCompletedEventId:StartTimerFailedEventAttributes' :: StartTimerFailedEventAttributes -> Integer
decisionTaskCompletedEventId} -> Integer
decisionTaskCompletedEventId) (\s :: StartTimerFailedEventAttributes
s@StartTimerFailedEventAttributes' {} Integer
a -> StartTimerFailedEventAttributes
s {$sel:decisionTaskCompletedEventId:StartTimerFailedEventAttributes' :: Integer
decisionTaskCompletedEventId = Integer
a} :: StartTimerFailedEventAttributes)

instance
  Data.FromJSON
    StartTimerFailedEventAttributes
  where
  parseJSON :: Value -> Parser StartTimerFailedEventAttributes
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"StartTimerFailedEventAttributes"
      ( \Object
x ->
          Text
-> StartTimerFailedCause
-> Integer
-> StartTimerFailedEventAttributes
StartTimerFailedEventAttributes'
            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
"timerId")
            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
"cause")
            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
"decisionTaskCompletedEventId")
      )

instance
  Prelude.Hashable
    StartTimerFailedEventAttributes
  where
  hashWithSalt :: Int -> StartTimerFailedEventAttributes -> Int
hashWithSalt
    Int
_salt
    StartTimerFailedEventAttributes' {Integer
Text
StartTimerFailedCause
decisionTaskCompletedEventId :: Integer
cause :: StartTimerFailedCause
timerId :: Text
$sel:decisionTaskCompletedEventId:StartTimerFailedEventAttributes' :: StartTimerFailedEventAttributes -> Integer
$sel:cause:StartTimerFailedEventAttributes' :: StartTimerFailedEventAttributes -> StartTimerFailedCause
$sel:timerId:StartTimerFailedEventAttributes' :: StartTimerFailedEventAttributes -> Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
timerId
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` StartTimerFailedCause
cause
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Integer
decisionTaskCompletedEventId

instance
  Prelude.NFData
    StartTimerFailedEventAttributes
  where
  rnf :: StartTimerFailedEventAttributes -> ()
rnf StartTimerFailedEventAttributes' {Integer
Text
StartTimerFailedCause
decisionTaskCompletedEventId :: Integer
cause :: StartTimerFailedCause
timerId :: Text
$sel:decisionTaskCompletedEventId:StartTimerFailedEventAttributes' :: StartTimerFailedEventAttributes -> Integer
$sel:cause:StartTimerFailedEventAttributes' :: StartTimerFailedEventAttributes -> StartTimerFailedCause
$sel:timerId:StartTimerFailedEventAttributes' :: StartTimerFailedEventAttributes -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
timerId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf StartTimerFailedCause
cause
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Integer
decisionTaskCompletedEventId