{-# 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.RecordMarkerFailedEventAttributes
-- 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.RecordMarkerFailedEventAttributes 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.RecordMarkerFailedCause

-- | Provides the details of the @RecordMarkerFailed@ event.
--
-- /See:/ 'newRecordMarkerFailedEventAttributes' smart constructor.
data RecordMarkerFailedEventAttributes = RecordMarkerFailedEventAttributes'
  { -- | The marker\'s name.
    RecordMarkerFailedEventAttributes -> Text
markerName :: 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/.
    RecordMarkerFailedEventAttributes -> RecordMarkerFailedCause
cause :: RecordMarkerFailedCause,
    -- | The ID of the @DecisionTaskCompleted@ event corresponding to the
    -- decision task that resulted in the @RecordMarkerFailed@ 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.
    RecordMarkerFailedEventAttributes -> Integer
decisionTaskCompletedEventId :: Prelude.Integer
  }
  deriving (RecordMarkerFailedEventAttributes
-> RecordMarkerFailedEventAttributes -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RecordMarkerFailedEventAttributes
-> RecordMarkerFailedEventAttributes -> Bool
$c/= :: RecordMarkerFailedEventAttributes
-> RecordMarkerFailedEventAttributes -> Bool
== :: RecordMarkerFailedEventAttributes
-> RecordMarkerFailedEventAttributes -> Bool
$c== :: RecordMarkerFailedEventAttributes
-> RecordMarkerFailedEventAttributes -> Bool
Prelude.Eq, ReadPrec [RecordMarkerFailedEventAttributes]
ReadPrec RecordMarkerFailedEventAttributes
Int -> ReadS RecordMarkerFailedEventAttributes
ReadS [RecordMarkerFailedEventAttributes]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RecordMarkerFailedEventAttributes]
$creadListPrec :: ReadPrec [RecordMarkerFailedEventAttributes]
readPrec :: ReadPrec RecordMarkerFailedEventAttributes
$creadPrec :: ReadPrec RecordMarkerFailedEventAttributes
readList :: ReadS [RecordMarkerFailedEventAttributes]
$creadList :: ReadS [RecordMarkerFailedEventAttributes]
readsPrec :: Int -> ReadS RecordMarkerFailedEventAttributes
$creadsPrec :: Int -> ReadS RecordMarkerFailedEventAttributes
Prelude.Read, Int -> RecordMarkerFailedEventAttributes -> ShowS
[RecordMarkerFailedEventAttributes] -> ShowS
RecordMarkerFailedEventAttributes -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RecordMarkerFailedEventAttributes] -> ShowS
$cshowList :: [RecordMarkerFailedEventAttributes] -> ShowS
show :: RecordMarkerFailedEventAttributes -> String
$cshow :: RecordMarkerFailedEventAttributes -> String
showsPrec :: Int -> RecordMarkerFailedEventAttributes -> ShowS
$cshowsPrec :: Int -> RecordMarkerFailedEventAttributes -> ShowS
Prelude.Show, forall x.
Rep RecordMarkerFailedEventAttributes x
-> RecordMarkerFailedEventAttributes
forall x.
RecordMarkerFailedEventAttributes
-> Rep RecordMarkerFailedEventAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RecordMarkerFailedEventAttributes x
-> RecordMarkerFailedEventAttributes
$cfrom :: forall x.
RecordMarkerFailedEventAttributes
-> Rep RecordMarkerFailedEventAttributes x
Prelude.Generic)

-- |
-- Create a value of 'RecordMarkerFailedEventAttributes' 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:
--
-- 'markerName', 'recordMarkerFailedEventAttributes_markerName' - The marker\'s name.
--
-- 'cause', 'recordMarkerFailedEventAttributes_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', 'recordMarkerFailedEventAttributes_decisionTaskCompletedEventId' - The ID of the @DecisionTaskCompleted@ event corresponding to the
-- decision task that resulted in the @RecordMarkerFailed@ 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.
newRecordMarkerFailedEventAttributes ::
  -- | 'markerName'
  Prelude.Text ->
  -- | 'cause'
  RecordMarkerFailedCause ->
  -- | 'decisionTaskCompletedEventId'
  Prelude.Integer ->
  RecordMarkerFailedEventAttributes
newRecordMarkerFailedEventAttributes :: Text
-> RecordMarkerFailedCause
-> Integer
-> RecordMarkerFailedEventAttributes
newRecordMarkerFailedEventAttributes
  Text
pMarkerName_
  RecordMarkerFailedCause
pCause_
  Integer
pDecisionTaskCompletedEventId_ =
    RecordMarkerFailedEventAttributes'
      { $sel:markerName:RecordMarkerFailedEventAttributes' :: Text
markerName =
          Text
pMarkerName_,
        $sel:cause:RecordMarkerFailedEventAttributes' :: RecordMarkerFailedCause
cause = RecordMarkerFailedCause
pCause_,
        $sel:decisionTaskCompletedEventId:RecordMarkerFailedEventAttributes' :: Integer
decisionTaskCompletedEventId =
          Integer
pDecisionTaskCompletedEventId_
      }

-- | The marker\'s name.
recordMarkerFailedEventAttributes_markerName :: Lens.Lens' RecordMarkerFailedEventAttributes Prelude.Text
recordMarkerFailedEventAttributes_markerName :: Lens' RecordMarkerFailedEventAttributes Text
recordMarkerFailedEventAttributes_markerName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecordMarkerFailedEventAttributes' {Text
markerName :: Text
$sel:markerName:RecordMarkerFailedEventAttributes' :: RecordMarkerFailedEventAttributes -> Text
markerName} -> Text
markerName) (\s :: RecordMarkerFailedEventAttributes
s@RecordMarkerFailedEventAttributes' {} Text
a -> RecordMarkerFailedEventAttributes
s {$sel:markerName:RecordMarkerFailedEventAttributes' :: Text
markerName = Text
a} :: RecordMarkerFailedEventAttributes)

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

-- | The ID of the @DecisionTaskCompleted@ event corresponding to the
-- decision task that resulted in the @RecordMarkerFailed@ 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.
recordMarkerFailedEventAttributes_decisionTaskCompletedEventId :: Lens.Lens' RecordMarkerFailedEventAttributes Prelude.Integer
recordMarkerFailedEventAttributes_decisionTaskCompletedEventId :: Lens' RecordMarkerFailedEventAttributes Integer
recordMarkerFailedEventAttributes_decisionTaskCompletedEventId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecordMarkerFailedEventAttributes' {Integer
decisionTaskCompletedEventId :: Integer
$sel:decisionTaskCompletedEventId:RecordMarkerFailedEventAttributes' :: RecordMarkerFailedEventAttributes -> Integer
decisionTaskCompletedEventId} -> Integer
decisionTaskCompletedEventId) (\s :: RecordMarkerFailedEventAttributes
s@RecordMarkerFailedEventAttributes' {} Integer
a -> RecordMarkerFailedEventAttributes
s {$sel:decisionTaskCompletedEventId:RecordMarkerFailedEventAttributes' :: Integer
decisionTaskCompletedEventId = Integer
a} :: RecordMarkerFailedEventAttributes)

instance
  Data.FromJSON
    RecordMarkerFailedEventAttributes
  where
  parseJSON :: Value -> Parser RecordMarkerFailedEventAttributes
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"RecordMarkerFailedEventAttributes"
      ( \Object
x ->
          Text
-> RecordMarkerFailedCause
-> Integer
-> RecordMarkerFailedEventAttributes
RecordMarkerFailedEventAttributes'
            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
"markerName")
            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
    RecordMarkerFailedEventAttributes
  where
  hashWithSalt :: Int -> RecordMarkerFailedEventAttributes -> Int
hashWithSalt
    Int
_salt
    RecordMarkerFailedEventAttributes' {Integer
Text
RecordMarkerFailedCause
decisionTaskCompletedEventId :: Integer
cause :: RecordMarkerFailedCause
markerName :: Text
$sel:decisionTaskCompletedEventId:RecordMarkerFailedEventAttributes' :: RecordMarkerFailedEventAttributes -> Integer
$sel:cause:RecordMarkerFailedEventAttributes' :: RecordMarkerFailedEventAttributes -> RecordMarkerFailedCause
$sel:markerName:RecordMarkerFailedEventAttributes' :: RecordMarkerFailedEventAttributes -> Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
markerName
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` RecordMarkerFailedCause
cause
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Integer
decisionTaskCompletedEventId

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