---
title: "POST /v1/projects/{projectsId}/locations/{locationsId}/clusters/{clustersId}:setMaintenancePolicy"
method: POST
path: "/v1/projects/{projectsId}/locations/{locationsId}/clusters/{clustersId}:setMaintenancePolicy"
tags: ["projects"]
---

# POST /v1/projects/{projectsId}/locations/{locationsId}/clusters/{clustersId}:setMaintenancePolicy

`POST /v1/projects/{projectsId}/locations/{locationsId}/clusters/{clustersId}:setMaintenancePolicy`

## Request

- Base URL: `https://container.googleapis.com`
- URL: `https://container.googleapis.com/v1/projects/{projectsId}/locations/{locationsId}/clusters/{clustersId}:setMaintenancePolicy`
- Auth: one of:
  - OAuth 2 and OAuth 2
    - Implicit: `https://accounts.google.com/o/oauth2/auth`
    - Scopes: `https://www.googleapis.com/auth/cloud-platform`
    - Authorization code: `https://accounts.google.com/o/oauth2/auth`
    - Token URL: `https://accounts.google.com/o/oauth2/token` scopes: `https://www.googleapis.com/auth/cloud-platform`
  - OAuth 2 and OAuth 2
    - Implicit: `https://accounts.google.com/o/oauth2/auth`
    - Scopes: `https://www.googleapis.com/auth/container`
    - Authorization code: `https://accounts.google.com/o/oauth2/auth`
    - Token URL: `https://accounts.google.com/o/oauth2/token` scopes: `https://www.googleapis.com/auth/container`

Sets the maintenance policy for a cluster.

## Path parameters

- `projectsId` string, required
- `locationsId` string, required
- `clustersId` string, required

## Request body

- SetMaintenancePolicyRequest: SetMaintenancePolicyRequest sets the maintenance policy for a cluster.
  - `clusterId` string: Required. The name of the cluster to update.
  - `maintenancePolicy` MaintenancePolicy: MaintenancePolicy defines the maintenance policy to be used for the cluster.
    - `disruptionBudget` DisruptionBudget: DisruptionBudget defines the upgrade disruption budget for the cluster control plane.
      - `lastDisruptionTime` string, google-datetime: Output only. The last time a disruption was performed on the control plane.
      - `lastMinorVersionDisruptionTime` string, google-datetime: Output only. The last time a minor version upgrade was performed on the control plane.
      - `minorVersionDisruptionInterval` string, google-duration: Optional. The minimum duration between two minor version upgrades of the control plane.
      - `patchVersionDisruptionInterval` string, google-duration: Optional. The minimum duration between two patch version upgrades of the control plane.
    - `resourceVersion` string: A hash identifying the version of this policy, so that updates to fields of the policy won't accidentally undo intermediate changes (and so that users of the API unaware of some fields won't accidentally remove other fields). Make a `get()` request to the cluster to get the current resource version and include it with requests to set the policy.
    - `window` MaintenanceWindow: MaintenanceWindow defines the maintenance window to be used for the cluster.
      - `dailyMaintenanceWindow` DailyMaintenanceWindow: Time window specified for daily maintenance operations.
        - `duration` string: Output only. Duration of the time window, automatically chosen to be smallest possible in the given scenario. Duration will be in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) format "PTnHnMnS".
        - `startTime` string: Time within the maintenance window to start the maintenance operations. Time format should be in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) format "HH:MM", where HH : [00-23] and MM : [00-59] GMT.
      - `maintenanceExclusions` object: Exceptions to maintenance window. Non-emergency maintenance should not occur in these windows.
      - `recurringMaintenanceWindow` RecurringMaintenanceWindow: Represents an arbitrary window of time that recurs. Will replace RecurringTimeWindow.
        - `delayUntil` Date: Represents a whole or partial calendar date, such as a birthday. The time of day and time zone are either specified elsewhere or are insignificant. The date is relative to the Gregorian Calendar. This can represent one of the following: * A full date, with non-zero year, month, and day values. * A month and day, with a zero year (for example, an anniversary). * A year on its own, with a zero month and a zero day. * A year and month, with a zero day (for example, a credit card expiration date). Related types: * google.type.TimeOfDay * google.type.DateTime * google.protobuf.Timestamp
          - `day` integer: Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant.
          - `month` integer: Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day.
          - `year` integer: Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year.
        - `recurrence` string: Required. An RRULE (https://tools.ietf.org/html/rfc5545#section-3.8.5.3) for how this window recurs. For example, to have something repeat every weekday, you'd use: `FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR` To repeat some window daily (equivalent to the DailyMaintenanceWindow): `FREQ=DAILY` For the first weekend of every month: `FREQ=MONTHLY;BYSETPOS=1;BYDAY=SA,SU` The FREQ values of HOURLY, MINUTELY, and SECONDLY are not supported.
        - `windowDuration` string, google-duration: Required. Duration of the window.
        - `windowStartTime` TimeOfDay: Represents a time of day. The date and time zone are either not significant or are specified elsewhere. An API may choose to allow leap seconds. Related types are google.type.Date and `google.protobuf.Timestamp`.
          - `hours` integer: Hours of a day in 24 hour format. Must be greater than or equal to 0 and typically must be less than or equal to 23. An API may choose to allow the value "24:00:00" for scenarios like business closing time.
          - `minutes` integer: Minutes of an hour. Must be greater than or equal to 0 and less than or equal to 59.
          - `nanos` integer: Fractions of seconds, in nanoseconds. Must be greater than or equal to 0 and less than or equal to 999,999,999.
          - `seconds` integer: Seconds of a minute. Must be greater than or equal to 0 and typically must be less than or equal to 59. An API may allow the value 60 if it allows leap-seconds.
      - `recurringWindow` RecurringTimeWindow: Represents an arbitrary window of time that recurs.
        - `recurrence` string: An RRULE (https://tools.ietf.org/html/rfc5545#section-3.8.5.3) for how this window recurs. They go on for the span of time between the start and end time. For example, to have something repeat every weekday, you'd use: `FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR` To repeat some window daily (equivalent to the DailyMaintenanceWindow): `FREQ=DAILY` For the first weekend of every month: `FREQ=MONTHLY;BYSETPOS=1;BYDAY=SA,SU` This specifies how frequently the window starts. Eg, if you wanted to have a 9-5 UTC-4 window every weekday, you'd use something like: ``` start time = 2019-01-01T09:00:00-0400 end time = 2019-01-01T17:00:00-0400 recurrence = FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR ``` Windows can span multiple days. Eg, to make the window encompass every weekend from midnight Saturday till the last minute of Sunday UTC: ``` start time = 2019-01-05T00:00:00Z end time = 2019-01-07T23:59:00Z recurrence = FREQ=WEEKLY;BYDAY=SA ``` Note the start and end time's specific dates are largely arbitrary except to specify duration of the window and when it first starts. The FREQ values of HOURLY, MINUTELY, and SECONDLY are not supported.
        - `window` TimeWindow: Represents an arbitrary window of time.
          - `endTime` string, google-datetime: The time that the window ends. The end time should take place after the start time.
          - `maintenanceExclusionOptions` MaintenanceExclusionOptions: Represents the Maintenance exclusion option.
            - `endTimeBehavior` 'END_TIME_BEHAVIOR_UNSPECIFIED' | 'UNTIL_END_OF_SUPPORT': EndTimeBehavior specifies the behavior of the exclusion end time.
            - `scope` 'NO_UPGRADES' | 'NO_MINOR_UPGRADES' | 'NO_MINOR_OR_NODE_UPGRADES': Scope specifies the upgrade scope which upgrades are blocked by the exclusion.
          - `startTime` string, google-datetime: The time that the window first starts.
  - `name` string: The name (project, location, cluster name) of the cluster to set maintenance policy. Specified in the format `projects/*/locations/*/clusters/*`.
  - `projectId` string: Required. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects).
  - `zone` string: Required. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides.

## Response `200`

Successful response

- Operation: This operation resource represents operations that may have happened or are happening on the cluster. All fields are output only.
  - `clusterConditions` StatusCondition[]: Which conditions caused the current cluster state. Deprecated. Use field error instead.
    - `canonicalCode` 'OK' | 'CANCELLED' | 'UNKNOWN' | 'INVALID_ARGUMENT' | 'DEADLINE_EXCEEDED' | 'NOT_FOUND' | 'ALREADY_EXISTS' | 'PERMISSION_DENIED' | 'UNAUTHENTICATED' | 'RESOURCE_EXHAUSTED' | 'FAILED_PRECONDITION' | 'ABORTED' | 'OUT_OF_RANGE' | 'UNIMPLEMENTED' | 'INTERNAL' | 'UNAVAILABLE' | 'DATA_LOSS': Canonical code of the condition.
    - `code` 'UNKNOWN' | 'GCE_STOCKOUT' | 'GKE_SERVICE_ACCOUNT_DELETED' | 'GCE_QUOTA_EXCEEDED' | 'SET_BY_OPERATOR' | 'CLOUD_KMS_KEY_ERROR' | 'CA_EXPIRING' | 'NODE_SERVICE_ACCOUNT_MISSING_PERMISSIONS' | 'CLOUD_KMS_KEY_DESTROYED': Machine-friendly representation of the condition Deprecated. Use canonical_code instead.
    - `message` string: Human-friendly representation of the condition
  - `detail` string: Output only. Detailed operation progress, if available.
  - `endTime` string: Output only. The time the operation completed, in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format.
  - `error` Status: The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).
    - `code` integer: The status code, which should be an enum value of google.rpc.Code.
    - `details` object[]: A list of messages that carry the error details. There is a common set of message types for APIs to use.
    - `message` string: A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.
  - `location` string: Output only. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/regions-zones/regions-zones#available) or [region](https://cloud.google.com/compute/docs/regions-zones/regions-zones#available) in which the cluster resides.
  - `name` string: Output only. The server-assigned ID for the operation.
  - `nodepoolConditions` StatusCondition[]: Which conditions caused the current node pool state. Deprecated. Use field error instead.
    - `canonicalCode` 'OK' | 'CANCELLED' | 'UNKNOWN' | 'INVALID_ARGUMENT' | 'DEADLINE_EXCEEDED' | 'NOT_FOUND' | 'ALREADY_EXISTS' | 'PERMISSION_DENIED' | 'UNAUTHENTICATED' | 'RESOURCE_EXHAUSTED' | 'FAILED_PRECONDITION' | 'ABORTED' | 'OUT_OF_RANGE' | 'UNIMPLEMENTED' | 'INTERNAL' | 'UNAVAILABLE' | 'DATA_LOSS': Canonical code of the condition.
    - `code` 'UNKNOWN' | 'GCE_STOCKOUT' | 'GKE_SERVICE_ACCOUNT_DELETED' | 'GCE_QUOTA_EXCEEDED' | 'SET_BY_OPERATOR' | 'CLOUD_KMS_KEY_ERROR' | 'CA_EXPIRING' | 'NODE_SERVICE_ACCOUNT_MISSING_PERMISSIONS' | 'CLOUD_KMS_KEY_DESTROYED': Machine-friendly representation of the condition Deprecated. Use canonical_code instead.
    - `message` string: Human-friendly representation of the condition
  - `operationType` 'TYPE_UNSPECIFIED' | 'CREATE_CLUSTER' | 'DELETE_CLUSTER' | 'UPGRADE_MASTER' | 'UPGRADE_NODES' | 'REPAIR_CLUSTER' | 'UPDATE_CLUSTER' | 'CREATE_NODE_POOL' | 'DELETE_NODE_POOL' | 'SET_NODE_POOL_MANAGEMENT' | 'AUTO_REPAIR_NODES' | 'AUTO_UPGRADE_NODES' | 'SET_LABELS' | 'SET_MASTER_AUTH' | 'SET_NODE_POOL_SIZE' | 'SET_NETWORK_POLICY' | 'SET_MAINTENANCE_POLICY' | 'RESIZE_CLUSTER' | 'FLEET_FEATURE_UPGRADE': Output only. The operation type.
  - `progress` OperationProgress: Information about operation (or operation stage) progress.
    - `metrics` Metric[]: Progress metric bundle, for example: metrics: [{name: "nodes done", int_value: 15}, {name: "nodes total", int_value: 32}] or metrics: [{name: "progress", double_value: 0.56}, {name: "progress scale", double_value: 1.0}]
      - `doubleValue` number, double: For metrics with floating point value.
      - `intValue` string, int64: For metrics with integer value.
      - `name` string: Required. Metric name, e.g., "nodes total", "percent done".
      - `stringValue` string: For metrics with custom values (ratios, visual progress, etc.).
    - `name` string: A non-parameterized string describing an operation stage. Unset for single-stage operations.
    - `stages` OperationProgress[]: Substages of an operation or a stage.
    - `status` 'STATUS_UNSPECIFIED' | 'PENDING' | 'RUNNING' | 'DONE' | 'ABORTING': Status of an operation stage. Unset for single-stage operations.
  - `selfLink` string: Output only. Server-defined URI for the operation. Example: `https://container.googleapis.com/v1alpha1/projects/123/locations/us-central1/operations/operation-123`.
  - `startTime` string: Output only. The time the operation started, in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format.
  - `status` 'STATUS_UNSPECIFIED' | 'PENDING' | 'RUNNING' | 'DONE' | 'ABORTING': Output only. The current status of the operation.
  - `statusMessage` string: Output only. If an error has occurred, a textual description of the error. Deprecated. Use the field error instead.
  - `targetLink` string: Output only. Server-defined URI for the target of the operation. The format of this is a URI to the resource being modified (such as a cluster, node pool, or node). For node pool repairs, there may be multiple nodes being repaired, but only one will be the target. Examples: - ## `https://container.googleapis.com/v1/projects/123/locations/us-central1/clusters/my-cluster` ## `https://container.googleapis.com/v1/projects/123/zones/us-central1-c/clusters/my-cluster/nodePools/my-np` `https://container.googleapis.com/v1/projects/123/zones/us-central1-c/clusters/my-cluster/nodePools/my-np/node/my-node`
  - `zone` string: Output only. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the operation is taking place. This field is deprecated, use location instead.

## Changes

- **2026-11-03** `649eae563481`: 4 info
  - the security scope `https://www.googleapis.com/auth/cloud-platform` was added to the endpoint's security scheme `Oauth2`
  - the security scope `https://www.googleapis.com/auth/cloud-platform` was added to the endpoint's security scheme `Oauth2c`
  - the security scope `https://www.googleapis.com/auth/container` was removed from the endpoint's security scheme `Oauth2`
  - the security scope `https://www.googleapis.com/auth/container` was removed from the endpoint's security scheme `Oauth2c`

[Operation history](https://skmtc.dev/google/apis/container/changes/v1/projects/:projectsId/locations/:locationsId/clusters/:clustersId:setMaintenancePolicy/post.md)

---

[API](https://skmtc.dev/google/apis/container.md) - [All operations](https://skmtc.dev/google/apis/container/llms.txt) - [OpenAPI document](https://skmtc.dev/google/apis/container/revisions/649eae563481?raw)
