scans
Creates, updates, deletes, gets or lists a scans resource.
Overview
| Name | scans |
| Type | Resource |
| Id | aws.codeguru_security.scans |
Fields
The following fields are returned by SELECT queries:
- get_scan
- list_scans
| Name | Datatype | Description |
|---|---|---|
analysis_type | string | The 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_at | string (date-time) | The time the scan was created. |
error_message | string | Details about the error that causes a scan to fail to be retrieved. |
number_of_revisions | integer (int64) | The number of times a scan has been re-run on a revised resource. |
run_id | string | UUID 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_name | string | The name of the scan. (pattern: <code>[a-zA-Z0-9-_$:.]*</code>) |
scan_name_arn | string | The ARN for the scan name. (pattern: <code>arn:aws:codeguru-security:[\S]+:[\d]{12}:scans/[a-zA-Z0-9-_$:.]*</code>) |
scan_state | string | The current state of the scan. Returns either InProgress, Successful, or Failed. (InProgress, Successful, Failed) |
updated_at | string (date-time) | The time when the scan was last updated. Only available for STANDARD scan types. |
| Name | Datatype | Description |
|---|---|---|
created_at | string (date-time) | The time when the scan was created. |
run_id | string | The identifier for the 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_name | string | The name of the scan. (pattern: <code>[a-zA-Z0-9-_$:.]*</code>) |
scan_name_arn | string | The ARN for the scan name. (pattern: <code>arn:aws:codeguru-security:[\S]+:[\d]{12}:scans/[a-zA-Z0-9-_$:.]*</code>) |
scan_state | string | The state of the scan. A scan can be In Progress, Complete, or Failed. (InProgress, Successful, Failed) |
updated_at | string (date-time) | The time the scan was last updated. A scan is updated when it is re-run. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_scan | select | scan_name, region | runId | Returns details about a scan, including whether or not a scan has completed. |
list_scans | select | region | nextToken, maxResults | Returns a list of all scans in an account. Does not return EXPRESS scans. |
create_scan | insert | region, resourceId, scanName | Use to create a scan using code uploaded to an Amazon S3 bucket. | |
create_upload_url | insert | region, scanName | Generates 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.
| Name | Datatype | Description |
|---|---|---|
region | string | AWS region (default: us-east-1) |
scan_name | string | The name of the scan you want to view details about. |
maxResults | integer | The 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. |
nextToken | string | A 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. |
runId | string | UUID 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
- get_scan
- list_scans
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 }}'
;
Returns a list of all scans in an account. Does not return EXPRESS scans.
SELECT
created_at,
run_id,
scan_name,
scan_name_arn,
scan_state,
updated_at
FROM aws.codeguru_security.scans
WHERE region = '{{ region }}' -- required
AND nextToken = '{{ nextToken }}'
AND maxResults = '{{ maxResults }}'
;
INSERT examples
- create_scan
- create_upload_url
- Manifest
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
;
Generates 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.
INSERT INTO aws.codeguru_security.scans (
scanName,
region
)
SELECT
'{{ scanName }}' /* required */,
'{{ region }}'
RETURNING
code_artifact_id,
request_headers,
s_3_url
;
# Description fields are for documentation purposes
- name: scans
props:
- name: region
value: "{{ region }}"
description: Required parameter for the scans resource.
- name: clientToken
value: "{{ clientToken }}"
- name: resourceId
description: |
The identifier for a resource object that contains resources to scan. Specifying a codeArtifactId is required to create a scan.
value:
codeArtifactId: "{{ codeArtifactId }}"
- name: scanName
value: "{{ scanName }}"
- name: scanType
value: "{{ scanType }}"
valid_values: ['Standard', 'Express']
- name: analysisType
value: "{{ analysisType }}"
valid_values: ['Security', 'All']
- name: tags
value: "{{ tags }}"