startDeployment method

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

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

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

Parameter appId : The unique ID for an Amplify app.

Parameter branchName : The name for the branch, for the job.

Parameter jobId : The job ID for this deployment, generated by the create deployment request.

Parameter sourceUrl : The source URL for this deployment, used when calling start deployment without create deployment. The source URL can be any HTTP GET URL that is publicly accessible and downloads a single .zip file.

Implementation

Future<StartDeploymentResult> startDeployment({
  required String appId,
  required String branchName,
  String? jobId,
  String? sourceUrl,
}) async {
  ArgumentError.checkNotNull(appId, 'appId');
  _s.validateStringLength(
    'appId',
    appId,
    1,
    20,
    isRequired: true,
  );
  ArgumentError.checkNotNull(branchName, 'branchName');
  _s.validateStringLength(
    'branchName',
    branchName,
    1,
    255,
    isRequired: true,
  );
  _s.validateStringLength(
    'jobId',
    jobId,
    0,
    255,
  );
  _s.validateStringLength(
    'sourceUrl',
    sourceUrl,
    0,
    1000,
  );
  final $payload = <String, dynamic>{
    if (jobId != null) 'jobId': jobId,
    if (sourceUrl != null) 'sourceUrl': sourceUrl,
  };
  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);
}