completeLayerUpload method

Future<CompleteLayerUploadResponse> completeLayerUpload({
  1. required List<String> layerDigests,
  2. required String repositoryName,
  3. required String uploadId,
  4. String? registryId,
})

Informs Amazon ECR that the image layer upload is complete for a specified public registry, repository name, and upload ID. You can optionally provide a sha256 digest of the image layer for data validation purposes.

When an image is pushed, the CompleteLayerUpload API is called once for each new image layer to verify that the upload is complete.

May throw EmptyUploadException. May throw InvalidLayerException. May throw InvalidParameterException. May throw LayerAlreadyExistsException. May throw LayerPartTooSmallException. May throw RegistryNotFoundException. May throw RepositoryNotFoundException. May throw ServerException. May throw UnsupportedCommandException. May throw UploadNotFoundException.

Parameter layerDigests : The sha256 digest of the image layer.

Parameter repositoryName : The name of the repository in a public registry to associate with the image layer.

Parameter uploadId : The upload ID from a previous InitiateLayerUpload operation to associate with the image layer.

Parameter registryId : The Amazon Web Services account ID, or registry alias, associated with the registry where layers are uploaded. If you do not specify a registry, the default public registry is assumed.

Implementation

Future<CompleteLayerUploadResponse> completeLayerUpload({
  required List<String> layerDigests,
  required String repositoryName,
  required String uploadId,
  String? registryId,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'SpencerFrontendService.CompleteLayerUpload'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'layerDigests': layerDigests,
      'repositoryName': repositoryName,
      'uploadId': uploadId,
      if (registryId != null) 'registryId': registryId,
    },
  );

  return CompleteLayerUploadResponse.fromJson(jsonResponse.body);
}