startDeployment method

Future<StartDeploymentResult> startDeployment({
  1. required String appId,
  2. required String branchName,
  3. String? jobId,
  4. String? sourceUrl,
  5. SourceUrlType? sourceUrlType,
})

Starts a deployment for a manually deployed app. Manually deployed apps are not connected to a Git repository.

The maximum duration between the CreateDeployment call and the StartDeployment call cannot exceed 8 hours. If the duration exceeds 8 hours, the StartDeployment call and the associated Job will fail.

May throw BadRequestException. May throw InternalFailureException. May throw LimitExceededException. May throw NotFoundException. May throw UnauthorizedException.

Parameter appId : The unique ID for an Amplify app.

Parameter branchName : The name of the branch to use for the deployment job.

Parameter jobId : The job ID for this deployment that is generated by the CreateDeployment request.

Parameter sourceUrl : The source URL for the deployment that is used when calling StartDeployment without CreateDeployment. The source URL can be either an HTTP GET URL that is publicly accessible and downloads a single .zip file, or an Amazon S3 bucket and prefix.

Parameter sourceUrlType : The type of source specified by the sourceURL. If the value is ZIP, the source is a .zip file. If the value is BUCKET_PREFIX, the source is an Amazon S3 bucket and prefix. If no value is specified, the default is ZIP.

Implementation

Future<StartDeploymentResult> startDeployment({
  required String appId,
  required String branchName,
  String? jobId,
  String? sourceUrl,
  SourceUrlType? sourceUrlType,
}) async {
  final $payload = <String, dynamic>{
    if (jobId != null) 'jobId': jobId,
    if (sourceUrl != null) 'sourceUrl': sourceUrl,
    if (sourceUrlType != null) 'sourceUrlType': sourceUrlType.value,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/apps/${Uri.encodeComponent(appId)}/branches/${Uri.encodeComponent(branchName)}/deployments/start',
    exceptionFnMap: _exceptionFns,
  );
  return StartDeploymentResult.fromJson(response);
}