startChangeRequestExecution method

Future<StartChangeRequestExecutionResult> startChangeRequestExecution({
  1. required String documentName,
  2. required List<Runbook> runbooks,
  3. bool? autoApprove,
  4. String? changeDetails,
  5. String? changeRequestName,
  6. String? clientToken,
  7. String? documentVersion,
  8. Map<String, List<String>>? parameters,
  9. DateTime? scheduledEndTime,
  10. DateTime? scheduledTime,
  11. List<Tag>? tags,
})
Creates a change request for Change Manager. The Automation runbooks specified in the change request run only after all required approvals for the change request have been received.

May throw AutomationDefinitionNotApprovedException. May throw AutomationDefinitionNotFoundException. May throw AutomationDefinitionVersionNotFoundException. May throw AutomationExecutionLimitExceededException. May throw IdempotentParameterMismatch. May throw InternalServerError. May throw InvalidAutomationExecutionParametersException. May throw NoLongerSupportedException.

Parameter documentName : The name of the change template document to run during the runbook workflow.

Parameter runbooks : Information about the Automation runbooks that are run during the runbook workflow.

Parameter autoApprove : Indicates whether the change request can be approved automatically without the need for manual approvals.

If AutoApprovable is enabled in a change template, then setting AutoApprove to true in StartChangeRequestExecution creates a change request that bypasses approver review.

Parameter changeDetails : User-provided details about the change. If no details are provided, content specified in the Template information section of the associated change template is added.

Parameter changeRequestName : The name of the change request associated with the runbook workflow to be run.

Parameter clientToken : The user-provided idempotency token. The token must be unique, is case insensitive, enforces the UUID format, and can't be reused.

Parameter documentVersion : The version of the change template document to run during the runbook workflow.

Parameter parameters : A key-value map of parameters that match the declared parameters in the change template document.

Parameter scheduledEndTime : The time that the requester expects the runbook workflow related to the change request to complete. The time is an estimate only that the requester provides for reviewers.

Parameter scheduledTime : The date and time specified in the change request to run the Automation runbooks.

Parameter tags : Optional metadata that you assign to a resource. You can specify a maximum of five tags for a change request. Tags enable you to categorize a resource in different ways, such as by purpose, owner, or environment. For example, you might want to tag a change request to identify an environment or target Amazon Web Services Region. In this case, you could specify the following key-value pairs:

  • Key=Environment,Value=Production
  • Key=Region,Value=us-east-2

Implementation

Future<StartChangeRequestExecutionResult> startChangeRequestExecution({
  required String documentName,
  required List<Runbook> runbooks,
  bool? autoApprove,
  String? changeDetails,
  String? changeRequestName,
  String? clientToken,
  String? documentVersion,
  Map<String, List<String>>? parameters,
  DateTime? scheduledEndTime,
  DateTime? scheduledTime,
  List<Tag>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AmazonSSM.StartChangeRequestExecution'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'DocumentName': documentName,
      'Runbooks': runbooks,
      if (autoApprove != null) 'AutoApprove': autoApprove,
      if (changeDetails != null) 'ChangeDetails': changeDetails,
      if (changeRequestName != null) 'ChangeRequestName': changeRequestName,
      if (clientToken != null) 'ClientToken': clientToken,
      if (documentVersion != null) 'DocumentVersion': documentVersion,
      if (parameters != null) 'Parameters': parameters,
      if (scheduledEndTime != null)
        'ScheduledEndTime': unixTimestampToJson(scheduledEndTime),
      if (scheduledTime != null)
        'ScheduledTime': unixTimestampToJson(scheduledTime),
      if (tags != null) 'Tags': tags,
    },
  );

  return StartChangeRequestExecutionResult.fromJson(jsonResponse.body);
}