capacity_commitments
Creates, updates, deletes, gets or lists a capacity_commitments resource.
Overview
| Name | capacity_commitments |
| Type | Resource |
| Id | google.bigqueryreservation.capacity_commitments |
Fields
The following fields are returned by SELECT queries:
- get
- list
| Name | Datatype | Description |
|---|---|---|
name | string | Output only. The resource name of the capacity commitment, e.g., projects/myproject/locations/US/capacityCommitments/123 The commitment_id must only contain lower case alphanumeric characters or dashes. It must start with a letter and must not end with a dash. Its maximum length is 64 characters. |
commitmentEndTime | string (google-datetime) | Output only. The end of the current commitment period. It is applicable only for ACTIVE capacity commitments. Note after renewal, commitment_end_time is the time the renewed commitment expires. So itwould be at a time after commitment_start_time + committed period, because we don't change commitment_start_time , |
commitmentStartTime | string (google-datetime) | Output only. The start of the current commitment period. It is applicable only for ACTIVE capacity commitments. Note after the commitment is renewed, commitment_start_time won't be changed. It refers to the start time of the original commitment. |
edition | string | Optional. Edition of the capacity commitment. (EDITION_UNSPECIFIED, STANDARD, ENTERPRISE, ENTERPRISE_PLUS) |
failureStatus | object | Output only. For FAILED commitment plan, provides the reason of failure. (id: Status) |
isFlatRate | boolean | Output only. If true, the commitment is a flat-rate commitment, otherwise, it's an edition commitment. |
multiRegionAuxiliary | boolean | Applicable only for commitments located within one of the BigQuery multi-regions (US or EU). If set to true, this commitment is placed in the organization's secondary region which is designated for disaster recovery purposes. If false, this commitment is placed in the organization's default region. NOTE: this is a preview feature. Project must be allow-listed in order to set this field. |
plan | string | Optional. Capacity commitment commitment plan. (COMMITMENT_PLAN_UNSPECIFIED, FLEX, FLEX_FLAT_RATE, TRIAL, MONTHLY, MONTHLY_FLAT_RATE, ANNUAL, ANNUAL_FLAT_RATE, THREE_YEAR, NONE) |
renewalPlan | string | Optional. The plan this capacity commitment is converted to after commitment_end_time passes. Once the plan is changed, committed period is extended according to commitment plan. Only applicable for ANNUAL and TRIAL commitments. (COMMITMENT_PLAN_UNSPECIFIED, FLEX, FLEX_FLAT_RATE, TRIAL, MONTHLY, MONTHLY_FLAT_RATE, ANNUAL, ANNUAL_FLAT_RATE, THREE_YEAR, NONE) |
slotCount | string (int64) | Optional. Number of slots in this commitment. |
state | string | Output only. State of the commitment. (STATE_UNSPECIFIED, PENDING, ACTIVE, FAILED) |
| Name | Datatype | Description |
|---|---|---|
name | string | Output only. The resource name of the capacity commitment, e.g., projects/myproject/locations/US/capacityCommitments/123 The commitment_id must only contain lower case alphanumeric characters or dashes. It must start with a letter and must not end with a dash. Its maximum length is 64 characters. |
commitmentEndTime | string (google-datetime) | Output only. The end of the current commitment period. It is applicable only for ACTIVE capacity commitments. Note after renewal, commitment_end_time is the time the renewed commitment expires. So itwould be at a time after commitment_start_time + committed period, because we don't change commitment_start_time , |
commitmentStartTime | string (google-datetime) | Output only. The start of the current commitment period. It is applicable only for ACTIVE capacity commitments. Note after the commitment is renewed, commitment_start_time won't be changed. It refers to the start time of the original commitment. |
edition | string | Optional. Edition of the capacity commitment. (EDITION_UNSPECIFIED, STANDARD, ENTERPRISE, ENTERPRISE_PLUS) |
failureStatus | object | Output only. For FAILED commitment plan, provides the reason of failure. (id: Status) |
isFlatRate | boolean | Output only. If true, the commitment is a flat-rate commitment, otherwise, it's an edition commitment. |
multiRegionAuxiliary | boolean | Applicable only for commitments located within one of the BigQuery multi-regions (US or EU). If set to true, this commitment is placed in the organization's secondary region which is designated for disaster recovery purposes. If false, this commitment is placed in the organization's default region. NOTE: this is a preview feature. Project must be allow-listed in order to set this field. |
plan | string | Optional. Capacity commitment commitment plan. (COMMITMENT_PLAN_UNSPECIFIED, FLEX, FLEX_FLAT_RATE, TRIAL, MONTHLY, MONTHLY_FLAT_RATE, ANNUAL, ANNUAL_FLAT_RATE, THREE_YEAR, NONE) |
renewalPlan | string | Optional. The plan this capacity commitment is converted to after commitment_end_time passes. Once the plan is changed, committed period is extended according to commitment plan. Only applicable for ANNUAL and TRIAL commitments. (COMMITMENT_PLAN_UNSPECIFIED, FLEX, FLEX_FLAT_RATE, TRIAL, MONTHLY, MONTHLY_FLAT_RATE, ANNUAL, ANNUAL_FLAT_RATE, THREE_YEAR, NONE) |
slotCount | string (int64) | Optional. Number of slots in this commitment. |
state | string | Output only. State of the commitment. (STATE_UNSPECIFIED, PENDING, ACTIVE, FAILED) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | projectsId, locationsId, capacityCommitmentsId | Returns information about the capacity commitment. | |
list | select | projectsId, locationsId | pageToken, pageSize | Lists all the capacity commitments for the admin project. |
create | insert | projectsId, locationsId | capacityCommitmentId, enforceSingleAdminProjectPerOrg | Creates a new capacity commitment resource. |
patch | update | projectsId, locationsId, capacityCommitmentsId | updateMask | Updates an existing capacity commitment. Only plan and renewal_plan fields can be updated. Plan can only be changed to a plan of a longer commitment period. Attempting to change to a plan with shorter commitment period will fail with the error code google.rpc.Code.FAILED_PRECONDITION. |
delete | delete | projectsId, locationsId, capacityCommitmentsId | force | Deletes a capacity commitment. Attempting to delete capacity commitment before its commitment_end_time will fail with the error code google.rpc.Code.FAILED_PRECONDITION. |
split | exec | projectsId, locationsId, capacityCommitmentsId | Splits capacity commitment to two commitments of the same plan and commitment_end_time. A common use case is to enable downgrading commitments. For example, in order to downgrade from 10000 slots to 8000, you might split a 10000 capacity commitment into commitments of 2000 and 8000. Then, you delete the first one after the commitment end time passes. | |
merge | exec | projectsId, locationsId | Merges capacity commitments of the same plan into a single commitment. The resulting capacity commitment has the greater commitment_end_time out of the to-be-merged capacity commitments. Attempting to merge capacity commitments of different plan will fail with the error code google.rpc.Code.FAILED_PRECONDITION. |
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.
| Name | Datatype | Description |
|---|---|---|
capacityCommitmentsId | string | |
locationsId | string | |
projectsId | string | |
capacityCommitmentId | string | |
enforceSingleAdminProjectPerOrg | boolean | |
force | boolean | |
pageSize | integer (int32) | |
pageToken | string | |
updateMask | string (google-fieldmask) |
SELECT examples
- get
- list
Returns information about the capacity commitment.
SELECT
name,
commitmentEndTime,
commitmentStartTime,
edition,
failureStatus,
isFlatRate,
multiRegionAuxiliary,
plan,
renewalPlan,
slotCount,
state
FROM google.bigqueryreservation.capacity_commitments
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND capacityCommitmentsId = '{{ capacityCommitmentsId }}' -- required
;
Lists all the capacity commitments for the admin project.
SELECT
name,
commitmentEndTime,
commitmentStartTime,
edition,
failureStatus,
isFlatRate,
multiRegionAuxiliary,
plan,
renewalPlan,
slotCount,
state
FROM google.bigqueryreservation.capacity_commitments
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND pageToken = '{{ pageToken }}'
AND pageSize = '{{ pageSize }}'
;
INSERT examples
- create
- Manifest
Creates a new capacity commitment resource.
INSERT INTO google.bigqueryreservation.capacity_commitments (
data__renewalPlan,
data__edition,
data__slotCount,
data__plan,
data__multiRegionAuxiliary,
projectsId,
locationsId,
capacityCommitmentId,
enforceSingleAdminProjectPerOrg
)
SELECT
'{{ renewalPlan }}',
'{{ edition }}',
'{{ slotCount }}',
'{{ plan }}',
{{ multiRegionAuxiliary }},
'{{ projectsId }}',
'{{ locationsId }}',
'{{ capacityCommitmentId }}',
'{{ enforceSingleAdminProjectPerOrg }}'
RETURNING
name,
commitmentEndTime,
commitmentStartTime,
edition,
failureStatus,
isFlatRate,
multiRegionAuxiliary,
plan,
renewalPlan,
slotCount,
state
;
# Description fields are for documentation purposes
- name: capacity_commitments
props:
- name: projectsId
value: "{{ projectsId }}"
description: Required parameter for the capacity_commitments resource.
- name: locationsId
value: "{{ locationsId }}"
description: Required parameter for the capacity_commitments resource.
- name: renewalPlan
value: "{{ renewalPlan }}"
description: |
Optional. The plan this capacity commitment is converted to after commitment_end_time passes. Once the plan is changed, committed period is extended according to commitment plan. Only applicable for ANNUAL and TRIAL commitments.
valid_values: ['COMMITMENT_PLAN_UNSPECIFIED', 'FLEX', 'FLEX_FLAT_RATE', 'TRIAL', 'MONTHLY', 'MONTHLY_FLAT_RATE', 'ANNUAL', 'ANNUAL_FLAT_RATE', 'THREE_YEAR', 'NONE']
- name: edition
value: "{{ edition }}"
description: |
Optional. Edition of the capacity commitment.
valid_values: ['EDITION_UNSPECIFIED', 'STANDARD', 'ENTERPRISE', 'ENTERPRISE_PLUS']
- name: slotCount
value: "{{ slotCount }}"
description: |
Optional. Number of slots in this commitment.
- name: plan
value: "{{ plan }}"
description: |
Optional. Capacity commitment commitment plan.
valid_values: ['COMMITMENT_PLAN_UNSPECIFIED', 'FLEX', 'FLEX_FLAT_RATE', 'TRIAL', 'MONTHLY', 'MONTHLY_FLAT_RATE', 'ANNUAL', 'ANNUAL_FLAT_RATE', 'THREE_YEAR', 'NONE']
- name: multiRegionAuxiliary
value: {{ multiRegionAuxiliary }}
description: |
Applicable only for commitments located within one of the BigQuery multi-regions (US or EU). If set to true, this commitment is placed in the organization's secondary region which is designated for disaster recovery purposes. If false, this commitment is placed in the organization's default region. NOTE: this is a preview feature. Project must be allow-listed in order to set this field.
- name: capacityCommitmentId
value: "{{ capacityCommitmentId }}"
- name: enforceSingleAdminProjectPerOrg
value: {{ enforceSingleAdminProjectPerOrg }}
UPDATE examples
- patch
Updates an existing capacity commitment. Only plan and renewal_plan fields can be updated. Plan can only be changed to a plan of a longer commitment period. Attempting to change to a plan with shorter commitment period will fail with the error code google.rpc.Code.FAILED_PRECONDITION.
UPDATE google.bigqueryreservation.capacity_commitments
SET
data__renewalPlan = '{{ renewalPlan }}',
data__edition = '{{ edition }}',
data__slotCount = '{{ slotCount }}',
data__plan = '{{ plan }}',
data__multiRegionAuxiliary = {{ multiRegionAuxiliary }}
WHERE
projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND capacityCommitmentsId = '{{ capacityCommitmentsId }}' --required
AND updateMask = '{{ updateMask}}'
RETURNING
name,
commitmentEndTime,
commitmentStartTime,
edition,
failureStatus,
isFlatRate,
multiRegionAuxiliary,
plan,
renewalPlan,
slotCount,
state;
DELETE examples
- delete
Deletes a capacity commitment. Attempting to delete capacity commitment before its commitment_end_time will fail with the error code google.rpc.Code.FAILED_PRECONDITION.
DELETE FROM google.bigqueryreservation.capacity_commitments
WHERE projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND capacityCommitmentsId = '{{ capacityCommitmentsId }}' --required
AND force = '{{ force }}'
;
Lifecycle Methods
- split
- merge
Splits capacity commitment to two commitments of the same plan and commitment_end_time. A common use case is to enable downgrading commitments. For example, in order to downgrade from 10000 slots to 8000, you might split a 10000 capacity commitment into commitments of 2000 and 8000. Then, you delete the first one after the commitment end time passes.
EXEC google.bigqueryreservation.capacity_commitments.split
@projectsId='{{ projectsId }}' --required,
@locationsId='{{ locationsId }}' --required,
@capacityCommitmentsId='{{ capacityCommitmentsId }}' --required
@@json=
'{
"slotCount": "{{ slotCount }}"
}'
;
Merges capacity commitments of the same plan into a single commitment. The resulting capacity commitment has the greater commitment_end_time out of the to-be-merged capacity commitments. Attempting to merge capacity commitments of different plan will fail with the error code google.rpc.Code.FAILED_PRECONDITION.
EXEC google.bigqueryreservation.capacity_commitments.merge
@projectsId='{{ projectsId }}' --required,
@locationsId='{{ locationsId }}' --required
@@json=
'{
"capacityCommitmentId": "{{ capacityCommitmentId }}",
"capacityCommitmentIds": "{{ capacityCommitmentIds }}"
}'
;