• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2023 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15syntax = "proto3";
16
17package google.cloud.bigquery.reservation.v1;
18
19import "google/api/annotations.proto";
20import "google/api/client.proto";
21import "google/api/field_behavior.proto";
22import "google/api/resource.proto";
23import "google/protobuf/empty.proto";
24import "google/protobuf/field_mask.proto";
25import "google/protobuf/timestamp.proto";
26import "google/rpc/status.proto";
27
28option csharp_namespace = "Google.Cloud.BigQuery.Reservation.V1";
29option go_package = "cloud.google.com/go/bigquery/reservation/apiv1/reservationpb;reservationpb";
30option java_multiple_files = true;
31option java_outer_classname = "ReservationProto";
32option java_package = "com.google.cloud.bigquery.reservation.v1";
33option php_namespace = "Google\\Cloud\\BigQuery\\Reservation\\V1";
34
35// This API allows users to manage their BigQuery reservations.
36//
37// A reservation provides computational resource guarantees, in the form of
38// [slots](https://cloud.google.com/bigquery/docs/slots), to users. A slot is a
39// unit of computational power in BigQuery, and serves as the basic unit of
40// parallelism. In a scan of a multi-partitioned table, a single slot operates
41// on a single partition of the table. A reservation resource exists as a child
42// resource of the admin project and location, e.g.:
43//   `projects/myproject/locations/US/reservations/reservationName`.
44//
45// A capacity commitment is a way to purchase compute capacity for BigQuery jobs
46// (in the form of slots) with some committed period of usage. A capacity
47// commitment resource exists as a child resource of the admin project and
48// location, e.g.:
49//   `projects/myproject/locations/US/capacityCommitments/id`.
50service ReservationService {
51  option (google.api.default_host) = "bigqueryreservation.googleapis.com";
52  option (google.api.oauth_scopes) =
53      "https://www.googleapis.com/auth/bigquery,"
54      "https://www.googleapis.com/auth/cloud-platform";
55
56  // Creates a new reservation resource.
57  rpc CreateReservation(CreateReservationRequest) returns (Reservation) {
58    option (google.api.http) = {
59      post: "/v1/{parent=projects/*/locations/*}/reservations"
60      body: "reservation"
61    };
62    option (google.api.method_signature) = "parent,reservation,reservation_id";
63  }
64
65  // Lists all the reservations for the project in the specified location.
66  rpc ListReservations(ListReservationsRequest)
67      returns (ListReservationsResponse) {
68    option (google.api.http) = {
69      get: "/v1/{parent=projects/*/locations/*}/reservations"
70    };
71    option (google.api.method_signature) = "parent";
72  }
73
74  // Returns information about the reservation.
75  rpc GetReservation(GetReservationRequest) returns (Reservation) {
76    option (google.api.http) = {
77      get: "/v1/{name=projects/*/locations/*/reservations/*}"
78    };
79    option (google.api.method_signature) = "name";
80  }
81
82  // Deletes a reservation.
83  // Returns `google.rpc.Code.FAILED_PRECONDITION` when reservation has
84  // assignments.
85  rpc DeleteReservation(DeleteReservationRequest)
86      returns (google.protobuf.Empty) {
87    option (google.api.http) = {
88      delete: "/v1/{name=projects/*/locations/*/reservations/*}"
89    };
90    option (google.api.method_signature) = "name";
91  }
92
93  // Updates an existing reservation resource.
94  rpc UpdateReservation(UpdateReservationRequest) returns (Reservation) {
95    option (google.api.http) = {
96      patch: "/v1/{reservation.name=projects/*/locations/*/reservations/*}"
97      body: "reservation"
98    };
99    option (google.api.method_signature) = "reservation,update_mask";
100  }
101
102  // Creates a new capacity commitment resource.
103  rpc CreateCapacityCommitment(CreateCapacityCommitmentRequest)
104      returns (CapacityCommitment) {
105    option (google.api.http) = {
106      post: "/v1/{parent=projects/*/locations/*}/capacityCommitments"
107      body: "capacity_commitment"
108    };
109    option (google.api.method_signature) = "parent,capacity_commitment";
110  }
111
112  // Lists all the capacity commitments for the admin project.
113  rpc ListCapacityCommitments(ListCapacityCommitmentsRequest)
114      returns (ListCapacityCommitmentsResponse) {
115    option (google.api.http) = {
116      get: "/v1/{parent=projects/*/locations/*}/capacityCommitments"
117    };
118    option (google.api.method_signature) = "parent";
119  }
120
121  // Returns information about the capacity commitment.
122  rpc GetCapacityCommitment(GetCapacityCommitmentRequest)
123      returns (CapacityCommitment) {
124    option (google.api.http) = {
125      get: "/v1/{name=projects/*/locations/*/capacityCommitments/*}"
126    };
127    option (google.api.method_signature) = "name";
128  }
129
130  // Deletes a capacity commitment. Attempting to delete capacity commitment
131  // before its commitment_end_time will fail with the error code
132  // `google.rpc.Code.FAILED_PRECONDITION`.
133  rpc DeleteCapacityCommitment(DeleteCapacityCommitmentRequest)
134      returns (google.protobuf.Empty) {
135    option (google.api.http) = {
136      delete: "/v1/{name=projects/*/locations/*/capacityCommitments/*}"
137    };
138    option (google.api.method_signature) = "name";
139  }
140
141  // Updates an existing capacity commitment.
142  //
143  // Only `plan` and `renewal_plan` fields can be updated.
144  //
145  // Plan can only be changed to a plan of a longer commitment period.
146  // Attempting to change to a plan with shorter commitment period will fail
147  // with the error code `google.rpc.Code.FAILED_PRECONDITION`.
148  rpc UpdateCapacityCommitment(UpdateCapacityCommitmentRequest)
149      returns (CapacityCommitment) {
150    option (google.api.http) = {
151      patch: "/v1/{capacity_commitment.name=projects/*/locations/*/capacityCommitments/*}"
152      body: "capacity_commitment"
153    };
154    option (google.api.method_signature) = "capacity_commitment,update_mask";
155  }
156
157  // Splits capacity commitment to two commitments of the same plan and
158  // `commitment_end_time`.
159  //
160  // A common use case is to enable downgrading commitments.
161  //
162  // For example, in order to downgrade from 10000 slots to 8000, you might
163  // split a 10000 capacity commitment into commitments of 2000 and 8000. Then,
164  // you delete the first one after the commitment end time passes.
165  rpc SplitCapacityCommitment(SplitCapacityCommitmentRequest)
166      returns (SplitCapacityCommitmentResponse) {
167    option (google.api.http) = {
168      post: "/v1/{name=projects/*/locations/*/capacityCommitments/*}:split"
169      body: "*"
170    };
171    option (google.api.method_signature) = "name,slot_count";
172  }
173
174  // Merges capacity commitments of the same plan into a single commitment.
175  //
176  // The resulting capacity commitment has the greater commitment_end_time
177  // out of the to-be-merged capacity commitments.
178  //
179  // Attempting to merge capacity commitments of different plan will fail
180  // with the error code `google.rpc.Code.FAILED_PRECONDITION`.
181  rpc MergeCapacityCommitments(MergeCapacityCommitmentsRequest)
182      returns (CapacityCommitment) {
183    option (google.api.http) = {
184      post: "/v1/{parent=projects/*/locations/*}/capacityCommitments:merge"
185      body: "*"
186    };
187    option (google.api.method_signature) = "parent,capacity_commitment_ids";
188  }
189
190  // Creates an assignment object which allows the given project to submit jobs
191  // of a certain type using slots from the specified reservation.
192  //
193  // Currently a
194  // resource (project, folder, organization) can only have one assignment per
195  // each (job_type, location) combination, and that reservation will be used
196  // for all jobs of the matching type.
197  //
198  // Different assignments can be created on different levels of the
199  // projects, folders or organization hierarchy.  During query execution,
200  // the assignment is looked up at the project, folder and organization levels
201  // in that order. The first assignment found is applied to the query.
202  //
203  // When creating assignments, it does not matter if other assignments exist at
204  // higher levels.
205  //
206  // Example:
207  //
208  // * The organization `organizationA` contains two projects, `project1`
209  //   and `project2`.
210  // * Assignments for all three entities (`organizationA`, `project1`, and
211  //   `project2`) could all be created and mapped to the same or different
212  //   reservations.
213  //
214  // "None" assignments represent an absence of the assignment. Projects
215  // assigned to None use on-demand pricing. To create a "None" assignment, use
216  // "none" as a reservation_id in the parent. Example parent:
217  // `projects/myproject/locations/US/reservations/none`.
218  //
219  // Returns `google.rpc.Code.PERMISSION_DENIED` if user does not have
220  // 'bigquery.admin' permissions on the project using the reservation
221  // and the project that owns this reservation.
222  //
223  // Returns `google.rpc.Code.INVALID_ARGUMENT` when location of the assignment
224  // does not match location of the reservation.
225  rpc CreateAssignment(CreateAssignmentRequest) returns (Assignment) {
226    option (google.api.http) = {
227      post: "/v1/{parent=projects/*/locations/*/reservations/*}/assignments"
228      body: "assignment"
229    };
230    option (google.api.method_signature) = "parent,assignment";
231  }
232
233  // Lists assignments.
234  //
235  // Only explicitly created assignments will be returned.
236  //
237  // Example:
238  //
239  // * Organization `organizationA` contains two projects, `project1` and
240  //   `project2`.
241  // * Reservation `res1` exists and was created previously.
242  // * CreateAssignment was used previously to define the following
243  //   associations between entities and reservations: `<organizationA, res1>`
244  //   and `<project1, res1>`
245  //
246  // In this example, ListAssignments will just return the above two assignments
247  // for reservation `res1`, and no expansion/merge will happen.
248  //
249  // The wildcard "-" can be used for
250  // reservations in the request. In that case all assignments belongs to the
251  // specified project and location will be listed.
252  //
253  // **Note** "-" cannot be used for projects nor locations.
254  rpc ListAssignments(ListAssignmentsRequest)
255      returns (ListAssignmentsResponse) {
256    option (google.api.http) = {
257      get: "/v1/{parent=projects/*/locations/*/reservations/*}/assignments"
258    };
259    option (google.api.method_signature) = "parent";
260  }
261
262  // Deletes a assignment. No expansion will happen.
263  //
264  // Example:
265  //
266  // * Organization `organizationA` contains two projects, `project1` and
267  //   `project2`.
268  // * Reservation `res1` exists and was created previously.
269  // * CreateAssignment was used previously to define the following
270  //   associations between entities and reservations: `<organizationA, res1>`
271  //   and `<project1, res1>`
272  //
273  // In this example, deletion of the `<organizationA, res1>` assignment won't
274  // affect the other assignment `<project1, res1>`. After said deletion,
275  // queries from `project1` will still use `res1` while queries from
276  // `project2` will switch to use on-demand mode.
277  rpc DeleteAssignment(DeleteAssignmentRequest)
278      returns (google.protobuf.Empty) {
279    option (google.api.http) = {
280      delete: "/v1/{name=projects/*/locations/*/reservations/*/assignments/*}"
281    };
282    option (google.api.method_signature) = "name";
283  }
284
285  // Deprecated: Looks up assignments for a specified resource for a particular
286  // region. If the request is about a project:
287  //
288  // 1. Assignments created on the project will be returned if they exist.
289  // 2. Otherwise assignments created on the closest ancestor will be
290  //    returned.
291  // 3. Assignments for different JobTypes will all be returned.
292  //
293  // The same logic applies if the request is about a folder.
294  //
295  // If the request is about an organization, then assignments created on the
296  // organization will be returned (organization doesn't have ancestors).
297  //
298  // Comparing to ListAssignments, there are some behavior
299  // differences:
300  //
301  // 1. permission on the assignee will be verified in this API.
302  // 2. Hierarchy lookup (project->folder->organization) happens in this API.
303  // 3. Parent here is `projects/*/locations/*`, instead of
304  //    `projects/*/locations/*reservations/*`.
305  //
306  // **Note** "-" cannot be used for projects
307  // nor locations.
308  rpc SearchAssignments(SearchAssignmentsRequest)
309      returns (SearchAssignmentsResponse) {
310    option deprecated = true;
311    option (google.api.http) = {
312      get: "/v1/{parent=projects/*/locations/*}:searchAssignments"
313    };
314    option (google.api.method_signature) = "parent,query";
315  }
316
317  // Looks up assignments for a specified resource for a particular region.
318  // If the request is about a project:
319  //
320  // 1. Assignments created on the project will be returned if they exist.
321  // 2. Otherwise assignments created on the closest ancestor will be
322  //    returned.
323  // 3. Assignments for different JobTypes will all be returned.
324  //
325  // The same logic applies if the request is about a folder.
326  //
327  // If the request is about an organization, then assignments created on the
328  // organization will be returned (organization doesn't have ancestors).
329  //
330  // Comparing to ListAssignments, there are some behavior
331  // differences:
332  //
333  // 1. permission on the assignee will be verified in this API.
334  // 2. Hierarchy lookup (project->folder->organization) happens in this API.
335  // 3. Parent here is `projects/*/locations/*`, instead of
336  //    `projects/*/locations/*reservations/*`.
337  rpc SearchAllAssignments(SearchAllAssignmentsRequest)
338      returns (SearchAllAssignmentsResponse) {
339    option (google.api.http) = {
340      get: "/v1/{parent=projects/*/locations/*}:searchAllAssignments"
341    };
342    option (google.api.method_signature) = "parent,query";
343  }
344
345  // Moves an assignment under a new reservation.
346  //
347  // This differs from removing an existing assignment and recreating a new one
348  // by providing a transactional change that ensures an assignee always has an
349  // associated reservation.
350  rpc MoveAssignment(MoveAssignmentRequest) returns (Assignment) {
351    option (google.api.http) = {
352      post: "/v1/{name=projects/*/locations/*/reservations/*/assignments/*}:move"
353      body: "*"
354    };
355    option (google.api.method_signature) = "name,destination_id";
356  }
357
358  // Updates an existing assignment.
359  //
360  // Only the `priority` field can be updated.
361  rpc UpdateAssignment(UpdateAssignmentRequest) returns (Assignment) {
362    option (google.api.http) = {
363      patch: "/v1/{assignment.name=projects/*/locations/*/reservations/*/assignments/*}"
364      body: "assignment"
365    };
366    option (google.api.method_signature) = "assignment,update_mask";
367  }
368
369  // Retrieves a BI reservation.
370  rpc GetBiReservation(GetBiReservationRequest) returns (BiReservation) {
371    option (google.api.http) = {
372      get: "/v1/{name=projects/*/locations/*/biReservation}"
373    };
374    option (google.api.method_signature) = "name";
375  }
376
377  // Updates a BI reservation.
378  //
379  // Only fields specified in the `field_mask` are updated.
380  //
381  // A singleton BI reservation always exists with default size 0.
382  // In order to reserve BI capacity it needs to be updated to an amount
383  // greater than 0. In order to release BI capacity reservation size
384  // must be set to 0.
385  rpc UpdateBiReservation(UpdateBiReservationRequest) returns (BiReservation) {
386    option (google.api.http) = {
387      patch: "/v1/{bi_reservation.name=projects/*/locations/*/biReservation}"
388      body: "bi_reservation"
389    };
390    option (google.api.method_signature) = "bi_reservation,update_mask";
391  }
392}
393
394// A reservation is a mechanism used to guarantee slots to users.
395message Reservation {
396  option (google.api.resource) = {
397    type: "bigqueryreservation.googleapis.com/Reservation"
398    pattern: "projects/{project}/locations/{location}/reservations/{reservation}"
399  };
400
401  // Auto scaling settings.
402  message Autoscale {
403    // Output only. The slot capacity added to this reservation when autoscale
404    // happens. Will be between [0, max_slots].
405    int64 current_slots = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
406
407    // Number of slots to be scaled when needed.
408    int64 max_slots = 2;
409  }
410
411  // The resource name of the reservation, e.g.,
412  // `projects/*/locations/*/reservations/team1-prod`.
413  // The reservation_id must only contain lower case alphanumeric characters or
414  // dashes. It must start with a letter and must not end with a dash. Its
415  // maximum length is 64 characters.
416  string name = 1;
417
418  // Minimum slots available to this reservation. A slot is a unit of
419  // computational power in BigQuery, and serves as the unit of parallelism.
420  //
421  // Queries using this reservation might use more slots during runtime if
422  // ignore_idle_slots is set to false.
423  //
424  // If total slot_capacity of the reservation and its siblings
425  // exceeds the total slot_count of all capacity commitments, the request will
426  // fail with `google.rpc.Code.RESOURCE_EXHAUSTED`.
427  //
428  //
429  // NOTE: for reservations in US or EU multi-regions, slot capacity constraints
430  // are checked separately for default and auxiliary regions. See
431  // multi_region_auxiliary flag for more details.
432  int64 slot_capacity = 2;
433
434  // If false, any query or pipeline job using this reservation will use idle
435  // slots from other reservations within the same admin project. If true, a
436  // query or pipeline job using this reservation will execute with the slot
437  // capacity specified in the slot_capacity field at most.
438  bool ignore_idle_slots = 4;
439
440  // The configuration parameters for the auto scaling feature. Note this is an
441  // alpha feature.
442  Autoscale autoscale = 7;
443
444  // Job concurrency target which sets a soft upper bound on the number of jobs
445  // that can run concurrently in this reservation. This is a soft target due to
446  // asynchronous nature of the system and various optimizations for small
447  // queries.
448  // Default value is 0 which means that concurrency target will be
449  // automatically computed by the system.
450  // NOTE: this field is exposed as `target_job_concurrency` in the Information
451  // Schema, DDL and BQ CLI.
452  int64 concurrency = 16;
453
454  // Output only. Creation time of the reservation.
455  google.protobuf.Timestamp creation_time = 8
456      [(google.api.field_behavior) = OUTPUT_ONLY];
457
458  // Output only. Last update time of the reservation.
459  google.protobuf.Timestamp update_time = 9
460      [(google.api.field_behavior) = OUTPUT_ONLY];
461
462  // Applicable only for reservations located within one of the BigQuery
463  // multi-regions (US or EU).
464  //
465  // If set to true, this reservation is placed in the organization's
466  // secondary region which is designated for disaster recovery purposes.
467  // If false, this reservation is placed in the organization's default region.
468  //
469  // NOTE: this is a preview feature. Project must be allow-listed in order to
470  // set this field.
471  bool multi_region_auxiliary = 14;
472
473  // Edition of the reservation.
474  Edition edition = 17;
475}
476
477// Capacity commitment is a way to purchase compute capacity for BigQuery jobs
478// (in the form of slots) with some committed period of usage. Annual
479// commitments renew by default. Commitments can be removed after their
480// commitment end time passes.
481//
482// In order to remove annual commitment, its plan needs to be changed
483// to monthly or flex first.
484//
485// A capacity commitment resource exists as a child resource of the admin
486// project.
487message CapacityCommitment {
488  option (google.api.resource) = {
489    type: "bigqueryreservation.googleapis.com/CapacityCommitment"
490    pattern: "projects/{project}/locations/{location}/capacityCommitments/{capacity_commitment}"
491  };
492
493  // Commitment plan defines the current committed period. Capacity commitment
494  // cannot be deleted during it's committed period.
495  enum CommitmentPlan {
496    // Invalid plan value. Requests with this value will be rejected with
497    // error code `google.rpc.Code.INVALID_ARGUMENT`.
498    COMMITMENT_PLAN_UNSPECIFIED = 0;
499
500    // Flex commitments have committed period of 1 minute after becoming ACTIVE.
501    // After that, they are not in a committed period anymore and can be removed
502    // any time.
503    FLEX = 3;
504
505    // Same as FLEX, should only be used if flat-rate commitments are still
506    // available.
507    FLEX_FLAT_RATE = 7 [deprecated = true];
508
509    // Trial commitments have a committed period of 182 days after becoming
510    // ACTIVE. After that, they are converted to a new commitment based on the
511    // `renewal_plan`. Default `renewal_plan` for Trial commitment is Flex so
512    // that it can be deleted right after committed period ends.
513    TRIAL = 5;
514
515    // Monthly commitments have a committed period of 30 days after becoming
516    // ACTIVE. After that, they are not in a committed period anymore and can be
517    // removed any time.
518    MONTHLY = 2;
519
520    // Same as MONTHLY, should only be used if flat-rate commitments are still
521    // available.
522    MONTHLY_FLAT_RATE = 8 [deprecated = true];
523
524    // Annual commitments have a committed period of 365 days after becoming
525    // ACTIVE. After that they are converted to a new commitment based on the
526    // renewal_plan.
527    ANNUAL = 4;
528
529    // Same as ANNUAL, should only be used if flat-rate commitments are still
530    // available.
531    ANNUAL_FLAT_RATE = 9 [deprecated = true];
532
533    // 3-year commitments have a committed period of 1095(3 * 365) days after
534    // becoming ACTIVE. After that they are converted to a new commitment based
535    // on the renewal_plan.
536    THREE_YEAR = 10;
537
538    // Should only be used for `renewal_plan` and is only meaningful if
539    // edition is specified to values other than EDITION_UNSPECIFIED. Otherwise
540    // CreateCapacityCommitmentRequest or UpdateCapacityCommitmentRequest will
541    // be rejected with error code `google.rpc.Code.INVALID_ARGUMENT`. If the
542    // renewal_plan is NONE, capacity commitment will be removed at the end of
543    // its commitment period.
544    NONE = 6;
545  }
546
547  // Capacity commitment can either become ACTIVE right away or transition
548  // from PENDING to ACTIVE or FAILED.
549  enum State {
550    // Invalid state value.
551    STATE_UNSPECIFIED = 0;
552
553    // Capacity commitment is pending provisioning. Pending capacity commitment
554    // does not contribute to the project's slot_capacity.
555    PENDING = 1;
556
557    // Once slots are provisioned, capacity commitment becomes active.
558    // slot_count is added to the project's slot_capacity.
559    ACTIVE = 2;
560
561    // Capacity commitment is failed to be activated by the backend.
562    FAILED = 3;
563  }
564
565  // Output only. The resource name of the capacity commitment, e.g.,
566  // `projects/myproject/locations/US/capacityCommitments/123`
567  // The commitment_id must only contain lower case alphanumeric characters or
568  // dashes. It must start with a letter and must not end
569  // with a dash. Its maximum length is 64 characters.
570  string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
571
572  // Number of slots in this commitment.
573  int64 slot_count = 2;
574
575  // Capacity commitment commitment plan.
576  CommitmentPlan plan = 3;
577
578  // Output only. State of the commitment.
579  State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
580
581  // Output only. The start of the current commitment period. It is applicable
582  // only for ACTIVE capacity commitments.
583  google.protobuf.Timestamp commitment_start_time = 9
584      [(google.api.field_behavior) = OUTPUT_ONLY];
585
586  // Output only. The end of the current commitment period. It is applicable
587  // only for ACTIVE capacity commitments.
588  google.protobuf.Timestamp commitment_end_time = 5
589      [(google.api.field_behavior) = OUTPUT_ONLY];
590
591  // Output only. For FAILED commitment plan, provides the reason of failure.
592  google.rpc.Status failure_status = 7
593      [(google.api.field_behavior) = OUTPUT_ONLY];
594
595  // The plan this capacity commitment is converted to after commitment_end_time
596  // passes. Once the plan is changed, committed period is extended according to
597  // commitment plan. Only applicable for ANNUAL and TRIAL commitments.
598  CommitmentPlan renewal_plan = 8;
599
600  // Applicable only for commitments located within one of the BigQuery
601  // multi-regions (US or EU).
602  //
603  // If set to true, this commitment is placed in the organization's
604  // secondary region which is designated for disaster recovery purposes.
605  // If false, this commitment is placed in the organization's default region.
606  //
607  // NOTE: this is a preview feature. Project must be allow-listed in order to
608  // set this field.
609  bool multi_region_auxiliary = 10;
610
611  // Edition of the capacity commitment.
612  Edition edition = 12;
613}
614
615// The request for
616// [ReservationService.CreateReservation][google.cloud.bigquery.reservation.v1.ReservationService.CreateReservation].
617message CreateReservationRequest {
618  // Required. Project, location. E.g.,
619  // `projects/myproject/locations/US`
620  string parent = 1 [
621    (google.api.field_behavior) = REQUIRED,
622    (google.api.resource_reference) = {
623      child_type: "bigqueryreservation.googleapis.com/Reservation"
624    }
625  ];
626
627  // The reservation ID. It must only contain lower case alphanumeric
628  // characters or dashes. It must start with a letter and must not end
629  // with a dash. Its maximum length is 64 characters.
630  string reservation_id = 2;
631
632  // Definition of the new reservation to create.
633  Reservation reservation = 3;
634}
635
636// The request for
637// [ReservationService.ListReservations][google.cloud.bigquery.reservation.v1.ReservationService.ListReservations].
638message ListReservationsRequest {
639  // Required. The parent resource name containing project and location, e.g.:
640  //   `projects/myproject/locations/US`
641  string parent = 1 [
642    (google.api.field_behavior) = REQUIRED,
643    (google.api.resource_reference) = {
644      child_type: "bigqueryreservation.googleapis.com/Reservation"
645    }
646  ];
647
648  // The maximum number of items to return per page.
649  int32 page_size = 2;
650
651  // The next_page_token value returned from a previous List request, if any.
652  string page_token = 3;
653}
654
655// The response for
656// [ReservationService.ListReservations][google.cloud.bigquery.reservation.v1.ReservationService.ListReservations].
657message ListReservationsResponse {
658  // List of reservations visible to the user.
659  repeated Reservation reservations = 1;
660
661  // Token to retrieve the next page of results, or empty if there are no
662  // more results in the list.
663  string next_page_token = 2;
664}
665
666// The request for
667// [ReservationService.GetReservation][google.cloud.bigquery.reservation.v1.ReservationService.GetReservation].
668message GetReservationRequest {
669  // Required. Resource name of the reservation to retrieve. E.g.,
670  //    `projects/myproject/locations/US/reservations/team1-prod`
671  string name = 1 [
672    (google.api.field_behavior) = REQUIRED,
673    (google.api.resource_reference) = {
674      type: "bigqueryreservation.googleapis.com/Reservation"
675    }
676  ];
677}
678
679// The request for
680// [ReservationService.DeleteReservation][google.cloud.bigquery.reservation.v1.ReservationService.DeleteReservation].
681message DeleteReservationRequest {
682  // Required. Resource name of the reservation to retrieve. E.g.,
683  //    `projects/myproject/locations/US/reservations/team1-prod`
684  string name = 1 [
685    (google.api.field_behavior) = REQUIRED,
686    (google.api.resource_reference) = {
687      type: "bigqueryreservation.googleapis.com/Reservation"
688    }
689  ];
690}
691
692// The request for
693// [ReservationService.UpdateReservation][google.cloud.bigquery.reservation.v1.ReservationService.UpdateReservation].
694message UpdateReservationRequest {
695  // Content of the reservation to update.
696  Reservation reservation = 1;
697
698  // Standard field mask for the set of fields to be updated.
699  google.protobuf.FieldMask update_mask = 2;
700}
701
702// The request for
703// [ReservationService.CreateCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.CreateCapacityCommitment].
704message CreateCapacityCommitmentRequest {
705  // Required. Resource name of the parent reservation. E.g.,
706  //    `projects/myproject/locations/US`
707  string parent = 1 [
708    (google.api.field_behavior) = REQUIRED,
709    (google.api.resource_reference) = {
710      child_type: "bigqueryreservation.googleapis.com/CapacityCommitment"
711    }
712  ];
713
714  // Content of the capacity commitment to create.
715  CapacityCommitment capacity_commitment = 2;
716
717  // If true, fail the request if another project in the organization has a
718  // capacity commitment.
719  bool enforce_single_admin_project_per_org = 4;
720
721  // The optional capacity commitment ID. Capacity commitment name will be
722  // generated automatically if this field is empty.
723  // This field must only contain lower case alphanumeric characters or dashes.
724  // The first and last character cannot be a dash. Max length is 64 characters.
725  // NOTE: this ID won't be kept if the capacity commitment is split or merged.
726  string capacity_commitment_id = 5;
727}
728
729// The request for
730// [ReservationService.ListCapacityCommitments][google.cloud.bigquery.reservation.v1.ReservationService.ListCapacityCommitments].
731message ListCapacityCommitmentsRequest {
732  // Required. Resource name of the parent reservation. E.g.,
733  //    `projects/myproject/locations/US`
734  string parent = 1 [
735    (google.api.field_behavior) = REQUIRED,
736    (google.api.resource_reference) = {
737      child_type: "bigqueryreservation.googleapis.com/CapacityCommitment"
738    }
739  ];
740
741  // The maximum number of items to return.
742  int32 page_size = 2;
743
744  // The next_page_token value returned from a previous List request, if any.
745  string page_token = 3;
746}
747
748// The response for
749// [ReservationService.ListCapacityCommitments][google.cloud.bigquery.reservation.v1.ReservationService.ListCapacityCommitments].
750message ListCapacityCommitmentsResponse {
751  // List of capacity commitments visible to the user.
752  repeated CapacityCommitment capacity_commitments = 1;
753
754  // Token to retrieve the next page of results, or empty if there are no
755  // more results in the list.
756  string next_page_token = 2;
757}
758
759// The request for
760// [ReservationService.GetCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.GetCapacityCommitment].
761message GetCapacityCommitmentRequest {
762  // Required. Resource name of the capacity commitment to retrieve. E.g.,
763  //    `projects/myproject/locations/US/capacityCommitments/123`
764  string name = 1 [
765    (google.api.field_behavior) = REQUIRED,
766    (google.api.resource_reference) = {
767      type: "bigqueryreservation.googleapis.com/CapacityCommitment"
768    }
769  ];
770}
771
772// The request for
773// [ReservationService.DeleteCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.DeleteCapacityCommitment].
774message DeleteCapacityCommitmentRequest {
775  // Required. Resource name of the capacity commitment to delete. E.g.,
776  //    `projects/myproject/locations/US/capacityCommitments/123`
777  string name = 1 [
778    (google.api.field_behavior) = REQUIRED,
779    (google.api.resource_reference) = {
780      type: "bigqueryreservation.googleapis.com/CapacityCommitment"
781    }
782  ];
783
784  // Can be used to force delete commitments even if assignments exist. Deleting
785  // commitments with assignments may cause queries to fail if they no longer
786  // have access to slots.
787  bool force = 3;
788}
789
790// The request for
791// [ReservationService.UpdateCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.UpdateCapacityCommitment].
792message UpdateCapacityCommitmentRequest {
793  // Content of the capacity commitment to update.
794  CapacityCommitment capacity_commitment = 1;
795
796  // Standard field mask for the set of fields to be updated.
797  google.protobuf.FieldMask update_mask = 2;
798}
799
800// The request for
801// [ReservationService.SplitCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.SplitCapacityCommitment].
802message SplitCapacityCommitmentRequest {
803  // Required. The resource name e.g.,:
804  //  `projects/myproject/locations/US/capacityCommitments/123`
805  string name = 1 [
806    (google.api.field_behavior) = REQUIRED,
807    (google.api.resource_reference) = {
808      type: "bigqueryreservation.googleapis.com/CapacityCommitment"
809    }
810  ];
811
812  // Number of slots in the capacity commitment after the split.
813  int64 slot_count = 2;
814}
815
816// The response for
817// [ReservationService.SplitCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.SplitCapacityCommitment].
818message SplitCapacityCommitmentResponse {
819  // First capacity commitment, result of a split.
820  CapacityCommitment first = 1;
821
822  // Second capacity commitment, result of a split.
823  CapacityCommitment second = 2;
824}
825
826// The request for
827// [ReservationService.MergeCapacityCommitments][google.cloud.bigquery.reservation.v1.ReservationService.MergeCapacityCommitments].
828message MergeCapacityCommitmentsRequest {
829  // Parent resource that identifies admin project and location e.g.,
830  //  `projects/myproject/locations/us`
831  string parent = 1 [(google.api.resource_reference) = {
832    child_type: "bigqueryreservation.googleapis.com/CapacityCommitment"
833  }];
834
835  // Ids of capacity commitments to merge.
836  // These capacity commitments must exist under admin project and location
837  // specified in the parent.
838  // ID is the last portion of capacity commitment name e.g., 'abc' for
839  // projects/myproject/locations/US/capacityCommitments/abc
840  repeated string capacity_commitment_ids = 2;
841}
842
843// An assignment allows a project to submit jobs
844// of a certain type using slots from the specified reservation.
845message Assignment {
846  option (google.api.resource) = {
847    type: "bigqueryreservation.googleapis.com/Assignment"
848    pattern: "projects/{project}/locations/{location}/reservations/{reservation}/assignments/{assignment}"
849  };
850
851  // Types of job, which could be specified when using the reservation.
852  enum JobType {
853    // Invalid type. Requests with this value will be rejected with
854    // error code `google.rpc.Code.INVALID_ARGUMENT`.
855    JOB_TYPE_UNSPECIFIED = 0;
856
857    // Pipeline (load/export) jobs from the project will use the reservation.
858    PIPELINE = 1;
859
860    // Query jobs from the project will use the reservation.
861    QUERY = 2;
862
863    // BigQuery ML jobs that use services external to BigQuery for model
864    // training. These jobs will not utilize idle slots from other reservations.
865    ML_EXTERNAL = 3;
866
867    // Background jobs that BigQuery runs for the customers in the background.
868    BACKGROUND = 4;
869  }
870
871  // Assignment will remain in PENDING state if no active capacity commitment is
872  // present. It will become ACTIVE when some capacity commitment becomes
873  // active.
874  enum State {
875    // Invalid state value.
876    STATE_UNSPECIFIED = 0;
877
878    // Queries from assignee will be executed as on-demand, if related
879    // assignment is pending.
880    PENDING = 1;
881
882    // Assignment is ready.
883    ACTIVE = 2;
884  }
885
886  // Output only. Name of the resource. E.g.:
887  // `projects/myproject/locations/US/reservations/team1-prod/assignments/123`.
888  // The assignment_id must only contain lower case alphanumeric characters or
889  // dashes and the max length is 64 characters.
890  string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
891
892  // The resource which will use the reservation. E.g.
893  // `projects/myproject`, `folders/123`, or `organizations/456`.
894  string assignee = 4;
895
896  // Which type of jobs will use the reservation.
897  JobType job_type = 3;
898
899  // Output only. State of the assignment.
900  State state = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
901}
902
903// The request for
904// [ReservationService.CreateAssignment][google.cloud.bigquery.reservation.v1.ReservationService.CreateAssignment].
905// Note: "bigquery.reservationAssignments.create" permission is required on the
906// related assignee.
907message CreateAssignmentRequest {
908  // Required. The parent resource name of the assignment
909  // E.g. `projects/myproject/locations/US/reservations/team1-prod`
910  string parent = 1 [
911    (google.api.field_behavior) = REQUIRED,
912    (google.api.resource_reference) = {
913      child_type: "bigqueryreservation.googleapis.com/Assignment"
914    }
915  ];
916
917  // Assignment resource to create.
918  Assignment assignment = 2;
919
920  // The optional assignment ID. Assignment name will be generated automatically
921  // if this field is empty.
922  // This field must only contain lower case alphanumeric characters or dashes.
923  // Max length is 64 characters.
924  string assignment_id = 4;
925}
926
927// The request for
928// [ReservationService.ListAssignments][google.cloud.bigquery.reservation.v1.ReservationService.ListAssignments].
929message ListAssignmentsRequest {
930  // Required. The parent resource name e.g.:
931  //
932  // `projects/myproject/locations/US/reservations/team1-prod`
933  //
934  // Or:
935  //
936  // `projects/myproject/locations/US/reservations/-`
937  string parent = 1 [
938    (google.api.field_behavior) = REQUIRED,
939    (google.api.resource_reference) = {
940      child_type: "bigqueryreservation.googleapis.com/Assignment"
941    }
942  ];
943
944  // The maximum number of items to return per page.
945  int32 page_size = 2;
946
947  // The next_page_token value returned from a previous List request, if any.
948  string page_token = 3;
949}
950
951// The response for
952// [ReservationService.ListAssignments][google.cloud.bigquery.reservation.v1.ReservationService.ListAssignments].
953message ListAssignmentsResponse {
954  // List of assignments visible to the user.
955  repeated Assignment assignments = 1;
956
957  // Token to retrieve the next page of results, or empty if there are no
958  // more results in the list.
959  string next_page_token = 2;
960}
961
962// The request for
963// [ReservationService.DeleteAssignment][google.cloud.bigquery.reservation.v1.ReservationService.DeleteAssignment].
964// Note: "bigquery.reservationAssignments.delete" permission is required on the
965// related assignee.
966message DeleteAssignmentRequest {
967  // Required. Name of the resource, e.g.
968  //   `projects/myproject/locations/US/reservations/team1-prod/assignments/123`
969  string name = 1 [
970    (google.api.field_behavior) = REQUIRED,
971    (google.api.resource_reference) = {
972      type: "bigqueryreservation.googleapis.com/Assignment"
973    }
974  ];
975}
976
977// The request for
978// [ReservationService.SearchAssignments][google.cloud.bigquery.reservation.v1.ReservationService.SearchAssignments].
979// Note: "bigquery.reservationAssignments.search" permission is required on the
980// related assignee.
981message SearchAssignmentsRequest {
982  // Required. The resource name of the admin project(containing project and
983  // location), e.g.:
984  //   `projects/myproject/locations/US`.
985  string parent = 1 [
986    (google.api.field_behavior) = REQUIRED,
987    (google.api.resource_reference) = {
988      type: "locations.googleapis.com/Location"
989    }
990  ];
991
992  // Please specify resource name as assignee in the query.
993  //
994  // Examples:
995  //
996  // * `assignee=projects/myproject`
997  // * `assignee=folders/123`
998  // * `assignee=organizations/456`
999  string query = 2;
1000
1001  // The maximum number of items to return per page.
1002  int32 page_size = 3;
1003
1004  // The next_page_token value returned from a previous List request, if any.
1005  string page_token = 4;
1006}
1007
1008// The request for
1009// [ReservationService.SearchAllAssignments][google.cloud.bigquery.reservation.v1.ReservationService.SearchAllAssignments].
1010// Note: "bigquery.reservationAssignments.search" permission is required on the
1011// related assignee.
1012message SearchAllAssignmentsRequest {
1013  // Required. The resource name with location (project name could be the
1014  // wildcard '-'), e.g.:
1015  //   `projects/-/locations/US`.
1016  string parent = 1 [
1017    (google.api.field_behavior) = REQUIRED,
1018    (google.api.resource_reference) = {
1019      type: "locations.googleapis.com/Location"
1020    }
1021  ];
1022
1023  // Please specify resource name as assignee in the query.
1024  //
1025  // Examples:
1026  //
1027  // * `assignee=projects/myproject`
1028  // * `assignee=folders/123`
1029  // * `assignee=organizations/456`
1030  string query = 2;
1031
1032  // The maximum number of items to return per page.
1033  int32 page_size = 3;
1034
1035  // The next_page_token value returned from a previous List request, if any.
1036  string page_token = 4;
1037}
1038
1039// The response for
1040// [ReservationService.SearchAssignments][google.cloud.bigquery.reservation.v1.ReservationService.SearchAssignments].
1041message SearchAssignmentsResponse {
1042  // List of assignments visible to the user.
1043  repeated Assignment assignments = 1;
1044
1045  // Token to retrieve the next page of results, or empty if there are no
1046  // more results in the list.
1047  string next_page_token = 2;
1048}
1049
1050// The response for
1051// [ReservationService.SearchAllAssignments][google.cloud.bigquery.reservation.v1.ReservationService.SearchAllAssignments].
1052message SearchAllAssignmentsResponse {
1053  // List of assignments visible to the user.
1054  repeated Assignment assignments = 1;
1055
1056  // Token to retrieve the next page of results, or empty if there are no
1057  // more results in the list.
1058  string next_page_token = 2;
1059}
1060
1061// The request for
1062// [ReservationService.MoveAssignment][google.cloud.bigquery.reservation.v1.ReservationService.MoveAssignment].
1063//
1064// **Note**: "bigquery.reservationAssignments.create" permission is required on
1065// the destination_id.
1066//
1067// **Note**: "bigquery.reservationAssignments.create" and
1068// "bigquery.reservationAssignments.delete" permission are required on the
1069// related assignee.
1070message MoveAssignmentRequest {
1071  // Required. The resource name of the assignment,
1072  // e.g.
1073  // `projects/myproject/locations/US/reservations/team1-prod/assignments/123`
1074  string name = 1 [
1075    (google.api.field_behavior) = REQUIRED,
1076    (google.api.resource_reference) = {
1077      type: "bigqueryreservation.googleapis.com/Assignment"
1078    }
1079  ];
1080
1081  // The new reservation ID, e.g.:
1082  //   `projects/myotherproject/locations/US/reservations/team2-prod`
1083  string destination_id = 3 [(google.api.resource_reference) = {
1084    child_type: "bigqueryreservation.googleapis.com/Assignment"
1085  }];
1086
1087  // The optional assignment ID. A new assignment name is generated if this
1088  // field is empty.
1089  //
1090  // This field can contain only lowercase alphanumeric characters or dashes.
1091  // Max length is 64 characters.
1092  string assignment_id = 5;
1093}
1094
1095// The request for
1096// [ReservationService.UpdateAssignment][google.cloud.bigquery.reservation.v1.ReservationService.UpdateAssignment].
1097message UpdateAssignmentRequest {
1098  // Content of the assignment to update.
1099  Assignment assignment = 1;
1100
1101  // Standard field mask for the set of fields to be updated.
1102  google.protobuf.FieldMask update_mask = 2;
1103}
1104
1105// Fully qualified reference to BigQuery table.
1106// Internally stored as google.cloud.bi.v1.BqTableReference.
1107message TableReference {
1108  // The assigned project ID of the project.
1109  string project_id = 1;
1110
1111  // The ID of the dataset in the above project.
1112  string dataset_id = 2;
1113
1114  // The ID of the table in the above dataset.
1115  string table_id = 3;
1116}
1117
1118// Represents a BI Reservation.
1119message BiReservation {
1120  option (google.api.resource) = {
1121    type: "bigqueryreservation.googleapis.com/BiReservation"
1122    pattern: "projects/{project}/locations/{location}/biReservation"
1123  };
1124
1125  // The resource name of the singleton BI reservation.
1126  // Reservation names have the form
1127  // `projects/{project_id}/locations/{location_id}/biReservation`.
1128  string name = 1;
1129
1130  // Output only. The last update timestamp of a reservation.
1131  google.protobuf.Timestamp update_time = 3
1132      [(google.api.field_behavior) = OUTPUT_ONLY];
1133
1134  // Size of a reservation, in bytes.
1135  int64 size = 4;
1136
1137  // Preferred tables to use BI capacity for.
1138  repeated TableReference preferred_tables = 5;
1139}
1140
1141// A request to get a singleton BI reservation.
1142message GetBiReservationRequest {
1143  // Required. Name of the requested reservation, for example:
1144  // `projects/{project_id}/locations/{location_id}/biReservation`
1145  string name = 1 [
1146    (google.api.field_behavior) = REQUIRED,
1147    (google.api.resource_reference) = {
1148      type: "bigqueryreservation.googleapis.com/BiReservation"
1149    }
1150  ];
1151}
1152
1153// A request to update a BI reservation.
1154message UpdateBiReservationRequest {
1155  // A reservation to update.
1156  BiReservation bi_reservation = 1;
1157
1158  // A list of fields to be updated in this request.
1159  google.protobuf.FieldMask update_mask = 2;
1160}
1161
1162// The type of editions.
1163// Different features and behaviors are provided to different editions
1164// Capacity commitments and reservations are linked to editions.
1165enum Edition {
1166  // Default value, which will be treated as ENTERPRISE.
1167  EDITION_UNSPECIFIED = 0;
1168
1169  // Standard edition.
1170  STANDARD = 1;
1171
1172  // Enterprise edition.
1173  ENTERPRISE = 2;
1174
1175  // Enterprise plus edition.
1176  ENTERPRISE_PLUS = 3;
1177}
1178