diff --git a/.github/.OwlBot-hermetic.yaml b/.github/.OwlBot-hermetic.yaml index 219163820..d426d10ea 100644 --- a/.github/.OwlBot-hermetic.yaml +++ b/.github/.OwlBot-hermetic.yaml @@ -41,6 +41,7 @@ deep-preserve-regex: - "/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/SequentialExecutorServiceTest.java" - "/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/StatusUtilTest.java" - "/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/StreamingSubscriberConnectionTest.java" +- "/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/SubscriberShutdownSettingsTest.java" - "/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/SubscriberTest.java" - "/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/TopicAdminSmokeTest.java" - "/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/WaiterTest.java" @@ -64,6 +65,7 @@ deep-preserve-regex: - "/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/StreamingSubscriberConnection.java" - "/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/Subscriber.java" - "/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/SubscriberInterface.java" +- "/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/SubscriberShutdownSettings.java" - "/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/SubscriberStats.java" - "/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/Waiter.java" diff --git a/.github/workflows/hermetic_library_generation.yaml b/.github/workflows/hermetic_library_generation.yaml index 0e85f8052..7023350ad 100644 --- a/.github/workflows/hermetic_library_generation.yaml +++ b/.github/workflows/hermetic_library_generation.yaml @@ -37,7 +37,7 @@ jobs: with: fetch-depth: 0 token: ${{ secrets.CLOUD_JAVA_BOT_TOKEN }} - - uses: googleapis/sdk-platform-java/.github/scripts@v2.62.3 + - uses: googleapis/sdk-platform-java/.github/scripts@v2.63.0 if: env.SHOULD_RUN == 'true' with: base_ref: ${{ github.base_ref }} diff --git a/.github/workflows/unmanaged_dependency_check.yaml b/.github/workflows/unmanaged_dependency_check.yaml index 8d2d29b64..118c3b50f 100644 --- a/.github/workflows/unmanaged_dependency_check.yaml +++ b/.github/workflows/unmanaged_dependency_check.yaml @@ -17,6 +17,6 @@ jobs: # repository .kokoro/build.sh - name: Unmanaged dependency check - uses: googleapis/sdk-platform-java/java-shared-dependencies/unmanaged-dependency-check@google-cloud-shared-dependencies/v3.52.3 + uses: googleapis/sdk-platform-java/java-shared-dependencies/unmanaged-dependency-check@google-cloud-shared-dependencies/v3.53.0 with: bom-path: google-cloud-pubsub-bom/pom.xml diff --git a/.kokoro/presubmit/graalvm-native-a.cfg b/.kokoro/presubmit/graalvm-native-a.cfg index b7567eeb7..55c5543e2 100644 --- a/.kokoro/presubmit/graalvm-native-a.cfg +++ b/.kokoro/presubmit/graalvm-native-a.cfg @@ -3,7 +3,7 @@ # Configure the docker image for kokoro-trampoline. env_vars: { key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_a:3.52.3" # {x-version-update:google-cloud-shared-dependencies:current} + value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_a:3.53.0" # {x-version-update:google-cloud-shared-dependencies:current} } env_vars: { diff --git a/.kokoro/presubmit/graalvm-native-b.cfg b/.kokoro/presubmit/graalvm-native-b.cfg index c7205f0ab..5c981b984 100644 --- a/.kokoro/presubmit/graalvm-native-b.cfg +++ b/.kokoro/presubmit/graalvm-native-b.cfg @@ -3,7 +3,7 @@ # Configure the docker image for kokoro-trampoline. env_vars: { key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_b:3.52.3" # {x-version-update:google-cloud-shared-dependencies:current} + value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_b:3.53.0" # {x-version-update:google-cloud-shared-dependencies:current} } env_vars: { diff --git a/.kokoro/presubmit/graalvm-native-c.cfg b/.kokoro/presubmit/graalvm-native-c.cfg index f6ab8976a..f2032499d 100644 --- a/.kokoro/presubmit/graalvm-native-c.cfg +++ b/.kokoro/presubmit/graalvm-native-c.cfg @@ -3,7 +3,7 @@ # Configure the docker image for kokoro-trampoline. env_vars: { key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_c:3.52.3" # {x-version-update:google-cloud-shared-dependencies:current} + value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_c:3.53.0" # {x-version-update:google-cloud-shared-dependencies:current} } env_vars: { diff --git a/CHANGELOG.md b/CHANGELOG.md index bb63149ef..2df2a6eb3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,28 @@ # Changelog +## [1.143.0](https://github.com/googleapis/java-pubsub/compare/v1.142.0...v1.143.0) (2025-10-20) + + +### Features + +* Annotate some resource fields with their corresponding API types ([ab60afa](https://github.com/googleapis/java-pubsub/commit/ab60afa012bd3fc81977ba24c416205ce9280943)) +* Implement SubscriberShutdownSettings ([#2569](https://github.com/googleapis/java-pubsub/issues/2569)) ([8195f6f](https://github.com/googleapis/java-pubsub/commit/8195f6fd3bbd33a178535994a94a79822ae2d4d6)) + + +### Bug Fixes + +* **deps:** Update the Java code generator (gapic-generator-java) to 2.63.0 ([ab60afa](https://github.com/googleapis/java-pubsub/commit/ab60afa012bd3fc81977ba24c416205ce9280943)) +* Update .OwlBot-hermetic.yaml to preserve SubscriberShutdownSettings files ([#2583](https://github.com/googleapis/java-pubsub/issues/2583)) ([f3cf5e7](https://github.com/googleapis/java-pubsub/commit/f3cf5e725c12173ade0275fd0526885309dc553a)) + + +### Dependencies + +* Update actions/checkout action to v5 ([#2576](https://github.com/googleapis/java-pubsub/issues/2576)) ([1375f6d](https://github.com/googleapis/java-pubsub/commit/1375f6d9a71c78d973a71f1df449640a95bc0bc7)) +* Update actions/checkout action to v5 ([#2584](https://github.com/googleapis/java-pubsub/issues/2584)) ([25059ce](https://github.com/googleapis/java-pubsub/commit/25059ce001e3273fcec9d1c40e3b09c89ddf487e)) +* Update dependency com.google.cloud:google-cloud-bigquery to v2.55.2 ([#2582](https://github.com/googleapis/java-pubsub/issues/2582)) ([d0f9673](https://github.com/googleapis/java-pubsub/commit/d0f96737a74453c3db54ee59e98d4b6636cd55d4)) +* Update dependency com.google.cloud:google-cloud-storage to v2.58.1 ([#2580](https://github.com/googleapis/java-pubsub/issues/2580)) ([d156cdb](https://github.com/googleapis/java-pubsub/commit/d156cdb27a8d68b6fa8c97f558df7088e6634320)) +* Update dependency com.google.cloud:sdk-platform-java-config to v3.53.0 ([#2589](https://github.com/googleapis/java-pubsub/issues/2589)) ([ce7cb09](https://github.com/googleapis/java-pubsub/commit/ce7cb09ac5e86953815e2ead9ae9202e9b034ba6)) + ## [1.142.0](https://github.com/googleapis/java-pubsub/compare/v1.141.5...v1.142.0) (2025-10-07) diff --git a/README.md b/README.md index 5e43686c1..615b42ea6 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file: com.google.cloud libraries-bom - 26.69.0 + 26.70.0 pom import @@ -43,7 +43,7 @@ If you are using Maven without the BOM, add this to your dependencies: com.google.cloud google-cloud-pubsub - 1.141.5 + 1.142.0 ``` @@ -51,20 +51,20 @@ If you are using Maven without the BOM, add this to your dependencies: If you are using Gradle 5.x or later, add this to your dependencies: ```Groovy -implementation platform('com.google.cloud:libraries-bom:26.69.0') +implementation platform('com.google.cloud:libraries-bom:26.70.0') implementation 'com.google.cloud:google-cloud-pubsub' ``` If you are using Gradle without BOM, add this to your dependencies: ```Groovy -implementation 'com.google.cloud:google-cloud-pubsub:1.142.0' +implementation 'com.google.cloud:google-cloud-pubsub:1.143.0' ``` If you are using SBT, add this to your dependencies: ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-pubsub" % "1.142.0" +libraryDependencies += "com.google.cloud" % "google-cloud-pubsub" % "1.143.0" ``` ## Authentication @@ -420,7 +420,7 @@ Java is a registered trademark of Oracle and/or its affiliates. [kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-pubsub/java11.html [stability-image]: https://img.shields.io/badge/stability-stable-green [maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-pubsub.svg -[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-pubsub/1.142.0 +[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-pubsub/1.143.0 [authentication]: https://github.com/googleapis/google-cloud-java#authentication [auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes [predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles diff --git a/generation_config.yaml b/generation_config.yaml index b70e279e6..0a9e75959 100644 --- a/generation_config.yaml +++ b/generation_config.yaml @@ -1,6 +1,6 @@ -gapic_generator_version: 2.62.3 -googleapis_commitish: 6e79e73204aed17b11e724beebb9cf11f36ea57d -libraries_bom_version: 26.69.0 +gapic_generator_version: 2.63.0 +googleapis_commitish: c288189b43c016dd3cf1ec73ce3cadee8b732f07 +libraries_bom_version: 26.70.0 libraries: - api_shortname: pubsub name_pretty: Cloud Pub/Sub diff --git a/google-cloud-pubsub-bom/pom.xml b/google-cloud-pubsub-bom/pom.xml index 99a617251..39ad7f874 100644 --- a/google-cloud-pubsub-bom/pom.xml +++ b/google-cloud-pubsub-bom/pom.xml @@ -3,12 +3,12 @@ 4.0.0 com.google.cloud google-cloud-pubsub-bom - 1.142.0 + 1.143.0 pom com.google.cloud sdk-platform-java-config - 3.52.3 + 3.53.0 Google Cloud pubsub BOM @@ -52,17 +52,17 @@ com.google.cloud google-cloud-pubsub - 1.142.0 + 1.143.0 com.google.api.grpc grpc-google-cloud-pubsub-v1 - 1.124.0 + 1.125.0 com.google.api.grpc proto-google-cloud-pubsub-v1 - 1.124.0 + 1.125.0 diff --git a/google-cloud-pubsub/pom.xml b/google-cloud-pubsub/pom.xml index 381bf7cda..35f337209 100644 --- a/google-cloud-pubsub/pom.xml +++ b/google-cloud-pubsub/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-pubsub - 1.142.0 + 1.143.0 jar Google Cloud Pub/Sub https://github.com/googleapis/java-pubsub @@ -11,7 +11,7 @@ com.google.cloud google-cloud-pubsub-parent - 1.142.0 + 1.143.0 google-cloud-pubsub diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/MessageDispatcher.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/MessageDispatcher.java index 983844a62..5ed36b9cd 100644 --- a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/MessageDispatcher.java +++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/MessageDispatcher.java @@ -62,6 +62,7 @@ class MessageDispatcher { @InternalApi static final double PERCENTILE_FOR_ACK_DEADLINE_UPDATES = 99.9; @InternalApi static final Duration PENDING_ACKS_SEND_DELAY = Duration.ofMillis(100); + @InternalApi static final long FINAL_NACK_TIMEOUT = Duration.ofSeconds(1).toMillis(); private final Executor executor; private final SequentialExecutorService.AutoExecutor sequentialExecutor; @@ -108,6 +109,8 @@ class MessageDispatcher { private final SubscriptionName subscriptionNameObject; private final boolean enableOpenTelemetryTracing; private OpenTelemetryPubsubTracer tracer = new OpenTelemetryPubsubTracer(null, false); + private final SubscriberShutdownSettings subscriberShutdownSettings; + private final AtomicBoolean nackImmediatelyShutdownInProgress = new AtomicBoolean(false); /** Internal representation of a reply to a Pubsub message, to be sent back to the service. */ public enum AckReply { @@ -170,12 +173,18 @@ public void onFailure(Throwable t) { public void onSuccess(AckReply reply) { switch (reply) { case ACK: - pendingAcks.add(this.ackRequestData); - // Record the latency rounded to the next closest integer. - ackLatencyDistribution.record( - Ints.saturatedCast( - (long) Math.ceil((clock.millisTime() - receivedTimeMillis) / 1000D))); - tracer.endSubscribeProcessSpan(this.ackRequestData.getMessageWrapper(), "ack"); + if (nackImmediatelyShutdownInProgress.get() && exactlyOnceDeliveryEnabled.get()) { + this.ackRequestData.setResponse(AckResponse.OTHER, true); + tracer.endSubscribeProcessSpan( + this.ackRequestData.getMessageWrapper(), "ack failed_with_nack_immediately"); + } else { + pendingAcks.add(this.ackRequestData); + // Record the latency rounded to the next closest integer. + ackLatencyDistribution.record( + Ints.saturatedCast( + (long) Math.ceil((clock.millisTime() - receivedTimeMillis) / 1000D))); + tracer.endSubscribeProcessSpan(this.ackRequestData.getMessageWrapper(), "ack"); + } break; case NACK: pendingNacks.add(this.ackRequestData); @@ -231,6 +240,7 @@ private MessageDispatcher(Builder builder) { if (builder.tracer != null) { tracer = builder.tracer; } + this.subscriberShutdownSettings = builder.subscriberShutdownSettings; } private boolean shouldSetMessageFuture() { @@ -294,8 +304,62 @@ public void run() { } } + private void nackAllOutstandingMessages() { + nackImmediatelyShutdownInProgress.set(true); + List handlersToNack = new ArrayList<>(pendingMessages.values()); + for (AckHandler ackHandler : handlersToNack) { + pendingNacks.add(ackHandler.getAckRequestData()); + ackHandler.forget(); // This removes from pendingMessages, releases flow control, etc. + } + } + void stop() { - messagesWaiter.waitComplete(); + switch (subscriberShutdownSettings.getMode()) { + case WAIT_FOR_PROCESSING: + logger.log( + Level.FINE, + "WAIT_FOR_PROCESSING shutdown mode: Waiting for outstanding messages to complete" + + " processing."); + java.time.Duration timeout = subscriberShutdownSettings.getTimeout(); + if (timeout.isNegative()) { + // Indefinite wait use existing blocking wait + messagesWaiter.waitComplete(); + } else { + // Wait for (timeout - 1 second) for messages to complete + long gracePeriodMillis = Math.max(0, timeout.toMillis() - FINAL_NACK_TIMEOUT); + boolean completedWait = messagesWaiter.tryWait(gracePeriodMillis, clock); + if (!completedWait) { + logger.log( + Level.WARNING, + "Grace period expired for WAIT_FOR_PROCESSING shutdown. Nacking remaining" + + " messages."); + // Switch to NACK_IMMEDIATELY behavior for remaining messages + nackAllOutstandingMessages(); + } + } + cancelBackgroundJob(); + processOutstandingOperations(); // Send any remaining acks/nacks. + break; + + case NACK_IMMEDIATELY: + logger.log(Level.FINE, "NACK_IMMEDIATELY shutdown mode: Nacking all outstanding messages."); + // Stop extending deadlines immediately. + cancelBackgroundJob(); + nackAllOutstandingMessages(); + processOutstandingOperations(); // Send all pending nacks. + break; + + default: + logger.log(Level.WARNING, "Unknown shutdown mode: " + subscriberShutdownSettings.getMode()); + // Default to WAIT_FOR_PROCESSING behavior + messagesWaiter.waitComplete(); + cancelBackgroundJob(); + processOutstandingOperations(); + break; + } + } + + private void cancelBackgroundJob() { jobLock.lock(); try { if (backgroundJob != null) { @@ -309,7 +373,6 @@ void stop() { } finally { jobLock.unlock(); } - processOutstandingOperations(); } @InternalApi @@ -364,6 +427,11 @@ void setMessageOrderingEnabled(boolean messageOrderingEnabled) { this.messageOrderingEnabled.set(messageOrderingEnabled); } + @InternalApi + boolean getNackImmediatelyShutdownInProgress() { + return nackImmediatelyShutdownInProgress.get(); + } + private static class OutstandingMessage { private final AckHandler ackHandler; @@ -661,7 +729,7 @@ void processOutstandingOperations() { List ackRequestDataReceipts = new ArrayList(); pendingReceipts.drainTo(ackRequestDataReceipts); - if (!ackRequestDataReceipts.isEmpty()) { + if (!ackRequestDataReceipts.isEmpty() && !getNackImmediatelyShutdownInProgress()) { ModackRequestData receiptModack = new ModackRequestData(this.getMessageDeadlineSeconds(), ackRequestDataReceipts); receiptModack.setIsReceiptModack(true); @@ -705,6 +773,7 @@ public static final class Builder { private String subscriptionName; private boolean enableOpenTelemetryTracing; private OpenTelemetryPubsubTracer tracer; + private SubscriberShutdownSettings subscriberShutdownSettings; protected Builder(MessageReceiver receiver) { this.receiver = receiver; @@ -791,6 +860,12 @@ public Builder setTracer(OpenTelemetryPubsubTracer tracer) { return this; } + public Builder setSubscriberShutdownSettings( + SubscriberShutdownSettings subscriberShutdownSettings) { + this.subscriberShutdownSettings = subscriberShutdownSettings; + return this; + } + public MessageDispatcher build() { return new MessageDispatcher(this); } diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/StreamingSubscriberConnection.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/StreamingSubscriberConnection.java index baf96f385..319dd31f5 100644 --- a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/StreamingSubscriberConnection.java +++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/StreamingSubscriberConnection.java @@ -98,6 +98,7 @@ final class StreamingSubscriberConnection extends AbstractApiService implements private final String subscription; private final SubscriptionName subscriptionNameObject; private final ScheduledExecutorService systemExecutor; + private final ApiClock clock; private final MessageDispatcher messageDispatcher; private final FlowControlSettings flowControlSettings; @@ -124,11 +125,13 @@ final class StreamingSubscriberConnection extends AbstractApiService implements private final boolean enableOpenTelemetryTracing; private OpenTelemetryPubsubTracer tracer = new OpenTelemetryPubsubTracer(null, false); + private final SubscriberShutdownSettings subscriberShutdownSettings; private StreamingSubscriberConnection(Builder builder) { subscription = builder.subscription; subscriptionNameObject = SubscriptionName.parse(builder.subscription); systemExecutor = builder.systemExecutor; + clock = builder.clock; // We need to set the default stream ack deadline on the initial request, this will be // updated by modack requests in the message dispatcher @@ -163,6 +166,7 @@ private StreamingSubscriberConnection(Builder builder) { if (builder.tracer != null) { tracer = builder.tracer; } + this.subscriberShutdownSettings = builder.subscriberShutdownSettings; messageDispatcher = messageDispatcherBuilder @@ -181,6 +185,7 @@ private StreamingSubscriberConnection(Builder builder) { .setSubscriptionName(subscription) .setEnableOpenTelemetryTracing(enableOpenTelemetryTracing) .setTracer(tracer) + .setSubscriberShutdownSettings(subscriberShutdownSettings) .build(); flowControlSettings = builder.flowControlSettings; @@ -218,8 +223,21 @@ protected void doStop() { } private void runShutdown() { + java.time.Duration timeout = subscriberShutdownSettings.getTimeout(); + if (timeout.isZero()) { + return; + } + messageDispatcher.stop(); - ackOperationsWaiter.waitComplete(); + if (timeout.isNegative()) { + ackOperationsWaiter.waitComplete(); + } else { + boolean completedWait = ackOperationsWaiter.tryWait(timeout.toMillis(), clock); + if (!completedWait) { + logger.log( + Level.WARNING, "Timeout exceeded while waiting for ACK/NACK operations to complete."); + } + } } private class StreamingPullResponseObserver implements ResponseObserver { @@ -554,9 +572,18 @@ public void onSuccess(Empty empty) { tracer.endSubscribeRpcSpan(rpcSpan); for (AckRequestData ackRequestData : ackRequestDataList) { - // This will check if a response is needed, and if it has already been set - ackRequestData.setResponse(AckResponse.SUCCESSFUL, setResponseOnSuccess); - messageDispatcher.notifyAckSuccess(ackRequestData); + // If we are in NACK_IMMEDIATELY shutdown mode, we will set failures on acks/nack so that + // an error is surfaced if the user + // manually acks or nacks in their callback. + if (setResponseOnSuccess + && getExactlyOnceDeliveryEnabled() + && messageDispatcher.getNackImmediatelyShutdownInProgress()) { + ackRequestData.setResponse(AckResponse.OTHER, setResponseOnSuccess); + messageDispatcher.notifyAckFailed(ackRequestData); + } else { + ackRequestData.setResponse(AckResponse.SUCCESSFUL, setResponseOnSuccess); + messageDispatcher.notifyAckSuccess(ackRequestData); + } // Remove from our pending operations pendingRequests.remove(ackRequestData); tracer.addEndRpcEvent( @@ -751,6 +778,7 @@ public static final class Builder { private boolean enableOpenTelemetryTracing; private OpenTelemetryPubsubTracer tracer; + private SubscriberShutdownSettings subscriberShutdownSettings; protected Builder(MessageReceiver receiver) { this.receiver = receiver; @@ -852,6 +880,12 @@ public Builder setTracer(OpenTelemetryPubsubTracer tracer) { return this; } + public Builder setSubscriberShutdownSettings( + SubscriberShutdownSettings subscriberShutdownSettings) { + this.subscriberShutdownSettings = subscriberShutdownSettings; + return this; + } + public StreamingSubscriberConnection build() { return new StreamingSubscriberConnection(this); } diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/Subscriber.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/Subscriber.java index b149bed37..c0779ff29 100644 --- a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/Subscriber.java +++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/Subscriber.java @@ -168,6 +168,7 @@ public class Subscriber extends AbstractApiService implements SubscriberInterfac private final boolean enableOpenTelemetryTracing; private final OpenTelemetry openTelemetry; private OpenTelemetryPubsubTracer tracer = new OpenTelemetryPubsubTracer(null, false); + private final SubscriberShutdownSettings subscriberShutdownSettings; private Subscriber(Builder builder) { receiver = builder.receiver; @@ -223,6 +224,7 @@ private Subscriber(Builder builder) { this.enableOpenTelemetryTracing = builder.enableOpenTelemetryTracing; this.openTelemetry = builder.openTelemetry; + this.subscriberShutdownSettings = builder.subscriberShutdownSettings; if (this.openTelemetry != null && this.enableOpenTelemetryTracing) { Tracer openTelemetryTracer = builder.openTelemetry.getTracer(OPEN_TELEMETRY_TRACER_NAME); if (openTelemetryTracer != null) { @@ -366,7 +368,6 @@ protected void doStop() { @Override public void run() { try { - // stop connection is no-op if connections haven't been started. runShutdown(); notifyStopped(); } catch (Exception e) { @@ -378,7 +379,13 @@ public void run() { } private void runShutdown() { - stopAllStreamingConnections(); + java.time.Duration timeout = subscriberShutdownSettings.getTimeout(); + long deadlineMillis = -1; + if (!timeout.isNegative()) { + deadlineMillis = clock.millisTime() + timeout.toMillis(); + } + + stopAllStreamingConnections(deadlineMillis); shutdownBackgroundResources(); subscriberStub.shutdownNow(); } @@ -420,6 +427,7 @@ private void startStreamingConnections() { .setClock(clock) .setEnableOpenTelemetryTracing(enableOpenTelemetryTracing) .setTracer(tracer) + .setSubscriberShutdownSettings(subscriberShutdownSettings) .build(); streamingSubscriberConnections.add(streamingSubscriberConnection); @@ -445,8 +453,8 @@ public void failed(State from, Throwable failure) { } } - private void stopAllStreamingConnections() { - stopConnections(streamingSubscriberConnections); + private void stopAllStreamingConnections(long deadlineMillis) { + stopConnections(streamingSubscriberConnections, deadlineMillis); } private void shutdownBackgroundResources() { @@ -466,7 +474,7 @@ private void startConnections( } } - private void stopConnections(List connections) { + private void stopConnections(List connections, long deadlineMillis) { ArrayList liveConnections; synchronized (connections) { liveConnections = new ArrayList(connections); @@ -477,11 +485,19 @@ private void stopConnections(List connections) { } for (ApiService subscriber : liveConnections) { try { - subscriber.awaitTerminated(); - } catch (IllegalStateException e) { - // If the service fails, awaitTerminated will throw an exception. - // However, we could be stopping services because at least one - // has already failed, so we just ignore this exception. + if (deadlineMillis < 0) { + // Wait indefinitely + subscriber.awaitTerminated(); + } else { + long remaining = deadlineMillis - clock.millisTime(); + if (remaining < 0) { + remaining = 0; + } + subscriber.awaitTerminated(remaining, java.util.concurrent.TimeUnit.MILLISECONDS); + } + } catch (Exception e) { + logger.log(Level.FINE, "Exception while waiting for a connection to terminate", e); + break; // Stop waiting for other connections. } } } @@ -532,6 +548,9 @@ public static final class Builder { private boolean enableOpenTelemetryTracing = false; private OpenTelemetry openTelemetry = null; + private SubscriberShutdownSettings subscriberShutdownSettings = + SubscriberShutdownSettings.newBuilder().build(); + Builder(String subscription, MessageReceiver receiver) { this.subscription = subscription; this.receiver = receiver; @@ -772,6 +791,19 @@ public Builder setOpenTelemetry(OpenTelemetry openTelemetry) { return this; } + /** + * Sets the shutdown settings for the subscriber. Defaults to {@link + * SubscriberShutdownSettings#newBuilder() default settings}. + */ + @BetaApi( + "The surface for SubscriberShutdownSettings is not stable yet and may be changed in the" + + " future.") + public Builder setSubscriberShutdownSettings( + SubscriberShutdownSettings subscriberShutdownSettings) { + this.subscriberShutdownSettings = Preconditions.checkNotNull(subscriberShutdownSettings); + return this; + } + /** Returns the default FlowControlSettings used by the client if settings are not provided. */ public static FlowControlSettings getDefaultFlowControlSettings() { return DEFAULT_FLOW_CONTROL_SETTINGS; diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/SubscriberShutdownSettings.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/SubscriberShutdownSettings.java new file mode 100644 index 000000000..efd8e10db --- /dev/null +++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/SubscriberShutdownSettings.java @@ -0,0 +1,102 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +package com.google.cloud.pubsub.v1; + +import com.google.common.base.Preconditions; +import java.time.Duration; + +/** + * Settings for configuring the shutdown behavior of a {@link Subscriber}. + * + *

This class allows customization of how the subscriber handles outstanding messages during + * shutdown, including whether to wait for processing to complete or to immediately nack messages, + * and an optional timeout for the shutdown process. + */ +public final class SubscriberShutdownSettings { + + /** Defines the behavior for handling outstanding messages during subscriber shutdown. */ + public enum ShutdownMode { + /** + * The subscriber will wait for all outstanding messages to be processed (acked or nacked by the + * user's message receiver) before completing the shutdown. + */ + WAIT_FOR_PROCESSING, + /** + * The subscriber will immediately nack all outstanding messages and attempt to shut down as + * quickly as possible. Messages delivered to the user callback but not yet acked/nacked will + * also be nacked. + */ + NACK_IMMEDIATELY + } + + private static final Duration DEFAULT_TIMEOUT = Duration.ofSeconds(-1); // Indicates no timeout + private static final ShutdownMode DEFAULT_MODE = ShutdownMode.WAIT_FOR_PROCESSING; + + private final ShutdownMode mode; + private final Duration timeout; + + private SubscriberShutdownSettings(Builder builder) { + this.mode = builder.mode; + this.timeout = builder.timeout; + } + + /** Returns the configured shutdown mode. */ + public ShutdownMode getMode() { + return mode; + } + + /** Returns the configured shutdown timeout. A negative duration indicates no timeout. */ + public Duration getTimeout() { + return timeout; + } + + /** Returns a new builder for {@code SubscriberShutdownSettings}. */ + public static Builder newBuilder() { + return new Builder(); + } + + /** Builder for {@code SubscriberShutdownSettings}. */ + public static final class Builder { + private ShutdownMode mode = DEFAULT_MODE; + private Duration timeout = DEFAULT_TIMEOUT; + + private Builder() {} + + /** Sets the shutdown mode. Defaults to {@link ShutdownMode#WAIT_FOR_PROCESSING}. */ + public Builder setMode(ShutdownMode mode) { + this.mode = Preconditions.checkNotNull(mode); + return this; + } + + /** + * Sets the shutdown timeout. Defaults to a negative duration, indicating no timeout. + * + *

A positive duration specifies the maximum time to wait for shutdown to complete. A + * duration of zero indicates an immediate, forceful shutdown. A negative duration indicates an + * indefinite wait. + */ + public Builder setTimeout(Duration timeout) { + this.timeout = Preconditions.checkNotNull(timeout); + return this; + } + + /** Builds an instance of {@code SubscriberShutdownSettings}. */ + public SubscriberShutdownSettings build() { + return new SubscriberShutdownSettings(this); + } + } +} diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/SubscriptionAdminClient.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/SubscriptionAdminClient.java index e0e70beb2..f22e3ec16 100644 --- a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/SubscriptionAdminClient.java +++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/SubscriptionAdminClient.java @@ -881,6 +881,7 @@ public final Subscription createSubscription( * .setAnalyticsHubSubscriptionInfo( * Subscription.AnalyticsHubSubscriptionInfo.newBuilder().build()) * .addAllMessageTransforms(new ArrayList()) + * .putAllTags(new HashMap()) * .build(); * Subscription response = subscriptionAdminClient.createSubscription(request); * } @@ -1147,6 +1148,7 @@ public final Subscription createSubscription( * .setAnalyticsHubSubscriptionInfo( * Subscription.AnalyticsHubSubscriptionInfo.newBuilder().build()) * .addAllMessageTransforms(new ArrayList()) + * .putAllTags(new HashMap()) * .build(); * ApiFuture future = * subscriptionAdminClient.createSubscriptionCallable().futureCall(request); @@ -3181,6 +3183,7 @@ public final Snapshot createSnapshot(String name, String subscription) { * .setName(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString()) * .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString()) * .putAllLabels(new HashMap()) + * .putAllTags(new HashMap()) * .build(); * Snapshot response = subscriptionAdminClient.createSnapshot(request); * } @@ -3373,6 +3376,7 @@ public final Snapshot createSnapshot(ProjectSnapshotName name, String subscripti * .setName(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString()) * .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString()) * .putAllLabels(new HashMap()) + * .putAllTags(new HashMap()) * .build(); * ApiFuture future = * subscriptionAdminClient.createSnapshotCallable().futureCall(request); diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/TopicAdminClient.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/TopicAdminClient.java index 2e635ba43..750f4da49 100644 --- a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/TopicAdminClient.java +++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/TopicAdminClient.java @@ -511,12 +511,15 @@ public final Topic createTopic(ProjectTopicName name) { * .setName(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) * .putAllLabels(new HashMap()) * .setMessageStoragePolicy(MessageStoragePolicy.newBuilder().build()) - * .setKmsKeyName("kmsKeyName412586233") + * .setKmsKeyName( + * CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]") + * .toString()) * .setSchemaSettings(SchemaSettings.newBuilder().build()) * .setSatisfiesPzs(true) * .setMessageRetentionDuration(Duration.newBuilder().build()) * .setIngestionDataSourceSettings(IngestionDataSourceSettings.newBuilder().build()) * .addAllMessageTransforms(new ArrayList()) + * .putAllTags(new HashMap()) * .build(); * Topic response = topicAdminClient.createTopic(request); * } @@ -548,12 +551,15 @@ public final Topic createTopic(Topic request) { * .setName(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) * .putAllLabels(new HashMap()) * .setMessageStoragePolicy(MessageStoragePolicy.newBuilder().build()) - * .setKmsKeyName("kmsKeyName412586233") + * .setKmsKeyName( + * CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]") + * .toString()) * .setSchemaSettings(SchemaSettings.newBuilder().build()) * .setSatisfiesPzs(true) * .setMessageRetentionDuration(Duration.newBuilder().build()) * .setIngestionDataSourceSettings(IngestionDataSourceSettings.newBuilder().build()) * .addAllMessageTransforms(new ArrayList()) + * .putAllTags(new HashMap()) * .build(); * ApiFuture future = topicAdminClient.createTopicCallable().futureCall(request); * // Do something. diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/Waiter.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/Waiter.java index e22125fee..7221d5144 100644 --- a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/Waiter.java +++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/Waiter.java @@ -16,6 +16,7 @@ package com.google.cloud.pubsub.v1; +import com.google.api.core.ApiClock; import com.google.api.core.InternalApi; /** @@ -54,6 +55,32 @@ public synchronized void waitComplete() { } } + public synchronized boolean tryWait(long timeoutMilliseconds, ApiClock clock) { + long startTime = clock.millisTime(); + long remainingMilliseconds = timeoutMilliseconds; + boolean interrupted = false; + boolean completedWait = true; + try { + while (pendingCount > 0) { + if (remainingMilliseconds <= 0) { + completedWait = false; + break; + } + try { + wait(remainingMilliseconds); + } catch (InterruptedException e) { + interrupted = true; + } + remainingMilliseconds = timeoutMilliseconds - (clock.millisTime() - startTime); + } + } finally { + if (interrupted) { + Thread.currentThread().interrupt(); + } + } + return completedWait; + } + @InternalApi public int pendingCount() { return pendingCount; diff --git a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/FakeSubscriberServiceImpl.java b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/FakeSubscriberServiceImpl.java index 173248041..3b2bd2f5d 100644 --- a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/FakeSubscriberServiceImpl.java +++ b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/FakeSubscriberServiceImpl.java @@ -24,6 +24,7 @@ import com.google.pubsub.v1.PublisherGrpc.PublisherImplBase; import com.google.pubsub.v1.PullRequest; import com.google.pubsub.v1.PullResponse; +import com.google.pubsub.v1.ReceivedMessage; import com.google.pubsub.v1.StreamingPullRequest; import com.google.pubsub.v1.StreamingPullResponse; import com.google.pubsub.v1.SubscriberGrpc.SubscriberImplBase; @@ -247,8 +248,26 @@ public void modifyAckDeadline( responseObserver.onCompleted(); } + public void sendMessages(int numMessages) throws InterruptedException { + waitForRegisteredSubscription(); + synchronized (openedStreams) { + waitForOpenedStreams(1); + Stream stream = openedStreams.get(getAndAdvanceCurrentStream()); + StreamingPullResponse.Builder response = StreamingPullResponse.newBuilder(); + for (int i = 0; i < numMessages; i++) { + response.addReceivedMessages( + ReceivedMessage.newBuilder() + .setAckId("ackid" + i) + .setMessage( + com.google.pubsub.v1.PubsubMessage.newBuilder().setMessageId("id" + i).build()) + .build()); + } + stream.responseObserver.onNext(response.build()); + } + } + public void sendError(Throwable error) throws InterruptedException { - waitForRegistedSubscription(); + waitForRegisteredSubscription(); synchronized (openedStreams) { waitForOpenedStreams(1); Stream stream = openedStreams.get(getAndAdvanceCurrentStream()); @@ -257,7 +276,7 @@ public void sendError(Throwable error) throws InterruptedException { } } - public String waitForRegistedSubscription() throws InterruptedException { + public String waitForRegisteredSubscription() throws InterruptedException { synchronized (subscriptionInitialized) { while (!subscriptionInitialized.get()) { subscriptionInitialized.wait(); diff --git a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MessageDispatcherTest.java b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MessageDispatcherTest.java index 1de156939..1285fadd5 100644 --- a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MessageDispatcherTest.java +++ b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MessageDispatcherTest.java @@ -18,6 +18,9 @@ import static com.google.common.truth.Truth.assertThat; import static org.junit.Assert.*; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.argThat; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.*; import com.google.api.gax.batching.FlowController; @@ -713,9 +716,238 @@ private MessageDispatcher getMessageDispatcherFromBuilder( .setSubscriptionName(MOCK_SUBSCRIPTION_NAME) .setSystemExecutor(systemExecutor) .setApiClock(clock) + .setSubscriberShutdownSettings(SubscriberShutdownSettings.newBuilder().build()) .build(); messageDispatcher.setMessageDeadlineSeconds(MIN_ACK_DEADLINE_SECONDS); return messageDispatcher; } + + private MessageDispatcher getMessageDispatcherFromBuilder( + MessageDispatcher.Builder builder, SubscriberShutdownSettings shutdownSettings) { + MessageDispatcher messageDispatcher = + builder + .setAckProcessor(mockAckProcessor) + .setAckExpirationPadding(ACK_EXPIRATION_PADDING_DEFAULT) + .setMaxAckExtensionPeriod(MAX_ACK_EXTENSION_PERIOD) + .setMinDurationPerAckExtension(Subscriber.DEFAULT_MIN_ACK_DEADLINE_EXTENSION) + .setMinDurationPerAckExtensionDefaultUsed(true) + .setMaxDurationPerAckExtension(Subscriber.DEFAULT_MAX_ACK_DEADLINE_EXTENSION) + .setMaxDurationPerAckExtensionDefaultUsed(true) + .setAckLatencyDistribution(mock(Distribution.class)) + .setFlowController(mock(FlowController.class)) + .setExecutor(MoreExecutors.newDirectExecutorService()) + .setSubscriptionName(MOCK_SUBSCRIPTION_NAME) + .setSystemExecutor(systemExecutor) + .setApiClock(clock) + .setSubscriberShutdownSettings(shutdownSettings) + .build(); + + messageDispatcher.setMessageDeadlineSeconds(MIN_ACK_DEADLINE_SECONDS); + return messageDispatcher; + } + + @Test + public void testStop_waitForProcessing_indefinite() throws Exception { + SubscriberShutdownSettings shutdownSettings = + SubscriberShutdownSettings.newBuilder() + .setMode(SubscriberShutdownSettings.ShutdownMode.WAIT_FOR_PROCESSING) + .setTimeout(Duration.ofSeconds(-1)) + .build(); + MessageDispatcher dispatcher = + getMessageDispatcherFromBuilder( + MessageDispatcher.newBuilder(messageReceiver), shutdownSettings); + + dispatcher.processReceivedMessages(Collections.singletonList(TEST_MESSAGE)); + + Thread stopThread = new Thread(dispatcher::stop); + stopThread.start(); + + // Wait for the stop thread to block on the waiter. + Thread.sleep(100); + assertTrue(stopThread.isAlive()); + + // Ack the message, which should allow the stop thread to complete. + consumers.take().ack(); + + List ackRequestDataList = new ArrayList(); + AckRequestData ackRequestData = AckRequestData.newBuilder(TEST_MESSAGE.getAckId()).build(); + ackRequestDataList.add(ackRequestData); + + stopThread.join(); + assertFalse(stopThread.isAlive()); + + verify(mockAckProcessor, times(1)) + .sendAckOperations( + argThat(new CustomArgumentMatchers.AckRequestDataListMatcher(ackRequestDataList))); + } + + @Test + public void testStop_waitForProcessing_withTimeout_success() { + SubscriberShutdownSettings shutdownSettings = + SubscriberShutdownSettings.newBuilder() + .setMode(SubscriberShutdownSettings.ShutdownMode.WAIT_FOR_PROCESSING) + .setTimeout(Duration.ofSeconds(5)) + .build(); + MessageDispatcher dispatcher = + getMessageDispatcherFromBuilder( + MessageDispatcher.newBuilder(messageReceiver), shutdownSettings); + + dispatcher.processReceivedMessages(Collections.singletonList(TEST_MESSAGE)); + + Thread stopThread = new Thread(dispatcher::stop); + stopThread.start(); + + // Ack the message before the timeout expires. + try { + consumers.take().ack(); + } catch (InterruptedException e) { + fail("Interrupted while taking consumer"); + } + + try { + stopThread.join(1000); + } catch (InterruptedException e) { + fail("Interrupted while joining stop thread"); + } + + List ackRequestDataList = new ArrayList(); + AckRequestData ackRequestData = AckRequestData.newBuilder(TEST_MESSAGE.getAckId()).build(); + ackRequestDataList.add(ackRequestData); + + verify(mockAckProcessor, times(1)) + .sendAckOperations( + argThat(new CustomArgumentMatchers.AckRequestDataListMatcher(ackRequestDataList))); + assertFalse(stopThread.isAlive()); + } + + @Test + public void testStop_waitForProcessing_withTimeout_nackWithOneSecondLeft() { + SubscriberShutdownSettings shutdownSettings = + SubscriberShutdownSettings.newBuilder() + .setMode(SubscriberShutdownSettings.ShutdownMode.WAIT_FOR_PROCESSING) + .setTimeout(Duration.ofSeconds(2)) + .build(); + MessageDispatcher dispatcher = + getMessageDispatcherFromBuilder( + MessageDispatcher.newBuilder(messageReceiver), shutdownSettings); + + dispatcher.processReceivedMessages(Collections.singletonList(TEST_MESSAGE)); + Thread stopThread = new Thread(dispatcher::stop); + stopThread.start(); + + // Wait for the stop thread to block on the waiter. + try { + Thread.sleep(100); + } catch (InterruptedException e) { + fail("Interrupted while sleeping"); + } + + clock.advance(1500, TimeUnit.MILLISECONDS); + + try { + stopThread.join(); + } catch (InterruptedException e) { + fail("Interrupted while joining stop thread"); + } + // Assert expected behavior + List modackRequestDataList = new ArrayList(); + modackRequestDataList.add( + new ModackRequestData(0, AckRequestData.newBuilder(TEST_MESSAGE.getAckId()).build())); + + verify(mockAckProcessor, times(1)) + .sendModackOperations( + argThat( + new CustomArgumentMatchers.ModackRequestDataListMatcher(modackRequestDataList))); + verify(mockAckProcessor, times(1)) + .sendAckOperations( + argThat(new CustomArgumentMatchers.AckRequestDataListMatcher(Collections.emptyList()))); + } + + @Test + public void testStop_nackImmediately() { + SubscriberShutdownSettings shutdownSettings = + SubscriberShutdownSettings.newBuilder() + .setMode(SubscriberShutdownSettings.ShutdownMode.NACK_IMMEDIATELY) + .build(); + MessageDispatcher dispatcher = + getMessageDispatcherFromBuilder( + MessageDispatcher.newBuilder(messageReceiver), shutdownSettings); + + dispatcher.processReceivedMessages(Collections.singletonList(TEST_MESSAGE)); + dispatcher.stop(); + + // Assert expected behavior + List modackRequestDataList = new ArrayList(); + modackRequestDataList.add( + new ModackRequestData(0, AckRequestData.newBuilder(TEST_MESSAGE.getAckId()).build())); + + verify(mockAckProcessor, times(1)) + .sendModackOperations( + argThat( + new CustomArgumentMatchers.ModackRequestDataListMatcher(modackRequestDataList))); + verify(mockAckProcessor, times(1)) + .sendAckOperations( + argThat(new CustomArgumentMatchers.AckRequestDataListMatcher(Collections.emptyList()))); + } + + @Test + public void testAckDuringNackImmediatelyShutdown() throws Exception { + SubscriberShutdownSettings shutdownSettings = + SubscriberShutdownSettings.newBuilder() + .setMode(SubscriberShutdownSettings.ShutdownMode.NACK_IMMEDIATELY) + .build(); + MessageDispatcher dispatcher = + getMessageDispatcherFromBuilder( + MessageDispatcher.newBuilder(messageReceiverWithAckResponse), shutdownSettings); + dispatcher.setExactlyOnceDeliveryEnabled(true); + + dispatcher.processReceivedMessages(Collections.singletonList(TEST_MESSAGE)); + dispatcher.processOutstandingOperations(); + + List receiptModackRequestDataList = new ArrayList(); + AckRequestData receiptModackRequestData = + AckRequestData.newBuilder(TEST_MESSAGE.getAckId()).build(); + receiptModackRequestDataList.add( + new ModackRequestData(MIN_ACK_DEADLINE_SECONDS, receiptModackRequestData)); + dispatcher.notifyAckSuccess(receiptModackRequestData); + + verify(mockAckProcessor, times(1)) + .sendModackOperations( + argThat( + new CustomArgumentMatchers.ModackRequestDataListMatcher( + receiptModackRequestDataList))); + + Thread stopThread = + new Thread( + () -> { + dispatcher.stop(); + }); + stopThread.start(); + + // Wait for the stop process to start. + while (!dispatcher.getNackImmediatelyShutdownInProgress()) { + Thread.sleep(1); + } + + // Try to ack the message. + AckResponse reply = consumersWithResponse.take().ack().get(); + assertThat(reply.equals(AckResponse.OTHER)); + + stopThread.join(); + + // Assert expected behavior + List modackRequestDataList = new ArrayList(); + modackRequestDataList.add( + new ModackRequestData(0, AckRequestData.newBuilder(TEST_MESSAGE.getAckId()).build())); + + // The message should have been nacked, not acked. + verify(mockAckProcessor, times(1)) + .sendModackOperations( + argThat( + new CustomArgumentMatchers.ModackRequestDataListMatcher(modackRequestDataList))); + verify(mockAckProcessor, times(2)) + .sendAckOperations( + argThat(new CustomArgumentMatchers.AckRequestDataListMatcher(Collections.emptyList()))); + } } diff --git a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/StreamingSubscriberConnectionTest.java b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/StreamingSubscriberConnectionTest.java index 335ccbdc3..f79825d85 100644 --- a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/StreamingSubscriberConnectionTest.java +++ b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/StreamingSubscriberConnectionTest.java @@ -17,6 +17,7 @@ package com.google.cloud.pubsub.v1; import static org.junit.Assert.*; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.argThat; import static org.mockito.Mockito.*; @@ -41,6 +42,8 @@ import java.time.Duration; import java.util.*; import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; import org.junit.After; import org.junit.Before; import org.junit.Rule; @@ -106,6 +109,110 @@ public void testSetupAndTeardown() { streamingSubscriberConnection.awaitTerminated(); } + @Test + public void testRunShutdown_TimeoutMet() throws Exception { + SubscriberShutdownSettings shutdownSettings = + SubscriberShutdownSettings.newBuilder().setTimeout(Duration.ofSeconds(10)).build(); + StreamingSubscriberConnection.Builder builder = + StreamingSubscriberConnection.newBuilder(mock(MessageReceiverWithAckResponse.class)); + builder.setSubscriberShutdownSettings(shutdownSettings); + StreamingSubscriberConnection streamingSubscriberConnection = + getStreamingSubscriberConnectionFromBuilder(builder); + + streamingSubscriberConnection.startAsync().awaitRunning(); + streamingSubscriberConnection.stopAsync(); + + // Should terminate quickly as there are no outstanding messages. + streamingSubscriberConnection.awaitTerminated(1, TimeUnit.SECONDS); + } + + @Test + public void testRunShutdown_TimeoutExceeded() throws Exception { + final SettableApiFuture ackFuture = SettableApiFuture.create(); + when(mockSubscriberStub.acknowledgeCallable().futureCall(any(AcknowledgeRequest.class))) + .thenReturn(ackFuture); + + SubscriberShutdownSettings shutdownSettings = + SubscriberShutdownSettings.newBuilder().setTimeout(Duration.ofSeconds(2)).build(); + StreamingSubscriberConnection.Builder builder = + StreamingSubscriberConnection.newBuilder(mock(MessageReceiverWithAckResponse.class)); + StreamingSubscriberConnection streamingSubscriberConnection = + getStreamingSubscriberConnectionFromBuilder(builder, shutdownSettings); + streamingSubscriberConnection.setExactlyOnceDeliveryEnabled(true); + + streamingSubscriberConnection.startAsync().awaitRunning(); + + // Send an ACK that will not complete. + SettableApiFuture messageFuture = SettableApiFuture.create(); + streamingSubscriberConnection.sendAckOperations( + Collections.singletonList( + AckRequestData.newBuilder("ack1").setMessageFuture(messageFuture).build())); + + Thread t = + new Thread( + () -> { + streamingSubscriberConnection.stopAsync(); + }); + t.start(); + + Thread t2 = + new Thread( + () -> { + try { + streamingSubscriberConnection.awaitTerminated(1, TimeUnit.SECONDS); + fail("Should have timed out"); + } catch (TimeoutException e) { + // expected + } + }); + t2.start(); + t2.join(); + + // Advance the clock past the shutdown timeout. + clock.advance(3, TimeUnit.SECONDS); + t.join(); + + // Now it should terminate. + streamingSubscriberConnection.awaitTerminated(); + assertFalse(streamingSubscriberConnection.isRunning()); + assertFalse(messageFuture.isDone()); + } + + @Test + public void testAckDuringNackImmediatelyShutdown() throws Exception { + SubscriberShutdownSettings shutdownSettings = + SubscriberShutdownSettings.newBuilder() + .setMode(SubscriberShutdownSettings.ShutdownMode.NACK_IMMEDIATELY) + .build(); + + MessageDispatcher mockMessageDispatcher = mock(MessageDispatcher.class); + when(mockMessageDispatcher.getNackImmediatelyShutdownInProgress()).thenReturn(true); + + StreamingSubscriberConnection.Builder builder = + StreamingSubscriberConnection.newBuilder(mock(MessageReceiverWithAckResponse.class)); + StreamingSubscriberConnection streamingSubscriberConnection = + getStreamingSubscriberConnectionFromBuilder(builder, shutdownSettings); + + // Use reflection to set the mock message dispatcher + java.lang.reflect.Field dispatcherField = + StreamingSubscriberConnection.class.getDeclaredField("messageDispatcher"); + dispatcherField.setAccessible(true); + dispatcherField.set(streamingSubscriberConnection, mockMessageDispatcher); + + streamingSubscriberConnection.setExactlyOnceDeliveryEnabled(true); + + SettableApiFuture messageFuture = SettableApiFuture.create(); + AckRequestData ackRequestData = + AckRequestData.newBuilder("ack1").setMessageFuture(messageFuture).build(); + + when(mockSubscriberStub.acknowledgeCallable().futureCall(any())) + .thenReturn(ApiFutures.immediateFuture(null)); + streamingSubscriberConnection.sendAckOperations(Collections.singletonList(ackRequestData)); + + verify(mockMessageDispatcher, times(1)).notifyAckFailed(ackRequestData); + assertEquals(AckResponse.OTHER, messageFuture.get()); + } + @Test public void testSendAckOperationsExactlyOnceDisabledNoMessageFutures() { // Setup mocks @@ -592,6 +699,28 @@ private StreamingSubscriberConnection getStreamingSubscriberConnectionFromBuilde .setMinDurationPerAckExtensionDefaultUsed(true) .setMaxDurationPerAckExtension(Subscriber.DEFAULT_MAX_ACK_DEADLINE_EXTENSION) .setMaxDurationPerAckExtensionDefaultUsed(true) + .setSubscriberShutdownSettings(SubscriberShutdownSettings.newBuilder().build()) + .build(); + } + + private StreamingSubscriberConnection getStreamingSubscriberConnectionFromBuilder( + StreamingSubscriberConnection.Builder builder, SubscriberShutdownSettings shutdownSettings) { + return builder + .setSubscription(MOCK_SUBSCRIPTION_NAME) + .setAckExpirationPadding(ACK_EXPIRATION_PADDING_DEFAULT_DURATION) + .setAckLatencyDistribution(mock(Distribution.class)) + .setSubscriberStub(mockSubscriberStub) + .setChannelAffinity(0) + .setFlowControlSettings(mock(FlowControlSettings.class)) + .setFlowController(mock(FlowController.class)) + .setExecutor(executor) + .setSystemExecutor(systemExecutor) + .setClock(clock) + .setMinDurationPerAckExtension(Subscriber.DEFAULT_MIN_ACK_DEADLINE_EXTENSION) + .setMinDurationPerAckExtensionDefaultUsed(true) + .setMaxDurationPerAckExtension(Subscriber.DEFAULT_MAX_ACK_DEADLINE_EXTENSION) + .setMaxDurationPerAckExtensionDefaultUsed(true) + .setSubscriberShutdownSettings(shutdownSettings) .build(); } diff --git a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/SubscriberShutdownSettingsTest.java b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/SubscriberShutdownSettingsTest.java new file mode 100644 index 000000000..f82937582 --- /dev/null +++ b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/SubscriberShutdownSettingsTest.java @@ -0,0 +1,100 @@ +/* + * Copyright 2025 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. + */ + +package com.google.cloud.pubsub.v1; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import com.google.cloud.pubsub.v1.SubscriberShutdownSettings.ShutdownMode; +import java.time.Duration; +import org.junit.Test; + +public class SubscriberShutdownSettingsTest { + + @Test + public void testDefaultSettings() { + SubscriberShutdownSettings settings = SubscriberShutdownSettings.newBuilder().build(); + + assertNotNull(settings); + assertEquals(ShutdownMode.WAIT_FOR_PROCESSING, settings.getMode()); + assertTrue(settings.getTimeout().isNegative()); // Indefinite timeout + } + + @Test + public void testWaitForProcessingWithCustomTimeout() { + Duration customTimeout = Duration.ofSeconds(30); + SubscriberShutdownSettings settings = + SubscriberShutdownSettings.newBuilder() + .setMode(ShutdownMode.WAIT_FOR_PROCESSING) + .setTimeout(customTimeout) + .build(); + + assertNotNull(settings); + assertEquals(ShutdownMode.WAIT_FOR_PROCESSING, settings.getMode()); + assertEquals(customTimeout, settings.getTimeout()); + } + + @Test + public void testNackImmediatelyWithDefaultTimeout() { + SubscriberShutdownSettings settings = + SubscriberShutdownSettings.newBuilder().setMode(ShutdownMode.NACK_IMMEDIATELY).build(); + + assertNotNull(settings); + assertEquals(ShutdownMode.NACK_IMMEDIATELY, settings.getMode()); + assertTrue(settings.getTimeout().isNegative()); // Indefinite timeout + } + + @Test + public void testNackImmediatelyWithCustomTimeout() { + Duration customTimeout = Duration.ofSeconds(10); + SubscriberShutdownSettings settings = + SubscriberShutdownSettings.newBuilder() + .setMode(ShutdownMode.NACK_IMMEDIATELY) + .setTimeout(customTimeout) + .build(); + + assertNotNull(settings); + assertEquals(ShutdownMode.NACK_IMMEDIATELY, settings.getMode()); + assertEquals(customTimeout, settings.getTimeout()); + } + + @Test + public void testZeroTimeout() { + Duration zeroTimeout = Duration.ZERO; + SubscriberShutdownSettings settings = + SubscriberShutdownSettings.newBuilder() + .setMode(ShutdownMode.WAIT_FOR_PROCESSING) + .setTimeout(zeroTimeout) + .build(); + + assertNotNull(settings); + assertEquals(ShutdownMode.WAIT_FOR_PROCESSING, settings.getMode()); + assertEquals(zeroTimeout, settings.getTimeout()); + assertTrue(settings.getTimeout().isZero()); + } + + @Test(expected = NullPointerException.class) + public void testNullModeThrowsException() { + SubscriberShutdownSettings.newBuilder().setMode(null).build(); + } + + @Test(expected = NullPointerException.class) + public void testNullTimeoutThrowsException() { + SubscriberShutdownSettings.newBuilder().setTimeout(null).build(); + } +} diff --git a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/SubscriberTest.java b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/SubscriberTest.java index 253a91f73..649769d1c 100644 --- a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/SubscriberTest.java +++ b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/SubscriberTest.java @@ -320,6 +320,104 @@ public void testPartialFlowControlSettings() throws Exception { Subscriber.Builder.DEFAULT_FLOW_CONTROL_SETTINGS.getMaxOutstandingElementCount()); } + @Test + public void testShutdown_waitForProcessing_indefinite() throws Exception { + final CountDownLatch messageReceived = new CountDownLatch(1); + final AckReplyConsumer[] consumer = new AckReplyConsumer[1]; + + MessageReceiver receiver = + new MessageReceiver() { + @Override + public void receiveMessage(PubsubMessage message, AckReplyConsumer c) { + consumer[0] = c; + messageReceived.countDown(); + } + }; + + Subscriber subscriber = + startSubscriber( + getTestSubscriberBuilder(receiver) + .setSubscriberShutdownSettings( + SubscriberShutdownSettings.newBuilder() + .setMode(SubscriberShutdownSettings.ShutdownMode.WAIT_FOR_PROCESSING) + .setTimeout(Duration.ofSeconds(-1)) + .build())); + + // Send a message and wait for it to be received. + fakeSubscriberServiceImpl.sendMessages(1); + messageReceived.await(10, TimeUnit.SECONDS); + + subscriber.stopAsync(); + + try { + subscriber.awaitTerminated(1, TimeUnit.SECONDS); + fail("Subscriber should not have terminated yet."); + } catch (TimeoutException e) { + // Expected + } + + // Now, ack the message, which should allow the subscriber to terminate. + consumer[0].ack(); + subscriber.awaitTerminated(10, TimeUnit.SECONDS); + } + + @Test + public void testShutdown_waitForProcessing_withTimeout_success() throws Exception { + Subscriber subscriber = + startSubscriber( + getTestSubscriberBuilder(testReceiver) + .setSubscriberShutdownSettings( + SubscriberShutdownSettings.newBuilder() + .setMode(SubscriberShutdownSettings.ShutdownMode.WAIT_FOR_PROCESSING) + .setTimeout(Duration.ofSeconds(10)) + .build())); + subscriber.stopAsync(); + fakeExecutor.advanceTime(Duration.ofSeconds(5)); + subscriber.awaitTerminated(1, TimeUnit.SECONDS); // Should terminate quickly now + } + + @Test + public void testShutdown_waitForProcessing_withTimeout_failure() throws Exception { + Subscriber subscriber = + startSubscriber( + getTestSubscriberBuilder(testReceiver) + .setSubscriberShutdownSettings( + SubscriberShutdownSettings.newBuilder() + .setMode(SubscriberShutdownSettings.ShutdownMode.WAIT_FOR_PROCESSING) + .setTimeout(Duration.ofSeconds(5)) + .build())); + subscriber.stopAsync(); + fakeExecutor.advanceTime(Duration.ofSeconds(6)); + subscriber.awaitTerminated(1, TimeUnit.SECONDS); // Should have timed out and terminated + } + + @Test + public void testShutdown_waitForProcessing_zeroTimeout() throws Exception { + Subscriber subscriber = + startSubscriber( + getTestSubscriberBuilder(testReceiver) + .setSubscriberShutdownSettings( + SubscriberShutdownSettings.newBuilder() + .setMode(SubscriberShutdownSettings.ShutdownMode.WAIT_FOR_PROCESSING) + .setTimeout(Duration.ZERO) + .build())); + subscriber.stopAsync(); + subscriber.awaitTerminated(1, TimeUnit.SECONDS); // Should terminate almost immediately + } + + @Test + public void testShutdown_nackImmediately() throws Exception { + Subscriber subscriber = + startSubscriber( + getTestSubscriberBuilder(testReceiver) + .setSubscriberShutdownSettings( + SubscriberShutdownSettings.newBuilder() + .setMode(SubscriberShutdownSettings.ShutdownMode.NACK_IMMEDIATELY) + .build())); + subscriber.stopAsync(); + subscriber.awaitTerminated(1, TimeUnit.SECONDS); // Should terminate almost immediately + } + private Subscriber startSubscriber(Builder testSubscriberBuilder) { Subscriber subscriber = testSubscriberBuilder.build(); subscriber.startAsync().awaitRunning(); diff --git a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/SubscriptionAdminClientHttpJsonTest.java b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/SubscriptionAdminClientHttpJsonTest.java index 711c8da98..860eb95ce 100644 --- a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/SubscriptionAdminClientHttpJsonTest.java +++ b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/SubscriptionAdminClientHttpJsonTest.java @@ -135,6 +135,7 @@ public void createSubscriptionTest() throws Exception { .setAnalyticsHubSubscriptionInfo( Subscription.AnalyticsHubSubscriptionInfo.newBuilder().build()) .addAllMessageTransforms(new ArrayList()) + .putAllTags(new HashMap()) .build(); mockService.addResponse(expectedResponse); @@ -205,6 +206,7 @@ public void createSubscriptionTest2() throws Exception { .setAnalyticsHubSubscriptionInfo( Subscription.AnalyticsHubSubscriptionInfo.newBuilder().build()) .addAllMessageTransforms(new ArrayList()) + .putAllTags(new HashMap()) .build(); mockService.addResponse(expectedResponse); @@ -275,6 +277,7 @@ public void createSubscriptionTest3() throws Exception { .setAnalyticsHubSubscriptionInfo( Subscription.AnalyticsHubSubscriptionInfo.newBuilder().build()) .addAllMessageTransforms(new ArrayList()) + .putAllTags(new HashMap()) .build(); mockService.addResponse(expectedResponse); @@ -345,6 +348,7 @@ public void createSubscriptionTest4() throws Exception { .setAnalyticsHubSubscriptionInfo( Subscription.AnalyticsHubSubscriptionInfo.newBuilder().build()) .addAllMessageTransforms(new ArrayList()) + .putAllTags(new HashMap()) .build(); mockService.addResponse(expectedResponse); @@ -415,6 +419,7 @@ public void getSubscriptionTest() throws Exception { .setAnalyticsHubSubscriptionInfo( Subscription.AnalyticsHubSubscriptionInfo.newBuilder().build()) .addAllMessageTransforms(new ArrayList()) + .putAllTags(new HashMap()) .build(); mockService.addResponse(expectedResponse); @@ -478,6 +483,7 @@ public void getSubscriptionTest2() throws Exception { .setAnalyticsHubSubscriptionInfo( Subscription.AnalyticsHubSubscriptionInfo.newBuilder().build()) .addAllMessageTransforms(new ArrayList()) + .putAllTags(new HashMap()) .build(); mockService.addResponse(expectedResponse); @@ -541,6 +547,7 @@ public void updateSubscriptionTest() throws Exception { .setAnalyticsHubSubscriptionInfo( Subscription.AnalyticsHubSubscriptionInfo.newBuilder().build()) .addAllMessageTransforms(new ArrayList()) + .putAllTags(new HashMap()) .build(); mockService.addResponse(expectedResponse); @@ -566,6 +573,7 @@ public void updateSubscriptionTest() throws Exception { .setAnalyticsHubSubscriptionInfo( Subscription.AnalyticsHubSubscriptionInfo.newBuilder().build()) .addAllMessageTransforms(new ArrayList()) + .putAllTags(new HashMap()) .build(); FieldMask updateMask = FieldMask.newBuilder().build(); @@ -617,6 +625,7 @@ public void updateSubscriptionExceptionTest() throws Exception { .setAnalyticsHubSubscriptionInfo( Subscription.AnalyticsHubSubscriptionInfo.newBuilder().build()) .addAllMessageTransforms(new ArrayList()) + .putAllTags(new HashMap()) .build(); FieldMask updateMask = FieldMask.newBuilder().build(); client.updateSubscription(subscription, updateMask); diff --git a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/SubscriptionAdminClientTest.java b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/SubscriptionAdminClientTest.java index c7d13c720..480e7ceaa 100644 --- a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/SubscriptionAdminClientTest.java +++ b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/SubscriptionAdminClientTest.java @@ -161,6 +161,7 @@ public void createSubscriptionTest() throws Exception { .setAnalyticsHubSubscriptionInfo( Subscription.AnalyticsHubSubscriptionInfo.newBuilder().build()) .addAllMessageTransforms(new ArrayList()) + .putAllTags(new HashMap()) .build(); mockSubscriber.addResponse(expectedResponse); @@ -228,6 +229,7 @@ public void createSubscriptionTest2() throws Exception { .setAnalyticsHubSubscriptionInfo( Subscription.AnalyticsHubSubscriptionInfo.newBuilder().build()) .addAllMessageTransforms(new ArrayList()) + .putAllTags(new HashMap()) .build(); mockSubscriber.addResponse(expectedResponse); @@ -295,6 +297,7 @@ public void createSubscriptionTest3() throws Exception { .setAnalyticsHubSubscriptionInfo( Subscription.AnalyticsHubSubscriptionInfo.newBuilder().build()) .addAllMessageTransforms(new ArrayList()) + .putAllTags(new HashMap()) .build(); mockSubscriber.addResponse(expectedResponse); @@ -362,6 +365,7 @@ public void createSubscriptionTest4() throws Exception { .setAnalyticsHubSubscriptionInfo( Subscription.AnalyticsHubSubscriptionInfo.newBuilder().build()) .addAllMessageTransforms(new ArrayList()) + .putAllTags(new HashMap()) .build(); mockSubscriber.addResponse(expectedResponse); @@ -429,6 +433,7 @@ public void getSubscriptionTest() throws Exception { .setAnalyticsHubSubscriptionInfo( Subscription.AnalyticsHubSubscriptionInfo.newBuilder().build()) .addAllMessageTransforms(new ArrayList()) + .putAllTags(new HashMap()) .build(); mockSubscriber.addResponse(expectedResponse); @@ -486,6 +491,7 @@ public void getSubscriptionTest2() throws Exception { .setAnalyticsHubSubscriptionInfo( Subscription.AnalyticsHubSubscriptionInfo.newBuilder().build()) .addAllMessageTransforms(new ArrayList()) + .putAllTags(new HashMap()) .build(); mockSubscriber.addResponse(expectedResponse); @@ -543,6 +549,7 @@ public void updateSubscriptionTest() throws Exception { .setAnalyticsHubSubscriptionInfo( Subscription.AnalyticsHubSubscriptionInfo.newBuilder().build()) .addAllMessageTransforms(new ArrayList()) + .putAllTags(new HashMap()) .build(); mockSubscriber.addResponse(expectedResponse); diff --git a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/TopicAdminClientHttpJsonTest.java b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/TopicAdminClientHttpJsonTest.java index 5a1e1e68a..44488abc6 100644 --- a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/TopicAdminClientHttpJsonTest.java +++ b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/TopicAdminClientHttpJsonTest.java @@ -43,6 +43,7 @@ import com.google.protobuf.Duration; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; +import com.google.pubsub.v1.CryptoKeyName; import com.google.pubsub.v1.DetachSubscriptionRequest; import com.google.pubsub.v1.DetachSubscriptionResponse; import com.google.pubsub.v1.IngestionDataSourceSettings; @@ -113,12 +114,15 @@ public void createTopicTest() throws Exception { .setName(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) .putAllLabels(new HashMap()) .setMessageStoragePolicy(MessageStoragePolicy.newBuilder().build()) - .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyName( + CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]") + .toString()) .setSchemaSettings(SchemaSettings.newBuilder().build()) .setSatisfiesPzs(true) .setMessageRetentionDuration(Duration.newBuilder().build()) .setIngestionDataSourceSettings(IngestionDataSourceSettings.newBuilder().build()) .addAllMessageTransforms(new ArrayList()) + .putAllTags(new HashMap()) .build(); mockService.addResponse(expectedResponse); @@ -165,12 +169,15 @@ public void createTopicTest2() throws Exception { .setName(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) .putAllLabels(new HashMap()) .setMessageStoragePolicy(MessageStoragePolicy.newBuilder().build()) - .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyName( + CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]") + .toString()) .setSchemaSettings(SchemaSettings.newBuilder().build()) .setSatisfiesPzs(true) .setMessageRetentionDuration(Duration.newBuilder().build()) .setIngestionDataSourceSettings(IngestionDataSourceSettings.newBuilder().build()) .addAllMessageTransforms(new ArrayList()) + .putAllTags(new HashMap()) .build(); mockService.addResponse(expectedResponse); @@ -217,12 +224,15 @@ public void updateTopicTest() throws Exception { .setName(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) .putAllLabels(new HashMap()) .setMessageStoragePolicy(MessageStoragePolicy.newBuilder().build()) - .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyName( + CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]") + .toString()) .setSchemaSettings(SchemaSettings.newBuilder().build()) .setSatisfiesPzs(true) .setMessageRetentionDuration(Duration.newBuilder().build()) .setIngestionDataSourceSettings(IngestionDataSourceSettings.newBuilder().build()) .addAllMessageTransforms(new ArrayList()) + .putAllTags(new HashMap()) .build(); mockService.addResponse(expectedResponse); @@ -231,12 +241,15 @@ public void updateTopicTest() throws Exception { .setName(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) .putAllLabels(new HashMap()) .setMessageStoragePolicy(MessageStoragePolicy.newBuilder().build()) - .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyName( + CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]") + .toString()) .setSchemaSettings(SchemaSettings.newBuilder().build()) .setSatisfiesPzs(true) .setMessageRetentionDuration(Duration.newBuilder().build()) .setIngestionDataSourceSettings(IngestionDataSourceSettings.newBuilder().build()) .addAllMessageTransforms(new ArrayList()) + .putAllTags(new HashMap()) .build(); FieldMask updateMask = FieldMask.newBuilder().build(); @@ -271,12 +284,15 @@ public void updateTopicExceptionTest() throws Exception { .setName(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) .putAllLabels(new HashMap()) .setMessageStoragePolicy(MessageStoragePolicy.newBuilder().build()) - .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyName( + CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]") + .toString()) .setSchemaSettings(SchemaSettings.newBuilder().build()) .setSatisfiesPzs(true) .setMessageRetentionDuration(Duration.newBuilder().build()) .setIngestionDataSourceSettings(IngestionDataSourceSettings.newBuilder().build()) .addAllMessageTransforms(new ArrayList()) + .putAllTags(new HashMap()) .build(); FieldMask updateMask = FieldMask.newBuilder().build(); client.updateTopic(topic, updateMask); @@ -381,12 +397,15 @@ public void getTopicTest() throws Exception { .setName(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) .putAllLabels(new HashMap()) .setMessageStoragePolicy(MessageStoragePolicy.newBuilder().build()) - .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyName( + CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]") + .toString()) .setSchemaSettings(SchemaSettings.newBuilder().build()) .setSatisfiesPzs(true) .setMessageRetentionDuration(Duration.newBuilder().build()) .setIngestionDataSourceSettings(IngestionDataSourceSettings.newBuilder().build()) .addAllMessageTransforms(new ArrayList()) + .putAllTags(new HashMap()) .build(); mockService.addResponse(expectedResponse); @@ -433,12 +452,15 @@ public void getTopicTest2() throws Exception { .setName(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) .putAllLabels(new HashMap()) .setMessageStoragePolicy(MessageStoragePolicy.newBuilder().build()) - .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyName( + CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]") + .toString()) .setSchemaSettings(SchemaSettings.newBuilder().build()) .setSatisfiesPzs(true) .setMessageRetentionDuration(Duration.newBuilder().build()) .setIngestionDataSourceSettings(IngestionDataSourceSettings.newBuilder().build()) .addAllMessageTransforms(new ArrayList()) + .putAllTags(new HashMap()) .build(); mockService.addResponse(expectedResponse); diff --git a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/TopicAdminClientTest.java b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/TopicAdminClientTest.java index d1e05afde..2ad693de3 100644 --- a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/TopicAdminClientTest.java +++ b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/TopicAdminClientTest.java @@ -41,6 +41,7 @@ import com.google.protobuf.Duration; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; +import com.google.pubsub.v1.CryptoKeyName; import com.google.pubsub.v1.DeleteTopicRequest; import com.google.pubsub.v1.DetachSubscriptionRequest; import com.google.pubsub.v1.DetachSubscriptionResponse; @@ -127,12 +128,15 @@ public void createTopicTest() throws Exception { .setName(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) .putAllLabels(new HashMap()) .setMessageStoragePolicy(MessageStoragePolicy.newBuilder().build()) - .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyName( + CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]") + .toString()) .setSchemaSettings(SchemaSettings.newBuilder().build()) .setSatisfiesPzs(true) .setMessageRetentionDuration(Duration.newBuilder().build()) .setIngestionDataSourceSettings(IngestionDataSourceSettings.newBuilder().build()) .addAllMessageTransforms(new ArrayList()) + .putAllTags(new HashMap()) .build(); mockPublisher.addResponse(expectedResponse); @@ -173,12 +177,15 @@ public void createTopicTest2() throws Exception { .setName(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) .putAllLabels(new HashMap()) .setMessageStoragePolicy(MessageStoragePolicy.newBuilder().build()) - .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyName( + CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]") + .toString()) .setSchemaSettings(SchemaSettings.newBuilder().build()) .setSatisfiesPzs(true) .setMessageRetentionDuration(Duration.newBuilder().build()) .setIngestionDataSourceSettings(IngestionDataSourceSettings.newBuilder().build()) .addAllMessageTransforms(new ArrayList()) + .putAllTags(new HashMap()) .build(); mockPublisher.addResponse(expectedResponse); @@ -219,12 +226,15 @@ public void updateTopicTest() throws Exception { .setName(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) .putAllLabels(new HashMap()) .setMessageStoragePolicy(MessageStoragePolicy.newBuilder().build()) - .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyName( + CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]") + .toString()) .setSchemaSettings(SchemaSettings.newBuilder().build()) .setSatisfiesPzs(true) .setMessageRetentionDuration(Duration.newBuilder().build()) .setIngestionDataSourceSettings(IngestionDataSourceSettings.newBuilder().build()) .addAllMessageTransforms(new ArrayList()) + .putAllTags(new HashMap()) .build(); mockPublisher.addResponse(expectedResponse); @@ -346,12 +356,15 @@ public void getTopicTest() throws Exception { .setName(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) .putAllLabels(new HashMap()) .setMessageStoragePolicy(MessageStoragePolicy.newBuilder().build()) - .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyName( + CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]") + .toString()) .setSchemaSettings(SchemaSettings.newBuilder().build()) .setSatisfiesPzs(true) .setMessageRetentionDuration(Duration.newBuilder().build()) .setIngestionDataSourceSettings(IngestionDataSourceSettings.newBuilder().build()) .addAllMessageTransforms(new ArrayList()) + .putAllTags(new HashMap()) .build(); mockPublisher.addResponse(expectedResponse); @@ -392,12 +405,15 @@ public void getTopicTest2() throws Exception { .setName(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) .putAllLabels(new HashMap()) .setMessageStoragePolicy(MessageStoragePolicy.newBuilder().build()) - .setKmsKeyName("kmsKeyName412586233") + .setKmsKeyName( + CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]") + .toString()) .setSchemaSettings(SchemaSettings.newBuilder().build()) .setSatisfiesPzs(true) .setMessageRetentionDuration(Duration.newBuilder().build()) .setIngestionDataSourceSettings(IngestionDataSourceSettings.newBuilder().build()) .addAllMessageTransforms(new ArrayList()) + .putAllTags(new HashMap()) .build(); mockPublisher.addResponse(expectedResponse); diff --git a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/WaiterTest.java b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/WaiterTest.java index ca8618378..c9eed7e16 100644 --- a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/WaiterTest.java +++ b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/WaiterTest.java @@ -17,7 +17,10 @@ package com.google.cloud.pubsub.v1; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import java.util.concurrent.TimeUnit; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @@ -50,4 +53,47 @@ public void run() { assertEquals(0, waiter.pendingCount()); } + + @Test + public void testTryWait_Completes() { + final Waiter waiter = new Waiter(); + waiter.incrementPendingCount(1); + final FakeClock clock = new FakeClock(); + + Thread t = + new Thread( + () -> { + try { + Thread.sleep(100); + } catch (InterruptedException e) { + } + waiter.incrementPendingCount(-1); + }); + t.start(); + + assertTrue(waiter.tryWait(500, clock)); + } + + @Test + public void testTryWait_TimesOut() { + final Waiter waiter = new Waiter(); + waiter.incrementPendingCount(1); + final FakeClock clock = new FakeClock(); + + Thread t = + new Thread( + () -> { + clock.advance(100, TimeUnit.MILLISECONDS); + }); + t.start(); + + assertFalse(waiter.tryWait(100, clock)); + } + + @Test + public void testTryWait_NoPending() { + final Waiter waiter = new Waiter(); + final FakeClock clock = new FakeClock(); + assertTrue(waiter.tryWait(100, clock)); + } } diff --git a/grpc-google-cloud-pubsub-v1/pom.xml b/grpc-google-cloud-pubsub-v1/pom.xml index 9c877b80c..7cb6e8fe2 100644 --- a/grpc-google-cloud-pubsub-v1/pom.xml +++ b/grpc-google-cloud-pubsub-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-pubsub-v1 - 1.124.0 + 1.125.0 grpc-google-cloud-pubsub-v1 GRPC library for grpc-google-cloud-pubsub-v1 com.google.cloud google-cloud-pubsub-parent - 1.142.0 + 1.143.0 diff --git a/pom.xml b/pom.xml index 3493ec8a6..8c63f6dc9 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-pubsub-parent pom - 1.142.0 + 1.143.0 Google Cloud Pub/Sub Parent https://github.com/googleapis/java-pubsub @@ -14,7 +14,7 @@ com.google.cloud sdk-platform-java-config - 3.52.3 + 3.53.0 @@ -69,17 +69,17 @@ com.google.api.grpc proto-google-cloud-pubsub-v1 - 1.124.0 + 1.125.0 com.google.api.grpc grpc-google-cloud-pubsub-v1 - 1.124.0 + 1.125.0 com.google.cloud google-cloud-pubsub - 1.142.0 + 1.143.0 diff --git a/proto-google-cloud-pubsub-v1/pom.xml b/proto-google-cloud-pubsub-v1/pom.xml index dd40d7622..ee3d27b32 100644 --- a/proto-google-cloud-pubsub-v1/pom.xml +++ b/proto-google-cloud-pubsub-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-pubsub-v1 - 1.124.0 + 1.125.0 proto-google-cloud-pubsub-v1 PROTO library for proto-google-cloud-pubsub-v1 com.google.cloud google-cloud-pubsub-parent - 1.142.0 + 1.143.0 diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/CreateSnapshotRequest.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/CreateSnapshotRequest.java index 079f3344b..e5d4f651c 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/CreateSnapshotRequest.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/CreateSnapshotRequest.java @@ -62,6 +62,8 @@ protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldRefl switch (number) { case 3: return internalGetLabels(); + case 4: + return internalGetTags(); default: throw new RuntimeException("Invalid map field number: " + number); } @@ -328,6 +330,133 @@ public java.lang.String getLabelsOrThrow(java.lang.String key) { return map.get(key); } + public static final int TAGS_FIELD_NUMBER = 4; + + private static final class TagsDefaultEntryHolder { + static final com.google.protobuf.MapEntry defaultEntry = + com.google.protobuf.MapEntry.newDefaultInstance( + com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_CreateSnapshotRequest_TagsEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.STRING, + ""); + } + + @SuppressWarnings("serial") + private com.google.protobuf.MapField tags_; + + private com.google.protobuf.MapField internalGetTags() { + if (tags_ == null) { + return com.google.protobuf.MapField.emptyMapField(TagsDefaultEntryHolder.defaultEntry); + } + return tags_; + } + + public int getTagsCount() { + return internalGetTags().getMap().size(); + } + + /** + * + * + *

+   * Optional. Input only. Immutable. Tag keys/values directly bound to this
+   * resource. For example:
+   *   "123/environment": "production",
+   *   "123/costCenter": "marketing"
+   * 
+ * + * + * map<string, string> tags = 4 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public boolean containsTags(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetTags().getMap().containsKey(key); + } + + /** Use {@link #getTagsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getTags() { + return getTagsMap(); + } + + /** + * + * + *
+   * Optional. Input only. Immutable. Tag keys/values directly bound to this
+   * resource. For example:
+   *   "123/environment": "production",
+   *   "123/costCenter": "marketing"
+   * 
+ * + * + * map<string, string> tags = 4 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public java.util.Map getTagsMap() { + return internalGetTags().getMap(); + } + + /** + * + * + *
+   * Optional. Input only. Immutable. Tag keys/values directly bound to this
+   * resource. For example:
+   *   "123/environment": "production",
+   *   "123/costCenter": "marketing"
+   * 
+ * + * + * map<string, string> tags = 4 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public /* nullable */ java.lang.String getTagsOrDefault( + java.lang.String key, + /* nullable */ + java.lang.String defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetTags().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + + /** + * + * + *
+   * Optional. Input only. Immutable. Tag keys/values directly bound to this
+   * resource. For example:
+   *   "123/environment": "production",
+   *   "123/costCenter": "marketing"
+   * 
+ * + * + * map<string, string> tags = 4 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public java.lang.String getTagsOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetTags().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -350,6 +479,8 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io } com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( output, internalGetLabels(), LabelsDefaultEntryHolder.defaultEntry, 3); + com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( + output, internalGetTags(), TagsDefaultEntryHolder.defaultEntry, 4); getUnknownFields().writeTo(output); } @@ -375,6 +506,16 @@ public int getSerializedSize() { .build(); size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, labels__); } + for (java.util.Map.Entry entry : + internalGetTags().getMap().entrySet()) { + com.google.protobuf.MapEntry tags__ = + TagsDefaultEntryHolder.defaultEntry + .newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, tags__); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -394,6 +535,7 @@ public boolean equals(final java.lang.Object obj) { if (!getName().equals(other.getName())) return false; if (!getSubscription().equals(other.getSubscription())) return false; if (!internalGetLabels().equals(other.internalGetLabels())) return false; + if (!internalGetTags().equals(other.internalGetTags())) return false; if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -413,6 +555,10 @@ public int hashCode() { hash = (37 * hash) + LABELS_FIELD_NUMBER; hash = (53 * hash) + internalGetLabels().hashCode(); } + if (!internalGetTags().getMap().isEmpty()) { + hash = (37 * hash) + TAGS_FIELD_NUMBER; + hash = (53 * hash) + internalGetTags().hashCode(); + } hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; @@ -538,6 +684,8 @@ protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldRefl switch (number) { case 3: return internalGetLabels(); + case 4: + return internalGetTags(); default: throw new RuntimeException("Invalid map field number: " + number); } @@ -549,6 +697,8 @@ protected com.google.protobuf.MapFieldReflectionAccessor internalGetMutableMapFi switch (number) { case 3: return internalGetMutableLabels(); + case 4: + return internalGetMutableTags(); default: throw new RuntimeException("Invalid map field number: " + number); } @@ -578,6 +728,7 @@ public Builder clear() { name_ = ""; subscription_ = ""; internalGetMutableLabels().clear(); + internalGetMutableTags().clear(); return this; } @@ -624,6 +775,10 @@ private void buildPartial0(com.google.pubsub.v1.CreateSnapshotRequest result) { result.labels_ = internalGetLabels(); result.labels_.makeImmutable(); } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.tags_ = internalGetTags(); + result.tags_.makeImmutable(); + } } @java.lang.Override @@ -683,6 +838,8 @@ public Builder mergeFrom(com.google.pubsub.v1.CreateSnapshotRequest other) { } internalGetMutableLabels().mergeFrom(other.internalGetLabels()); bitField0_ |= 0x00000004; + internalGetMutableTags().mergeFrom(other.internalGetTags()); + bitField0_ |= 0x00000008; this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; @@ -733,6 +890,15 @@ public Builder mergeFrom( bitField0_ |= 0x00000004; break; } // case 26 + case 34: + { + com.google.protobuf.MapEntry tags__ = + input.readMessage( + TagsDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry); + internalGetMutableTags().getMutableMap().put(tags__.getKey(), tags__.getValue()); + bitField0_ |= 0x00000008; + break; + } // case 34 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { @@ -1238,6 +1404,213 @@ public Builder putAllLabels(java.util.Map va return this; } + private com.google.protobuf.MapField tags_; + + private com.google.protobuf.MapField internalGetTags() { + if (tags_ == null) { + return com.google.protobuf.MapField.emptyMapField(TagsDefaultEntryHolder.defaultEntry); + } + return tags_; + } + + private com.google.protobuf.MapField + internalGetMutableTags() { + if (tags_ == null) { + tags_ = com.google.protobuf.MapField.newMapField(TagsDefaultEntryHolder.defaultEntry); + } + if (!tags_.isMutable()) { + tags_ = tags_.copy(); + } + bitField0_ |= 0x00000008; + onChanged(); + return tags_; + } + + public int getTagsCount() { + return internalGetTags().getMap().size(); + } + + /** + * + * + *
+     * Optional. Input only. Immutable. Tag keys/values directly bound to this
+     * resource. For example:
+     *   "123/environment": "production",
+     *   "123/costCenter": "marketing"
+     * 
+ * + * + * map<string, string> tags = 4 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public boolean containsTags(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetTags().getMap().containsKey(key); + } + + /** Use {@link #getTagsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getTags() { + return getTagsMap(); + } + + /** + * + * + *
+     * Optional. Input only. Immutable. Tag keys/values directly bound to this
+     * resource. For example:
+     *   "123/environment": "production",
+     *   "123/costCenter": "marketing"
+     * 
+ * + * + * map<string, string> tags = 4 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public java.util.Map getTagsMap() { + return internalGetTags().getMap(); + } + + /** + * + * + *
+     * Optional. Input only. Immutable. Tag keys/values directly bound to this
+     * resource. For example:
+     *   "123/environment": "production",
+     *   "123/costCenter": "marketing"
+     * 
+ * + * + * map<string, string> tags = 4 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public /* nullable */ java.lang.String getTagsOrDefault( + java.lang.String key, + /* nullable */ + java.lang.String defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetTags().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + + /** + * + * + *
+     * Optional. Input only. Immutable. Tag keys/values directly bound to this
+     * resource. For example:
+     *   "123/environment": "production",
+     *   "123/costCenter": "marketing"
+     * 
+ * + * + * map<string, string> tags = 4 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public java.lang.String getTagsOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetTags().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public Builder clearTags() { + bitField0_ = (bitField0_ & ~0x00000008); + internalGetMutableTags().getMutableMap().clear(); + return this; + } + + /** + * + * + *
+     * Optional. Input only. Immutable. Tag keys/values directly bound to this
+     * resource. For example:
+     *   "123/environment": "production",
+     *   "123/costCenter": "marketing"
+     * 
+ * + * + * map<string, string> tags = 4 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder removeTags(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + internalGetMutableTags().getMutableMap().remove(key); + return this; + } + + /** Use alternate mutation accessors instead. */ + @java.lang.Deprecated + public java.util.Map getMutableTags() { + bitField0_ |= 0x00000008; + return internalGetMutableTags().getMutableMap(); + } + + /** + * + * + *
+     * Optional. Input only. Immutable. Tag keys/values directly bound to this
+     * resource. For example:
+     *   "123/environment": "production",
+     *   "123/costCenter": "marketing"
+     * 
+ * + * + * map<string, string> tags = 4 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder putTags(java.lang.String key, java.lang.String value) { + if (key == null) { + throw new NullPointerException("map key"); + } + if (value == null) { + throw new NullPointerException("map value"); + } + internalGetMutableTags().getMutableMap().put(key, value); + bitField0_ |= 0x00000008; + return this; + } + + /** + * + * + *
+     * Optional. Input only. Immutable. Tag keys/values directly bound to this
+     * resource. For example:
+     *   "123/environment": "production",
+     *   "123/costCenter": "marketing"
+     * 
+ * + * + * map<string, string> tags = 4 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder putAllTags(java.util.Map values) { + internalGetMutableTags().getMutableMap().putAll(values); + bitField0_ |= 0x00000008; + return this; + } + @java.lang.Override public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/CreateSnapshotRequestOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/CreateSnapshotRequestOrBuilder.java index 25f5c59d1..80a1f76fc 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/CreateSnapshotRequestOrBuilder.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/CreateSnapshotRequestOrBuilder.java @@ -177,4 +177,92 @@ java.lang.String getLabelsOrDefault( * map<string, string> labels = 3 [(.google.api.field_behavior) = OPTIONAL]; */ java.lang.String getLabelsOrThrow(java.lang.String key); + + /** + * + * + *
+   * Optional. Input only. Immutable. Tag keys/values directly bound to this
+   * resource. For example:
+   *   "123/environment": "production",
+   *   "123/costCenter": "marketing"
+   * 
+ * + * + * map<string, string> tags = 4 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * + */ + int getTagsCount(); + + /** + * + * + *
+   * Optional. Input only. Immutable. Tag keys/values directly bound to this
+   * resource. For example:
+   *   "123/environment": "production",
+   *   "123/costCenter": "marketing"
+   * 
+ * + * + * map<string, string> tags = 4 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * + */ + boolean containsTags(java.lang.String key); + + /** Use {@link #getTagsMap()} instead. */ + @java.lang.Deprecated + java.util.Map getTags(); + + /** + * + * + *
+   * Optional. Input only. Immutable. Tag keys/values directly bound to this
+   * resource. For example:
+   *   "123/environment": "production",
+   *   "123/costCenter": "marketing"
+   * 
+ * + * + * map<string, string> tags = 4 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * + */ + java.util.Map getTagsMap(); + + /** + * + * + *
+   * Optional. Input only. Immutable. Tag keys/values directly bound to this
+   * resource. For example:
+   *   "123/environment": "production",
+   *   "123/costCenter": "marketing"
+   * 
+ * + * + * map<string, string> tags = 4 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * + */ + /* nullable */ + java.lang.String getTagsOrDefault( + java.lang.String key, + /* nullable */ + java.lang.String defaultValue); + + /** + * + * + *
+   * Optional. Input only. Immutable. Tag keys/values directly bound to this
+   * resource. For example:
+   *   "123/environment": "production",
+   *   "123/costCenter": "marketing"
+   * 
+ * + * + * map<string, string> tags = 4 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * + */ + java.lang.String getTagsOrThrow(java.lang.String key); } diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/CryptoKeyName.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/CryptoKeyName.java new file mode 100644 index 000000000..12a4c7312 --- /dev/null +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/CryptoKeyName.java @@ -0,0 +1,261 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +package com.google.pubsub.v1; + +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") +public class CryptoKeyName implements ResourceName { + private static final PathTemplate PROJECT_LOCATION_KEY_RING_CRYPTO_KEY = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}"); + private volatile Map fieldValuesMap; + private final String project; + private final String location; + private final String keyRing; + private final String cryptoKey; + + @Deprecated + protected CryptoKeyName() { + project = null; + location = null; + keyRing = null; + cryptoKey = null; + } + + private CryptoKeyName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + keyRing = Preconditions.checkNotNull(builder.getKeyRing()); + cryptoKey = Preconditions.checkNotNull(builder.getCryptoKey()); + } + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public String getKeyRing() { + return keyRing; + } + + public String getCryptoKey() { + return cryptoKey; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + public static CryptoKeyName of( + String project, String location, String keyRing, String cryptoKey) { + return newBuilder() + .setProject(project) + .setLocation(location) + .setKeyRing(keyRing) + .setCryptoKey(cryptoKey) + .build(); + } + + public static String format(String project, String location, String keyRing, String cryptoKey) { + return newBuilder() + .setProject(project) + .setLocation(location) + .setKeyRing(keyRing) + .setCryptoKey(cryptoKey) + .build() + .toString(); + } + + public static CryptoKeyName parse(String formattedString) { + if (formattedString.isEmpty()) { + return null; + } + Map matchMap = + PROJECT_LOCATION_KEY_RING_CRYPTO_KEY.validatedMatch( + formattedString, "CryptoKeyName.parse: formattedString not in valid format"); + return of( + matchMap.get("project"), + matchMap.get("location"), + matchMap.get("key_ring"), + matchMap.get("crypto_key")); + } + + public static List parseList(List formattedStrings) { + List list = new ArrayList<>(formattedStrings.size()); + for (String formattedString : formattedStrings) { + list.add(parse(formattedString)); + } + return list; + } + + public static List toStringList(List values) { + List list = new ArrayList<>(values.size()); + for (CryptoKeyName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return PROJECT_LOCATION_KEY_RING_CRYPTO_KEY.matches(formattedString); + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (location != null) { + fieldMapBuilder.put("location", location); + } + if (keyRing != null) { + fieldMapBuilder.put("key_ring", keyRing); + } + if (cryptoKey != null) { + fieldMapBuilder.put("crypto_key", cryptoKey); + } + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + @Override + public String toString() { + return PROJECT_LOCATION_KEY_RING_CRYPTO_KEY.instantiate( + "project", project, "location", location, "key_ring", keyRing, "crypto_key", cryptoKey); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null && getClass() == o.getClass()) { + CryptoKeyName that = ((CryptoKeyName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location) + && Objects.equals(this.keyRing, that.keyRing) + && Objects.equals(this.cryptoKey, that.cryptoKey); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + h *= 1000003; + h ^= Objects.hashCode(keyRing); + h *= 1000003; + h ^= Objects.hashCode(cryptoKey); + return h; + } + + /** + * Builder for + * projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}. + */ + public static class Builder { + private String project; + private String location; + private String keyRing; + private String cryptoKey; + + protected Builder() {} + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public String getKeyRing() { + return keyRing; + } + + public String getCryptoKey() { + return cryptoKey; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setLocation(String location) { + this.location = location; + return this; + } + + public Builder setKeyRing(String keyRing) { + this.keyRing = keyRing; + return this; + } + + public Builder setCryptoKey(String cryptoKey) { + this.cryptoKey = cryptoKey; + return this; + } + + private Builder(CryptoKeyName cryptoKeyName) { + this.project = cryptoKeyName.project; + this.location = cryptoKeyName.location; + this.keyRing = cryptoKeyName.keyRing; + this.cryptoKey = cryptoKeyName.cryptoKey; + } + + public CryptoKeyName build() { + return new CryptoKeyName(this); + } + } +} diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeadLetterPolicy.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeadLetterPolicy.java index b9b9f3a19..d809e9d6b 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeadLetterPolicy.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeadLetterPolicy.java @@ -88,7 +88,9 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { * since messages published to a topic with no subscriptions are lost. * * - * string dead_letter_topic = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * string dead_letter_topic = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return The deadLetterTopic. */ @@ -120,7 +122,9 @@ public java.lang.String getDeadLetterTopic() { * since messages published to a topic with no subscriptions are lost. * * - * string dead_letter_topic = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * string dead_letter_topic = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return The bytes for deadLetterTopic. */ @@ -551,7 +555,9 @@ public Builder mergeFrom( * since messages published to a topic with no subscriptions are lost. * * - * string dead_letter_topic = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * string dead_letter_topic = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return The deadLetterTopic. */ @@ -582,7 +588,9 @@ public java.lang.String getDeadLetterTopic() { * since messages published to a topic with no subscriptions are lost. * * - * string dead_letter_topic = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * string dead_letter_topic = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return The bytes for deadLetterTopic. */ @@ -613,7 +621,9 @@ public com.google.protobuf.ByteString getDeadLetterTopicBytes() { * since messages published to a topic with no subscriptions are lost. * * - * string dead_letter_topic = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * string dead_letter_topic = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @param value The deadLetterTopic to set. * @return This builder for chaining. @@ -643,7 +653,9 @@ public Builder setDeadLetterTopic(java.lang.String value) { * since messages published to a topic with no subscriptions are lost. * * - * string dead_letter_topic = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * string dead_letter_topic = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return This builder for chaining. */ @@ -669,7 +681,9 @@ public Builder clearDeadLetterTopic() { * since messages published to a topic with no subscriptions are lost. * * - * string dead_letter_topic = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * string dead_letter_topic = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @param value The bytes for deadLetterTopic to set. * @return This builder for chaining. diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeadLetterPolicyOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeadLetterPolicyOrBuilder.java index 2978a0510..83159d59d 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeadLetterPolicyOrBuilder.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeadLetterPolicyOrBuilder.java @@ -39,7 +39,9 @@ public interface DeadLetterPolicyOrBuilder * since messages published to a topic with no subscriptions are lost. * * - * string dead_letter_topic = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * string dead_letter_topic = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return The deadLetterTopic. */ @@ -60,7 +62,9 @@ public interface DeadLetterPolicyOrBuilder * since messages published to a topic with no subscriptions are lost. * * - * string dead_letter_topic = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * string dead_letter_topic = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return The bytes for deadLetterTopic. */ diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/IngestionDataSourceSettings.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/IngestionDataSourceSettings.java index 73f44578d..d2c79575f 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/IngestionDataSourceSettings.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/IngestionDataSourceSettings.java @@ -9182,7 +9182,9 @@ public interface AwsMskOrBuilder * will import from. * * - * string topic = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * string topic = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * * * @return The topic. */ @@ -9196,7 +9198,9 @@ public interface AwsMskOrBuilder * will import from. * * - * string topic = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * string topic = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * * * @return The bytes for topic. */ @@ -9657,7 +9661,9 @@ public com.google.protobuf.ByteString getClusterArnBytes() { * will import from. * * - * string topic = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * string topic = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * * * @return The topic. */ @@ -9682,7 +9688,9 @@ public java.lang.String getTopic() { * will import from. * * - * string topic = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * string topic = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * * * @return The bytes for topic. */ @@ -10499,7 +10507,9 @@ public Builder setClusterArnBytes(com.google.protobuf.ByteString value) { * will import from. * * - * string topic = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * string topic = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * * * @return The topic. */ @@ -10523,7 +10533,9 @@ public java.lang.String getTopic() { * will import from. * * - * string topic = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * string topic = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * * * @return The bytes for topic. */ @@ -10547,7 +10559,9 @@ public com.google.protobuf.ByteString getTopicBytes() { * will import from. * * - * string topic = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * string topic = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * * * @param value The topic to set. * @return This builder for chaining. @@ -10570,7 +10584,9 @@ public Builder setTopic(java.lang.String value) { * will import from. * * - * string topic = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * string topic = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * * * @return This builder for chaining. */ @@ -10589,7 +10605,9 @@ public Builder clearTopic() { * will import from. * * - * string topic = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * string topic = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * * * @param value The bytes for topic to set. * @return This builder for chaining. diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/IngestionFailureEvent.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/IngestionFailureEvent.java index 640c8f154..6f1455a19 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/IngestionFailureEvent.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/IngestionFailureEvent.java @@ -11941,6 +11941,56 @@ public interface AwsKinesisFailureReasonOrBuilder com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReasonOrBuilder getMessageTransformationFailureReasonOrBuilder(); + /** + * + * + *
+     * Optional. The message failed to be published due to an API violation.
+     * This is only set when the size of the data field of the Kinesis record
+     * is zero.
+     * 
+ * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the apiViolationReason field is set. + */ + boolean hasApiViolationReason(); + + /** + * + * + *
+     * Optional. The message failed to be published due to an API violation.
+     * This is only set when the size of the data field of the Kinesis record
+     * is zero.
+     * 
+ * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The apiViolationReason. + */ + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason getApiViolationReason(); + + /** + * + * + *
+     * Optional. The message failed to be published due to an API violation.
+     * This is only set when the size of the data field of the Kinesis record
+     * is zero.
+     * 
+ * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReasonOrBuilder + getApiViolationReasonOrBuilder(); + com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason.ReasonCase getReasonCase(); } @@ -12002,6 +12052,7 @@ public enum ReasonCase com.google.protobuf.AbstractMessage.InternalOneOfEnum { SCHEMA_VIOLATION_REASON(4), MESSAGE_TRANSFORMATION_FAILURE_REASON(5), + API_VIOLATION_REASON(6), REASON_NOT_SET(0); private final int value; @@ -12025,6 +12076,8 @@ public static ReasonCase forNumber(int value) { return SCHEMA_VIOLATION_REASON; case 5: return MESSAGE_TRANSFORMATION_FAILURE_REASON; + case 6: + return API_VIOLATION_REASON; case 0: return REASON_NOT_SET; default: @@ -12331,6 +12384,73 @@ public boolean hasMessageTransformationFailureReason() { .getDefaultInstance(); } + public static final int API_VIOLATION_REASON_FIELD_NUMBER = 6; + + /** + * + * + *
+     * Optional. The message failed to be published due to an API violation.
+     * This is only set when the size of the data field of the Kinesis record
+     * is zero.
+     * 
+ * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the apiViolationReason field is set. + */ + @java.lang.Override + public boolean hasApiViolationReason() { + return reasonCase_ == 6; + } + + /** + * + * + *
+     * Optional. The message failed to be published due to an API violation.
+     * This is only set when the size of the data field of the Kinesis record
+     * is zero.
+     * 
+ * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The apiViolationReason. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason getApiViolationReason() { + if (reasonCase_ == 6) { + return (com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason) reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.getDefaultInstance(); + } + + /** + * + * + *
+     * Optional. The message failed to be published due to an API violation.
+     * This is only set when the size of the data field of the Kinesis record
+     * is zero.
+     * 
+ * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReasonOrBuilder + getApiViolationReasonOrBuilder() { + if (reasonCase_ == 6) { + return (com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason) reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.getDefaultInstance(); + } + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -12364,6 +12484,10 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io (com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason) reason_); } + if (reasonCase_ == 6) { + output.writeMessage( + 6, (com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason) reason_); + } getUnknownFields().writeTo(output); } @@ -12394,6 +12518,11 @@ public int getSerializedSize() { (com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason) reason_); } + if (reasonCase_ == 6) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 6, (com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason) reason_); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -12422,6 +12551,9 @@ public boolean equals(final java.lang.Object obj) { if (!getMessageTransformationFailureReason() .equals(other.getMessageTransformationFailureReason())) return false; break; + case 6: + if (!getApiViolationReason().equals(other.getApiViolationReason())) return false; + break; case 0: default: } @@ -12451,6 +12583,10 @@ public int hashCode() { hash = (37 * hash) + MESSAGE_TRANSFORMATION_FAILURE_REASON_FIELD_NUMBER; hash = (53 * hash) + getMessageTransformationFailureReason().hashCode(); break; + case 6: + hash = (37 * hash) + API_VIOLATION_REASON_FIELD_NUMBER; + hash = (53 * hash) + getApiViolationReason().hashCode(); + break; case 0: default: } @@ -12608,6 +12744,9 @@ public Builder clear() { if (messageTransformationFailureReasonBuilder_ != null) { messageTransformationFailureReasonBuilder_.clear(); } + if (apiViolationReasonBuilder_ != null) { + apiViolationReasonBuilder_.clear(); + } reasonCase_ = 0; reason_ = null; return this; @@ -12671,6 +12810,9 @@ private void buildPartialOneofs( if (reasonCase_ == 5 && messageTransformationFailureReasonBuilder_ != null) { result.reason_ = messageTransformationFailureReasonBuilder_.build(); } + if (reasonCase_ == 6 && apiViolationReasonBuilder_ != null) { + result.reason_ = apiViolationReasonBuilder_.build(); + } } @java.lang.Override @@ -12751,6 +12893,11 @@ public Builder mergeFrom( other.getMessageTransformationFailureReason()); break; } + case API_VIOLATION_REASON: + { + mergeApiViolationReason(other.getApiViolationReason()); + break; + } case REASON_NOT_SET: { break; @@ -12815,6 +12962,13 @@ public Builder mergeFrom( reasonCase_ = 5; break; } // case 42 + case 50: + { + input.readMessage( + getApiViolationReasonFieldBuilder().getBuilder(), extensionRegistry); + reasonCase_ = 6; + break; + } // case 50 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { @@ -13698,6 +13852,267 @@ public Builder clearMessageTransformationFailureReason() { return messageTransformationFailureReasonBuilder_; } + private com.google.protobuf.SingleFieldBuilderV3< + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason, + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.Builder, + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReasonOrBuilder> + apiViolationReasonBuilder_; + + /** + * + * + *
+       * Optional. The message failed to be published due to an API violation.
+       * This is only set when the size of the data field of the Kinesis record
+       * is zero.
+       * 
+ * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the apiViolationReason field is set. + */ + @java.lang.Override + public boolean hasApiViolationReason() { + return reasonCase_ == 6; + } + + /** + * + * + *
+       * Optional. The message failed to be published due to an API violation.
+       * This is only set when the size of the data field of the Kinesis record
+       * is zero.
+       * 
+ * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The apiViolationReason. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason getApiViolationReason() { + if (apiViolationReasonBuilder_ == null) { + if (reasonCase_ == 6) { + return (com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason) reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.getDefaultInstance(); + } else { + if (reasonCase_ == 6) { + return apiViolationReasonBuilder_.getMessage(); + } + return com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.getDefaultInstance(); + } + } + + /** + * + * + *
+       * Optional. The message failed to be published due to an API violation.
+       * This is only set when the size of the data field of the Kinesis record
+       * is zero.
+       * 
+ * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setApiViolationReason( + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason value) { + if (apiViolationReasonBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + reason_ = value; + onChanged(); + } else { + apiViolationReasonBuilder_.setMessage(value); + } + reasonCase_ = 6; + return this; + } + + /** + * + * + *
+       * Optional. The message failed to be published due to an API violation.
+       * This is only set when the size of the data field of the Kinesis record
+       * is zero.
+       * 
+ * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setApiViolationReason( + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.Builder builderForValue) { + if (apiViolationReasonBuilder_ == null) { + reason_ = builderForValue.build(); + onChanged(); + } else { + apiViolationReasonBuilder_.setMessage(builderForValue.build()); + } + reasonCase_ = 6; + return this; + } + + /** + * + * + *
+       * Optional. The message failed to be published due to an API violation.
+       * This is only set when the size of the data field of the Kinesis record
+       * is zero.
+       * 
+ * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeApiViolationReason( + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason value) { + if (apiViolationReasonBuilder_ == null) { + if (reasonCase_ == 6 + && reason_ + != com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason + .getDefaultInstance()) { + reason_ = + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.newBuilder( + (com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason) reason_) + .mergeFrom(value) + .buildPartial(); + } else { + reason_ = value; + } + onChanged(); + } else { + if (reasonCase_ == 6) { + apiViolationReasonBuilder_.mergeFrom(value); + } else { + apiViolationReasonBuilder_.setMessage(value); + } + } + reasonCase_ = 6; + return this; + } + + /** + * + * + *
+       * Optional. The message failed to be published due to an API violation.
+       * This is only set when the size of the data field of the Kinesis record
+       * is zero.
+       * 
+ * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearApiViolationReason() { + if (apiViolationReasonBuilder_ == null) { + if (reasonCase_ == 6) { + reasonCase_ = 0; + reason_ = null; + onChanged(); + } + } else { + if (reasonCase_ == 6) { + reasonCase_ = 0; + reason_ = null; + } + apiViolationReasonBuilder_.clear(); + } + return this; + } + + /** + * + * + *
+       * Optional. The message failed to be published due to an API violation.
+       * This is only set when the size of the data field of the Kinesis record
+       * is zero.
+       * 
+ * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.Builder + getApiViolationReasonBuilder() { + return getApiViolationReasonFieldBuilder().getBuilder(); + } + + /** + * + * + *
+       * Optional. The message failed to be published due to an API violation.
+       * This is only set when the size of the data field of the Kinesis record
+       * is zero.
+       * 
+ * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReasonOrBuilder + getApiViolationReasonOrBuilder() { + if ((reasonCase_ == 6) && (apiViolationReasonBuilder_ != null)) { + return apiViolationReasonBuilder_.getMessageOrBuilder(); + } else { + if (reasonCase_ == 6) { + return (com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason) reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.getDefaultInstance(); + } + } + + /** + * + * + *
+       * Optional. The message failed to be published due to an API violation.
+       * This is only set when the size of the data field of the Kinesis record
+       * is zero.
+       * 
+ * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason, + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.Builder, + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReasonOrBuilder> + getApiViolationReasonFieldBuilder() { + if (apiViolationReasonBuilder_ == null) { + if (!(reasonCase_ == 6)) { + reason_ = + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.getDefaultInstance(); + } + apiViolationReasonBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason, + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.Builder, + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReasonOrBuilder>( + (com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason) reason_, + getParentForChildren(), + isClean()); + reason_ = null; + } + reasonCase_ = 6; + onChanged(); + return apiViolationReasonBuilder_; + } + @java.lang.Override public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { @@ -13837,7 +14252,9 @@ public FailureCase getFailureCase() { * projects/{project_name}/topics/{topic_name}. * * - * string topic = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * string topic = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * * * @return The topic. */ @@ -13862,7 +14279,9 @@ public java.lang.String getTopic() { * projects/{project_name}/topics/{topic_name}. * * - * string topic = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * string topic = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * * * @return The bytes for topic. */ @@ -14826,7 +15245,9 @@ public Builder clearFailure() { * projects/{project_name}/topics/{topic_name}. * * - * string topic = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * string topic = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * * * @return The topic. */ @@ -14850,7 +15271,9 @@ public java.lang.String getTopic() { * projects/{project_name}/topics/{topic_name}. * * - * string topic = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * string topic = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * * * @return The bytes for topic. */ @@ -14874,7 +15297,9 @@ public com.google.protobuf.ByteString getTopicBytes() { * projects/{project_name}/topics/{topic_name}. * * - * string topic = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * string topic = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * * * @param value The topic to set. * @return This builder for chaining. @@ -14897,7 +15322,9 @@ public Builder setTopic(java.lang.String value) { * projects/{project_name}/topics/{topic_name}. * * - * string topic = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * string topic = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * * * @return This builder for chaining. */ @@ -14916,7 +15343,9 @@ public Builder clearTopic() { * projects/{project_name}/topics/{topic_name}. * * - * string topic = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * string topic = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * * * @param value The bytes for topic to set. * @return This builder for chaining. diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/IngestionFailureEventOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/IngestionFailureEventOrBuilder.java index c7ceeb108..49390d159 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/IngestionFailureEventOrBuilder.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/IngestionFailureEventOrBuilder.java @@ -32,7 +32,9 @@ public interface IngestionFailureEventOrBuilder * projects/{project_name}/topics/{topic_name}. * * - * string topic = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * string topic = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * * * @return The topic. */ @@ -46,7 +48,9 @@ public interface IngestionFailureEventOrBuilder * projects/{project_name}/topics/{topic_name}. * * - * string topic = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * string topic = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * * * @return The bytes for topic. */ diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicSnapshotsResponse.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicSnapshotsResponse.java index 4536d9f60..387a4ef7e 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicSnapshotsResponse.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicSnapshotsResponse.java @@ -78,7 +78,9 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { * Optional. The names of the snapshots that match the request. * * - * repeated string snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * repeated string snapshots = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return A list containing the snapshots. */ @@ -93,7 +95,9 @@ public com.google.protobuf.ProtocolStringList getSnapshotsList() { * Optional. The names of the snapshots that match the request. * * - * repeated string snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * repeated string snapshots = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return The count of snapshots. */ @@ -108,7 +112,9 @@ public int getSnapshotsCount() { * Optional. The names of the snapshots that match the request. * * - * repeated string snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * repeated string snapshots = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @param index The index of the element to return. * @return The snapshots at the given index. @@ -124,7 +130,9 @@ public java.lang.String getSnapshots(int index) { * Optional. The names of the snapshots that match the request. * * - * repeated string snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * repeated string snapshots = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @param index The index of the value to return. * @return The bytes of the snapshots at the given index. @@ -588,7 +596,9 @@ private void ensureSnapshotsIsMutable() { * Optional. The names of the snapshots that match the request. * * - * repeated string snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * repeated string snapshots = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return A list containing the snapshots. */ @@ -604,7 +614,9 @@ public com.google.protobuf.ProtocolStringList getSnapshotsList() { * Optional. The names of the snapshots that match the request. * * - * repeated string snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * repeated string snapshots = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return The count of snapshots. */ @@ -619,7 +631,9 @@ public int getSnapshotsCount() { * Optional. The names of the snapshots that match the request. * * - * repeated string snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * repeated string snapshots = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @param index The index of the element to return. * @return The snapshots at the given index. @@ -635,7 +649,9 @@ public java.lang.String getSnapshots(int index) { * Optional. The names of the snapshots that match the request. * * - * repeated string snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * repeated string snapshots = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @param index The index of the value to return. * @return The bytes of the snapshots at the given index. @@ -651,7 +667,9 @@ public com.google.protobuf.ByteString getSnapshotsBytes(int index) { * Optional. The names of the snapshots that match the request. * * - * repeated string snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * repeated string snapshots = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @param index The index to set the value at. * @param value The snapshots to set. @@ -675,7 +693,9 @@ public Builder setSnapshots(int index, java.lang.String value) { * Optional. The names of the snapshots that match the request. * * - * repeated string snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * repeated string snapshots = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @param value The snapshots to add. * @return This builder for chaining. @@ -698,7 +718,9 @@ public Builder addSnapshots(java.lang.String value) { * Optional. The names of the snapshots that match the request. * * - * repeated string snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * repeated string snapshots = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @param values The snapshots to add. * @return This builder for chaining. @@ -718,7 +740,9 @@ public Builder addAllSnapshots(java.lang.Iterable values) { * Optional. The names of the snapshots that match the request. * * - * repeated string snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * repeated string snapshots = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return This builder for chaining. */ @@ -737,7 +761,9 @@ public Builder clearSnapshots() { * Optional. The names of the snapshots that match the request. * * - * repeated string snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * repeated string snapshots = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @param value The bytes of the snapshots to add. * @return This builder for chaining. diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicSnapshotsResponseOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicSnapshotsResponseOrBuilder.java index 4623e163f..fd3eca179 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicSnapshotsResponseOrBuilder.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicSnapshotsResponseOrBuilder.java @@ -31,7 +31,9 @@ public interface ListTopicSnapshotsResponseOrBuilder * Optional. The names of the snapshots that match the request. * * - * repeated string snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * repeated string snapshots = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return A list containing the snapshots. */ @@ -44,7 +46,9 @@ public interface ListTopicSnapshotsResponseOrBuilder * Optional. The names of the snapshots that match the request. * * - * repeated string snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * repeated string snapshots = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return The count of snapshots. */ @@ -57,7 +61,9 @@ public interface ListTopicSnapshotsResponseOrBuilder * Optional. The names of the snapshots that match the request. * * - * repeated string snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * repeated string snapshots = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @param index The index of the element to return. * @return The snapshots at the given index. @@ -71,7 +77,9 @@ public interface ListTopicSnapshotsResponseOrBuilder * Optional. The names of the snapshots that match the request. * * - * repeated string snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * repeated string snapshots = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @param index The index of the value to return. * @return The bytes of the snapshots at the given index. diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/MessageTransform.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/MessageTransform.java index 0456c10b4..573d42c33 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/MessageTransform.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/MessageTransform.java @@ -186,7 +186,7 @@ public com.google.pubsub.v1.JavaScriptUDFOrBuilder getJavascriptUdfOrBuilder() { * bool enabled = 3 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; * * @deprecated google.pubsub.v1.MessageTransform.enabled is deprecated. See - * google/pubsub/v1/pubsub.proto;l=798 + * google/pubsub/v1/pubsub.proto;l=818 * @return The enabled. */ @java.lang.Override @@ -899,7 +899,7 @@ public com.google.pubsub.v1.JavaScriptUDFOrBuilder getJavascriptUdfOrBuilder() { * bool enabled = 3 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; * * @deprecated google.pubsub.v1.MessageTransform.enabled is deprecated. See - * google/pubsub/v1/pubsub.proto;l=798 + * google/pubsub/v1/pubsub.proto;l=818 * @return The enabled. */ @java.lang.Override @@ -919,7 +919,7 @@ public boolean getEnabled() { * bool enabled = 3 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; * * @deprecated google.pubsub.v1.MessageTransform.enabled is deprecated. See - * google/pubsub/v1/pubsub.proto;l=798 + * google/pubsub/v1/pubsub.proto;l=818 * @param value The enabled to set. * @return This builder for chaining. */ @@ -943,7 +943,7 @@ public Builder setEnabled(boolean value) { * bool enabled = 3 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; * * @deprecated google.pubsub.v1.MessageTransform.enabled is deprecated. See - * google/pubsub/v1/pubsub.proto;l=798 + * google/pubsub/v1/pubsub.proto;l=818 * @return This builder for chaining. */ @java.lang.Deprecated diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/MessageTransformOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/MessageTransformOrBuilder.java index 324cf524a..24c73b06b 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/MessageTransformOrBuilder.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/MessageTransformOrBuilder.java @@ -81,7 +81,7 @@ public interface MessageTransformOrBuilder * bool enabled = 3 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; * * @deprecated google.pubsub.v1.MessageTransform.enabled is deprecated. See - * google/pubsub/v1/pubsub.proto;l=798 + * google/pubsub/v1/pubsub.proto;l=818 * @return The enabled. */ @java.lang.Deprecated diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PubsubProto.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PubsubProto.java index 0a9017c9b..1b5e7d634 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PubsubProto.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PubsubProto.java @@ -132,6 +132,10 @@ public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry r internal_static_google_pubsub_v1_Topic_LabelsEntry_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_google_pubsub_v1_Topic_LabelsEntry_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_pubsub_v1_Topic_TagsEntry_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_pubsub_v1_Topic_TagsEntry_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_PubsubMessage_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable @@ -204,6 +208,10 @@ public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry r internal_static_google_pubsub_v1_Subscription_LabelsEntry_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_google_pubsub_v1_Subscription_LabelsEntry_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_pubsub_v1_Subscription_TagsEntry_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_pubsub_v1_Subscription_TagsEntry_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_RetryPolicy_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable @@ -324,6 +332,10 @@ public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry r internal_static_google_pubsub_v1_CreateSnapshotRequest_LabelsEntry_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_google_pubsub_v1_CreateSnapshotRequest_LabelsEntry_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_pubsub_v1_CreateSnapshotRequest_TagsEntry_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_pubsub_v1_CreateSnapshotRequest_TagsEntry_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_UpdateSnapshotRequest_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable @@ -385,7 +397,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "\034pubsub.googleapis.com/Schema\0221\n" + "\010encoding\030\002 \001(\0162\032.google.pubsub.v1.EncodingB\003\340A\001\022\036\n" + "\021first_revision_id\030\003 \001(\tB\003\340A\001\022\035\n" - + "\020last_revision_id\030\004 \001(\tB\003\340A\001\"\310\027\n" + + "\020last_revision_id\030\004 \001(\tB\003\340A\001\"\350\027\n" + "\033IngestionDataSourceSettings\022T\n" + "\013aws_kinesis\030\001 \001(\01328.google.pubsub.v" + "1.IngestionDataSourceSettings.AwsKinesisB\003\340A\001H\000\022X\n\r" @@ -457,12 +469,13 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "\023NAMESPACE_NOT_FOUND\020\004\022\027\n" + "\023EVENT_HUB_NOT_FOUND\020\005\022\032\n" + "\026SUBSCRIPTION_NOT_FOUND\020\006\022\034\n" - + "\030RESOURCE_GROUP_NOT_FOUND\020\007\032\326\002\n" + + "\030RESOURCE_GROUP_NOT_FOUND\020\007\032\366\002\n" + "\006AwsMsk\022N\n" + "\005state\030\001 \001(\0162:.google.pubsub.v1.In" + "gestionDataSourceSettings.AwsMsk.StateB\003\340A\003\022\030\n" - + "\013cluster_arn\030\002 \001(\tB\003\340A\002\022\022\n" - + "\005topic\030\003 \001(\tB\003\340A\002\022\031\n" + + "\013cluster_arn\030\002 \001(\tB\003\340A\002\0222\n" + + "\005topic\030\003 \001(\tB#\340A\002\372A\035\n" + + "\033pubsub.googleapis.com/Topic\022\031\n" + "\014aws_role_arn\030\004 \001(\tB\003\340A\002\022 \n" + "\023gcp_service_account\030\005 \001(\tB\003\340A\002\"\220\001\n" + "\005State\022\025\n" @@ -473,8 +486,8 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "\021CLUSTER_NOT_FOUND\020\004\022\023\n" + "\017TOPIC_NOT_FOUND\020\005\032\266\003\n" + "\016ConfluentCloud\022V\n" - + "\005state\030\001 \001(\0162B.google.pubsub.v1.Ingestion" - + "DataSourceSettings.ConfluentCloud.StateB\003\340A\003\022\035\n" + + "\005state\030\001 " + + "\001(\0162B.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud.StateB\003\340A\003\022\035\n" + "\020bootstrap_server\030\002 \001(\tB\003\340A\002\022\027\n\n" + "cluster_id\030\003 \001(\tB\003\340A\002\022\022\n" + "\005topic\030\004 \001(\tB\003\340A\002\022\035\n" @@ -490,28 +503,29 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "\017TOPIC_NOT_FOUND\020\006B\010\n" + "\006source\"\277\001\n" + "\024PlatformLogsSettings\022F\n" - + "\010severity\030\001 \001(\0162/.google" - + ".pubsub.v1.PlatformLogsSettings.SeverityB\003\340A\001\"_\n" + + "\010severity\030\001" + + " \001(\0162/.google.pubsub.v1.PlatformLogsSettings.SeverityB\003\340A\001\"_\n" + "\010Severity\022\030\n" + "\024SEVERITY_UNSPECIFIED\020\000\022\014\n" + "\010DISABLED\020\001\022\t\n" + "\005DEBUG\020\002\022\010\n" + "\004INFO\020\003\022\013\n" + "\007WARNING\020\004\022\t\n" - + "\005ERROR\020\005\"\270\027\n" - + "\025IngestionFailureEvent\022\022\n" - + "\005topic\030\001 \001(\tB\003\340A\002\022\032\n\r" + + "\005ERROR\020\005\"\271\030\n" + + "\025IngestionFailureEvent\0222\n" + + "\005topic\030\001 \001(\tB#\340A\002\372A\035\n" + + "\033pubsub.googleapis.com/Topic\022\032\n\r" + "error_message\030\002 \001(\tB\003\340A\002\022a\n" - + "\025cloud_storage_failure\030\003" - + " \001(\0132;.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailureB\003\340A\001H\000\022[\n" - + "\017aws_msk_failure\030\004 \001(\0132;.google.pubsub.v1." - + "IngestionFailureEvent.AwsMskFailureReasonB\003\340A\001H\000\022l\n" - + "\030azure_event_hubs_failure\030\005 \001(\0132C.google.pubsub.v1.IngestionFailureEv" - + "ent.AzureEventHubsFailureReasonB\003\340A\001H\000\022k\n" - + "\027confluent_cloud_failure\030\006 \001(\0132C.google" - + ".pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReasonB\003\340A\001H\000\022c\n" - + "\023aws_kinesis_failure\030\007 \001(\0132?.google.pubsub.v1.Inge" - + "stionFailureEvent.AwsKinesisFailureReasonB\003\340A\001H\000\032\024\n" + + "\025cloud_storage_failure\030\003 \001(\0132;.google" + + ".pubsub.v1.IngestionFailureEvent.CloudStorageFailureB\003\340A\001H\000\022[\n" + + "\017aws_msk_failure\030\004" + + " \001(\0132;.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReasonB\003\340A\001H\000\022l\n" + + "\030azure_event_hubs_failure\030\005 \001(\0132C.google.pubs" + + "ub.v1.IngestionFailureEvent.AzureEventHubsFailureReasonB\003\340A\001H\000\022k\n" + + "\027confluent_cloud_failure\030\006 \001(\0132C.google.pubsub.v1.Inges" + + "tionFailureEvent.ConfluentCloudFailureReasonB\003\340A\001H\000\022c\n" + + "\023aws_kinesis_failure\030\007 \001(\013" + + "2?.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReasonB\003\340A\001H\000\032\024\n" + "\022ApiViolationReason\032\023\n" + "\021AvroFailureReason\032\027\n" + "\025SchemaViolationReason\032$\n" @@ -520,62 +534,63 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "\006bucket\030\001 \001(\tB\003\340A\001\022\030\n" + "\013object_name\030\002 \001(\tB\003\340A\001\022\036\n" + "\021object_generation\030\003 \001(\003B\003\340A\001\022]\n" - + "\023avro_failure_reason\030\005" - + " \001(\01329.google.pubsub.v1.IngestionFailureEvent.AvroFailureReasonB\003\340A\001H\000\022_\n" - + "\024api_violation_reason\030\006 \001(\0132:.google.pubsub.v" - + "1.IngestionFailureEvent.ApiViolationReasonB\003\340A\001H\000\022e\n" - + "\027schema_violation_reason\030\007 \001" - + "(\0132=.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReasonB\003\340A\001H\000\022\200\001\n" - + "%message_transformation_failure_reason\030\010 \001(\013" - + "2J.google.pubsub.v1.IngestionFailureEven" - + "t.MessageTransformationFailureReasonB\003\340A\001H\000B\010\n" + + "\023avro_failure_reason\030\005 \001(\01329.google." + + "pubsub.v1.IngestionFailureEvent.AvroFailureReasonB\003\340A\001H\000\022_\n" + + "\024api_violation_reason\030\006" + + " \001(\0132:.google.pubsub.v1.IngestionFailureEvent.ApiViolationReasonB\003\340A\001H\000\022e\n" + + "\027schema_violation_reason\030\007 \001(\0132=.google.pubs" + + "ub.v1.IngestionFailureEvent.SchemaViolationReasonB\003\340A\001H\000\022\200\001\n" + + "%message_transformation_failure_reason\030\010 \001(\0132J.google.pubsub" + + ".v1.IngestionFailureEvent.MessageTransformationFailureReasonB\003\340A\001H\000B\010\n" + "\006reason\032\316\003\n" + "\023AwsMskFailureReason\022\030\n" + "\013cluster_arn\030\001 \001(\tB\003\340A\001\022\030\n" + "\013kafka_topic\030\002 \001(\tB\003\340A\001\022\031\n" + "\014partition_id\030\003 \001(\003B\003\340A\001\022\023\n" + "\006offset\030\004 \001(\003B\003\340A\001\022_\n" - + "\024api_violation_reason\030\005" - + " \001(\0132:.google.pubsub.v1.IngestionFailureEvent.ApiViolationReasonB\003\340A\001H\000\022e\n" - + "\027schema_violation_reason\030\006 \001(\0132=.google.pub" - + "sub.v1.IngestionFailureEvent.SchemaViolationReasonB\003\340A\001H\000\022\200\001\n" - + "%message_transformation_failure_reason\030\007 \001(\0132J.google.pubsu" - + "b.v1.IngestionFailureEvent.MessageTransformationFailureReasonB\003\340A\001H\000B\010\n" + + "\024api_violation_reason\030\005 \001(\0132:.google" + + ".pubsub.v1.IngestionFailureEvent.ApiViolationReasonB\003\340A\001H\000\022e\n" + + "\027schema_violation_reason\030\006 \001(\0132=.google.pubsub.v1.Ingestion" + + "FailureEvent.SchemaViolationReasonB\003\340A\001H\000\022\200\001\n" + + "%message_transformation_failure_reason\030\007" + + " \001(\0132J.google.pubsub.v1.IngestionFa" + + "ilureEvent.MessageTransformationFailureReasonB\003\340A\001H\000B\010\n" + "\006reason\032\322\003\n" + "\033AzureEventHubsFailureReason\022\026\n" + "\tnamespace\030\001 \001(\tB\003\340A\001\022\026\n" + "\tevent_hub\030\002 \001(\tB\003\340A\001\022\031\n" + "\014partition_id\030\003 \001(\003B\003\340A\001\022\023\n" + "\006offset\030\004 \001(\003B\003\340A\001\022_\n" - + "\024api_violation_reason\030\005 \001(\0132:.g" - + "oogle.pubsub.v1.IngestionFailureEvent.ApiViolationReasonB\003\340A\001H\000\022e\n" - + "\027schema_violation_reason\030\006 \001(\0132=.google.pubsub.v1.Inge" - + "stionFailureEvent.SchemaViolationReasonB\003\340A\001H\000\022\200\001\n" - + "%message_transformation_failure_reason\030\007 \001(\0132J.google.pubsub.v1.Ingest" - + "ionFailureEvent.MessageTransformationFailureReasonB\003\340A\001H\000B\010\n" + + "\024api_violation_reason\030\005 \001(\0132:.google.pubsub.v1." + + "IngestionFailureEvent.ApiViolationReasonB\003\340A\001H\000\022e\n" + + "\027schema_violation_reason\030\006 \001(\013" + + "2=.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReasonB\003\340A\001H\000\022\200\001\n" + + "%message_transformation_failure_reason\030\007 \001(\0132J" + + ".google.pubsub.v1.IngestionFailureEvent." + + "MessageTransformationFailureReasonB\003\340A\001H\000B\010\n" + "\006reason\032\325\003\n" + "\033ConfluentCloudFailureReason\022\027\n\n" + "cluster_id\030\001 \001(\tB\003\340A\001\022\030\n" + "\013kafka_topic\030\002 \001(\tB\003\340A\001\022\031\n" + "\014partition_id\030\003 \001(\003B\003\340A\001\022\023\n" + "\006offset\030\004 \001(\003B\003\340A\001\022_\n" - + "\024api_violation_reason\030\005 \001(\0132:.google.pu" - + "bsub.v1.IngestionFailureEvent.ApiViolationReasonB\003\340A\001H\000\022e\n" - + "\027schema_violation_reason\030\006 \001(\0132=.google.pubsub.v1.IngestionFai" - + "lureEvent.SchemaViolationReasonB\003\340A\001H\000\022\200\001\n" - + "%message_transformation_failure_reason\030\007" - + " \001(\0132J.google.pubsub.v1.IngestionFailu" - + "reEvent.MessageTransformationFailureReasonB\003\340A\001H\000B\010\n" - + "\006reason\032\340\002\n" + + "\024api_violation_reason\030\005 \001(\0132:.google.pubsub.v1.Ingestio" + + "nFailureEvent.ApiViolationReasonB\003\340A\001H\000\022e\n" + + "\027schema_violation_reason\030\006 \001(\0132=.googl" + + "e.pubsub.v1.IngestionFailureEvent.SchemaViolationReasonB\003\340A\001H\000\022\200\001\n" + + "%message_transformation_failure_reason\030\007 \001(\0132J.google." + + "pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReasonB\003\340A\001H\000B\010\n" + + "\006reason\032\301\003\n" + "\027AwsKinesisFailureReason\022\027\n\n" + "stream_arn\030\001 \001(\tB\003\340A\001\022\032\n\r" + "partition_key\030\002 \001(\tB\003\340A\001\022\034\n" + "\017sequence_number\030\003 \001(\tB\003\340A\001\022e\n" - + "\027schema_violation_reason\030\004 " - + "\001(\0132=.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReasonB\003\340A\001H\000\022\200\001\n" - + "%message_transformation_failure_reason\030\005 \001(" - + "\0132J.google.pubsub.v1.IngestionFailureEve" - + "nt.MessageTransformationFailureReasonB\003\340A\001H\000B\010\n" + + "\027schema_violation_reason\030\004 \001(\0132=.google.pub" + + "sub.v1.IngestionFailureEvent.SchemaViolationReasonB\003\340A\001H\000\022\200\001\n" + + "%message_transformation_failure_reason\030\005 \001(\0132J.google.pubsu" + + "b.v1.IngestionFailureEvent.MessageTransformationFailureReasonB\003\340A\001H\000\022_\n" + + "\024api_violation_reason\030\006 \001(\0132:.google.pubsub.v1.In" + + "gestionFailureEvent.ApiViolationReasonB\003\340A\001H\000B\010\n" + "\006reasonB\t\n" + "\007failure\">\n\r" + "JavaScriptUDF\022\032\n\r" @@ -586,13 +601,14 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + " \001(\0132\037.google.pubsub.v1.JavaScriptUDFB\003\340A\001H\000\022\026\n" + "\007enabled\030\003 \001(\010B\005\030\001\340A\001\022\025\n" + "\010disabled\030\004 \001(\010B\003\340A\001B\013\n" - + "\ttransform\"\216\006\n" + + "\ttransform\"\235\007\n" + "\005Topic\022\021\n" + "\004name\030\001 \001(\tB\003\340A\002\0228\n" + "\006labels\030\002 \003(\0132#.google.pubsub.v1.Topic.LabelsEntryB\003\340A\001\022K\n" - + "\026message_storage_policy\030\003 \001(\0132&.goog" - + "le.pubsub.v1.MessageStoragePolicyB\003\340A\001\022\031\n" - + "\014kms_key_name\030\005 \001(\tB\003\340A\001\022>\n" + + "\026message_storage_policy\030\003 \001(\0132&.goo" + + "gle.pubsub.v1.MessageStoragePolicyB\003\340A\001\022?\n" + + "\014kms_key_name\030\005 \001(\tB)\340A\001\372A#\n" + + "!cloudkms.googleapis.com/CryptoKey\022>\n" + "\017schema_settings\030\006 \001(\0132" + " .google.pubsub.v1.SchemaSettingsB\003\340A\001\022\032\n\r" + "satisfies_pzs\030\007 \001(\010B\003\340A\001\022B\n" @@ -602,20 +618,25 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "\036ingestion_data_source_settings\030\n" + " \001(\0132-.google.pubsub.v1.IngestionDataSourceSettingsB\003\340A\001\022C\n" + "\022message_transforms\030\r" - + " \003(\0132\".google.pubsub.v1.MessageTransformB\003\340A\001\032-\n" + + " \003(\0132\".google.pubsub.v1.MessageTransformB\003\340A\001\022:\n" + + "\004tags\030\016 \003(\0132!.google.pubsub.v1.Topic.TagsEntryB" + + "\t\340A\004\340A\005\340A\001\032-\n" + "\013LabelsEntry\022\013\n" + "\003key\030\001 \001(\t\022\r\n" + + "\005value\030\002 \001(\t:\0028\001\032+\n" + + "\tTagsEntry\022\013\n" + + "\003key\030\001 \001(\t\022\r\n" + "\005value\030\002 \001(\t:\0028\001\"H\n" + "\005State\022\025\n" + "\021STATE_UNSPECIFIED\020\000\022\n\n" + "\006ACTIVE\020\001\022\034\n" + "\030INGESTION_RESOURCE_ERROR\020\002:c\352A`\n" - + "\033pubsub.googleapis.com/Topic\022!projec" - + "ts/{project}/topics/{topic}\022\017_deleted-topic_*\006topics2\005topic\"\200\002\n\r" + + "\033pubsub.googleapis.com/Topic\022!projects/{project}/top" + + "ics/{topic}\022\017_deleted-topic_*\006topics2\005topic\"\200\002\n\r" + "PubsubMessage\022\021\n" + "\004data\030\001 \001(\014B\003\340A\001\022H\n\n" - + "attributes\030\002 \003(\0132/.g" - + "oogle.pubsub.v1.PubsubMessage.AttributesEntryB\003\340A\001\022\022\n\n" + + "attributes\030\002" + + " \003(\0132/.google.pubsub.v1.PubsubMessage.AttributesEntryB\003\340A\001\022\022\n\n" + "message_id\030\003 \001(\t\0220\n" + "\014publish_time\030\004 \001(\0132\032.google.protobuf.Timestamp\022\031\n" + "\014ordering_key\030\005 \001(\tB\003\340A\001\0321\n" @@ -637,8 +658,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "\021ListTopicsRequest\022D\n" + "\007project\030\001 \001(\tB3\340A\002\372A-\n" + "+cloudresourcemanager.googleapis.com/Project\022\026\n" - + "\tpage_size\030\002 \001(\005B\003\340A\001\022\027\n" - + "\n" + + "\tpage_size\030\002 \001(\005B\003\340A\001\022\027\n\n" + "page_token\030\003 \001(\tB\003\340A\001\"`\n" + "\022ListTopicsResponse\022,\n" + "\006topics\030\001 \003(\0132\027.google.pubsub.v1.TopicB\003\340A\001\022\034\n" @@ -655,10 +675,12 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "\031ListTopicSnapshotsRequest\0222\n" + "\005topic\030\001 \001(\tB#\340A\002\372A\035\n" + "\033pubsub.googleapis.com/Topic\022\026\n" - + "\tpage_size\030\002 \001(\005B\003\340A\001\022\027\n\n" - + "page_token\030\003 \001(\tB\003\340A\001\"R\n" - + "\032ListTopicSnapshotsResponse\022\026\n" - + "\tsnapshots\030\001 \003(\tB\003\340A\001\022\034\n" + + "\tpage_size\030\002 \001(\005B\003\340A\001\022\027\n" + + "\n" + + "page_token\030\003 \001(\tB\003\340A\001\"u\n" + + "\032ListTopicSnapshotsResponse\0229\n" + + "\tsnapshots\030\001 \003(\tB&\340A\001\372A \n" + + "\036pubsub.googleapis.com/Snapshot\022\034\n" + "\017next_page_token\030\002 \001(\tB\003\340A\001\"H\n" + "\022DeleteTopicRequest\0222\n" + "\005topic\030\001 \001(\tB#\340A\002\372A\035\n" @@ -666,7 +688,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "\031DetachSubscriptionRequest\022@\n" + "\014subscription\030\001 \001(\tB*\340A\002\372A$\n" + "\"pubsub.googleapis.com/Subscription\"\034\n" - + "\032DetachSubscriptionResponse\"\215\013\n" + + "\032DetachSubscriptionResponse\"\245\014\n" + "\014Subscription\022\021\n" + "\004name\030\001 \001(\tB\003\340A\002\0222\n" + "\005topic\030\002 \001(\tB#\340A\002\372A\035\n" @@ -675,14 +697,14 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + " \001(\0132\034.google.pubsub.v1.PushConfigB\003\340A\001\022>\n" + "\017bigquery_config\030\022 \001(\0132" + " .google.pubsub.v1.BigQueryConfigB\003\340A\001\022G\n" - + "\024cloud_storage_config\030\026 \001(\0132" - + "$.google.pubsub.v1.CloudStorageConfigB\003\340A\001\022!\n" + + "\024cloud_storage_config\030\026" + + " \001(\0132$.google.pubsub.v1.CloudStorageConfigB\003\340A\001\022!\n" + "\024ack_deadline_seconds\030\005 \001(\005B\003\340A\001\022\"\n" + "\025retain_acked_messages\030\007 \001(\010B\003\340A\001\022B\n" + "\032message_retention_duration\030\010" + " \001(\0132\031.google.protobuf.DurationB\003\340A\001\022?\n" - + "\006labels\030\t \003(\0132*." - + "google.pubsub.v1.Subscription.LabelsEntryB\003\340A\001\022$\n" + + "\006labels\030\t" + + " \003(\0132*.google.pubsub.v1.Subscription.LabelsEntryB\003\340A\001\022$\n" + "\027enable_message_ordering\030\n" + " \001(\010B\003\340A\001\022B\n" + "\021expiration_policy\030\013" @@ -690,36 +712,43 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "\006filter\030\014 \001(\tB\003\340A\001\022C\n" + "\022dead_letter_policy\030\r" + " \001(\0132\".google.pubsub.v1.DeadLetterPolicyB\003\340A\001\0228\n" - + "\014retry_policy\030\016" - + " \001(\0132\035.google.pubsub.v1.RetryPolicyB\003\340A\001\022\025\n" + + "\014retry_policy\030\016 " + + "\001(\0132\035.google.pubsub.v1.RetryPolicyB\003\340A\001\022\025\n" + "\010detached\030\017 \001(\010B\003\340A\001\022)\n" + "\034enable_exactly_once_delivery\030\020 \001(\010B\003\340A\001\022H\n" + " topic_message_retention_duration\030\021" + " \001(\0132\031.google.protobuf.DurationB\003\340A\003\0228\n" + "\005state\030\023 \001(\0162$.google.pubsub.v1.Subscription.StateB\003\340A\003\022i\n" - + "\037analytics_hub_subscription_info\030\027 \001(\0132;.google.pubsub.v1.S" - + "ubscription.AnalyticsHubSubscriptionInfoB\003\340A\003\022C\n" + + "\037analytics_hub_subscription_info\030\027 \001(\0132;" + + ".google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfoB\003\340A\003\022C\n" + "\022message_transforms\030\031" - + " \003(\0132\".google.pubsub.v1.MessageTransformB\003\340A\001\032O\n" - + "\034AnalyticsHubSubscriptionInfo\022\024\n" - + "\007listing\030\001 \001(\tB\003\340A\001\022\031\n" + + " \003(\0132\".google.pubsub.v1.MessageTransformB\003\340A\001\022A\n" + + "\004tags\030\032 \003(\0132(.google.pubsub.v1.Subscription.TagsEntryB" + + "\t\340A\004\340A\005\340A\001\032w\n" + + "\034AnalyticsHubSubscriptionInfo\022<\n" + + "\007listing\030\001 \001(\tB+\340A\001\372A%\n" + + "#analyticshub.googleapis.com/Listing\022\031\n" + "\014subscription\030\002 \001(\tB\003\340A\001\032-\n" + "\013LabelsEntry\022\013\n" + "\003key\030\001 \001(\t\022\r\n" + + "\005value\030\002 \001(\t:\0028\001\032+\n" + + "\tTagsEntry\022\013\n" + + "\003key\030\001 \001(\t\022\r\n" + "\005value\030\002 \001(\t:\0028\001\">\n" + "\005State\022\025\n" + "\021STATE_UNSPECIFIED\020\000\022\n\n" + "\006ACTIVE\020\001\022\022\n" + "\016RESOURCE_ERROR\020\002:u\352Ar\n" - + "\"pubsub." - + "googleapis.com/Subscription\022/projects/{project}/subscriptions/{subscription}*\r" + + "\"pubsub.googleapis.com/Subscription\022/" + + "projects/{project}/subscriptions/{subscription}*\r" + "subscriptions2\014subscription\"\177\n" + "\013RetryPolicy\0227\n" + "\017minimum_backoff\030\001" + " \001(\0132\031.google.protobuf.DurationB\003\340A\001\0227\n" - + "\017maximum_backoff\030\002 \001(\0132\031.google.protobuf.DurationB\003\340A\001\"V\n" - + "\020DeadLetterPolicy\022\036\n" - + "\021dead_letter_topic\030\001 \001(\tB\003\340A\001\022\"\n" + + "\017maximum_backoff\030\002 \001(\0132\031.google.protobuf.DurationB\003\340A\001\"v\n" + + "\020DeadLetterPolicy\022>\n" + + "\021dead_letter_topic\030\001 \001(\tB#\340A\001\372A\035\n" + + "\033pubsub.googleapis.com/Topic\022\"\n" + "\025max_delivery_attempts\030\002 \001(\005B\003\340A\001\"?\n" + "\020ExpirationPolicy\022+\n" + "\003ttl\030\001 \001(\0132\031.google.protobuf.DurationB\003\340A\001\"\232\004\n\n" @@ -727,10 +756,10 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "push_endpoint\030\001 \001(\tB\003\340A\001\022E\n\n" + "attributes\030\002" + " \003(\0132,.google.pubsub.v1.PushConfig.AttributesEntryB\003\340A\001\022A\n\n" - + "oidc_token\030\003 \001(" - + "\0132&.google.pubsub.v1.PushConfig.OidcTokenB\003\340A\001H\000\022I\n" - + "\016pubsub_wrapper\030\004 \001(\0132*.googl" - + "e.pubsub.v1.PushConfig.PubsubWrapperB\003\340A\001H\001\022A\n\n" + + "oidc_token\030\003" + + " \001(\0132&.google.pubsub.v1.PushConfig.OidcTokenB\003\340A\001H\000\022I\n" + + "\016pubsub_wrapper\030\004 \001(\0132*.go" + + "ogle.pubsub.v1.PushConfig.PubsubWrapperB\003\340A\001H\001\022A\n\n" + "no_wrapper\030\005" + " \001(\0132&.google.pubsub.v1.PushConfig.NoWrapperB\003\340A\001H\001\032F\n" + "\tOidcToken\022\"\n" @@ -749,8 +778,8 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "\020use_topic_schema\030\002 \001(\010B\003\340A\001\022\033\n" + "\016write_metadata\030\003 \001(\010B\003\340A\001\022 \n" + "\023drop_unknown_fields\030\004 \001(\010B\003\340A\001\022:\n" - + "\005state\030\005 \001(\0162&.g" - + "oogle.pubsub.v1.BigQueryConfig.StateB\003\340A\003\022\035\n" + + "\005state\030\005 \001(\0162" + + "&.google.pubsub.v1.BigQueryConfig.StateB\003\340A\003\022\035\n" + "\020use_table_schema\030\006 \001(\010B\003\340A\001\022\"\n" + "\025service_account_email\030\007 \001(\tB\003\340A\001\"\212\001\n" + "\005State\022\025\n" @@ -774,8 +803,8 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + " \001(\0132\031.google.protobuf.DurationB\003\340A\001\022\026\n" + "\tmax_bytes\030\007 \001(\003B\003\340A\001\022\031\n" + "\014max_messages\030\010 \001(\003B\003\340A\001\022>\n" - + "\005state\030\t" - + " \001(\0162*.google.pubsub.v1.CloudStorageConfig.StateB\003\340A\003\022\"\n" + + "\005state\030\t \001(\0162*.google.p" + + "ubsub.v1.CloudStorageConfig.StateB\003\340A\003\022\"\n" + "\025service_account_email\030\013 \001(\tB\003\340A\001\032\014\n\n" + "TextConfig\032H\n\n" + "AvroConfig\022\033\n" @@ -808,8 +837,8 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "\tpage_size\030\002 \001(\005B\003\340A\001\022\027\n\n" + "page_token\030\003 \001(\tB\003\340A\001\"u\n" + "\031ListSubscriptionsResponse\022:\n\r" - + "subscriptions\030\001" - + " \003(\0132\036.google.pubsub.v1.SubscriptionB\003\340A\001\022\034\n" + + "subscriptions\030\001 \003(" + + "\0132\036.google.pubsub.v1.SubscriptionB\003\340A\001\022\034\n" + "\017next_page_token\030\002 \001(\tB\003\340A\001\"]\n" + "\031DeleteSubscriptionRequest\022@\n" + "\014subscription\030\001 \001(\tB*\340A\002\372A$\n" @@ -851,12 +880,13 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "\025StreamingPullResponse\022A\n" + "\021received_messages\030\001" + " \003(\0132!.google.pubsub.v1.ReceivedMessageB\003\340A\001\022f\n" - + "\030acknowledge_confirmation\030\005" - + " \001(\0132?.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmationB\003\340A\001\022t\n" - + " modify_ack_deadline_confirmation\030\003 \001(\0132" - + "E.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmationB\003\340A\001\022d\n" - + "\027subscription_properties\030\004 \001(\0132>.google.pu" - + "bsub.v1.StreamingPullResponse.SubscriptionPropertiesB\003\340A\001\032\224\001\n" + + "\030acknowledge_confirmation\030\005 \001(\0132?.google.pubsub.v1.StreamingP" + + "ullResponse.AcknowledgeConfirmationB\003\340A\001\022t\n" + + " modify_ack_deadline_confirmation\030\003 \001" + + "(\0132E.google.pubsub.v1.StreamingPullRespo" + + "nse.ModifyAckDeadlineConfirmationB\003\340A\001\022d\n" + + "\027subscription_properties\030\004 \001(\0132>.google" + + ".pubsub.v1.StreamingPullResponse.SubscriptionPropertiesB\003\340A\001\032\224\001\n" + "\027AcknowledgeConfirmation\022\024\n" + "\007ack_ids\030\001 \003(\tB\003\340A\001\022\034\n" + "\017invalid_ack_ids\030\002 \003(\tB\003\340A\001\022\036\n" @@ -868,16 +898,21 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "\030temporary_failed_ack_ids\030\003 \003(\tB\003\340A\001\032k\n" + "\026SubscriptionProperties\022*\n" + "\035exactly_once_delivery_enabled\030\001 \001(\010B\003\340A\001\022%\n" - + "\030message_ordering_enabled\030\002 \001(\010B\003\340A\001\"\210\002\n" + + "\030message_ordering_enabled\030\002 \001(\010B\003\340A\001\"\201\003\n" + "\025CreateSnapshotRequest\0224\n" + "\004name\030\001 \001(\tB&\340A\002\372A \n" + "\036pubsub.googleapis.com/Snapshot\022@\n" + "\014subscription\030\002 \001(\tB*\340A\002\372A$\n" + "\"pubsub.googleapis.com/Subscription\022H\n" - + "\006labels\030\003 " - + "\003(\01323.google.pubsub.v1.CreateSnapshotRequest.LabelsEntryB\003\340A\001\032-\n" + + "\006labels\030\003 \003(\01323.google.pubsub.v1.CreateSnapshot", + "Request.LabelsEntryB\003\340A\001\022J\n" + + "\004tags\030\004 \003(\01321.google.pubsub.v1.CreateSnapshotRequest.TagsEntryB" + + "\t\340A\004\340A\005\340A\001\032-\n" + "\013LabelsEntry\022\013\n" + "\003key\030\001 \001(\t\022\r\n" + + "\005value\030\002 \001(\t:\0028\001\032+\n" + + "\tTagsEntry\022\013\n" + + "\003key\030\001 \001(\t\022\r\n" + "\005value\030\002 \001(\t:\0028\001\"\200\001\n" + "\025UpdateSnapshotRequest\0221\n" + "\010snapshot\030\001 \001(\0132\032.google.pubsub.v1.SnapshotB\003\340A\002\0224\n" @@ -888,139 +923,127 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "\005topic\030\002 \001(\tB#\340A\001\372A\035\n" + "\033pubsub.googleapis.com/Topic\0224\n" + "\013expire_time\030\003 \001(\0132\032.google.protobuf.TimestampB\003\340A\001\022;\n" - + "\006labels\030\004 \003(\0132&.goog" - + "le.pubsub.v1.Snapshot.LabelsEntryB\003\340A\001\032-\n" + + "\006labels\030\004 \003(\0132&." + + "google.pubsub.v1.Snapshot.LabelsEntryB\003\340A\001\032-\n" + "\013LabelsEntry\022\013\n" + "\003key\030\001 \001(\t\022\r\n" + "\005value\030\002 \001(\t:\0028\001:a\352A^\n" - + "\036pubsub.googleapis.com/Snapshot\022\'projects/{project}/snapshots/{snapsh", - "ot}*\tsnapshots2\010snapshot\"N\n\022GetSnapshotR" - + "equest\0228\n\010snapshot\030\001 \001(\tB&\340A\002\372A \n\036pubsub" - + ".googleapis.com/Snapshot\"\215\001\n\024ListSnapsho" - + "tsRequest\022D\n\007project\030\001 \001(\tB3\340A\002\372A-\n+clou" - + "dresourcemanager.googleapis.com/Project\022" - + "\026\n\tpage_size\030\002 \001(\005B\003\340A\001\022\027\n\npage_token\030\003 " - + "\001(\tB\003\340A\001\"i\n\025ListSnapshotsResponse\0222\n\tsna" - + "pshots\030\001 \003(\0132\032.google.pubsub.v1.Snapshot" - + "B\003\340A\001\022\034\n\017next_page_token\030\002 \001(\tB\003\340A\001\"Q\n\025D" - + "eleteSnapshotRequest\0228\n\010snapshot\030\001 \001(\tB&" - + "\340A\002\372A \n\036pubsub.googleapis.com/Snapshot\"\306" - + "\001\n\013SeekRequest\022@\n\014subscription\030\001 \001(\tB*\340A" - + "\002\372A$\n\"pubsub.googleapis.com/Subscription" - + "\022/\n\004time\030\002 \001(\0132\032.google.protobuf.Timesta" - + "mpB\003\340A\001H\000\022:\n\010snapshot\030\003 \001(\tB&\340A\001\372A \n\036pub" - + "sub.googleapis.com/SnapshotH\000B\010\n\006target\"" - + "\016\n\014SeekResponse2\270\013\n\tPublisher\022q\n\013CreateT" - + "opic\022\027.google.pubsub.v1.Topic\032\027.google.p" - + "ubsub.v1.Topic\"0\332A\004name\202\323\344\223\002#\032\036/v1/{name" - + "=projects/*/topics/*}:\001*\022\221\001\n\013UpdateTopic" - + "\022$.google.pubsub.v1.UpdateTopicRequest\032\027" - + ".google.pubsub.v1.Topic\"C\332A\021topic,update" - + "_mask\202\323\344\223\002)2$/v1/{topic.name=projects/*/" - + "topics/*}:\001*\022\223\001\n\007Publish\022 .google.pubsub" - + ".v1.PublishRequest\032!.google.pubsub.v1.Pu" - + "blishResponse\"C\332A\016topic,messages\202\323\344\223\002,\"\'" - + "/v1/{topic=projects/*/topics/*}:publish:" - + "\001*\022w\n\010GetTopic\022!.google.pubsub.v1.GetTop" - + "icRequest\032\027.google.pubsub.v1.Topic\"/\332A\005t" - + "opic\202\323\344\223\002!\022\037/v1/{topic=projects/*/topics" - + "/*}\022\212\001\n\nListTopics\022#.google.pubsub.v1.Li" - + "stTopicsRequest\032$.google.pubsub.v1.ListT" - + "opicsResponse\"1\332A\007project\202\323\344\223\002!\022\037/v1/{pr" - + "oject=projects/*}/topics\022\272\001\n\026ListTopicSu" - + "bscriptions\022/.google.pubsub.v1.ListTopic" - + "SubscriptionsRequest\0320.google.pubsub.v1." - + "ListTopicSubscriptionsResponse\"=\332A\005topic" - + "\202\323\344\223\002/\022-/v1/{topic=projects/*/topics/*}/" - + "subscriptions\022\252\001\n\022ListTopicSnapshots\022+.g" - + "oogle.pubsub.v1.ListTopicSnapshotsReques" - + "t\032,.google.pubsub.v1.ListTopicSnapshotsR" - + "esponse\"9\332A\005topic\202\323\344\223\002+\022)/v1/{topic=proj" - + "ects/*/topics/*}/snapshots\022|\n\013DeleteTopi" - + "c\022$.google.pubsub.v1.DeleteTopicRequest\032" - + "\026.google.protobuf.Empty\"/\332A\005topic\202\323\344\223\002!*" - + "\037/v1/{topic=projects/*/topics/*}\022\255\001\n\022Det" - + "achSubscription\022+.google.pubsub.v1.Detac" - + "hSubscriptionRequest\032,.google.pubsub.v1." - + "DetachSubscriptionResponse\"<\202\323\344\223\0026\"4/v1/" - + "{subscription=projects/*/subscriptions/*" - + "}:detach\032p\312A\025pubsub.googleapis.com\322AUhtt" - + "ps://www.googleapis.com/auth/cloud-platf" - + "orm,https://www.googleapis.com/auth/pubs" - + "ub2\322\025\n\nSubscriber\022\264\001\n\022CreateSubscription" - + "\022\036.google.pubsub.v1.Subscription\032\036.googl" - + "e.pubsub.v1.Subscription\"^\332A+name,topic," - + "push_config,ack_deadline_seconds\202\323\344\223\002*\032%" - + "/v1/{name=projects/*/subscriptions/*}:\001*" - + "\022\241\001\n\017GetSubscription\022(.google.pubsub.v1." - + "GetSubscriptionRequest\032\036.google.pubsub.v" - + "1.Subscription\"D\332A\014subscription\202\323\344\223\002/\022-/" - + "v1/{subscription=projects/*/subscription" - + "s/*}\022\273\001\n\022UpdateSubscription\022+.google.pub" - + "sub.v1.UpdateSubscriptionRequest\032\036.googl" - + "e.pubsub.v1.Subscription\"X\332A\030subscriptio" - + "n,update_mask\202\323\344\223\002722/v1/{subscription.n" - + "ame=projects/*/subscriptions/*}:\001*\022\246\001\n\021L" - + "istSubscriptions\022*.google.pubsub.v1.List" - + "SubscriptionsRequest\032+.google.pubsub.v1." - + "ListSubscriptionsResponse\"8\332A\007project\202\323\344" - + "\223\002(\022&/v1/{project=projects/*}/subscripti" - + "ons\022\237\001\n\022DeleteSubscription\022+.google.pubs" - + "ub.v1.DeleteSubscriptionRequest\032\026.google" - + ".protobuf.Empty\"D\332A\014subscription\202\323\344\223\002/*-" + + "\036pubsub.googleapis.com/Snapshot\022\'projects/{project}/snapshots/{snapshot}*" + + "\tsnapshots2\010snapshot\"N\n" + + "\022GetSnapshotRequest\0228\n" + + "\010snapshot\030\001 \001(\tB&\340A\002\372A \n" + + "\036pubsub.googleapis.com/Snapshot\"\215\001\n" + + "\024ListSnapshotsRequest\022D\n" + + "\007project\030\001 \001(\tB3\340A\002\372A-\n" + + "+cloudresourcemanager.googleapis.com/Project\022\026\n" + + "\tpage_size\030\002 \001(\005B\003\340A\001\022\027\n\n" + + "page_token\030\003 \001(\tB\003\340A\001\"i\n" + + "\025ListSnapshotsResponse\0222\n" + + "\tsnapshots\030\001 \003(\0132\032.google.pubsub.v1.SnapshotB\003\340A\001\022\034\n" + + "\017next_page_token\030\002 \001(\tB\003\340A\001\"Q\n" + + "\025DeleteSnapshotRequest\0228\n" + + "\010snapshot\030\001 \001(\tB&\340A\002\372A \n" + + "\036pubsub.googleapis.com/Snapshot\"\306\001\n" + + "\013SeekRequest\022@\n" + + "\014subscription\030\001 \001(\tB*\340A\002\372A$\n" + + "\"pubsub.googleapis.com/Subscription\022/\n" + + "\004time\030\002 \001(\0132\032.google.protobuf.TimestampB\003\340A\001H\000\022:\n" + + "\010snapshot\030\003 \001(\tB&\340A\001\372A \n" + + "\036pubsub.googleapis.com/SnapshotH\000B\010\n" + + "\006target\"\016\n" + + "\014SeekResponse2\270\013\n" + + "\tPublisher\022q\n" + + "\013CreateTopic\022\027.google.pubsub.v1.Topic\032\027.goog" + + "le.pubsub.v1.Topic\"0\332A\004name\202\323\344\223\002#\032\036/v1/{name=projects/*/topics/*}:\001*\022\221\001\n" + + "\013UpdateTopic\022$.google.pubsub.v1.UpdateTopicReque" + + "st\032\027.google.pubsub.v1.Topic\"C\332A\021topic,up" + + "date_mask\202\323\344\223\002)2$/v1/{topic.name=projects/*/topics/*}:\001*\022\223\001\n" + + "\007Publish\022 .google.pubsub.v1.PublishRequest\032!.google.pubsub.v" + + "1.PublishResponse\"C\332A\016topic,messages\202\323\344\223" + + "\002,\"\'/v1/{topic=projects/*/topics/*}:publish:\001*\022w\n" + + "\010GetTopic\022!.google.pubsub.v1.GetTopicRequest\032\027.google.pubsub.v1.Topic\"/" + + "\332A\005topic\202\323\344\223\002!\022\037/v1/{topic=projects/*/topics/*}\022\212\001\n\n" + + "ListTopics\022#.google.pubsub.v1.ListTopicsRequest\032$.google.pubsub.v1.L" + + "istTopicsResponse\"1\332A\007project\202\323\344\223\002!\022\037/v1/{project=projects/*}/topics\022\272\001\n" + + "\026ListTopicSubscriptions\022/.google.pubsub.v1.ListT" + + "opicSubscriptionsRequest\0320.google.pubsub" + + ".v1.ListTopicSubscriptionsResponse\"=\332A\005t" + + "opic\202\323\344\223\002/\022-/v1/{topic=projects/*/topics/*}/subscriptions\022\252\001\n" + + "\022ListTopicSnapshots\022+.google.pubsub.v1.ListTopicSnapshotsRe" + + "quest\032,.google.pubsub.v1.ListTopicSnapsh" + + "otsResponse\"9\332A\005topic\202\323\344\223\002+\022)/v1/{topic=projects/*/topics/*}/snapshots\022|\n" + + "\013DeleteTopic\022$.google.pubsub.v1.DeleteTopicRequ" + + "est\032\026.google.protobuf.Empty\"/\332A\005topic\202\323\344\223\002!*\037/v1/{topic=projects/*/topics/*}\022\255\001\n" + + "\022DetachSubscription\022+.google.pubsub.v1.D" + + "etachSubscriptionRequest\032,.google.pubsub" + + ".v1.DetachSubscriptionResponse\"<\202\323\344\223\0026\"4" + "/v1/{subscription=projects/*/subscriptio" - + "ns/*}\022\317\001\n\021ModifyAckDeadline\022*.google.pub" - + "sub.v1.ModifyAckDeadlineRequest\032\026.google" - + ".protobuf.Empty\"v\332A)subscription,ack_ids" - + ",ack_deadline_seconds\202\323\344\223\002D\"?/v1/{subscr" - + "iption=projects/*/subscriptions/*}:modif" - + "yAckDeadline:\001*\022\250\001\n\013Acknowledge\022$.google" - + ".pubsub.v1.AcknowledgeRequest\032\026.google.p" - + "rotobuf.Empty\"[\332A\024subscription,ack_ids\202\323" - + "\344\223\002>\"9/v1/{subscription=projects/*/subsc" - + "riptions/*}:acknowledge:\001*\022\320\001\n\004Pull\022\035.go" - + "ogle.pubsub.v1.PullRequest\032\036.google.pubs" - + "ub.v1.PullResponse\"\210\001\332A,subscription,ret" - + "urn_immediately,max_messages\332A\031subscript" - + "ion,max_messages\202\323\344\223\0027\"2/v1/{subscriptio" - + "n=projects/*/subscriptions/*}:pull:\001*\022f\n" - + "\rStreamingPull\022&.google.pubsub.v1.Stream" - + "ingPullRequest\032\'.google.pubsub.v1.Stream" - + "ingPullResponse\"\000(\0010\001\022\273\001\n\020ModifyPushConf" - + "ig\022).google.pubsub.v1.ModifyPushConfigRe" - + "quest\032\026.google.protobuf.Empty\"d\332A\030subscr" - + "iption,push_config\202\323\344\223\002C\">/v1/{subscript" - + "ion=projects/*/subscriptions/*}:modifyPu" - + "shConfig:\001*\022\211\001\n\013GetSnapshot\022$.google.pub" - + "sub.v1.GetSnapshotRequest\032\032.google.pubsu" - + "b.v1.Snapshot\"8\332A\010snapshot\202\323\344\223\002\'\022%/v1/{s" - + "napshot=projects/*/snapshots/*}\022\226\001\n\rList" - + "Snapshots\022&.google.pubsub.v1.ListSnapsho" - + "tsRequest\032\'.google.pubsub.v1.ListSnapsho" - + "tsResponse\"4\332A\007project\202\323\344\223\002$\022\"/v1/{proje" - + "ct=projects/*}/snapshots\022\227\001\n\016CreateSnaps" - + "hot\022\'.google.pubsub.v1.CreateSnapshotReq" - + "uest\032\032.google.pubsub.v1.Snapshot\"@\332A\021nam" - + "e,subscription\202\323\344\223\002&\032!/v1/{name=projects" - + "/*/snapshots/*}:\001*\022\243\001\n\016UpdateSnapshot\022\'." - + "google.pubsub.v1.UpdateSnapshotRequest\032\032" - + ".google.pubsub.v1.Snapshot\"L\332A\024snapshot," - + "update_mask\202\323\344\223\002/2*/v1/{snapshot.name=pr" - + "ojects/*/snapshots/*}:\001*\022\213\001\n\016DeleteSnaps" - + "hot\022\'.google.pubsub.v1.DeleteSnapshotReq" - + "uest\032\026.google.protobuf.Empty\"8\332A\010snapsho" - + "t\202\323\344\223\002\'*%/v1/{snapshot=projects/*/snapsh" - + "ots/*}\022\204\001\n\004Seek\022\035.google.pubsub.v1.SeekR" - + "equest\032\036.google.pubsub.v1.SeekResponse\"=" - + "\202\323\344\223\0027\"2/v1/{subscription=projects/*/sub" - + "scriptions/*}:seek:\001*\032p\312A\025pubsub.googlea" - + "pis.com\322AUhttps://www.googleapis.com/aut" - + "h/cloud-platform,https://www.googleapis." - + "com/auth/pubsubB\252\001\n\024com.google.pubsub.v1" - + "B\013PubsubProtoP\001Z5cloud.google.com/go/pub" - + "sub/v2/apiv1/pubsubpb;pubsubpb\252\002\026Google." - + "Cloud.PubSub.V1\312\002\026Google\\Cloud\\PubSub\\V1" - + "\352\002\031Google::Cloud::PubSub::V1b\006proto3" + + "ns/*}:detach\032p\312A\025pubsub.googleapis.com\322A" + + "Uhttps://www.googleapis.com/auth/cloud-p" + + "latform,https://www.googleapis.com/auth/pubsub2\322\025\n\n" + + "Subscriber\022\264\001\n" + + "\022CreateSubscription\022\036.google.pubsub.v1.Subscription\032\036.g" + + "oogle.pubsub.v1.Subscription\"^\332A+name,to" + + "pic,push_config,ack_deadline_seconds\202\323\344\223" + + "\002*\032%/v1/{name=projects/*/subscriptions/*}:\001*\022\241\001\n" + + "\017GetSubscription\022(.google.pubsub.v1.GetSubscriptionRequest\032\036.google.pubs" + + "ub.v1.Subscription\"D\332A\014subscription\202\323\344\223\002" + + "/\022-/v1/{subscription=projects/*/subscriptions/*}\022\273\001\n" + + "\022UpdateSubscription\022+.google.pubsub.v1.UpdateSubscriptionRequest\032\036.g" + + "oogle.pubsub.v1.Subscription\"X\332A\030subscri" + + "ption,update_mask\202\323\344\223\002722/v1/{subscripti" + + "on.name=projects/*/subscriptions/*}:\001*\022\246\001\n" + + "\021ListSubscriptions\022*.google.pubsub.v1." + + "ListSubscriptionsRequest\032+.google.pubsub" + + ".v1.ListSubscriptionsResponse\"8\332A\007projec" + + "t\202\323\344\223\002(\022&/v1/{project=projects/*}/subscriptions\022\237\001\n" + + "\022DeleteSubscription\022+.google.pubsub.v1.DeleteSubscriptionRequest\032\026.go" + + "ogle.protobuf.Empty\"D\332A\014subscription\202\323\344\223" + + "\002/*-/v1/{subscription=projects/*/subscriptions/*}\022\317\001\n" + + "\021ModifyAckDeadline\022*.google.pubsub.v1.ModifyAckDeadlineRequest\032\026.go" + + "ogle.protobuf.Empty\"v\332A)subscription,ack" + + "_ids,ack_deadline_seconds\202\323\344\223\002D\"?/v1/{su" + + "bscription=projects/*/subscriptions/*}:modifyAckDeadline:\001*\022\250\001\n" + + "\013Acknowledge\022$.google.pubsub.v1.AcknowledgeRequest\032\026.goog" + + "le.protobuf.Empty\"[\332A\024subscription,ack_i" + + "ds\202\323\344\223\002>\"9/v1/{subscription=projects/*/subscriptions/*}:acknowledge:\001*\022\320\001\n" + + "\004Pull\022\035.google.pubsub.v1.PullRequest\032\036.google." + + "pubsub.v1.PullResponse\"\210\001\332A,subscription" + + ",return_immediately,max_messages\332A\031subsc" + + "ription,max_messages\202\323\344\223\0027\"2/v1/{subscri" + + "ption=projects/*/subscriptions/*}:pull:\001*\022f\n\r" + + "StreamingPull\022&.google.pubsub.v1.St" + + "reamingPullRequest\032\'.google.pubsub.v1.StreamingPullResponse\"\000(\0010\001\022\273\001\n" + + "\020ModifyPushConfig\022).google.pubsub.v1.ModifyPushConf" + + "igRequest\032\026.google.protobuf.Empty\"d\332A\030su" + + "bscription,push_config\202\323\344\223\002C\">/v1/{subsc" + + "ription=projects/*/subscriptions/*}:modifyPushConfig:\001*\022\211\001\n" + + "\013GetSnapshot\022$.google.pubsub.v1.GetSnapshotRequest\032\032.google.p" + + "ubsub.v1.Snapshot\"8\332A\010snapshot\202\323\344\223\002\'\022%/v1/{snapshot=projects/*/snapshots/*}\022\226\001\n\r" + + "ListSnapshots\022&.google.pubsub.v1.ListSna" + + "pshotsRequest\032\'.google.pubsub.v1.ListSna" + + "pshotsResponse\"4\332A\007project\202\323\344\223\002$\022\"/v1/{project=projects/*}/snapshots\022\227\001\n" + + "\016CreateSnapshot\022\'.google.pubsub.v1.CreateSnapsho" + + "tRequest\032\032.google.pubsub.v1.Snapshot\"@\332A" + + "\021name,subscription\202\323\344\223\002&\032!/v1/{name=projects/*/snapshots/*}:\001*\022\243\001\n" + + "\016UpdateSnapshot\022\'.google.pubsub.v1.UpdateSnapshotReque" + + "st\032\032.google.pubsub.v1.Snapshot\"L\332A\024snaps" + + "hot,update_mask\202\323\344\223\002/2*/v1/{snapshot.name=projects/*/snapshots/*}:\001*\022\213\001\n" + + "\016DeleteSnapshot\022\'.google.pubsub.v1.DeleteSnapsho" + + "tRequest\032\026.google.protobuf.Empty\"8\332A\010sna" + + "pshot\202\323\344\223\002\'*%/v1/{snapshot=projects/*/snapshots/*}\022\204\001\n" + + "\004Seek\022\035.google.pubsub.v1.SeekRequest\032\036.google.pubsub.v1.SeekRespon" + + "se\"=\202\323\344\223\0027\"2/v1/{subscription=projects/*" + + "/subscriptions/*}:seek:\001*\032p\312A\025pubsub.goo" + + "gleapis.com\322AUhttps://www.googleapis.com" + + "/auth/cloud-platform,https://www.googleapis.com/auth/pubsubB\247\003\n" + + "\024com.google.pubsub.v1B\013PubsubProtoP\001Z5cloud.google.com/go" + + "/pubsub/v2/apiv1/pubsubpb;pubsubpb\252\002\026Goo" + + "gle.Cloud.PubSub.V1\312\002\026Google\\Cloud\\PubSub\\V1\352\002\031Google::Cloud::PubSub::V1\352Ax\n" + + "!cloudkms.googleapis.com/CryptoKey\022Sprojects" + + "/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}\352A\177\n" + + "#analyticshub.googleapis.com/Listing\022Xprojects/{project}/locations/{location}/dat" + + "aExchanges/{data_exchange}/listings/{listing}b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( @@ -1279,6 +1302,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "SequenceNumber", "SchemaViolationReason", "MessageTransformationFailureReason", + "ApiViolationReason", "Reason", }); internal_static_google_pubsub_v1_JavaScriptUDF_descriptor = @@ -1312,6 +1336,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "State", "IngestionDataSourceSettings", "MessageTransforms", + "Tags", }); internal_static_google_pubsub_v1_Topic_LabelsEntry_descriptor = internal_static_google_pubsub_v1_Topic_descriptor.getNestedTypes().get(0); @@ -1321,6 +1346,14 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new java.lang.String[] { "Key", "Value", }); + internal_static_google_pubsub_v1_Topic_TagsEntry_descriptor = + internal_static_google_pubsub_v1_Topic_descriptor.getNestedTypes().get(1); + internal_static_google_pubsub_v1_Topic_TagsEntry_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_pubsub_v1_Topic_TagsEntry_descriptor, + new java.lang.String[] { + "Key", "Value", + }); internal_static_google_pubsub_v1_PubsubMessage_descriptor = getDescriptor().getMessageTypes().get(8); internal_static_google_pubsub_v1_PubsubMessage_fieldAccessorTable = @@ -1465,6 +1498,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "State", "AnalyticsHubSubscriptionInfo", "MessageTransforms", + "Tags", }); internal_static_google_pubsub_v1_Subscription_AnalyticsHubSubscriptionInfo_descriptor = internal_static_google_pubsub_v1_Subscription_descriptor.getNestedTypes().get(0); @@ -1482,6 +1516,14 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new java.lang.String[] { "Key", "Value", }); + internal_static_google_pubsub_v1_Subscription_TagsEntry_descriptor = + internal_static_google_pubsub_v1_Subscription_descriptor.getNestedTypes().get(2); + internal_static_google_pubsub_v1_Subscription_TagsEntry_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_pubsub_v1_Subscription_TagsEntry_descriptor, + new java.lang.String[] { + "Key", "Value", + }); internal_static_google_pubsub_v1_RetryPolicy_descriptor = getDescriptor().getMessageTypes().get(23); internal_static_google_pubsub_v1_RetryPolicy_fieldAccessorTable = @@ -1742,7 +1784,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_pubsub_v1_CreateSnapshotRequest_descriptor, new java.lang.String[] { - "Name", "Subscription", "Labels", + "Name", "Subscription", "Labels", "Tags", }); internal_static_google_pubsub_v1_CreateSnapshotRequest_LabelsEntry_descriptor = internal_static_google_pubsub_v1_CreateSnapshotRequest_descriptor.getNestedTypes().get(0); @@ -1752,6 +1794,14 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new java.lang.String[] { "Key", "Value", }); + internal_static_google_pubsub_v1_CreateSnapshotRequest_TagsEntry_descriptor = + internal_static_google_pubsub_v1_CreateSnapshotRequest_descriptor.getNestedTypes().get(1); + internal_static_google_pubsub_v1_CreateSnapshotRequest_TagsEntry_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_pubsub_v1_CreateSnapshotRequest_TagsEntry_descriptor, + new java.lang.String[] { + "Key", "Value", + }); internal_static_google_pubsub_v1_UpdateSnapshotRequest_descriptor = getDescriptor().getMessageTypes().get(43); internal_static_google_pubsub_v1_UpdateSnapshotRequest_fieldAccessorTable = @@ -1829,6 +1879,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { registry.add(com.google.api.ClientProto.methodSignature); registry.add(com.google.api.ClientProto.oauthScopes); registry.add(com.google.api.ResourceProto.resource); + registry.add(com.google.api.ResourceProto.resourceDefinition); registry.add(com.google.api.ResourceProto.resourceReference); com.google.protobuf.Descriptors.FileDescriptor.internalUpdateFileDescriptor( descriptor, registry); diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PullRequest.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PullRequest.java index 330b0ece6..c6dbf3f12 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PullRequest.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PullRequest.java @@ -141,7 +141,7 @@ public com.google.protobuf.ByteString getSubscriptionBytes() { * * * @deprecated google.pubsub.v1.PullRequest.return_immediately is deprecated. See - * google/pubsub/v1/pubsub.proto;l=1983 + * google/pubsub/v1/pubsub.proto;l=2039 * @return The returnImmediately. */ @java.lang.Override @@ -700,7 +700,7 @@ public Builder setSubscriptionBytes(com.google.protobuf.ByteString value) { * * * @deprecated google.pubsub.v1.PullRequest.return_immediately is deprecated. See - * google/pubsub/v1/pubsub.proto;l=1983 + * google/pubsub/v1/pubsub.proto;l=2039 * @return The returnImmediately. */ @java.lang.Override @@ -727,7 +727,7 @@ public boolean getReturnImmediately() { * * * @deprecated google.pubsub.v1.PullRequest.return_immediately is deprecated. See - * google/pubsub/v1/pubsub.proto;l=1983 + * google/pubsub/v1/pubsub.proto;l=2039 * @param value The returnImmediately to set. * @return This builder for chaining. */ @@ -758,7 +758,7 @@ public Builder setReturnImmediately(boolean value) { * * * @deprecated google.pubsub.v1.PullRequest.return_immediately is deprecated. See - * google/pubsub/v1/pubsub.proto;l=1983 + * google/pubsub/v1/pubsub.proto;l=2039 * @return This builder for chaining. */ @java.lang.Deprecated diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PullRequestOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PullRequestOrBuilder.java index 4f1cb824e..15b70709e 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PullRequestOrBuilder.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PullRequestOrBuilder.java @@ -73,7 +73,7 @@ public interface PullRequestOrBuilder * * * @deprecated google.pubsub.v1.PullRequest.return_immediately is deprecated. See - * google/pubsub/v1/pubsub.proto;l=1983 + * google/pubsub/v1/pubsub.proto;l=2039 * @return The returnImmediately. */ @java.lang.Deprecated diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/StreamingPullResponse.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/StreamingPullResponse.java index 677345113..bf36bc06f 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/StreamingPullResponse.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/StreamingPullResponse.java @@ -4214,7 +4214,7 @@ public com.google.protobuf.Parser getParserForType() { * * *
-   * Optional. Received Pub/Sub messages. This will not be empty.
+   * Optional. Received Pub/Sub messages.
    * 
* * @@ -4230,7 +4230,7 @@ public java.util.List getReceivedMessagesL * * *
-   * Optional. Received Pub/Sub messages. This will not be empty.
+   * Optional. Received Pub/Sub messages.
    * 
* * @@ -4247,7 +4247,7 @@ public java.util.List getReceivedMessagesL * * *
-   * Optional. Received Pub/Sub messages. This will not be empty.
+   * Optional. Received Pub/Sub messages.
    * 
* * @@ -4263,7 +4263,7 @@ public int getReceivedMessagesCount() { * * *
-   * Optional. Received Pub/Sub messages. This will not be empty.
+   * Optional. Received Pub/Sub messages.
    * 
* * @@ -4279,7 +4279,7 @@ public com.google.pubsub.v1.ReceivedMessage getReceivedMessages(int index) { * * *
-   * Optional. Received Pub/Sub messages. This will not be empty.
+   * Optional. Received Pub/Sub messages.
    * 
* * @@ -5023,7 +5023,7 @@ private void ensureReceivedMessagesIsMutable() { * * *
-     * Optional. Received Pub/Sub messages. This will not be empty.
+     * Optional. Received Pub/Sub messages.
      * 
* * @@ -5042,7 +5042,7 @@ public java.util.List getReceivedMessagesL * * *
-     * Optional. Received Pub/Sub messages. This will not be empty.
+     * Optional. Received Pub/Sub messages.
      * 
* * @@ -5061,7 +5061,7 @@ public int getReceivedMessagesCount() { * * *
-     * Optional. Received Pub/Sub messages. This will not be empty.
+     * Optional. Received Pub/Sub messages.
      * 
* * @@ -5080,7 +5080,7 @@ public com.google.pubsub.v1.ReceivedMessage getReceivedMessages(int index) { * * *
-     * Optional. Received Pub/Sub messages. This will not be empty.
+     * Optional. Received Pub/Sub messages.
      * 
* * @@ -5105,7 +5105,7 @@ public Builder setReceivedMessages(int index, com.google.pubsub.v1.ReceivedMessa * * *
-     * Optional. Received Pub/Sub messages. This will not be empty.
+     * Optional. Received Pub/Sub messages.
      * 
* * @@ -5128,7 +5128,7 @@ public Builder setReceivedMessages( * * *
-     * Optional. Received Pub/Sub messages. This will not be empty.
+     * Optional. Received Pub/Sub messages.
      * 
* * @@ -5153,7 +5153,7 @@ public Builder addReceivedMessages(com.google.pubsub.v1.ReceivedMessage value) { * * *
-     * Optional. Received Pub/Sub messages. This will not be empty.
+     * Optional. Received Pub/Sub messages.
      * 
* * @@ -5178,7 +5178,7 @@ public Builder addReceivedMessages(int index, com.google.pubsub.v1.ReceivedMessa * * *
-     * Optional. Received Pub/Sub messages. This will not be empty.
+     * Optional. Received Pub/Sub messages.
      * 
* * @@ -5201,7 +5201,7 @@ public Builder addReceivedMessages( * * *
-     * Optional. Received Pub/Sub messages. This will not be empty.
+     * Optional. Received Pub/Sub messages.
      * 
* * @@ -5224,7 +5224,7 @@ public Builder addReceivedMessages( * * *
-     * Optional. Received Pub/Sub messages. This will not be empty.
+     * Optional. Received Pub/Sub messages.
      * 
* * @@ -5247,7 +5247,7 @@ public Builder addAllReceivedMessages( * * *
-     * Optional. Received Pub/Sub messages. This will not be empty.
+     * Optional. Received Pub/Sub messages.
      * 
* * @@ -5269,7 +5269,7 @@ public Builder clearReceivedMessages() { * * *
-     * Optional. Received Pub/Sub messages. This will not be empty.
+     * Optional. Received Pub/Sub messages.
      * 
* * @@ -5291,7 +5291,7 @@ public Builder removeReceivedMessages(int index) { * * *
-     * Optional. Received Pub/Sub messages. This will not be empty.
+     * Optional. Received Pub/Sub messages.
      * 
* * @@ -5306,7 +5306,7 @@ public com.google.pubsub.v1.ReceivedMessage.Builder getReceivedMessagesBuilder(i * * *
-     * Optional. Received Pub/Sub messages. This will not be empty.
+     * Optional. Received Pub/Sub messages.
      * 
* * @@ -5325,7 +5325,7 @@ public com.google.pubsub.v1.ReceivedMessageOrBuilder getReceivedMessagesOrBuilde * * *
-     * Optional. Received Pub/Sub messages. This will not be empty.
+     * Optional. Received Pub/Sub messages.
      * 
* * @@ -5345,7 +5345,7 @@ public com.google.pubsub.v1.ReceivedMessageOrBuilder getReceivedMessagesOrBuilde * * *
-     * Optional. Received Pub/Sub messages. This will not be empty.
+     * Optional. Received Pub/Sub messages.
      * 
* * @@ -5361,7 +5361,7 @@ public com.google.pubsub.v1.ReceivedMessage.Builder addReceivedMessagesBuilder() * * *
-     * Optional. Received Pub/Sub messages. This will not be empty.
+     * Optional. Received Pub/Sub messages.
      * 
* * @@ -5377,7 +5377,7 @@ public com.google.pubsub.v1.ReceivedMessage.Builder addReceivedMessagesBuilder(i * * *
-     * Optional. Received Pub/Sub messages. This will not be empty.
+     * Optional. Received Pub/Sub messages.
      * 
* * diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/StreamingPullResponseOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/StreamingPullResponseOrBuilder.java index 1a6fedfa8..516c56f47 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/StreamingPullResponseOrBuilder.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/StreamingPullResponseOrBuilder.java @@ -28,7 +28,7 @@ public interface StreamingPullResponseOrBuilder * * *
-   * Optional. Received Pub/Sub messages. This will not be empty.
+   * Optional. Received Pub/Sub messages.
    * 
* * @@ -41,7 +41,7 @@ public interface StreamingPullResponseOrBuilder * * *
-   * Optional. Received Pub/Sub messages. This will not be empty.
+   * Optional. Received Pub/Sub messages.
    * 
* * @@ -54,7 +54,7 @@ public interface StreamingPullResponseOrBuilder * * *
-   * Optional. Received Pub/Sub messages. This will not be empty.
+   * Optional. Received Pub/Sub messages.
    * 
* * @@ -67,7 +67,7 @@ public interface StreamingPullResponseOrBuilder * * *
-   * Optional. Received Pub/Sub messages. This will not be empty.
+   * Optional. Received Pub/Sub messages.
    * 
* * @@ -81,7 +81,7 @@ public interface StreamingPullResponseOrBuilder * * *
-   * Optional. Received Pub/Sub messages. This will not be empty.
+   * Optional. Received Pub/Sub messages.
    * 
* * diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/Subscription.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/Subscription.java index e70130399..9e637b08e 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/Subscription.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/Subscription.java @@ -67,6 +67,8 @@ protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldRefl switch (number) { case 9: return internalGetLabels(); + case 26: + return internalGetTags(); default: throw new RuntimeException("Invalid map field number: " + number); } @@ -259,7 +261,9 @@ public interface AnalyticsHubSubscriptionInfoOrBuilder * "projects/{project}/locations/{location}/dataExchanges/{data_exchange}/listings/{listing}" * * - * string listing = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * string listing = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return The listing. */ @@ -274,7 +278,9 @@ public interface AnalyticsHubSubscriptionInfoOrBuilder * "projects/{project}/locations/{location}/dataExchanges/{data_exchange}/listings/{listing}" * * - * string listing = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * string listing = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return The bytes for listing. */ @@ -374,7 +380,9 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { * "projects/{project}/locations/{location}/dataExchanges/{data_exchange}/listings/{listing}" * * - * string listing = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * string listing = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return The listing. */ @@ -400,7 +408,9 @@ public java.lang.String getListing() { * "projects/{project}/locations/{location}/dataExchanges/{data_exchange}/listings/{listing}" * * - * string listing = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * string listing = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return The bytes for listing. */ @@ -862,7 +872,9 @@ public Builder mergeFrom( * "projects/{project}/locations/{location}/dataExchanges/{data_exchange}/listings/{listing}" * * - * string listing = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * string listing = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return The listing. */ @@ -887,7 +899,9 @@ public java.lang.String getListing() { * "projects/{project}/locations/{location}/dataExchanges/{data_exchange}/listings/{listing}" * * - * string listing = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * string listing = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return The bytes for listing. */ @@ -912,7 +926,9 @@ public com.google.protobuf.ByteString getListingBytes() { * "projects/{project}/locations/{location}/dataExchanges/{data_exchange}/listings/{listing}" * * - * string listing = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * string listing = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @param value The listing to set. * @return This builder for chaining. @@ -936,7 +952,9 @@ public Builder setListing(java.lang.String value) { * "projects/{project}/locations/{location}/dataExchanges/{data_exchange}/listings/{listing}" * * - * string listing = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * string listing = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return This builder for chaining. */ @@ -956,7 +974,9 @@ public Builder clearListing() { * "projects/{project}/locations/{location}/dataExchanges/{data_exchange}/listings/{listing}" * * - * string listing = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * string listing = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @param value The bytes for listing to set. * @return This builder for chaining. @@ -2351,6 +2371,133 @@ public com.google.pubsub.v1.MessageTransformOrBuilder getMessageTransformsOrBuil return messageTransforms_.get(index); } + public static final int TAGS_FIELD_NUMBER = 26; + + private static final class TagsDefaultEntryHolder { + static final com.google.protobuf.MapEntry defaultEntry = + com.google.protobuf.MapEntry.newDefaultInstance( + com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_Subscription_TagsEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.STRING, + ""); + } + + @SuppressWarnings("serial") + private com.google.protobuf.MapField tags_; + + private com.google.protobuf.MapField internalGetTags() { + if (tags_ == null) { + return com.google.protobuf.MapField.emptyMapField(TagsDefaultEntryHolder.defaultEntry); + } + return tags_; + } + + public int getTagsCount() { + return internalGetTags().getMap().size(); + } + + /** + * + * + *
+   * Optional. Input only. Immutable. Tag keys/values directly bound to this
+   * resource. For example:
+   *   "123/environment": "production",
+   *   "123/costCenter": "marketing"
+   * 
+ * + * + * map<string, string> tags = 26 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public boolean containsTags(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetTags().getMap().containsKey(key); + } + + /** Use {@link #getTagsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getTags() { + return getTagsMap(); + } + + /** + * + * + *
+   * Optional. Input only. Immutable. Tag keys/values directly bound to this
+   * resource. For example:
+   *   "123/environment": "production",
+   *   "123/costCenter": "marketing"
+   * 
+ * + * + * map<string, string> tags = 26 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public java.util.Map getTagsMap() { + return internalGetTags().getMap(); + } + + /** + * + * + *
+   * Optional. Input only. Immutable. Tag keys/values directly bound to this
+   * resource. For example:
+   *   "123/environment": "production",
+   *   "123/costCenter": "marketing"
+   * 
+ * + * + * map<string, string> tags = 26 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public /* nullable */ java.lang.String getTagsOrDefault( + java.lang.String key, + /* nullable */ + java.lang.String defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetTags().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + + /** + * + * + *
+   * Optional. Input only. Immutable. Tag keys/values directly bound to this
+   * resource. For example:
+   *   "123/environment": "production",
+   *   "123/costCenter": "marketing"
+   * 
+ * + * + * map<string, string> tags = 26 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public java.lang.String getTagsOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetTags().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -2424,6 +2571,8 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io for (int i = 0; i < messageTransforms_.size(); i++) { output.writeMessage(25, messageTransforms_.get(i)); } + com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( + output, internalGetTags(), TagsDefaultEntryHolder.defaultEntry, 26); getUnknownFields().writeTo(output); } @@ -2507,6 +2656,16 @@ public int getSerializedSize() { size += com.google.protobuf.CodedOutputStream.computeMessageSize(25, messageTransforms_.get(i)); } + for (java.util.Map.Entry entry : + internalGetTags().getMap().entrySet()) { + com.google.protobuf.MapEntry tags__ = + TagsDefaultEntryHolder.defaultEntry + .newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream.computeMessageSize(26, tags__); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -2572,6 +2731,7 @@ public boolean equals(final java.lang.Object obj) { return false; } if (!getMessageTransformsList().equals(other.getMessageTransformsList())) return false; + if (!internalGetTags().equals(other.internalGetTags())) return false; if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -2645,6 +2805,10 @@ public int hashCode() { hash = (37 * hash) + MESSAGE_TRANSFORMS_FIELD_NUMBER; hash = (53 * hash) + getMessageTransformsList().hashCode(); } + if (!internalGetTags().getMap().isEmpty()) { + hash = (37 * hash) + TAGS_FIELD_NUMBER; + hash = (53 * hash) + internalGetTags().hashCode(); + } hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; @@ -2771,6 +2935,8 @@ protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldRefl switch (number) { case 9: return internalGetLabels(); + case 26: + return internalGetTags(); default: throw new RuntimeException("Invalid map field number: " + number); } @@ -2782,6 +2948,8 @@ protected com.google.protobuf.MapFieldReflectionAccessor internalGetMutableMapFi switch (number) { case 9: return internalGetMutableLabels(); + case 26: + return internalGetMutableTags(); default: throw new RuntimeException("Invalid map field number: " + number); } @@ -2888,6 +3056,7 @@ public Builder clear() { messageTransformsBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00080000); + internalGetMutableTags().clear(); return this; } @@ -3020,6 +3189,10 @@ private void buildPartial0(com.google.pubsub.v1.Subscription result) { : analyticsHubSubscriptionInfoBuilder_.build(); to_bitField0_ |= 0x00000100; } + if (((from_bitField0_ & 0x00100000) != 0)) { + result.tags_ = internalGetTags(); + result.tags_.makeImmutable(); + } result.bitField0_ |= to_bitField0_; } @@ -3157,6 +3330,8 @@ public Builder mergeFrom(com.google.pubsub.v1.Subscription other) { } } } + internalGetMutableTags().mergeFrom(other.internalGetTags()); + bitField0_ |= 0x00100000; this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; @@ -3322,6 +3497,15 @@ public Builder mergeFrom( } break; } // case 202 + case 210: + { + com.google.protobuf.MapEntry tags__ = + input.readMessage( + TagsDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry); + internalGetMutableTags().getMutableMap().put(tags__.getKey(), tags__.getValue()); + bitField0_ |= 0x00100000; + break; + } // case 210 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { @@ -7065,6 +7249,213 @@ public com.google.pubsub.v1.MessageTransform.Builder addMessageTransformsBuilder return messageTransformsBuilder_; } + private com.google.protobuf.MapField tags_; + + private com.google.protobuf.MapField internalGetTags() { + if (tags_ == null) { + return com.google.protobuf.MapField.emptyMapField(TagsDefaultEntryHolder.defaultEntry); + } + return tags_; + } + + private com.google.protobuf.MapField + internalGetMutableTags() { + if (tags_ == null) { + tags_ = com.google.protobuf.MapField.newMapField(TagsDefaultEntryHolder.defaultEntry); + } + if (!tags_.isMutable()) { + tags_ = tags_.copy(); + } + bitField0_ |= 0x00100000; + onChanged(); + return tags_; + } + + public int getTagsCount() { + return internalGetTags().getMap().size(); + } + + /** + * + * + *
+     * Optional. Input only. Immutable. Tag keys/values directly bound to this
+     * resource. For example:
+     *   "123/environment": "production",
+     *   "123/costCenter": "marketing"
+     * 
+ * + * + * map<string, string> tags = 26 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public boolean containsTags(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetTags().getMap().containsKey(key); + } + + /** Use {@link #getTagsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getTags() { + return getTagsMap(); + } + + /** + * + * + *
+     * Optional. Input only. Immutable. Tag keys/values directly bound to this
+     * resource. For example:
+     *   "123/environment": "production",
+     *   "123/costCenter": "marketing"
+     * 
+ * + * + * map<string, string> tags = 26 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public java.util.Map getTagsMap() { + return internalGetTags().getMap(); + } + + /** + * + * + *
+     * Optional. Input only. Immutable. Tag keys/values directly bound to this
+     * resource. For example:
+     *   "123/environment": "production",
+     *   "123/costCenter": "marketing"
+     * 
+ * + * + * map<string, string> tags = 26 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public /* nullable */ java.lang.String getTagsOrDefault( + java.lang.String key, + /* nullable */ + java.lang.String defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetTags().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + + /** + * + * + *
+     * Optional. Input only. Immutable. Tag keys/values directly bound to this
+     * resource. For example:
+     *   "123/environment": "production",
+     *   "123/costCenter": "marketing"
+     * 
+ * + * + * map<string, string> tags = 26 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public java.lang.String getTagsOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetTags().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public Builder clearTags() { + bitField0_ = (bitField0_ & ~0x00100000); + internalGetMutableTags().getMutableMap().clear(); + return this; + } + + /** + * + * + *
+     * Optional. Input only. Immutable. Tag keys/values directly bound to this
+     * resource. For example:
+     *   "123/environment": "production",
+     *   "123/costCenter": "marketing"
+     * 
+ * + * + * map<string, string> tags = 26 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder removeTags(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + internalGetMutableTags().getMutableMap().remove(key); + return this; + } + + /** Use alternate mutation accessors instead. */ + @java.lang.Deprecated + public java.util.Map getMutableTags() { + bitField0_ |= 0x00100000; + return internalGetMutableTags().getMutableMap(); + } + + /** + * + * + *
+     * Optional. Input only. Immutable. Tag keys/values directly bound to this
+     * resource. For example:
+     *   "123/environment": "production",
+     *   "123/costCenter": "marketing"
+     * 
+ * + * + * map<string, string> tags = 26 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder putTags(java.lang.String key, java.lang.String value) { + if (key == null) { + throw new NullPointerException("map key"); + } + if (value == null) { + throw new NullPointerException("map value"); + } + internalGetMutableTags().getMutableMap().put(key, value); + bitField0_ |= 0x00100000; + return this; + } + + /** + * + * + *
+     * Optional. Input only. Immutable. Tag keys/values directly bound to this
+     * resource. For example:
+     *   "123/environment": "production",
+     *   "123/costCenter": "marketing"
+     * 
+ * + * + * map<string, string> tags = 26 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder putAllTags(java.util.Map values) { + internalGetMutableTags().getMutableMap().putAll(values); + bitField0_ |= 0x00100000; + return this; + } + @java.lang.Override public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SubscriptionOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SubscriptionOrBuilder.java index 40c9a735d..585c95c3e 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SubscriptionOrBuilder.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SubscriptionOrBuilder.java @@ -886,4 +886,92 @@ java.lang.String getLabelsOrDefault( *
*/ com.google.pubsub.v1.MessageTransformOrBuilder getMessageTransformsOrBuilder(int index); + + /** + * + * + *
+   * Optional. Input only. Immutable. Tag keys/values directly bound to this
+   * resource. For example:
+   *   "123/environment": "production",
+   *   "123/costCenter": "marketing"
+   * 
+ * + * + * map<string, string> tags = 26 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * + */ + int getTagsCount(); + + /** + * + * + *
+   * Optional. Input only. Immutable. Tag keys/values directly bound to this
+   * resource. For example:
+   *   "123/environment": "production",
+   *   "123/costCenter": "marketing"
+   * 
+ * + * + * map<string, string> tags = 26 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * + */ + boolean containsTags(java.lang.String key); + + /** Use {@link #getTagsMap()} instead. */ + @java.lang.Deprecated + java.util.Map getTags(); + + /** + * + * + *
+   * Optional. Input only. Immutable. Tag keys/values directly bound to this
+   * resource. For example:
+   *   "123/environment": "production",
+   *   "123/costCenter": "marketing"
+   * 
+ * + * + * map<string, string> tags = 26 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * + */ + java.util.Map getTagsMap(); + + /** + * + * + *
+   * Optional. Input only. Immutable. Tag keys/values directly bound to this
+   * resource. For example:
+   *   "123/environment": "production",
+   *   "123/costCenter": "marketing"
+   * 
+ * + * + * map<string, string> tags = 26 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * + */ + /* nullable */ + java.lang.String getTagsOrDefault( + java.lang.String key, + /* nullable */ + java.lang.String defaultValue); + + /** + * + * + *
+   * Optional. Input only. Immutable. Tag keys/values directly bound to this
+   * resource. For example:
+   *   "123/environment": "production",
+   *   "123/costCenter": "marketing"
+   * 
+ * + * + * map<string, string> tags = 26 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * + */ + java.lang.String getTagsOrThrow(java.lang.String key); } diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/Topic.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/Topic.java index 234faa309..3719e7280 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/Topic.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/Topic.java @@ -63,6 +63,8 @@ protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldRefl switch (number) { case 2: return internalGetLabels(); + case 14: + return internalGetTags(); default: throw new RuntimeException("Invalid map field number: " + number); } @@ -495,7 +497,9 @@ public com.google.pubsub.v1.MessageStoragePolicyOrBuilder getMessageStoragePolic * The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`. * * - * string kms_key_name = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * string kms_key_name = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return The kmsKeyName. */ @@ -522,7 +526,9 @@ public java.lang.String getKmsKeyName() { * The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`. * * - * string kms_key_name = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * string kms_key_name = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return The bytes for kmsKeyName. */ @@ -890,6 +896,133 @@ public com.google.pubsub.v1.MessageTransformOrBuilder getMessageTransformsOrBuil return messageTransforms_.get(index); } + public static final int TAGS_FIELD_NUMBER = 14; + + private static final class TagsDefaultEntryHolder { + static final com.google.protobuf.MapEntry defaultEntry = + com.google.protobuf.MapEntry.newDefaultInstance( + com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_Topic_TagsEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.STRING, + ""); + } + + @SuppressWarnings("serial") + private com.google.protobuf.MapField tags_; + + private com.google.protobuf.MapField internalGetTags() { + if (tags_ == null) { + return com.google.protobuf.MapField.emptyMapField(TagsDefaultEntryHolder.defaultEntry); + } + return tags_; + } + + public int getTagsCount() { + return internalGetTags().getMap().size(); + } + + /** + * + * + *
+   * Optional. Input only. Immutable. Tag keys/values directly bound to this
+   * resource. For example:
+   *   "123/environment": "production",
+   *   "123/costCenter": "marketing"
+   * 
+ * + * + * map<string, string> tags = 14 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public boolean containsTags(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetTags().getMap().containsKey(key); + } + + /** Use {@link #getTagsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getTags() { + return getTagsMap(); + } + + /** + * + * + *
+   * Optional. Input only. Immutable. Tag keys/values directly bound to this
+   * resource. For example:
+   *   "123/environment": "production",
+   *   "123/costCenter": "marketing"
+   * 
+ * + * + * map<string, string> tags = 14 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public java.util.Map getTagsMap() { + return internalGetTags().getMap(); + } + + /** + * + * + *
+   * Optional. Input only. Immutable. Tag keys/values directly bound to this
+   * resource. For example:
+   *   "123/environment": "production",
+   *   "123/costCenter": "marketing"
+   * 
+ * + * + * map<string, string> tags = 14 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public /* nullable */ java.lang.String getTagsOrDefault( + java.lang.String key, + /* nullable */ + java.lang.String defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetTags().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + + /** + * + * + *
+   * Optional. Input only. Immutable. Tag keys/values directly bound to this
+   * resource. For example:
+   *   "123/environment": "production",
+   *   "123/costCenter": "marketing"
+   * 
+ * + * + * map<string, string> tags = 14 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public java.lang.String getTagsOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetTags().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -933,6 +1066,8 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io for (int i = 0; i < messageTransforms_.size(); i++) { output.writeMessage(13, messageTransforms_.get(i)); } + com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( + output, internalGetTags(), TagsDefaultEntryHolder.defaultEntry, 14); getUnknownFields().writeTo(output); } @@ -985,6 +1120,16 @@ public int getSerializedSize() { size += com.google.protobuf.CodedOutputStream.computeMessageSize(13, messageTransforms_.get(i)); } + for (java.util.Map.Entry entry : + internalGetTags().getMap().entrySet()) { + com.google.protobuf.MapEntry tags__ = + TagsDefaultEntryHolder.defaultEntry + .newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream.computeMessageSize(14, tags__); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -1023,6 +1168,7 @@ public boolean equals(final java.lang.Object obj) { return false; } if (!getMessageTransformsList().equals(other.getMessageTransformsList())) return false; + if (!internalGetTags().equals(other.internalGetTags())) return false; if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -1066,6 +1212,10 @@ public int hashCode() { hash = (37 * hash) + MESSAGE_TRANSFORMS_FIELD_NUMBER; hash = (53 * hash) + getMessageTransformsList().hashCode(); } + if (!internalGetTags().getMap().isEmpty()) { + hash = (37 * hash) + TAGS_FIELD_NUMBER; + hash = (53 * hash) + internalGetTags().hashCode(); + } hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; @@ -1189,6 +1339,8 @@ protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldRefl switch (number) { case 2: return internalGetLabels(); + case 14: + return internalGetTags(); default: throw new RuntimeException("Invalid map field number: " + number); } @@ -1200,6 +1352,8 @@ protected com.google.protobuf.MapFieldReflectionAccessor internalGetMutableMapFi switch (number) { case 2: return internalGetMutableLabels(); + case 14: + return internalGetMutableTags(); default: throw new RuntimeException("Invalid map field number: " + number); } @@ -1270,6 +1424,7 @@ public Builder clear() { messageTransformsBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000200); + internalGetMutableTags().clear(); return this; } @@ -1360,6 +1515,10 @@ private void buildPartial0(com.google.pubsub.v1.Topic result) { : ingestionDataSourceSettingsBuilder_.build(); to_bitField0_ |= 0x00000008; } + if (((from_bitField0_ & 0x00000400) != 0)) { + result.tags_ = internalGetTags(); + result.tags_.makeImmutable(); + } result.bitField0_ |= to_bitField0_; } @@ -1465,6 +1624,8 @@ public Builder mergeFrom(com.google.pubsub.v1.Topic other) { } } } + internalGetMutableTags().mergeFrom(other.internalGetTags()); + bitField0_ |= 0x00000400; this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; @@ -1567,6 +1728,15 @@ public Builder mergeFrom( } break; } // case 106 + case 114: + { + com.google.protobuf.MapEntry tags__ = + input.readMessage( + TagsDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry); + internalGetMutableTags().getMutableMap().put(tags__.getKey(), tags__.getValue()); + bitField0_ |= 0x00000400; + break; + } // case 114 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { @@ -2145,7 +2315,9 @@ public com.google.pubsub.v1.MessageStoragePolicyOrBuilder getMessageStoragePolic * The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`. * * - * string kms_key_name = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * string kms_key_name = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return The kmsKeyName. */ @@ -2171,7 +2343,9 @@ public java.lang.String getKmsKeyName() { * The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`. * * - * string kms_key_name = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * string kms_key_name = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return The bytes for kmsKeyName. */ @@ -2197,7 +2371,9 @@ public com.google.protobuf.ByteString getKmsKeyNameBytes() { * The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`. * * - * string kms_key_name = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * string kms_key_name = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @param value The kmsKeyName to set. * @return This builder for chaining. @@ -2222,7 +2398,9 @@ public Builder setKmsKeyName(java.lang.String value) { * The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`. * * - * string kms_key_name = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * string kms_key_name = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return This builder for chaining. */ @@ -2243,7 +2421,9 @@ public Builder clearKmsKeyName() { * The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`. * * - * string kms_key_name = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * string kms_key_name = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @param value The bytes for kmsKeyName to set. * @return This builder for chaining. @@ -3557,6 +3737,213 @@ public com.google.pubsub.v1.MessageTransform.Builder addMessageTransformsBuilder return messageTransformsBuilder_; } + private com.google.protobuf.MapField tags_; + + private com.google.protobuf.MapField internalGetTags() { + if (tags_ == null) { + return com.google.protobuf.MapField.emptyMapField(TagsDefaultEntryHolder.defaultEntry); + } + return tags_; + } + + private com.google.protobuf.MapField + internalGetMutableTags() { + if (tags_ == null) { + tags_ = com.google.protobuf.MapField.newMapField(TagsDefaultEntryHolder.defaultEntry); + } + if (!tags_.isMutable()) { + tags_ = tags_.copy(); + } + bitField0_ |= 0x00000400; + onChanged(); + return tags_; + } + + public int getTagsCount() { + return internalGetTags().getMap().size(); + } + + /** + * + * + *
+     * Optional. Input only. Immutable. Tag keys/values directly bound to this
+     * resource. For example:
+     *   "123/environment": "production",
+     *   "123/costCenter": "marketing"
+     * 
+ * + * + * map<string, string> tags = 14 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public boolean containsTags(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetTags().getMap().containsKey(key); + } + + /** Use {@link #getTagsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getTags() { + return getTagsMap(); + } + + /** + * + * + *
+     * Optional. Input only. Immutable. Tag keys/values directly bound to this
+     * resource. For example:
+     *   "123/environment": "production",
+     *   "123/costCenter": "marketing"
+     * 
+ * + * + * map<string, string> tags = 14 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public java.util.Map getTagsMap() { + return internalGetTags().getMap(); + } + + /** + * + * + *
+     * Optional. Input only. Immutable. Tag keys/values directly bound to this
+     * resource. For example:
+     *   "123/environment": "production",
+     *   "123/costCenter": "marketing"
+     * 
+ * + * + * map<string, string> tags = 14 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public /* nullable */ java.lang.String getTagsOrDefault( + java.lang.String key, + /* nullable */ + java.lang.String defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetTags().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + + /** + * + * + *
+     * Optional. Input only. Immutable. Tag keys/values directly bound to this
+     * resource. For example:
+     *   "123/environment": "production",
+     *   "123/costCenter": "marketing"
+     * 
+ * + * + * map<string, string> tags = 14 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public java.lang.String getTagsOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetTags().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public Builder clearTags() { + bitField0_ = (bitField0_ & ~0x00000400); + internalGetMutableTags().getMutableMap().clear(); + return this; + } + + /** + * + * + *
+     * Optional. Input only. Immutable. Tag keys/values directly bound to this
+     * resource. For example:
+     *   "123/environment": "production",
+     *   "123/costCenter": "marketing"
+     * 
+ * + * + * map<string, string> tags = 14 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder removeTags(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + internalGetMutableTags().getMutableMap().remove(key); + return this; + } + + /** Use alternate mutation accessors instead. */ + @java.lang.Deprecated + public java.util.Map getMutableTags() { + bitField0_ |= 0x00000400; + return internalGetMutableTags().getMutableMap(); + } + + /** + * + * + *
+     * Optional. Input only. Immutable. Tag keys/values directly bound to this
+     * resource. For example:
+     *   "123/environment": "production",
+     *   "123/costCenter": "marketing"
+     * 
+ * + * + * map<string, string> tags = 14 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder putTags(java.lang.String key, java.lang.String value) { + if (key == null) { + throw new NullPointerException("map key"); + } + if (value == null) { + throw new NullPointerException("map value"); + } + internalGetMutableTags().getMutableMap().put(key, value); + bitField0_ |= 0x00000400; + return this; + } + + /** + * + * + *
+     * Optional. Input only. Immutable. Tag keys/values directly bound to this
+     * resource. For example:
+     *   "123/environment": "production",
+     *   "123/costCenter": "marketing"
+     * 
+ * + * + * map<string, string> tags = 14 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder putAllTags(java.util.Map values) { + internalGetMutableTags().getMutableMap().putAll(values); + bitField0_ |= 0x00000400; + return this; + } + @java.lang.Override public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/TopicOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/TopicOrBuilder.java index 875b6e81a..ea55bec4e 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/TopicOrBuilder.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/TopicOrBuilder.java @@ -187,7 +187,9 @@ java.lang.String getLabelsOrDefault( * The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`. * * - * string kms_key_name = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * string kms_key_name = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return The kmsKeyName. */ @@ -203,7 +205,9 @@ java.lang.String getLabelsOrDefault( * The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`. * * - * string kms_key_name = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * string kms_key_name = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return The bytes for kmsKeyName. */ @@ -475,4 +479,92 @@ java.lang.String getLabelsOrDefault( *
*/ com.google.pubsub.v1.MessageTransformOrBuilder getMessageTransformsOrBuilder(int index); + + /** + * + * + *
+   * Optional. Input only. Immutable. Tag keys/values directly bound to this
+   * resource. For example:
+   *   "123/environment": "production",
+   *   "123/costCenter": "marketing"
+   * 
+ * + * + * map<string, string> tags = 14 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * + */ + int getTagsCount(); + + /** + * + * + *
+   * Optional. Input only. Immutable. Tag keys/values directly bound to this
+   * resource. For example:
+   *   "123/environment": "production",
+   *   "123/costCenter": "marketing"
+   * 
+ * + * + * map<string, string> tags = 14 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * + */ + boolean containsTags(java.lang.String key); + + /** Use {@link #getTagsMap()} instead. */ + @java.lang.Deprecated + java.util.Map getTags(); + + /** + * + * + *
+   * Optional. Input only. Immutable. Tag keys/values directly bound to this
+   * resource. For example:
+   *   "123/environment": "production",
+   *   "123/costCenter": "marketing"
+   * 
+ * + * + * map<string, string> tags = 14 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * + */ + java.util.Map getTagsMap(); + + /** + * + * + *
+   * Optional. Input only. Immutable. Tag keys/values directly bound to this
+   * resource. For example:
+   *   "123/environment": "production",
+   *   "123/costCenter": "marketing"
+   * 
+ * + * + * map<string, string> tags = 14 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * + */ + /* nullable */ + java.lang.String getTagsOrDefault( + java.lang.String key, + /* nullable */ + java.lang.String defaultValue); + + /** + * + * + *
+   * Optional. Input only. Immutable. Tag keys/values directly bound to this
+   * resource. For example:
+   *   "123/environment": "production",
+   *   "123/costCenter": "marketing"
+   * 
+ * + * + * map<string, string> tags = 14 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * + */ + java.lang.String getTagsOrThrow(java.lang.String key); } diff --git a/proto-google-cloud-pubsub-v1/src/main/proto/google/pubsub/v1/pubsub.proto b/proto-google-cloud-pubsub-v1/src/main/proto/google/pubsub/v1/pubsub.proto index 125b907f6..b542351d9 100644 --- a/proto-google-cloud-pubsub-v1/src/main/proto/google/pubsub/v1/pubsub.proto +++ b/proto-google-cloud-pubsub-v1/src/main/proto/google/pubsub/v1/pubsub.proto @@ -33,6 +33,14 @@ option java_outer_classname = "PubsubProto"; option java_package = "com.google.pubsub.v1"; option php_namespace = "Google\\Cloud\\PubSub\\V1"; option ruby_package = "Google::Cloud::PubSub::V1"; +option (google.api.resource_definition) = { + type: "cloudkms.googleapis.com/CryptoKey" + pattern: "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}" +}; +option (google.api.resource_definition) = { + type: "analyticshub.googleapis.com/Listing" + pattern: "projects/{project}/locations/{location}/dataExchanges/{data_exchange}/listings/{listing}" +}; // The service that an application uses to manipulate topics, and to send // messages to a topic. @@ -415,7 +423,10 @@ message IngestionDataSourceSettings { // Required. The name of the topic in the Amazon MSK cluster that Pub/Sub // will import from. - string topic = 3 [(google.api.field_behavior) = REQUIRED]; + string topic = 3 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "pubsub.googleapis.com/Topic" } + ]; // Required. AWS role ARN to be used for Federated Identity authentication // with Amazon MSK. Check the Pub/Sub docs for how to set up this role and @@ -712,12 +723,21 @@ message IngestionFailureEvent { // the Pub/Sub message. MessageTransformationFailureReason message_transformation_failure_reason = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The message failed to be published due to an API violation. + // This is only set when the size of the data field of the Kinesis record + // is zero. + ApiViolationReason api_violation_reason = 6 + [(google.api.field_behavior) = OPTIONAL]; } } // Required. Name of the import topic. Format is: // projects/{project_name}/topics/{topic_name}. - string topic = 1 [(google.api.field_behavior) = REQUIRED]; + string topic = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "pubsub.googleapis.com/Topic" } + ]; // Required. Error details explaining why ingestion to Pub/Sub has failed. string error_message = 2 [(google.api.field_behavior) = REQUIRED]; @@ -849,7 +869,12 @@ message Topic { // protect access to messages published on this topic. // // The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`. - string kms_key_name = 5 [(google.api.field_behavior) = OPTIONAL]; + string kms_key_name = 5 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKey" + } + ]; // Optional. Settings for validating messages published against a schema. SchemaSettings schema_settings = 6 [(google.api.field_behavior) = OPTIONAL]; @@ -881,6 +906,16 @@ message Topic { // Transforms are applied in the order specified. repeated MessageTransform message_transforms = 13 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Input only. Immutable. Tag keys/values directly bound to this + // resource. For example: + // "123/environment": "production", + // "123/costCenter": "marketing" + map tags = 14 [ + (google.api.field_behavior) = INPUT_ONLY, + (google.api.field_behavior) = IMMUTABLE, + (google.api.field_behavior) = OPTIONAL + ]; } // A message that is published by publishers and consumed by subscribers. The @@ -1054,7 +1089,10 @@ message ListTopicSnapshotsRequest { // Response for the `ListTopicSnapshots` method. message ListTopicSnapshotsResponse { // Optional. The names of the snapshots that match the request. - repeated string snapshots = 1 [(google.api.field_behavior) = OPTIONAL]; + repeated string snapshots = 1 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { type: "pubsub.googleapis.com/Snapshot" } + ]; // Optional. If not empty, indicates that there may be more snapshots that // match the request; this value should be passed in a new @@ -1348,7 +1386,12 @@ message Subscription { // Optional. The name of the associated Analytics Hub listing resource. // Pattern: // "projects/{project}/locations/{location}/dataExchanges/{data_exchange}/listings/{listing}" - string listing = 1 [(google.api.field_behavior) = OPTIONAL]; + string listing = 1 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { + type: "analyticshub.googleapis.com/Listing" + } + ]; // Optional. The name of the associated Analytics Hub subscription resource. // Pattern: @@ -1514,6 +1557,16 @@ message Subscription { // subscribers. Transforms are applied in the order specified. repeated MessageTransform message_transforms = 25 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Input only. Immutable. Tag keys/values directly bound to this + // resource. For example: + // "123/environment": "production", + // "123/costCenter": "marketing" + map tags = 26 [ + (google.api.field_behavior) = INPUT_ONLY, + (google.api.field_behavior) = IMMUTABLE, + (google.api.field_behavior) = OPTIONAL + ]; } // A policy that specifies how Pub/Sub retries message delivery. @@ -1555,7 +1608,10 @@ message DeadLetterPolicy { // The operation will fail if the topic does not exist. // Users should ensure that there is a subscription attached to this topic // since messages published to a topic with no subscriptions are lost. - string dead_letter_topic = 1 [(google.api.field_behavior) = OPTIONAL]; + string dead_letter_topic = 1 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { type: "pubsub.googleapis.com/Topic" } + ]; // Optional. The maximum number of delivery attempts for any message. The // value must be between 5 and 100. @@ -2183,7 +2239,7 @@ message StreamingPullResponse { bool message_ordering_enabled = 2 [(google.api.field_behavior) = OPTIONAL]; } - // Optional. Received Pub/Sub messages. This will not be empty. + // Optional. Received Pub/Sub messages. repeated ReceivedMessage received_messages = 1 [(google.api.field_behavior) = OPTIONAL]; @@ -2234,6 +2290,16 @@ message CreateSnapshotRequest { // Optional. See [Creating and managing // labels](https://cloud.google.com/pubsub/docs/labels). map labels = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Input only. Immutable. Tag keys/values directly bound to this + // resource. For example: + // "123/environment": "production", + // "123/costCenter": "marketing" + map tags = 4 [ + (google.api.field_behavior) = INPUT_ONLY, + (google.api.field_behavior) = IMMUTABLE, + (google.api.field_behavior) = OPTIONAL + ]; } // Request for the UpdateSnapshot method. diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml index 5ed3a7985..35331a6b0 100644 --- a/samples/install-without-bom/pom.xml +++ b/samples/install-without-bom/pom.xml @@ -44,7 +44,7 @@ com.google.cloud google-cloud-pubsub - 1.141.5 + 1.142.0 @@ -86,12 +86,12 @@ com.google.cloud google-cloud-bigquery - 2.55.1 + 2.55.2 com.google.cloud google-cloud-storage - 2.58.0 + 2.58.1 com.google.cloud.opentelemetry diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index 8e1b4df9a..99a343181 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -43,7 +43,7 @@ com.google.cloud google-cloud-pubsub - 1.142.0 + 1.143.0 @@ -85,12 +85,12 @@ com.google.cloud google-cloud-bigquery - 2.55.1 + 2.55.2 com.google.cloud google-cloud-storage - 2.58.0 + 2.58.1 com.google.cloud.opentelemetry diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml index 305bbc16e..c0b404f69 100644 --- a/samples/snippets/pom.xml +++ b/samples/snippets/pom.xml @@ -45,7 +45,7 @@ com.google.cloud libraries-bom - 26.69.0 + 26.70.0 pom import diff --git a/versions.txt b/versions.txt index dc8172577..7092d2e59 100644 --- a/versions.txt +++ b/versions.txt @@ -1,6 +1,6 @@ # Format: # module:released-version:current-version -google-cloud-pubsub:1.142.0:1.142.0 -grpc-google-cloud-pubsub-v1:1.124.0:1.124.0 -proto-google-cloud-pubsub-v1:1.124.0:1.124.0 +google-cloud-pubsub:1.143.0:1.143.0 +grpc-google-cloud-pubsub-v1:1.125.0:1.125.0 +proto-google-cloud-pubsub-v1:1.125.0:1.125.0