initiateLayerUpload method
Notifies Amazon ECR that you intend to upload an image layer.
When an image is pushed, the InitiateLayerUpload API is called once per image layer that has not already been uploaded. Whether or not an image layer has been uploaded is determined by the BatchCheckLayerAvailability API action.
May throw ServerException. May throw InvalidParameterException. May throw RepositoryNotFoundException. May throw KmsException.
Parameter repositoryName
:
The name of the repository to which you intend to upload layers.
Parameter registryId
:
The AWS account ID associated with the registry to which you intend to
upload layers. If you do not specify a registry, the default registry is
assumed.
Implementation
Future<InitiateLayerUploadResponse> initiateLayerUpload({
required String repositoryName,
String? registryId,
}) async {
ArgumentError.checkNotNull(repositoryName, 'repositoryName');
_s.validateStringLength(
'repositoryName',
repositoryName,
2,
256,
isRequired: true,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AmazonEC2ContainerRegistry_V20150921.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);
}