Skip to main content

resource_policies

Creates, updates, deletes, gets or lists a resource_policies resource.

Overview

Nameresource_policies
TypeResource
Idgoogle.compute.resource_policies

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstring (uint64)Output only. [Output Only] The unique identifier for the resource. This identifier is defined by the server.
namestringThe 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])?)
creationTimestampstringOutput only. [Output Only] Creation timestamp inRFC3339 text format.
descriptionstring
diskConsistencyGroupPolicyobjectResource policy for disk consistency groups. (id: ResourcePolicyDiskConsistencyGroupPolicy)
groupPlacementPolicyobjectResource policy for instances for placement configuration. (id: ResourcePolicyGroupPlacementPolicy)
instanceSchedulePolicyobjectResource policy for scheduling instance operations. (id: ResourcePolicyInstanceSchedulePolicy)
kindstringOutput only. [Output Only] Type of the resource. Alwayscompute#resource_policies for resource policies. (default: compute#resourcePolicy)
regionstring
resourceStatusobjectOutput only. [Output Only] The system status of the resource policy. (id: ResourcePolicyResourceStatus)
selfLinkstringOutput only. [Output Only] Server-defined fully-qualified URL for this resource.
snapshotSchedulePolicyobjectResource policy for persistent disks for creating snapshots. (id: ResourcePolicySnapshotSchedulePolicy)
statusstringOutput only. [Output Only] The status of resource policy creation. (CREATING, DELETING, EXPIRED, INVALID, READY)
workloadPolicyobjectResource policy for defining instance placement for MIGs. (id: ResourcePolicyWorkloadPolicy)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectproject, region, resourcePolicyRetrieves all information of the specified resource policy.
listselectproject, regionreturnPartialSuccess, maxResults, pageToken, filter, orderByA list all the resource policies that have been configured for the
specified project in specified region.
aggregated_listselectprojectfilter, serviceProjectNumber, maxResults, pageToken, includeAllScopes, orderBy, returnPartialSuccessRetrieves an aggregated list of resource policies.

To prevent failure, Google recommends that you set the
returnPartialSuccess parameter to true.
insertinsertproject, regionrequestIdCreates a new resource policy.
patchupdateproject, region, resourcePolicyrequestId, updateMaskModify the specified resource policy.
deletedeleteproject, region, resourcePolicyrequestIdDeletes 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.

NameDatatypeDescription
projectstring
regionstring
resourcePolicystring
filterstring
includeAllScopesboolean
maxResultsinteger (uint32)
orderBystring
pageTokenstring
requestIdstring
returnPartialSuccessboolean
serviceProjectNumberstring (int64)
updateMaskstring (google-fieldmask)

SELECT examples

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
;

INSERT examples

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
;

UPDATE examples

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

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 }}'
;