createScan method
Use to create a scan using code uploaded to an Amazon S3 bucket.
May throw AccessDeniedException.
May throw ConflictException.
May throw InternalServerException.
May throw ResourceNotFoundException.
May throw ThrottlingException.
May throw ValidationException.
Parameter resourceId :
The identifier for the resource object to be scanned.
Parameter scanName :
The unique name that CodeGuru Security uses to track revisions across
multiple scans of the same resource. Only allowed for a
STANDARD scan type.
Parameter analysisType :
The type of analysis you want CodeGuru Security to perform in the scan,
either Security or All. The
Security type only generates findings related to security.
The All type generates both security findings and quality
findings. Defaults to Security type if missing.
Parameter clientToken :
The idempotency token for the request. Amazon CodeGuru Security uses this
value to prevent the accidental creation of duplicate scans if there are
failures and retries.
Parameter scanType :
The type of scan, either Standard or Express.
Defaults to Standard type if missing.
Express scans run on limited resources and use a limited set
of detectors to analyze your code in near-real time. Standard
scans have standard resource limits and use the full set of detectors to
analyze your code.
Parameter tags :
An array of key-value pairs used to tag a scan. A tag is a custom
attribute label with two parts:
-
A tag key. For example,
CostCenter,Environment, orSecret. Tag keys are case sensitive. -
An optional tag value field. For example,
111122223333,Production, or a team name. Omitting the tag value is the same as using an empty string. Tag values are case sensitive.
Implementation
Future<CreateScanResponse> createScan({
required ResourceId resourceId,
required String scanName,
AnalysisType? analysisType,
String? clientToken,
ScanType? scanType,
Map<String, String>? tags,
}) async {
final $payload = <String, dynamic>{
'resourceId': resourceId,
'scanName': scanName,
if (analysisType != null) 'analysisType': analysisType.value,
'clientToken': clientToken ?? _s.generateIdempotencyToken(),
if (scanType != null) 'scanType': scanType.value,
if (tags != null) 'tags': tags,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/scans',
exceptionFnMap: _exceptionFns,
);
return CreateScanResponse.fromJson(response);
}