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

NameDatatypeDescription
idstring[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 with RFC1035. 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.
descriptionstring
creationTimestampstring[Output Only] Creation timestamp in RFC3339 text format.
diskConsistencyGroupPolicyobjectResource policy for disk consistency groups.
groupPlacementPolicyobjectA GroupPlacementPolicy specifies resource placement configuration. It specifies the failure bucket separation
instanceSchedulePolicyobjectAn InstanceSchedulePolicy specifies when and how frequent certain operations are performed on the instance.
kindstring[Output Only] Type of the resource. Always compute#resource_policies for resource policies.
regionstring
resourceStatusobjectContains output only fields. Use this sub-message for all output fields set on ResourcePolicy. The internal structure of this "status" field should mimic the structure of ResourcePolicy proto specification.
selfLinkstring[Output Only] Server-defined fully-qualified URL for this resource.
snapshotSchedulePolicyobjectA snapshot schedule policy specifies when and how frequently snapshots are to be created for the target disk. Also specifies how many and how long these scheduled snapshots should be retained.
statusstring[Output Only] The status of resource policy creation.

Methods

NameAccessible byRequired ParamsDescription
aggregated_listSELECTprojectRetrieves an aggregated list of resource policies. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.
getSELECTproject, region, resourcePolicyRetrieves all information of the specified resource policy.
listSELECTproject, regionA list all the resource policies that have been configured for the specified project in specified region.
insertINSERTproject, regionCreates a new resource policy.
deleteDELETEproject, region, resourcePolicyDeletes the specified resource policy.
patchUPDATEproject, region, resourcePolicyModify the specified resource policy.

SELECT examples

Retrieves an aggregated list of resource policies. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.

SELECT
id,
name,
description,
creationTimestamp,
diskConsistencyGroupPolicy,
groupPlacementPolicy,
instanceSchedulePolicy,
kind,
region,
resourceStatus,
selfLink,
snapshotSchedulePolicy,
status
FROM google.compute.resource_policies
WHERE project = '{{ project }}';

INSERT example

Use the following StackQL query and manifest file to create a new resource_policies resource.

/*+ create */
INSERT INTO google.compute.resource_policies (
project,
region,
region,
description,
name,
snapshotSchedulePolicy,
groupPlacementPolicy,
instanceSchedulePolicy,
diskConsistencyGroupPolicy,
status,
resourceStatus
)
SELECT
'{{ project }}',
'{{ region }}',
'{{ region }}',
'{{ description }}',
'{{ name }}',
'{{ snapshotSchedulePolicy }}',
'{{ groupPlacementPolicy }}',
'{{ instanceSchedulePolicy }}',
'{{ diskConsistencyGroupPolicy }}',
'{{ status }}',
'{{ resourceStatus }}'
;

UPDATE example

Updates a resource_policies resource.

/*+ update */
UPDATE google.compute.resource_policies
SET
region = '{{ region }}',
description = '{{ description }}',
name = '{{ name }}',
snapshotSchedulePolicy = '{{ snapshotSchedulePolicy }}',
groupPlacementPolicy = '{{ groupPlacementPolicy }}',
instanceSchedulePolicy = '{{ instanceSchedulePolicy }}',
diskConsistencyGroupPolicy = '{{ diskConsistencyGroupPolicy }}',
status = '{{ status }}',
resourceStatus = '{{ resourceStatus }}'
WHERE
project = '{{ project }}'
AND region = '{{ region }}'
AND resourcePolicy = '{{ resourcePolicy }}';

DELETE example

Deletes the specified resource_policies resource.

/*+ delete */
DELETE FROM google.compute.resource_policies
WHERE project = '{{ project }}'
AND region = '{{ region }}'
AND resourcePolicy = '{{ resourcePolicy }}';