createStateMachine method
- required String definition,
- required String name,
- required String roleArn,
- LoggingConfiguration? loggingConfiguration,
- List<
Tag> ? tags, - TracingConfiguration? tracingConfiguration,
- StateMachineType? type,
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 AWS Step Functions User Guide.
May throw InvalidArn. May throw InvalidDefinition. May throw InvalidName. May throw InvalidLoggingConfiguration. May throw InvalidTracingConfiguration. May throw StateMachineAlreadyExists. May throw StateMachineDeleting. May throw StateMachineLimitExceeded. May throw StateMachineTypeNotSupported. May throw TooManyTags.
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
)
Parameter roleArn
:
The Amazon Resource Name (ARN) of the IAM role to use for this state
machine.
Parameter loggingConfiguration
:
Defines what execution history events are logged and where they are
logged.
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 AWS 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 AWS 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.
Implementation
Future<CreateStateMachineOutput> createStateMachine({
required String definition,
required String name,
required String roleArn,
LoggingConfiguration? loggingConfiguration,
List<Tag>? tags,
TracingConfiguration? tracingConfiguration,
StateMachineType? type,
}) async {
ArgumentError.checkNotNull(definition, 'definition');
_s.validateStringLength(
'definition',
definition,
1,
1048576,
isRequired: true,
);
ArgumentError.checkNotNull(name, 'name');
_s.validateStringLength(
'name',
name,
1,
80,
isRequired: true,
);
ArgumentError.checkNotNull(roleArn, 'roleArn');
_s.validateStringLength(
'roleArn',
roleArn,
1,
256,
isRequired: true,
);
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 (loggingConfiguration != null)
'loggingConfiguration': loggingConfiguration,
if (tags != null) 'tags': tags,
if (tracingConfiguration != null)
'tracingConfiguration': tracingConfiguration,
if (type != null) 'type': type.toValue(),
},
);
return CreateStateMachineOutput.fromJson(jsonResponse.body);
}