- [Resource: ResourcePolicy](https://docs.cloud.google.com/compute/docs/reference/rest/beta/resourcePolicies#ResourcePolicy)
  - [JSON representation](https://docs.cloud.google.com/compute/docs/reference/rest/beta/resourcePolicies#ResourcePolicy.SCHEMA_REPRESENTATION)
    - [JSON representation](https://docs.cloud.google.com/compute/docs/reference/rest/beta/resourcePolicies#ResourcePolicy.SCHEMA_REPRESENTATION.resource_status.SCHEMA_REPRESENTATION)
    - [JSON representation](https://docs.cloud.google.com/compute/docs/reference/rest/beta/resourcePolicies#ResourcePolicy.SCHEMA_REPRESENTATION.snapshot_schedule_policy.SCHEMA_REPRESENTATION)
      - [JSON representation](https://docs.cloud.google.com/compute/docs/reference/rest/beta/resourcePolicies#ResourcePolicy.SCHEMA_REPRESENTATION.snapshot_schedule_policy.SCHEMA_REPRESENTATION.weekly_schedule.SCHEMA_REPRESENTATION)
    - [JSON representation](https://docs.cloud.google.com/compute/docs/reference/rest/beta/resourcePolicies#ResourcePolicy.SCHEMA_REPRESENTATION.snapshot_schedule_policy.SCHEMA_REPRESENTATION_1)
    - [JSON representation](https://docs.cloud.google.com/compute/docs/reference/rest/beta/resourcePolicies#ResourcePolicy.SCHEMA_REPRESENTATION.snapshot_schedule_policy.SCHEMA_REPRESENTATION_2)
    - [JSON representation](https://docs.cloud.google.com/compute/docs/reference/rest/beta/resourcePolicies#ResourcePolicy.SCHEMA_REPRESENTATION.instance_schedule_policy.SCHEMA_REPRESENTATION)
    - [JSON representation](https://docs.cloud.google.com/compute/docs/reference/rest/beta/resourcePolicies#ResourcePolicy.SCHEMA_REPRESENTATION.instance_schedule_policy.SCHEMA_REPRESENTATION_1)
- [Methods](https://docs.cloud.google.com/compute/docs/reference/rest/beta/resourcePolicies#METHODS_SUMMARY)

## Resource: ResourcePolicy

Represents a Resource Policy resource. You can use resource policies to schedule actions for some Compute Engine resources. For example, you can use them to [schedule persistent disk snapshots](https://docs.cloud.google.com/compute/docs/disks/scheduled-snapshots).

| JSON representation |
|---|
| ``` { "kind": string, "id": string, "creationTimestamp": string, "selfLink": string, "region": string, "description": string, "name": string, "status": enum, "resourceStatus": { "instanceSchedulePolicy": { "nextRunStartTime": string, "lastRunStartTime": string } }, // The following is a list of mutually exclusive fields. At most one of the // fields will be set in a response: "snapshotSchedulePolicy": { "schedule": { // The following is a list of mutually exclusive fields. At most one of the // fields will be set in a response: "hourlySchedule": { "hoursInCycle": integer, "startTime": string, "duration": string }, "dailySchedule": { "daysInCycle": integer, "startTime": string, "duration": string }, "weeklySchedule": { "dayOfWeeks": [ { "day": enum, "startTime": string, "duration": string } ] } // End of mutually exclusive fields. }, "retentionPolicy": { "maxRetentionDays": integer, "onSourceDiskDelete": enum }, "snapshotProperties": { "labels": { string: string, ... }, "storageLocations": [ string ], "guestFlush": boolean, "chainName": string, "region": string } }, "groupPlacementPolicy": { "vmCount": integer, "availabilityDomainCount": integer, "collocation": enum, "tpuTopology": string, "maxDistance": integer, "sliceCount": integer, "gpuTopology": string, "acceleratorTopologyMode": enum }, "instanceSchedulePolicy": { "vmStartSchedule": { "schedule": string }, "vmStopSchedule": { "schedule": string }, "timeZone": string, "startTime": string, "expirationTime": string }, "diskConsistencyGroupPolicy": , "workloadPolicy": { "type": enum, "maxTopologyDistance": enum, "acceleratorTopology": string, "acceleratorTopologyMode": enum } // End of mutually exclusive fields. } ``` |

| Fields ||
|---|---|
| `kind` | `string` Output only. Type of the resource. Always `compute#resourcePolicies` for resource policies. |
| `id` | `string (https://developers.google.com/discovery/v1/type-format format)` Output only. The unique identifier for the resource. This identifier is defined by the server. |
| `creationTimestamp` | `string` Output only. Creation timestamp in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format. |
| `selfLink` | `string` Output only. Server-defined fully-qualified URL for this resource. |
| `region` | `string` |
| `description` | `string` |
| `name` | `string` The name of the resource, provided by the client when initially creating the resource. The resource name must be 1-63 characters long, and comply with [RFC1035](https://www.ietf.org/rfc/rfc1035.txt). Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. |
| `status` | `enum` Output only. The status of resource policy creation. |
| `resourceStatus` | `object` Output only. The system status of the resource policy. |
| `resourceStatus.instanceSchedulePolicy` | `object` Output only. Specifies a set of output values reffering to the instanceSchedulePolicy system status. This field should have the same name as corresponding policy field. |
| `resourceStatus.instanceSchedulePolicy.nextRunStartTime` | `string` Output only. The next time the schedule is planned to run. The actual time might be slightly different. The timestamp is an RFC3339 string. |
| `resourceStatus.instanceSchedulePolicy.lastRunStartTime` | `string` Output only. The last time the schedule successfully ran. The timestamp is an RFC3339 string. |
| The following is a list of mutually exclusive fields. At most one of the fields will be set in a response: ||
| `snapshotSchedulePolicy` | `object` Resource policy for persistent disks for creating snapshots. |
| `snapshotSchedulePolicy.schedule` | `object` A Vm Maintenance Policy specifies what kind of infrastructure maintenance we are allowed to perform on this VM and when. Schedule that is applied to disks covered by this policy. |
| `snapshotSchedulePolicy.schedule.hourlySchedule` | `object` |
| `snapshotSchedulePolicy.schedule.hourlySchedule.hoursInCycle` | `integer` Defines a schedule with units measured in hours. The value determines how many hours pass between the start of each cycle. |
| `snapshotSchedulePolicy.schedule.hourlySchedule.startTime` | `string` Time within the window to start the operations. It must be in format "HH:MM", where HH : \[00-23\] and MM : \[00-00\] GMT. |
| `snapshotSchedulePolicy.schedule.hourlySchedule.duration` | `string` Output only. Duration of the time window, automatically chosen to be smallest possible in the given scenario. |
| `snapshotSchedulePolicy.schedule.dailySchedule` | `object` |
| `snapshotSchedulePolicy.schedule.dailySchedule.daysInCycle` | `integer` Defines a schedule with units measured in days. The value determines how many days pass between the start of each cycle. |
| `snapshotSchedulePolicy.schedule.dailySchedule.startTime` | `string` Start time of the window. This must be in UTC format that resolves to one of `00:00`, `04:00`, `08:00`, `12:00`, `16:00`, or `20:00`. For example, both `13:00-5` and `08:00` are valid. |
| `snapshotSchedulePolicy.schedule.dailySchedule.duration` | `string` Output only. A predetermined duration for the window, automatically chosen to be the smallest possible in the given scenario. |
| `snapshotSchedulePolicy.schedule.weeklySchedule` | `object` |
| `snapshotSchedulePolicy.schedule.weeklySchedule.dayOfWeeks[]` | `object` Up to 7 intervals/windows, one for each day of the week. |
| `snapshotSchedulePolicy.schedule.weeklySchedule.dayOfWeeks[].day` | `enum` Defines a schedule that runs on specific days of the week. Specify one or more days. The following options are available: MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY. |
| `snapshotSchedulePolicy.schedule.weeklySchedule.dayOfWeeks[].startTime` | `string` Time within the window to start the operations. It must be in format "HH:MM", where HH : \[00-23\] and MM : \[00-00\] GMT. |
| `snapshotSchedulePolicy.schedule.weeklySchedule.dayOfWeeks[].duration` | `string` Output only. Duration of the time window, automatically chosen to be smallest possible in the given scenario. |
| `snapshotSchedulePolicy.retentionPolicy` | `object` Retention policy applied to snapshots created by this resource policy. |
| `snapshotSchedulePolicy.retentionPolicy.maxRetentionDays` | `integer` Maximum age of the snapshot that is allowed to be kept. |
| `snapshotSchedulePolicy.retentionPolicy.onSourceDiskDelete` | `enum` Specifies the behavior to apply to scheduled snapshots when the source disk is deleted. |
| `snapshotSchedulePolicy.snapshotProperties` | `object` Properties with which snapshots are created such as labels, encryption keys. |
| `snapshotSchedulePolicy.snapshotProperties.labels` | `map (key: string, value: string)` Labels to apply to scheduled snapshots. These can be later modified by the `setLabels` method. Label values may be empty. |
| `snapshotSchedulePolicy.snapshotProperties.storageLocations[]` | `string` Cloud Storage bucket storage location of the auto snapshot (regional or multi-regional). |
| `snapshotSchedulePolicy.snapshotProperties.guestFlush` | `boolean` Indication to perform a 'guest aware' snapshot. |
| `snapshotSchedulePolicy.snapshotProperties.chainName` | `string` Chain name that the snapshot is created in. |
| `snapshotSchedulePolicy.snapshotProperties.region` | `string` Region where the snapshot is scoped to. |
| `groupPlacementPolicy` | `object` Resource policy for instances for placement configuration. |
| `groupPlacementPolicy.vmCount` | `integer` Number of VMs in this placement group. Google does not recommend that you use this field unless you use a compact policy and you want your policy to work only if it contains this exact number of VMs. |
| `groupPlacementPolicy.availabilityDomainCount` | `integer` The number of availability domains to spread instances across. If two instances are in different availability domain, they are not in the same low latency network. |
| `groupPlacementPolicy.collocation` | `enum` Specifies network collocation |
| `groupPlacementPolicy.tpuTopology` | `string` Specifies the shape of the TPU slice |
| `groupPlacementPolicy.maxDistance` | `integer` Specifies the number of max logical switches. |
| `groupPlacementPolicy.sliceCount` | `integer` Specifies the number of slices in a multislice workload. |
| `groupPlacementPolicy.gpuTopology` | `string` Specifies the shape of the GPU slice, in slice based GPU families eg. A4X. |
| `groupPlacementPolicy.acceleratorTopologyMode` | `enum` Specifies the connection mode for the accelerator topology. If not specified, the default is AUTO_CONNECT. |
| `instanceSchedulePolicy` | `object` Resource policy for scheduling instance operations. |
| `instanceSchedulePolicy.vmStartSchedule` | `object` Specifies the schedule for starting instances. |
| `instanceSchedulePolicy.vmStartSchedule.schedule` | `string` Specifies the frequency for the operation, using the unix-cron format. |
| `instanceSchedulePolicy.vmStopSchedule` | `object` Specifies the schedule for stopping instances. |
| `instanceSchedulePolicy.vmStopSchedule.schedule` | `string` Specifies the frequency for the operation, using the unix-cron format. |
| `instanceSchedulePolicy.timeZone` | `string` Specifies the time zone to be used in interpreting Schedule.schedule. The value of this field must be a time zone name from the tz database: <https://wikipedia.org/wiki/Tz_database>. |
| `instanceSchedulePolicy.startTime` | `string` The start time of the schedule. The timestamp is an RFC3339 string. |
| `instanceSchedulePolicy.expirationTime` | `string` The expiration time of the schedule. The timestamp is an RFC3339 string. |
| `diskConsistencyGroupPolicy` | `object` Resource policy for disk consistency groups. |
| `workloadPolicy` | `object` Resource policy for defining instance placement for MIGs. |
| `workloadPolicy.type` | `enum` Specifies the intent of the instance placement in the MIG. |
| `workloadPolicy.maxTopologyDistance` | `enum` Specifies the maximum distance between instances. |
| `workloadPolicy.acceleratorTopology` | `string` Specifies the topology required to create a partition for VMs that have interconnected GPUs. |
| `workloadPolicy.acceleratorTopologyMode` | `enum` Specifies the connection mode for the accelerator topology. If not specified, the default is AUTO_CONNECT. |
| End of mutually exclusive fields. ||

| ## Methods ||
|---|---|
| ### `https://docs.cloud.google.com/compute/docs/reference/rest/beta/resourcePolicies/aggregatedList` | Retrieves an aggregated list of resource policies. |
| ### `https://docs.cloud.google.com/compute/docs/reference/rest/beta/resourcePolicies/delete` | Deletes the specified resource policy. |
| ### `https://docs.cloud.google.com/compute/docs/reference/rest/beta/resourcePolicies/get` | Retrieves all information of the specified resource policy. |
| ### `https://docs.cloud.google.com/compute/docs/reference/rest/beta/resourcePolicies/getIamPolicy` | Gets the access control policy for a resource. |
| ### `https://docs.cloud.google.com/compute/docs/reference/rest/beta/resourcePolicies/insert` | Creates a new resource policy. |
| ### `https://docs.cloud.google.com/compute/docs/reference/rest/beta/resourcePolicies/list` | A list all the resource policies that have been configured for the specified project in specified region. |
| ### `https://docs.cloud.google.com/compute/docs/reference/rest/beta/resourcePolicies/patch` | Modify the specified resource policy. |
| ### `https://docs.cloud.google.com/compute/docs/reference/rest/beta/resourcePolicies/setIamPolicy` | Sets the access control policy on the specified resource. |
| ### `https://docs.cloud.google.com/compute/docs/reference/rest/beta/resourcePolicies/testIamPermissions` | Returns permissions that a caller has on the specified resource. |