rollbackStack method

Future<RollbackStackOutput> rollbackStack({
  1. required String stackName,
  2. String? clientRequestToken,
  3. bool? retainExceptOnCreate,
  4. String? roleARN,
})

When specifying RollbackStack, you preserve the state of previously provisioned resources when an operation fails. You can check the status of the stack through the DescribeStacks operation.

Rolls back the specified stack to the last known stable state from CREATE_FAILED or UPDATE_FAILED stack statuses.

This operation will delete a stack if it doesn't contain a last known stable state. A last known stable state includes any status in a *_COMPLETE. This includes the following stack statuses.

  • CREATE_COMPLETE
  • UPDATE_COMPLETE
  • UPDATE_ROLLBACK_COMPLETE
  • IMPORT_COMPLETE
  • IMPORT_ROLLBACK_COMPLETE

May throw TokenAlreadyExistsException.

Parameter stackName : The name that's associated with the stack.

Parameter clientRequestToken : A unique identifier for this RollbackStack request.

Parameter retainExceptOnCreate : When set to true, newly created resources are deleted when the operation rolls back. This includes newly created resources marked with a deletion policy of Retain.

Default: false

Parameter roleARN : The Amazon Resource Name (ARN) of an IAM role that CloudFormation assumes to rollback the stack.

Implementation

Future<RollbackStackOutput> rollbackStack({
  required String stackName,
  String? clientRequestToken,
  bool? retainExceptOnCreate,
  String? roleARN,
}) async {
  final $request = <String, String>{
    'StackName': stackName,
    if (clientRequestToken != null) 'ClientRequestToken': clientRequestToken,
    if (retainExceptOnCreate != null)
      'RetainExceptOnCreate': retainExceptOnCreate.toString(),
    if (roleARN != null) 'RoleARN': roleARN,
  };
  final $result = await _protocol.send(
    $request,
    action: 'RollbackStack',
    version: '2010-05-15',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    resultWrapper: 'RollbackStackResult',
  );
  return RollbackStackOutput.fromXml($result);
}