---
title: "POST /v1/{+name}:setMaintenancePolicy"
method: POST
path: "/v1/{+name}:setMaintenancePolicy"
tags: ["projects"]
---

# POST /v1/{+name}:setMaintenancePolicy

`POST /v1/{+name}:setMaintenancePolicy`

Sets the maintenance policy for a cluster.

## Path parameters

- `name` string, required

## Request body

- SetMaintenancePolicyRequest — SetMaintenancePolicyRequest sets the maintenance policy for a cluster.
  - `projectId` string — Required. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects).
  - `clusterId` string — Required. The name of the cluster to update.
  - `name` string — The name (project, location, cluster name) of the cluster to set maintenance policy. Specified in the format `projects/*/locations/*/clusters/*`.
  - `zone` string — Required. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides.
  - `maintenancePolicy` MaintenancePolicy — MaintenancePolicy defines the maintenance policy to be used for the cluster.
    - `window` MaintenanceWindow — MaintenanceWindow defines the maintenance window to be used for the cluster.
      - `dailyMaintenanceWindow` DailyMaintenanceWindow — Time window specified for daily maintenance operations.
        - `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.
        - `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".
      - `recurringMaintenanceWindow` RecurringMaintenanceWindow — Represents an arbitrary window of time that recurs. Will replace RecurringTimeWindow.
        - `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.
        - `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
          - `year` integer — Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year.
          - `month` integer — Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day.
          - `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.
        - `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.
          - `nanos` integer — Fractions of seconds, in nanoseconds. Must be greater than or equal to 0 and less than or equal to 999,999,999.
          - `minutes` integer — Minutes of an hour. Must be greater than or equal to 0 and less than or equal to 59.
          - `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.
      - `maintenanceExclusions` object — Exceptions to maintenance window. Non-emergency maintenance should not occur in these windows.
      - `recurringWindow` RecurringTimeWindow — Represents an arbitrary window of time that recurs.
        - `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.
            - `scope` 'NO_UPGRADES' | 'NO_MINOR_UPGRADES' | 'NO_MINOR_OR_NODE_UPGRADES' — Scope specifies the upgrade scope which upgrades are blocked by the exclusion.
            - `endTimeBehavior` 'END_TIME_BEHAVIOR_UNSPECIFIED' | 'UNTIL_END_OF_SUPPORT' — EndTimeBehavior specifies the behavior of the exclusion end time.
          - `startTime` string, google-datetime — The time that the window first starts.
        - `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.
    - `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.
    - `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.
      - `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.
      - `lastMinorVersionDisruptionTime` string, google-datetime — Output only. The last time a minor version upgrade was performed on the control plane.

## Response `200`

Successful response

---

[API](https://skmtc.net/google/apis/container.md) · [All operations](https://skmtc.net/google/apis/container/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/google/container/revisions/f20e7f9e2240/schema)
