{-# 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.StepFunctions.Types.TaskSubmitFailedEventDetails
-- 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.StepFunctions.Types.TaskSubmitFailedEventDetails where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contains details about a task that failed to submit during an execution.
--
-- /See:/ 'newTaskSubmitFailedEventDetails' smart constructor.
data TaskSubmitFailedEventDetails = TaskSubmitFailedEventDetails'
  { -- | The error code of the failure.
    TaskSubmitFailedEventDetails -> Maybe (Sensitive Text)
error :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | A more detailed explanation of the cause of the failure.
    TaskSubmitFailedEventDetails -> Maybe (Sensitive Text)
cause :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The action of the resource called by a task state.
    TaskSubmitFailedEventDetails -> Text
resourceType :: Prelude.Text,
    -- | The service name of the resource in a task state.
    TaskSubmitFailedEventDetails -> Text
resource :: Prelude.Text
  }
  deriving (TaskSubmitFailedEventDetails
-> TaskSubmitFailedEventDetails -> Bool
(TaskSubmitFailedEventDetails
 -> TaskSubmitFailedEventDetails -> Bool)
-> (TaskSubmitFailedEventDetails
    -> TaskSubmitFailedEventDetails -> Bool)
-> Eq TaskSubmitFailedEventDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TaskSubmitFailedEventDetails
-> TaskSubmitFailedEventDetails -> Bool
$c/= :: TaskSubmitFailedEventDetails
-> TaskSubmitFailedEventDetails -> Bool
== :: TaskSubmitFailedEventDetails
-> TaskSubmitFailedEventDetails -> Bool
$c== :: TaskSubmitFailedEventDetails
-> TaskSubmitFailedEventDetails -> Bool
Prelude.Eq, Int -> TaskSubmitFailedEventDetails -> ShowS
[TaskSubmitFailedEventDetails] -> ShowS
TaskSubmitFailedEventDetails -> String
(Int -> TaskSubmitFailedEventDetails -> ShowS)
-> (TaskSubmitFailedEventDetails -> String)
-> ([TaskSubmitFailedEventDetails] -> ShowS)
-> Show TaskSubmitFailedEventDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TaskSubmitFailedEventDetails] -> ShowS
$cshowList :: [TaskSubmitFailedEventDetails] -> ShowS
show :: TaskSubmitFailedEventDetails -> String
$cshow :: TaskSubmitFailedEventDetails -> String
showsPrec :: Int -> TaskSubmitFailedEventDetails -> ShowS
$cshowsPrec :: Int -> TaskSubmitFailedEventDetails -> ShowS
Prelude.Show, (forall x.
 TaskSubmitFailedEventDetails -> Rep TaskSubmitFailedEventDetails x)
-> (forall x.
    Rep TaskSubmitFailedEventDetails x -> TaskSubmitFailedEventDetails)
-> Generic TaskSubmitFailedEventDetails
forall x.
Rep TaskSubmitFailedEventDetails x -> TaskSubmitFailedEventDetails
forall x.
TaskSubmitFailedEventDetails -> Rep TaskSubmitFailedEventDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep TaskSubmitFailedEventDetails x -> TaskSubmitFailedEventDetails
$cfrom :: forall x.
TaskSubmitFailedEventDetails -> Rep TaskSubmitFailedEventDetails x
Prelude.Generic)

-- |
-- Create a value of 'TaskSubmitFailedEventDetails' 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:
--
-- 'error', 'taskSubmitFailedEventDetails_error' - The error code of the failure.
--
-- 'cause', 'taskSubmitFailedEventDetails_cause' - A more detailed explanation of the cause of the failure.
--
-- 'resourceType', 'taskSubmitFailedEventDetails_resourceType' - The action of the resource called by a task state.
--
-- 'resource', 'taskSubmitFailedEventDetails_resource' - The service name of the resource in a task state.
newTaskSubmitFailedEventDetails ::
  -- | 'resourceType'
  Prelude.Text ->
  -- | 'resource'
  Prelude.Text ->
  TaskSubmitFailedEventDetails
newTaskSubmitFailedEventDetails :: Text -> Text -> TaskSubmitFailedEventDetails
newTaskSubmitFailedEventDetails
  Text
pResourceType_
  Text
pResource_ =
    TaskSubmitFailedEventDetails' :: Maybe (Sensitive Text)
-> Maybe (Sensitive Text)
-> Text
-> Text
-> TaskSubmitFailedEventDetails
TaskSubmitFailedEventDetails'
      { $sel:error:TaskSubmitFailedEventDetails' :: Maybe (Sensitive Text)
error =
          Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:cause:TaskSubmitFailedEventDetails' :: Maybe (Sensitive Text)
cause = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:resourceType:TaskSubmitFailedEventDetails' :: Text
resourceType = Text
pResourceType_,
        $sel:resource:TaskSubmitFailedEventDetails' :: Text
resource = Text
pResource_
      }

-- | The error code of the failure.
taskSubmitFailedEventDetails_error :: Lens.Lens' TaskSubmitFailedEventDetails (Prelude.Maybe Prelude.Text)
taskSubmitFailedEventDetails_error :: (Maybe Text -> f (Maybe Text))
-> TaskSubmitFailedEventDetails -> f TaskSubmitFailedEventDetails
taskSubmitFailedEventDetails_error = (TaskSubmitFailedEventDetails -> Maybe (Sensitive Text))
-> (TaskSubmitFailedEventDetails
    -> Maybe (Sensitive Text) -> TaskSubmitFailedEventDetails)
-> Lens
     TaskSubmitFailedEventDetails
     TaskSubmitFailedEventDetails
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TaskSubmitFailedEventDetails' {Maybe (Sensitive Text)
error :: Maybe (Sensitive Text)
$sel:error:TaskSubmitFailedEventDetails' :: TaskSubmitFailedEventDetails -> Maybe (Sensitive Text)
error} -> Maybe (Sensitive Text)
error) (\s :: TaskSubmitFailedEventDetails
s@TaskSubmitFailedEventDetails' {} Maybe (Sensitive Text)
a -> TaskSubmitFailedEventDetails
s {$sel:error:TaskSubmitFailedEventDetails' :: Maybe (Sensitive Text)
error = Maybe (Sensitive Text)
a} :: TaskSubmitFailedEventDetails) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> TaskSubmitFailedEventDetails -> f TaskSubmitFailedEventDetails)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> TaskSubmitFailedEventDetails
-> f TaskSubmitFailedEventDetails
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
     (Maybe Text)
     (Maybe Text)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | A more detailed explanation of the cause of the failure.
taskSubmitFailedEventDetails_cause :: Lens.Lens' TaskSubmitFailedEventDetails (Prelude.Maybe Prelude.Text)
taskSubmitFailedEventDetails_cause :: (Maybe Text -> f (Maybe Text))
-> TaskSubmitFailedEventDetails -> f TaskSubmitFailedEventDetails
taskSubmitFailedEventDetails_cause = (TaskSubmitFailedEventDetails -> Maybe (Sensitive Text))
-> (TaskSubmitFailedEventDetails
    -> Maybe (Sensitive Text) -> TaskSubmitFailedEventDetails)
-> Lens
     TaskSubmitFailedEventDetails
     TaskSubmitFailedEventDetails
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TaskSubmitFailedEventDetails' {Maybe (Sensitive Text)
cause :: Maybe (Sensitive Text)
$sel:cause:TaskSubmitFailedEventDetails' :: TaskSubmitFailedEventDetails -> Maybe (Sensitive Text)
cause} -> Maybe (Sensitive Text)
cause) (\s :: TaskSubmitFailedEventDetails
s@TaskSubmitFailedEventDetails' {} Maybe (Sensitive Text)
a -> TaskSubmitFailedEventDetails
s {$sel:cause:TaskSubmitFailedEventDetails' :: Maybe (Sensitive Text)
cause = Maybe (Sensitive Text)
a} :: TaskSubmitFailedEventDetails) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> TaskSubmitFailedEventDetails -> f TaskSubmitFailedEventDetails)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> TaskSubmitFailedEventDetails
-> f TaskSubmitFailedEventDetails
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
     (Maybe Text)
     (Maybe Text)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | The action of the resource called by a task state.
taskSubmitFailedEventDetails_resourceType :: Lens.Lens' TaskSubmitFailedEventDetails Prelude.Text
taskSubmitFailedEventDetails_resourceType :: (Text -> f Text)
-> TaskSubmitFailedEventDetails -> f TaskSubmitFailedEventDetails
taskSubmitFailedEventDetails_resourceType = (TaskSubmitFailedEventDetails -> Text)
-> (TaskSubmitFailedEventDetails
    -> Text -> TaskSubmitFailedEventDetails)
-> Lens
     TaskSubmitFailedEventDetails TaskSubmitFailedEventDetails Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TaskSubmitFailedEventDetails' {Text
resourceType :: Text
$sel:resourceType:TaskSubmitFailedEventDetails' :: TaskSubmitFailedEventDetails -> Text
resourceType} -> Text
resourceType) (\s :: TaskSubmitFailedEventDetails
s@TaskSubmitFailedEventDetails' {} Text
a -> TaskSubmitFailedEventDetails
s {$sel:resourceType:TaskSubmitFailedEventDetails' :: Text
resourceType = Text
a} :: TaskSubmitFailedEventDetails)

-- | The service name of the resource in a task state.
taskSubmitFailedEventDetails_resource :: Lens.Lens' TaskSubmitFailedEventDetails Prelude.Text
taskSubmitFailedEventDetails_resource :: (Text -> f Text)
-> TaskSubmitFailedEventDetails -> f TaskSubmitFailedEventDetails
taskSubmitFailedEventDetails_resource = (TaskSubmitFailedEventDetails -> Text)
-> (TaskSubmitFailedEventDetails
    -> Text -> TaskSubmitFailedEventDetails)
-> Lens
     TaskSubmitFailedEventDetails TaskSubmitFailedEventDetails Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TaskSubmitFailedEventDetails' {Text
resource :: Text
$sel:resource:TaskSubmitFailedEventDetails' :: TaskSubmitFailedEventDetails -> Text
resource} -> Text
resource) (\s :: TaskSubmitFailedEventDetails
s@TaskSubmitFailedEventDetails' {} Text
a -> TaskSubmitFailedEventDetails
s {$sel:resource:TaskSubmitFailedEventDetails' :: Text
resource = Text
a} :: TaskSubmitFailedEventDetails)

instance Core.FromJSON TaskSubmitFailedEventDetails where
  parseJSON :: Value -> Parser TaskSubmitFailedEventDetails
parseJSON =
    String
-> (Object -> Parser TaskSubmitFailedEventDetails)
-> Value
-> Parser TaskSubmitFailedEventDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"TaskSubmitFailedEventDetails"
      ( \Object
x ->
          Maybe (Sensitive Text)
-> Maybe (Sensitive Text)
-> Text
-> Text
-> TaskSubmitFailedEventDetails
TaskSubmitFailedEventDetails'
            (Maybe (Sensitive Text)
 -> Maybe (Sensitive Text)
 -> Text
 -> Text
 -> TaskSubmitFailedEventDetails)
-> Parser (Maybe (Sensitive Text))
-> Parser
     (Maybe (Sensitive Text)
      -> Text -> Text -> TaskSubmitFailedEventDetails)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Sensitive Text))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"error")
            Parser
  (Maybe (Sensitive Text)
   -> Text -> Text -> TaskSubmitFailedEventDetails)
-> Parser (Maybe (Sensitive Text))
-> Parser (Text -> Text -> TaskSubmitFailedEventDetails)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Sensitive Text))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"cause")
            Parser (Text -> Text -> TaskSubmitFailedEventDetails)
-> Parser Text -> Parser (Text -> TaskSubmitFailedEventDetails)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"resourceType")
            Parser (Text -> TaskSubmitFailedEventDetails)
-> Parser Text -> Parser TaskSubmitFailedEventDetails
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"resource")
      )

instance
  Prelude.Hashable
    TaskSubmitFailedEventDetails

instance Prelude.NFData TaskSubmitFailedEventDetails