{-# 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.StateExitedEventDetails
-- 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.StateExitedEventDetails 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.HistoryEventExecutionDataDetails

-- | Contains details about an exit from a state during an execution.
--
-- /See:/ 'newStateExitedEventDetails' smart constructor.
data StateExitedEventDetails = StateExitedEventDetails'
  { -- | The JSON output data of the state. Length constraints apply to the
    -- payload size, and are expressed as bytes in UTF-8 encoding.
    StateExitedEventDetails -> Maybe (Sensitive Text)
output :: Prelude.Maybe (Data.Sensitive Prelude.Text),
    -- | Contains details about the output of an execution history event.
    StateExitedEventDetails -> Maybe HistoryEventExecutionDataDetails
outputDetails :: Prelude.Maybe HistoryEventExecutionDataDetails,
    -- | The name of the state.
    --
    -- 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 _.
    StateExitedEventDetails -> Text
name :: Prelude.Text
  }
  deriving (StateExitedEventDetails -> StateExitedEventDetails -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StateExitedEventDetails -> StateExitedEventDetails -> Bool
$c/= :: StateExitedEventDetails -> StateExitedEventDetails -> Bool
== :: StateExitedEventDetails -> StateExitedEventDetails -> Bool
$c== :: StateExitedEventDetails -> StateExitedEventDetails -> Bool
Prelude.Eq, Int -> StateExitedEventDetails -> ShowS
[StateExitedEventDetails] -> ShowS
StateExitedEventDetails -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StateExitedEventDetails] -> ShowS
$cshowList :: [StateExitedEventDetails] -> ShowS
show :: StateExitedEventDetails -> String
$cshow :: StateExitedEventDetails -> String
showsPrec :: Int -> StateExitedEventDetails -> ShowS
$cshowsPrec :: Int -> StateExitedEventDetails -> ShowS
Prelude.Show, forall x. Rep StateExitedEventDetails x -> StateExitedEventDetails
forall x. StateExitedEventDetails -> Rep StateExitedEventDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StateExitedEventDetails x -> StateExitedEventDetails
$cfrom :: forall x. StateExitedEventDetails -> Rep StateExitedEventDetails x
Prelude.Generic)

-- |
-- Create a value of 'StateExitedEventDetails' 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', 'stateExitedEventDetails_output' - The JSON output data of the state. Length constraints apply to the
-- payload size, and are expressed as bytes in UTF-8 encoding.
--
-- 'outputDetails', 'stateExitedEventDetails_outputDetails' - Contains details about the output of an execution history event.
--
-- 'name', 'stateExitedEventDetails_name' - The name of the state.
--
-- 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 _.
newStateExitedEventDetails ::
  -- | 'name'
  Prelude.Text ->
  StateExitedEventDetails
newStateExitedEventDetails :: Text -> StateExitedEventDetails
newStateExitedEventDetails Text
pName_ =
  StateExitedEventDetails'
    { $sel:output:StateExitedEventDetails' :: Maybe (Sensitive Text)
output = forall a. Maybe a
Prelude.Nothing,
      $sel:outputDetails:StateExitedEventDetails' :: Maybe HistoryEventExecutionDataDetails
outputDetails = forall a. Maybe a
Prelude.Nothing,
      $sel:name:StateExitedEventDetails' :: Text
name = Text
pName_
    }

-- | The JSON output data of the state. Length constraints apply to the
-- payload size, and are expressed as bytes in UTF-8 encoding.
stateExitedEventDetails_output :: Lens.Lens' StateExitedEventDetails (Prelude.Maybe Prelude.Text)
stateExitedEventDetails_output :: Lens' StateExitedEventDetails (Maybe Text)
stateExitedEventDetails_output = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StateExitedEventDetails' {Maybe (Sensitive Text)
output :: Maybe (Sensitive Text)
$sel:output:StateExitedEventDetails' :: StateExitedEventDetails -> Maybe (Sensitive Text)
output} -> Maybe (Sensitive Text)
output) (\s :: StateExitedEventDetails
s@StateExitedEventDetails' {} Maybe (Sensitive Text)
a -> StateExitedEventDetails
s {$sel:output:StateExitedEventDetails' :: Maybe (Sensitive Text)
output = Maybe (Sensitive Text)
a} :: StateExitedEventDetails) 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. Iso' (Sensitive a) a
Data._Sensitive

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

-- | The name of the state.
--
-- 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 _.
stateExitedEventDetails_name :: Lens.Lens' StateExitedEventDetails Prelude.Text
stateExitedEventDetails_name :: Lens' StateExitedEventDetails Text
stateExitedEventDetails_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StateExitedEventDetails' {Text
name :: Text
$sel:name:StateExitedEventDetails' :: StateExitedEventDetails -> Text
name} -> Text
name) (\s :: StateExitedEventDetails
s@StateExitedEventDetails' {} Text
a -> StateExitedEventDetails
s {$sel:name:StateExitedEventDetails' :: Text
name = Text
a} :: StateExitedEventDetails)

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

instance Prelude.Hashable StateExitedEventDetails where
  hashWithSalt :: Int -> StateExitedEventDetails -> Int
hashWithSalt Int
_salt StateExitedEventDetails' {Maybe (Sensitive Text)
Maybe HistoryEventExecutionDataDetails
Text
name :: Text
outputDetails :: Maybe HistoryEventExecutionDataDetails
output :: Maybe (Sensitive Text)
$sel:name:StateExitedEventDetails' :: StateExitedEventDetails -> Text
$sel:outputDetails:StateExitedEventDetails' :: StateExitedEventDetails -> Maybe HistoryEventExecutionDataDetails
$sel:output:StateExitedEventDetails' :: StateExitedEventDetails -> Maybe (Sensitive Text)
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Text)
output
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe HistoryEventExecutionDataDetails
outputDetails
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name

instance Prelude.NFData StateExitedEventDetails where
  rnf :: StateExitedEventDetails -> ()
rnf StateExitedEventDetails' {Maybe (Sensitive Text)
Maybe HistoryEventExecutionDataDetails
Text
name :: Text
outputDetails :: Maybe HistoryEventExecutionDataDetails
output :: Maybe (Sensitive Text)
$sel:name:StateExitedEventDetails' :: StateExitedEventDetails -> Text
$sel:outputDetails:StateExitedEventDetails' :: StateExitedEventDetails -> Maybe HistoryEventExecutionDataDetails
$sel:output:StateExitedEventDetails' :: StateExitedEventDetails -> Maybe (Sensitive Text)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
output
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe HistoryEventExecutionDataDetails
outputDetails
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name