initiateLayerUpload method

Future<InitiateLayerUploadResponse> initiateLayerUpload({
  1. required String repositoryName,
  2. String? registryId,
})

Notifies Amazon ECR that you intend to upload an image layer.

When an image is pushed, the InitiateLayerUpload API is called once for each image layer that hasn't already been uploaded. Whether an image layer uploads is determined by the BatchCheckLayerAvailability API action.

May throw InvalidParameterException. May throw RegistryNotFoundException. May throw RepositoryNotFoundException. May throw ServerException. May throw UnsupportedCommandException.

Parameter repositoryName : The name of the repository that you want to upload layers to.

Parameter registryId : The Amazon Web Services account ID, or registry alias, that's associated with the registry to which you intend to upload layers. If you do not specify a registry, the default public registry is assumed.

Implementation

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

  return InitiateLayerUploadResponse.fromJson(jsonResponse.body);
}