uploadLayerPart method
Uploads an image layer part to Amazon ECR.
When an image is pushed, each new image layer is uploaded in parts. The maximum size of each image layer part can be 20971520 bytes (about 20MB). The UploadLayerPart API is called once for each new image layer part.
May throw InvalidLayerPartException.
May throw InvalidParameterException.
May throw LimitExceededException.
May throw RegistryNotFoundException.
May throw RepositoryNotFoundException.
May throw ServerException.
May throw UnsupportedCommandException.
May throw UploadNotFoundException.
Parameter layerPartBlob :
The base64-encoded layer part payload.
Parameter partFirstByte :
The position of the first byte of the layer part witin the overall image
layer.
Parameter partLastByte :
The position of the last byte of the layer part within the overall image
layer.
Parameter repositoryName :
The name of the repository that you're uploading layer parts to.
Parameter uploadId :
The upload ID from a previous InitiateLayerUpload operation to
associate with the layer part upload.
Parameter registryId :
The Amazon Web Services account ID, or registry alias, that's associated
with the registry that you're uploading layer parts to. If you do not
specify a registry, the default public registry is assumed.
Implementation
Future<UploadLayerPartResponse> uploadLayerPart({
required Uint8List layerPartBlob,
required int partFirstByte,
required int partLastByte,
required String repositoryName,
required String uploadId,
String? registryId,
}) async {
_s.validateNumRange(
'partFirstByte',
partFirstByte,
0,
1152921504606846976,
isRequired: true,
);
_s.validateNumRange(
'partLastByte',
partLastByte,
0,
1152921504606846976,
isRequired: true,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'SpencerFrontendService.UploadLayerPart'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'layerPartBlob': base64Encode(layerPartBlob),
'partFirstByte': partFirstByte,
'partLastByte': partLastByte,
'repositoryName': repositoryName,
'uploadId': uploadId,
if (registryId != null) 'registryId': registryId,
},
);
return UploadLayerPartResponse.fromJson(jsonResponse.body);
}