startImageScan method

Future<StartImageScanResponse> startImageScan({
  1. required ImageIdentifier imageId,
  2. required String repositoryName,
  3. String? registryId,
})

Starts a basic image vulnerability scan.

A basic image scan can only be started once per 24 hours on an individual image. This limit includes if an image was scanned on initial push. You can start up to 100,000 basic scans per 24 hours. This limit includes both scans on initial push and scans initiated by the StartImageScan API. For more information, see Basic scanning in the Amazon Elastic Container Registry User Guide.

May throw ImageArchivedException. May throw ImageNotFoundException. May throw InvalidParameterException. May throw LimitExceededException. May throw RepositoryNotFoundException. May throw ServerException. May throw UnsupportedImageTypeException. May throw ValidationException.

Parameter repositoryName : The name of the repository that contains the images to scan.

Parameter registryId : The Amazon Web Services account ID associated with the registry that contains the repository in which to start an image scan request. If you do not specify a registry, the default registry is assumed.

Implementation

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

  return StartImageScanResponse.fromJson(jsonResponse.body);
}