{-# 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.TaskStartFailedEventDetails
-- 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.TaskStartFailedEventDetails 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 start during an execution.
--
-- /See:/ 'newTaskStartFailedEventDetails' smart constructor.
data TaskStartFailedEventDetails = TaskStartFailedEventDetails'
  { -- | The error code of the failure.
    TaskStartFailedEventDetails -> Maybe (Sensitive Text)
error :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | A more detailed explanation of the cause of the failure.
    TaskStartFailedEventDetails -> Maybe (Sensitive Text)
cause :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The action of the resource called by a task state.
    TaskStartFailedEventDetails -> Text
resourceType :: Prelude.Text,
    -- | The service name of the resource in a task state.
    TaskStartFailedEventDetails -> Text
resource :: Prelude.Text
  }
  deriving (TaskStartFailedEventDetails -> TaskStartFailedEventDetails -> Bool
(TaskStartFailedEventDetails
 -> TaskStartFailedEventDetails -> Bool)
-> (TaskStartFailedEventDetails
    -> TaskStartFailedEventDetails -> Bool)
-> Eq TaskStartFailedEventDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TaskStartFailedEventDetails -> TaskStartFailedEventDetails -> Bool
$c/= :: TaskStartFailedEventDetails -> TaskStartFailedEventDetails -> Bool
== :: TaskStartFailedEventDetails -> TaskStartFailedEventDetails -> Bool
$c== :: TaskStartFailedEventDetails -> TaskStartFailedEventDetails -> Bool
Prelude.Eq, Int -> TaskStartFailedEventDetails -> ShowS
[TaskStartFailedEventDetails] -> ShowS
TaskStartFailedEventDetails -> String
(Int -> TaskStartFailedEventDetails -> ShowS)
-> (TaskStartFailedEventDetails -> String)
-> ([TaskStartFailedEventDetails] -> ShowS)
-> Show TaskStartFailedEventDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TaskStartFailedEventDetails] -> ShowS
$cshowList :: [TaskStartFailedEventDetails] -> ShowS
show :: TaskStartFailedEventDetails -> String
$cshow :: TaskStartFailedEventDetails -> String
showsPrec :: Int -> TaskStartFailedEventDetails -> ShowS
$cshowsPrec :: Int -> TaskStartFailedEventDetails -> ShowS
Prelude.Show, (forall x.
 TaskStartFailedEventDetails -> Rep TaskStartFailedEventDetails x)
-> (forall x.
    Rep TaskStartFailedEventDetails x -> TaskStartFailedEventDetails)
-> Generic TaskStartFailedEventDetails
forall x.
Rep TaskStartFailedEventDetails x -> TaskStartFailedEventDetails
forall x.
TaskStartFailedEventDetails -> Rep TaskStartFailedEventDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep TaskStartFailedEventDetails x -> TaskStartFailedEventDetails
$cfrom :: forall x.
TaskStartFailedEventDetails -> Rep TaskStartFailedEventDetails x
Prelude.Generic)

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

-- | The error code of the failure.
taskStartFailedEventDetails_error :: Lens.Lens' TaskStartFailedEventDetails (Prelude.Maybe Prelude.Text)
taskStartFailedEventDetails_error :: (Maybe Text -> f (Maybe Text))
-> TaskStartFailedEventDetails -> f TaskStartFailedEventDetails
taskStartFailedEventDetails_error = (TaskStartFailedEventDetails -> Maybe (Sensitive Text))
-> (TaskStartFailedEventDetails
    -> Maybe (Sensitive Text) -> TaskStartFailedEventDetails)
-> Lens
     TaskStartFailedEventDetails
     TaskStartFailedEventDetails
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TaskStartFailedEventDetails' {Maybe (Sensitive Text)
error :: Maybe (Sensitive Text)
$sel:error:TaskStartFailedEventDetails' :: TaskStartFailedEventDetails -> Maybe (Sensitive Text)
error} -> Maybe (Sensitive Text)
error) (\s :: TaskStartFailedEventDetails
s@TaskStartFailedEventDetails' {} Maybe (Sensitive Text)
a -> TaskStartFailedEventDetails
s {$sel:error:TaskStartFailedEventDetails' :: Maybe (Sensitive Text)
error = Maybe (Sensitive Text)
a} :: TaskStartFailedEventDetails) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> TaskStartFailedEventDetails -> f TaskStartFailedEventDetails)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> TaskStartFailedEventDetails
-> f TaskStartFailedEventDetails
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.
taskStartFailedEventDetails_cause :: Lens.Lens' TaskStartFailedEventDetails (Prelude.Maybe Prelude.Text)
taskStartFailedEventDetails_cause :: (Maybe Text -> f (Maybe Text))
-> TaskStartFailedEventDetails -> f TaskStartFailedEventDetails
taskStartFailedEventDetails_cause = (TaskStartFailedEventDetails -> Maybe (Sensitive Text))
-> (TaskStartFailedEventDetails
    -> Maybe (Sensitive Text) -> TaskStartFailedEventDetails)
-> Lens
     TaskStartFailedEventDetails
     TaskStartFailedEventDetails
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TaskStartFailedEventDetails' {Maybe (Sensitive Text)
cause :: Maybe (Sensitive Text)
$sel:cause:TaskStartFailedEventDetails' :: TaskStartFailedEventDetails -> Maybe (Sensitive Text)
cause} -> Maybe (Sensitive Text)
cause) (\s :: TaskStartFailedEventDetails
s@TaskStartFailedEventDetails' {} Maybe (Sensitive Text)
a -> TaskStartFailedEventDetails
s {$sel:cause:TaskStartFailedEventDetails' :: Maybe (Sensitive Text)
cause = Maybe (Sensitive Text)
a} :: TaskStartFailedEventDetails) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> TaskStartFailedEventDetails -> f TaskStartFailedEventDetails)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> TaskStartFailedEventDetails
-> f TaskStartFailedEventDetails
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.
taskStartFailedEventDetails_resourceType :: Lens.Lens' TaskStartFailedEventDetails Prelude.Text
taskStartFailedEventDetails_resourceType :: (Text -> f Text)
-> TaskStartFailedEventDetails -> f TaskStartFailedEventDetails
taskStartFailedEventDetails_resourceType = (TaskStartFailedEventDetails -> Text)
-> (TaskStartFailedEventDetails
    -> Text -> TaskStartFailedEventDetails)
-> Lens
     TaskStartFailedEventDetails TaskStartFailedEventDetails Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TaskStartFailedEventDetails' {Text
resourceType :: Text
$sel:resourceType:TaskStartFailedEventDetails' :: TaskStartFailedEventDetails -> Text
resourceType} -> Text
resourceType) (\s :: TaskStartFailedEventDetails
s@TaskStartFailedEventDetails' {} Text
a -> TaskStartFailedEventDetails
s {$sel:resourceType:TaskStartFailedEventDetails' :: Text
resourceType = Text
a} :: TaskStartFailedEventDetails)

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

instance Core.FromJSON TaskStartFailedEventDetails where
  parseJSON :: Value -> Parser TaskStartFailedEventDetails
parseJSON =
    String
-> (Object -> Parser TaskStartFailedEventDetails)
-> Value
-> Parser TaskStartFailedEventDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"TaskStartFailedEventDetails"
      ( \Object
x ->
          Maybe (Sensitive Text)
-> Maybe (Sensitive Text)
-> Text
-> Text
-> TaskStartFailedEventDetails
TaskStartFailedEventDetails'
            (Maybe (Sensitive Text)
 -> Maybe (Sensitive Text)
 -> Text
 -> Text
 -> TaskStartFailedEventDetails)
-> Parser (Maybe (Sensitive Text))
-> Parser
     (Maybe (Sensitive Text)
      -> Text -> Text -> TaskStartFailedEventDetails)
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 -> TaskStartFailedEventDetails)
-> Parser (Maybe (Sensitive Text))
-> Parser (Text -> Text -> TaskStartFailedEventDetails)
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 -> TaskStartFailedEventDetails)
-> Parser Text -> Parser (Text -> TaskStartFailedEventDetails)
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 -> TaskStartFailedEventDetails)
-> Parser Text -> Parser TaskStartFailedEventDetails
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 TaskStartFailedEventDetails

instance Prelude.NFData TaskStartFailedEventDetails