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

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

-- | Contains details about an execution.
--
-- /See:/ 'newExecutionListItem' smart constructor.
data ExecutionListItem = ExecutionListItem'
  { -- | If the execution already ended, the date the execution stopped.
    ExecutionListItem -> Maybe POSIX
stopDate :: Prelude.Maybe Core.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 :: Core.POSIX
  }
  deriving (ExecutionListItem -> ExecutionListItem -> Bool
(ExecutionListItem -> ExecutionListItem -> Bool)
-> (ExecutionListItem -> ExecutionListItem -> Bool)
-> Eq ExecutionListItem
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]
(Int -> ReadS ExecutionListItem)
-> ReadS [ExecutionListItem]
-> ReadPrec ExecutionListItem
-> ReadPrec [ExecutionListItem]
-> Read 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
(Int -> ExecutionListItem -> ShowS)
-> (ExecutionListItem -> String)
-> ([ExecutionListItem] -> ShowS)
-> Show ExecutionListItem
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. ExecutionListItem -> Rep ExecutionListItem x)
-> (forall x. Rep ExecutionListItem x -> ExecutionListItem)
-> Generic ExecutionListItem
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:
--
-- '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' :: Maybe POSIX
-> Text
-> Text
-> Text
-> ExecutionStatus
-> POSIX
-> ExecutionListItem
ExecutionListItem'
      { $sel:stopDate:ExecutionListItem' :: Maybe POSIX
stopDate = Maybe POSIX
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 = Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pStartDate_
      }

-- | If the execution already ended, the date the execution stopped.
executionListItem_stopDate :: Lens.Lens' ExecutionListItem (Prelude.Maybe Prelude.UTCTime)
executionListItem_stopDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ExecutionListItem -> f ExecutionListItem
executionListItem_stopDate = (ExecutionListItem -> Maybe POSIX)
-> (ExecutionListItem -> Maybe POSIX -> ExecutionListItem)
-> Lens
     ExecutionListItem ExecutionListItem (Maybe POSIX) (Maybe POSIX)
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) ((Maybe POSIX -> f (Maybe POSIX))
 -> ExecutionListItem -> f ExecutionListItem)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ExecutionListItem
-> f ExecutionListItem
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The Amazon Resource Name (ARN) that identifies the execution.
executionListItem_executionArn :: Lens.Lens' ExecutionListItem Prelude.Text
executionListItem_executionArn :: (Text -> f Text) -> ExecutionListItem -> f ExecutionListItem
executionListItem_executionArn = (ExecutionListItem -> Text)
-> (ExecutionListItem -> Text -> ExecutionListItem)
-> Lens ExecutionListItem ExecutionListItem Text Text
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 :: (Text -> f Text) -> ExecutionListItem -> f ExecutionListItem
executionListItem_stateMachineArn = (ExecutionListItem -> Text)
-> (ExecutionListItem -> Text -> ExecutionListItem)
-> Lens ExecutionListItem ExecutionListItem Text Text
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 :: (Text -> f Text) -> ExecutionListItem -> f ExecutionListItem
executionListItem_name = (ExecutionListItem -> Text)
-> (ExecutionListItem -> Text -> ExecutionListItem)
-> Lens ExecutionListItem ExecutionListItem Text Text
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 :: (ExecutionStatus -> f ExecutionStatus)
-> ExecutionListItem -> f ExecutionListItem
executionListItem_status = (ExecutionListItem -> ExecutionStatus)
-> (ExecutionListItem -> ExecutionStatus -> ExecutionListItem)
-> Lens
     ExecutionListItem ExecutionListItem ExecutionStatus ExecutionStatus
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 :: (UTCTime -> f UTCTime) -> ExecutionListItem -> f ExecutionListItem
executionListItem_startDate = (ExecutionListItem -> POSIX)
-> (ExecutionListItem -> POSIX -> ExecutionListItem)
-> Lens ExecutionListItem ExecutionListItem POSIX POSIX
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) ((POSIX -> f POSIX) -> ExecutionListItem -> f ExecutionListItem)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> ExecutionListItem
-> f ExecutionListItem
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

instance Core.FromJSON ExecutionListItem where
  parseJSON :: Value -> Parser ExecutionListItem
parseJSON =
    String
-> (Object -> Parser ExecutionListItem)
-> Value
-> Parser ExecutionListItem
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ExecutionListItem"
      ( \Object
x ->
          Maybe POSIX
-> Text
-> Text
-> Text
-> ExecutionStatus
-> POSIX
-> ExecutionListItem
ExecutionListItem'
            (Maybe POSIX
 -> Text
 -> Text
 -> Text
 -> ExecutionStatus
 -> POSIX
 -> ExecutionListItem)
-> Parser (Maybe POSIX)
-> Parser
     (Text
      -> Text -> Text -> ExecutionStatus -> POSIX -> ExecutionListItem)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"stopDate")
            Parser
  (Text
   -> Text -> Text -> ExecutionStatus -> POSIX -> ExecutionListItem)
-> Parser Text
-> Parser
     (Text -> Text -> ExecutionStatus -> POSIX -> ExecutionListItem)
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
"executionArn")
            Parser
  (Text -> Text -> ExecutionStatus -> POSIX -> ExecutionListItem)
-> Parser Text
-> Parser (Text -> ExecutionStatus -> POSIX -> ExecutionListItem)
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
"stateMachineArn")
            Parser (Text -> ExecutionStatus -> POSIX -> ExecutionListItem)
-> Parser Text
-> Parser (ExecutionStatus -> POSIX -> ExecutionListItem)
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
"name")
            Parser (ExecutionStatus -> POSIX -> ExecutionListItem)
-> Parser ExecutionStatus -> Parser (POSIX -> ExecutionListItem)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser ExecutionStatus
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"status")
            Parser (POSIX -> ExecutionListItem)
-> Parser POSIX -> Parser ExecutionListItem
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser POSIX
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"startDate")
      )

instance Prelude.Hashable ExecutionListItem

instance Prelude.NFData ExecutionListItem