---
description: >-
  A DataSource is a plugin instance collecting `metric` and `log` data from
  Cloudforet.
---

# Data Source

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

## DataSource

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

| Method                               | Request                                                         | Response                                                                                                           |
| ------------------------------------ | --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
| [**register**](#register)            | [RegisterDataSourceRequest](#registerdatasourcerequest)         | [DataSourceInfo](#datasourceinfo)                                                                                  |
| [**update**](#update)                | [UpdateDataSourceRequest](#updatedatasourcerequest)             | [DataSourceInfo](#datasourceinfo)                                                                                  |
| [**enable**](#enable)                | [DataSourceRequest](#datasourcerequest)                         | [DataSourceInfo](#datasourceinfo)                                                                                  |
| [**disable**](#disable)              | [DataSourceRequest](#datasourcerequest)                         | [DataSourceInfo](#datasourceinfo)                                                                                  |
| [**deregister**](#deregister)        | [DataSourceRequest](#datasourcerequest)                         | [google.protobuf.Empty](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/empty.proto)   |
| [**update\_plugin**](#update_plugin) | [UpdateDataSourcePluginRequest](#updatedatasourcepluginrequest) | [DataSourceInfo](#datasourceinfo)                                                                                  |
| [**verify\_plugin**](#verify_plugin) | [DataSourceRequest](#datasourcerequest)                         | [google.protobuf.Empty](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/empty.proto)   |
| [**get**](#get)                      | [GetDataSourceRequest](#getdatasourcerequest)                   | [DataSourceInfo](#datasourceinfo)                                                                                  |
| [**list**](#list)                    | [DataSourceQuery](#datasourcequery)                             | [DataSourcesInfo](#datasourcesinfo)                                                                                |
| [**stat**](#stat)                    | [DataSourceStatQuery](#datasourcestatquery)                     | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |

### register

> **POST** /monitoring/v1/data-sources

> Registers a DataSource with information of the plugin to use. Information of the plugin includes `version`, `provider`, `upgrade_mode`.

| Type     | Message                                                 |
| -------- | ------------------------------------------------------- |
| Request  | [RegisterDataSourceRequest](#registerdatasourcerequest) |
| Response | [DataSourceInfo](#datasourceinfo)                       |

{% tabs %}
{% tab title="Request Example" %}
```
{
    "name": "datasource-test",
    "plugin_info": {
        "plugin_id": "plugin-123456789012",
        "version": "1.1.4.20220617.135934",
        "options": {},
        "provider": "aws",
        "metadata": {
            "supported_resource_type": [
                "inventory.Server",
                "inventory.CloudService"
            ],
            "required_keys": [
                "data.cloudwatch"
            ],
            "supported_stat": [
                "AVERAGE",
                "MAX",
                "MIN",
                "SUM"
            ]
        },
        "upgrade_mode": "AUTO"
    },
    "tags": {
        "a": "b"
    },
    "domain_id": "domain-123456789012"
}
```
{% endtab %}

{% tab title="Response Example" %}
```
{
    "data_source_id": "ds-123456789012",
    "name": "datasource-test",
    "state": "ENABLED",
    "monitoring_type": "METRIC",
    "provider": "aws",
    "capability": {
        "supported_schema": [
            "aws_access_key",
            "aws_assume_role"
        ],
        "use_resource_secret": true,
        "monitoring_type": "METRIC"
    },
    "plugin_info": {
        "plugin_id": "plugin-123456789012",
        "version": "1.1.4.20220617.135934",
        "options": {},
        "provider": "aws",
        "metadata": {
            "supported_stat": [
                "AVERAGE",
                "MAX",
                "MIN",
                "SUM"
            ],
            "supported_resource_type": [
                "inventory.Server",
                "inventory.CloudService"
            ],
            "required_keys": [
                "data.cloudwatch"
            ]
        },
        "upgrade_mode": "AUTO"
    },
    "tags": {
        "a": "b"
    },
    "domain_id": "domain-123456789012",
    "created_at": "2022-06-21T01:17:12.144Z"
}
```
{% endtab %}
{% endtabs %}

### update

> **PUT** /monitoring/v1/data-source/{data\_source\_id}

> Updates a specific DataSource. You can make changes in DataSource settings, including `name` and `tags`.

| Type     | Message                                             |
| -------- | --------------------------------------------------- |
| Request  | [UpdateDataSourceRequest](#updatedatasourcerequest) |
| Response | [DataSourceInfo](#datasourceinfo)                   |

{% tabs %}
{% tab title="Request Example" %}
```
{
    "data_source_id": "ds-123456789012",
    "name": "tmp-datasource_test",
    "tags": {
        "b": "c"
    },
    "domain_id": "domain-123456789012"
}
```
{% endtab %}

{% tab title="Response Example" %}
```
{
    "data_source_id": "ds-123456789012",
    "name": "tmp-datasource_test",
    "state": "ENABLED",
    "monitoring_type": "METRIC",
    "provider": "aws",
    "capability": {
        "use_resource_secret": true,
        "monitoring_type": "METRIC",
        "supported_schema": [
            "aws_access_key",
            "aws_assume_role"
        ]
    },
    "plugin_info": {
        "plugin_id": "plugin-123456789012",
        "version": "1.1.4.20220617.135934",
        "options": {},
        "provider": "aws",
        "metadata": {
            "required_keys": [
                "data.cloudwatch"
            ],
            "supported_resource_type": [
                "inventory.Server",
                "inventory.CloudService"
            ],
            "supported_stat": [
                "AVERAGE",
                "MAX",
                "MIN",
                "SUM"
            ]
        },
        "upgrade_mode": "AUTO"
    },
    "tags": {
        "b": "c"
    },
    "domain_id": "domain-123456789012",
    "created_at": "2022-06-21T01:17:12.144Z"
}
```
{% endtab %}
{% endtabs %}

### enable

> **PUT** /monitoring/v1/data-source/{data\_source\_id}/enable

> Enables a specific DataSource. By enabling a DataSource, you can communicate with an external cloud service via the plugin.

| Type     | Message                                 |
| -------- | --------------------------------------- |
| Request  | [DataSourceRequest](#datasourcerequest) |
| Response | [DataSourceInfo](#datasourceinfo)       |

{% tabs %}
{% tab title="Request Example" %}
```
{
    "data_source_id": "ds-6167ed6b42f4",
    "domain_id": "domain-123456789012"
}
```
{% endtab %}

{% tab title="Response Example" %}
```
{
    "data_source_id": "ds-6167ed6b42f4",
    "name": "tmp-datasource_test",
    "state": "ENABLED",
    "monitoring_type": "METRIC",
    "provider": "aws",
    "capability": {
        "supported_schema": [
            "aws_access_key",
            "aws_assume_role"
        ],
        "monitoring_type": "METRIC",
        "use_resource_secret": true
    },
    "plugin_info": {
        "plugin_id": "plugin-5cdf8d72a7cc",
        "version": "1.1.4.20220617.135934",
        "options": {},
        "provider": "aws",
        "metadata": {
            "supported_stat": [
                "AVERAGE",
                "MAX",
                "MIN",
                "SUM"
            ],
            "required_keys": [
                "data.cloudwatch"
            ],
            "supported_resource_type": [
                "inventory.Server",
                "inventory.CloudService"
            ]
        },
        "upgrade_mode": "AUTO"
    },
    "tags": {
        "b": "c"
    },
    "domain_id": "domain-123456789012",
    "created_at": "2022-06-21T01:17:12.144Z"
}
```
{% endtab %}
{% endtabs %}

### disable

> **PUT** /monitoring/v1/data-source/{data\_source\_id}/disable

> Disables a specific DataSource. By disabling a DataSource, you can block communication with an external cloud service via the plugin.

| Type     | Message                                 |
| -------- | --------------------------------------- |
| Request  | [DataSourceRequest](#datasourcerequest) |
| Response | [DataSourceInfo](#datasourceinfo)       |

{% tabs %}
{% tab title="Request Example" %}
```
{
    "data_source_id": "ds-6167ed6b42f4",
    "domain_id": "domain-123456789012"
}
```
{% endtab %}

{% tab title="Response Example" %}
```
{
    "data_source_id": "ds-6167ed6b42f4",
    "name": "tmp-datasource_test",
    "state": "DISABLED",
    "monitoring_type": "METRIC",
    "provider": "aws",
    "capability": {
        "supported_schema": [
            "aws_access_key",
            "aws_assume_role"
        ],
        "monitoring_type": "METRIC",
        "use_resource_secret": true
    },
    "plugin_info": {
        "plugin_id": "plugin-5cdf8d72a7cc",
        "version": "1.1.4.20220617.135934",
        "options": {},
        "provider": "aws",
        "metadata": {
            "supported_stat": [
                "AVERAGE",
                "MAX",
                "MIN",
                "SUM"
            ],
            "required_keys": [
                "data.cloudwatch"
            ],
            "supported_resource_type": [
                "inventory.Server",
                "inventory.CloudService"
            ]
        },
        "upgrade_mode": "AUTO"
    },
    "tags": {
        "b": "c"
    },
    "domain_id": "domain-123456789012",
    "created_at": "2022-06-21T01:17:12.144Z"
}
```
{% endtab %}
{% endtabs %}

### deregister

> **DELETE** /monitoring/v1/data-source/{data\_source\_id}

> Deregisters and deletes a specific DataSource. You must specify the `data_source_id` of the DataSource to deregister.

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

{% tabs %}
{% tab title="Request Example" %}
```
{
    "data_source_id": "ds-6167ed6b42f4",
    "domain_id": "domain-123456789012"
}
```
{% endtab %}
{% endtabs %}

### update\_plugin

> **PUT** /monitoring/v1/data-source/{data\_source\_id}/plugin

> Updates the plugin of a specific DataSource. This method resets the plugin data in the DataSource to update the `metadata`.

| Type     | Message                                                         |
| -------- | --------------------------------------------------------------- |
| Request  | [UpdateDataSourcePluginRequest](#updatedatasourcepluginrequest) |
| Response | [DataSourceInfo](#datasourceinfo)                               |

{% tabs %}
{% tab title="Request Example" %}
```
{
    "data_source_id": "ds-6167ed6b42f4",
    "version": "1.1.3",
    "options": {},
    "upgrade_mode": "MANUAL",
    "domain_id": "domain-123456789012"
}
```
{% endtab %}

{% tab title="Response Example" %}
```
{
    "data_source_id": "ds-6167ed6b42f4",
    "name": "tmp-datasource_test",
    "state": "ENABLED",
    "monitoring_type": "METRIC",
    "provider": "aws",
    "capability": {
        "use_resource_secret": true,
        "supported_schema": [
            "aws_access_key",
            "aws_assume_role"
        ],
        "monitoring_type": "METRIC"
    },
    "plugin_info": {
        "plugin_id": "plugin-5cdf8d72a7cc",
        "version": "1.1.3",
        "options": {},
        "provider": "aws",
        "metadata": {
            "required_keys": [
                "data.cloudwatch"
            ],
            "supported_resource_type": [
                "inventory.Server",
                "inventory.CloudService"
            ],
            "supported_stat": [
                "AVERAGE",
                "MAX",
                "MIN",
                "SUM"
            ]
        },
        "upgrade_mode": "MANUAL"
    },
    "tags": {
        "b": "c"
    },
    "domain_id": "domain-123456789012",
    "created_at": "2022-06-21T01:17:12.144Z"
}
```
{% endtab %}
{% endtabs %}

### verify\_plugin

> **PUT** /monitoring/v1/data-source/{data\_source\_id}/plugin/verify

> Verifies the plugin of a specific DataSource. This method validates the plugin data, `version` and `endpoint`.

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

{% tabs %}
{% tab title="Request Example" %}
```
{
    "data_source_id": "ds-6167ed6b42f4",
    "domain_id": "domain-123456789012"
}
```
{% endtab %}
{% endtabs %}

### get

> **GET** /monitoring/v1/data-source/{data\_source\_id}

> Gets a specific DataSource. Prints detailed information about the DataSource, including `name`, `state`, and `plugin_info`.

| Type     | Message                                       |
| -------- | --------------------------------------------- |
| Request  | [GetDataSourceRequest](#getdatasourcerequest) |
| Response | [DataSourceInfo](#datasourceinfo)             |

{% tabs %}
{% tab title="Request Example" %}
```
{
    "data_source_id": "ds-123456789012",
    "domain_id": "domain-123456789012"
}
```
{% endtab %}

{% tab title="Response Example" %}
```
{
    "data_source_id": "ds-89f1e81528e9",
    "name": "AWS CloudTrail",
    "state": "ENABLED",
    "monitoring_type": "LOG",
    "provider": "aws",
    "capability": {
        "use_resource_secret": true,
        "supported_schema": [
            "aws_access_key",
            "aws_assume_role"
        ],
        "monitoring_type": "LOG"
    },
    "plugin_info": {
        "plugin_id": "plugin-9881b9b440a4",
        "version": "1.0-dev2",
        "options": {},
        "provider": "aws",
        "metadata": {
            "supported_resource_type": [
                "inventory.Server",
                "inventory.CloudService"
            ],
            "required_keys": [
                "reference.resource_id"
            ]
        },
        "upgrade_mode": "AUTO"
    },
    "tags": {},
    "domain_id": "domain-123456789012",
    "created_at": "2021-03-31T08:39:45.532Z"
}
```
{% endtab %}
{% endtabs %}

### list

> **GET** /monitoring/v1/data-sources
>
> **POST** /monitoring/v1/data-sources/search

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

| Type     | Message                             |
| -------- | ----------------------------------- |
| Request  | [DataSourceQuery](#datasourcequery) |
| Response | [DataSourcesInfo](#datasourcesinfo) |

{% tabs %}
{% tab title="Request Example" %}
```
{
    "query": {},
    "domain_id": "domain-123456789012"
}
```
{% endtab %}

{% tab title="Response Example" %}
```
{
    "results": [
        {
            "data_source_id": "ds-89f1e81528e9",
            "name": "AWS CloudTrail",
            "state": "ENABLED",
            "monitoring_type": "LOG",
            "provider": "aws",
            "capability": {
                "use_resource_secret": true,
                "monitoring_type": "LOG",
                "supported_schema": [
                    "aws_access_key",
                    "aws_assume_role"
                ]
            },
            "plugin_info": {
                "plugin_id": "plugin-9881b9b440a4",
                "version": "1.0-dev2",
                "options": {},
                "provider": "aws",
                "metadata": {
                    "required_keys": [
                        "reference.resource_id"
                    ],
                    "supported_resource_type": [
                        "inventory.Server",
                        "inventory.CloudService"
                    ]
                },
                "upgrade_mode": "AUTO"
            },
            "tags": {},
            "domain_id": "domain-123456789012",
            "created_at": "2021-03-31T08:39:45.532Z"
        }
    ],
    "total_count": 2
}
```
{% endtab %}
{% endtabs %}

### stat

> **POST** /monitoring/v1/data-sources/stat

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

##

## Message

### DataSourceInfo

| Field            | Type                                                                                                               | Description |
| ---------------- | ------------------------------------------------------------------------------------------------------------------ | ----------- |
| data\_source\_id | string                                                                                                             |             |
| name             | string                                                                                                             |             |
| state            | <ul><li>NONE</li><li>ENABLED</li><li>DISABLED</li></ul>                                                            |             |
| monitoring\_type | <ul><li>NONE</li><li>METRIC</li><li>LOG</li></ul>                                                                  |             |
| provider         | string                                                                                                             |             |
| capability       | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |             |
| plugin\_info     | [DataSourcePluginInfo](#datasourceplugininfo)                                                                      |             |
| tags             | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |             |
| domain\_id       | string                                                                                                             |             |
| created\_at      | string                                                                                                             |             |

### DataSourcePluginInfo

| Field         | Type                                                                                                               | Description |
| ------------- | ------------------------------------------------------------------------------------------------------------------ | ----------- |
| plugin\_id    | string                                                                                                             |             |
| version       | string                                                                                                             |             |
| options       | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |             |
| metadata      | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |             |
| upgrade\_mode | <ul><li>NONE</li><li>MANUAL</li><li>AUTO</li></ul>                                                                 |             |
| secret\_id    | string                                                                                                             |             |
| provider      | string                                                                                                             |             |

### DataSourceQuery

| Field            | Type                                                                                               | Required | Description |
| ---------------- | -------------------------------------------------------------------------------------------------- | -------- | ----------- |
| query            | [spaceone.api.core.v1.Query](https://spaceone-dev.gitbook.io/api-reference/common-v1/search-query) | ✘        |             |
| data\_source\_id | string                                                                                             | ✘        |             |
| name             | string                                                                                             | ✘        |             |
| state            | string                                                                                             | ✘        |             |
| monitoring\_type | <ul><li>NONE</li><li>METRIC</li><li>LOG</li></ul>                                                  | ✘        |             |
| provider         | string                                                                                             | ✘        |             |
| domain\_id       | string                                                                                             | ✔        |             |

### DataSourceRequest

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

### DataSourceStatQuery

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

### DataSourcesInfo

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

### GetDataSourceRequest

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

### RegisterDataSourceRequest

| Field        | Type                                                                                                               | Required | Description |
| ------------ | ------------------------------------------------------------------------------------------------------------------ | :------: | ----------- |
| name         | string                                                                                                             |     ✔    |             |
| plugin\_info | [DataSourcePluginInfo](#datasourceplugininfo)                                                                      |     ✔    |             |
| tags         | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |     ✘    |             |
| domain\_id   | string                                                                                                             |     ✔    |             |

### UpdateDataSourcePluginRequest

| Field            | Type                                                                                                               | Required | Description |
| ---------------- | ------------------------------------------------------------------------------------------------------------------ | -------- | ----------- |
| data\_source\_id | string                                                                                                             | ✔        |             |
| version          | string                                                                                                             | ✘        |             |
| options          | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) | ✘        |             |
| upgrade\_mode    | <ul><li>NONE</li><li>MANUAL</li><li>AUTO</li></ul>                                                                 | ✘        |             |
| domain\_id       | string                                                                                                             | ✔        |             |

### UpdateDataSourceRequest

| Field            | Type                                                                                                               | Required | Description |
| ---------------- | ------------------------------------------------------------------------------------------------------------------ | :------: | ----------- |
| data\_source\_id | string                                                                                                             |     ✔    |             |
| name             | string                                                                                                             |     ✘    |             |
| tags             | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |     ✘    |             |
| domain\_id       | string                                                                                                             |     ✔    |             |
