batchCheckLayerAvailability method

Future<BatchCheckLayerAvailabilityResponse> batchCheckLayerAvailability({
  1. required List<String> layerDigests,
  2. required String repositoryName,
  3. String? registryId,
})

Checks the availability of one or more image layers in a repository.

When an image is pushed to a repository, each image layer is checked to verify if it has been uploaded before. If it has been uploaded, then the image layer is skipped.

May throw RepositoryNotFoundException. May throw InvalidParameterException. May throw ServerException.

Parameter layerDigests : The digests of the image layers to check.

Parameter repositoryName : The name of the repository that is associated with the image layers to check.

Parameter registryId : The AWS account ID associated with the registry that contains the image layers to check. If you do not specify a registry, the default registry is assumed.

Implementation

Future<BatchCheckLayerAvailabilityResponse> batchCheckLayerAvailability({
  required List<String> layerDigests,
  required String repositoryName,
  String? registryId,
}) async {
  ArgumentError.checkNotNull(layerDigests, 'layerDigests');
  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.BatchCheckLayerAvailability'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'layerDigests': layerDigests,
      'repositoryName': repositoryName,
      if (registryId != null) 'registryId': registryId,
    },
  );

  return BatchCheckLayerAvailabilityResponse.fromJson(jsonResponse.body);
}