Skip to main content

scans

Creates, updates, deletes, gets or lists a scans resource.

Overview

Namescans
TypeResource
Idaws.codeguru_security.scans

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
analysis_typestringThe type of analysis CodeGuru Security performed 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. (Security, All)
created_atstring (date-time)The time the scan was created.
error_messagestringDetails about the error that causes a scan to fail to be retrieved.
number_of_revisionsinteger (int64)The number of times a scan has been re-run on a revised resource.
run_idstringUUID that identifies the individual scan run. (pattern: <code>[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}</code>)
scan_namestringThe name of the scan. (pattern: <code>[a-zA-Z0-9-_$:.]*</code>)
scan_name_arnstringThe ARN for the scan name. (pattern: <code>arn:aws:codeguru-security:[\S]+:[\d]{12}:scans/[a-zA-Z0-9-_$:.]*</code>)
scan_statestringThe current state of the scan. Returns either InProgress, Successful, or Failed. (InProgress, Successful, Failed)
updated_atstring (date-time)The time when the scan was last updated. Only available for STANDARD scan types.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_scanselectscan_name, regionrunIdReturns details about a scan, including whether or not a scan has completed.
list_scansselectregionnextToken, maxResultsReturns a list of all scans in an account. Does not return EXPRESS scans.
create_scaninsertregion, resourceId, scanNameUse to create a scan using code uploaded to an Amazon S3 bucket.
create_upload_urlinsertregion, scanNameGenerates a pre-signed URL, request headers used to upload a code resource, and code artifact identifier for the uploaded resource. You can upload your code resource to the URL with the request headers using any HTTP client.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
regionstringAWS region (default: us-east-1)
scan_namestringThe name of the scan you want to view details about.
maxResultsintegerThe maximum number of results to return in the response. Use this parameter when paginating results. If additional results exist beyond the number you specify, the nextToken element is returned in the response. Use nextToken in a subsequent request to retrieve additional results. If not specified, returns 100 results.
nextTokenstringA token to use for paginating results that are returned in the response. Set the value of this parameter to null for the first request. For subsequent calls, use the nextToken value returned from the previous request to continue listing results after the first page.
runIdstringUUID that identifies the individual scan run you want to view details about. You retrieve this when you call the CreateScan operation. Defaults to the latest scan run if missing.

SELECT examples

Returns details about a scan, including whether or not a scan has completed.

SELECT
analysis_type,
created_at,
error_message,
number_of_revisions,
run_id,
scan_name,
scan_name_arn,
scan_state,
updated_at
FROM aws.codeguru_security.scans
WHERE scan_name = '{{ scan_name }}' -- required
AND region = '{{ region }}' -- required
AND runId = '{{ runId }}'
;

INSERT examples

Use to create a scan using code uploaded to an Amazon S3 bucket.

INSERT INTO aws.codeguru_security.scans (
clientToken,
resourceId,
scanName,
scanType,
analysisType,
tags,
region
)
SELECT
'{{ clientToken }}',
'{{ resourceId }}' /* required */,
'{{ scanName }}' /* required */,
'{{ scanType }}',
'{{ analysisType }}',
'{{ tags }}',
'{{ region }}'
RETURNING
resource_id,
run_id,
scan_name,
scan_name_arn,
scan_state
;