Maintenance Service
Manage scheduled maintenance windows. The Maintenance Service provides 8 RPC methods.
Create Maintenance Window
const { maintenance } = await client.maintenance.v1.MaintenanceService
.createMaintenance({
title: "Database Upgrade",
message: "We will be upgrading our database infrastructure.",
from: "2024-01-20T02:00:00Z",
to: "2024-01-20T04:00:00Z",
pageId: "1",
pageComponentIds: ["12"],
notify: true,
});
console.log(`Maintenance created: ${maintenance?.id}`);
All date fields (from, to) must be in RFC 3339 format.
List Maintenances
List maintenance windows with optional page filtering.
const { maintenances, totalSize } = await client.maintenance.v1
.MaintenanceService.listMaintenances({
limit: 10,
offset: 0,
pageId: "1",
});
console.log(`Found ${totalSize} maintenance windows`);
Get / Update / Delete Maintenance Windows
Get Maintenance
const { maintenance } = await client.maintenance.v1.MaintenanceService
.getMaintenance({ id: "123" });
console.log(`Title: ${maintenance?.title}`);
console.log(`From: ${maintenance?.from}`);
console.log(`To: ${maintenance?.to}`);
Update Maintenance
const { maintenance } = await client.maintenance.v1.MaintenanceService
.updateMaintenance({
id: "123",
title: "Extended Database Upgrade",
to: "2024-01-20T06:00:00Z",
});
Delete Maintenance
const { success } = await client.maintenance.v1.MaintenanceService
.deleteMaintenance({ id: "123" });
Maintenance Updates
A maintenance is a timeline of dated notes; the first one is written at creation. A maintenance always keeps at least one update: deleting the last one fails with invalid_argument; delete the maintenance instead.
Add Maintenance Update
const { maintenanceUpdate } = await client.maintenance.v1.MaintenanceService
.addMaintenanceUpdate({
maintenanceId: "123",
message: "Work has started.",
notify: true,
});
Update Maintenance Update
const { maintenanceUpdate } = await client.maintenance.v1.MaintenanceService
.updateMaintenanceUpdate({
id: "456",
message: "Work has started, running 30 minutes behind.",
});
Delete Maintenance Update
const { success } = await client.maintenance.v1.MaintenanceService
.deleteMaintenanceUpdate({ id: "456" });