Skip to content

Commit 2c7f233

Browse files
Google APIscopybara-github
authored andcommitted
feat: Deprecated SearchAssignments in favor of SearchAllAssignments
feat: Reservation objects now contain a creation time and an update time feat: Added commitment_start_time to capacity commitments feat: Force deleting capacity commitments is allowed while reservations with active assignments exist feat: ML_EXTERNAL job type is supported feat: Optional id can be passed into CreateCapacityCommitment and CreateAssignment docs: Clarified docs for None assignments fix!: Fixed pattern for BiReservation object BREAKING_CHANGE: Changed from `bireservation` to `biReservation` PiperOrigin-RevId: 394129271
1 parent ee78ed7 commit 2c7f233

4 files changed

Lines changed: 139 additions & 20 deletions

File tree

google/cloud/bigquery/reservation/v1/BUILD.bazel

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
# This file was automatically generated by BuildFileGenerator
2+
# https://github.com/googleapis/rules_gapic/tree/master/bazel
3+
4+
# Most of the manual changes to this file will be overwritten.
5+
# It's **only** allowed to change the following rule attribute values:
6+
# - names of *_gapic_assembly_* rules
7+
# - certain parameters of *_gapic_library rules, including but not limited to:
8+
# * extra_protoc_parameters
9+
# * extra_protoc_file_parameters
10+
# The complete list of preserved parameters can be found in the source code.
211

312
# This is an API workspace, having public visibility by default makes perfect sense.
413
package(default_visibility = ["//visibility:public"])
@@ -60,12 +69,15 @@ java_grpc_library(
6069
java_gapic_library(
6170
name = "reservation_java_gapic",
6271
srcs = [":reservation_proto_with_info"],
72+
gapic_yaml = None,
6373
grpc_service_config = "bigqueryreservation_grpc_service_config.json",
74+
service_yaml = "bigqueryreservation_v1.yaml",
6475
test_deps = [
6576
":reservation_java_grpc",
6677
],
6778
deps = [
6879
":reservation_java_proto",
80+
"//google/api:api_java_proto",
6981
],
7082
)
7183

@@ -115,6 +127,7 @@ go_gapic_library(
115127
srcs = [":reservation_proto_with_info"],
116128
grpc_service_config = "bigqueryreservation_grpc_service_config.json",
117129
importpath = "cloud.google.com/go/bigquery/reservation/apiv1;reservation",
130+
metadata = True,
118131
service_yaml = "bigqueryreservation_v1.yaml",
119132
deps = [
120133
":reservation_go_proto",
@@ -133,6 +146,7 @@ go_gapic_assembly_pkg(
133146
name = "gapi-cloud-bigquery-reservation-v1-go",
134147
deps = [
135148
":reservation_go_gapic",
149+
":reservation_go_gapic_srcjar-metadata.srcjar",
136150
":reservation_go_gapic_srcjar-test.srcjar",
137151
":reservation_go_proto",
138152
],
@@ -152,8 +166,8 @@ py_gapic_library(
152166
srcs = [":reservation_proto"],
153167
grpc_service_config = "bigqueryreservation_grpc_service_config.json",
154168
opt_args = [
155-
"python-gapic-namespace=google.cloud",
156169
"python-gapic-name=bigquery_reservation",
170+
"python-gapic-namespace=google.cloud",
157171
],
158172
)
159173

@@ -191,6 +205,7 @@ php_gapic_library(
191205
name = "reservation_php_gapic",
192206
srcs = [":reservation_proto_with_info"],
193207
grpc_service_config = "bigqueryreservation_grpc_service_config.json",
208+
service_yaml = "bigqueryreservation_v1.yaml",
194209
deps = [
195210
":reservation_php_grpc",
196211
":reservation_php_proto",
@@ -261,11 +276,11 @@ ruby_cloud_gapic_library(
261276
name = "reservation_ruby_gapic",
262277
srcs = [":reservation_proto_with_info"],
263278
extra_protoc_parameters = [
264-
"ruby-cloud-gem-name=google-cloud-bigquery-reservation-v1",
265-
"ruby-cloud-env-prefix=BIGQUERY_RESERVATION",
266-
"ruby-cloud-product-url=https://cloud.google.com/bigquery/docs/reference/reservations",
267279
"ruby-cloud-api-id=bigqueryreservation.googleapis.com",
268280
"ruby-cloud-api-shortname=bigqueryreservation",
281+
"ruby-cloud-env-prefix=BIGQUERY_RESERVATION",
282+
"ruby-cloud-gem-name=google-cloud-bigquery-reservation-v1",
283+
"ruby-cloud-product-url=https://cloud.google.com/bigquery/docs/reference/reservations",
269284
],
270285
grpc_service_config = "bigqueryreservation_grpc_service_config.json",
271286
ruby_cloud_description = "The BigQuery Reservation API provides the mechanisms by which enterprise users can provision and manage dedicated resources such as slots and BigQuery BI Engine memory allocations.",

google/cloud/bigquery/reservation/v1/bigqueryreservation_grpc_service_config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"method": "UpdateBiReservation"
4040
}
4141
],
42-
"timeout": "60s"
42+
"timeout": "300s"
4343
},
4444
{
4545
"name": [

google/cloud/bigquery/reservation/v1/bigqueryreservation_v1.yaml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ backend:
1313
rules:
1414
- selector: 'google.cloud.bigquery.reservation.v1.ReservationService.*'
1515
deadline: 30.0
16-
- selector: 'google.longrunning.Operations.*'
17-
deadline: 30.0
16+
- selector: google.cloud.bigquery.reservation.v1.ReservationService.CreateCapacityCommitment
17+
deadline: 300.0
18+
- selector: google.cloud.bigquery.reservation.v1.ReservationService.DeleteCapacityCommitment
19+
deadline: 300.0
1820

1921
authentication:
2022
rules:
@@ -23,8 +25,3 @@ authentication:
2325
canonical_scopes: |-
2426
https://www.googleapis.com/auth/bigquery,
2527
https://www.googleapis.com/auth/cloud-platform
26-
- selector: 'google.longrunning.Operations.*'
27-
oauth:
28-
canonical_scopes: |-
29-
https://www.googleapis.com/auth/bigquery,
30-
https://www.googleapis.com/auth/cloud-platform

google/cloud/bigquery/reservation/v1/reservation.proto

Lines changed: 115 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2020 Google LLC
1+
// Copyright 2021 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -202,6 +202,11 @@ service ReservationService {
202202
// `project2`) could all be created and mapped to the same or different
203203
// reservations.
204204
//
205+
// "None" assignments represent an absence of the assignment. Projects
206+
// assigned to None use on-demand pricing. To create a "None" assignment, use
207+
// "none" as a reservation_id in the parent. Example parent:
208+
// `projects/myproject/locations/US/reservations/none`.
209+
//
205210
// Returns `google.rpc.Code.PERMISSION_DENIED` if user does not have
206211
// 'bigquery.admin' permissions on the project using the reservation
207212
// and the project that owns this reservation.
@@ -266,7 +271,7 @@ service ReservationService {
266271
option (google.api.method_signature) = "name";
267272
}
268273

269-
// Looks up assignments for a specified resource for a particular region.
274+
// Deprecated: Looks up assignments for a specified resource for a particular region.
270275
// If the request is about a project:
271276
//
272277
// 1. Assignments created on the project will be returned if they exist.
@@ -290,12 +295,40 @@ service ReservationService {
290295
// **Note** "-" cannot be used for projects
291296
// nor locations.
292297
rpc SearchAssignments(SearchAssignmentsRequest) returns (SearchAssignmentsResponse) {
298+
option deprecated = true;
293299
option (google.api.http) = {
294300
get: "/v1/{parent=projects/*/locations/*}:searchAssignments"
295301
};
296302
option (google.api.method_signature) = "parent,query";
297303
}
298304

305+
// Looks up assignments for a specified resource for a particular region.
306+
// If the request is about a project:
307+
//
308+
// 1. Assignments created on the project will be returned if they exist.
309+
// 2. Otherwise assignments created on the closest ancestor will be
310+
// returned.
311+
// 3. Assignments for different JobTypes will all be returned.
312+
//
313+
// The same logic applies if the request is about a folder.
314+
//
315+
// If the request is about an organization, then assignments created on the
316+
// organization will be returned (organization doesn't have ancestors).
317+
//
318+
// Comparing to ListAssignments, there are some behavior
319+
// differences:
320+
//
321+
// 1. permission on the assignee will be verified in this API.
322+
// 2. Hierarchy lookup (project->folder->organization) happens in this API.
323+
// 3. Parent here is `projects/*/locations/*`, instead of
324+
// `projects/*/locations/*reservations/*`.
325+
rpc SearchAllAssignments(SearchAllAssignmentsRequest) returns (SearchAllAssignmentsResponse) {
326+
option (google.api.http) = {
327+
get: "/v1/{parent=projects/*/locations/*}:searchAllAssignments"
328+
};
329+
option (google.api.method_signature) = "parent,query";
330+
}
331+
299332
// Moves an assignment under a new reservation.
300333
//
301334
// This differs from removing an existing assignment and recreating a new one
@@ -357,10 +390,17 @@ message Reservation {
357390
// `google.rpc.Code.RESOURCE_EXHAUSTED`.
358391
int64 slot_capacity = 2;
359392

360-
// If false, any query using this reservation will use idle slots from other
361-
// reservations within the same admin project. If true, a query using this
362-
// reservation will execute with the slot capacity specified above at most.
393+
// If false, any query or pipeline job using this reservation will use idle
394+
// slots from other reservations within the same admin project. If true, a
395+
// query or pipeline job using this reservation will execute with the slot
396+
// capacity specified in the slot_capacity field at most.
363397
bool ignore_idle_slots = 4;
398+
399+
// Output only. Creation time of the reservation.
400+
google.protobuf.Timestamp creation_time = 8 [(google.api.field_behavior) = OUTPUT_ONLY];
401+
402+
// Output only. Last update time of the reservation.
403+
google.protobuf.Timestamp update_time = 9 [(google.api.field_behavior) = OUTPUT_ONLY];
364404
}
365405

366406
// Capacity commitment is a way to purchase compute capacity for BigQuery jobs
@@ -439,6 +479,10 @@ message CapacityCommitment {
439479
// Output only. State of the commitment.
440480
State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
441481

482+
// Output only. The start of the current commitment period. It is applicable only for
483+
// ACTIVE capacity commitments.
484+
google.protobuf.Timestamp commitment_start_time = 9 [(google.api.field_behavior) = OUTPUT_ONLY];
485+
442486
// Output only. The end of the current commitment period. It is applicable only for ACTIVE
443487
// capacity commitments.
444488
google.protobuf.Timestamp commitment_end_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
@@ -549,6 +593,13 @@ message CreateCapacityCommitmentRequest {
549593
// If true, fail the request if another project in the organization has a
550594
// capacity commitment.
551595
bool enforce_single_admin_project_per_org = 4;
596+
597+
// The optional capacity commitment ID. Capacity commitment name will be
598+
// generated automatically if this field is empty.
599+
// This field must only contain lower case alphanumeric characters or dash.
600+
// Max length is 64 characters.
601+
// NOTE: this ID won't be kept if the capacity commitment is split or merged.
602+
string capacity_commitment_id = 5;
552603
}
553604

554605
// The request for [ReservationService.ListCapacityCommitments][google.cloud.bigquery.reservation.v1.ReservationService.ListCapacityCommitments].
@@ -601,6 +652,11 @@ message DeleteCapacityCommitmentRequest {
601652
type: "bigqueryreservation.googleapis.com/CapacityCommitment"
602653
}
603654
];
655+
656+
// Can be used to force delete commitments even if assignments exist. Deleting
657+
// commitments with assignments may cause queries to fail if they no longer
658+
// have access to slots.
659+
bool force = 3;
604660
}
605661

606662
// The request for [ReservationService.UpdateCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.UpdateCapacityCommitment].
@@ -671,6 +727,10 @@ message Assignment {
671727

672728
// Query jobs from the project will use the reservation.
673729
QUERY = 2;
730+
731+
// BigQuery ML jobs that use services external to BigQuery for model
732+
// training. These jobs will not utilize idle slots from other reservations.
733+
ML_EXTERNAL = 3;
674734
}
675735

676736
// Assignment will remain in PENDING state if no active capacity commitment is
@@ -718,6 +778,12 @@ message CreateAssignmentRequest {
718778

719779
// Assignment resource to create.
720780
Assignment assignment = 2;
781+
782+
// The optional assignment ID. Assignment name will be generated automatically
783+
// if this field is empty.
784+
// This field must only contain lower case alphanumeric characters or dash.
785+
// Max length is 64 characters.
786+
string assignment_id = 4;
721787
}
722788

723789
// The request for [ReservationService.ListAssignments][google.cloud.bigquery.reservation.v1.ReservationService.ListAssignments].
@@ -798,6 +864,37 @@ message SearchAssignmentsRequest {
798864
string page_token = 4;
799865
}
800866

867+
// The request for
868+
// [ReservationService.SearchAllAssignments][google.cloud.bigquery.reservation.v1.ReservationService.SearchAllAssignments].
869+
// Note: "bigquery.reservationAssignments.search" permission is required on the
870+
// related assignee.
871+
message SearchAllAssignmentsRequest {
872+
// Required. The resource name with location (project name could be the wildcard '-'),
873+
// e.g.:
874+
// `projects/-/locations/US`.
875+
string parent = 1 [
876+
(google.api.field_behavior) = REQUIRED,
877+
(google.api.resource_reference) = {
878+
type: "locations.googleapis.com/Location"
879+
}
880+
];
881+
882+
// Please specify resource name as assignee in the query.
883+
//
884+
// Examples:
885+
//
886+
// * `assignee=projects/myproject`
887+
// * `assignee=folders/123`
888+
// * `assignee=organizations/456`
889+
string query = 2;
890+
891+
// The maximum number of items to return per page.
892+
int32 page_size = 3;
893+
894+
// The next_page_token value returned from a previous List request, if any.
895+
string page_token = 4;
896+
}
897+
801898
// The response for [ReservationService.SearchAssignments][google.cloud.bigquery.reservation.v1.ReservationService.SearchAssignments].
802899
message SearchAssignmentsResponse {
803900
// List of assignments visible to the user.
@@ -808,6 +905,16 @@ message SearchAssignmentsResponse {
808905
string next_page_token = 2;
809906
}
810907

908+
// The response for [ReservationService.SearchAllAssignments][google.cloud.bigquery.reservation.v1.ReservationService.SearchAllAssignments].
909+
message SearchAllAssignmentsResponse {
910+
// List of assignments visible to the user.
911+
repeated Assignment assignments = 1;
912+
913+
// Token to retrieve the next page of results, or empty if there are no
914+
// more results in the list.
915+
string next_page_token = 2;
916+
}
917+
811918
// The request for
812919
// [ReservationService.MoveAssignment][google.cloud.bigquery.reservation.v1.ReservationService.MoveAssignment].
813920
//
@@ -839,12 +946,12 @@ message MoveAssignmentRequest {
839946
message BiReservation {
840947
option (google.api.resource) = {
841948
type: "bigqueryreservation.googleapis.com/BiReservation"
842-
pattern: "projects/{project}/locations/{location}/bireservation"
949+
pattern: "projects/{project}/locations/{location}/biReservation"
843950
};
844951

845952
// The resource name of the singleton BI reservation.
846953
// Reservation names have the form
847-
// `projects/{project_id}/locations/{location_id}/bireservation`.
954+
// `projects/{project_id}/locations/{location_id}/biReservation`.
848955
string name = 1;
849956

850957
// Output only. The last update timestamp of a reservation.
@@ -857,7 +964,7 @@ message BiReservation {
857964
// A request to get a singleton BI reservation.
858965
message GetBiReservationRequest {
859966
// Required. Name of the requested reservation, for example:
860-
// `projects/{project_id}/locations/{location_id}/bireservation`
967+
// `projects/{project_id}/locations/{location_id}/biReservation`
861968
string name = 1 [
862969
(google.api.field_behavior) = REQUIRED,
863970
(google.api.resource_reference) = {

0 commit comments

Comments
 (0)