putImageScanningConfiguration method

Future<PutImageScanningConfigurationResponse> putImageScanningConfiguration({
  1. required ImageScanningConfiguration imageScanningConfiguration,
  2. required String repositoryName,
  3. String? registryId,
})

Updates the image scanning configuration for the specified repository.

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

Parameter imageScanningConfiguration : The image scanning configuration for the repository. This setting determines whether images are scanned for known vulnerabilities after being pushed to the repository.

Parameter repositoryName : The name of the repository in which to update the image scanning configuration setting.

Parameter registryId : The AWS account ID associated with the registry that contains the repository in which to update the image scanning configuration setting. If you do not specify a registry, the default registry is assumed.

Implementation

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

  return PutImageScanningConfigurationResponse.fromJson(jsonResponse.body);
}