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

-- |
-- Create a value of 'TaskSubmittedEventDetails' 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', 'taskSubmittedEventDetails_output' - The response from a resource when a task has started. Length constraints
-- apply to the payload size, and are expressed as bytes in UTF-8 encoding.
--
-- 'outputDetails', 'taskSubmittedEventDetails_outputDetails' - Contains details about the output of an execution history event.
--
-- 'resourceType', 'taskSubmittedEventDetails_resourceType' - The action of the resource called by a task state.
--
-- 'resource', 'taskSubmittedEventDetails_resource' - The service name of the resource in a task state.
newTaskSubmittedEventDetails ::
  -- | 'resourceType'
  Prelude.Text ->
  -- | 'resource'
  Prelude.Text ->
  TaskSubmittedEventDetails
newTaskSubmittedEventDetails :: Text -> Text -> TaskSubmittedEventDetails
newTaskSubmittedEventDetails
  Text
pResourceType_
  Text
pResource_ =
    TaskSubmittedEventDetails' :: Maybe (Sensitive Text)
-> Maybe HistoryEventExecutionDataDetails
-> Text
-> Text
-> TaskSubmittedEventDetails
TaskSubmittedEventDetails'
      { $sel:output:TaskSubmittedEventDetails' :: Maybe (Sensitive Text)
output =
          Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:outputDetails:TaskSubmittedEventDetails' :: Maybe HistoryEventExecutionDataDetails
outputDetails = Maybe HistoryEventExecutionDataDetails
forall a. Maybe a
Prelude.Nothing,
        $sel:resourceType:TaskSubmittedEventDetails' :: Text
resourceType = Text
pResourceType_,
        $sel:resource:TaskSubmittedEventDetails' :: Text
resource = Text
pResource_
      }

-- | The response from a resource when a task has started. Length constraints
-- apply to the payload size, and are expressed as bytes in UTF-8 encoding.
taskSubmittedEventDetails_output :: Lens.Lens' TaskSubmittedEventDetails (Prelude.Maybe Prelude.Text)
taskSubmittedEventDetails_output :: (Maybe Text -> f (Maybe Text))
-> TaskSubmittedEventDetails -> f TaskSubmittedEventDetails
taskSubmittedEventDetails_output = (TaskSubmittedEventDetails -> Maybe (Sensitive Text))
-> (TaskSubmittedEventDetails
    -> Maybe (Sensitive Text) -> TaskSubmittedEventDetails)
-> Lens
     TaskSubmittedEventDetails
     TaskSubmittedEventDetails
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TaskSubmittedEventDetails' {Maybe (Sensitive Text)
output :: Maybe (Sensitive Text)
$sel:output:TaskSubmittedEventDetails' :: TaskSubmittedEventDetails -> Maybe (Sensitive Text)
output} -> Maybe (Sensitive Text)
output) (\s :: TaskSubmittedEventDetails
s@TaskSubmittedEventDetails' {} Maybe (Sensitive Text)
a -> TaskSubmittedEventDetails
s {$sel:output:TaskSubmittedEventDetails' :: Maybe (Sensitive Text)
output = Maybe (Sensitive Text)
a} :: TaskSubmittedEventDetails) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> TaskSubmittedEventDetails -> f TaskSubmittedEventDetails)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> TaskSubmittedEventDetails
-> f TaskSubmittedEventDetails
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.
taskSubmittedEventDetails_outputDetails :: Lens.Lens' TaskSubmittedEventDetails (Prelude.Maybe HistoryEventExecutionDataDetails)
taskSubmittedEventDetails_outputDetails :: (Maybe HistoryEventExecutionDataDetails
 -> f (Maybe HistoryEventExecutionDataDetails))
-> TaskSubmittedEventDetails -> f TaskSubmittedEventDetails
taskSubmittedEventDetails_outputDetails = (TaskSubmittedEventDetails
 -> Maybe HistoryEventExecutionDataDetails)
-> (TaskSubmittedEventDetails
    -> Maybe HistoryEventExecutionDataDetails
    -> TaskSubmittedEventDetails)
-> Lens
     TaskSubmittedEventDetails
     TaskSubmittedEventDetails
     (Maybe HistoryEventExecutionDataDetails)
     (Maybe HistoryEventExecutionDataDetails)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TaskSubmittedEventDetails' {Maybe HistoryEventExecutionDataDetails
outputDetails :: Maybe HistoryEventExecutionDataDetails
$sel:outputDetails:TaskSubmittedEventDetails' :: TaskSubmittedEventDetails -> Maybe HistoryEventExecutionDataDetails
outputDetails} -> Maybe HistoryEventExecutionDataDetails
outputDetails) (\s :: TaskSubmittedEventDetails
s@TaskSubmittedEventDetails' {} Maybe HistoryEventExecutionDataDetails
a -> TaskSubmittedEventDetails
s {$sel:outputDetails:TaskSubmittedEventDetails' :: Maybe HistoryEventExecutionDataDetails
outputDetails = Maybe HistoryEventExecutionDataDetails
a} :: TaskSubmittedEventDetails)

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

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

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

instance Prelude.NFData TaskSubmittedEventDetails