@google-cloud/pubsub-api 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,409 @@
1
+ // Copyright 2026 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
+
15
+ syntax = "proto3";
16
+
17
+ package google.pubsub.v1;
18
+
19
+ import "google/api/annotations.proto";
20
+ import "google/api/client.proto";
21
+ import "google/api/field_behavior.proto";
22
+ import "google/api/resource.proto";
23
+ import "google/protobuf/empty.proto";
24
+ import "google/protobuf/timestamp.proto";
25
+
26
+ option csharp_namespace = "Google.Cloud.PubSub.V1";
27
+ option go_package = "cloud.google.com/go/pubsub/v2/apiv1/pubsubpb;pubsubpb";
28
+ option java_multiple_files = true;
29
+ option java_outer_classname = "SchemaProto";
30
+ option java_package = "com.google.pubsub.v1";
31
+ option php_namespace = "Google\\Cloud\\PubSub\\V1";
32
+ option ruby_package = "Google::Cloud::PubSub::V1";
33
+
34
+ // Service for doing schema-related operations.
35
+ service SchemaService {
36
+ option (google.api.default_host) = "pubsub.googleapis.com";
37
+ option (google.api.oauth_scopes) =
38
+ "https://www.googleapis.com/auth/cloud-platform,"
39
+ "https://www.googleapis.com/auth/pubsub";
40
+
41
+ // Creates a schema.
42
+ rpc CreateSchema(CreateSchemaRequest) returns (Schema) {
43
+ option (google.api.http) = {
44
+ post: "/v1/{parent=projects/*}/schemas"
45
+ body: "schema"
46
+ };
47
+ option (google.api.method_signature) = "parent,schema,schema_id";
48
+ }
49
+
50
+ // Gets a schema.
51
+ rpc GetSchema(GetSchemaRequest) returns (Schema) {
52
+ option (google.api.http) = {
53
+ get: "/v1/{name=projects/*/schemas/*}"
54
+ };
55
+ option (google.api.method_signature) = "name";
56
+ }
57
+
58
+ // Lists schemas in a project.
59
+ rpc ListSchemas(ListSchemasRequest) returns (ListSchemasResponse) {
60
+ option (google.api.http) = {
61
+ get: "/v1/{parent=projects/*}/schemas"
62
+ };
63
+ option (google.api.method_signature) = "parent";
64
+ }
65
+
66
+ // Lists all schema revisions for the named schema.
67
+ rpc ListSchemaRevisions(ListSchemaRevisionsRequest)
68
+ returns (ListSchemaRevisionsResponse) {
69
+ option (google.api.http) = {
70
+ get: "/v1/{name=projects/*/schemas/*}:listRevisions"
71
+ };
72
+ option (google.api.method_signature) = "name";
73
+ }
74
+
75
+ // Commits a new schema revision to an existing schema.
76
+ rpc CommitSchema(CommitSchemaRequest) returns (Schema) {
77
+ option (google.api.http) = {
78
+ post: "/v1/{name=projects/*/schemas/*}:commit"
79
+ body: "*"
80
+ };
81
+ option (google.api.method_signature) = "name,schema";
82
+ }
83
+
84
+ // Creates a new schema revision that is a copy of the provided revision_id.
85
+ rpc RollbackSchema(RollbackSchemaRequest) returns (Schema) {
86
+ option (google.api.http) = {
87
+ post: "/v1/{name=projects/*/schemas/*}:rollback"
88
+ body: "*"
89
+ };
90
+ option (google.api.method_signature) = "name,revision_id";
91
+ }
92
+
93
+ // Deletes a specific schema revision.
94
+ rpc DeleteSchemaRevision(DeleteSchemaRevisionRequest) returns (Schema) {
95
+ option (google.api.http) = {
96
+ delete: "/v1/{name=projects/*/schemas/*}:deleteRevision"
97
+ };
98
+ option (google.api.method_signature) = "name,revision_id";
99
+ }
100
+
101
+ // Deletes a schema.
102
+ rpc DeleteSchema(DeleteSchemaRequest) returns (google.protobuf.Empty) {
103
+ option (google.api.http) = {
104
+ delete: "/v1/{name=projects/*/schemas/*}"
105
+ };
106
+ option (google.api.method_signature) = "name";
107
+ }
108
+
109
+ // Validates a schema.
110
+ rpc ValidateSchema(ValidateSchemaRequest) returns (ValidateSchemaResponse) {
111
+ option (google.api.http) = {
112
+ post: "/v1/{parent=projects/*}/schemas:validate"
113
+ body: "*"
114
+ };
115
+ option (google.api.method_signature) = "parent,schema";
116
+ }
117
+
118
+ // Validates a message against a schema.
119
+ rpc ValidateMessage(ValidateMessageRequest)
120
+ returns (ValidateMessageResponse) {
121
+ option (google.api.http) = {
122
+ post: "/v1/{parent=projects/*}/schemas:validateMessage"
123
+ body: "*"
124
+ };
125
+ }
126
+ }
127
+
128
+ // A schema resource.
129
+ message Schema {
130
+ option (google.api.resource) = {
131
+ type: "pubsub.googleapis.com/Schema"
132
+ pattern: "projects/{project}/schemas/{schema}"
133
+ };
134
+
135
+ // Possible schema definition types.
136
+ enum Type {
137
+ // Default value. This value is unused.
138
+ TYPE_UNSPECIFIED = 0;
139
+
140
+ // A Protocol Buffer schema definition.
141
+ PROTOCOL_BUFFER = 1;
142
+
143
+ // An Avro schema definition.
144
+ AVRO = 2;
145
+ }
146
+
147
+ // Required. Name of the schema.
148
+ // Format is `projects/{project}/schemas/{schema}`.
149
+ string name = 1 [(google.api.field_behavior) = REQUIRED];
150
+
151
+ // The type of the schema definition.
152
+ Type type = 2;
153
+
154
+ // The definition of the schema. This should contain a string representing
155
+ // the full definition of the schema that is a valid schema definition of
156
+ // the type specified in `type`.
157
+ string definition = 3;
158
+
159
+ // Output only. Immutable. The revision ID of the schema.
160
+ string revision_id = 4 [
161
+ (google.api.field_behavior) = IMMUTABLE,
162
+ (google.api.field_behavior) = OUTPUT_ONLY
163
+ ];
164
+
165
+ // Output only. The timestamp that the revision was created.
166
+ google.protobuf.Timestamp revision_create_time = 6
167
+ [(google.api.field_behavior) = OUTPUT_ONLY];
168
+ }
169
+
170
+ // View of Schema object fields to be returned by GetSchema and ListSchemas.
171
+ enum SchemaView {
172
+ // The default / unset value.
173
+ // The API will default to the BASIC view.
174
+ SCHEMA_VIEW_UNSPECIFIED = 0;
175
+
176
+ // Include the name and type of the schema, but not the definition.
177
+ BASIC = 1;
178
+
179
+ // Include all Schema object fields.
180
+ FULL = 2;
181
+ }
182
+
183
+ // Request for the CreateSchema method.
184
+ message CreateSchemaRequest {
185
+ // Required. The name of the project in which to create the schema.
186
+ // Format is `projects/{project-id}`.
187
+ string parent = 1 [
188
+ (google.api.field_behavior) = REQUIRED,
189
+ (google.api.resource_reference) = {
190
+ child_type: "pubsub.googleapis.com/Schema"
191
+ }
192
+ ];
193
+
194
+ // Required. The schema object to create.
195
+ //
196
+ // This schema's `name` parameter is ignored. The schema object returned
197
+ // by CreateSchema will have a `name` made using the given `parent` and
198
+ // `schema_id`.
199
+ Schema schema = 2 [(google.api.field_behavior) = REQUIRED];
200
+
201
+ // The ID to use for the schema, which will become the final component of
202
+ // the schema's resource name.
203
+ //
204
+ // See https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names for
205
+ // resource name constraints.
206
+ string schema_id = 3;
207
+ }
208
+
209
+ // Request for the GetSchema method.
210
+ message GetSchemaRequest {
211
+ // Required. The name of the schema to get.
212
+ // Format is `projects/{project}/schemas/{schema}`.
213
+ string name = 1 [
214
+ (google.api.field_behavior) = REQUIRED,
215
+ (google.api.resource_reference) = { type: "pubsub.googleapis.com/Schema" }
216
+ ];
217
+
218
+ // The set of fields to return in the response. If not set, returns a Schema
219
+ // with all fields filled out. Set to `BASIC` to omit the `definition`.
220
+ SchemaView view = 2;
221
+ }
222
+
223
+ // Request for the `ListSchemas` method.
224
+ message ListSchemasRequest {
225
+ // Required. The name of the project in which to list schemas.
226
+ // Format is `projects/{project-id}`.
227
+ string parent = 1 [
228
+ (google.api.field_behavior) = REQUIRED,
229
+ (google.api.resource_reference) = {
230
+ type: "cloudresourcemanager.googleapis.com/Project"
231
+ }
232
+ ];
233
+
234
+ // The set of Schema fields to return in the response. If not set, returns
235
+ // Schemas with `name` and `type`, but not `definition`. Set to `FULL` to
236
+ // retrieve all fields.
237
+ SchemaView view = 2;
238
+
239
+ // Maximum number of schemas to return.
240
+ int32 page_size = 3;
241
+
242
+ // The value returned by the last `ListSchemasResponse`; indicates that
243
+ // this is a continuation of a prior `ListSchemas` call, and that the
244
+ // system should return the next page of data.
245
+ string page_token = 4;
246
+ }
247
+
248
+ // Response for the `ListSchemas` method.
249
+ message ListSchemasResponse {
250
+ // The resulting schemas.
251
+ repeated Schema schemas = 1;
252
+
253
+ // If not empty, indicates that there may be more schemas that match the
254
+ // request; this value should be passed in a new `ListSchemasRequest`.
255
+ string next_page_token = 2;
256
+ }
257
+
258
+ // Request for the `ListSchemaRevisions` method.
259
+ message ListSchemaRevisionsRequest {
260
+ // Required. The name of the schema to list revisions for.
261
+ string name = 1 [
262
+ (google.api.field_behavior) = REQUIRED,
263
+ (google.api.resource_reference) = { type: "pubsub.googleapis.com/Schema" }
264
+ ];
265
+
266
+ // The set of Schema fields to return in the response. If not set, returns
267
+ // Schemas with `name` and `type`, but not `definition`. Set to `FULL` to
268
+ // retrieve all fields.
269
+ SchemaView view = 2;
270
+
271
+ // The maximum number of revisions to return per page.
272
+ int32 page_size = 3;
273
+
274
+ // The page token, received from a previous ListSchemaRevisions call.
275
+ // Provide this to retrieve the subsequent page.
276
+ string page_token = 4;
277
+ }
278
+
279
+ // Response for the `ListSchemaRevisions` method.
280
+ message ListSchemaRevisionsResponse {
281
+ // The revisions of the schema.
282
+ repeated Schema schemas = 1;
283
+
284
+ // A token that can be sent as `page_token` to retrieve the next page.
285
+ // If this field is empty, there are no subsequent pages.
286
+ string next_page_token = 2;
287
+ }
288
+
289
+ // Request for CommitSchema method.
290
+ message CommitSchemaRequest {
291
+ // Required. The name of the schema we are revising.
292
+ // Format is `projects/{project}/schemas/{schema}`.
293
+ string name = 1 [
294
+ (google.api.field_behavior) = REQUIRED,
295
+ (google.api.resource_reference) = { type: "pubsub.googleapis.com/Schema" }
296
+ ];
297
+
298
+ // Required. The schema revision to commit.
299
+ Schema schema = 2 [(google.api.field_behavior) = REQUIRED];
300
+ }
301
+
302
+ // Request for the `RollbackSchema` method.
303
+ message RollbackSchemaRequest {
304
+ // Required. The schema being rolled back with revision id.
305
+ string name = 1 [
306
+ (google.api.field_behavior) = REQUIRED,
307
+ (google.api.resource_reference) = { type: "pubsub.googleapis.com/Schema" }
308
+ ];
309
+
310
+ // Required. The revision ID to roll back to.
311
+ // It must be a revision of the same schema.
312
+ //
313
+ // Example: c7cfa2a8
314
+ string revision_id = 2 [(google.api.field_behavior) = REQUIRED];
315
+ }
316
+
317
+ // Request for the `DeleteSchemaRevision` method.
318
+ message DeleteSchemaRevisionRequest {
319
+ // Required. The name of the schema revision to be deleted, with a revision ID
320
+ // explicitly included.
321
+ //
322
+ // Example: `projects/123/schemas/my-schema@c7cfa2a8`
323
+ string name = 1 [
324
+ (google.api.field_behavior) = REQUIRED,
325
+ (google.api.resource_reference) = { type: "pubsub.googleapis.com/Schema" }
326
+ ];
327
+
328
+ // Optional. This field is deprecated and should not be used for specifying
329
+ // the revision ID. The revision ID should be specified via the `name`
330
+ // parameter.
331
+ string revision_id = 2
332
+ [deprecated = true, (google.api.field_behavior) = OPTIONAL];
333
+ }
334
+
335
+ // Request for the `DeleteSchema` method.
336
+ message DeleteSchemaRequest {
337
+ // Required. Name of the schema to delete.
338
+ // Format is `projects/{project}/schemas/{schema}`.
339
+ string name = 1 [
340
+ (google.api.field_behavior) = REQUIRED,
341
+ (google.api.resource_reference) = { type: "pubsub.googleapis.com/Schema" }
342
+ ];
343
+ }
344
+
345
+ // Request for the `ValidateSchema` method.
346
+ message ValidateSchemaRequest {
347
+ // Required. The name of the project in which to validate schemas.
348
+ // Format is `projects/{project-id}`.
349
+ string parent = 1 [
350
+ (google.api.field_behavior) = REQUIRED,
351
+ (google.api.resource_reference) = {
352
+ type: "cloudresourcemanager.googleapis.com/Project"
353
+ }
354
+ ];
355
+
356
+ // Required. The schema object to validate.
357
+ Schema schema = 2 [(google.api.field_behavior) = REQUIRED];
358
+ }
359
+
360
+ // Response for the `ValidateSchema` method.
361
+ // Empty for now.
362
+ message ValidateSchemaResponse {}
363
+
364
+ // Request for the `ValidateMessage` method.
365
+ message ValidateMessageRequest {
366
+ // Required. The name of the project in which to validate schemas.
367
+ // Format is `projects/{project-id}`.
368
+ string parent = 1 [
369
+ (google.api.field_behavior) = REQUIRED,
370
+ (google.api.resource_reference) = {
371
+ type: "cloudresourcemanager.googleapis.com/Project"
372
+ }
373
+ ];
374
+
375
+ oneof schema_spec {
376
+ // Name of the schema against which to validate.
377
+ //
378
+ // Format is `projects/{project}/schemas/{schema}`.
379
+ string name = 2 [
380
+ (google.api.resource_reference) = { type: "pubsub.googleapis.com/Schema" }
381
+ ];
382
+
383
+ // Ad-hoc schema against which to validate
384
+ Schema schema = 3;
385
+ }
386
+
387
+ // Message to validate against the provided `schema_spec`.
388
+ bytes message = 4;
389
+
390
+ // The encoding expected for messages
391
+ Encoding encoding = 5;
392
+ }
393
+
394
+ // Response for the `ValidateMessage` method.
395
+ // Empty for now.
396
+ message ValidateMessageResponse {}
397
+
398
+ // Possible encoding types for messages.
399
+ enum Encoding {
400
+ // Unspecified
401
+ ENCODING_UNSPECIFIED = 0;
402
+
403
+ // JSON encoding
404
+ JSON = 1;
405
+
406
+ // Binary encoding, as defined by the schema type. For some schema types,
407
+ // binary encoding may not be available.
408
+ BINARY = 2;
409
+ }