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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.StepFunctions.Types.HistoryEventExecutionDataDetails

-- | Contains details about the successful completion of a task state.
--
-- /See:/ 'newTaskSucceededEventDetails' smart constructor.
data TaskSucceededEventDetails = TaskSucceededEventDetails'
  { -- | The full JSON response from a resource when a task has succeeded. This
    -- response becomes the output of the related task. Length constraints
    -- apply to the payload size, and are expressed as bytes in UTF-8 encoding.
    TaskSucceededEventDetails -> Maybe (Sensitive Text)
output :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | Contains details about the output of an execution history event.
    TaskSucceededEventDetails -> Maybe HistoryEventExecutionDataDetails
outputDetails :: Prelude.Maybe HistoryEventExecutionDataDetails,
    -- | The action of the resource called by a task state.
    TaskSucceededEventDetails -> Text
resourceType :: Prelude.Text,
    -- | The service name of the resource in a task state.
    TaskSucceededEventDetails -> Text
resource :: Prelude.Text
  }
  deriving (TaskSucceededEventDetails -> TaskSucceededEventDetails -> Bool
(TaskSucceededEventDetails -> TaskSucceededEventDetails -> Bool)
-> (TaskSucceededEventDetails -> TaskSucceededEventDetails -> Bool)
-> Eq TaskSucceededEventDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TaskSucceededEventDetails -> TaskSucceededEventDetails -> Bool
$c/= :: TaskSucceededEventDetails -> TaskSucceededEventDetails -> Bool
== :: TaskSucceededEventDetails -> TaskSucceededEventDetails -> Bool
$c== :: TaskSucceededEventDetails -> TaskSucceededEventDetails -> Bool
Prelude.Eq, Int -> TaskSucceededEventDetails -> ShowS
[TaskSucceededEventDetails] -> ShowS
TaskSucceededEventDetails -> String
(Int -> TaskSucceededEventDetails -> ShowS)
-> (TaskSucceededEventDetails -> String)
-> ([TaskSucceededEventDetails] -> ShowS)
-> Show TaskSucceededEventDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TaskSucceededEventDetails] -> ShowS
$cshowList :: [TaskSucceededEventDetails] -> ShowS
show :: TaskSucceededEventDetails -> String
$cshow :: TaskSucceededEventDetails -> String
showsPrec :: Int -> TaskSucceededEventDetails -> ShowS
$cshowsPrec :: Int -> TaskSucceededEventDetails -> ShowS
Prelude.Show, (forall x.
 TaskSucceededEventDetails -> Rep TaskSucceededEventDetails x)
-> (forall x.
    Rep TaskSucceededEventDetails x -> TaskSucceededEventDetails)
-> Generic TaskSucceededEventDetails
forall x.
Rep TaskSucceededEventDetails x -> TaskSucceededEventDetails
forall x.
TaskSucceededEventDetails -> Rep TaskSucceededEventDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep TaskSucceededEventDetails x -> TaskSucceededEventDetails
$cfrom :: forall x.
TaskSucceededEventDetails -> Rep TaskSucceededEventDetails x
Prelude.Generic)

-- |
-- Create a value of 'TaskSucceededEventDetails' 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:
--
-- 'output', 'taskSucceededEventDetails_output' - The full JSON response from a resource when a task has succeeded. This
-- response becomes the output of the related task. Length constraints
-- apply to the payload size, and are expressed as bytes in UTF-8 encoding.
--
-- 'outputDetails', 'taskSucceededEventDetails_outputDetails' - Contains details about the output of an execution history event.
--
-- 'resourceType', 'taskSucceededEventDetails_resourceType' - The action of the resource called by a task state.
--
-- 'resource', 'taskSucceededEventDetails_resource' - The service name of the resource in a task state.
newTaskSucceededEventDetails ::
  -- | 'resourceType'
  Prelude.Text ->
  -- | 'resource'
  Prelude.Text ->
  TaskSucceededEventDetails
newTaskSucceededEventDetails :: Text -> Text -> TaskSucceededEventDetails
newTaskSucceededEventDetails
  Text
pResourceType_
  Text
pResource_ =
    TaskSucceededEventDetails' :: Maybe (Sensitive Text)
-> Maybe HistoryEventExecutionDataDetails
-> Text
-> Text
-> TaskSucceededEventDetails
TaskSucceededEventDetails'
      { $sel:output:TaskSucceededEventDetails' :: Maybe (Sensitive Text)
output =
          Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:outputDetails:TaskSucceededEventDetails' :: Maybe HistoryEventExecutionDataDetails
outputDetails = Maybe HistoryEventExecutionDataDetails
forall a. Maybe a
Prelude.Nothing,
        $sel:resourceType:TaskSucceededEventDetails' :: Text
resourceType = Text
pResourceType_,
        $sel:resource:TaskSucceededEventDetails' :: Text
resource = Text
pResource_
      }

-- | The full JSON response from a resource when a task has succeeded. This
-- response becomes the output of the related task. Length constraints
-- apply to the payload size, and are expressed as bytes in UTF-8 encoding.
taskSucceededEventDetails_output :: Lens.Lens' TaskSucceededEventDetails (Prelude.Maybe Prelude.Text)
taskSucceededEventDetails_output :: (Maybe Text -> f (Maybe Text))
-> TaskSucceededEventDetails -> f TaskSucceededEventDetails
taskSucceededEventDetails_output = (TaskSucceededEventDetails -> Maybe (Sensitive Text))
-> (TaskSucceededEventDetails
    -> Maybe (Sensitive Text) -> TaskSucceededEventDetails)
-> Lens
     TaskSucceededEventDetails
     TaskSucceededEventDetails
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TaskSucceededEventDetails' {Maybe (Sensitive Text)
output :: Maybe (Sensitive Text)
$sel:output:TaskSucceededEventDetails' :: TaskSucceededEventDetails -> Maybe (Sensitive Text)
output} -> Maybe (Sensitive Text)
output) (\s :: TaskSucceededEventDetails
s@TaskSucceededEventDetails' {} Maybe (Sensitive Text)
a -> TaskSucceededEventDetails
s {$sel:output:TaskSucceededEventDetails' :: Maybe (Sensitive Text)
output = Maybe (Sensitive Text)
a} :: TaskSucceededEventDetails) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> TaskSucceededEventDetails -> f TaskSucceededEventDetails)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> TaskSucceededEventDetails
-> f TaskSucceededEventDetails
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

-- | Contains details about the output of an execution history event.
taskSucceededEventDetails_outputDetails :: Lens.Lens' TaskSucceededEventDetails (Prelude.Maybe HistoryEventExecutionDataDetails)
taskSucceededEventDetails_outputDetails :: (Maybe HistoryEventExecutionDataDetails
 -> f (Maybe HistoryEventExecutionDataDetails))
-> TaskSucceededEventDetails -> f TaskSucceededEventDetails
taskSucceededEventDetails_outputDetails = (TaskSucceededEventDetails
 -> Maybe HistoryEventExecutionDataDetails)
-> (TaskSucceededEventDetails
    -> Maybe HistoryEventExecutionDataDetails
    -> TaskSucceededEventDetails)
-> Lens
     TaskSucceededEventDetails
     TaskSucceededEventDetails
     (Maybe HistoryEventExecutionDataDetails)
     (Maybe HistoryEventExecutionDataDetails)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TaskSucceededEventDetails' {Maybe HistoryEventExecutionDataDetails
outputDetails :: Maybe HistoryEventExecutionDataDetails
$sel:outputDetails:TaskSucceededEventDetails' :: TaskSucceededEventDetails -> Maybe HistoryEventExecutionDataDetails
outputDetails} -> Maybe HistoryEventExecutionDataDetails
outputDetails) (\s :: TaskSucceededEventDetails
s@TaskSucceededEventDetails' {} Maybe HistoryEventExecutionDataDetails
a -> TaskSucceededEventDetails
s {$sel:outputDetails:TaskSucceededEventDetails' :: Maybe HistoryEventExecutionDataDetails
outputDetails = Maybe HistoryEventExecutionDataDetails
a} :: TaskSucceededEventDetails)

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

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

instance Core.FromJSON TaskSucceededEventDetails where
  parseJSON :: Value -> Parser TaskSucceededEventDetails
parseJSON =
    String
-> (Object -> Parser TaskSucceededEventDetails)
-> Value
-> Parser TaskSucceededEventDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"TaskSucceededEventDetails"
      ( \Object
x ->
          Maybe (Sensitive Text)
-> Maybe HistoryEventExecutionDataDetails
-> Text
-> Text
-> TaskSucceededEventDetails
TaskSucceededEventDetails'
            (Maybe (Sensitive Text)
 -> Maybe HistoryEventExecutionDataDetails
 -> Text
 -> Text
 -> TaskSucceededEventDetails)
-> Parser (Maybe (Sensitive Text))
-> Parser
     (Maybe HistoryEventExecutionDataDetails
      -> Text -> Text -> TaskSucceededEventDetails)
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
"output")
            Parser
  (Maybe HistoryEventExecutionDataDetails
   -> Text -> Text -> TaskSucceededEventDetails)
-> Parser (Maybe HistoryEventExecutionDataDetails)
-> Parser (Text -> Text -> TaskSucceededEventDetails)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe HistoryEventExecutionDataDetails)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"outputDetails")
            Parser (Text -> Text -> TaskSucceededEventDetails)
-> Parser Text -> Parser (Text -> TaskSucceededEventDetails)
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 -> TaskSucceededEventDetails)
-> Parser Text -> Parser TaskSucceededEventDetails
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 TaskSucceededEventDetails

instance Prelude.NFData TaskSucceededEventDetails