publishStateMachineVersion method
Creates a version from the current revision of a state machine. Use versions to create immutable snapshots of your state machine. You can start executions from versions either directly or with an alias. To create an alias, use CreateStateMachineAlias.
You can publish up to 1000 versions for each state machine. You must manually delete unused versions using the DeleteStateMachineVersion API action.
PublishStateMachineVersion is an idempotent API. It doesn't
create a duplicate state machine version if it already exists for the
current revision. Step Functions bases
PublishStateMachineVersion's idempotency check on the
stateMachineArn, name, and
revisionId parameters. Requests with the same parameters
return a successful idempotent response. If you don't specify a
revisionId, Step Functions checks for a previously published
version of the state machine's current revision.
Related operations:
May throw ConflictException.
May throw InvalidArn.
May throw ServiceQuotaExceededException.
May throw StateMachineDeleting.
May throw StateMachineDoesNotExist.
May throw ValidationException.
Parameter stateMachineArn :
The Amazon Resource Name (ARN) of the state machine.
Parameter description :
An optional description of the state machine version.
Parameter revisionId :
Only publish the state machine version if the current state machine's
revision ID matches the specified ID.
Use this option to avoid publishing a version if the state machine changed
since you last updated it. If the specified revision ID doesn't match the
state machine's current revision ID, the API returns
ConflictException.
Implementation
Future<PublishStateMachineVersionOutput> publishStateMachineVersion({
required String stateMachineArn,
String? description,
String? revisionId,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.0',
'X-Amz-Target': 'AWSStepFunctions.PublishStateMachineVersion'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'stateMachineArn': stateMachineArn,
if (description != null) 'description': description,
if (revisionId != null) 'revisionId': revisionId,
},
);
return PublishStateMachineVersionOutput.fromJson(jsonResponse.body);
}