# Data Source Rule

> **Package : spaceone.api.cost\_analysis.v1**

## DataSourceRule

{% hint style="info" %}
**DataSourceRule Methods:**
{% endhint %}

| Method                             | Request                                                               | Response                                                                                                           |
| ---------------------------------- | --------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
| [**create**](#create)              | [CreateDataSourceRuleRequest](#createdatasourcerulerequest)           | [DataSourceRuleInfo](#datasourceruleinfo)                                                                          |
| [**update**](#update)              | [UpdateDataSourceRuleRequest](#updatedatasourcerulerequest)           | [DataSourceRuleInfo](#datasourceruleinfo)                                                                          |
| [**change\_order**](#change_order) | [ChangeDataSourceRuleOrderRequest](#changedatasourceruleorderrequest) | [DataSourceRuleInfo](#datasourceruleinfo)                                                                          |
| [**delete**](#delete)              | [DataSourceRuleRequest](#datasourcerulerequest)                       | [google.protobuf.Empty](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/empty.proto)   |
| [**get**](#get)                    | [GetDataSourceRuleRequest](#getdatasourcerulerequest)                 | [DataSourceRuleInfo](#datasourceruleinfo)                                                                          |
| [**list**](#list)                  | [DataSourceRuleQuery](#datasourcerulequery)                           | [DataSourceRulesInfo](#datasourcerulesinfo)                                                                        |
| [**stat**](#stat)                  | [DataSourceRuleStatQuery](#datasourcerulestatquery)                   | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |

### create

> **POST** /cost-analysis/v1/data\_source\_rules

| Type     | Message                                                     |
| -------- | ----------------------------------------------------------- |
| Request  | [CreateDataSourceRuleRequest](#createdatasourcerulerequest) |
| Response | [DataSourceRuleInfo](#datasourceruleinfo)                   |

### update

> **PUT** /cost-analysis/v1/data\_source\_rule/{data\_source\_rule\_id}

| Type     | Message                                                     |
| -------- | ----------------------------------------------------------- |
| Request  | [UpdateDataSourceRuleRequest](#updatedatasourcerulerequest) |
| Response | [DataSourceRuleInfo](#datasourceruleinfo)                   |

### change\_order

> **PUT** /cost-analysis/v1/data\_source\_rule/{data\_source\_rule\_id}/order

| Type     | Message                                                               |
| -------- | --------------------------------------------------------------------- |
| Request  | [ChangeDataSourceRuleOrderRequest](#changedatasourceruleorderrequest) |
| Response | [DataSourceRuleInfo](#datasourceruleinfo)                             |

### delete

> **DELETE** /cost-analysis/v1/data\_source\_rule/{data\_source\_rule\_id}

| Type     | Message                                                                                                          |
| -------- | ---------------------------------------------------------------------------------------------------------------- |
| Request  | [DataSourceRuleRequest](#datasourcerulerequest)                                                                  |
| Response | [google.protobuf.Empty](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/empty.proto) |

### get

> **GET** /cost-analysis/v1/data\_source\_rule/{data\_source\_rule\_id}

| Type     | Message                                               |
| -------- | ----------------------------------------------------- |
| Request  | [GetDataSourceRuleRequest](#getdatasourcerulerequest) |
| Response | [DataSourceRuleInfo](#datasourceruleinfo)             |

### list

> **GET** /cost-analysis/v1/data\_source\_rules
>
> **POST** /cost-analysis/v1/data\_source\_rules/search

| Type     | Message                                     |
| -------- | ------------------------------------------- |
| Request  | [DataSourceRuleQuery](#datasourcerulequery) |
| Response | [DataSourceRulesInfo](#datasourcerulesinfo) |

### stat

> **POST** /cost-analysis/v1/data\_source\_rules/stat

| Type     | Message                                                                                                            |
| -------- | ------------------------------------------------------------------------------------------------------------------ |
| Request  | [DataSourceRuleStatQuery](#datasourcerulestatquery)                                                                |
| Response | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |

##

## Message

### ChangeDataSourceRuleOrderRequest

| Field                  | Type                                                                                            | Required | Description |
| ---------------------- | ----------------------------------------------------------------------------------------------- | :------: | ----------- |
| data\_source\_rule\_id | string                                                                                          |     ✔    |             |
| order                  | [int32](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/type.proto) |     ✔    |             |
| domain\_id             | string                                                                                          |     ✔    |             |

### CreateDataSourceRuleRequest

| Field              | Type                                                                                                               | Required | Description |
| ------------------ | ------------------------------------------------------------------------------------------------------------------ | -------- | ----------- |
| name               | string                                                                                                             | ✘        |             |
| conditions         | [list of DataSourceRuleCondition](#datasourcerulecondition)                                                        | ✘        |             |
| conditions\_policy | <ul><li>NONE</li><li>ALL</li><li>ANY</li><li>ALWAYS</li></ul>                                                      | ✔        |             |
| actions            | [DataSourceRuleActions](#datasourceruleactions)                                                                    | ✔        |             |
| options            | [DataSourceRuleOptions](#datasourceruleoptions)                                                                    | ✘        |             |
| tags               | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) | ✘        |             |
| data\_source\_id   | string                                                                                                             | ✔        |             |
| domain\_id         | string                                                                                                             | ✔        |             |

### DataSourceRuleActions

| Field                   | Type                                                                                                               | Description |
| ----------------------- | ------------------------------------------------------------------------------------------------------------------ | ----------- |
| change\_project         | string                                                                                                             |             |
| match\_project          | [MatchRule](#matchrule)                                                                                            |             |
| match\_service\_account | [MatchRule](#matchrule)                                                                                            |             |
| add\_additional\_info   | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |             |

### DataSourceRuleCondition

| Field    | Type   | Description |
| -------- | ------ | ----------- |
| key      | string |             |
| value    | string |             |
| operator | string |             |

### DataSourceRuleInfo

| Field                  | Type                                                                                                               | Description |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------ | ----------- |
| data\_source\_rule\_id | string                                                                                                             |             |
| name                   | string                                                                                                             |             |
| order                  | [int32](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/type.proto)                    |             |
| conditions             | [list of DataSourceRuleCondition](#datasourcerulecondition)                                                        |             |
| conditions\_policy     | <ul><li>NONE</li><li>ALL</li><li>ANY</li><li>ALWAYS</li></ul>                                                      |             |
| actions                | [DataSourceRuleActions](#datasourceruleactions)                                                                    |             |
| options                | [DataSourceRuleOptions](#datasourceruleoptions)                                                                    |             |
| tags                   | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |             |
| data\_source\_id       | string                                                                                                             |             |
| domain\_id             | string                                                                                                             |             |
| created\_at            | string                                                                                                             |             |

### DataSourceRuleOptions

| Field            | Type | Description |
| ---------------- | ---- | ----------- |
| stop\_processing | bool |             |

### DataSourceRuleQuery

| Field                  | Type                                                                                               | Required | Description |
| ---------------------- | -------------------------------------------------------------------------------------------------- | :------: | ----------- |
| query                  | [spaceone.api.core.v1.Query](https://spaceone-dev.gitbook.io/api-reference/common-v1/search-query) |     ✘    |             |
| data\_source\_rule\_id | string                                                                                             |     ✘    |             |
| name                   | string                                                                                             |     ✘    |             |
| data\_source\_id       | string                                                                                             |     ✘    |             |
| domain\_id             | string                                                                                             |     ✔    |             |

### DataSourceRuleRequest

| Field                  | Type   | Required | Description |
| ---------------------- | ------ | :------: | ----------- |
| data\_source\_rule\_id | string |     ✔    |             |
| domain\_id             | string |     ✔    |             |

### DataSourceRuleStatQuery

| Field      | Type                                                                                                             | Required | Description |
| ---------- | ---------------------------------------------------------------------------------------------------------------- | :------: | ----------- |
| query      | [spaceone.api.core.v1.StatisticsQuery](https://spaceone-dev.gitbook.io/api-reference/common-v1/statistics-query) |     ✔    |             |
| domain\_id | string                                                                                                           |     ✔    |             |

### DataSourceRulesInfo

| Field        | Type                                                                                            | Description |
| ------------ | ----------------------------------------------------------------------------------------------- | ----------- |
| results      | [list of DataSourceRuleInfo](#datasourceruleinfo)                                               |             |
| total\_count | [int32](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/type.proto) |             |

### GetDataSourceRuleRequest

| Field                  | Type           | Required | Description |
| ---------------------- | -------------- | :------: | ----------- |
| data\_source\_rule\_id | string         |     ✔    |             |
| domain\_id             | string         |     ✔    |             |
| only                   | list of string |     ✘    |             |

### MatchRule

| Field  | Type   | Description |
| ------ | ------ | ----------- |
| source | string |             |
| target | string |             |

### UpdateDataSourceRuleRequest

| Field                  | Type                                                                                                               | Required | Description |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------ | -------- | ----------- |
| data\_source\_rule\_id | string                                                                                                             | ✔        |             |
| name                   | string                                                                                                             | ✘        |             |
| conditions             | [list of DataSourceRuleCondition](#datasourcerulecondition)                                                        | ✘        |             |
| conditions\_policy     | <ul><li>NONE</li><li>ALL</li><li>ANY</li><li>ALWAYS</li></ul>                                                      | ✘        |             |
| actions                | [DataSourceRuleActions](#datasourceruleactions)                                                                    | ✘        |             |
| options                | [DataSourceRuleOptions](#datasourceruleoptions)                                                                    | ✘        |             |
| tags                   | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) | ✘        |             |
| domain\_id             | string                                                                                                             | ✔        |             |
