Skip to main content

reservations

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

Overview

Namereservations
TypeResource
Idgoogle.compute.reservations

Fields

The following fields are returned by SELECT queries:

Successful response

NameDatatypeDescription
idstring (uint64)[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. (pattern: a-z?)
advancedDeploymentControlobjectAdvanced control for cluster management, applicable only to DENSE deployment type reservations. (id: ReservationAdvancedDeploymentControl)
aggregateReservationobjectReservation for aggregated resources, providing shape flexibility. (id: AllocationAggregateReservation)
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.
deleteAfterDurationobjectDuration time relative to reservation creation when Compute Engine will automatically delete this resource. (id: Duration)
deleteAtTimestringAbsolute time in future when the reservation will be auto-deleted by Compute Engine. Timestamp is represented in RFC3339 text format.
deploymentTypestringSpecifies the deployment strategy for this reservation.
descriptionstringAn optional description of this resource. Provide this property when you create the resource.
enableEmergentMaintenancebooleanIndicates whether Compute Engine allows unplanned maintenance for your VMs; for example, to fix hardware errors.
kindstring[Output Only] Type of the resource. Always compute#reservations for reservations. (default: compute#reservation)
linkedCommitmentsarray[Output Only] Full or partial URL to parent commitments. This field displays for reservations that are tied to multiple commitments.
reservationSharingPolicyobjectSpecify the reservation sharing policy. If unspecified, the reservation will not be shared with Google Cloud managed services. (id: AllocationReservationSharingPolicy)
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] Status information for Reservation resource. (id: AllocationResourceStatus)
satisfiesPzsboolean[Output Only] Reserved for future use.
schedulingTypestringThe type of maintenance for the reservation.
selfLinkstring[Output Only] Server-defined fully-qualified URL for this resource.
shareSettingsobjectSpecify share-settings to create a shared reservation. This property is optional. For more information about the syntax and options for this field and its subfields, see the guide for creating a shared reservation. (id: ShareSettings)
specificReservationobjectReservation for instances with specific machine shapes. (id: AllocationSpecificSKUReservation)
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. - CREATING: Reservation resources are being allocated. - READY: Reservation resources have been allocated, and the reservation is ready for use. - DELETING: Reservation deletion is in progress. - UPDATING: Reservation update is in progress.
zonestringZone in which the reservation resides. A zone must be provided if the reservation is created within a commitment.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectproject, zone, reservationRetrieves information about the specified reservation.
listselectproject, zonefilter, maxResults, orderBy, pageToken, returnPartialSuccessA list of all the reservations that have been configured for the specified project in specified zone.
aggregated_listselectprojectfilter, includeAllScopes, maxResults, orderBy, pageToken, returnPartialSuccess, serviceProjectNumberRetrieves an aggregated list of reservations. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.
insertinsertproject, zonerequestIdCreates a new reservation. For more information, read Reserving zonal resources.
updateupdateproject, zone, reservationpaths, requestId, updateMaskUpdate share settings of the reservation.
deletedeleteproject, zone, reservationrequestIdDeletes the specified reservation.
resizeexecproject, zone, reservationrequestIdResizes the reservation (applicable to standalone reservations only). For more information, read Modifying reservations.
perform_maintenanceexecproject, zone, reservationrequestIdPerform maintenance on an extended reservation

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
reservationstring
zonestring
filterstring
includeAllScopesboolean
maxResultsinteger (uint32)
orderBystring
pageTokenstring
pathsstring
requestIdstring
returnPartialSuccessboolean
serviceProjectNumberstring (int64)
updateMaskstring (google-fieldmask)

SELECT examples

Retrieves information about the specified reservation.

SELECT
id,
name,
advancedDeploymentControl,
aggregateReservation,
commitment,
creationTimestamp,
deleteAfterDuration,
deleteAtTime,
deploymentType,
description,
enableEmergentMaintenance,
kind,
linkedCommitments,
reservationSharingPolicy,
resourcePolicies,
resourceStatus,
satisfiesPzs,
schedulingType,
selfLink,
shareSettings,
specificReservation,
specificReservationRequired,
status,
zone
FROM google.compute.reservations
WHERE project = '{{ project }}' -- required
AND zone = '{{ zone }}' -- required
AND reservation = '{{ reservation }}' -- required;

INSERT examples

Creates a new reservation. For more information, read Reserving zonal resources.

INSERT INTO google.compute.reservations (
data__specificReservation,
data__aggregateReservation,
data__deleteAtTime,
data__deleteAfterDuration,
data__kind,
data__id,
data__creationTimestamp,
data__selfLink,
data__zone,
data__description,
data__name,
data__commitment,
data__linkedCommitments,
data__specificReservationRequired,
data__status,
data__shareSettings,
data__satisfiesPzs,
data__resourcePolicies,
data__resourceStatus,
data__reservationSharingPolicy,
data__deploymentType,
data__advancedDeploymentControl,
data__enableEmergentMaintenance,
data__schedulingType,
project,
zone,
requestId
)
SELECT
'{{ specificReservation }}',
'{{ aggregateReservation }}',
'{{ deleteAtTime }}',
'{{ deleteAfterDuration }}',
'{{ kind }}',
'{{ id }}',
'{{ creationTimestamp }}',
'{{ selfLink }}',
'{{ zone }}',
'{{ description }}',
'{{ name }}',
'{{ commitment }}',
'{{ linkedCommitments }}',
{{ specificReservationRequired }},
'{{ status }}',
'{{ shareSettings }}',
{{ satisfiesPzs }},
'{{ resourcePolicies }}',
'{{ resourceStatus }}',
'{{ reservationSharingPolicy }}',
'{{ deploymentType }}',
'{{ advancedDeploymentControl }}',
{{ enableEmergentMaintenance }},
'{{ schedulingType }}',
'{{ project }}',
'{{ zone }}',
'{{ requestId }}'
RETURNING
id,
name,
clientOperationId,
creationTimestamp,
description,
endTime,
error,
httpErrorMessage,
httpErrorStatusCode,
insertTime,
instancesBulkInsertOperationMetadata,
kind,
operationGroupId,
operationType,
progress,
region,
selfLink,
setCommonInstanceMetadataOperationMetadata,
startTime,
status,
statusMessage,
targetId,
targetLink,
user,
warnings,
zone
;

UPDATE examples

Update share settings of the reservation.

UPDATE google.compute.reservations
SET
data__specificReservation = '{{ specificReservation }}',
data__aggregateReservation = '{{ aggregateReservation }}',
data__deleteAtTime = '{{ deleteAtTime }}',
data__deleteAfterDuration = '{{ deleteAfterDuration }}',
data__kind = '{{ kind }}',
data__id = '{{ id }}',
data__creationTimestamp = '{{ creationTimestamp }}',
data__selfLink = '{{ selfLink }}',
data__zone = '{{ zone }}',
data__description = '{{ description }}',
data__name = '{{ name }}',
data__commitment = '{{ commitment }}',
data__linkedCommitments = '{{ linkedCommitments }}',
data__specificReservationRequired = {{ specificReservationRequired }},
data__status = '{{ status }}',
data__shareSettings = '{{ shareSettings }}',
data__satisfiesPzs = {{ satisfiesPzs }},
data__resourcePolicies = '{{ resourcePolicies }}',
data__resourceStatus = '{{ resourceStatus }}',
data__reservationSharingPolicy = '{{ reservationSharingPolicy }}',
data__deploymentType = '{{ deploymentType }}',
data__advancedDeploymentControl = '{{ advancedDeploymentControl }}',
data__enableEmergentMaintenance = {{ enableEmergentMaintenance }},
data__schedulingType = '{{ schedulingType }}'
WHERE
project = '{{ project }}' --required
AND zone = '{{ zone }}' --required
AND reservation = '{{ reservation }}' --required
AND paths = '{{ paths}}'
AND requestId = '{{ requestId}}'
AND updateMask = '{{ updateMask}}'
RETURNING
id,
name,
clientOperationId,
creationTimestamp,
description,
endTime,
error,
httpErrorMessage,
httpErrorStatusCode,
insertTime,
instancesBulkInsertOperationMetadata,
kind,
operationGroupId,
operationType,
progress,
region,
selfLink,
setCommonInstanceMetadataOperationMetadata,
startTime,
status,
statusMessage,
targetId,
targetLink,
user,
warnings,
zone;

DELETE examples

Deletes the specified reservation.

DELETE FROM google.compute.reservations
WHERE project = '{{ project }}' --required
AND zone = '{{ zone }}' --required
AND reservation = '{{ reservation }}' --required
AND requestId = '{{ requestId }}';

Lifecycle Methods

Resizes the reservation (applicable to standalone reservations only). For more information, read Modifying reservations.

EXEC google.compute.reservations.resize 
@project='{{ project }}' --required,
@zone='{{ zone }}' --required,
@reservation='{{ reservation }}' --required,
@requestId='{{ requestId }}'
@@json=
'{
"specificSkuCount": "{{ specificSkuCount }}"
}';