From 435a18110fdefb6964b331047a9ac536d758d1d3 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 11 Aug 2021 16:06:17 +0000 Subject: [PATCH] fix(pubsub): replace IAMPolicy in API config (#1373) PiperOrigin-RevId: 389961627 Source-Link: https://github.com/googleapis/googleapis/commit/e41be609f1e2ae7618bf323748871c591f44742a Source-Link: https://github.com/googleapis/googleapis-gen/commit/68372a8c43f97a79d2403a096324f45d7f8ff0c9 --- protos/google/pubsub/v1/pubsub.proto | 24 +++++++++++-- protos/google/pubsub/v1/schema.proto | 4 ++- protos/protos.d.ts | 12 +++++++ protos/protos.js | 54 ++++++++++++++++++++++++++++ protos/protos.json | 11 ++++++ src/v1/publisher_client.ts | 9 +++++ src/v1/subscriber_client.ts | 12 +++++-- 7 files changed, 121 insertions(+), 5 deletions(-) diff --git a/protos/google/pubsub/v1/pubsub.proto b/protos/google/pubsub/v1/pubsub.proto index 173c4ce71..b1d65626c 100644 --- a/protos/google/pubsub/v1/pubsub.proto +++ b/protos/google/pubsub/v1/pubsub.proto @@ -196,6 +196,16 @@ message Topic { // Reserved for future use. This field is set only in responses from the // server; it is ignored if it is set in any requests. bool satisfies_pzs = 7; + + // Indicates the minimum duration to retain a message after it is published to + // the topic. If this field is set, messages published to the topic in the + // last `message_retention_duration` are always available to subscribers. For + // instance, it allows any attached subscription to [seek to a + // timestamp](https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time) + // that is up to `message_retention_duration` in the past. If this field is + // not set, message retention is controlled by settings on individual + // subscriptions. Cannot be more than 7 days or less than 10 minutes. + google.protobuf.Duration message_retention_duration = 8; } // A message that is published by publishers and consumed by subscribers. The @@ -678,8 +688,9 @@ message Subscription { // Indicates whether to retain acknowledged messages. If true, then // messages are not expunged from the subscription's backlog, even if they are // acknowledged, until they fall out of the `message_retention_duration` - // window. This must be true if you would like to [Seek to a timestamp] - // (https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time). + // window. This must be true if you would like to [`Seek` to a timestamp] + // (https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time) in + // the past to replay previously-acknowledged messages. bool retain_acked_messages = 7; // How long to retain unacknowledged messages in the subscription's backlog, @@ -740,6 +751,15 @@ message Subscription { // FAILED_PRECONDITION. If the subscription is a push subscription, pushes to // the endpoint will not be made. bool detached = 15; + + // Output only. Indicates the minimum duration for which a message is retained + // after it is published to the subscription's topic. If this field is set, + // messages published to the subscription's topic in the last + // `topic_message_retention_duration` are always available to subscribers. See + // the `message_retention_duration` field in `Topic`. This field is set only + // in responses from the server; it is ignored if it is set in any requests. + google.protobuf.Duration topic_message_retention_duration = 17 + [(google.api.field_behavior) = OUTPUT_ONLY]; } // A policy that specifies how Cloud Pub/Sub retries message delivery. diff --git a/protos/google/pubsub/v1/schema.proto b/protos/google/pubsub/v1/schema.proto index 1ace7ef3b..3cdf10d93 100644 --- a/protos/google/pubsub/v1/schema.proto +++ b/protos/google/pubsub/v1/schema.proto @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -237,6 +237,7 @@ message ValidateSchemaRequest { } // Response for the `ValidateSchema` method. +// Empty for now. message ValidateSchemaResponse {} // Request for the `ValidateMessage` method. @@ -270,6 +271,7 @@ message ValidateMessageRequest { } // Response for the `ValidateMessage` method. +// Empty for now. message ValidateMessageResponse {} // Possible encoding types for messages. diff --git a/protos/protos.d.ts b/protos/protos.d.ts index fb224bba9..6662d8236 100644 --- a/protos/protos.d.ts +++ b/protos/protos.d.ts @@ -442,6 +442,9 @@ export namespace google { /** Topic satisfiesPzs */ satisfiesPzs?: (boolean|null); + + /** Topic messageRetentionDuration */ + messageRetentionDuration?: (google.protobuf.IDuration|null); } /** Represents a Topic. */ @@ -471,6 +474,9 @@ export namespace google { /** Topic satisfiesPzs. */ public satisfiesPzs: boolean; + /** Topic messageRetentionDuration. */ + public messageRetentionDuration?: (google.protobuf.IDuration|null); + /** * Creates a new Topic instance using the specified properties. * @param [properties] Properties to set @@ -2287,6 +2293,9 @@ export namespace google { /** Subscription detached */ detached?: (boolean|null); + + /** Subscription topicMessageRetentionDuration */ + topicMessageRetentionDuration?: (google.protobuf.IDuration|null); } /** Represents a Subscription. */ @@ -2337,6 +2346,9 @@ export namespace google { /** Subscription detached. */ public detached: boolean; + /** Subscription topicMessageRetentionDuration. */ + public topicMessageRetentionDuration?: (google.protobuf.IDuration|null); + /** * Creates a new Subscription instance using the specified properties. * @param [properties] Properties to set diff --git a/protos/protos.js b/protos/protos.js index 43146104a..9e7f2cfec 100644 --- a/protos/protos.js +++ b/protos/protos.js @@ -832,6 +832,7 @@ * @property {string|null} [kmsKeyName] Topic kmsKeyName * @property {google.pubsub.v1.ISchemaSettings|null} [schemaSettings] Topic schemaSettings * @property {boolean|null} [satisfiesPzs] Topic satisfiesPzs + * @property {google.protobuf.IDuration|null} [messageRetentionDuration] Topic messageRetentionDuration */ /** @@ -898,6 +899,14 @@ */ Topic.prototype.satisfiesPzs = false; + /** + * Topic messageRetentionDuration. + * @member {google.protobuf.IDuration|null|undefined} messageRetentionDuration + * @memberof google.pubsub.v1.Topic + * @instance + */ + Topic.prototype.messageRetentionDuration = null; + /** * Creates a new Topic instance using the specified properties. * @function create @@ -935,6 +944,8 @@ $root.google.pubsub.v1.SchemaSettings.encode(message.schemaSettings, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); if (message.satisfiesPzs != null && Object.hasOwnProperty.call(message, "satisfiesPzs")) writer.uint32(/* id 7, wireType 0 =*/56).bool(message.satisfiesPzs); + if (message.messageRetentionDuration != null && Object.hasOwnProperty.call(message, "messageRetentionDuration")) + $root.google.protobuf.Duration.encode(message.messageRetentionDuration, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); return writer; }; @@ -1006,6 +1017,9 @@ case 7: message.satisfiesPzs = reader.bool(); break; + case 8: + message.messageRetentionDuration = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; @@ -1068,6 +1082,11 @@ if (message.satisfiesPzs != null && message.hasOwnProperty("satisfiesPzs")) if (typeof message.satisfiesPzs !== "boolean") return "satisfiesPzs: boolean expected"; + if (message.messageRetentionDuration != null && message.hasOwnProperty("messageRetentionDuration")) { + var error = $root.google.protobuf.Duration.verify(message.messageRetentionDuration); + if (error) + return "messageRetentionDuration." + error; + } return null; }; @@ -1106,6 +1125,11 @@ } if (object.satisfiesPzs != null) message.satisfiesPzs = Boolean(object.satisfiesPzs); + if (object.messageRetentionDuration != null) { + if (typeof object.messageRetentionDuration !== "object") + throw TypeError(".google.pubsub.v1.Topic.messageRetentionDuration: object expected"); + message.messageRetentionDuration = $root.google.protobuf.Duration.fromObject(object.messageRetentionDuration); + } return message; }; @@ -1130,6 +1154,7 @@ object.kmsKeyName = ""; object.schemaSettings = null; object.satisfiesPzs = false; + object.messageRetentionDuration = null; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -1147,6 +1172,8 @@ object.schemaSettings = $root.google.pubsub.v1.SchemaSettings.toObject(message.schemaSettings, options); if (message.satisfiesPzs != null && message.hasOwnProperty("satisfiesPzs")) object.satisfiesPzs = message.satisfiesPzs; + if (message.messageRetentionDuration != null && message.hasOwnProperty("messageRetentionDuration")) + object.messageRetentionDuration = $root.google.protobuf.Duration.toObject(message.messageRetentionDuration, options); return object; }; @@ -4826,6 +4853,7 @@ * @property {google.pubsub.v1.IDeadLetterPolicy|null} [deadLetterPolicy] Subscription deadLetterPolicy * @property {google.pubsub.v1.IRetryPolicy|null} [retryPolicy] Subscription retryPolicy * @property {boolean|null} [detached] Subscription detached + * @property {google.protobuf.IDuration|null} [topicMessageRetentionDuration] Subscription topicMessageRetentionDuration */ /** @@ -4948,6 +4976,14 @@ */ Subscription.prototype.detached = false; + /** + * Subscription topicMessageRetentionDuration. + * @member {google.protobuf.IDuration|null|undefined} topicMessageRetentionDuration + * @memberof google.pubsub.v1.Subscription + * @instance + */ + Subscription.prototype.topicMessageRetentionDuration = null; + /** * Creates a new Subscription instance using the specified properties. * @function create @@ -4999,6 +5035,8 @@ $root.google.pubsub.v1.RetryPolicy.encode(message.retryPolicy, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); if (message.detached != null && Object.hasOwnProperty.call(message, "detached")) writer.uint32(/* id 15, wireType 0 =*/120).bool(message.detached); + if (message.topicMessageRetentionDuration != null && Object.hasOwnProperty.call(message, "topicMessageRetentionDuration")) + $root.google.protobuf.Duration.encode(message.topicMessageRetentionDuration, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); return writer; }; @@ -5091,6 +5129,9 @@ case 15: message.detached = reader.bool(); break; + case 17: + message.topicMessageRetentionDuration = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; @@ -5180,6 +5221,11 @@ if (message.detached != null && message.hasOwnProperty("detached")) if (typeof message.detached !== "boolean") return "detached: boolean expected"; + if (message.topicMessageRetentionDuration != null && message.hasOwnProperty("topicMessageRetentionDuration")) { + var error = $root.google.protobuf.Duration.verify(message.topicMessageRetentionDuration); + if (error) + return "topicMessageRetentionDuration." + error; + } return null; }; @@ -5241,6 +5287,11 @@ } if (object.detached != null) message.detached = Boolean(object.detached); + if (object.topicMessageRetentionDuration != null) { + if (typeof object.topicMessageRetentionDuration !== "object") + throw TypeError(".google.pubsub.v1.Subscription.topicMessageRetentionDuration: object expected"); + message.topicMessageRetentionDuration = $root.google.protobuf.Duration.fromObject(object.topicMessageRetentionDuration); + } return message; }; @@ -5272,6 +5323,7 @@ object.deadLetterPolicy = null; object.retryPolicy = null; object.detached = false; + object.topicMessageRetentionDuration = null; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -5303,6 +5355,8 @@ object.retryPolicy = $root.google.pubsub.v1.RetryPolicy.toObject(message.retryPolicy, options); if (message.detached != null && message.hasOwnProperty("detached")) object.detached = message.detached; + if (message.topicMessageRetentionDuration != null && message.hasOwnProperty("topicMessageRetentionDuration")) + object.topicMessageRetentionDuration = $root.google.protobuf.Duration.toObject(message.topicMessageRetentionDuration, options); return object; }; diff --git a/protos/protos.json b/protos/protos.json index 1de6e50a1..6d3bc635f 100644 --- a/protos/protos.json +++ b/protos/protos.json @@ -242,6 +242,10 @@ "satisfiesPzs": { "type": "bool", "id": 7 + }, + "messageRetentionDuration": { + "type": "google.protobuf.Duration", + "id": 8 } } }, @@ -816,6 +820,13 @@ "detached": { "type": "bool", "id": 15 + }, + "topicMessageRetentionDuration": { + "type": "google.protobuf.Duration", + "id": 17, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } } } }, diff --git a/src/v1/publisher_client.ts b/src/v1/publisher_client.ts index b41a83c6b..3216dd457 100644 --- a/src/v1/publisher_client.ts +++ b/src/v1/publisher_client.ts @@ -422,6 +422,15 @@ export class PublisherClient { * @param {boolean} request.satisfiesPzs * Reserved for future use. This field is set only in responses from the * server; it is ignored if it is set in any requests. + * @param {google.protobuf.Duration} request.messageRetentionDuration + * Indicates the minimum duration to retain a message after it is published to + * the topic. If this field is set, messages published to the topic in the + * last `message_retention_duration` are always available to subscribers. For + * instance, it allows any attached subscription to [seek to a + * timestamp](https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time) + * that is up to `message_retention_duration` in the past. If this field is + * not set, message retention is controlled by settings on individual + * subscriptions. Cannot be more than 7 days or less than 10 minutes. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. diff --git a/src/v1/subscriber_client.ts b/src/v1/subscriber_client.ts index 31ed465e4..8486f1a3d 100644 --- a/src/v1/subscriber_client.ts +++ b/src/v1/subscriber_client.ts @@ -441,8 +441,9 @@ export class SubscriberClient { * Indicates whether to retain acknowledged messages. If true, then * messages are not expunged from the subscription's backlog, even if they are * acknowledged, until they fall out of the `message_retention_duration` - * window. This must be true if you would like to [Seek to a timestamp] - * (https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time). + * window. This must be true if you would like to [`Seek` to a timestamp] + * (https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time) in + * the past to replay previously-acknowledged messages. * @param {google.protobuf.Duration} request.messageRetentionDuration * How long to retain unacknowledged messages in the subscription's backlog, * from the moment a message is published. @@ -494,6 +495,13 @@ export class SubscriberClient { * backlog. `Pull` and `StreamingPull` requests will return * FAILED_PRECONDITION. If the subscription is a push subscription, pushes to * the endpoint will not be made. + * @param {google.protobuf.Duration} request.topicMessageRetentionDuration + * Output only. Indicates the minimum duration for which a message is retained + * after it is published to the subscription's topic. If this field is set, + * messages published to the subscription's topic in the last + * `topic_message_retention_duration` are always available to subscribers. See + * the `message_retention_duration` field in `Topic`. This field is set only + * in responses from the server; it is ignored if it is set in any requests. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array.