{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# 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.CreateStateMachine
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates a state machine. A state machine consists of a collection of
-- states that can do work (@Task@ states), determine to which states to
-- transition next (@Choice@ states), stop an execution with an error
-- (@Fail@ states), and so on. State machines are specified using a
-- JSON-based, structured language. For more information, see
-- <https://docs.aws.amazon.com/step-functions/latest/dg/concepts-amazon-states-language.html Amazon States Language>
-- in the Step Functions User Guide.
--
-- This operation is eventually consistent. The results are best effort and
-- may not reflect very recent updates and changes.
--
-- @CreateStateMachine@ is an idempotent API. Subsequent requests won’t
-- create a duplicate resource if it was already created.
-- @CreateStateMachine@\'s idempotency check is based on the state machine
-- @name@, @definition@, @type@, @LoggingConfiguration@ and
-- @TracingConfiguration@. If a following request has a different @roleArn@
-- or @tags@, Step Functions will ignore these differences and treat it as
-- an idempotent request of the previous. In this case, @roleArn@ and
-- @tags@ will not be updated, even if they are different.
module Amazonka.StepFunctions.CreateStateMachine
  ( -- * Creating a Request
    CreateStateMachine (..),
    newCreateStateMachine,

    -- * Request Lenses
    createStateMachine_loggingConfiguration,
    createStateMachine_tags,
    createStateMachine_tracingConfiguration,
    createStateMachine_type,
    createStateMachine_name,
    createStateMachine_definition,
    createStateMachine_roleArn,

    -- * Destructuring the Response
    CreateStateMachineResponse (..),
    newCreateStateMachineResponse,

    -- * Response Lenses
    createStateMachineResponse_httpStatus,
    createStateMachineResponse_stateMachineArn,
    createStateMachineResponse_creationDate,
  )
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 qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.StepFunctions.Types

-- | /See:/ 'newCreateStateMachine' smart constructor.
data CreateStateMachine = CreateStateMachine'
  { -- | Defines what execution history events are logged and where they are
    -- logged.
    --
    -- By default, the @level@ is set to @OFF@. For more information see
    -- <https://docs.aws.amazon.com/step-functions/latest/dg/cloudwatch-log-level.html Log Levels>
    -- in the Step Functions User Guide.
    CreateStateMachine -> Maybe LoggingConfiguration
loggingConfiguration :: Prelude.Maybe LoggingConfiguration,
    -- | Tags to be added when creating a state machine.
    --
    -- An array of key-value pairs. For more information, see
    -- <https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/cost-alloc-tags.html Using Cost Allocation Tags>
    -- in the /Amazon Web Services Billing and Cost Management User Guide/, and
    -- <https://docs.aws.amazon.com/IAM/latest/UserGuide/access_iam-tags.html Controlling Access Using IAM Tags>.
    --
    -- Tags may only contain Unicode letters, digits, white space, or these
    -- symbols: @_ . : \/ = + - \@@.
    CreateStateMachine -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | Selects whether X-Ray tracing is enabled.
    CreateStateMachine -> Maybe TracingConfiguration
tracingConfiguration :: Prelude.Maybe TracingConfiguration,
    -- | Determines whether a Standard or Express state machine is created. The
    -- default is @STANDARD@. You cannot update the @type@ of a state machine
    -- once it has been created.
    CreateStateMachine -> Maybe StateMachineType
type' :: Prelude.Maybe StateMachineType,
    -- | The name of the state machine.
    --
    -- 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 _.
    CreateStateMachine -> Text
name :: Prelude.Text,
    -- | The Amazon States Language definition of the state machine. See
    -- <https://docs.aws.amazon.com/step-functions/latest/dg/concepts-amazon-states-language.html Amazon States Language>.
    CreateStateMachine -> Sensitive Text
definition :: Data.Sensitive Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the IAM role to use for this state
    -- machine.
    CreateStateMachine -> Text
roleArn :: Prelude.Text
  }
  deriving (CreateStateMachine -> CreateStateMachine -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateStateMachine -> CreateStateMachine -> Bool
$c/= :: CreateStateMachine -> CreateStateMachine -> Bool
== :: CreateStateMachine -> CreateStateMachine -> Bool
$c== :: CreateStateMachine -> CreateStateMachine -> Bool
Prelude.Eq, Int -> CreateStateMachine -> ShowS
[CreateStateMachine] -> ShowS
CreateStateMachine -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateStateMachine] -> ShowS
$cshowList :: [CreateStateMachine] -> ShowS
show :: CreateStateMachine -> String
$cshow :: CreateStateMachine -> String
showsPrec :: Int -> CreateStateMachine -> ShowS
$cshowsPrec :: Int -> CreateStateMachine -> ShowS
Prelude.Show, forall x. Rep CreateStateMachine x -> CreateStateMachine
forall x. CreateStateMachine -> Rep CreateStateMachine x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateStateMachine x -> CreateStateMachine
$cfrom :: forall x. CreateStateMachine -> Rep CreateStateMachine x
Prelude.Generic)

-- |
-- Create a value of 'CreateStateMachine' 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:
--
-- 'loggingConfiguration', 'createStateMachine_loggingConfiguration' - Defines what execution history events are logged and where they are
-- logged.
--
-- By default, the @level@ is set to @OFF@. For more information see
-- <https://docs.aws.amazon.com/step-functions/latest/dg/cloudwatch-log-level.html Log Levels>
-- in the Step Functions User Guide.
--
-- 'tags', 'createStateMachine_tags' - Tags to be added when creating a state machine.
--
-- An array of key-value pairs. For more information, see
-- <https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/cost-alloc-tags.html Using Cost Allocation Tags>
-- in the /Amazon Web Services Billing and Cost Management User Guide/, and
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/access_iam-tags.html Controlling Access Using IAM Tags>.
--
-- Tags may only contain Unicode letters, digits, white space, or these
-- symbols: @_ . : \/ = + - \@@.
--
-- 'tracingConfiguration', 'createStateMachine_tracingConfiguration' - Selects whether X-Ray tracing is enabled.
--
-- 'type'', 'createStateMachine_type' - Determines whether a Standard or Express state machine is created. The
-- default is @STANDARD@. You cannot update the @type@ of a state machine
-- once it has been created.
--
-- 'name', 'createStateMachine_name' - The name of the state machine.
--
-- 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 _.
--
-- 'definition', 'createStateMachine_definition' - The Amazon States Language definition of the state machine. See
-- <https://docs.aws.amazon.com/step-functions/latest/dg/concepts-amazon-states-language.html Amazon States Language>.
--
-- 'roleArn', 'createStateMachine_roleArn' - The Amazon Resource Name (ARN) of the IAM role to use for this state
-- machine.
newCreateStateMachine ::
  -- | 'name'
  Prelude.Text ->
  -- | 'definition'
  Prelude.Text ->
  -- | 'roleArn'
  Prelude.Text ->
  CreateStateMachine
newCreateStateMachine :: Text -> Text -> Text -> CreateStateMachine
newCreateStateMachine Text
pName_ Text
pDefinition_ Text
pRoleArn_ =
  CreateStateMachine'
    { $sel:loggingConfiguration:CreateStateMachine' :: Maybe LoggingConfiguration
loggingConfiguration =
        forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateStateMachine' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing,
      $sel:tracingConfiguration:CreateStateMachine' :: Maybe TracingConfiguration
tracingConfiguration = forall a. Maybe a
Prelude.Nothing,
      $sel:type':CreateStateMachine' :: Maybe StateMachineType
type' = forall a. Maybe a
Prelude.Nothing,
      $sel:name:CreateStateMachine' :: Text
name = Text
pName_,
      $sel:definition:CreateStateMachine' :: Sensitive Text
definition = forall a. Iso' (Sensitive a) a
Data._Sensitive forall t b. AReview t b -> b -> t
Lens.# Text
pDefinition_,
      $sel:roleArn:CreateStateMachine' :: Text
roleArn = Text
pRoleArn_
    }

-- | Defines what execution history events are logged and where they are
-- logged.
--
-- By default, the @level@ is set to @OFF@. For more information see
-- <https://docs.aws.amazon.com/step-functions/latest/dg/cloudwatch-log-level.html Log Levels>
-- in the Step Functions User Guide.
createStateMachine_loggingConfiguration :: Lens.Lens' CreateStateMachine (Prelude.Maybe LoggingConfiguration)
createStateMachine_loggingConfiguration :: Lens' CreateStateMachine (Maybe LoggingConfiguration)
createStateMachine_loggingConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStateMachine' {Maybe LoggingConfiguration
loggingConfiguration :: Maybe LoggingConfiguration
$sel:loggingConfiguration:CreateStateMachine' :: CreateStateMachine -> Maybe LoggingConfiguration
loggingConfiguration} -> Maybe LoggingConfiguration
loggingConfiguration) (\s :: CreateStateMachine
s@CreateStateMachine' {} Maybe LoggingConfiguration
a -> CreateStateMachine
s {$sel:loggingConfiguration:CreateStateMachine' :: Maybe LoggingConfiguration
loggingConfiguration = Maybe LoggingConfiguration
a} :: CreateStateMachine)

-- | Tags to be added when creating a state machine.
--
-- An array of key-value pairs. For more information, see
-- <https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/cost-alloc-tags.html Using Cost Allocation Tags>
-- in the /Amazon Web Services Billing and Cost Management User Guide/, and
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/access_iam-tags.html Controlling Access Using IAM Tags>.
--
-- Tags may only contain Unicode letters, digits, white space, or these
-- symbols: @_ . : \/ = + - \@@.
createStateMachine_tags :: Lens.Lens' CreateStateMachine (Prelude.Maybe [Tag])
createStateMachine_tags :: Lens' CreateStateMachine (Maybe [Tag])
createStateMachine_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStateMachine' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateStateMachine' :: CreateStateMachine -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateStateMachine
s@CreateStateMachine' {} Maybe [Tag]
a -> CreateStateMachine
s {$sel:tags:CreateStateMachine' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateStateMachine) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Selects whether X-Ray tracing is enabled.
createStateMachine_tracingConfiguration :: Lens.Lens' CreateStateMachine (Prelude.Maybe TracingConfiguration)
createStateMachine_tracingConfiguration :: Lens' CreateStateMachine (Maybe TracingConfiguration)
createStateMachine_tracingConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStateMachine' {Maybe TracingConfiguration
tracingConfiguration :: Maybe TracingConfiguration
$sel:tracingConfiguration:CreateStateMachine' :: CreateStateMachine -> Maybe TracingConfiguration
tracingConfiguration} -> Maybe TracingConfiguration
tracingConfiguration) (\s :: CreateStateMachine
s@CreateStateMachine' {} Maybe TracingConfiguration
a -> CreateStateMachine
s {$sel:tracingConfiguration:CreateStateMachine' :: Maybe TracingConfiguration
tracingConfiguration = Maybe TracingConfiguration
a} :: CreateStateMachine)

-- | Determines whether a Standard or Express state machine is created. The
-- default is @STANDARD@. You cannot update the @type@ of a state machine
-- once it has been created.
createStateMachine_type :: Lens.Lens' CreateStateMachine (Prelude.Maybe StateMachineType)
createStateMachine_type :: Lens' CreateStateMachine (Maybe StateMachineType)
createStateMachine_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStateMachine' {Maybe StateMachineType
type' :: Maybe StateMachineType
$sel:type':CreateStateMachine' :: CreateStateMachine -> Maybe StateMachineType
type'} -> Maybe StateMachineType
type') (\s :: CreateStateMachine
s@CreateStateMachine' {} Maybe StateMachineType
a -> CreateStateMachine
s {$sel:type':CreateStateMachine' :: Maybe StateMachineType
type' = Maybe StateMachineType
a} :: CreateStateMachine)

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

-- | The Amazon States Language definition of the state machine. See
-- <https://docs.aws.amazon.com/step-functions/latest/dg/concepts-amazon-states-language.html Amazon States Language>.
createStateMachine_definition :: Lens.Lens' CreateStateMachine Prelude.Text
createStateMachine_definition :: Lens' CreateStateMachine Text
createStateMachine_definition = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStateMachine' {Sensitive Text
definition :: Sensitive Text
$sel:definition:CreateStateMachine' :: CreateStateMachine -> Sensitive Text
definition} -> Sensitive Text
definition) (\s :: CreateStateMachine
s@CreateStateMachine' {} Sensitive Text
a -> CreateStateMachine
s {$sel:definition:CreateStateMachine' :: Sensitive Text
definition = Sensitive Text
a} :: CreateStateMachine) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a. Iso' (Sensitive a) a
Data._Sensitive

-- | The Amazon Resource Name (ARN) of the IAM role to use for this state
-- machine.
createStateMachine_roleArn :: Lens.Lens' CreateStateMachine Prelude.Text
createStateMachine_roleArn :: Lens' CreateStateMachine Text
createStateMachine_roleArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStateMachine' {Text
roleArn :: Text
$sel:roleArn:CreateStateMachine' :: CreateStateMachine -> Text
roleArn} -> Text
roleArn) (\s :: CreateStateMachine
s@CreateStateMachine' {} Text
a -> CreateStateMachine
s {$sel:roleArn:CreateStateMachine' :: Text
roleArn = Text
a} :: CreateStateMachine)

instance Core.AWSRequest CreateStateMachine where
  type
    AWSResponse CreateStateMachine =
      CreateStateMachineResponse
  request :: (Service -> Service)
-> CreateStateMachine -> Request CreateStateMachine
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateStateMachine
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateStateMachine)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Int -> Text -> POSIX -> CreateStateMachineResponse
CreateStateMachineResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String 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 -> Either String a
Data..:> Key
"creationDate")
      )

instance Prelude.Hashable CreateStateMachine where
  hashWithSalt :: Int -> CreateStateMachine -> Int
hashWithSalt Int
_salt CreateStateMachine' {Maybe [Tag]
Maybe LoggingConfiguration
Maybe StateMachineType
Maybe TracingConfiguration
Text
Sensitive Text
roleArn :: Text
definition :: Sensitive Text
name :: Text
type' :: Maybe StateMachineType
tracingConfiguration :: Maybe TracingConfiguration
tags :: Maybe [Tag]
loggingConfiguration :: Maybe LoggingConfiguration
$sel:roleArn:CreateStateMachine' :: CreateStateMachine -> Text
$sel:definition:CreateStateMachine' :: CreateStateMachine -> Sensitive Text
$sel:name:CreateStateMachine' :: CreateStateMachine -> Text
$sel:type':CreateStateMachine' :: CreateStateMachine -> Maybe StateMachineType
$sel:tracingConfiguration:CreateStateMachine' :: CreateStateMachine -> Maybe TracingConfiguration
$sel:tags:CreateStateMachine' :: CreateStateMachine -> Maybe [Tag]
$sel:loggingConfiguration:CreateStateMachine' :: CreateStateMachine -> Maybe LoggingConfiguration
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe LoggingConfiguration
loggingConfiguration
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TracingConfiguration
tracingConfiguration
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe StateMachineType
type'
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Sensitive Text
definition
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
roleArn

instance Prelude.NFData CreateStateMachine where
  rnf :: CreateStateMachine -> ()
rnf CreateStateMachine' {Maybe [Tag]
Maybe LoggingConfiguration
Maybe StateMachineType
Maybe TracingConfiguration
Text
Sensitive Text
roleArn :: Text
definition :: Sensitive Text
name :: Text
type' :: Maybe StateMachineType
tracingConfiguration :: Maybe TracingConfiguration
tags :: Maybe [Tag]
loggingConfiguration :: Maybe LoggingConfiguration
$sel:roleArn:CreateStateMachine' :: CreateStateMachine -> Text
$sel:definition:CreateStateMachine' :: CreateStateMachine -> Sensitive Text
$sel:name:CreateStateMachine' :: CreateStateMachine -> Text
$sel:type':CreateStateMachine' :: CreateStateMachine -> Maybe StateMachineType
$sel:tracingConfiguration:CreateStateMachine' :: CreateStateMachine -> Maybe TracingConfiguration
$sel:tags:CreateStateMachine' :: CreateStateMachine -> Maybe [Tag]
$sel:loggingConfiguration:CreateStateMachine' :: CreateStateMachine -> Maybe LoggingConfiguration
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe LoggingConfiguration
loggingConfiguration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Tag]
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TracingConfiguration
tracingConfiguration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe StateMachineType
type'
      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 Sensitive Text
definition
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
roleArn

instance Data.ToHeaders CreateStateMachine where
  toHeaders :: CreateStateMachine -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AWSStepFunctions.CreateStateMachine" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.0" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON CreateStateMachine where
  toJSON :: CreateStateMachine -> Value
toJSON CreateStateMachine' {Maybe [Tag]
Maybe LoggingConfiguration
Maybe StateMachineType
Maybe TracingConfiguration
Text
Sensitive Text
roleArn :: Text
definition :: Sensitive Text
name :: Text
type' :: Maybe StateMachineType
tracingConfiguration :: Maybe TracingConfiguration
tags :: Maybe [Tag]
loggingConfiguration :: Maybe LoggingConfiguration
$sel:roleArn:CreateStateMachine' :: CreateStateMachine -> Text
$sel:definition:CreateStateMachine' :: CreateStateMachine -> Sensitive Text
$sel:name:CreateStateMachine' :: CreateStateMachine -> Text
$sel:type':CreateStateMachine' :: CreateStateMachine -> Maybe StateMachineType
$sel:tracingConfiguration:CreateStateMachine' :: CreateStateMachine -> Maybe TracingConfiguration
$sel:tags:CreateStateMachine' :: CreateStateMachine -> Maybe [Tag]
$sel:loggingConfiguration:CreateStateMachine' :: CreateStateMachine -> Maybe LoggingConfiguration
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"loggingConfiguration" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe LoggingConfiguration
loggingConfiguration,
            (Key
"tags" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
            (Key
"tracingConfiguration" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe TracingConfiguration
tracingConfiguration,
            (Key
"type" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe StateMachineType
type',
            forall a. a -> Maybe a
Prelude.Just (Key
"name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name),
            forall a. a -> Maybe a
Prelude.Just (Key
"definition" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Sensitive Text
definition),
            forall a. a -> Maybe a
Prelude.Just (Key
"roleArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
roleArn)
          ]
      )

instance Data.ToPath CreateStateMachine where
  toPath :: CreateStateMachine -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Data.ToQuery CreateStateMachine where
  toQuery :: CreateStateMachine -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newCreateStateMachineResponse' smart constructor.
data CreateStateMachineResponse = CreateStateMachineResponse'
  { -- | The response's http status code.
    CreateStateMachineResponse -> Int
httpStatus :: Prelude.Int,
    -- | The Amazon Resource Name (ARN) that identifies the created state
    -- machine.
    CreateStateMachineResponse -> Text
stateMachineArn :: Prelude.Text,
    -- | The date the state machine is created.
    CreateStateMachineResponse -> POSIX
creationDate :: Data.POSIX
  }
  deriving (CreateStateMachineResponse -> CreateStateMachineResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateStateMachineResponse -> CreateStateMachineResponse -> Bool
$c/= :: CreateStateMachineResponse -> CreateStateMachineResponse -> Bool
== :: CreateStateMachineResponse -> CreateStateMachineResponse -> Bool
$c== :: CreateStateMachineResponse -> CreateStateMachineResponse -> Bool
Prelude.Eq, ReadPrec [CreateStateMachineResponse]
ReadPrec CreateStateMachineResponse
Int -> ReadS CreateStateMachineResponse
ReadS [CreateStateMachineResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateStateMachineResponse]
$creadListPrec :: ReadPrec [CreateStateMachineResponse]
readPrec :: ReadPrec CreateStateMachineResponse
$creadPrec :: ReadPrec CreateStateMachineResponse
readList :: ReadS [CreateStateMachineResponse]
$creadList :: ReadS [CreateStateMachineResponse]
readsPrec :: Int -> ReadS CreateStateMachineResponse
$creadsPrec :: Int -> ReadS CreateStateMachineResponse
Prelude.Read, Int -> CreateStateMachineResponse -> ShowS
[CreateStateMachineResponse] -> ShowS
CreateStateMachineResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateStateMachineResponse] -> ShowS
$cshowList :: [CreateStateMachineResponse] -> ShowS
show :: CreateStateMachineResponse -> String
$cshow :: CreateStateMachineResponse -> String
showsPrec :: Int -> CreateStateMachineResponse -> ShowS
$cshowsPrec :: Int -> CreateStateMachineResponse -> ShowS
Prelude.Show, forall x.
Rep CreateStateMachineResponse x -> CreateStateMachineResponse
forall x.
CreateStateMachineResponse -> Rep CreateStateMachineResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateStateMachineResponse x -> CreateStateMachineResponse
$cfrom :: forall x.
CreateStateMachineResponse -> Rep CreateStateMachineResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateStateMachineResponse' 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:
--
-- 'httpStatus', 'createStateMachineResponse_httpStatus' - The response's http status code.
--
-- 'stateMachineArn', 'createStateMachineResponse_stateMachineArn' - The Amazon Resource Name (ARN) that identifies the created state
-- machine.
--
-- 'creationDate', 'createStateMachineResponse_creationDate' - The date the state machine is created.
newCreateStateMachineResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'stateMachineArn'
  Prelude.Text ->
  -- | 'creationDate'
  Prelude.UTCTime ->
  CreateStateMachineResponse
newCreateStateMachineResponse :: Int -> Text -> UTCTime -> CreateStateMachineResponse
newCreateStateMachineResponse
  Int
pHttpStatus_
  Text
pStateMachineArn_
  UTCTime
pCreationDate_ =
    CreateStateMachineResponse'
      { $sel:httpStatus:CreateStateMachineResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:stateMachineArn:CreateStateMachineResponse' :: Text
stateMachineArn = Text
pStateMachineArn_,
        $sel:creationDate:CreateStateMachineResponse' :: POSIX
creationDate = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pCreationDate_
      }

-- | The response's http status code.
createStateMachineResponse_httpStatus :: Lens.Lens' CreateStateMachineResponse Prelude.Int
createStateMachineResponse_httpStatus :: Lens' CreateStateMachineResponse Int
createStateMachineResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStateMachineResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateStateMachineResponse' :: CreateStateMachineResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateStateMachineResponse
s@CreateStateMachineResponse' {} Int
a -> CreateStateMachineResponse
s {$sel:httpStatus:CreateStateMachineResponse' :: Int
httpStatus = Int
a} :: CreateStateMachineResponse)

-- | The Amazon Resource Name (ARN) that identifies the created state
-- machine.
createStateMachineResponse_stateMachineArn :: Lens.Lens' CreateStateMachineResponse Prelude.Text
createStateMachineResponse_stateMachineArn :: Lens' CreateStateMachineResponse Text
createStateMachineResponse_stateMachineArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStateMachineResponse' {Text
stateMachineArn :: Text
$sel:stateMachineArn:CreateStateMachineResponse' :: CreateStateMachineResponse -> Text
stateMachineArn} -> Text
stateMachineArn) (\s :: CreateStateMachineResponse
s@CreateStateMachineResponse' {} Text
a -> CreateStateMachineResponse
s {$sel:stateMachineArn:CreateStateMachineResponse' :: Text
stateMachineArn = Text
a} :: CreateStateMachineResponse)

-- | The date the state machine is created.
createStateMachineResponse_creationDate :: Lens.Lens' CreateStateMachineResponse Prelude.UTCTime
createStateMachineResponse_creationDate :: Lens' CreateStateMachineResponse UTCTime
createStateMachineResponse_creationDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStateMachineResponse' {POSIX
creationDate :: POSIX
$sel:creationDate:CreateStateMachineResponse' :: CreateStateMachineResponse -> POSIX
creationDate} -> POSIX
creationDate) (\s :: CreateStateMachineResponse
s@CreateStateMachineResponse' {} POSIX
a -> CreateStateMachineResponse
s {$sel:creationDate:CreateStateMachineResponse' :: POSIX
creationDate = POSIX
a} :: CreateStateMachineResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

instance Prelude.NFData CreateStateMachineResponse where
  rnf :: CreateStateMachineResponse -> ()
rnf CreateStateMachineResponse' {Int
Text
POSIX
creationDate :: POSIX
stateMachineArn :: Text
httpStatus :: Int
$sel:creationDate:CreateStateMachineResponse' :: CreateStateMachineResponse -> POSIX
$sel:stateMachineArn:CreateStateMachineResponse' :: CreateStateMachineResponse -> Text
$sel:httpStatus:CreateStateMachineResponse' :: CreateStateMachineResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
      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 POSIX
creationDate