{-# 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.ExecutionListItem
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.StepFunctions.Types.ExecutionListItem where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.StepFunctions.Types.ExecutionStatus

-- | Contains details about an execution.
--
-- /See:/ 'newExecutionListItem' smart constructor.
data ExecutionListItem = ExecutionListItem'
  { -- | The total number of items processed in a child workflow execution. This
    -- field is returned only if @mapRunArn@ was specified in the
    -- @ListExecutions@ API action. If @stateMachineArn@ was specified in
    -- @ListExecutions@, the @itemCount@ field isn\'t returned.
    ExecutionListItem -> Maybe Natural
itemCount :: Prelude.Maybe Prelude.Natural,
    -- | The Amazon Resource Name (ARN) of a Map Run. This field is returned only
    -- if @mapRunArn@ was specified in the @ListExecutions@ API action. If
    -- @stateMachineArn@ was specified in @ListExecutions@, the @mapRunArn@
    -- isn\'t returned.
    ExecutionListItem -> Maybe Text
mapRunArn :: Prelude.Maybe Prelude.Text,
    -- | If the execution already ended, the date the execution stopped.
    ExecutionListItem -> Maybe POSIX
stopDate :: Prelude.Maybe Data.POSIX,
    -- | The Amazon Resource Name (ARN) that identifies the execution.
    ExecutionListItem -> Text
executionArn :: Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the executed state machine.
    ExecutionListItem -> Text
stateMachineArn :: Prelude.Text,
    -- | The name of the execution.
    --
    -- A name must /not/ contain:
    --
    -- -   white space
    --
    -- -   brackets @\< > { } [ ]@
    --
    -- -   wildcard characters @? *@
    --
    -- -   special characters @\" # % \\ ^ | ~ \` $ & , ; : \/@
    --
    -- -   control characters (@U+0000-001F@, @U+007F-009F@)
    --
    -- To enable logging with CloudWatch Logs, the name should only contain
    -- 0-9, A-Z, a-z, - and _.
    ExecutionListItem -> Text
name :: Prelude.Text,
    -- | The current status of the execution.
    ExecutionListItem -> ExecutionStatus
status :: ExecutionStatus,
    -- | The date the execution started.
    ExecutionListItem -> POSIX
startDate :: Data.POSIX
  }
  deriving (ExecutionListItem -> ExecutionListItem -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExecutionListItem -> ExecutionListItem -> Bool
$c/= :: ExecutionListItem -> ExecutionListItem -> Bool
== :: ExecutionListItem -> ExecutionListItem -> Bool
$c== :: ExecutionListItem -> ExecutionListItem -> Bool
Prelude.Eq, ReadPrec [ExecutionListItem]
ReadPrec ExecutionListItem
Int -> ReadS ExecutionListItem
ReadS [ExecutionListItem]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ExecutionListItem]
$creadListPrec :: ReadPrec [ExecutionListItem]
readPrec :: ReadPrec ExecutionListItem
$creadPrec :: ReadPrec ExecutionListItem
readList :: ReadS [ExecutionListItem]
$creadList :: ReadS [ExecutionListItem]
readsPrec :: Int -> ReadS ExecutionListItem
$creadsPrec :: Int -> ReadS ExecutionListItem
Prelude.Read, Int -> ExecutionListItem -> ShowS
[ExecutionListItem] -> ShowS
ExecutionListItem -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExecutionListItem] -> ShowS
$cshowList :: [ExecutionListItem] -> ShowS
show :: ExecutionListItem -> String
$cshow :: ExecutionListItem -> String
showsPrec :: Int -> ExecutionListItem -> ShowS
$cshowsPrec :: Int -> ExecutionListItem -> ShowS
Prelude.Show, forall x. Rep ExecutionListItem x -> ExecutionListItem
forall x. ExecutionListItem -> Rep ExecutionListItem x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ExecutionListItem x -> ExecutionListItem
$cfrom :: forall x. ExecutionListItem -> Rep ExecutionListItem x
Prelude.Generic)

-- |
-- Create a value of 'ExecutionListItem' 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:
--
-- 'itemCount', 'executionListItem_itemCount' - The total number of items processed in a child workflow execution. This
-- field is returned only if @mapRunArn@ was specified in the
-- @ListExecutions@ API action. If @stateMachineArn@ was specified in
-- @ListExecutions@, the @itemCount@ field isn\'t returned.
--
-- 'mapRunArn', 'executionListItem_mapRunArn' - The Amazon Resource Name (ARN) of a Map Run. This field is returned only
-- if @mapRunArn@ was specified in the @ListExecutions@ API action. If
-- @stateMachineArn@ was specified in @ListExecutions@, the @mapRunArn@
-- isn\'t returned.
--
-- 'stopDate', 'executionListItem_stopDate' - If the execution already ended, the date the execution stopped.
--
-- 'executionArn', 'executionListItem_executionArn' - The Amazon Resource Name (ARN) that identifies the execution.
--
-- 'stateMachineArn', 'executionListItem_stateMachineArn' - The Amazon Resource Name (ARN) of the executed state machine.
--
-- 'name', 'executionListItem_name' - The name of the execution.
--
-- A name must /not/ contain:
--
-- -   white space
--
-- -   brackets @\< > { } [ ]@
--
-- -   wildcard characters @? *@
--
-- -   special characters @\" # % \\ ^ | ~ \` $ & , ; : \/@
--
-- -   control characters (@U+0000-001F@, @U+007F-009F@)
--
-- To enable logging with CloudWatch Logs, the name should only contain
-- 0-9, A-Z, a-z, - and _.
--
-- 'status', 'executionListItem_status' - The current status of the execution.
--
-- 'startDate', 'executionListItem_startDate' - The date the execution started.
newExecutionListItem ::
  -- | 'executionArn'
  Prelude.Text ->
  -- | 'stateMachineArn'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  -- | 'status'
  ExecutionStatus ->
  -- | 'startDate'
  Prelude.UTCTime ->
  ExecutionListItem
newExecutionListItem :: Text
-> Text -> Text -> ExecutionStatus -> UTCTime -> ExecutionListItem
newExecutionListItem
  Text
pExecutionArn_
  Text
pStateMachineArn_
  Text
pName_
  ExecutionStatus
pStatus_
  UTCTime
pStartDate_ =
    ExecutionListItem'
      { $sel:itemCount:ExecutionListItem' :: Maybe Natural
itemCount = forall a. Maybe a
Prelude.Nothing,
        $sel:mapRunArn:ExecutionListItem' :: Maybe Text
mapRunArn = forall a. Maybe a
Prelude.Nothing,
        $sel:stopDate:ExecutionListItem' :: Maybe POSIX
stopDate = forall a. Maybe a
Prelude.Nothing,
        $sel:executionArn:ExecutionListItem' :: Text
executionArn = Text
pExecutionArn_,
        $sel:stateMachineArn:ExecutionListItem' :: Text
stateMachineArn = Text
pStateMachineArn_,
        $sel:name:ExecutionListItem' :: Text
name = Text
pName_,
        $sel:status:ExecutionListItem' :: ExecutionStatus
status = ExecutionStatus
pStatus_,
        $sel:startDate:ExecutionListItem' :: POSIX
startDate = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pStartDate_
      }

-- | The total number of items processed in a child workflow execution. This
-- field is returned only if @mapRunArn@ was specified in the
-- @ListExecutions@ API action. If @stateMachineArn@ was specified in
-- @ListExecutions@, the @itemCount@ field isn\'t returned.
executionListItem_itemCount :: Lens.Lens' ExecutionListItem (Prelude.Maybe Prelude.Natural)
executionListItem_itemCount :: Lens' ExecutionListItem (Maybe Natural)
executionListItem_itemCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecutionListItem' {Maybe Natural
itemCount :: Maybe Natural
$sel:itemCount:ExecutionListItem' :: ExecutionListItem -> Maybe Natural
itemCount} -> Maybe Natural
itemCount) (\s :: ExecutionListItem
s@ExecutionListItem' {} Maybe Natural
a -> ExecutionListItem
s {$sel:itemCount:ExecutionListItem' :: Maybe Natural
itemCount = Maybe Natural
a} :: ExecutionListItem)

-- | The Amazon Resource Name (ARN) of a Map Run. This field is returned only
-- if @mapRunArn@ was specified in the @ListExecutions@ API action. If
-- @stateMachineArn@ was specified in @ListExecutions@, the @mapRunArn@
-- isn\'t returned.
executionListItem_mapRunArn :: Lens.Lens' ExecutionListItem (Prelude.Maybe Prelude.Text)
executionListItem_mapRunArn :: Lens' ExecutionListItem (Maybe Text)
executionListItem_mapRunArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecutionListItem' {Maybe Text
mapRunArn :: Maybe Text
$sel:mapRunArn:ExecutionListItem' :: ExecutionListItem -> Maybe Text
mapRunArn} -> Maybe Text
mapRunArn) (\s :: ExecutionListItem
s@ExecutionListItem' {} Maybe Text
a -> ExecutionListItem
s {$sel:mapRunArn:ExecutionListItem' :: Maybe Text
mapRunArn = Maybe Text
a} :: ExecutionListItem)

-- | If the execution already ended, the date the execution stopped.
executionListItem_stopDate :: Lens.Lens' ExecutionListItem (Prelude.Maybe Prelude.UTCTime)
executionListItem_stopDate :: Lens' ExecutionListItem (Maybe UTCTime)
executionListItem_stopDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecutionListItem' {Maybe POSIX
stopDate :: Maybe POSIX
$sel:stopDate:ExecutionListItem' :: ExecutionListItem -> Maybe POSIX
stopDate} -> Maybe POSIX
stopDate) (\s :: ExecutionListItem
s@ExecutionListItem' {} Maybe POSIX
a -> ExecutionListItem
s {$sel:stopDate:ExecutionListItem' :: Maybe POSIX
stopDate = Maybe POSIX
a} :: ExecutionListItem) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The Amazon Resource Name (ARN) that identifies the execution.
executionListItem_executionArn :: Lens.Lens' ExecutionListItem Prelude.Text
executionListItem_executionArn :: Lens' ExecutionListItem Text
executionListItem_executionArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecutionListItem' {Text
executionArn :: Text
$sel:executionArn:ExecutionListItem' :: ExecutionListItem -> Text
executionArn} -> Text
executionArn) (\s :: ExecutionListItem
s@ExecutionListItem' {} Text
a -> ExecutionListItem
s {$sel:executionArn:ExecutionListItem' :: Text
executionArn = Text
a} :: ExecutionListItem)

-- | The Amazon Resource Name (ARN) of the executed state machine.
executionListItem_stateMachineArn :: Lens.Lens' ExecutionListItem Prelude.Text
executionListItem_stateMachineArn :: Lens' ExecutionListItem Text
executionListItem_stateMachineArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecutionListItem' {Text
stateMachineArn :: Text
$sel:stateMachineArn:ExecutionListItem' :: ExecutionListItem -> Text
stateMachineArn} -> Text
stateMachineArn) (\s :: ExecutionListItem
s@ExecutionListItem' {} Text
a -> ExecutionListItem
s {$sel:stateMachineArn:ExecutionListItem' :: Text
stateMachineArn = Text
a} :: ExecutionListItem)

-- | The name of the execution.
--
-- A name must /not/ contain:
--
-- -   white space
--
-- -   brackets @\< > { } [ ]@
--
-- -   wildcard characters @? *@
--
-- -   special characters @\" # % \\ ^ | ~ \` $ & , ; : \/@
--
-- -   control characters (@U+0000-001F@, @U+007F-009F@)
--
-- To enable logging with CloudWatch Logs, the name should only contain
-- 0-9, A-Z, a-z, - and _.
executionListItem_name :: Lens.Lens' ExecutionListItem Prelude.Text
executionListItem_name :: Lens' ExecutionListItem Text
executionListItem_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecutionListItem' {Text
name :: Text
$sel:name:ExecutionListItem' :: ExecutionListItem -> Text
name} -> Text
name) (\s :: ExecutionListItem
s@ExecutionListItem' {} Text
a -> ExecutionListItem
s {$sel:name:ExecutionListItem' :: Text
name = Text
a} :: ExecutionListItem)

-- | The current status of the execution.
executionListItem_status :: Lens.Lens' ExecutionListItem ExecutionStatus
executionListItem_status :: Lens' ExecutionListItem ExecutionStatus
executionListItem_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecutionListItem' {ExecutionStatus
status :: ExecutionStatus
$sel:status:ExecutionListItem' :: ExecutionListItem -> ExecutionStatus
status} -> ExecutionStatus
status) (\s :: ExecutionListItem
s@ExecutionListItem' {} ExecutionStatus
a -> ExecutionListItem
s {$sel:status:ExecutionListItem' :: ExecutionStatus
status = ExecutionStatus
a} :: ExecutionListItem)

-- | The date the execution started.
executionListItem_startDate :: Lens.Lens' ExecutionListItem Prelude.UTCTime
executionListItem_startDate :: Lens' ExecutionListItem UTCTime
executionListItem_startDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecutionListItem' {POSIX
startDate :: POSIX
$sel:startDate:ExecutionListItem' :: ExecutionListItem -> POSIX
startDate} -> POSIX
startDate) (\s :: ExecutionListItem
s@ExecutionListItem' {} POSIX
a -> ExecutionListItem
s {$sel:startDate:ExecutionListItem' :: POSIX
startDate = POSIX
a} :: ExecutionListItem) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

instance Data.FromJSON ExecutionListItem where
  parseJSON :: Value -> Parser ExecutionListItem
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ExecutionListItem"
      ( \Object
x ->
          Maybe Natural
-> Maybe Text
-> Maybe POSIX
-> Text
-> Text
-> Text
-> ExecutionStatus
-> POSIX
-> ExecutionListItem
ExecutionListItem'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"itemCount")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"mapRunArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"stopDate")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"executionArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"stateMachineArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"name")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"status")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"startDate")
      )

instance Prelude.Hashable ExecutionListItem where
  hashWithSalt :: Int -> ExecutionListItem -> Int
hashWithSalt Int
_salt ExecutionListItem' {Maybe Natural
Maybe Text
Maybe POSIX
Text
POSIX
ExecutionStatus
startDate :: POSIX
status :: ExecutionStatus
name :: Text
stateMachineArn :: Text
executionArn :: Text
stopDate :: Maybe POSIX
mapRunArn :: Maybe Text
itemCount :: Maybe Natural
$sel:startDate:ExecutionListItem' :: ExecutionListItem -> POSIX
$sel:status:ExecutionListItem' :: ExecutionListItem -> ExecutionStatus
$sel:name:ExecutionListItem' :: ExecutionListItem -> Text
$sel:stateMachineArn:ExecutionListItem' :: ExecutionListItem -> Text
$sel:executionArn:ExecutionListItem' :: ExecutionListItem -> Text
$sel:stopDate:ExecutionListItem' :: ExecutionListItem -> Maybe POSIX
$sel:mapRunArn:ExecutionListItem' :: ExecutionListItem -> Maybe Text
$sel:itemCount:ExecutionListItem' :: ExecutionListItem -> Maybe Natural
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
itemCount
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
mapRunArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
stopDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
executionArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
stateMachineArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ExecutionStatus
status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
startDate

instance Prelude.NFData ExecutionListItem where
  rnf :: ExecutionListItem -> ()
rnf ExecutionListItem' {Maybe Natural
Maybe Text
Maybe POSIX
Text
POSIX
ExecutionStatus
startDate :: POSIX
status :: ExecutionStatus
name :: Text
stateMachineArn :: Text
executionArn :: Text
stopDate :: Maybe POSIX
mapRunArn :: Maybe Text
itemCount :: Maybe Natural
$sel:startDate:ExecutionListItem' :: ExecutionListItem -> POSIX
$sel:status:ExecutionListItem' :: ExecutionListItem -> ExecutionStatus
$sel:name:ExecutionListItem' :: ExecutionListItem -> Text
$sel:stateMachineArn:ExecutionListItem' :: ExecutionListItem -> Text
$sel:executionArn:ExecutionListItem' :: ExecutionListItem -> Text
$sel:stopDate:ExecutionListItem' :: ExecutionListItem -> Maybe POSIX
$sel:mapRunArn:ExecutionListItem' :: ExecutionListItem -> Maybe Text
$sel:itemCount:ExecutionListItem' :: ExecutionListItem -> Maybe Natural
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
itemCount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
mapRunArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
stopDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
executionArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
stateMachineArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ExecutionStatus
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
startDate