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

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

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

-- |
-- Create a value of 'RequestCancelActivityTaskFailedEventAttributes' 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:
--
-- 'activityId', 'requestCancelActivityTaskFailedEventAttributes_activityId' - The activityId provided in the @RequestCancelActivityTask@ decision that
-- failed.
--
-- 'cause', 'requestCancelActivityTaskFailedEventAttributes_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', 'requestCancelActivityTaskFailedEventAttributes_decisionTaskCompletedEventId' - The ID of the @DecisionTaskCompleted@ event corresponding to the
-- decision task that resulted in the @RequestCancelActivityTask@ decision
-- for this cancellation request. This information can be useful for
-- diagnosing problems by tracing back the chain of events leading up to
-- this event.
newRequestCancelActivityTaskFailedEventAttributes ::
  -- | 'activityId'
  Prelude.Text ->
  -- | 'cause'
  RequestCancelActivityTaskFailedCause ->
  -- | 'decisionTaskCompletedEventId'
  Prelude.Integer ->
  RequestCancelActivityTaskFailedEventAttributes
newRequestCancelActivityTaskFailedEventAttributes :: Text
-> RequestCancelActivityTaskFailedCause
-> Integer
-> RequestCancelActivityTaskFailedEventAttributes
newRequestCancelActivityTaskFailedEventAttributes
  Text
pActivityId_
  RequestCancelActivityTaskFailedCause
pCause_
  Integer
pDecisionTaskCompletedEventId_ =
    RequestCancelActivityTaskFailedEventAttributes' :: Text
-> RequestCancelActivityTaskFailedCause
-> Integer
-> RequestCancelActivityTaskFailedEventAttributes
RequestCancelActivityTaskFailedEventAttributes'
      { $sel:activityId:RequestCancelActivityTaskFailedEventAttributes' :: Text
activityId =
          Text
pActivityId_,
        $sel:cause:RequestCancelActivityTaskFailedEventAttributes' :: RequestCancelActivityTaskFailedCause
cause = RequestCancelActivityTaskFailedCause
pCause_,
        $sel:decisionTaskCompletedEventId:RequestCancelActivityTaskFailedEventAttributes' :: Integer
decisionTaskCompletedEventId =
          Integer
pDecisionTaskCompletedEventId_
      }

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

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

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

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

instance
  Prelude.NFData
    RequestCancelActivityTaskFailedEventAttributes