@google-cloud/pubsub 3.2.1 → 3.4.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.
Files changed (40) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +3 -2
  3. package/build/protos/google/pubsub/v1/pubsub.proto +65 -43
  4. package/build/protos/google/pubsub/v1/schema.proto +138 -16
  5. package/build/protos/protos.d.ts +2513 -373
  6. package/build/protos/protos.js +6492 -1101
  7. package/build/protos/protos.json +522 -36
  8. package/build/src/ack-metadata.d.ts +1 -1
  9. package/build/src/iam.d.ts +7 -7
  10. package/build/src/iam.js.map +1 -1
  11. package/build/src/message-queues.d.ts +1 -1
  12. package/build/src/publisher/index.d.ts +1 -1
  13. package/build/src/publisher/index.js +2 -2
  14. package/build/src/publisher/index.js.map +1 -1
  15. package/build/src/publisher/message-queues.d.ts +29 -1
  16. package/build/src/publisher/message-queues.js +32 -2
  17. package/build/src/publisher/message-queues.js.map +1 -1
  18. package/build/src/publisher/pubsub-message.d.ts +1 -1
  19. package/build/src/pubsub.d.ts +19 -19
  20. package/build/src/schema.d.ts +6 -6
  21. package/build/src/snapshot.d.ts +4 -4
  22. package/build/src/subscriber.d.ts +4 -4
  23. package/build/src/subscriber.js +1 -3
  24. package/build/src/subscriber.js.map +1 -1
  25. package/build/src/subscription.d.ts +21 -21
  26. package/build/src/temporal.d.ts +1 -1
  27. package/build/src/topic.d.ts +17 -17
  28. package/build/src/v1/index.js +1 -1
  29. package/build/src/v1/publisher_client.d.ts +20 -20
  30. package/build/src/v1/publisher_client.js +15 -13
  31. package/build/src/v1/publisher_client.js.map +1 -1
  32. package/build/src/v1/schema_service_client.d.ts +193 -20
  33. package/build/src/v1/schema_service_client.js +189 -13
  34. package/build/src/v1/schema_service_client.js.map +1 -1
  35. package/build/src/v1/schema_service_client_config.json +16 -0
  36. package/build/src/v1/subscriber_client.d.ts +54 -60
  37. package/build/src/v1/subscriber_client.js +19 -17
  38. package/build/src/v1/subscriber_client.js.map +1 -1
  39. package/build/src/v1/subscriber_client_config.json +7 -1
  40. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -4,6 +4,32 @@
4
4
 
5
5
  [1]: https://www.npmjs.com/package/@google-cloud/pubsub?activeTab=versions
6
6
 
7
+ ## [3.4.0](https://github.com/googleapis/nodejs-pubsub/compare/v3.3.0...v3.4.0) (2023-03-06)
8
+
9
+
10
+ ### Features
11
+
12
+ * Add google.api.method.signature to update methods ([1e28405](https://github.com/googleapis/nodejs-pubsub/commit/1e2840529a8451c94d5d845062da84729b7843db))
13
+ * Add temporary_failed_ack_ids to ModifyAckDeadlineConfirmation ([1e28405](https://github.com/googleapis/nodejs-pubsub/commit/1e2840529a8451c94d5d845062da84729b7843db))
14
+ * Make INTERNAL a retryable error for Pull ([#1681](https://github.com/googleapis/nodejs-pubsub/issues/1681)) ([1e28405](https://github.com/googleapis/nodejs-pubsub/commit/1e2840529a8451c94d5d845062da84729b7843db))
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * Don't do multiple drains per publish() in message queues unless requested ([#1691](https://github.com/googleapis/nodejs-pubsub/issues/1691)) ([d9b3a63](https://github.com/googleapis/nodejs-pubsub/commit/d9b3a63ddbfec0581a0e05fdbfcf9e9326b3dcf9))
20
+
21
+ ## [3.3.0](https://github.com/googleapis/nodejs-pubsub/compare/v3.2.1...v3.3.0) (2023-01-23)
22
+
23
+
24
+ ### Features
25
+
26
+ * Add schema evolution methods and fields ([#1672](https://github.com/googleapis/nodejs-pubsub/issues/1672)) ([7a5bc29](https://github.com/googleapis/nodejs-pubsub/commit/7a5bc29e8a39e5c1991a5eae4200a5045f21997d))
27
+
28
+
29
+ ### Bug Fixes
30
+
31
+ * Remove redundant .then() ([#1671](https://github.com/googleapis/nodejs-pubsub/issues/1671)) ([108edc3](https://github.com/googleapis/nodejs-pubsub/commit/108edc3cd2d3d512e2a9777a68541dae1f6aba23))
32
+
7
33
  ## [3.2.1](https://github.com/googleapis/nodejs-pubsub/compare/v3.2.0...v3.2.1) (2022-11-04)
8
34
 
9
35
 
package/README.md CHANGED
@@ -13,7 +13,7 @@
13
13
  [Cloud Pub/Sub](https://cloud.google.com/pubsub/docs) is a fully-managed real-time messaging service that allows
14
14
  you to send and receive messages between independent applications.
15
15
 
16
- This document contains links to an [API reference](https://googleapis.dev/nodejs/pubsub/latest/index.html#reference), samples,
16
+ This document contains links to an [API reference](https://cloud.google.com/nodejs/docs/reference/pubsub/latest/overview), samples,
17
17
  and other resources useful to developing Node.js applications.
18
18
  For additional help developing Pub/Sub applications, in Node.js and other languages, see our
19
19
  [Pub/Sub quickstart](https://cloud.google.com/pubsub/docs/quickstart-client-libraries),
@@ -96,7 +96,7 @@ async function quickstart(
96
96
  });
97
97
 
98
98
  // Send a message to the topic
99
- topic.publish(Buffer.from('Test message!'));
99
+ topic.publishMessage({data: Buffer.from('Test message!')});
100
100
  }
101
101
 
102
102
  ```
@@ -174,6 +174,7 @@ Samples are in the [`samples/`](https://github.com/googleapis/nodejs-pubsub/tree
174
174
  | Test Subscription Permissions | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/testSubscriptionPermissions.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/testSubscriptionPermissions.js,samples/README.md) |
175
175
  | Test Topic Permissions | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/testTopicPermissions.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/testTopicPermissions.js,samples/README.md) |
176
176
  | Update Dead Letter Policy | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/updateDeadLetterPolicy.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/updateDeadLetterPolicy.js,samples/README.md) |
177
+ | Validate a schema definition | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/validateSchema.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/validateSchema.js,samples/README.md) |
177
178
 
178
179
 
179
180
 
@@ -60,6 +60,7 @@ service Publisher {
60
60
  patch: "/v1/{topic.name=projects/*/topics/*}"
61
61
  body: "*"
62
62
  };
63
+ option (google.api.method_signature) = "topic,update_mask";
63
64
  }
64
65
 
65
66
  // Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic
@@ -157,6 +158,16 @@ message SchemaSettings {
157
158
 
158
159
  // The encoding of messages validated against `schema`.
159
160
  Encoding encoding = 2;
161
+
162
+ // The minimum (inclusive) revision allowed for validating messages. If empty
163
+ // or not present, allow any revision to be validated against last_revision or
164
+ // any revision created before.
165
+ string first_revision_id = 3;
166
+
167
+ // The maximum (inclusive) revision allowed for validating messages. If empty
168
+ // or not present, allow any revision to be validated against first_revision
169
+ // or any revision created after.
170
+ string last_revision_id = 4;
160
171
  }
161
172
 
162
173
  // A topic resource.
@@ -204,7 +215,7 @@ message Topic {
204
215
  // timestamp](https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time)
205
216
  // that is up to `message_retention_duration` in the past. If this field is
206
217
  // not set, message retention is controlled by settings on individual
207
- // subscriptions. Cannot be more than 7 days or less than 10 minutes.
218
+ // subscriptions. Cannot be more than 31 days or less than 10 minutes.
208
219
  google.protobuf.Duration message_retention_duration = 8;
209
220
  }
210
221
 
@@ -243,6 +254,8 @@ message PubsubMessage {
243
254
  // delivered to subscribers in the order in which they are received by the
244
255
  // Pub/Sub system. All `PubsubMessage`s published in a given `PublishRequest`
245
256
  // must specify the same `ordering_key` value.
257
+ // For more information, see [ordering
258
+ // messages](https://cloud.google.com/pubsub/docs/ordering).
246
259
  string ordering_key = 5;
247
260
  }
248
261
 
@@ -451,6 +464,7 @@ service Subscriber {
451
464
  patch: "/v1/{subscription.name=projects/*/subscriptions/*}"
452
465
  body: "*"
453
466
  };
467
+ option (google.api.method_signature) = "subscription,update_mask";
454
468
  }
455
469
 
456
470
  // Lists matching subscriptions.
@@ -505,9 +519,7 @@ service Subscriber {
505
519
  option (google.api.method_signature) = "subscription,ack_ids";
506
520
  }
507
521
 
508
- // Pulls messages from the server. The server may return `UNAVAILABLE` if
509
- // there are too many concurrent pull requests pending for the given
510
- // subscription.
522
+ // Pulls messages from the server.
511
523
  rpc Pull(PullRequest) returns (PullResponse) {
512
524
  option (google.api.http) = {
513
525
  post: "/v1/{subscription=projects/*/subscriptions/*}:pull"
@@ -544,10 +556,10 @@ service Subscriber {
544
556
  }
545
557
 
546
558
  // Gets the configuration details of a snapshot. Snapshots are used in
547
- // <a href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a>
548
- // operations, which allow you to manage message acknowledgments in bulk. That
549
- // is, you can set the acknowledgment state of messages in an existing
550
- // subscription to the state captured by a snapshot.
559
+ // [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations,
560
+ // which allow you to manage message acknowledgments in bulk. That is, you can
561
+ // set the acknowledgment state of messages in an existing subscription to the
562
+ // state captured by a snapshot.
551
563
  rpc GetSnapshot(GetSnapshotRequest) returns (Snapshot) {
552
564
  option (google.api.http) = {
553
565
  get: "/v1/{snapshot=projects/*/snapshots/*}"
@@ -592,16 +604,16 @@ service Subscriber {
592
604
  }
593
605
 
594
606
  // Updates an existing snapshot. Snapshots are used in
595
- // <a href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a>
596
- // operations, which allow
597
- // you to manage message acknowledgments in bulk. That is, you can set the
598
- // acknowledgment state of messages in an existing subscription to the state
599
- // captured by a snapshot.
607
+ // [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations,
608
+ // which allow you to manage message acknowledgments in bulk. That is, you can
609
+ // set the acknowledgment state of messages in an existing subscription to the
610
+ // state captured by a snapshot.
600
611
  rpc UpdateSnapshot(UpdateSnapshotRequest) returns (Snapshot) {
601
612
  option (google.api.http) = {
602
613
  patch: "/v1/{snapshot.name=projects/*/snapshots/*}"
603
614
  body: "*"
604
615
  };
616
+ option (google.api.method_signature) = "snapshot,update_mask";
605
617
  }
606
618
 
607
619
  // Removes an existing snapshot. Snapshots are used in [Seek]
@@ -635,7 +647,9 @@ service Subscriber {
635
647
  }
636
648
  }
637
649
 
638
- // A subscription resource.
650
+ // A subscription resource. If none of `push_config` or `bigquery_config` is
651
+ // set, then the subscriber will pull and ack messages using API methods. At
652
+ // most one of these fields may be set.
639
653
  message Subscription {
640
654
  option (google.api.resource) = {
641
655
  type: "pubsub.googleapis.com/Subscription"
@@ -673,21 +687,17 @@ message Subscription {
673
687
  ];
674
688
 
675
689
  // If push delivery is used with this subscription, this field is
676
- // used to configure it. Either `pushConfig` or `bigQueryConfig` can be set,
677
- // but not both. If both are empty, then the subscriber will pull and ack
678
- // messages using API methods.
690
+ // used to configure it.
679
691
  PushConfig push_config = 4;
680
692
 
681
693
  // If delivery to BigQuery is used with this subscription, this field is
682
- // used to configure it. Either `pushConfig` or `bigQueryConfig` can be set,
683
- // but not both. If both are empty, then the subscriber will pull and ack
684
- // messages using API methods.
694
+ // used to configure it.
685
695
  BigQueryConfig bigquery_config = 18;
686
696
 
687
697
  // The approximate amount of time (on a best-effort basis) Pub/Sub waits for
688
698
  // the subscriber to acknowledge receipt before resending the message. In the
689
699
  // interval after the message is delivered and before it is acknowledged, it
690
- // is considered to be <i>outstanding</i>. During that time period, the
700
+ // is considered to be _outstanding_. During that time period, the
691
701
  // message will not be redelivered (on a best-effort basis).
692
702
  //
693
703
  // For pull subscriptions, this value is used as the initial value for the ack
@@ -722,8 +732,8 @@ message Subscription {
722
732
  // minutes.
723
733
  google.protobuf.Duration message_retention_duration = 8;
724
734
 
725
- // See <a href="https://cloud.google.com/pubsub/docs/labels"> Creating and
726
- // managing labels</a>.
735
+ // See [Creating and managing
736
+ // labels](https://cloud.google.com/pubsub/docs/labels).
727
737
  map<string, string> labels = 9;
728
738
 
729
739
  // If true, messages published with the same `ordering_key` in `PubsubMessage`
@@ -737,7 +747,8 @@ message Subscription {
737
747
  // successfully consuming messages from the subscription or is issuing
738
748
  // operations on the subscription. If `expiration_policy` is not set, a
739
749
  // *default policy* with `ttl` of 31 days will be used. The minimum allowed
740
- // value for `expiration_policy.ttl` is 1 day.
750
+ // value for `expiration_policy.ttl` is 1 day. If `expiration_policy` is set,
751
+ // but `expiration_policy.ttl` is not set, the subscription never expires.
741
752
  ExpirationPolicy expiration_policy = 11;
742
753
 
743
754
  // An expression written in the Pub/Sub [filter
@@ -795,8 +806,8 @@ message Subscription {
795
806
  google.protobuf.Duration topic_message_retention_duration = 17
796
807
  [(google.api.field_behavior) = OUTPUT_ONLY];
797
808
 
798
- // Output only. An output-only field indicating whether or not the subscription can receive
799
- // messages.
809
+ // Output only. An output-only field indicating whether or not the
810
+ // subscription can receive messages.
800
811
  State state = 19 [(google.api.field_behavior) = OUTPUT_ONLY];
801
812
  }
802
813
 
@@ -912,7 +923,7 @@ message PushConfig {
912
923
  // * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API.
913
924
  //
914
925
  // For example:
915
- // <pre><code>attributes { "x-goog-version": "v1" } </code></pre>
926
+ // `attributes { "x-goog-version": "v1" }`
916
927
  map<string, string> attributes = 2;
917
928
 
918
929
  // An authentication method used by push endpoints to verify the source of
@@ -938,6 +949,11 @@ message BigQueryConfig {
938
949
  ACTIVE = 1;
939
950
 
940
951
  // Cannot write to the BigQuery table because of permission denied errors.
952
+ // This can happen if
953
+ // - Pub/Sub SA has not been granted the [appropriate BigQuery IAM
954
+ // permissions](https://cloud.google.com/pubsub/docs/create-subscription#assign_bigquery_service_account)
955
+ // - bigquery.googleapis.com API is not enabled for the project
956
+ // ([instructions](https://cloud.google.com/service-usage/docs/enable-disable))
941
957
  PERMISSION_DENIED = 2;
942
958
 
943
959
  // Cannot write to the BigQuery table because it does not exist.
@@ -948,7 +964,7 @@ message BigQueryConfig {
948
964
  }
949
965
 
950
966
  // The name of the table to which to write data, of the form
951
- // {projectId}:{datasetId}.{tableId}
967
+ // {projectId}.{datasetId}.{tableId}
952
968
  string table = 1;
953
969
 
954
970
  // When true, use the topic's schema as the columns to write to in BigQuery,
@@ -969,8 +985,8 @@ message BigQueryConfig {
969
985
  // subscription's backlog.
970
986
  bool drop_unknown_fields = 4;
971
987
 
972
- // Output only. An output-only field that indicates whether or not the subscription can
973
- // receive messages.
988
+ // Output only. An output-only field that indicates whether or not the
989
+ // subscription can receive messages.
974
990
  State state = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
975
991
  }
976
992
 
@@ -1117,7 +1133,8 @@ message PullRequest {
1117
1133
  // Response for the `Pull` method.
1118
1134
  message PullResponse {
1119
1135
  // Received Pub/Sub messages. The list will be empty if there are no more
1120
- // messages available in the backlog. For JSON, the response can be entirely
1136
+ // messages available in the backlog, or if no messages could be returned
1137
+ // before the request timeout. For JSON, the response can be entirely
1121
1138
  // empty. The Pub/Sub system may return fewer than the `maxMessages` requested
1122
1139
  // even if there are more messages available in the backlog.
1123
1140
  repeated ReceivedMessage received_messages = 1;
@@ -1252,31 +1269,38 @@ message StreamingPullResponse {
1252
1269
  // previously received message.
1253
1270
  message AcknowledgeConfirmation {
1254
1271
  // Successfully processed acknowledgement IDs.
1255
- repeated string ack_ids = 1 [ctype = CORD];
1272
+ repeated string ack_ids = 1;
1256
1273
 
1257
1274
  // List of acknowledgement IDs that were malformed or whose acknowledgement
1258
1275
  // deadline has expired.
1259
- repeated string invalid_ack_ids = 2 [ctype = CORD];
1276
+ repeated string invalid_ack_ids = 2;
1260
1277
 
1261
1278
  // List of acknowledgement IDs that were out of order.
1262
- repeated string unordered_ack_ids = 3 [ctype = CORD];
1279
+ repeated string unordered_ack_ids = 3;
1280
+
1281
+ // List of acknowledgement IDs that failed processing with temporary issues.
1282
+ repeated string temporary_failed_ack_ids = 4;
1263
1283
  }
1264
1284
 
1265
1285
  // Acknowledgement IDs sent in one or more previous requests to modify the
1266
1286
  // deadline for a specific message.
1267
1287
  message ModifyAckDeadlineConfirmation {
1268
1288
  // Successfully processed acknowledgement IDs.
1269
- repeated string ack_ids = 1 [ctype = CORD];
1289
+ repeated string ack_ids = 1;
1270
1290
 
1271
1291
  // List of acknowledgement IDs that were malformed or whose acknowledgement
1272
1292
  // deadline has expired.
1273
- repeated string invalid_ack_ids = 2 [ctype = CORD];
1293
+ repeated string invalid_ack_ids = 2;
1294
+
1295
+ // List of acknowledgement IDs that failed processing with temporary issues.
1296
+ repeated string temporary_failed_ack_ids = 3;
1274
1297
  }
1275
1298
 
1276
1299
  // Subscription properties sent as part of the response.
1277
1300
  message SubscriptionProperties {
1278
1301
  // True iff exactly once delivery is enabled for this subscription.
1279
1302
  bool exactly_once_delivery_enabled = 1;
1303
+
1280
1304
  // True iff message ordering is enabled for this subscription.
1281
1305
  bool message_ordering_enabled = 2;
1282
1306
  }
@@ -1284,8 +1308,6 @@ message StreamingPullResponse {
1284
1308
  // Received Pub/Sub messages. This will not be empty.
1285
1309
  repeated ReceivedMessage received_messages = 1;
1286
1310
 
1287
- reserved 2;
1288
-
1289
1311
  // This field will only be set if `enable_exactly_once_delivery` is set to
1290
1312
  // `true`.
1291
1313
  AcknowledgeConfirmation acknowledge_confirmation = 5;
@@ -1303,9 +1325,9 @@ message CreateSnapshotRequest {
1303
1325
  // Required. User-provided name for this snapshot. If the name is not provided
1304
1326
  // in the request, the server will assign a random name for this snapshot on
1305
1327
  // the same project as the subscription. Note that for REST API requests, you
1306
- // must specify a name. See the <a
1307
- // href="https://cloud.google.com/pubsub/docs/admin#resource_names"> resource
1308
- // name rules</a>. Format is `projects/{project}/snapshots/{snap}`.
1328
+ // must specify a name. See the [resource name
1329
+ // rules](https://cloud.google.com/pubsub/docs/admin#resource_names). Format
1330
+ // is `projects/{project}/snapshots/{snap}`.
1309
1331
  string name = 1 [
1310
1332
  (google.api.field_behavior) = REQUIRED,
1311
1333
  (google.api.resource_reference) = { type: "pubsub.googleapis.com/Snapshot" }
@@ -1327,8 +1349,8 @@ message CreateSnapshotRequest {
1327
1349
  }
1328
1350
  ];
1329
1351
 
1330
- // See <a href="https://cloud.google.com/pubsub/docs/labels"> Creating and
1331
- // managing labels</a>.
1352
+ // See [Creating and managing
1353
+ // labels](https://cloud.google.com/pubsub/docs/labels).
1332
1354
  map<string, string> labels = 3;
1333
1355
  }
1334
1356
 
@@ -1,4 +1,4 @@
1
- // Copyright 2021 Google LLC
1
+ // Copyright 2022 Google LLC
2
2
  //
3
3
  // Licensed under the Apache License, Version 2.0 (the "License");
4
4
  // you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@ import "google/api/client.proto";
21
21
  import "google/api/field_behavior.proto";
22
22
  import "google/api/resource.proto";
23
23
  import "google/protobuf/empty.proto";
24
+ import "google/protobuf/timestamp.proto";
24
25
 
25
26
  option cc_enable_arenas = true;
26
27
  option csharp_namespace = "Google.Cloud.PubSub.V1";
@@ -63,6 +64,41 @@ service SchemaService {
63
64
  option (google.api.method_signature) = "parent";
64
65
  }
65
66
 
67
+ // Lists all schema revisions for the named schema.
68
+ rpc ListSchemaRevisions(ListSchemaRevisionsRequest)
69
+ returns (ListSchemaRevisionsResponse) {
70
+ option (google.api.http) = {
71
+ get: "/v1/{name=projects/*/schemas/*}:listRevisions"
72
+ };
73
+ option (google.api.method_signature) = "name";
74
+ }
75
+
76
+ // Commits a new schema revision to an existing schema.
77
+ rpc CommitSchema(CommitSchemaRequest) returns (Schema) {
78
+ option (google.api.http) = {
79
+ post: "/v1/{name=projects/*/schemas/*}:commit"
80
+ body: "*"
81
+ };
82
+ option (google.api.method_signature) = "name,schema";
83
+ }
84
+
85
+ // Creates a new schema revision that is a copy of the provided revision_id.
86
+ rpc RollbackSchema(RollbackSchemaRequest) returns (Schema) {
87
+ option (google.api.http) = {
88
+ post: "/v1/{name=projects/*/schemas/*}:rollback"
89
+ body: "*"
90
+ };
91
+ option (google.api.method_signature) = "name,revision_id";
92
+ }
93
+
94
+ // Deletes a specific schema revision.
95
+ rpc DeleteSchemaRevision(DeleteSchemaRevisionRequest) returns (Schema) {
96
+ option (google.api.http) = {
97
+ delete: "/v1/{name=projects/*/schemas/*}:deleteRevision"
98
+ };
99
+ option (google.api.method_signature) = "name,revision_id";
100
+ }
101
+
66
102
  // Deletes a schema.
67
103
  rpc DeleteSchema(DeleteSchemaRequest) returns (google.protobuf.Empty) {
68
104
  option (google.api.http) = {
@@ -120,6 +156,29 @@ message Schema {
120
156
  // the full definition of the schema that is a valid schema definition of
121
157
  // the type specified in `type`.
122
158
  string definition = 3;
159
+
160
+ // Output only. Immutable. The revision ID of the schema.
161
+ string revision_id = 4 [
162
+ (google.api.field_behavior) = IMMUTABLE,
163
+ (google.api.field_behavior) = OUTPUT_ONLY
164
+ ];
165
+
166
+ // Output only. The timestamp that the revision was created.
167
+ google.protobuf.Timestamp revision_create_time = 6
168
+ [(google.api.field_behavior) = OUTPUT_ONLY];
169
+ }
170
+
171
+ // View of Schema object fields to be returned by GetSchema and ListSchemas.
172
+ enum SchemaView {
173
+ // The default / unset value.
174
+ // The API will default to the BASIC view.
175
+ SCHEMA_VIEW_UNSPECIFIED = 0;
176
+
177
+ // Include the name and type of the schema, but not the definition.
178
+ BASIC = 1;
179
+
180
+ // Include all Schema object fields.
181
+ FULL = 2;
123
182
  }
124
183
 
125
184
  // Request for the CreateSchema method.
@@ -148,19 +207,6 @@ message CreateSchemaRequest {
148
207
  string schema_id = 3;
149
208
  }
150
209
 
151
- // View of Schema object fields to be returned by GetSchema and ListSchemas.
152
- enum SchemaView {
153
- // The default / unset value.
154
- // The API will default to the BASIC view.
155
- SCHEMA_VIEW_UNSPECIFIED = 0;
156
-
157
- // Include the name and type of the schema, but not the definition.
158
- BASIC = 1;
159
-
160
- // Include all Schema object fields.
161
- FULL = 2;
162
- }
163
-
164
210
  // Request for the GetSchema method.
165
211
  message GetSchemaRequest {
166
212
  // Required. The name of the schema to get.
@@ -171,8 +217,7 @@ message GetSchemaRequest {
171
217
  ];
172
218
 
173
219
  // The set of fields to return in the response. If not set, returns a Schema
174
- // with `name` and `type`, but not `definition`. Set to `FULL` to retrieve all
175
- // fields.
220
+ // with all fields filled out. Set to `BASIC` to omit the `definition`.
176
221
  SchemaView view = 2;
177
222
  }
178
223
 
@@ -211,6 +256,83 @@ message ListSchemasResponse {
211
256
  string next_page_token = 2;
212
257
  }
213
258
 
259
+ // Request for the `ListSchemaRevisions` method.
260
+ message ListSchemaRevisionsRequest {
261
+ // Required. The name of the schema to list revisions for.
262
+ string name = 1 [
263
+ (google.api.field_behavior) = REQUIRED,
264
+ (google.api.resource_reference) = { type: "pubsub.googleapis.com/Schema" }
265
+ ];
266
+
267
+ // The set of Schema fields to return in the response. If not set, returns
268
+ // Schemas with `name` and `type`, but not `definition`. Set to `FULL` to
269
+ // retrieve all fields.
270
+ SchemaView view = 2;
271
+
272
+ // The maximum number of revisions to return per page.
273
+ int32 page_size = 3;
274
+
275
+ // The page token, received from a previous ListSchemaRevisions call.
276
+ // Provide this to retrieve the subsequent page.
277
+ string page_token = 4;
278
+ }
279
+
280
+ // Response for the `ListSchemaRevisions` method.
281
+ message ListSchemaRevisionsResponse {
282
+ // The revisions of the schema.
283
+ repeated Schema schemas = 1;
284
+
285
+ // A token that can be sent as `page_token` to retrieve the next page.
286
+ // If this field is empty, there are no subsequent pages.
287
+ string next_page_token = 2;
288
+ }
289
+
290
+ // Request for CommitSchema method.
291
+ message CommitSchemaRequest {
292
+ // Required. The name of the schema we are revising.
293
+ // Format is `projects/{project}/schemas/{schema}`.
294
+ string name = 1 [
295
+ (google.api.field_behavior) = REQUIRED,
296
+ (google.api.resource_reference) = { type: "pubsub.googleapis.com/Schema" }
297
+ ];
298
+
299
+ // Required. The schema revision to commit.
300
+ Schema schema = 2 [(google.api.field_behavior) = REQUIRED];
301
+ }
302
+
303
+ // Request for the `RollbackSchema` method.
304
+ message RollbackSchemaRequest {
305
+ // Required. The schema being rolled back with revision id.
306
+ string name = 1 [
307
+ (google.api.field_behavior) = REQUIRED,
308
+ (google.api.resource_reference) = { type: "pubsub.googleapis.com/Schema" }
309
+ ];
310
+
311
+ // Required. The revision ID to roll back to.
312
+ // It must be a revision of the same schema.
313
+ //
314
+ // Example: c7cfa2a8
315
+ string revision_id = 2 [(google.api.field_behavior) = REQUIRED];
316
+ }
317
+
318
+ // Request for the `DeleteSchemaRevision` method.
319
+ message DeleteSchemaRevisionRequest {
320
+ // Required. The name of the schema revision to be deleted, with a revision ID
321
+ // explicitly included.
322
+ //
323
+ // Example: `projects/123/schemas/my-schema@c7cfa2a8`
324
+ string name = 1 [
325
+ (google.api.field_behavior) = REQUIRED,
326
+ (google.api.resource_reference) = { type: "pubsub.googleapis.com/Schema" }
327
+ ];
328
+
329
+ // Optional. This field is deprecated and should not be used for specifying
330
+ // the revision ID. The revision ID should be specified via the `name`
331
+ // parameter.
332
+ string revision_id = 2
333
+ [deprecated = true, (google.api.field_behavior) = OPTIONAL];
334
+ }
335
+
214
336
  // Request for the `DeleteSchema` method.
215
337
  message DeleteSchemaRequest {
216
338
  // Required. Name of the schema to delete.