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

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

-- | Contains details about the start of a task during an execution.
--
-- /See:/ 'newTaskStartedEventDetails' smart constructor.
data TaskStartedEventDetails = TaskStartedEventDetails'
  { -- | The action of the resource called by a task state.
    TaskStartedEventDetails -> Text
resourceType :: Prelude.Text,
    -- | The service name of the resource in a task state.
    TaskStartedEventDetails -> Text
resource :: Prelude.Text
  }
  deriving (TaskStartedEventDetails -> TaskStartedEventDetails -> Bool
(TaskStartedEventDetails -> TaskStartedEventDetails -> Bool)
-> (TaskStartedEventDetails -> TaskStartedEventDetails -> Bool)
-> Eq TaskStartedEventDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TaskStartedEventDetails -> TaskStartedEventDetails -> Bool
$c/= :: TaskStartedEventDetails -> TaskStartedEventDetails -> Bool
== :: TaskStartedEventDetails -> TaskStartedEventDetails -> Bool
$c== :: TaskStartedEventDetails -> TaskStartedEventDetails -> Bool
Prelude.Eq, ReadPrec [TaskStartedEventDetails]
ReadPrec TaskStartedEventDetails
Int -> ReadS TaskStartedEventDetails
ReadS [TaskStartedEventDetails]
(Int -> ReadS TaskStartedEventDetails)
-> ReadS [TaskStartedEventDetails]
-> ReadPrec TaskStartedEventDetails
-> ReadPrec [TaskStartedEventDetails]
-> Read TaskStartedEventDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TaskStartedEventDetails]
$creadListPrec :: ReadPrec [TaskStartedEventDetails]
readPrec :: ReadPrec TaskStartedEventDetails
$creadPrec :: ReadPrec TaskStartedEventDetails
readList :: ReadS [TaskStartedEventDetails]
$creadList :: ReadS [TaskStartedEventDetails]
readsPrec :: Int -> ReadS TaskStartedEventDetails
$creadsPrec :: Int -> ReadS TaskStartedEventDetails
Prelude.Read, Int -> TaskStartedEventDetails -> ShowS
[TaskStartedEventDetails] -> ShowS
TaskStartedEventDetails -> String
(Int -> TaskStartedEventDetails -> ShowS)
-> (TaskStartedEventDetails -> String)
-> ([TaskStartedEventDetails] -> ShowS)
-> Show TaskStartedEventDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TaskStartedEventDetails] -> ShowS
$cshowList :: [TaskStartedEventDetails] -> ShowS
show :: TaskStartedEventDetails -> String
$cshow :: TaskStartedEventDetails -> String
showsPrec :: Int -> TaskStartedEventDetails -> ShowS
$cshowsPrec :: Int -> TaskStartedEventDetails -> ShowS
Prelude.Show, (forall x.
 TaskStartedEventDetails -> Rep TaskStartedEventDetails x)
-> (forall x.
    Rep TaskStartedEventDetails x -> TaskStartedEventDetails)
-> Generic TaskStartedEventDetails
forall x. Rep TaskStartedEventDetails x -> TaskStartedEventDetails
forall x. TaskStartedEventDetails -> Rep TaskStartedEventDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TaskStartedEventDetails x -> TaskStartedEventDetails
$cfrom :: forall x. TaskStartedEventDetails -> Rep TaskStartedEventDetails x
Prelude.Generic)

-- |
-- Create a value of 'TaskStartedEventDetails' 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:
--
-- 'resourceType', 'taskStartedEventDetails_resourceType' - The action of the resource called by a task state.
--
-- 'resource', 'taskStartedEventDetails_resource' - The service name of the resource in a task state.
newTaskStartedEventDetails ::
  -- | 'resourceType'
  Prelude.Text ->
  -- | 'resource'
  Prelude.Text ->
  TaskStartedEventDetails
newTaskStartedEventDetails :: Text -> Text -> TaskStartedEventDetails
newTaskStartedEventDetails Text
pResourceType_ Text
pResource_ =
  TaskStartedEventDetails' :: Text -> Text -> TaskStartedEventDetails
TaskStartedEventDetails'
    { $sel:resourceType:TaskStartedEventDetails' :: Text
resourceType =
        Text
pResourceType_,
      $sel:resource:TaskStartedEventDetails' :: Text
resource = Text
pResource_
    }

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

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

instance Core.FromJSON TaskStartedEventDetails where
  parseJSON :: Value -> Parser TaskStartedEventDetails
parseJSON =
    String
-> (Object -> Parser TaskStartedEventDetails)
-> Value
-> Parser TaskStartedEventDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"TaskStartedEventDetails"
      ( \Object
x ->
          Text -> Text -> TaskStartedEventDetails
TaskStartedEventDetails'
            (Text -> Text -> TaskStartedEventDetails)
-> Parser Text -> Parser (Text -> TaskStartedEventDetails)
forall (f :: * -> *) a b. Functor 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 -> TaskStartedEventDetails)
-> Parser Text -> Parser TaskStartedEventDetails
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 TaskStartedEventDetails

instance Prelude.NFData TaskStartedEventDetails