Skip to main content

reservations

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

Overview

Namereservations
TypeResource
Idgoogle.compute.reservations

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.
descriptionstringAn optional description of this resource. Provide this property when you create the resource.
aggregateReservationobjectThis reservation type is specified by total resource amounts (e.g. total count of CPUs) and can account for multiple instance SKUs. In other words, one can create instances of varying shapes against this reservation.
commitmentstring[Output Only] Full or partial URL to a parent commitment. This field displays for reservations that are tied to a commitment.
creationTimestampstring[Output Only] Creation timestamp in RFC3339 text format.
kindstring[Output Only] Type of the resource. Always compute#reservations for reservations.
resourcePoliciesobjectResource policies to be added to this reservation. The key is defined by user, and the value is resource policy url. This is to define placement policy with reservation.
resourceStatusobject[Output Only] Contains output only fields.
satisfiesPzsboolean[Output Only] Reserved for future use.
selfLinkstring[Output Only] Server-defined fully-qualified URL for this resource.
shareSettingsobjectThe share setting for reservations and sole tenancy node groups.
specificReservationobjectThis reservation type allows to pre allocate specific instance configuration.
specificReservationRequiredbooleanIndicates whether the reservation can be consumed by VMs with affinity for "any" reservation. If the field is set, then only VMs that target the reservation by name can consume from this reservation.
statusstring[Output Only] The status of the reservation.
zonestringZone in which the reservation resides. A zone must be provided if the reservation is created within a commitment.

Methods

NameAccessible byRequired ParamsDescription
aggregated_listSELECTprojectRetrieves an aggregated list of reservations. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.
getSELECTproject, reservation, zoneRetrieves information about the specified reservation.
listSELECTproject, zoneA list of all the reservations that have been configured for the specified project in specified zone.
insertINSERTproject, zoneCreates a new reservation. For more information, read Reserving zonal resources.
deleteDELETEproject, reservation, zoneDeletes the specified reservation.
updateUPDATEproject, reservation, zoneUpdate share settings of the reservation.
resizeEXECproject, reservation, zoneResizes the reservation (applicable to standalone reservations only). For more information, read Modifying reservations.

SELECT examples

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

SELECT
id,
name,
description,
aggregateReservation,
commitment,
creationTimestamp,
kind,
resourcePolicies,
resourceStatus,
satisfiesPzs,
selfLink,
shareSettings,
specificReservation,
specificReservationRequired,
status,
zone
FROM google.compute.reservations
WHERE project = '{{ project }}';

INSERT example

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

/*+ create */
INSERT INTO google.compute.reservations (
project,
zone,
zone,
description,
name,
specificReservation,
aggregateReservation,
commitment,
specificReservationRequired,
status,
shareSettings,
satisfiesPzs,
resourcePolicies,
resourceStatus
)
SELECT
'{{ project }}',
'{{ zone }}',
'{{ zone }}',
'{{ description }}',
'{{ name }}',
'{{ specificReservation }}',
'{{ aggregateReservation }}',
'{{ commitment }}',
{{ specificReservationRequired }},
'{{ status }}',
'{{ shareSettings }}',
{{ satisfiesPzs }},
'{{ resourcePolicies }}',
'{{ resourceStatus }}'
;

UPDATE example

Updates a reservations resource.

/*+ update */
UPDATE google.compute.reservations
SET
zone = '{{ zone }}',
description = '{{ description }}',
name = '{{ name }}',
specificReservation = '{{ specificReservation }}',
aggregateReservation = '{{ aggregateReservation }}',
commitment = '{{ commitment }}',
specificReservationRequired = true|false,
status = '{{ status }}',
shareSettings = '{{ shareSettings }}',
satisfiesPzs = true|false,
resourcePolicies = '{{ resourcePolicies }}',
resourceStatus = '{{ resourceStatus }}'
WHERE
project = '{{ project }}'
AND reservation = '{{ reservation }}'
AND zone = '{{ zone }}';

DELETE example

Deletes the specified reservations resource.

/*+ delete */
DELETE FROM google.compute.reservations
WHERE project = '{{ project }}'
AND reservation = '{{ reservation }}'
AND zone = '{{ zone }}';