# CollectorRule

A CollectorRule is a cloud service resource filtering the raw data from the Collector. The Cloud Service resource is created after the raw data is filtered by the CollectorRule.

> **Package : spaceone.api.inventory.v1**

\
\


## CollectorRule

**CollectorRule Methods:**

| Method                                                                                                                                 | Request                                                                                                                                                                 | Response                                                                                                                                      |
| -------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| [**create**](https://github.com/cloudforet-io/api-doc/blob/master/content/en/inventory/v1/CollectorRule/README.md#create)              | [CreateCollectorRuleRequest](https://github.com/cloudforet-io/api-doc/blob/master/content/en/inventory/v1/CollectorRule/README.md#createcollectorrulerequest)           | [CollectorRuleInfo](https://github.com/cloudforet-io/api-doc/blob/master/content/en/inventory/v1/CollectorRule/README.md#collectorruleinfo)   |
| [**update**](https://github.com/cloudforet-io/api-doc/blob/master/content/en/inventory/v1/CollectorRule/README.md#update)              | [UpdateCollectorRuleRequest](https://github.com/cloudforet-io/api-doc/blob/master/content/en/inventory/v1/CollectorRule/README.md#updatecollectorrulerequest)           | [CollectorRuleInfo](https://github.com/cloudforet-io/api-doc/blob/master/content/en/inventory/v1/CollectorRule/README.md#collectorruleinfo)   |
| [**change\_order**](https://github.com/cloudforet-io/api-doc/blob/master/content/en/inventory/v1/CollectorRule/README.md#change_order) | [ChangeCollectorRuleOrderRequest](https://github.com/cloudforet-io/api-doc/blob/master/content/en/inventory/v1/CollectorRule/README.md#changecollectorruleorderrequest) | [CollectorRuleInfo](https://github.com/cloudforet-io/api-doc/blob/master/content/en/inventory/v1/CollectorRule/README.md#collectorruleinfo)   |
| [**delete**](https://github.com/cloudforet-io/api-doc/blob/master/content/en/inventory/v1/CollectorRule/README.md#delete)              | [CollectorRuleRequest](https://github.com/cloudforet-io/api-doc/blob/master/content/en/inventory/v1/CollectorRule/README.md#collectorrulerequest)                       | [Empty](https://github.com/cloudforet-io/api-doc/blob/master/content/en/inventory/v1/CollectorRule/README.md#empty)                           |
| [**get**](https://github.com/cloudforet-io/api-doc/blob/master/content/en/inventory/v1/CollectorRule/README.md#get)                    | [CollectorRuleRequest](https://github.com/cloudforet-io/api-doc/blob/master/content/en/inventory/v1/CollectorRule/README.md#collectorrulerequest)                       | [CollectorRuleInfo](https://github.com/cloudforet-io/api-doc/blob/master/content/en/inventory/v1/CollectorRule/README.md#collectorruleinfo)   |
| [**list**](https://github.com/cloudforet-io/api-doc/blob/master/content/en/inventory/v1/CollectorRule/README.md#list)                  | [CollectorRuleQuery](https://github.com/cloudforet-io/api-doc/blob/master/content/en/inventory/v1/CollectorRule/README.md#collectorrulequery)                           | [CollectorRulesInfo](https://github.com/cloudforet-io/api-doc/blob/master/content/en/inventory/v1/CollectorRule/README.md#collectorrulesinfo) |
| [**stat**](https://github.com/cloudforet-io/api-doc/blob/master/content/en/inventory/v1/CollectorRule/README.md#stat)                  | [CollectorRuleStatQuery](https://github.com/cloudforet-io/api-doc/blob/master/content/en/inventory/v1/CollectorRule/README.md#collectorrulestatquery)                   | [Struct](https://github.com/cloudforet-io/api-doc/blob/master/content/en/inventory/v1/CollectorRule/README.md#struct)                         |

\


### create

Creates a new CollectorRule. When creating the cloud service, this method can apply two types of conditions: mapping projects where the cloud service incurred to the Cloud Service, and mapping cloud service accounts to the Cloud Service. By adjusting the `condition_policy` parameter, the CollectorRule can be applied when all conditions are met, applied when any of the conditions are met, or always applied regardless of whether the conditions are met.

> **POST** /inventory/v1/collector-rule/create

\{{< tabs " create " >\}}

\{{< tab "Request Example" >\}}

[CreateCollectorRuleRequest](https://github.com/cloudforet-io/api-doc/blob/master/content/en/inventory/v1/CollectorRule/README.md#createcollectorrulerequest)

* **collector\_id** (string) `Required`
* **conditions\_policy** (ConditionsPolicy) `Required`
* **actions** (CollectorRuleActions) `Required`
* **name** (string)
* **conditions** (CollectorRuleCondition) `Repeated`
* **options** (CollectorRuleOptions)
* **tags** (Struct)

\{{< highlight json >\}} { "name": "match\_service\_account\_test", "conditions\_policy": "ALWAYS", "actions": { "match\_service\_account": {"source": "account", "target": "data.project\_id"} }, "options": {"stop\_processing": true}, "tags": {"b": "c", "a": "b"}, "collector\_id": "collector-2e39891cbbb5" } \{{< /highlight >\}} \{{< /tab >\}}

\{{< tab "Response Example" >\}}

[CollectorRuleInfo](#COLLECTORRULEINFO)

* **collector\_rule\_id** (string) `Required`
* **name** (string) `Required`
* **rule\_type** (RuleType) `Required`
* **order** (int32) `Required`
* **conditions** (CollectorRuleCondition) `Repeated` `Required`
* **conditions\_policy** (ConditionsPolicy) `Required`
* **actions** (CollectorRuleActions) `Required`
* **options** (CollectorRuleOptions) `Required`
* **tags** (Struct) `Required`
* **resource\_group** (ResourceGroup) `Required`
* **domain\_id** (string) `Required`
* **workspace\_id** (string) `Required`
* **collector\_id** (string) `Required`
* **created\_at** (string) `Required`

\{{< highlight json >\}} { "collector\_rule\_id": "collector-rule-c8055231e212", "name": "match\_service\_account\_test", "order": 2, "conditions\_policy": "ALWAYS", "actions": { "match\_service\_account": { "source": "account", "target": "data.project\_id" } }, "options": { "stop\_processing": true }, "tags": { "a": "b", "b": "c" }, "collector\_id": "collector-2e39891cbbb5", "domain\_id": "domain-58010aa2e451", "created\_at": "2022-07-19T10:13:28.335Z" } \{{< /highlight >\}} \{{< /tab >\}}

\{{< /tabs >\}}

\


### update

Updates a specific CollectorRule. You can make changes in CollectorRule settings, including filtering conditions.

> **POST** /inventory/v1/collector-rule/update

\{{< tabs " update " >\}}

\{{< tab "Request Example" >\}}

[UpdateCollectorRuleRequest](https://github.com/cloudforet-io/api-doc/blob/master/content/en/inventory/v1/CollectorRule/README.md#updatecollectorrulerequest)

* **collector\_rule\_id** (string) `Required`
* **name** (string)
* **conditions** (CollectorRuleCondition) `Repeated`
* **conditions\_policy** (ConditionsPolicy)
* **actions** (CollectorRuleActions)
* **options** (CollectorRuleOptions)
* **tags** (Struct)

\{{< highlight json >\}} { "collector\_rule\_id": "collector-rule-c8055231e212", "name": "match\_service\_account\_test", "conditions\_policy": "ALWAYS", "actions": { "match\_service\_account": { "source": "account", "target": "data.project\_id" } }, "options": { "stop\_processing": true }, "tags": {"b": "c", "a": "b"} } \{{< /highlight >\}} \{{< /tab >\}}

\{{< tab "Response Example" >\}}

[CollectorRuleInfo](#COLLECTORRULEINFO)

* **collector\_rule\_id** (string) `Required`
* **name** (string) `Required`
* **rule\_type** (RuleType) `Required`
* **order** (int32) `Required`
* **conditions** (CollectorRuleCondition) `Repeated` `Required`
* **conditions\_policy** (ConditionsPolicy) `Required`
* **actions** (CollectorRuleActions) `Required`
* **options** (CollectorRuleOptions) `Required`
* **tags** (Struct) `Required`
* **resource\_group** (ResourceGroup) `Required`
* **domain\_id** (string) `Required`
* **workspace\_id** (string) `Required`
* **collector\_id** (string) `Required`
* **created\_at** (string) `Required`

\{{< highlight json >\}} { "collector\_rule\_id": "collector-rule-c8055231e212", "name": "match\_service\_account\_test", "order": 2, "conditions\_policy": "ALWAYS", "actions": { "match\_service\_account": { "source": "account", "target": "data.project\_id" } }, "options": { "stop\_processing": true }, "tags": { "a": "b", "b": "c" }, "collector\_id": "collector-2e39891cbbb5", "domain\_id": "domain-58010aa2e451", "created\_at": "2022-07-19T10:13:28.335Z" } \{{< /highlight >\}} \{{< /tab >\}}

\{{< /tabs >\}}

\


### change\_order

Changes the priority order of the CollectorRules to apply. If there are multiple CollectorRules applied in a specific service account, the priority order of the resources is required. This method changes the priority order to apply CollectorRules.

> **POST** /inventory/v1/collector-rule/change-order

\{{< tabs " change\_order " >\}}

\{{< tab "Request Example" >\}}

[ChangeCollectorRuleOrderRequest](https://github.com/cloudforet-io/api-doc/blob/master/content/en/inventory/v1/CollectorRule/README.md#changecollectorruleorderrequest)

* **collector\_rule\_id** (string) `Required`
* **order** (int32) `Required`

\{{< highlight json >\}} { "collector\_rule\_id": "collector-rule-c8055231e212", "order": 2 } \{{< /highlight >\}} \{{< /tab >\}}

\{{< tab "Response Example" >\}}

[CollectorRuleInfo](#COLLECTORRULEINFO)

* **collector\_rule\_id** (string) `Required`
* **name** (string) `Required`
* **rule\_type** (RuleType) `Required`
* **order** (int32) `Required`
* **conditions** (CollectorRuleCondition) `Repeated` `Required`
* **conditions\_policy** (ConditionsPolicy) `Required`
* **actions** (CollectorRuleActions) `Required`
* **options** (CollectorRuleOptions) `Required`
* **tags** (Struct) `Required`
* **resource\_group** (ResourceGroup) `Required`
* **domain\_id** (string) `Required`
* **workspace\_id** (string) `Required`
* **collector\_id** (string) `Required`
* **created\_at** (string) `Required`

\{{< highlight json >\}} { "collector\_rule\_id": "collector-rule-c8055231e212", "name": "match\_service\_account\_test", "order": 2, "conditions\_policy": "ALWAYS", "actions": { "match\_service\_account": { "source": "account", "target": "data.project\_id" } }, "options": { "stop\_processing": true }, "tags": { "a": "b", "b": "c" }, "collector\_id": "collector-2e39891cbbb5", "domain\_id": "domain-58010aa2e451", "created\_at": "2022-07-19T10:13:28.335Z" } \{{< /highlight >\}} \{{< /tab >\}}

\{{< /tabs >\}}

\


### delete

Deletes a specific CollectorRule. You must specify the `collector_rule_id` of the CollectorRule to delete.

> **POST** /inventory/v1/collector-rule/delete

\{{< tabs " delete " >\}}

\{{< tab "Request Example" >\}}

[CollectorRuleRequest](https://github.com/cloudforet-io/api-doc/blob/master/content/en/inventory/v1/CollectorRule/README.md#collectorrulerequest)

* **collector\_rule\_id** (string) `Required`

\{{< highlight json >\}} { "collector\_rule\_id": "collector-rule-c8055231e212", } \{{< /highlight >\}} \{{< /tab >\}}

\{{< /tabs >\}}

\


### get

Gets a specific CollectorRule. Prints detailed information about the CollectorRule, including `conditions_policy` and conditions applied to Collector.

> **POST** /inventory/v1/collector-rule/get

\{{< tabs " get " >\}}

\{{< tab "Request Example" >\}}

[CollectorRuleRequest](https://github.com/cloudforet-io/api-doc/blob/master/content/en/inventory/v1/CollectorRule/README.md#collectorrulerequest)

* **collector\_rule\_id** (string) `Required`

\{{< highlight json >\}} { "collector\_rule\_id": "collector-rule-c8055231e212", } \{{< /highlight >\}} \{{< /tab >\}}

\{{< tab "Response Example" >\}}

[CollectorRuleInfo](#COLLECTORRULEINFO)

* **collector\_rule\_id** (string) `Required`
* **name** (string) `Required`
* **rule\_type** (RuleType) `Required`
* **order** (int32) `Required`
* **conditions** (CollectorRuleCondition) `Repeated` `Required`
* **conditions\_policy** (ConditionsPolicy) `Required`
* **actions** (CollectorRuleActions) `Required`
* **options** (CollectorRuleOptions) `Required`
* **tags** (Struct) `Required`
* **resource\_group** (ResourceGroup) `Required`
* **domain\_id** (string) `Required`
* **workspace\_id** (string) `Required`
* **collector\_id** (string) `Required`
* **created\_at** (string) `Required`

\{{< highlight json >\}} { "collector\_rule\_id": "collector-rule-c8055231e212", "name": "match\_service\_account\_test", "order": 2, "conditions\_policy": "ALWAYS", "actions": { "match\_service\_account": { "source": "account", "target": "data.project\_id" } }, "options": { "stop\_processing": true }, "tags": { "a": "b", "b": "c" }, "collector\_id": "collector-2e39891cbbb5", "domain\_id": "domain-58010aa2e451", "created\_at": "2022-07-19T10:13:28.335Z" } \{{< /highlight >\}} \{{< /tab >\}}

\{{< /tabs >\}}

\


### list

Gets a list of all CollectorRules. You can use a query to get a filtered list of CollectorRules.

> **POST** /inventory/v1/collector-rule/list

\{{< tabs " list " >\}}

\{{< tab "Request Example" >\}}

[CollectorRuleQuery](https://github.com/cloudforet-io/api-doc/blob/master/content/en/inventory/v1/CollectorRule/README.md#collectorrulequery)

* **query** (Query)
* **collector\_rule\_id** (string)
* **name** (string)
* **rule\_type** (RuleType)
* **workspace\_id** (string)
* **collector\_id** (string)

\{{< highlight json >\}} { "query": {} } \{{< /highlight >\}} \{{< /tab >\}}

\{{< tab "Response Example" >\}}

[CollectorRulesInfo](#COLLECTORRULESINFO)

* **results** (CollectorRuleInfo) `Repeated` `Required`
* **total\_count** (int32) `Required`

\{{< highlight json >\}} { "results": \[ { "collector\_rule\_id": "collector-rule-c8055231e212", "name": "match\_service\_account", "order": 1, "conditions\_policy": "ALWAYS", "actions": { "match\_service\_account": { "source": "account", "target": "data.project\_id" } }, "options": { "stop\_processing": true }, "tags": {}, "collector\_id": "collector-2e39891cbbb5", "domain\_id": "domain-58010aa2e451", "created\_at": "2022-05-25T16:01:51.858Z" }, { "collector\_rule\_id": "collector-rule-t3345231e167", "name": "match\_service\_account", "order": 1, "conditions\_policy": "ALWAYS", "actions": { "match\_service\_account": { "source": "account", "target": "data.account\_id" } }, "options": { "stop\_processing": true }, "tags": {}, "collector\_id": "collector-7163022d49a1", "domain\_id": "domain-58010aa2e451", "created\_at": "2022-06-03T16:00:54.099Z" } ], "total\_count": 2 } \{{< /highlight >\}} \{{< /tab >\}}

\{{< /tabs >\}}

\


### stat

> **POST** /inventory/v1/collector-rule/stat

\
\


## Message

### ChangeCollectorRuleOrderRequest

* **collector\_rule\_id** (string) `Required`
*   **order** (int32) `Required`

    \


### CollectorRuleActions

* **change\_project** (string) `Required`
* **match\_project** (MatchRule) `Required`
* **match\_service\_account** (MatchRule) `Required`
*   **add\_additional\_info** (Struct) `Required`

    \


### CollectorRuleCondition

* **key** (string) `Required`
* **value** (string) `Required`
*   **operator** (string) `Required`

    \


### CollectorRuleInfo

* **collector\_rule\_id** (string) `Required`
* **name** (string) `Required`
* **rule\_type** (RuleType) `Required`
* **order** (int32) `Required`
* **conditions** (CollectorRuleCondition) `Repeated` `Required`
* **conditions\_policy** (ConditionsPolicy) `Required`
* **actions** (CollectorRuleActions) `Required`
* **options** (CollectorRuleOptions) `Required`
* **tags** (Struct) `Required`
* **resource\_group** (ResourceGroup) `Required`
* **domain\_id** (string) `Required`
* **workspace\_id** (string) `Required`
* **collector\_id** (string) `Required`
*   **created\_at** (string) `Required`

    \


### CollectorRuleOptions

*   **stop\_processing** (bool) `Required`

    \


### CollectorRuleQuery

* **query** (Query)
* **collector\_rule\_id** (string)
* **name** (string)
* **rule\_type** (RuleType)
* **workspace\_id** (string)
*   **collector\_id** (string)

    \


### CollectorRuleRequest

*   **collector\_rule\_id** (string) `Required`

    \


### CollectorRuleStatQuery

*   **query** (StatisticsQuery) `Required`

    \


### CollectorRulesInfo

* **results** (CollectorRuleInfo) `Repeated` `Required`
*   **total\_count** (int32) `Required`

    \


### CreateCollectorRuleRequest

* **collector\_id** (string) `Required`
* **conditions\_policy** (ConditionsPolicy) `Required`
* **actions** (CollectorRuleActions) `Required`
* **name** (string)
* **conditions** (CollectorRuleCondition) `Repeated`
* **options** (CollectorRuleOptions)
*   **tags** (Struct)

    \


### MatchRule

* **source** (string) `Required`
*   **target** (string) `Required`

    \


### UpdateCollectorRuleRequest

* **collector\_rule\_id** (string) `Required`
* **name** (string)
* **conditions** (CollectorRuleCondition) `Repeated`
* **conditions\_policy** (ConditionsPolicy)
* **actions** (CollectorRuleActions)
* **options** (CollectorRuleOptions)
*   **tags** (Struct)

    \
