resource_policies
Creates, updates, deletes, gets or lists a resource_policies resource.
Overview
| Name | resource_policies |
| Type | Resource |
| Id | google.compute.resource_policies |
Fields
The following fields are returned by SELECT queries:
- get
- list
- aggregated_list
| Name | Datatype | Description |
|---|---|---|
id | string (uint64) | Output only. [Output Only] The unique identifier for the resource. This identifier is defined by the server. |
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 withRFC1035. 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. (pattern: [a-z](?:[-a-z0-9]{0,61}[a-z0-9])?) |
creationTimestamp | string | Output only. [Output Only] Creation timestamp inRFC3339 text format. |
description | string | |
diskConsistencyGroupPolicy | object | Resource policy for disk consistency groups. (id: ResourcePolicyDiskConsistencyGroupPolicy) |
groupPlacementPolicy | object | Resource policy for instances for placement configuration. (id: ResourcePolicyGroupPlacementPolicy) |
instanceSchedulePolicy | object | Resource policy for scheduling instance operations. (id: ResourcePolicyInstanceSchedulePolicy) |
kind | string | Output only. [Output Only] Type of the resource. Alwayscompute#resource_policies for resource policies. (default: compute#resourcePolicy) |
region | string | |
resourceStatus | object | Output only. [Output Only] The system status of the resource policy. (id: ResourcePolicyResourceStatus) |
selfLink | string | Output only. [Output Only] Server-defined fully-qualified URL for this resource. |
snapshotSchedulePolicy | object | Resource policy for persistent disks for creating snapshots. (id: ResourcePolicySnapshotSchedulePolicy) |
status | string | Output only. [Output Only] The status of resource policy creation. (CREATING, DELETING, EXPIRED, INVALID, READY) |
workloadPolicy | object | Resource policy for defining instance placement for MIGs. (id: ResourcePolicyWorkloadPolicy) |
| Name | Datatype | Description |
|---|---|---|
id | string | [Output Only] The unique identifier for the resource. This identifier is defined by the server. |
etag | string | |
items | array | [Output Only] A list of ResourcePolicy resources. |
kind | string | Output only. [Output Only] Type of resource.Alwayscompute#resourcePoliciesList for listsof resourcePolicies (default: compute#resourcePolicyList) |
nextPageToken | string | [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger thanmaxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. |
selfLink | string | Output only. [Output Only] Server-defined URL for this resource. |
warning | object | [Output Only] Informational warning message. |
| Name | Datatype | Description |
|---|---|---|
id | string (uint64) | Output only. [Output Only] The unique identifier for the resource. This identifier is defined by the server. |
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 withRFC1035. 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. (pattern: [a-z](?:[-a-z0-9]{0,61}[a-z0-9])?) |
creationTimestamp | string | Output only. [Output Only] Creation timestamp inRFC3339 text format. |
description | string | |
diskConsistencyGroupPolicy | object | Resource policy for disk consistency groups. (id: ResourcePolicyDiskConsistencyGroupPolicy) |
groupPlacementPolicy | object | Resource policy for instances for placement configuration. (id: ResourcePolicyGroupPlacementPolicy) |
instanceSchedulePolicy | object | Resource policy for scheduling instance operations. (id: ResourcePolicyInstanceSchedulePolicy) |
kind | string | Output only. [Output Only] Type of the resource. Alwayscompute#resource_policies for resource policies. (default: compute#resourcePolicy) |
region | string | |
resourceStatus | object | Output only. [Output Only] The system status of the resource policy. (id: ResourcePolicyResourceStatus) |
selfLink | string | Output only. [Output Only] Server-defined fully-qualified URL for this resource. |
snapshotSchedulePolicy | object | Resource policy for persistent disks for creating snapshots. (id: ResourcePolicySnapshotSchedulePolicy) |
status | string | Output only. [Output Only] The status of resource policy creation. (CREATING, DELETING, EXPIRED, INVALID, READY) |
workloadPolicy | object | Resource policy for defining instance placement for MIGs. (id: ResourcePolicyWorkloadPolicy) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | project, region, resourcePolicy | Retrieves all information of the specified resource policy. | |
list | select | project, region | returnPartialSuccess, maxResults, pageToken, filter, orderBy | A list all the resource policies that have been configured for the specified project in specified region. |
aggregated_list | select | project | filter, serviceProjectNumber, maxResults, pageToken, includeAllScopes, orderBy, returnPartialSuccess | Retrieves an aggregated list of resource policies. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true. |
insert | insert | project, region | requestId | Creates a new resource policy. |
patch | update | project, region, resourcePolicy | requestId, updateMask | Modify the specified resource policy. |
delete | delete | project, region, resourcePolicy | requestId | Deletes the specified resource policy. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
project | string | |
region | string | |
resourcePolicy | string | |
filter | string | |
includeAllScopes | boolean | |
maxResults | integer (uint32) | |
orderBy | string | |
pageToken | string | |
requestId | string | |
returnPartialSuccess | boolean | |
serviceProjectNumber | string (int64) | |
updateMask | string (google-fieldmask) |
SELECT examples
- get
- list
- aggregated_list
Retrieves all information of the specified resource policy.
SELECT
id,
name,
creationTimestamp,
description,
diskConsistencyGroupPolicy,
groupPlacementPolicy,
instanceSchedulePolicy,
kind,
region,
resourceStatus,
selfLink,
snapshotSchedulePolicy,
status,
workloadPolicy
FROM google.compute.resource_policies
WHERE project = '{{ project }}' -- required
AND region = '{{ region }}' -- required
AND resourcePolicy = '{{ resourcePolicy }}' -- required
;
A list all the resource policies that have been configured for the
specified project in specified region.
SELECT
id,
etag,
items,
kind,
nextPageToken,
selfLink,
warning
FROM google.compute.resource_policies
WHERE project = '{{ project }}' -- required
AND region = '{{ region }}' -- required
AND returnPartialSuccess = '{{ returnPartialSuccess }}'
AND maxResults = '{{ maxResults }}'
AND pageToken = '{{ pageToken }}'
AND filter = '{{ filter }}'
AND orderBy = '{{ orderBy }}'
;
Retrieves an aggregated list of resource policies.
To prevent failure, Google recommends that you set thereturnPartialSuccess parameter to true.
SELECT
id,
name,
creationTimestamp,
description,
diskConsistencyGroupPolicy,
groupPlacementPolicy,
instanceSchedulePolicy,
kind,
region,
resourceStatus,
selfLink,
snapshotSchedulePolicy,
status,
workloadPolicy
FROM google.compute.resource_policies
WHERE project = '{{ project }}' -- required
AND filter = '{{ filter }}'
AND serviceProjectNumber = '{{ serviceProjectNumber }}'
AND maxResults = '{{ maxResults }}'
AND pageToken = '{{ pageToken }}'
AND includeAllScopes = '{{ includeAllScopes }}'
AND orderBy = '{{ orderBy }}'
AND returnPartialSuccess = '{{ returnPartialSuccess }}'
;
INSERT examples
- insert
- Manifest
Creates a new resource policy.
INSERT INTO google.compute.resource_policies (
data__instanceSchedulePolicy,
data__diskConsistencyGroupPolicy,
data__snapshotSchedulePolicy,
data__description,
data__groupPlacementPolicy,
data__workloadPolicy,
data__name,
project,
region,
requestId
)
SELECT
'{{ instanceSchedulePolicy }}',
'{{ diskConsistencyGroupPolicy }}',
'{{ snapshotSchedulePolicy }}',
'{{ description }}',
'{{ groupPlacementPolicy }}',
'{{ workloadPolicy }}',
'{{ name }}',
'{{ project }}',
'{{ region }}',
'{{ requestId }}'
RETURNING
id,
name,
clientOperationId,
creationTimestamp,
description,
endTime,
error,
getVersionOperationMetadata,
httpErrorMessage,
httpErrorStatusCode,
insertTime,
instancesBulkInsertOperationMetadata,
kind,
operationGroupId,
operationType,
progress,
region,
selfLink,
setCommonInstanceMetadataOperationMetadata,
startTime,
status,
statusMessage,
targetId,
targetLink,
user,
warnings,
zone
;
# Description fields are for documentation purposes
- name: resource_policies
props:
- name: project
value: "{{ project }}"
description: Required parameter for the resource_policies resource.
- name: region
value: "{{ region }}"
description: Required parameter for the resource_policies resource.
- name: instanceSchedulePolicy
description: |
Resource policy for scheduling instance operations.
value:
timeZone: "{{ timeZone }}"
vmStartSchedule:
schedule: "{{ schedule }}"
startTime: "{{ startTime }}"
vmStopSchedule:
schedule: "{{ schedule }}"
expirationTime: "{{ expirationTime }}"
- name: diskConsistencyGroupPolicy
value: "{{ diskConsistencyGroupPolicy }}"
description: |
Resource policy for disk consistency groups.
- name: snapshotSchedulePolicy
description: |
Resource policy for persistent disks for creating snapshots.
value:
snapshotProperties:
chainName: "{{ chainName }}"
labels: "{{ labels }}"
storageLocations:
- "{{ storageLocations }}"
guestFlush: {{ guestFlush }}
schedule:
weeklySchedule:
dayOfWeeks:
- duration: "{{ duration }}"
day: "{{ day }}"
startTime: "{{ startTime }}"
hourlySchedule:
duration: "{{ duration }}"
hoursInCycle: {{ hoursInCycle }}
startTime: "{{ startTime }}"
dailySchedule:
startTime: "{{ startTime }}"
daysInCycle: {{ daysInCycle }}
duration: "{{ duration }}"
retentionPolicy:
maxRetentionDays: {{ maxRetentionDays }}
onSourceDiskDelete: "{{ onSourceDiskDelete }}"
- name: description
value: "{{ description }}"
- name: groupPlacementPolicy
description: |
Resource policy for instances for placement configuration.
value:
acceleratorTopologyMode: "{{ acceleratorTopologyMode }}"
gpuTopology: "{{ gpuTopology }}"
availabilityDomainCount: {{ availabilityDomainCount }}
vmCount: {{ vmCount }}
collocation: "{{ collocation }}"
- name: workloadPolicy
description: |
Resource policy for defining instance placement for MIGs.
value:
acceleratorTopologyMode: "{{ acceleratorTopologyMode }}"
type: "{{ type }}"
maxTopologyDistance: "{{ maxTopologyDistance }}"
acceleratorTopology: "{{ acceleratorTopology }}"
- name: name
value: "{{ name }}"
description: |
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
withRFC1035.
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.
- name: requestId
value: "{{ requestId }}"
UPDATE examples
- patch
Modify the specified resource policy.
UPDATE google.compute.resource_policies
SET
data__instanceSchedulePolicy = '{{ instanceSchedulePolicy }}',
data__diskConsistencyGroupPolicy = '{{ diskConsistencyGroupPolicy }}',
data__snapshotSchedulePolicy = '{{ snapshotSchedulePolicy }}',
data__description = '{{ description }}',
data__groupPlacementPolicy = '{{ groupPlacementPolicy }}',
data__workloadPolicy = '{{ workloadPolicy }}',
data__name = '{{ name }}'
WHERE
project = '{{ project }}' --required
AND region = '{{ region }}' --required
AND resourcePolicy = '{{ resourcePolicy }}' --required
AND requestId = '{{ requestId}}'
AND updateMask = '{{ updateMask}}'
RETURNING
id,
name,
clientOperationId,
creationTimestamp,
description,
endTime,
error,
getVersionOperationMetadata,
httpErrorMessage,
httpErrorStatusCode,
insertTime,
instancesBulkInsertOperationMetadata,
kind,
operationGroupId,
operationType,
progress,
region,
selfLink,
setCommonInstanceMetadataOperationMetadata,
startTime,
status,
statusMessage,
targetId,
targetLink,
user,
warnings,
zone;
DELETE examples
- delete
Deletes the specified resource policy.
DELETE FROM google.compute.resource_policies
WHERE project = '{{ project }}' --required
AND region = '{{ region }}' --required
AND resourcePolicy = '{{ resourcePolicy }}' --required
AND requestId = '{{ requestId }}'
;