capacity_commitments
Creates, updates, deletes, gets or lists a capacity_commitments
resource.
Overview
Name | capacity_commitments |
Type | Resource |
Id | google.bigqueryreservation.capacity_commitments |
Fields
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 | Output only. The end of the current commitment period. It is applicable only for ACTIVE capacity commitments. |
commitmentStartTime | string | Output only. The start of the current commitment period. It is applicable only for ACTIVE capacity commitments. |
edition | string | Edition of the capacity commitment. |
failureStatus | object | The Status type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by gRPC. Each Status message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the API Design Guide. |
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 | Capacity commitment commitment plan. |
renewalPlan | string | 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 | Number of slots in this commitment. |
state | string | Output only. State of the commitment. |
Methods
Name | Accessible by | Required Params | Description |
---|---|---|---|
get | SELECT | capacityCommitmentsId, locationsId, projectsId | Returns information about the capacity commitment. |
list | SELECT | locationsId, projectsId | Lists all the capacity commitments for the admin project. |
create | INSERT | locationsId, projectsId | Creates a new capacity commitment resource. |
delete | DELETE | capacityCommitmentsId, locationsId, projectsId | 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 . |
patch | UPDATE | capacityCommitmentsId, locationsId, projectsId | 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 . |
merge | EXEC | locationsId, projectsId | 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 . |
split | EXEC | capacityCommitmentsId, locationsId, projectsId | 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. |
SELECT
examples
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 locationsId = '{{ locationsId }}'
AND projectsId = '{{ projectsId }}';
INSERT
example
Use the following StackQL query and manifest file to create a new capacity_commitments
resource.
- All Properties
- Manifest
/*+ create */
INSERT INTO google.bigqueryreservation.capacity_commitments (
locationsId,
projectsId,
slotCount,
plan,
renewalPlan,
multiRegionAuxiliary,
edition
)
SELECT
'{{ locationsId }}',
'{{ projectsId }}',
'{{ slotCount }}',
'{{ plan }}',
'{{ renewalPlan }}',
{{ multiRegionAuxiliary }},
'{{ edition }}'
;
- name: your_resource_model_name
props:
- name: name
value: string
- name: slotCount
value: string
- name: plan
value: string
- name: state
value: string
- name: commitmentStartTime
value: string
- name: commitmentEndTime
value: string
- name: failureStatus
value:
- name: code
value: integer
- name: message
value: string
- name: details
value:
- object
- name: renewalPlan
value: string
- name: multiRegionAuxiliary
value: boolean
- name: edition
value: string
- name: isFlatRate
value: boolean
UPDATE
example
Updates a capacity_commitments
resource.
/*+ update */
UPDATE google.bigqueryreservation.capacity_commitments
SET
slotCount = '{{ slotCount }}',
plan = '{{ plan }}',
renewalPlan = '{{ renewalPlan }}',
multiRegionAuxiliary = true|false,
edition = '{{ edition }}'
WHERE
capacityCommitmentsId = '{{ capacityCommitmentsId }}'
AND locationsId = '{{ locationsId }}'
AND projectsId = '{{ projectsId }}';
DELETE
example
Deletes the specified capacity_commitments
resource.
/*+ delete */
DELETE FROM google.bigqueryreservation.capacity_commitments
WHERE capacityCommitmentsId = '{{ capacityCommitmentsId }}'
AND locationsId = '{{ locationsId }}'
AND projectsId = '{{ projectsId }}';