createStateMachine method
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 Amazon
States Language in the Step Functions User Guide.
If you set the publish parameter of this API action to
true, it publishes version 1 as the first
revision of the state machine.
For additional control over security, you can encrypt your data using a customer-managed key for Step Functions state machines. You can configure a symmetric KMS key and data key reuse period when creating or updating a State Machine. The execution history and state machine definition will be encrypted with the key applied to the State Machine.
May throw ConflictException.
May throw InvalidArn.
May throw InvalidDefinition.
May throw InvalidEncryptionConfiguration.
May throw InvalidLoggingConfiguration.
May throw InvalidName.
May throw InvalidTracingConfiguration.
May throw KmsAccessDeniedException.
May throw KmsThrottlingException.
May throw StateMachineAlreadyExists.
May throw StateMachineDeleting.
May throw StateMachineLimitExceeded.
May throw StateMachineTypeNotSupported.
May throw TooManyTags.
May throw ValidationException.
Parameter definition :
The Amazon States Language definition of the state machine. See Amazon
States Language.
Parameter 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,U+FFFE-FFFF) -
surrogates (
U+D800-DFFF) -
invalid characters (
U+10FFFF)
Parameter roleArn :
The Amazon Resource Name (ARN) of the IAM role to use for this state
machine.
Parameter encryptionConfiguration :
Settings to configure server-side encryption.
Parameter loggingConfiguration :
Defines what execution history events are logged and where they are
logged.
Parameter publish :
Set to true to publish the first version of the state machine
during creation. The default is false.
Parameter tags :
Tags to be added when creating a state machine.
An array of key-value pairs. For more information, see Using Cost Allocation Tags in the Amazon Web Services Billing and Cost Management User Guide, and Controlling Access Using IAM Tags.
Tags may only contain Unicode letters, digits, white space, or these
symbols: _ . : / = + - @.
Parameter tracingConfiguration :
Selects whether X-Ray tracing is enabled.
Parameter 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.
Parameter versionDescription :
Sets description about the state machine version. You can only set the
description if the publish parameter is set to
true. Otherwise, if you set versionDescription,
but publish to false, this API action throws
ValidationException.
Implementation
Future<CreateStateMachineOutput> createStateMachine({
required String definition,
required String name,
required String roleArn,
EncryptionConfiguration? encryptionConfiguration,
LoggingConfiguration? loggingConfiguration,
bool? publish,
List<Tag>? tags,
TracingConfiguration? tracingConfiguration,
StateMachineType? type,
String? versionDescription,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.0',
'X-Amz-Target': 'AWSStepFunctions.CreateStateMachine'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'definition': definition,
'name': name,
'roleArn': roleArn,
if (encryptionConfiguration != null)
'encryptionConfiguration': encryptionConfiguration,
if (loggingConfiguration != null)
'loggingConfiguration': loggingConfiguration,
if (publish != null) 'publish': publish,
if (tags != null) 'tags': tags,
if (tracingConfiguration != null)
'tracingConfiguration': tracingConfiguration,
if (type != null) 'type': type.value,
if (versionDescription != null)
'versionDescription': versionDescription,
},
);
return CreateStateMachineOutput.fromJson(jsonResponse.body);
}