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

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

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

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

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

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

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

instance Prelude.NFData TaskTimedOutEventDetails