Add API for bigqueryreservation v1.

PiperOrigin-RevId: 305151484
This commit is contained in:
Google APIs 2020-04-06 17:14:51 -07:00 committed by Copybara-Service
parent 514f7d2781
commit 6b9c969d42
4 changed files with 1543 additions and 0 deletions

View File

@ -0,0 +1,365 @@
# This file was automatically generated by BuildFileGenerator
# This is an API workspace, having public visibility by default makes perfect sense.
package(default_visibility = ["//visibility:public"])
##############################################################################
# Common
##############################################################################
load("@rules_proto//proto:defs.bzl", "proto_library")
load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
proto_library(
name = "reservation_proto",
srcs = [
"reservation.proto",
],
deps = [
"//google/api:annotations_proto",
"//google/api:client_proto",
"//google/api:field_behavior_proto",
"//google/api:resource_proto",
"//google/rpc:status_proto",
"@com_google_protobuf//:empty_proto",
"@com_google_protobuf//:field_mask_proto",
"@com_google_protobuf//:timestamp_proto",
],
)
proto_library_with_info(
name = "reservation_proto_with_info",
deps = [
":reservation_proto",
"//google/cloud:common_resources_proto",
],
)
##############################################################################
# Java
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"java_gapic_assembly_gradle_pkg",
"java_gapic_library",
"java_gapic_test",
"java_grpc_library",
"java_proto_library",
)
java_proto_library(
name = "reservation_java_proto",
deps = [":reservation_proto"],
)
java_grpc_library(
name = "reservation_java_grpc",
srcs = [":reservation_proto"],
deps = [":reservation_java_proto"],
)
java_gapic_library(
name = "reservation_java_gapic",
src = ":reservation_proto_with_info",
gapic_yaml = "bigqueryreservation_gapic.yaml",
package = "google.cloud.bigquery.reservation.v1",
service_yaml = "bigqueryreservation_v1.yaml",
test_deps = [
":reservation_java_grpc",
],
deps = [
":reservation_java_proto",
],
)
java_gapic_test(
name = "reservation_java_gapic_test_suite",
test_classes = [
"com.google.cloud.bigquery.reservation.v1.ReservationServiceClientTest",
],
runtime_deps = [":reservation_java_gapic_test"],
)
# Open Source Packages
java_gapic_assembly_gradle_pkg(
name = "google-cloud-bigquery-reservation-v1-java",
deps = [
":reservation_java_gapic",
":reservation_java_grpc",
":reservation_java_proto",
":reservation_proto",
],
)
##############################################################################
# Go
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"go_gapic_assembly_pkg",
"go_gapic_library",
"go_proto_library",
"go_test",
)
go_proto_library(
name = "reservation_go_proto",
compilers = ["@io_bazel_rules_go//proto:go_grpc"],
importpath = "google.golang.org/genproto/googleapis/cloud/bigquery/reservation/v1",
protos = [":reservation_proto"],
deps = [
"//google/api:annotations_go_proto",
"//google/rpc:status_go_proto",
],
)
go_gapic_library(
name = "reservation_go_gapic",
srcs = [":reservation_proto_with_info"],
grpc_service_config = "bigqueryreservation_grpc_service_config.json",
importpath = "cloud.google.com/go/bigquery/reservation/apiv1;reservation",
service_yaml = "bigqueryreservation_v1.yaml",
deps = [
":reservation_go_proto",
],
)
go_test(
name = "reservation_go_gapic_test",
srcs = [":reservation_go_gapic_srcjar_test"],
embed = [":reservation_go_gapic"],
importpath = "cloud.google.com/go/bigquery/reservation/apiv1",
)
# Open Source Packages
go_gapic_assembly_pkg(
name = "gapi-cloud-bigquery-reservation-v1-go",
deps = [
":reservation_go_gapic",
":reservation_go_gapic_srcjar-test.srcjar",
":reservation_go_proto",
],
)
##############################################################################
# Python
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"moved_proto_library",
"py_gapic_assembly_pkg",
"py_gapic_library",
"py_grpc_library",
"py_proto_library",
)
moved_proto_library(
name = "reservation_moved_proto",
srcs = [":reservation_proto"],
deps = [
"//google/api:annotations_proto",
"//google/api:client_proto",
"//google/api:field_behavior_proto",
"//google/api:resource_proto",
"//google/rpc:status_proto",
"@com_google_protobuf//:empty_proto",
"@com_google_protobuf//:field_mask_proto",
"@com_google_protobuf//:timestamp_proto",
],
)
py_proto_library(
name = "reservation_py_proto",
plugin = "@protoc_docs_plugin//:docs_plugin",
deps = [":reservation_moved_proto"],
)
py_grpc_library(
name = "reservation_py_grpc",
srcs = [":reservation_moved_proto"],
deps = [":reservation_py_proto"],
)
py_gapic_library(
name = "reservation_py_gapic",
src = ":reservation_proto_with_info",
gapic_yaml = "bigqueryreservation_gapic.yaml",
package = "google.cloud.bigquery.reservation.v1",
service_yaml = "bigqueryreservation_v1.yaml",
deps = [
":reservation_py_grpc",
":reservation_py_proto",
],
)
# Open Source Packages
py_gapic_assembly_pkg(
name = "bigquery-reservation-v1-py",
deps = [
":reservation_py_gapic",
":reservation_py_grpc",
":reservation_py_proto",
],
)
##############################################################################
# PHP
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"php_gapic_assembly_pkg",
"php_gapic_library",
"php_grpc_library",
"php_proto_library",
)
php_proto_library(
name = "reservation_php_proto",
deps = [":reservation_proto"],
)
php_grpc_library(
name = "reservation_php_grpc",
srcs = [":reservation_proto"],
deps = [":reservation_php_proto"],
)
php_gapic_library(
name = "reservation_php_gapic",
src = ":reservation_proto_with_info",
gapic_yaml = "bigqueryreservation_gapic.yaml",
package = "google.cloud.bigquery.reservation.v1",
service_yaml = "bigqueryreservation_v1.yaml",
deps = [
":reservation_php_grpc",
":reservation_php_proto",
],
)
# Open Source Packages
php_gapic_assembly_pkg(
name = "google-cloud-bigquery-reservation-v1-php",
deps = [
":reservation_php_gapic",
":reservation_php_grpc",
":reservation_php_proto",
],
)
##############################################################################
# Node.js
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"nodejs_gapic_assembly_pkg",
"nodejs_gapic_library",
)
nodejs_gapic_library(
name = "reservation_nodejs_gapic",
src = ":reservation_proto_with_info",
gapic_yaml = "bigqueryreservation_gapic.yaml",
package = "google.cloud.bigquery.reservation.v1",
service_yaml = "bigqueryreservation_v1.yaml",
deps = [],
)
nodejs_gapic_assembly_pkg(
name = "bigquery-reservation-v1-nodejs",
deps = [
":reservation_nodejs_gapic",
":reservation_proto",
],
)
##############################################################################
# Ruby
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"ruby_gapic_assembly_pkg",
"ruby_gapic_library",
"ruby_grpc_library",
"ruby_proto_library",
)
ruby_proto_library(
name = "reservation_ruby_proto",
deps = [":reservation_proto"],
)
ruby_grpc_library(
name = "reservation_ruby_grpc",
srcs = [":reservation_proto"],
deps = [":reservation_ruby_proto"],
)
ruby_gapic_library(
name = "reservation_ruby_gapic",
src = ":reservation_proto_with_info",
gapic_yaml = "bigqueryreservation_gapic.yaml",
package = "google.cloud.bigquery.reservation.v1",
service_yaml = "bigqueryreservation_v1.yaml",
deps = [
":reservation_ruby_grpc",
":reservation_ruby_proto",
],
)
# Open Source Packages
ruby_gapic_assembly_pkg(
name = "google-cloud-bigquery-reservation-v1-ruby",
deps = [
":reservation_ruby_gapic",
":reservation_ruby_grpc",
":reservation_ruby_proto",
],
)
##############################################################################
# C#
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"csharp_gapic_assembly_pkg",
"csharp_gapic_library",
"csharp_grpc_library",
"csharp_proto_library",
)
csharp_proto_library(
name = "reservation_csharp_proto",
deps = [":reservation_proto"],
)
csharp_grpc_library(
name = "reservation_csharp_grpc",
srcs = [":reservation_proto"],
deps = [":reservation_csharp_proto"],
)
csharp_gapic_library(
name = "reservation_csharp_gapic",
src = ":reservation_proto_with_info",
gapic_yaml = "bigqueryreservation_gapic.yaml",
package = "google.cloud.bigquery.reservation.v1",
service_yaml = "bigqueryreservation_v1.yaml",
deps = [
":reservation_csharp_grpc",
":reservation_csharp_proto",
],
)
# Open Source Packages
csharp_gapic_assembly_pkg(
name = "google-cloud-bigquery-reservation-v1-csharp",
deps = [
":reservation_csharp_gapic",
":reservation_csharp_grpc",
":reservation_csharp_proto",
],
)
##############################################################################
# C++
##############################################################################
# Put your C++ rules here

View File

@ -0,0 +1,369 @@
type: com.google.api.codegen.ConfigProto
config_schema_version: 1.0.0
# The settings of generated code in a specific language.
language_settings:
java:
package_name: com.google.cloud.bigquery.reservation.v1
python:
package_name: google.cloud.bigquery.reservation_v1.gapic
go:
package_name: cloud.google.com/go/bigquery/reservation/apiv1
csharp:
package_name: Google.Cloud.Bigquery.Reservation.V1
ruby:
package_name: Google::Cloud::Bigquery::Reservation::V1
php:
package_name: Google\Cloud\Bigquery\Reservation\V1
nodejs:
package_name: reservation.v1
# A list of API interface configurations.
interfaces:
# The fully qualified name of the API interface.
- name: google.cloud.bigquery.reservation.v1.ReservationService
# A list of resource collection configurations.
# Consists of a name_pattern and an entity_name.
# The name_pattern is a pattern to describe the names of the resources of this
# collection, using the platform's conventions for URI patterns. A generator
# may use this to generate methods to compose and decompose such names. The
# pattern should use named placeholders as in `shelves/{shelf}/books/{book}`;
# those will be taken as hints for the parameter names of the generated
# methods. If empty, no name methods are generated.
# The entity_name is the name to be used as a basis for generated methods and
# classes.
collections:
- name_pattern: projects/{project}/locations/{location}
entity_name: location
- name_pattern: projects/{project}/locations/{location}/capacityCommitments/{capacity_commitment}
entity_name: capacity_commitment
- name_pattern: projects/{project}/locations/{location}/reservations/{reservation}
entity_name: reservation
- name_pattern: projects/{project}/locations/{location}/reservations/{reservation}/assignments/{assignment}
entity_name: assignment
# Definition for retryable codes.
retry_codes_def:
- name: idempotent
retry_codes:
- DEADLINE_EXCEEDED
- UNAVAILABLE
- name: non_idempotent
retry_codes: []
# Definition for retry/backoff parameters.
retry_params_def:
- name: default
initial_retry_delay_millis: 100
retry_delay_multiplier: 1.3
max_retry_delay_millis: 60000
initial_rpc_timeout_millis: 20000
rpc_timeout_multiplier: 1
max_rpc_timeout_millis: 20000
total_timeout_millis: 600000
# A list of method configurations.
# Common properties:
#
# name - The simple name of the method.
#
# flattening - Specifies the configuration for parameter flattening.
# Describes the parameter groups for which a generator should produce method
# overloads which allow a client to directly pass request message fields as
# method parameters. This information may or may not be used, depending on
# the target language.
# Consists of groups, which each represent a list of parameters to be
# flattened. Each parameter listed must be a field of the request message.
#
# required_fields - Fields that are always required for a request to be
# valid.
#
# page_streaming - Specifies the configuration for paging.
# Describes information for generating a method which transforms a paging
# list RPC into a stream of resources.
# Consists of a request and a response.
# The request specifies request information of the list method. It defines
# which fields match the paging pattern in the request. The request consists
# of a page_size_field and a token_field. The page_size_field is the name of
# the optional field specifying the maximum number of elements to be
# returned in the response. The token_field is the name of the field in the
# request containing the page token.
# The response specifies response information of the list method. It defines
# which fields match the paging pattern in the response. The response
# consists of a token_field and a resources_field. The token_field is the
# name of the field in the response containing the next page token. The
# resources_field is the name of the field in the response containing the
# list of resources belonging to the page.
#
# retry_codes_name - Specifies the configuration for retryable codes. The
# name must be defined in interfaces.retry_codes_def.
#
# retry_params_name - Specifies the configuration for retry/backoff
# parameters. The name must be defined in interfaces.retry_params_def.
#
# field_name_patterns - Maps the field name of the request type to
# entity_name of interfaces.collections.
# Specifies the string pattern that the field must follow.
#
# timeout_millis - Specifies the default timeout for a non-retrying call. If
# the call is retrying, refer to retry_params_name instead.
methods:
- name: CreateReservation
flattening:
groups:
- parameters:
- parent
- reservation_id
- reservation
required_fields:
- parent
- reservation_id
- reservation
retry_codes_name: non_idempotent
retry_params_name: default
field_name_patterns:
parent: location
timeout_millis: 60000
- name: ListReservations
flattening:
groups:
- parameters:
- parent
required_fields:
- parent
page_streaming:
request:
page_size_field: page_size
token_field: page_token
response:
token_field: next_page_token
resources_field: reservations
retry_codes_name: idempotent
retry_params_name: default
field_name_patterns:
parent: location
timeout_millis: 60000
- name: GetReservation
flattening:
groups:
- parameters:
- name
required_fields:
- name
retry_codes_name: idempotent
retry_params_name: default
field_name_patterns:
name: reservation
timeout_millis: 60000
- name: GetBiReservation
flattening:
groups:
- parameters:
- name
required_fields:
- name
retry_codes_name: idempotent
retry_params_name: default
field_name_patterns:
name: reservation
timeout_millis: 60000
- name: DeleteReservation
flattening:
groups:
- parameters:
- name
required_fields:
- name
retry_codes_name: idempotent
retry_params_name: default
field_name_patterns:
name: reservation
timeout_millis: 60000
- name: UpdateReservation
flattening:
groups:
- parameters:
- reservation
- update_mask
required_fields:
- reservation
- update_mask
retry_codes_name: non_idempotent
retry_params_name: default
field_name_patterns:
reservation.name: reservation
timeout_millis: 60000
- name: UpdateBiReservation
flattening:
groups:
- parameters:
- bi_reservation
- update_mask
required_fields:
- bi_reservation
- update_mask
retry_codes_name: non_idempotent
retry_params_name: default
field_name_patterns:
reservation.name: reservation
timeout_millis: 60000
- name: ListCapacityCommitments
flattening:
groups:
- parameters:
- parent
required_fields:
- parent
page_streaming:
request:
page_size_field: page_size
token_field: page_token
response:
token_field: next_page_token
resources_field: capacity_commitments
retry_codes_name: idempotent
retry_params_name: default
field_name_patterns:
parent: location
timeout_millis: 60000
- name: GetCapacityCommitment
flattening:
groups:
- parameters:
- name
required_fields:
- name
retry_codes_name: idempotent
retry_params_name: default
field_name_patterns:
name: capacity_commitment
timeout_millis: 60000
- name: UpdateCapacityCommitment
flattening:
groups:
- parameters:
- capacity_commitment
- update_mask
required_fields:
- capacity_commitment
- update_mask
retry_codes_name: non_idempotent
retry_params_name: default
field_name_patterns:
capacity_commitment.name: capacity_commitment
timeout_millis: 60000
- name: SplitCapacityCommitment
flattening:
groups:
- parameters:
- name
- slot_count
required_fields:
- name
- slot_count
retry_codes_name: non_idempotent
retry_params_name: default
field_name_patterns:
name: capacity_commitment
timeout_millis: 60000
- name: MergeCapacityCommitments
flattening:
groups:
- parameters:
- parent
- capacity_commitment_ids
required_fields:
- parent
- capacity_commitment_ids
retry_codes_name: non_idempotent
retry_params_name: default
field_name_patterns:
parent: location
timeout_millis: 6000
- name: DeleteCapacityCommitment
flattening:
groups:
- parameters:
- name
required_fields:
- name
retry_codes_name: idempotent
retry_params_name: default
field_name_patterns:
name: capacity_commitment
timeout_millis: 60000
- name: CreateAssignment
flattening:
groups:
- parameters:
- parent
- assignment
required_fields:
- parent
- assignment
retry_codes_name: non_idempotent
retry_params_name: default
field_name_patterns:
parent: reservation
timeout_millis: 60000
- name: ListAssignments
flattening:
groups:
- parameters:
- parent
required_fields:
- parent
page_streaming:
request:
page_size_field: page_size
token_field: page_token
response:
token_field: next_page_token
resources_field: assignments
retry_codes_name: idempotent
retry_params_name: default
field_name_patterns:
parent: reservation
timeout_millis: 60000
- name: DeleteAssignment
flattening:
groups:
- parameters:
- name
required_fields:
- name
retry_codes_name: idempotent
retry_params_name: default
field_name_patterns:
name: assignment
timeout_millis: 60000
- name: SearchAssignments
flattening:
groups:
- parameters:
- parent
- query
required_fields:
- parent
- query
page_streaming:
request:
page_size_field: page_size
token_field: page_token
response:
token_field: next_page_token
resources_field: assignments
retry_codes_name: idempotent
retry_params_name: default
field_name_patterns:
parent: location
timeout_millis: 60000
- name: MoveAssignment
flattening:
groups:
- parameters:
- name
- destination_id
required_fields:
- name
- destination_id
retry_codes_name: non_idempotent
retry_params_name: default
field_name_patterns:
name: assignment
timeout_millis: 60000

View File

@ -0,0 +1,30 @@
type: google.api.Service
config_version: 3
name: bigqueryreservation.googleapis.com
title: BigQuery Reservation API
apis:
- name: google.cloud.bigquery.reservation.v1.ReservationService
documentation:
summary: 'A service to modify your BigQuery flat-rate reservations.'
backend:
rules:
- selector: 'google.cloud.bigquery.reservation.v1.ReservationService.*'
deadline: 30.0
- selector: 'google.longrunning.Operations.*'
deadline: 30.0
authentication:
rules:
- selector: 'google.cloud.bigquery.reservation.v1.ReservationService.*'
oauth:
canonical_scopes: |-
https://www.googleapis.com/auth/bigquery,
https://www.googleapis.com/auth/cloud-platform
- selector: 'google.longrunning.Operations.*'
oauth:
canonical_scopes: |-
https://www.googleapis.com/auth/bigquery,
https://www.googleapis.com/auth/cloud-platform

View File

@ -0,0 +1,779 @@
// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.cloud.bigquery.reservation.v1;
import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/field_mask.proto";
import "google/protobuf/timestamp.proto";
import "google/rpc/status.proto";
option go_package = "google.golang.org/genproto/googleapis/cloud/bigquery/reservation/v1;reservation";
option java_multiple_files = true;
option java_outer_classname = "ReservationProto";
option java_package = "com.google.cloud.bigquery.reservation.v1";
// This API allows users to manage their flat-rate BigQuery reservations.
//
// A reservation provides computational resource guarantees, in the form of
// [slots](https://cloud.google.com/bigquery/docs/slots), to users. A slot is a
// unit of computational power in BigQuery, and serves as the basic unit of
// parallelism. In a scan of a multi-partitioned table, a single slot operates
// on a single partition of the table. A reservation resource exists as a child
// resource of the admin project and location, e.g.:
// projects/myproject/locations/US/reservations/reservationName.
//
// A capacity commitment is a way to purchase compute capacity for BigQuery jobs
// (in the form of slots) with some committed period of usage. A capacity
// commitment resource exists as a child resource of the admin project and
// location, e.g.:
// projects/myproject/locations/US/capacityCommitments/id.
service ReservationService {
option (google.api.default_host) = "bigqueryreservation.googleapis.com";
option (google.api.oauth_scopes) =
"https://www.googleapis.com/auth/bigquery,"
"https://www.googleapis.com/auth/cloud-platform";
// Creates a new reservation resource.
rpc CreateReservation(CreateReservationRequest) returns (Reservation) {
option (google.api.http) = {
post: "/v1/{parent=projects/*/locations/*}/reservations"
body: "reservation"
};
option (google.api.method_signature) = "parent,reservation,reservation_id";
}
// Lists all the reservations for the project in the specified location.
rpc ListReservations(ListReservationsRequest) returns (ListReservationsResponse) {
option (google.api.http) = {
get: "/v1/{parent=projects/*/locations/*}/reservations"
};
option (google.api.method_signature) = "parent";
}
// Returns information about the reservation.
rpc GetReservation(GetReservationRequest) returns (Reservation) {
option (google.api.http) = {
get: "/v1/{name=projects/*/locations/*/reservations/*}"
};
option (google.api.method_signature) = "name";
}
// Deletes a reservation.
// Returns `google.rpc.Code.FAILED_PRECONDITION` when reservation has
// assignments.
rpc DeleteReservation(DeleteReservationRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete: "/v1/{name=projects/*/locations/*/reservations/*}"
};
option (google.api.method_signature) = "name";
}
// Updates an existing reservation resource.
rpc UpdateReservation(UpdateReservationRequest) returns (Reservation) {
option (google.api.http) = {
patch: "/v1/{reservation.name=projects/*/locations/*/reservations/*}"
body: "reservation"
};
option (google.api.method_signature) = "reservation,update_mask";
}
// Lists all the capacity commitments for the admin project.
rpc ListCapacityCommitments(ListCapacityCommitmentsRequest) returns (ListCapacityCommitmentsResponse) {
option (google.api.http) = {
get: "/v1/{parent=projects/*/locations/*}/capacityCommitments"
};
option (google.api.method_signature) = "parent";
}
// Returns information about the capacity commitment.
rpc GetCapacityCommitment(GetCapacityCommitmentRequest) returns (CapacityCommitment) {
option (google.api.http) = {
get: "/v1/{name=projects/*/locations/*/capacityCommitments/*}"
};
option (google.api.method_signature) = "name";
}
// 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`.
rpc DeleteCapacityCommitment(DeleteCapacityCommitmentRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete: "/v1/{name=projects/*/locations/*/capacityCommitments/*}"
};
option (google.api.method_signature) = "name";
}
// 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`.
rpc UpdateCapacityCommitment(UpdateCapacityCommitmentRequest) returns (CapacityCommitment) {
option (google.api.http) = {
patch: "/v1/{capacity_commitment.name=projects/*/locations/*/capacityCommitments/*}"
body: "capacity_commitment"
};
option (google.api.method_signature) = "capacity_commitment,update_mask";
}
// Splits capacity commitment to two commitments of the same plan and
// commitment_end_time. A common use case to do that is to perform a downgrade
// e.g., in order to downgrade from 10000 slots to 8000, one might split 10000
// capacity commitment to 2000 and 8000, change the plan of the first one to
// flex and then delete it.
rpc SplitCapacityCommitment(SplitCapacityCommitmentRequest) returns (SplitCapacityCommitmentResponse) {
option (google.api.http) = {
post: "/v1/{name=projects/*/locations/*/capacityCommitments/*}:split"
body: "*"
};
option (google.api.method_signature) = "name,slot_count";
}
// Merges capacity commitments of the same plan into one. Resulting capacity
// commitment has the longer commitment_end_time out of the two. Attempting to
// merge capacity commitments of different plan will fail with the error code
// `google.rpc.Code.FAILED_PRECONDITION`.
rpc MergeCapacityCommitments(MergeCapacityCommitmentsRequest) returns (CapacityCommitment) {
option (google.api.http) = {
post: "/v1/{parent=projects/*/locations/*}/capacityCommitments:merge"
body: "*"
};
option (google.api.method_signature) = "parent,capacity_commitment_ids";
}
// Creates an object which allows the given project to submit jobs
// of a certain type using slots from the specified reservation. Currently a
// resource (project, folder, organization) can only have one assignment per
// {job_type, location}, and that reservation will be used for all jobs of the
// matching type. Within the organization, different assignments can be
// created on projects, folders or organization level. During query execution,
// the assignment is looked up at the project, folder and organization levels
// in that order. The first assignment found is applied to the query. When
// creating assignments, it does not matter if other assignments exist at
// higher levels. E.g: organizationA contains project1, project2. Assignments
// for organizationA, project1 and project2 could all be created, mapping to
// the same or different reservations.
// Returns `google.rpc.Code.PERMISSION_DENIED` if user does not have
// 'bigquery.admin' permissions on the project using the reservation
// and the project that owns this reservation.
// Returns `google.rpc.Code.INVALID_ARGUMENT` when location of the assignment
// does not match location of the reservation.
rpc CreateAssignment(CreateAssignmentRequest) returns (Assignment) {
option (google.api.http) = {
post: "/v1/{parent=projects/*/locations/*/reservations/*}/assignments"
body: "assignment"
};
option (google.api.method_signature) = "parent,assignment";
}
// Lists assignments.
// Only explicitly created assignments will be returned. E.g:
// organizationA contains project1 and project2. Reservation res1 exists.
// CreateAssignment was invoked previously and following assignments were
// created explicitly:
// <organizationA, res1>
// <project1, res1>
// Then this API will just return the above two assignments for reservation
// res1, and no expansion/merge will happen. Wildcard "-" can be used for
// reservations in the request. In that case all assignments belongs to the
// specified project and location will be listed. Note
// "-" cannot be used for projects nor locations.
rpc ListAssignments(ListAssignmentsRequest) returns (ListAssignmentsResponse) {
option (google.api.http) = {
get: "/v1/{parent=projects/*/locations/*/reservations/*}/assignments"
};
option (google.api.method_signature) = "parent";
}
// Deletes a assignment. No expansion will happen.
// E.g:
// organizationA contains project1 and project2. Reservation res1 exists.
// CreateAssignment was invoked previously and following assignments were
// created explicitly:
// <organizationA, res1>
// <project1, res1>
// Then deletion of <organizationA, res1> won't affect <project1, res1>. After
// deletion of <organizationA, res1>, queries from project1 will still use
// res1, while queries from project2 will use on-demand mode.
rpc DeleteAssignment(DeleteAssignmentRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete: "/v1/{name=projects/*/locations/*/reservations/*/assignments/*}"
};
option (google.api.method_signature) = "name";
}
// Looks up assignments for a specified resource for a particular region.
// If the request is about a project:
// 1) Assignments created on the project will be returned if they exist.
// 2) Otherwise assignments created on the closest ancestor will be
// returned. 3) Assignments for different JobTypes will all be returned.
// Same logic applies if the request is about a folder.
// If the request is about an organization, then assignments created on the
// organization will be returned (organization doesn't have ancestors).
// Comparing to ListAssignments, there are some behavior
// differences:
// 1) permission on the assignee will be verified in this API.
// 2) Hierarchy lookup (project->folder->organization) happens in this API.
// 3) Parent here is projects/*/locations/*, instead of
// projects/*/locations/*reservations/*.
// Note "-" cannot be used for projects
// nor locations.
rpc SearchAssignments(SearchAssignmentsRequest) returns (SearchAssignmentsResponse) {
option (google.api.http) = {
get: "/v1/{parent=projects/*/locations/*}:searchAssignments"
};
option (google.api.method_signature) = "parent,query";
}
// Moves a assignment under a new reservation. Customers can do this by
// deleting the existing assignment followed by creating another assignment
// under the new reservation, but this method provides a transactional way to
// do so, to make sure the assignee always has an associated reservation.
// Without the method customers might see some queries run on-demand which
// might be unexpected.
rpc MoveAssignment(MoveAssignmentRequest) returns (Assignment) {
option (google.api.http) = {
post: "/v1/{name=projects/*/locations/*/reservations/*/assignments/*}:move"
body: "*"
};
option (google.api.method_signature) = "name,destination_id";
}
// Retrieves a BI reservation.
rpc GetBiReservation(GetBiReservationRequest) returns (BiReservation) {
option (google.api.http) = {
get: "/v1/{name=projects/*/locations/*/biReservation}"
};
option (google.api.method_signature) = "name";
}
// Updates a BI reservation.
// Only fields specified in the field_mask are updated.
// Singleton BI reservation always exists with default size 0.
// In order to reserve BI capacity it needs to be updated to an amount
// greater than 0. In order to release BI capacity reservation size
// must be set to 0.
rpc UpdateBiReservation(UpdateBiReservationRequest) returns (BiReservation) {
option (google.api.http) = {
patch: "/v1/{bi_reservation.name=projects/*/locations/*/biReservation}"
body: "bi_reservation"
};
option (google.api.method_signature) = "bi_reservation,update_mask";
}
}
// A reservation is a mechanism used to guarantee slots to users.
message Reservation {
option (google.api.resource) = {
type: "bigqueryreservation.googleapis.com/Reservation"
pattern: "projects/{project}/locations/{location}/reservations/{reservation}"
};
// The resource name of the reservation, e.g.,
// "projects/*/locations/*/reservations/team1-prod".
string name = 1;
// Minimum slots available to this reservation. A slot is a unit of
// computational power in BigQuery, and serves as the unit of parallelism.
// Queries using this reservation might use more slots during runtime if
// ignore_idle_slots is set to false.
// If the new reservation's slot capacity exceed the parent's slot capacity or
// if total slot capacity of the new reservation and its siblings exceeds the
// parent's slot capacity, the request will fail with
// `google.rpc.Code.RESOURCE_EXHAUSTED`.
int64 slot_capacity = 2;
// If false, any query using this reservation will use idle slots from other
// reservations within the same admin project. If true, a query using this
// reservation will execute with the slot capacity specified above at most.
bool ignore_idle_slots = 4;
}
// Capacity commitment is a way to purchase compute capacity for BigQuery jobs
// (in the form of slots) with some committed period of usage. Monthly and
// annual commitments renew by default. Only flex commitments can be removed. In
// order to remove monthly or annual commitments, their plan needs to be changed
// to flex first.
//
// A capacity commitment resource exists as a child resource of the admin
// project.
message CapacityCommitment {
option (google.api.resource) = {
type: "bigqueryreservation.googleapis.com/CapacityCommitment"
pattern: "projects/{project}/locations/{location}/capacityCommitments/{capacity_commitment}"
};
// Commitment plan defines the current committed period. Capacity commitment
// cannot be deleted during it's committed period.
enum CommitmentPlan {
// Invalid plan value. Requests with this value will be rejected with
// error code `google.rpc.Code.INVALID_ARGUMENT`.
COMMITMENT_PLAN_UNSPECIFIED = 0;
// Flex commitments have committed period of 1 minute after becoming ACTIVE.
// After that, they are not in a committed period anymore and can be removed
// any time.
FLEX = 3;
// Monthly commitments have a committed period of 30 days after becoming
// ACTIVE.
MONTHLY = 2;
// Annual commitments have a committed period of 365 days after becoming
// ACTIVE.
ANNUAL = 4;
}
// Capacity commitment can either become ACTIVE right away or transition
// from PENDING to ACTIVE or FAILED.
enum State {
// Invalid state value.
STATE_UNSPECIFIED = 0;
// Capacity commitment is pending provisioning. Pending capacity commitment
// does not contribute to the parent's slot_capacity.
PENDING = 1;
// Once slots are provisioned, capacity commitment becomes active.
// slot_count is added to the parent's slot_capacity.
ACTIVE = 2;
// Capacity commitment is failed to be activated by the backend.
FAILED = 3;
}
// Output only. The resource name of the capacity commitment, e.g.,
// projects/myproject/locations/US/capacityCommitments/123
string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
// Number of slots in this commitment.
int64 slot_count = 2;
// Capacity commitment commitment plan.
CommitmentPlan plan = 3;
// Output only. State of the commitment.
State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
// Output only. The end of the current commitment period. It is applicable only for ACTIVE
// capacity commitments.
google.protobuf.Timestamp commitment_end_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
// Output only. For FAILED commitment plan, provides the reason of failure.
google.rpc.Status failure_status = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
// 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 MONTHLY and ANNUAL commitments.
CommitmentPlan renewal_plan = 8;
}
// The request for [ReservationService.CreateReservation][google.cloud.bigquery.reservation.v1.ReservationService.CreateReservation].
message CreateReservationRequest {
// Required. Project, location. E.g.,
// projects/myproject/locations/US
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
child_type: "bigqueryreservation.googleapis.com/Reservation"
}
];
// The reservation ID. This field must only contain lower case alphanumeric
// characters or dash. Max length is 64 characters.
string reservation_id = 2;
// Content of the new reservation to create.
Reservation reservation = 3;
}
// The request for [ReservationService.ListReservations][google.cloud.bigquery.reservation.v1.ReservationService.ListReservations].
message ListReservationsRequest {
// Required. The parent resource name containing project and location, e.g.:
// "projects/myproject/locations/US"
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
child_type: "bigqueryreservation.googleapis.com/Reservation"
}
];
// The maximum number of items to return.
int32 page_size = 2;
// The next_page_token value returned from a previous List request, if any.
string page_token = 3;
}
// The response for [ReservationService.ListReservations][google.cloud.bigquery.reservation.v1.ReservationService.ListReservations].
message ListReservationsResponse {
// List of reservations visible to the user.
repeated Reservation reservations = 1;
// Token to retrieve the next page of results, or empty if there are no
// more results in the list.
string next_page_token = 2;
}
// The request for [ReservationService.GetReservation][google.cloud.bigquery.reservation.v1.ReservationService.GetReservation].
message GetReservationRequest {
// Required. Resource name of the reservation to retrieve. E.g.,
// projects/myproject/locations/US/reservations/team1-prod
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "bigqueryreservation.googleapis.com/Reservation"
}
];
}
// The request for [ReservationService.DeleteReservation][google.cloud.bigquery.reservation.v1.ReservationService.DeleteReservation].
message DeleteReservationRequest {
// Required. Resource name of the reservation to retrieve. E.g.,
// projects/myproject/locations/US/reservations/team1-prod
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "bigqueryreservation.googleapis.com/Reservation"
}
];
}
// The request for [ReservationService.UpdateReservation][google.cloud.bigquery.reservation.v1.ReservationService.UpdateReservation].
message UpdateReservationRequest {
// Content of the reservation to update.
Reservation reservation = 1;
// Standard field mask for the set of fields to be updated.
google.protobuf.FieldMask update_mask = 2;
}
// The request for [ReservationService.ListCapacityCommitments][google.cloud.bigquery.reservation.v1.ReservationService.ListCapacityCommitments].
message ListCapacityCommitmentsRequest {
// Required. Resource name of the parent reservation. E.g.,
// projects/myproject/locations/US
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
child_type: "bigqueryreservation.googleapis.com/CapacityCommitment"
}
];
// The maximum number of items to return.
int32 page_size = 2;
// The next_page_token value returned from a previous List request, if any.
string page_token = 3;
}
// The response for [ReservationService.ListCapacityCommitments][google.cloud.bigquery.reservation.v1.ReservationService.ListCapacityCommitments].
message ListCapacityCommitmentsResponse {
// List of capacity commitments visible to the user.
repeated CapacityCommitment capacity_commitments = 1;
// Token to retrieve the next page of results, or empty if there are no
// more results in the list.
string next_page_token = 2;
}
// The request for [ReservationService.GetCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.GetCapacityCommitment].
message GetCapacityCommitmentRequest {
// Required. Resource name of the capacity commitment to retrieve. E.g.,
// projects/myproject/locations/US/capacityCommitments/123
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "bigqueryreservation.googleapis.com/CapacityCommitment"
}
];
}
// The request for [ReservationService.DeleteCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.DeleteCapacityCommitment].
message DeleteCapacityCommitmentRequest {
// Required. Resource name of the capacity commitment to delete. E.g.,
// projects/myproject/locations/US/capacityCommitments/123
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "bigqueryreservation.googleapis.com/CapacityCommitment"
}
];
}
// The request for [ReservationService.UpdateCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.UpdateCapacityCommitment].
message UpdateCapacityCommitmentRequest {
// Content of the capacity commitment to update.
CapacityCommitment capacity_commitment = 1;
// Standard field mask for the set of fields to be updated.
google.protobuf.FieldMask update_mask = 2;
}
// The request for [ReservationService.SplitCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.SplitCapacityCommitment].
message SplitCapacityCommitmentRequest {
// Required. The resource name e.g.,:
// projects/myproject/locations/US/capacityCommitments/123
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "bigqueryreservation.googleapis.com/CapacityCommitment"
}
];
// Number of slots in the capacity commitment after the split.
int64 slot_count = 2;
}
// The response for [ReservationService.SplitCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.SplitCapacityCommitment].
message SplitCapacityCommitmentResponse {
// First capacity commitment, result of a split.
CapacityCommitment first = 1;
// Second capacity commitment, result of a split.
CapacityCommitment second = 2;
}
// The request for [ReservationService.MergeCapacityCommitments][google.cloud.bigquery.reservation.v1.ReservationService.MergeCapacityCommitments].
message MergeCapacityCommitmentsRequest {
// Parent resource that identifies admin project and location e.g.,
// projects/myproject/locations/us
string parent = 1 [(google.api.resource_reference) = {
child_type: "bigqueryreservation.googleapis.com/CapacityCommitment"
}];
// Ids of capacity commitments to merge.
// These capacity commitments must exist under admin project and location
// specified in the parent.
repeated string capacity_commitment_ids = 2;
}
// A Assignment allows a project to submit jobs
// of a certain type using slots from the specified reservation.
message Assignment {
option (google.api.resource) = {
type: "bigqueryreservation.googleapis.com/Assignment"
pattern: "projects/{project}/locations/{location}/reservations/{reservation}/assignments/{assignment}"
};
// Types of job, which could be specified when using the reservation.
enum JobType {
// Invalid type. Requests with this value will be rejected with
// error code `google.rpc.Code.INVALID_ARGUMENT`.
JOB_TYPE_UNSPECIFIED = 0;
// Pipeline (load/export) jobs from the project will use the reservation.
PIPELINE = 1;
// Query jobs from the project will use the reservation.
QUERY = 2;
}
// Assignment will remain in PENDING state if no active capacity commitment is
// present. It will become ACTIVE when some capacity commitment becomes
// active.
enum State {
// Invalid state value.
STATE_UNSPECIFIED = 0;
// Queries from assignee will be executed as on-demand, if related
// assignment is pending.
PENDING = 1;
// Assignment is ready.
ACTIVE = 2;
}
// Output only. Name of the resource. E.g.:
// projects/myproject/locations/US/reservations/team1-prod/assignments/123.
string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
// The resource which will use the reservation. E.g.
// projects/myproject, folders/123, organizations/456.
string assignee = 4;
// Which type of jobs will use the reservation.
JobType job_type = 3;
// Output only. State of the assignment.
State state = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
}
// The request for [ReservationService.CreateAssignment][google.cloud.bigquery.reservation.v1.ReservationService.CreateAssignment].
// Note: "bigquery.reservationAssignments.create" permission is required on the
// related assignee.
message CreateAssignmentRequest {
// Required. The parent resource name of the assignment
// E.g.: projects/myproject/locations/US/reservations/team1-prod
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
child_type: "bigqueryreservation.googleapis.com/Assignment"
}
];
// Assignment resource to create.
Assignment assignment = 2;
}
// The request for [ReservationService.ListAssignments][google.cloud.bigquery.reservation.v1.ReservationService.ListAssignments].
message ListAssignmentsRequest {
// Required. The parent resource name e.g.:
// projects/myproject/locations/US/reservations/team1-prod
// Or:
// projects/myproject/locations/US/reservations/-
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "bigqueryreservation.googleapis.com/Reservation"
}
];
// The maximum number of items to return.
int32 page_size = 2;
// The next_page_token value returned from a previous List request, if any.
string page_token = 3;
}
// The response for [ReservationService.ListAssignments][google.cloud.bigquery.reservation.v1.ReservationService.ListAssignments].
message ListAssignmentsResponse {
// List of assignments visible to the user.
repeated Assignment assignments = 1;
// Token to retrieve the next page of results, or empty if there are no
// more results in the list.
string next_page_token = 2;
}
// The request for [ReservationService.DeleteAssignment][google.cloud.bigquery.reservation.v1.ReservationService.DeleteAssignment].
// Note: "bigquery.reservationAssignments.delete" permission is required on the
// related assignee.
message DeleteAssignmentRequest {
// Required. Name of the resource, e.g.:
// projects/myproject/locations/US/reservations/team1-prod/assignments/123
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "bigqueryreservation.googleapis.com/Assignment"
}
];
}
// The request for
// [ReservationService.SearchAssignments][google.cloud.bigquery.reservation.v1.ReservationService.SearchAssignments].
// Note: "bigquery.reservationAssignments.search" permission is required on the
// related assignee.
message SearchAssignmentsRequest {
// Required. The resource name of the admin project(containing project and location),
// e.g.:
// "projects/myproject/locations/US".
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
child_type: "bigqueryreservation.googleapis.com/Assignment"
}
];
// Please specify resource name as assignee in the query.
// e.g., "assignee=projects/myproject"
// "assignee=folders/123"
// "assignee=organizations/456"
string query = 2;
// The maximum number of items to return.
int32 page_size = 3;
// The next_page_token value returned from a previous List request, if any.
string page_token = 4;
}
// The response for [ReservationService.SearchAssignments][google.cloud.bigquery.reservation.v1.ReservationService.SearchAssignments].
message SearchAssignmentsResponse {
// List of assignments visible to the user.
repeated Assignment assignments = 1;
// Token to retrieve the next page of results, or empty if there are no
// more results in the list.
string next_page_token = 2;
}
// The request for
// [ReservationService.MoveAssignment][google.cloud.bigquery.reservation.v1.ReservationService.MoveAssignment].
// Note: "bigquery.reservationAssignments.create" permission is required on the
// destination_id. Note: "bigquery.reservationAssignments.create" and
// "bigquery.reservationAssignments.delete" permission is required on the
// related assignee.
message MoveAssignmentRequest {
// Required. The resource name of the assignment,
// e.g.:
// projects/myproject/locations/US/reservations/team1-prod/assignments/123
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "bigqueryreservation.googleapis.com/Assignment"
}
];
// The new reservation ID, e.g.:
// projects/myotherproject/locations/US/reservations/team2-prod
string destination_id = 3;
}
// Represents a BI Reservation.
message BiReservation {
option (google.api.resource) = {
type: "bigqueryreservation.googleapis.com/BiReservation"
pattern: "projects/{project}/locations/{location}/bireservation"
};
// The resource name of the singleton BI reservation.
// Reservation names have the form
// `projects/{project_id}/locations/{location_id}/bireservation`.
string name = 1;
// Output only. The last update timestamp of a reservation.
google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
// Size of a reservation, in bytes.
int64 size = 4;
}
// A request to get a singleton BI reservation.
message GetBiReservationRequest {
// Required. Name of the requested reservation, for example:
// `projects/{project_id}/locations/{location_id}/bireservation`
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "bigqueryreservation.googleapis.com/BiReservation"
}
];
}
// A request to update a BI reservation.
message UpdateBiReservationRequest {
// A reservation to update.
BiReservation bi_reservation = 1;
// A list of fields to be updated in this request.
google.protobuf.FieldMask update_mask = 2;
}