createDeployment method

Future<CreateDeploymentResult> createDeployment({
  1. required String appId,
  2. required String branchName,
  3. Map<String, String>? fileMap,
})

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

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

Parameter appId : The unique ID for an Amplify app.

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

Parameter fileMap : An optional file map that contains the file name as the key and the file content md5 hash as the value. If this argument is provided, the service will generate a unique upload URL per file. Otherwise, the service will only generate a single upload URL for the zipped files.

Implementation

Future<CreateDeploymentResult> createDeployment({
  required String appId,
  required String branchName,
  Map<String, String>? fileMap,
}) 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,
  );
  final $payload = <String, dynamic>{
    if (fileMap != null) 'fileMap': fileMap,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/apps/${Uri.encodeComponent(appId)}/branches/${Uri.encodeComponent(branchName)}/deployments',
    exceptionFnMap: _exceptionFns,
  );
  return CreateDeploymentResult.fromJson(response);
}