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
Successful response
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. |
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. |
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. |
slotCount | string (int64) | Optional. Number of slots in this commitment. |
state | string | Output only. State of the commitment. |
Successful response
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. |
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. |
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. |
slotCount | string (int64) | Optional. Number of slots in this commitment. |
state | string | Output only. State of the commitment. |
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 | pageSize , pageToken | Lists all the capacity commitments for the admin project. |
create | insert | projectsId , locationsId | enforceSingleAdminProjectPerOrg , capacityCommitmentId | 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 pageSize = '{{ pageSize }}'
AND pageToken = '{{ pageToken }}';
INSERT
examples
- create
- Manifest
Creates a new capacity commitment resource.
INSERT INTO google.bigqueryreservation.capacity_commitments (
data__slotCount,
data__plan,
data__renewalPlan,
data__multiRegionAuxiliary,
data__edition,
projectsId,
locationsId,
enforceSingleAdminProjectPerOrg,
capacityCommitmentId
)
SELECT
'{{ slotCount }}',
'{{ plan }}',
'{{ renewalPlan }}',
{{ multiRegionAuxiliary }},
'{{ edition }}',
'{{ projectsId }}',
'{{ locationsId }}',
'{{ enforceSingleAdminProjectPerOrg }}',
'{{ capacityCommitmentId }}'
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: string
description: Required parameter for the capacity_commitments resource.
- name: locationsId
value: string
description: Required parameter for the capacity_commitments resource.
- name: slotCount
value: string
description: >
Optional. Number of slots in this commitment.
- name: plan
value: string
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: renewalPlan
value: string
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: multiRegionAuxiliary
value: boolean
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: edition
value: string
description: >
Optional. Edition of the capacity commitment.
valid_values: ['EDITION_UNSPECIFIED', 'STANDARD', 'ENTERPRISE', 'ENTERPRISE_PLUS']
- name: enforceSingleAdminProjectPerOrg
value: boolean
- name: capacityCommitmentId
value: string
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__slotCount = '{{ slotCount }}',
data__plan = '{{ plan }}',
data__renewalPlan = '{{ renewalPlan }}',
data__multiRegionAuxiliary = {{ multiRegionAuxiliary }},
data__edition = '{{ edition }}'
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=
'{
"capacityCommitmentIds": "{{ capacityCommitmentIds }}",
"capacityCommitmentId": "{{ capacityCommitmentId }}"
}';