# Maintenance Window

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

## MaintenanceWindow

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

| Method                | Request                                                           | Response                                                                                                           |
| --------------------- | ----------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
| [**create**](#create) | [CreateMaintenanceWindowRequest](#createmaintenancewindowrequest) | [MaintenanceWindowInfo](#maintenancewindowinfo)                                                                    |
| [**update**](#update) | [UpdateMaintenanceWindowRequest](#updatemaintenancewindowrequest) | [MaintenanceWindowInfo](#maintenancewindowinfo)                                                                    |
| [**close**](#close)   | [MaintenanceWindowRequest](#maintenancewindowrequest)             | [MaintenanceWindowInfo](#maintenancewindowinfo)                                                                    |
| [**get**](#get)       | [GetMaintenanceWindowRequest](#getmaintenancewindowrequest)       | [MaintenanceWindowInfo](#maintenancewindowinfo)                                                                    |
| [**list**](#list)     | [MaintenanceWindowQuery](#maintenancewindowquery)                 | [MaintenanceWindowsInfo](#maintenancewindowsinfo)                                                                  |
| [**stat**](#stat)     | [MaintenanceWindowStatQuery](#maintenancewindowstatquery)         | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |

### create

> **POST** /monitoring/v1/maintenance-windows

> Creates a new MaintenanceWindow. When creating a MaintenanceWindow, you can set the title and maintenance schedule of the MaintenanceWindow. From the `start_time` to the `end_time` specified by the schedule set in this method, alerts in the Projects linked with the MaintenanceWindow are ceased.

| Type     | Message                                                           |
| -------- | ----------------------------------------------------------------- |
| Request  | [CreateMaintenanceWindowRequest](#createmaintenancewindowrequest) |
| Response | [MaintenanceWindowInfo](#maintenancewindowinfo)                   |

{% tabs %}
{% tab title="Request Example" %}

```
{
    "title": "The dev server is under regular maintenance.",
    "projects": [
        "project-123456789012"
    ],
    "start_time": "2022-01-01T09:45:00.000Z",
    "end_time": "2022-01-01T10:45:00.000Z",
    "domain_id": "domain-123456789012"
}
```

{% endtab %}

{% tab title="Response Example" %}

```
{
    "maintenance_window_id": "mw-123456789012",
    "title": "The dev server is under regular maintenance.",
    "state": "OPEN",
    "start_time": "2022-01-01T09:45:00.000Z",
    "end_time": "2022-01-01T10:45:00.000Z",
    "tags": {},
    "projects": [
        "project-123456789012"
    ],
    "domain_id": "domain-123456789012",
    "created_by": "user1@email.com",
    "created_at": "2022-06-02T09:46:49.196Z",
    "updated_at": "2022-06-02T09:46:49.196Z"
}
```

{% endtab %}
{% endtabs %}

### update

> **PUT** /monitoring/v1/maintenance-window/{maintenance\_window\_id}

> Updates a specific MaintenanceWindow. You can make changes in MaintenanceWindow settings including, the `title` and the schedule.

| Type     | Message                                                           |
| -------- | ----------------------------------------------------------------- |
| Request  | [UpdateMaintenanceWindowRequest](#updatemaintenancewindowrequest) |
| Response | [MaintenanceWindowInfo](#maintenancewindowinfo)                   |

{% tabs %}
{% tab title="Request Example" %}

```
{
    "maintenance_window_id": "mw-123456789012",
    "title": "The dev server is under regular maintenance.",
    "projects": [
        "project-123456789012"
    ],
    "start_time": "2022-01-03T00:00:00.000Z",
    "end_time": "2022-01-03T01:00:00.000Z",
    "domain_id": "domain-123456789012"
}
```

{% endtab %}

{% tab title="Response Example" %}

```
{
    "maintenance_window_id": "mw-123456789012",
    "title": "The dev server is under regular maintenance.",
    "state": "OPEN",
    "start_time": "2022-06-03T00:00:00.000Z",
    "end_time": "2022-06-03T01:00:00.000Z",
    "tags": {},
    "projects": [
        "project-123456789012"
    ],
    "domain_id": "domain-123456789012",
    "created_by": "user1@email.com",
    "created_at": "2022-01-02T09:46:49.196Z",
    "updated_at": "2022-01-02T09:46:49.196Z"
}
```

{% endtab %}
{% endtabs %}

### close

> **PUT** /monitoring/v1/maintenance-window/{maintenance\_window\_id}/close

> Closes a MaintenanceWindow by changing the state of the MaintenanceWindow to `CLOSED` when the maintenance is completed. As the MaintenanceWindow is not deleted but closed, the maintenance history remains undeleted.

| Type     | Message                                               |
| -------- | ----------------------------------------------------- |
| Request  | [MaintenanceWindowRequest](#maintenancewindowrequest) |
| Response | [MaintenanceWindowInfo](#maintenancewindowinfo)       |

{% tabs %}
{% tab title="Request Example" %}

```
{
    "maintenance_window_id": "mw-123456789012",
    "domain_id": "domain-123456789012"
}
```

{% endtab %}

{% tab title="Response Example" %}

```
{
    "maintenance_window_id": "mw-123456789012",
    "title": "The dev server is under regular maintenance.",
    "state": "CLOSED",
    "start_time": "2022-06-03T00:00:00.000Z",
    "end_time": "2022-06-03T01:00:00.000Z",
    "tags": {},
    "projects": [
        "project-123456789012"
    ],
    "domain_id": "domain-123456789012",
    "created_by": "user1@email.com",
    "created_at": "2022-01-02T09:46:49.196Z",
    "updated_at": "2022-01-02T09:46:49.196Z"
}
```

{% endtab %}
{% endtabs %}

### get

> **GET** /monitoring/v1/maintenance-window/{maintenance\_window\_id}

> Gets a specific MaintenanceWindow. Prints detailed information about the MaintenanceWindow, including the title and the schedule.

| Type     | Message                                                     |
| -------- | ----------------------------------------------------------- |
| Request  | [GetMaintenanceWindowRequest](#getmaintenancewindowrequest) |
| Response | [MaintenanceWindowInfo](#maintenancewindowinfo)             |

{% tabs %}
{% tab title="Request Example" %}

```
{
    "maintenance_window_id": "mw-123456789012",
    "domain_id": "domain-123456789012"
}
```

{% endtab %}

{% tab title="Response Example" %}

```
{
    "maintenance_window_id": "mw-123456789012",
    "title": "The dev server is under regular maintenance.",
    "state": "OPEN",
    "start_time": "2022-06-03T00:00:00.000Z",
    "end_time": "2022-06-03T01:00:00.000Z",
    "tags": {},
    "projects": [
        "project-123456789012"
    ],
    "domain_id": "domain-123456789012",
    "created_by": "user1@email.com",
    "created_at": "2022-01-02T09:46:49.196Z",
    "updated_at": "2022-01-02T09:46:49.196Z"
}
```

{% endtab %}
{% endtabs %}

### list

> **GET** /monitoring/v1/maintenance-windows
>
> **POST** /monitoring/v1/maintenance-windows/search

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

| Type     | Message                                           |
| -------- | ------------------------------------------------- |
| Request  | [MaintenanceWindowQuery](#maintenancewindowquery) |
| Response | [MaintenanceWindowsInfo](#maintenancewindowsinfo) |

{% tabs %}
{% tab title="Request Example" %}

```
{
    "query": {},
    "domain_id": "domain-123456789012"
}
```

{% endtab %}

{% tab title="Response Example" %}

```
{
    "results": [
        {
            "maintenance_window_id": "mw-123456789012",
            "title": "The dev server is under regular maintenance.",
            "state": "OPEN",
            "start_time": "2022-06-03T00:00:00.000Z",
            "end_time": "2022-06-03T01:00:00.000Z",
            "tags": {},
            "projects": [
                "project-123456789012"
            ],
            "domain_id": "domain-123456789012",
            "created_by": "user1@email.com",
            "created_at": "2022-01-01T09:59:01.966Z",
            "updated_at": "2022-01-01T09:59:01.966Z"
        },
        {
            "maintenance_window_id": "mw-987654321098",
            "title": "The prd server is under regular maintenance.",
            "state": "OPEN",
            "start_time": "2022-06-03T00:00:00.000Z",
            "end_time": "2022-06-03T01:00:00.000Z",
            "tags": {},
            "projects": [
                "project-123456789012"
            ],
            "domain_id": "domain-123456789012",
            "created_by": "user2@email.com",
            "created_at": "2022-01-02T09:57:28.999Z",
            "updated_at": "2022-01-02T09:57:28.999Z"
        }
    ],
    "total_count": 50
}
```

{% endtab %}
{% endtabs %}

### stat

> **POST** /monitoring/v1/maintenance-windows/stat

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

##

## Message

### CreateMaintenanceWindowRequest

| Field       | Type                                                                                                               | Required | Description |
| ----------- | ------------------------------------------------------------------------------------------------------------------ | :------: | ----------- |
| title       | string                                                                                                             |     ✔    |             |
| projects    | list of string                                                                                                     |     ✔    |             |
| start\_time | string                                                                                                             |     ✔    |             |
| end\_time   | string                                                                                                             |     ✔    |             |
| tags        | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |     ✘    |             |
| domain\_id  | string                                                                                                             |     ✔    |             |

### GetMaintenanceWindowRequest

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

### MaintenanceWindowInfo

| Field                   | Type                                                                                                               | Description |
| ----------------------- | ------------------------------------------------------------------------------------------------------------------ | ----------- |
| maintenance\_window\_id | string                                                                                                             |             |
| title                   | string                                                                                                             |             |
| state                   | <ul><li>NONE</li><li>OPEN</li><li>CLOSED</li></ul>                                                                 |             |
| start\_time             | string                                                                                                             |             |
| end\_time               | string                                                                                                             |             |
| tags                    | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |             |
| projects                | list of string                                                                                                     |             |
| domain\_id              | string                                                                                                             |             |
| created\_by             | string                                                                                                             |             |
| created\_at             | string                                                                                                             |             |
| updated\_at             | string                                                                                                             |             |
| closed\_at              | string                                                                                                             |             |

### MaintenanceWindowQuery

| Field                   | Type                                                                                               | Required | Description |
| ----------------------- | -------------------------------------------------------------------------------------------------- | -------- | ----------- |
| query                   | [spaceone.api.core.v1.Query](https://spaceone-dev.gitbook.io/api-reference/common-v1/search-query) | ✘        |             |
| maintenance\_window\_id | string                                                                                             | ✘        |             |
| title                   | string                                                                                             | ✘        |             |
| state                   | <ul><li>NONE</li><li>OPEN</li><li>CLOSED</li></ul>                                                 | ✘        |             |
| project\_id             | string                                                                                             | ✘        |             |
| created\_by             | string                                                                                             | ✘        |             |
| domain\_id              | string                                                                                             | ✔        |             |

### MaintenanceWindowRequest

| Field                   | Type   | Required | Description |
| ----------------------- | ------ | :------: | ----------- |
| maintenance\_window\_id | string |     ✔    |             |
| domain\_id              | string |     ✔    |             |

### MaintenanceWindowStatQuery

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

### MaintenanceWindowsInfo

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

### UpdateMaintenanceWindowRequest

| Field                   | Type                                                                                                               | Required | Description |
| ----------------------- | ------------------------------------------------------------------------------------------------------------------ | :------: | ----------- |
| maintenance\_window\_id | string                                                                                                             |     ✔    |             |
| title                   | string                                                                                                             |     ✘    |             |
| projects                | list of string                                                                                                     |     ✘    |             |
| start\_time             | string                                                                                                             |     ✘    |             |
| end\_time               | string                                                                                                             |     ✘    |             |
| tags                    | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |     ✘    |             |
| domain\_id              | string                                                                                                             |     ✔    |             |
