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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(RecordMarkerFailedEventAttributes
 -> RecordMarkerFailedEventAttributes -> Bool)
-> (RecordMarkerFailedEventAttributes
    -> RecordMarkerFailedEventAttributes -> Bool)
-> Eq RecordMarkerFailedEventAttributes
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]
(Int -> ReadS RecordMarkerFailedEventAttributes)
-> ReadS [RecordMarkerFailedEventAttributes]
-> ReadPrec RecordMarkerFailedEventAttributes
-> ReadPrec [RecordMarkerFailedEventAttributes]
-> Read 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
(Int -> RecordMarkerFailedEventAttributes -> ShowS)
-> (RecordMarkerFailedEventAttributes -> String)
-> ([RecordMarkerFailedEventAttributes] -> ShowS)
-> Show RecordMarkerFailedEventAttributes
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.
 RecordMarkerFailedEventAttributes
 -> Rep RecordMarkerFailedEventAttributes x)
-> (forall x.
    Rep RecordMarkerFailedEventAttributes x
    -> RecordMarkerFailedEventAttributes)
-> Generic RecordMarkerFailedEventAttributes
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' :: Text
-> RecordMarkerFailedCause
-> Integer
-> RecordMarkerFailedEventAttributes
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 :: (Text -> f Text)
-> RecordMarkerFailedEventAttributes
-> f RecordMarkerFailedEventAttributes
recordMarkerFailedEventAttributes_markerName = (RecordMarkerFailedEventAttributes -> Text)
-> (RecordMarkerFailedEventAttributes
    -> Text -> RecordMarkerFailedEventAttributes)
-> Lens
     RecordMarkerFailedEventAttributes
     RecordMarkerFailedEventAttributes
     Text
     Text
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 :: (RecordMarkerFailedCause -> f RecordMarkerFailedCause)
-> RecordMarkerFailedEventAttributes
-> f RecordMarkerFailedEventAttributes
recordMarkerFailedEventAttributes_cause = (RecordMarkerFailedEventAttributes -> RecordMarkerFailedCause)
-> (RecordMarkerFailedEventAttributes
    -> RecordMarkerFailedCause -> RecordMarkerFailedEventAttributes)
-> Lens
     RecordMarkerFailedEventAttributes
     RecordMarkerFailedEventAttributes
     RecordMarkerFailedCause
     RecordMarkerFailedCause
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 :: (Integer -> f Integer)
-> RecordMarkerFailedEventAttributes
-> f RecordMarkerFailedEventAttributes
recordMarkerFailedEventAttributes_decisionTaskCompletedEventId = (RecordMarkerFailedEventAttributes -> Integer)
-> (RecordMarkerFailedEventAttributes
    -> Integer -> RecordMarkerFailedEventAttributes)
-> Lens
     RecordMarkerFailedEventAttributes
     RecordMarkerFailedEventAttributes
     Integer
     Integer
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
  Core.FromJSON
    RecordMarkerFailedEventAttributes
  where
  parseJSON :: Value -> Parser RecordMarkerFailedEventAttributes
parseJSON =
    String
-> (Object -> Parser RecordMarkerFailedEventAttributes)
-> Value
-> Parser RecordMarkerFailedEventAttributes
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"RecordMarkerFailedEventAttributes"
      ( \Object
x ->
          Text
-> RecordMarkerFailedCause
-> Integer
-> RecordMarkerFailedEventAttributes
RecordMarkerFailedEventAttributes'
            (Text
 -> RecordMarkerFailedCause
 -> Integer
 -> RecordMarkerFailedEventAttributes)
-> Parser Text
-> Parser
     (RecordMarkerFailedCause
      -> Integer -> RecordMarkerFailedEventAttributes)
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
"markerName")
            Parser
  (RecordMarkerFailedCause
   -> Integer -> RecordMarkerFailedEventAttributes)
-> Parser RecordMarkerFailedCause
-> Parser (Integer -> RecordMarkerFailedEventAttributes)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser RecordMarkerFailedCause
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"cause")
            Parser (Integer -> RecordMarkerFailedEventAttributes)
-> Parser Integer -> Parser RecordMarkerFailedEventAttributes
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
    RecordMarkerFailedEventAttributes

instance
  Prelude.NFData
    RecordMarkerFailedEventAttributes