Implement CollectorRule for project routing
Closed this issue · 1 comments
Add CollectorRule API that can change the project and region of resources collected in one Service Account.
A new API called CollectorRule
has been added!
CollectorRule
has a feature to change data according to set rules when cloud service is collected by Plugin.
rule_type
is set differently depending on how the CollectorRule
is added. When a user adds a CollectorRule
through API, rule_type
is set to CUSTOM
, and a rule added by Plugin metadata, it is set to MANAGED
.
In the case of a MANAGED
rule type, it cannot be changed or deleted by the user, and it is updated only by the metadata of the Plugin.
The order of CollectorRule
is also set separately for CUSTOM
and MANAGED
.
If Collector plugin collects cloud service data, it can be changed by CollectorRule
, and the order of application of rules can be changed by each order of MANAGED
, CUSTOM
.
> spacectl list inventory.CollectorRule --minimal
collector_rule_id | name | order | rule_type | collector_id
-----------------------------+----------------------------------+---------+-------------+------------------------
collector-rule-19abf41ac487 | route_project_by_aws_account_custom | 1 | CUSTOM | collector-7163022d49a1
collector-rule-0e17a4594807 | route_project_by_name_tag_custom | 2 | CUSTOM | collector-7163022d49a1
The example below is a CollectorRule
that collects data to a specified project (project-3458f667e090
) in the case of a cloud service is collected from a specific account ID (123456789012
) in AWS.
> spacectl list inventory.CollectorRule -o yaml
---
results:
- actions:
change_project: project-3458f667e090
collector_id: collector-7163022d49a1
collector_rule_id: collector-rule-19abf41ac487
conditions:
- key: account
operator: eq
value: '123456789012'
conditions_policy: ALL
created_at: '2023-01-18T06:20:51.199Z'
domain_id: domain-d95e098e37e0
name: route_project_by_aws_account_custom
options: {}
order: 1
rule_type: CUSTOM
tags:
description: Project Routing Test
total_count: 1