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:

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])?)
advancedDeploymentControlobjectAdvanced control for cluster management, applicable only to DENSE deployment type reservations. (id: ReservationAdvancedDeploymentControl)
aggregateReservationobjectReservation for aggregated resources, providing shape flexibility. (id: AllocationAggregateReservation)
commitmentstringOutput only. [Output Only] Full or partial URL to a parent commitment. This field displays for reservations that are tied to a commitment.
confidentialComputeTypestring (CONFIDENTIAL_COMPUTE_TYPE_TDX, CONFIDENTIAL_COMPUTE_TYPE_UNSPECIFIED)
creationTimestampstringOutput only. [Output Only] Creation timestamp inRFC3339 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 inRFC3339 text format.
deploymentTypestringSpecifies the deployment strategy for this reservation. (DENSE, DEPLOYMENT_TYPE_UNSPECIFIED)
descriptionstringAn optional description of this resource. Provide this property when you create the resource.
earlyAccessMaintenancestringIndicates the early access maintenance for the reservation. If this field is absent or set to NO_EARLY_ACCESS, the reservation is not enrolled in early access maintenance and the standard notice applies. (NO_EARLY_ACCESS, WAVE1, WAVE2)
enableEmergentMaintenancebooleanIndicates whether Compute Engine allows unplanned maintenance for your VMs; for example, to fix hardware errors.
kindstringOutput only. [Output Only] Type of the resource. Alwayscompute#reservations for reservations. (default: compute#reservation)
linkedCommitmentsarrayOutput only. [Output Only] Full or partial URL to parent commitments. This field displays for reservations that are tied to multiple commitments.
paramsobjectInput only. Additional params passed with the request, but not persisted as part of resource payload. (id: ReservationParams)
protectionTierstringProtection tier for the workload which specifies the workload expectations in the event of infrastructure failures at data center (e.g. power and/or cooling failures). (CAPACITY_OPTIMIZED, PROTECTION_TIER_UNSPECIFIED, STANDARD)
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.
resourceStatusobjectOutput only. [Output Only] Status information for Reservation resource. (id: AllocationResourceStatus)
satisfiesPzsbooleanOutput only. [Output Only] Reserved for future use.
schedulingTypestringThe type of maintenance for the reservation. (GROUPED, GROUP_MAINTENANCE_TYPE_UNSPECIFIED, INDEPENDENT)
selfLinkstringOutput only. [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.
statusstringOutput only. [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. (CREATING, DELETING, INVALID, READY, UPDATING)
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, pageToken, orderBy, returnPartialSuccessA list of all the reservations that have been configured for the
specified project in specified zone.
aggregated_listselectprojectreturnPartialSuccess, includeAllScopes, orderBy, maxResults, pageToken, filter, serviceProjectNumberRetrieves an aggregated list of reservations.

To prevent failure, it is recommended that you set the
returnPartialSuccess parameter to true.
insertinsertproject, zonerequestIdCreates a new reservation. For more information, readReserving zonal
resources.
updateupdateproject, zone, reservationpaths, requestId, updateMaskUpdate share settings of the reservation.
deletedeleteproject, zone, reservationrequestIdDeletes the specified reservation.
perform_maintenanceexecproject, zone, reservationrequestIdPerform maintenance on an extended reservation
resizeexecproject, zone, reservationrequestIdResizes the reservation (applicable to standalone reservations only). For
more information, readModifying
reservations.

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,
confidentialComputeType,
creationTimestamp,
deleteAfterDuration,
deleteAtTime,
deploymentType,
description,
earlyAccessMaintenance,
enableEmergentMaintenance,
kind,
linkedCommitments,
params,
protectionTier,
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, readReserving zonal
resources.

INSERT INTO google.compute.reservations (
data__deleteAtTime,
data__name,
data__confidentialComputeType,
data__description,
data__deleteAfterDuration,
data__schedulingType,
data__earlyAccessMaintenance,
data__resourcePolicies,
data__advancedDeploymentControl,
data__deploymentType,
data__protectionTier,
data__shareSettings,
data__reservationSharingPolicy,
data__params,
data__zone,
data__aggregateReservation,
data__enableEmergentMaintenance,
data__specificReservation,
data__specificReservationRequired,
project,
zone,
requestId
)
SELECT
'{{ deleteAtTime }}',
'{{ name }}',
'{{ confidentialComputeType }}',
'{{ description }}',
'{{ deleteAfterDuration }}',
'{{ schedulingType }}',
'{{ earlyAccessMaintenance }}',
'{{ resourcePolicies }}',
'{{ advancedDeploymentControl }}',
'{{ deploymentType }}',
'{{ protectionTier }}',
'{{ shareSettings }}',
'{{ reservationSharingPolicy }}',
'{{ params }}',
'{{ zone }}',
'{{ aggregateReservation }}',
{{ enableEmergentMaintenance }},
'{{ specificReservation }}',
{{ specificReservationRequired }},
'{{ project }}',
'{{ zone }}',
'{{ 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

Update share settings of the reservation.

UPDATE google.compute.reservations
SET
data__deleteAtTime = '{{ deleteAtTime }}',
data__name = '{{ name }}',
data__confidentialComputeType = '{{ confidentialComputeType }}',
data__description = '{{ description }}',
data__deleteAfterDuration = '{{ deleteAfterDuration }}',
data__schedulingType = '{{ schedulingType }}',
data__earlyAccessMaintenance = '{{ earlyAccessMaintenance }}',
data__resourcePolicies = '{{ resourcePolicies }}',
data__advancedDeploymentControl = '{{ advancedDeploymentControl }}',
data__deploymentType = '{{ deploymentType }}',
data__protectionTier = '{{ protectionTier }}',
data__shareSettings = '{{ shareSettings }}',
data__reservationSharingPolicy = '{{ reservationSharingPolicy }}',
data__params = '{{ params }}',
data__zone = '{{ zone }}',
data__aggregateReservation = '{{ aggregateReservation }}',
data__enableEmergentMaintenance = {{ enableEmergentMaintenance }},
data__specificReservation = '{{ specificReservation }}',
data__specificReservationRequired = {{ specificReservationRequired }}
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,
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 reservation.

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

Lifecycle Methods

Perform maintenance on an extended reservation

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