# Schedule

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

## Schedule

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

| NO | Method                  | Request Type                                    | Response Type                                                                                                      | Description |
| -- | ----------------------- | ----------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ | ----------- |
| 1  | [**add**](#add)         | [AddScheduleRequest](#addschedulerequest)       | [ScheduleInfo](#scheduleinfo)                                                                                      |             |
| 2  | [**update**](#update)   | [UpdateScheduleRequest](#updateschedulerequest) | [ScheduleInfo](#scheduleinfo)                                                                                      |             |
| 3  | [**enable**](#enable)   | [ScheduleRequest](#schedulerequest)             | [ScheduleInfo](#scheduleinfo)                                                                                      |             |
| 4  | [**disable**](#disable) | [ScheduleRequest](#schedulerequest)             | [ScheduleInfo](#scheduleinfo)                                                                                      |             |
| 5  | [**delete**](#delete)   | [ScheduleRequest](#schedulerequest)             | [google.protobuf.Empty](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/empty.proto)   |             |
| 6  | [**get**](#get)         | [GetScheduleRequest](#getschedulerequest)       | [ScheduleInfo](#scheduleinfo)                                                                                      |             |
| 7  | [**list**](#list)       | [ScheduleQuery](#schedulequery)                 | [SchedulesInfo](#schedulesinfo)                                                                                    |             |
| 8  | [**stat**](#stat)       | [ScheduleStatQuery](#schedulestatquery)         | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |             |

### add

> **POST** /statistics/v1/schedules

| Type     | Message                                   |
| -------- | ----------------------------------------- |
| Request  | [AddScheduleRequest](#addschedulerequest) |
| Response | [ScheduleInfo](#scheduleinfo)             |

### update

> **PUT** /statistics/v1/schedule/{schedule\_id}

| Type     | Message                                         |
| -------- | ----------------------------------------------- |
| Request  | [UpdateScheduleRequest](#updateschedulerequest) |
| Response | [ScheduleInfo](#scheduleinfo)                   |

### enable

> **PUT** /statistics/v1/schedule/{schedule\_id}/enable

| Type     | Message                             |
| -------- | ----------------------------------- |
| Request  | [ScheduleRequest](#schedulerequest) |
| Response | [ScheduleInfo](#scheduleinfo)       |

### disable

> **PUT** /statistics/v1/schedule/{schedule\_id}/disable

| Type     | Message                             |
| -------- | ----------------------------------- |
| Request  | [ScheduleRequest](#schedulerequest) |
| Response | [ScheduleInfo](#scheduleinfo)       |

### delete

> **DELETE** /statistics/v1/schedule/{schedule\_id}

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

### get

> **GET** /statistics/v1/schedule/{schedule\_id}

| Type     | Message                                   |
| -------- | ----------------------------------------- |
| Request  | [GetScheduleRequest](#getschedulerequest) |
| Response | [ScheduleInfo](#scheduleinfo)             |

### list

> **GET** /statistics/v1/schedules
>
> **POST** /statistics/v1/schedules/search

| Type     | Message                         |
| -------- | ------------------------------- |
| Request  | [ScheduleQuery](#schedulequery) |
| Response | [SchedulesInfo](#schedulesinfo) |

### stat

> **POST** /statistics/v1/schedules/stat

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

## Message

### AddScheduleRequest

| No | Field      | Type                             | Required | Description |
| -- | ---------- | -------------------------------- | -------- | ----------- |
| 1  | topic      | string                           | ✅        |             |
| 2  | options    | [QueryOption](#queryoption)      | ✅        |             |
| 3  | schedule   | [Scheduled](#scheduled)          | ✅        |             |
| 4  | tags       | list of spaceone.api.core.v1.Tag | ❌        |             |
| 5  | domain\_id | string                           | ✅        |             |

### GetScheduleRequest

| No | Field        | Type           | Required | Description |
| -- | ------------ | -------------- | -------- | ----------- |
| 1  | schedule\_id | string         | ✅        |             |
| 2  | domain\_id   | string         | ✅        |             |
| 3  | only         | list of string | ❌        |             |

### QueryOption

| No | Field            | Type                                                                                                               | Required | Description |
| -- | ---------------- | ------------------------------------------------------------------------------------------------------------------ | -------- | ----------- |
| 1  | data\_source\_id | string                                                                                                             | ❌        |             |
| 2  | resource\_type   | string                                                                                                             | ✅        |             |
| 3  | query            | [spaceone.api.core.v1.StatisticsQuery](https://spaceone-dev.gitbook.io/api-reference/common-v1/statistics-query)   | ✅        |             |
| 4  | join             | [list of ScheduleJoinQuery](#schedulejoinquery)                                                                    | ❌        |             |
| 5  | formulas         | [list of ScheduleFormula](#scheduleformula)                                                                        | ❌        |             |
| 6  | concat           | [list of ScheduleConcatQuery](#scheduleconcatquery)                                                                | ❌        |             |
| 7  | extend\_data     | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) | ❌        |             |
| 8  | fill\_na         | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) | ❌        |             |

### ScheduleConcatQuery

| No | Field            | Type                                                                                                               | Required | Description |
| -- | ---------------- | ------------------------------------------------------------------------------------------------------------------ | -------- | ----------- |
| 1  | data\_source\_id | string                                                                                                             | ❌        |             |
| 2  | resource\_type   | string                                                                                                             | ✅        |             |
| 3  | query            | [spaceone.api.core.v1.StatisticsQuery](https://spaceone-dev.gitbook.io/api-reference/common-v1/statistics-query)   | ✅        |             |
| 4  | extend\_data     | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) | ❌        |             |

### ScheduleFormula

| No | Field    | Type   | Required | Description |
| -- | -------- | ------ | -------- | ----------- |
| 1  | formula  | string | ✅        |             |
| 2  | operator | string | ❌        |             |

### ScheduleInfo

| No | Field               | Type                                                                                                                     | Description |
| -- | ------------------- | ------------------------------------------------------------------------------------------------------------------------ | ----------- |
| 1  | schedule\_id        | string                                                                                                                   |             |
| 2  | topic               | string                                                                                                                   |             |
| 3  | state               | <ul><li>NONE</li><li>ENABLED</li><li>DISABLED</li></ul>                                                                  |             |
| 4  | options             | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto)       |             |
| 5  | schedule            | [Scheduled](#scheduled)                                                                                                  |             |
| 6  | tags                | list of spaceone.api.core.v1.Tag                                                                                         |             |
| 7  | domain\_id          | string                                                                                                                   |             |
| 8  | created\_at         | [google.protobuf.Timestamp](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/timestamp.proto) |             |
| 9  | last\_scheduled\_at | [google.protobuf.Timestamp](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/timestamp.proto) |             |

### ScheduleJoinQuery

| No | Field            | Type                                                                                                               | Required | Description |
| -- | ---------------- | ------------------------------------------------------------------------------------------------------------------ | -------- | ----------- |
| 1  | keys             | list of string                                                                                                     | ❌        |             |
| 2  | type             | <ul><li>LEFT</li><li>RIGHT</li><li>OUTER</li><li>INNER</li></ul>                                                   | ❌        |             |
| 3  | data\_source\_id | string                                                                                                             | ❌        |             |
| 4  | resource\_type   | string                                                                                                             | ✅        |             |
| 5  | query            | [spaceone.api.core.v1.StatisticsQuery](https://spaceone-dev.gitbook.io/api-reference/common-v1/statistics-query)   | ✅        |             |
| 6  | extend\_data     | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) | ❌        |             |

### ScheduleQuery

| No | Field            | Type                                                                                               | Required | Description |
| -- | ---------------- | -------------------------------------------------------------------------------------------------- | -------- | ----------- |
| 1  | query            | [spaceone.api.core.v1.Query](https://spaceone-dev.gitbook.io/api-reference/common-v1/search-query) | ❌        |             |
| 2  | schedule\_id     | string                                                                                             | ❌        |             |
| 3  | topic            | string                                                                                             | ❌        |             |
| 4  | state            | string                                                                                             | ❌        |             |
| 5  | data\_source\_id | string                                                                                             | ❌        |             |
| 6  | resource\_type   | string                                                                                             | ❌        |             |
| 7  | domain\_id       | string                                                                                             | ✅        |             |

### ScheduleRequest

| No | Field        | Type   | Required | Description |
| -- | ------------ | ------ | -------- | ----------- |
| 1  | schedule\_id | string | ✅        |             |
| 2  | domain\_id   | string | ✅        |             |

### ScheduleStatQuery

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

### Scheduled

| No | Field    | Type                                                                                                    | Description |
| -- | -------- | ------------------------------------------------------------------------------------------------------- | ----------- |
| 1  | cron     | string                                                                                                  |             |
| 2  | interval | [int32](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/type.proto)         |             |
| 3  | minutes  | [list of int32](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/type.proto) |             |
| 4  | hours    | [list of int32](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/type.proto) |             |

### SchedulesInfo

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

### UpdateScheduleRequest

| No | Field        | Type                             | Required | Description |
| -- | ------------ | -------------------------------- | -------- | ----------- |
| 1  | schedule\_id | string                           | ✅        |             |
| 2  | schedule     | [Scheduled](#scheduled)          | ❌        |             |
| 3  | tags         | list of spaceone.api.core.v1.Tag | ❌        |             |
| 4  | domain\_id   | string                           | ✅        |             |
