filters
Creates, updates, deletes or gets a filter resource or lists filters in a region
Overview
| Name | filters |
| Type | Resource |
| Description | Inspector Filter resource schema |
| Id | awscc.inspectorv2.filters |
Fields
- get (all properties)
- list (identifiers only)
| Name | Datatype | Description |
|---|---|---|
name | string | Findings filter name. |
description | string | Findings filter description. |
filter_criteria | object | Findings filter criteria. |
filter_action | string | Findings filter action. |
arn | string | Findings filter ARN. |
tags | object | |
region | string | AWS region. |
| Name | Datatype | Description |
|---|---|---|
arn | string | Findings filter ARN. |
region | string | AWS region. |
For more information, see AWS::InspectorV2::Filter.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | filters | INSERT | Name, FilterCriteria, FilterAction, region |
delete_resource | filters | DELETE | Identifier, region |
update_resource | filters | UPDATE | Identifier, PatchDocument, region |
list_resources | filters_list_only | SELECT | region |
get_resource | filters | SELECT | Identifier, region |
SELECT examples
- get (all properties)
- list (identifiers only)
Gets all properties from an individual filter.
SELECT
region,
name,
description,
filter_criteria,
filter_action,
arn,
tags
FROM awscc.inspectorv2.filters
WHERE
region = '{{ region }}' AND
Identifier = '{{ arn }}';
Lists all filters in a region.
SELECT
region,
arn
FROM awscc.inspectorv2.filters_list_only
WHERE
region = '{{ region }}';
INSERT example
Use the following StackQL query and manifest file to create a new filter resource, using stack-deploy.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO awscc.inspectorv2.filters (
Name,
FilterCriteria,
FilterAction,
region
)
SELECT
'{{ name }}',
'{{ filter_criteria }}',
'{{ filter_action }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
/*+ create */
INSERT INTO awscc.inspectorv2.filters (
Name,
Description,
FilterCriteria,
FilterAction,
Tags,
region
)
SELECT
'{{ name }}',
'{{ description }}',
'{{ filter_criteria }}',
'{{ filter_action }}',
'{{ tags }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: filter
props:
- name: name
value: '{{ name }}'
- name: description
value: '{{ description }}'
- name: filter_criteria
value:
aws_account_id:
- comparison: '{{ comparison }}'
value: '{{ value }}'
code_vulnerability_detector_name: null
code_vulnerability_detector_tags: null
code_vulnerability_file_path: null
component_id: null
component_type: null
ec2_instance_image_id: null
ec2_instance_subnet_id: null
ec2_instance_vpc_id: null
ecr_image_architecture: null
ecr_image_hash: null
ecr_image_pushed_at:
- end_inclusive: '{{ end_inclusive }}'
start_inclusive: null
ecr_image_registry: null
ecr_image_repository_name: null
ecr_image_tags: null
epss_score:
- lower_inclusive: null
upper_inclusive: null
exploit_available: null
finding_arn: null
finding_status: null
finding_type: null
first_observed_at: null
fix_available: null
inspector_score: null
lambda_function_execution_role_arn: null
lambda_function_last_modified_at: null
lambda_function_layers: null
lambda_function_name: null
lambda_function_runtime: null
last_observed_at: null
network_protocol: null
port_range:
- begin_inclusive: '{{ begin_inclusive }}'
end_inclusive: null
related_vulnerabilities: null
resource_id: null
resource_tags:
- comparison: '{{ comparison }}'
key: '{{ key }}'
value: '{{ value }}'
resource_type: null
severity: null
title: null
updated_at: null
vendor_severity: null
vulnerability_id: null
vulnerability_source: null
vulnerable_packages:
- architecture: null
epoch: null
file_path: null
name: null
release: null
source_lambda_layer_arn: null
source_layer_hash: null
version: null
- name: filter_action
value: '{{ filter_action }}'
- name: tags
value: {}
UPDATE example
Use the following StackQL query and manifest file to update a filter resource, using stack-deploy.
/*+ update */
UPDATE awscc.inspectorv2.filters
SET PatchDocument = string('{{ {
"Name": name,
"Description": description,
"FilterCriteria": filter_criteria,
"FilterAction": filter_action,
"Tags": tags
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ arn }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
DELETE example
/*+ delete */
DELETE FROM awscc.inspectorv2.filters
WHERE
Identifier = '{{ arn }}' AND
region = '{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
Additional Parameters
Mutable resources in the Cloud Control provider support additional optional parameters which can be supplied with INSERT, UPDATE, or DELETE operations. These include:
| Parameter | Description |
|---|---|
ClientToken | A unique identifier to ensure the idempotency of the resource request.This allows the provider to accurately distinguish between retries and new requests.A client token is valid for 36 hours once used. After that, a resource request with the same client token is treated as a new request. If you do not specify a client token, one is generated for inclusion in the request. |
RoleArn | The ARN of the IAM role used to perform this resource operation.The role specified must have the permissions required for this operation.If you do not specify a role, a temporary session is created using your AWS user credentials. |
TypeVersionId | For private resource types, the type version to use in this resource operation.If you do not specify a resource version, the default version is used. |
Permissions
To operate on the filters resource, the following permissions are required:
- Create
- Read
- Update
- Delete
- List
inspector2:CreateFilter,
inspector2:ListFilters,
inspector2:TagResource
inspector2:ListFilters,
inspector2:ListTagsForResource
inspector2:ListFilters,
inspector2:UpdateFilter,
inspector2:TagResource,
inspector2:UntagResource,
inspector2:ListTagsForResource
inspector2:DeleteFilter,
inspector2:ListFilters
inspector2:ListFilters