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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SWF.Types.CancelTimerFailedCause

-- | Provides the details of the @CancelTimerFailed@ event.
--
-- /See:/ 'newCancelTimerFailedEventAttributes' smart constructor.
data CancelTimerFailedEventAttributes = CancelTimerFailedEventAttributes'
  { -- | The timerId provided in the @CancelTimer@ decision that failed.
    CancelTimerFailedEventAttributes -> 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/.
    CancelTimerFailedEventAttributes -> CancelTimerFailedCause
cause :: CancelTimerFailedCause,
    -- | The ID of the @DecisionTaskCompleted@ event corresponding to the
    -- decision task that resulted in the @CancelTimer@ decision to cancel this
    -- timer. This information can be useful for diagnosing problems by tracing
    -- back the chain of events leading up to this event.
    CancelTimerFailedEventAttributes -> Integer
decisionTaskCompletedEventId :: Prelude.Integer
  }
  deriving (CancelTimerFailedEventAttributes
-> CancelTimerFailedEventAttributes -> Bool
(CancelTimerFailedEventAttributes
 -> CancelTimerFailedEventAttributes -> Bool)
-> (CancelTimerFailedEventAttributes
    -> CancelTimerFailedEventAttributes -> Bool)
-> Eq CancelTimerFailedEventAttributes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CancelTimerFailedEventAttributes
-> CancelTimerFailedEventAttributes -> Bool
$c/= :: CancelTimerFailedEventAttributes
-> CancelTimerFailedEventAttributes -> Bool
== :: CancelTimerFailedEventAttributes
-> CancelTimerFailedEventAttributes -> Bool
$c== :: CancelTimerFailedEventAttributes
-> CancelTimerFailedEventAttributes -> Bool
Prelude.Eq, ReadPrec [CancelTimerFailedEventAttributes]
ReadPrec CancelTimerFailedEventAttributes
Int -> ReadS CancelTimerFailedEventAttributes
ReadS [CancelTimerFailedEventAttributes]
(Int -> ReadS CancelTimerFailedEventAttributes)
-> ReadS [CancelTimerFailedEventAttributes]
-> ReadPrec CancelTimerFailedEventAttributes
-> ReadPrec [CancelTimerFailedEventAttributes]
-> Read CancelTimerFailedEventAttributes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CancelTimerFailedEventAttributes]
$creadListPrec :: ReadPrec [CancelTimerFailedEventAttributes]
readPrec :: ReadPrec CancelTimerFailedEventAttributes
$creadPrec :: ReadPrec CancelTimerFailedEventAttributes
readList :: ReadS [CancelTimerFailedEventAttributes]
$creadList :: ReadS [CancelTimerFailedEventAttributes]
readsPrec :: Int -> ReadS CancelTimerFailedEventAttributes
$creadsPrec :: Int -> ReadS CancelTimerFailedEventAttributes
Prelude.Read, Int -> CancelTimerFailedEventAttributes -> ShowS
[CancelTimerFailedEventAttributes] -> ShowS
CancelTimerFailedEventAttributes -> String
(Int -> CancelTimerFailedEventAttributes -> ShowS)
-> (CancelTimerFailedEventAttributes -> String)
-> ([CancelTimerFailedEventAttributes] -> ShowS)
-> Show CancelTimerFailedEventAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CancelTimerFailedEventAttributes] -> ShowS
$cshowList :: [CancelTimerFailedEventAttributes] -> ShowS
show :: CancelTimerFailedEventAttributes -> String
$cshow :: CancelTimerFailedEventAttributes -> String
showsPrec :: Int -> CancelTimerFailedEventAttributes -> ShowS
$cshowsPrec :: Int -> CancelTimerFailedEventAttributes -> ShowS
Prelude.Show, (forall x.
 CancelTimerFailedEventAttributes
 -> Rep CancelTimerFailedEventAttributes x)
-> (forall x.
    Rep CancelTimerFailedEventAttributes x
    -> CancelTimerFailedEventAttributes)
-> Generic CancelTimerFailedEventAttributes
forall x.
Rep CancelTimerFailedEventAttributes x
-> CancelTimerFailedEventAttributes
forall x.
CancelTimerFailedEventAttributes
-> Rep CancelTimerFailedEventAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CancelTimerFailedEventAttributes x
-> CancelTimerFailedEventAttributes
$cfrom :: forall x.
CancelTimerFailedEventAttributes
-> Rep CancelTimerFailedEventAttributes x
Prelude.Generic)

-- |
-- Create a value of 'CancelTimerFailedEventAttributes' 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', 'cancelTimerFailedEventAttributes_timerId' - The timerId provided in the @CancelTimer@ decision that failed.
--
-- 'cause', 'cancelTimerFailedEventAttributes_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', 'cancelTimerFailedEventAttributes_decisionTaskCompletedEventId' - The ID of the @DecisionTaskCompleted@ event corresponding to the
-- decision task that resulted in the @CancelTimer@ decision to cancel this
-- timer. This information can be useful for diagnosing problems by tracing
-- back the chain of events leading up to this event.
newCancelTimerFailedEventAttributes ::
  -- | 'timerId'
  Prelude.Text ->
  -- | 'cause'
  CancelTimerFailedCause ->
  -- | 'decisionTaskCompletedEventId'
  Prelude.Integer ->
  CancelTimerFailedEventAttributes
newCancelTimerFailedEventAttributes :: Text
-> CancelTimerFailedCause
-> Integer
-> CancelTimerFailedEventAttributes
newCancelTimerFailedEventAttributes
  Text
pTimerId_
  CancelTimerFailedCause
pCause_
  Integer
pDecisionTaskCompletedEventId_ =
    CancelTimerFailedEventAttributes' :: Text
-> CancelTimerFailedCause
-> Integer
-> CancelTimerFailedEventAttributes
CancelTimerFailedEventAttributes'
      { $sel:timerId:CancelTimerFailedEventAttributes' :: Text
timerId =
          Text
pTimerId_,
        $sel:cause:CancelTimerFailedEventAttributes' :: CancelTimerFailedCause
cause = CancelTimerFailedCause
pCause_,
        $sel:decisionTaskCompletedEventId:CancelTimerFailedEventAttributes' :: Integer
decisionTaskCompletedEventId =
          Integer
pDecisionTaskCompletedEventId_
      }

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

-- | 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/.
cancelTimerFailedEventAttributes_cause :: Lens.Lens' CancelTimerFailedEventAttributes CancelTimerFailedCause
cancelTimerFailedEventAttributes_cause :: (CancelTimerFailedCause -> f CancelTimerFailedCause)
-> CancelTimerFailedEventAttributes
-> f CancelTimerFailedEventAttributes
cancelTimerFailedEventAttributes_cause = (CancelTimerFailedEventAttributes -> CancelTimerFailedCause)
-> (CancelTimerFailedEventAttributes
    -> CancelTimerFailedCause -> CancelTimerFailedEventAttributes)
-> Lens
     CancelTimerFailedEventAttributes
     CancelTimerFailedEventAttributes
     CancelTimerFailedCause
     CancelTimerFailedCause
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CancelTimerFailedEventAttributes' {CancelTimerFailedCause
cause :: CancelTimerFailedCause
$sel:cause:CancelTimerFailedEventAttributes' :: CancelTimerFailedEventAttributes -> CancelTimerFailedCause
cause} -> CancelTimerFailedCause
cause) (\s :: CancelTimerFailedEventAttributes
s@CancelTimerFailedEventAttributes' {} CancelTimerFailedCause
a -> CancelTimerFailedEventAttributes
s {$sel:cause:CancelTimerFailedEventAttributes' :: CancelTimerFailedCause
cause = CancelTimerFailedCause
a} :: CancelTimerFailedEventAttributes)

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

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

instance
  Prelude.NFData
    CancelTimerFailedEventAttributes