Skip to content
This repository was archived by the owner on Nov 12, 2025. It is now read-only.

Commit ee330bb

Browse files
yoshi-automationtswast
authored andcommitted
Add annotations to protocol buffers indicating request parameters (via synth). (#7550)
[Internal] This commit should not have any effect on the public interface, or even the behavior of the client. It picks up some additional metadata to indicate resources used in request parameters for the purpose of adding helpers in the generated clients for statically-typed languages.
1 parent d11047f commit ee330bb

8 files changed

Lines changed: 171 additions & 103 deletions

File tree

google/cloud/bigquery_storage_v1beta1/proto/avro.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ option go_package = "google.golang.org/genproto/googleapis/cloud/bigquery/storag
2121
option java_outer_classname = "AvroProto";
2222
option java_package = "com.google.cloud.bigquery.storage.v1beta1";
2323

24+
2425
// Avro schema.
2526
message AvroSchema {
2627
// Json serialized schema, as described at

google/cloud/bigquery_storage_v1beta1/proto/read_options.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ package google.cloud.bigquery.storage.v1beta1;
2020
option go_package = "google.golang.org/genproto/googleapis/cloud/bigquery/storage/v1beta1;storage";
2121
option java_package = "com.google.cloud.bigquery.storage.v1beta1";
2222

23+
2324
// Options dictating how we read a table.
2425
message TableReadOptions {
2526
// Optional. Names of the fields in the table that should be read. If empty,

google/cloud/bigquery_storage_v1beta1/proto/storage.proto

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ syntax = "proto3";
1717

1818
package google.cloud.bigquery.storage.v1beta1;
1919

20+
import "google/api/annotations.proto";
21+
import "google/api/resource.proto";
2022
import "google/cloud/bigquery/storage/v1beta1/avro.proto";
2123
import "google/cloud/bigquery/storage/v1beta1/read_options.proto";
2224
import "google/cloud/bigquery/storage/v1beta1/table_reference.proto";
@@ -26,6 +28,7 @@ import "google/protobuf/timestamp.proto";
2628
option go_package = "google.golang.org/genproto/googleapis/cloud/bigquery/storage/v1beta1;storage";
2729
option java_package = "com.google.cloud.bigquery.storage.v1beta1";
2830

31+
2932
// BigQuery storage API.
3033
//
3134
// The BigQuery storage API can be used to read data stored in BigQuery.
@@ -42,7 +45,16 @@ service BigQueryStorage {
4245
//
4346
// Read sessions automatically expire 24 hours after they are created and do
4447
// not require manual clean-up by the caller.
45-
rpc CreateReadSession(CreateReadSessionRequest) returns (ReadSession) {}
48+
rpc CreateReadSession(CreateReadSessionRequest) returns (ReadSession) {
49+
option (google.api.http) = {
50+
post: "/v1beta1/{table_reference.project_id=projects/*}"
51+
body: "*"
52+
additional_bindings {
53+
post: "/v1beta1/{table_reference.dataset_id=projects/*/datasets/*}"
54+
body: "*"
55+
}
56+
};
57+
}
4658

4759
// Reads rows from the table in the format prescribed by the read session.
4860
// Each response contains one or more table rows, up to a maximum of 10 MiB
@@ -53,13 +65,21 @@ service BigQueryStorage {
5365
// estimated total number of rows in the read stream. This number is computed
5466
// based on the total table size and the number of active streams in the read
5567
// session, and may change as other streams continue to read data.
56-
rpc ReadRows(ReadRowsRequest) returns (stream ReadRowsResponse) {}
68+
rpc ReadRows(ReadRowsRequest) returns (stream ReadRowsResponse) {
69+
option (google.api.http) = {
70+
get: "/v1beta1/{read_position.stream.name=projects/*/streams/*}"
71+
};
72+
}
5773

5874
// Creates additional streams for a ReadSession. This API can be used to
5975
// dynamically adjust the parallelism of a batch processing task upwards by
6076
// adding additional workers.
61-
rpc BatchCreateReadSessionStreams(BatchCreateReadSessionStreamsRequest)
62-
returns (BatchCreateReadSessionStreamsResponse) {}
77+
rpc BatchCreateReadSessionStreams(BatchCreateReadSessionStreamsRequest) returns (BatchCreateReadSessionStreamsResponse) {
78+
option (google.api.http) = {
79+
post: "/v1beta1/{session.name=projects/*/sessions/*}"
80+
body: "*"
81+
};
82+
}
6383

6484
// Triggers the graceful termination of a single stream in a ReadSession. This
6585
// API can be used to dynamically adjust the parallelism of a batch processing
@@ -75,7 +95,12 @@ service BigQueryStorage {
7595
// This method will return an error if there are no other live streams
7696
// in the Session, or if SplitReadStream() has been called on the given
7797
// Stream.
78-
rpc FinalizeStream(FinalizeStreamRequest) returns (google.protobuf.Empty) {}
98+
rpc FinalizeStream(FinalizeStreamRequest) returns (google.protobuf.Empty) {
99+
option (google.api.http) = {
100+
post: "/v1beta1/{stream.name=projects/*/streams/*}"
101+
body: "*"
102+
};
103+
}
79104

80105
// Splits a given read stream into two Streams. These streams are referred to
81106
// as the primary and the residual of the split. The original stream can still
@@ -90,8 +115,11 @@ service BigQueryStorage {
90115
// completion.
91116
//
92117
// This method is guaranteed to be idempotent.
93-
rpc SplitReadStream(SplitReadStreamRequest)
94-
returns (SplitReadStreamResponse) {}
118+
rpc SplitReadStream(SplitReadStreamRequest) returns (SplitReadStreamResponse) {
119+
option (google.api.http) = {
120+
get: "/v1beta1/{original_stream.name=projects/*/streams/*}"
121+
};
122+
}
95123
}
96124

97125
// Information about a single data stream within a read session.

google/cloud/bigquery_storage_v1beta1/proto/storage_pb2.py

Lines changed: 48 additions & 36 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

google/cloud/bigquery_storage_v1beta1/proto/table_reference.proto

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@ syntax = "proto3";
1717

1818
package google.cloud.bigquery.storage.v1beta1;
1919

20+
import "google/api/resource.proto";
2021
import "google/protobuf/timestamp.proto";
2122

2223
option go_package = "google.golang.org/genproto/googleapis/cloud/bigquery/storage/v1beta1;storage";
2324
option java_outer_classname = "TableReferenceProto";
2425
option java_package = "com.google.cloud.bigquery.storage.v1beta1";
2526

27+
2628
// Table reference that includes just the 3 strings needed to identify a table.
2729
message TableReference {
2830
// The assigned project ID of the project.

0 commit comments

Comments
 (0)