# Job

> **Package : spaceone.api.power\_scheduler.v1**

## Job

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

| NO | Method            | Request Type                  | Response Type                                                                                                      | Description |
| -- | ----------------- | ----------------------------- | ------------------------------------------------------------------------------------------------------------------ | ----------- |
| 1  | [**list**](#list) | [JobsQuery](#jobsquery)       | [JobsInfo](#jobsinfo)                                                                                              |             |
| 2  | [**stat**](#stat) | [JobStatQuery](#jobstatquery) | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |             |

### list

> **GET** /power-scheduler/v1/jobs
>
> **POST** /power-scheduler/v1/jobs/search

| Type     | Message                 |
| -------- | ----------------------- |
| Request  | [JobsQuery](#jobsquery) |
| Response | [JobsInfo](#jobsinfo)   |

### stat

> **POST** /power-scheduler/v1/jobs/stat

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

## Message

### ErrorInfo

| No | Field       | Type                                                                                                               | Description |
| -- | ----------- | ------------------------------------------------------------------------------------------------------------------ | ----------- |
| 1  | error\_code | string                                                                                                             |             |
| 2  | message     | string                                                                                                             |             |
| 3  | additional  | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |             |

### JobInfo

| No | Field           | Type                                                                                                                       | Description |
| -- | --------------- | -------------------------------------------------------------------------------------------------------------------------- | ----------- |
| 1  | job\_id         | string                                                                                                                     |             |
| 2  | status          | <ul><li>NONE</li><li>CREATED</li><li>CANCELED</li><li>IN\_PROGRESS</li><li>SUCCESS</li><li>ERROR</li><li>TIMEOUT</li></ul> |             |
| 3  | filter          | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto)         |             |
| 4  | total\_tasks    | [int32](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/type.proto)                            |             |
| 5  | remained\_tasks | [int32](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/type.proto)                            |             |
| 6  | errors          | [list of ErrorInfo](#errorinfo)                                                                                            |             |
| 7  | schedule\_info  | [ScheduleInfo](#scheduleinfo)                                                                                              |             |
| 8  | control\_action | <ul><li>CONTROL\_ACTION\_NONE</li><li>RUNNING</li><li>STOPPED</li></ul>                                                    |             |
| 9  | project\_id     | string                                                                                                                     |             |
| 10 | domain\_id      | string                                                                                                                     |             |
| 11 | job\_type       | <ul><li>JOB\_TYPE\_NONE</li><li>APPLY</li><li>MAINTAIN</li></ul>                                                           |             |
| 12 | created\_at     | string                                                                                                                     |             |
| 13 | updated\_at     | string                                                                                                                     |             |
| 14 | finished\_at    | string                                                                                                                     |             |

### JobStatQuery

| 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                                                                                                           | ✅        |             |

### JobsInfo

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

### JobsQuery

| No | Field           | Type                                                                                                                                    | Required | Description |
| -- | --------------- | --------------------------------------------------------------------------------------------------------------------------------------- | -------- | ----------- |
| 1  | query           | [spaceone.api.core.v1.Query](https://spaceone-dev.gitbook.io/api-reference/common-v1/search-query)                                      | ❌        |             |
| 2  | job\_id         | string                                                                                                                                  | ❌        |             |
| 3  | status          | <ul><li>JOB\_STATUS\_NONE</li><li>CREATED</li><li>CANCELED</li><li>IN\_PROGRESS</li><li>SUCCESS</li><li>ERROR</li><li>TIMEOUT</li></ul> | ❌        |             |
| 4  | schedule\_id    | string                                                                                                                                  | ❌        |             |
| 5  | control\_action | <ul><li>CONTROL\_ACTION\_NONE</li><li>RUNNING</li><li>STOPPED</li></ul>                                                                 | ❌        |             |
| 6  | project\_id     | string                                                                                                                                  | ❌        |             |
| 7  | domain\_id      | string                                                                                                                                  | ✅        |             |
| 8  | job\_type       | <ul><li>JOB\_TYPE\_NONE</li><li>APPLY</li><li>MAINTAIN</li></ul>                                                                        | ❌        |             |
