{-# 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-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.StateExitedEventDetails 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 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 (Core.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
(StateExitedEventDetails -> StateExitedEventDetails -> Bool)
-> (StateExitedEventDetails -> StateExitedEventDetails -> Bool)
-> Eq StateExitedEventDetails
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
(Int -> StateExitedEventDetails -> ShowS)
-> (StateExitedEventDetails -> String)
-> ([StateExitedEventDetails] -> ShowS)
-> Show StateExitedEventDetails
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.
 StateExitedEventDetails -> Rep StateExitedEventDetails x)
-> (forall x.
    Rep StateExitedEventDetails x -> StateExitedEventDetails)
-> Generic StateExitedEventDetails
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' :: Maybe (Sensitive Text)
-> Maybe HistoryEventExecutionDataDetails
-> Text
-> StateExitedEventDetails
StateExitedEventDetails'
    { $sel:output:StateExitedEventDetails' :: Maybe (Sensitive Text)
output = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:outputDetails:StateExitedEventDetails' :: Maybe HistoryEventExecutionDataDetails
outputDetails = Maybe HistoryEventExecutionDataDetails
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 :: (Maybe Text -> f (Maybe Text))
-> StateExitedEventDetails -> f StateExitedEventDetails
stateExitedEventDetails_output = (StateExitedEventDetails -> Maybe (Sensitive Text))
-> (StateExitedEventDetails
    -> Maybe (Sensitive Text) -> StateExitedEventDetails)
-> Lens
     StateExitedEventDetails
     StateExitedEventDetails
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
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) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> StateExitedEventDetails -> f StateExitedEventDetails)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> StateExitedEventDetails
-> f StateExitedEventDetails
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.
stateExitedEventDetails_outputDetails :: Lens.Lens' StateExitedEventDetails (Prelude.Maybe HistoryEventExecutionDataDetails)
stateExitedEventDetails_outputDetails :: (Maybe HistoryEventExecutionDataDetails
 -> f (Maybe HistoryEventExecutionDataDetails))
-> StateExitedEventDetails -> f StateExitedEventDetails
stateExitedEventDetails_outputDetails = (StateExitedEventDetails -> Maybe HistoryEventExecutionDataDetails)
-> (StateExitedEventDetails
    -> Maybe HistoryEventExecutionDataDetails
    -> StateExitedEventDetails)
-> Lens
     StateExitedEventDetails
     StateExitedEventDetails
     (Maybe HistoryEventExecutionDataDetails)
     (Maybe HistoryEventExecutionDataDetails)
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 :: (Text -> f Text)
-> StateExitedEventDetails -> f StateExitedEventDetails
stateExitedEventDetails_name = (StateExitedEventDetails -> Text)
-> (StateExitedEventDetails -> Text -> StateExitedEventDetails)
-> Lens StateExitedEventDetails StateExitedEventDetails Text Text
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 Core.FromJSON StateExitedEventDetails where
  parseJSON :: Value -> Parser StateExitedEventDetails
parseJSON =
    String
-> (Object -> Parser StateExitedEventDetails)
-> Value
-> Parser StateExitedEventDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"StateExitedEventDetails"
      ( \Object
x ->
          Maybe (Sensitive Text)
-> Maybe HistoryEventExecutionDataDetails
-> Text
-> StateExitedEventDetails
StateExitedEventDetails'
            (Maybe (Sensitive Text)
 -> Maybe HistoryEventExecutionDataDetails
 -> Text
 -> StateExitedEventDetails)
-> Parser (Maybe (Sensitive Text))
-> Parser
     (Maybe HistoryEventExecutionDataDetails
      -> Text -> StateExitedEventDetails)
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 -> StateExitedEventDetails)
-> Parser (Maybe HistoryEventExecutionDataDetails)
-> Parser (Text -> StateExitedEventDetails)
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 -> StateExitedEventDetails)
-> Parser Text -> Parser StateExitedEventDetails
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")
      )

instance Prelude.Hashable StateExitedEventDetails

instance Prelude.NFData StateExitedEventDetails