You can use the Unified Maintenance API to return information about maintenance on your resources.
This document describes how to use Cloud Shell to call the Unified Maintenance API to return resource maintenance.
To view upcoming and historical maintenance activities in Cloud Hub, see View maintenance activities.
Before you begin
Before you view maintenance on your resources using Unified Maintenance, verify that Unified Maintenance supports your resource types.
Filters
You can filter which maintenance activities are returned by several parameters:
- State (
SUCCEEDED
, orSTARTED
, for example) - Resource name
- Resource location
- Resource type
- Maintenance name
- Maintenance start time
- Maintenance end time
For more information, see Unified Maintenance API documentation.
View resource maintenances
You can use the Unified Maintenance API to return maintenance activity information for a Google Cloud project.
To list all maintenance activities:
Go to Cloud Shell.
Run the command:
curl \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "Content-Type: application/json" \ https://maintenance.googleapis.com/v1beta/projects/PROJECT_ID/locations/LOCATION/resourceMaintenances
Replace:
PROJECT_ID
: The project ID of your project.LOCATION
: Region or zone containing your project. Set toglobal
,region
, or-
(to match all locations).
Unified Maintenance returns information about resource maintenances for your specified project.
View maintenances for a resource
You can use the Unified Maintenance API to return maintenances for a specified resource.
To filter and print maintenances for a specified resource:
Go to Cloud Shell.
Run the command:
curl \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "Content-Type: application/json" \ https://maintenance.googleapis.com/v1beta/projects/PROJECT_ID/locations/LOCATION/resourceMaintenances?filter=FILTER=%22RESOURCE_NAME%22
Replace:
PROJECT_ID
: The project ID of your project.LOCATION
: Region or zone containing your project. Set toglobal
,region
, or-
(to match all locations).RESOURCE_NAME
: The full resource name of your resource.
What's next
- Learn how to configure alerts and notifications based on different webhooks.
- Use Unified Maintenance to reschedule or perform on-demand updates.