stopDeployment method

Future<Deployment> stopDeployment({
  1. required String applicationId,
  2. required int deploymentNumber,
  3. required String environmentId,
  4. bool? allowRevert,
})

Stops a deployment. This API action works only on deployments that have a status of DEPLOYING, unless an AllowRevert parameter is supplied. If the AllowRevert parameter is supplied, the status of an in-progress deployment will be ROLLED_BACK. The status of a completed deployment will be REVERTED. AppConfig only allows a revert within 72 hours of deployment completion.

May throw BadRequestException. May throw InternalServerException. May throw ResourceNotFoundException.

Parameter applicationId : The application ID.

Parameter deploymentNumber : The sequence number of the deployment.

Parameter environmentId : The environment ID.

Parameter allowRevert : A Boolean that enables AppConfig to rollback a COMPLETED deployment to the previous configuration version. This action moves the deployment to a status of REVERTED.

Implementation

Future<Deployment> stopDeployment({
  required String applicationId,
  required int deploymentNumber,
  required String environmentId,
  bool? allowRevert,
}) async {
  final headers = <String, String>{
    if (allowRevert != null) 'Allow-Revert': allowRevert.toString(),
  };
  final response = await _protocol.send(
    payload: null,
    method: 'DELETE',
    requestUri:
        '/applications/${Uri.encodeComponent(applicationId)}/environments/${Uri.encodeComponent(environmentId)}/deployments/${Uri.encodeComponent(deploymentNumber.toString())}',
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
  return Deployment.fromJson(response);
}