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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(StartTimerFailedEventAttributes
 -> StartTimerFailedEventAttributes -> Bool)
-> (StartTimerFailedEventAttributes
    -> StartTimerFailedEventAttributes -> Bool)
-> Eq StartTimerFailedEventAttributes
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]
(Int -> ReadS StartTimerFailedEventAttributes)
-> ReadS [StartTimerFailedEventAttributes]
-> ReadPrec StartTimerFailedEventAttributes
-> ReadPrec [StartTimerFailedEventAttributes]
-> Read 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
(Int -> StartTimerFailedEventAttributes -> ShowS)
-> (StartTimerFailedEventAttributes -> String)
-> ([StartTimerFailedEventAttributes] -> ShowS)
-> Show StartTimerFailedEventAttributes
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.
 StartTimerFailedEventAttributes
 -> Rep StartTimerFailedEventAttributes x)
-> (forall x.
    Rep StartTimerFailedEventAttributes x
    -> StartTimerFailedEventAttributes)
-> Generic StartTimerFailedEventAttributes
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' :: Text
-> StartTimerFailedCause
-> Integer
-> StartTimerFailedEventAttributes
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 :: (Text -> f Text)
-> StartTimerFailedEventAttributes
-> f StartTimerFailedEventAttributes
startTimerFailedEventAttributes_timerId = (StartTimerFailedEventAttributes -> Text)
-> (StartTimerFailedEventAttributes
    -> Text -> StartTimerFailedEventAttributes)
-> Lens
     StartTimerFailedEventAttributes
     StartTimerFailedEventAttributes
     Text
     Text
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 :: (StartTimerFailedCause -> f StartTimerFailedCause)
-> StartTimerFailedEventAttributes
-> f StartTimerFailedEventAttributes
startTimerFailedEventAttributes_cause = (StartTimerFailedEventAttributes -> StartTimerFailedCause)
-> (StartTimerFailedEventAttributes
    -> StartTimerFailedCause -> StartTimerFailedEventAttributes)
-> Lens
     StartTimerFailedEventAttributes
     StartTimerFailedEventAttributes
     StartTimerFailedCause
     StartTimerFailedCause
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 :: (Integer -> f Integer)
-> StartTimerFailedEventAttributes
-> f StartTimerFailedEventAttributes
startTimerFailedEventAttributes_decisionTaskCompletedEventId = (StartTimerFailedEventAttributes -> Integer)
-> (StartTimerFailedEventAttributes
    -> Integer -> StartTimerFailedEventAttributes)
-> Lens
     StartTimerFailedEventAttributes
     StartTimerFailedEventAttributes
     Integer
     Integer
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
  Core.FromJSON
    StartTimerFailedEventAttributes
  where
  parseJSON :: Value -> Parser StartTimerFailedEventAttributes
parseJSON =
    String
-> (Object -> Parser StartTimerFailedEventAttributes)
-> Value
-> Parser StartTimerFailedEventAttributes
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"StartTimerFailedEventAttributes"
      ( \Object
x ->
          Text
-> StartTimerFailedCause
-> Integer
-> StartTimerFailedEventAttributes
StartTimerFailedEventAttributes'
            (Text
 -> StartTimerFailedCause
 -> Integer
 -> StartTimerFailedEventAttributes)
-> Parser Text
-> Parser
     (StartTimerFailedCause
      -> Integer -> StartTimerFailedEventAttributes)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"timerId")
            Parser
  (StartTimerFailedCause
   -> Integer -> StartTimerFailedEventAttributes)
-> Parser StartTimerFailedCause
-> Parser (Integer -> StartTimerFailedEventAttributes)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser StartTimerFailedCause
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"cause")
            Parser (Integer -> StartTimerFailedEventAttributes)
-> Parser Integer -> Parser StartTimerFailedEventAttributes
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
"decisionTaskCompletedEventId")
      )

instance
  Prelude.Hashable
    StartTimerFailedEventAttributes

instance
  Prelude.NFData
    StartTimerFailedEventAttributes