diff --git a/.cloudbuild/samples_build.yaml b/.cloudbuild/samples_build.yaml new file mode 100644 index 000000000..2d4a498e3 --- /dev/null +++ b/.cloudbuild/samples_build.yaml @@ -0,0 +1,31 @@ +steps: +- name: gcr.io/cloud-devrel-public-resources/java8 + entrypoint: ls + args: [ + '-alt', + ] +- name: gcr.io/cloud-devrel-public-resources/java8 + entrypoint: curl + args: [ + '--header', + 'Metadata-Flavor: Google', + 'http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/email' + ] +- name: gcr.io/cloud-devrel-public-resources/java8 + entrypoint: pwd +- name: gcr.io/cloud-devrel-public-resources/java8 + entrypoint: bash + args: [ + '.kokoro/build.sh' + ] + env: + - 'JOB_TYPE=samples' + - 'GOOGLE_CLOUD_PROJECT=cloud-java-ci-sample' +- name: gcr.io/cloud-devrel-public-resources/java8 + entrypoint: echo + args: [ + 'Sample job succeeded', + ] +timeout: 3600s +options: + defaultLogsBucketBehavior: REGIONAL_USER_OWNED_BUCKET diff --git a/.github/.OwlBot-hermetic.yaml b/.github/.OwlBot-hermetic.yaml new file mode 100644 index 000000000..1c4539892 --- /dev/null +++ b/.github/.OwlBot-hermetic.yaml @@ -0,0 +1,80 @@ +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# 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. +deep-remove-regex: +- "/grpc-google-.*/src" +- "/proto-google-.*/src" +- "/google-.*/src" + +#Args=--initialize-at-build-time=org.junit.runners.model.FrameworkField +deep-preserve-regex: +- "/.*google-.*/src/main/java/.*/stub/Version.java" +- "/google-cloud-pubsub/src/test/resources/META-INF/native-image/.*" +- "/google-cloud-pubsub/src/main/java/com/google/cloud/.*/v.*/it/IT.*Test.java" +- "/google-.*/src/test/java/com/google/cloud/.*/v.*/it/IT.*Test.java" +- "/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeletedTopic.java" +- "/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ProjectSnapshotName.java" +- "/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ProjectSubscriptionName.java" +- "/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ProjectTopicName.java" +- "/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/TopicNames.java" +- "/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/UntypedTopicName.java" +- "/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/it/ITPubSubTest.java" +- "/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/CustomArgumentMatchers.java" +- "/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/FakeClock.java" +- "/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/FakePublisherServiceImpl.java" +- "/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/FakeScheduledExecutorService.java" +- "/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/FakeSubscriberServiceImpl.java" +- "/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MessageDataMatcher.java" +- "/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MessageDispatcherTest.java" +- "/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/OpenCensusUtilTest.java" +- "/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/OpenTelemetryTest.java" +- "/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/PublisherImplTest.java" +- "/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" +- "/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/AckReplyConsumer.java" +- "/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/AckReplyConsumerImpl.java" +- "/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/AckReplyConsumerWithResponse.java" +- "/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/AckReplyConsumerWithResponseImpl.java" +- "/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/AckRequestData.java" +- "/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/AckResponse.java" +- "/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/MessageDispatcher.java" +- "/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/MessageReceiver.java" +- "/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/MessageReceiverWithAckResponse.java" +- "/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/ModackRequestData.java" +- "/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/OpenCensusUtil.java" +- "/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/OpenTelemetryPubsubTracer.java" +- "/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/Publisher.java" +- "/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/PublisherInterface.java" +- "/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/PubsubMessageWrapper.java" +- "/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/SequentialExecutorService.java" +- "/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/StatusUtil.java" +- "/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" +- "/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/LoggingUtil.java" + +deep-copy-regex: +- source: "/google/pubsub/(v.*)/.*-java/proto-google-.*/src" + dest: "/owl-bot-staging/$1/proto-google-cloud-pubsub-$1/src" +- source: "/google/pubsub/(v.*)/.*-java/grpc-google-.*/src" + dest: "/owl-bot-staging/$1/grpc-google-cloud-pubsub-$1/src" +- source: "/google/pubsub/(v.*)/.*-java/gapic-google-.*/src" + dest: "/owl-bot-staging/$1/google-cloud-pubsub/src" diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 0bcf47a66..3a6e0dbe4 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -4,9 +4,26 @@ # For syntax help see: # https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax -# The @googleapis/api-pubsub is the default owner for changes in this repo -* @googleapis/yoshi-java @googleapis/api-pubsub -**/*.java @googleapis/api-pubsub +# The @googleapis/pubsub-team is the default owner for changes in this repo +* @googleapis/cloud-sdk-java-team @googleapis/pubsub-team + +# for handwritten libraries, keep codeowner_team in .repo-metadata.json as owner +**/*.java @googleapis/pubsub-team + +# For generated Java code +proto-*/ @googleapis/cloud-sdk-java-team @googleapis/pubsub-team +grpc-*/ @googleapis/cloud-sdk-java-team @googleapis/pubsub-team +# Generated code pattern in google-cloud-pubsub +**/*Client.java @googleapis/cloud-sdk-java-team @googleapis/pubsub-team +**/*Settings.java @googleapis/cloud-sdk-java-team @googleapis/pubsub-team +**/*ClientHttpJsonTest.java @googleapis/cloud-sdk-java-team @googleapis/pubsub-team +**/*ClientTest.java @googleapis/cloud-sdk-java-team @googleapis/pubsub-team +google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/** @googleapis/cloud-sdk-java-team @googleapis/pubsub-team +google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/package-info.java @googleapis/cloud-sdk-java-team @googleapis/pubsub-team +google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/Mock* @googleapis/cloud-sdk-java-team @googleapis/pubsub-team # The java-samples-reviewers team is the default owner for samples changes samples/**/*.java @googleapis/java-samples-reviewers + +# Generated snippets should not be owned by samples reviewers +samples/snippets/generated/ @googleapis/cloud-sdk-java-team diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 616371b51..50c4b1498 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -21,7 +21,7 @@ If you are still having issues, please include as much information as possible: General, Core, and Other are also allowed as types 2. OS type and version: 3. Java version: -4. pubsub version(s): +4. version(s): #### Steps to reproduce diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index f2a217cb7..66a507f7e 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -5,3 +5,6 @@ Thank you for opening a Pull Request! Before submitting your PR, there are a few - [ ] Appropriate docs were updated (if necessary) Fixes # ☕️ + +If you write sample code, please follow the [samples format]( +https://github.com/GoogleCloudPlatform/java-docs-samples/blob/main/SAMPLE_FORMAT.md). diff --git a/.github/readme/synth.py b/.github/auto-label.yaml similarity index 73% rename from .github/readme/synth.py rename to .github/auto-label.yaml index 7b48cc28d..4caef688b 100644 --- a/.github/readme/synth.py +++ b/.github/auto-label.yaml @@ -1,4 +1,4 @@ -# Copyright 2020 Google LLC +# Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -11,9 +11,5 @@ # 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. - -"""This script is used to synthesize generated the README for this library.""" - -from synthtool.languages import java - -java.custom_templates(["java_library/README.md"]) +requestsize: + enabled: true diff --git a/.github/blunderbuss.yml b/.github/blunderbuss.yml index 1a23ea42b..97998e463 100644 --- a/.github/blunderbuss.yml +++ b/.github/blunderbuss.yml @@ -1,5 +1,9 @@ # Configuration for the Blunderbuss GitHub app. For more info see -# https://github.com/googleapis/repo-automation-bots/tree/master/packages/blunderbuss +# https://github.com/googleapis/repo-automation-bots/tree/main/packages/blunderbuss +assign_issues: + - michaelpri10 +assign_prs: + - michaelpri10 assign_prs_by: - labels: - samples diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000..203f9eacc --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,19 @@ +version: 2 +updates: + - package-ecosystem: "maven" + directory: "/" + schedule: + interval: "daily" + # Disable version updates for Maven dependencies + # we use renovate-bot as well as shared-dependencies BOM to update maven dependencies. + ignore: + - dependency-name: "*" + - package-ecosystem: "pip" + directory: "/" + schedule: + interval: "daily" + # Disable version updates for pip dependencies + # If a security vulnerability comes in, we will be notified about + # it via template in the synthtool repository. + ignore: + - dependency-name: "*" diff --git a/.github/generated-files-bot.yml b/.github/generated-files-bot.yml index 47c2ba132..e58cdcbad 100644 --- a/.github/generated-files-bot.yml +++ b/.github/generated-files-bot.yml @@ -6,6 +6,8 @@ externalManifests: file: '.github/readme/synth.metadata/synth.metadata' jsonpath: '$.generatedFiles[*]' ignoreAuthors: +- 'cloud-java-bot' - 'renovate-bot' - 'yoshi-automation' - 'release-please[bot]' +- 'gcf-owl-bot[bot]' diff --git a/.github/readme/synth.metadata/synth.metadata b/.github/readme/synth.metadata/synth.metadata deleted file mode 100644 index 924ca4114..000000000 --- a/.github/readme/synth.metadata/synth.metadata +++ /dev/null @@ -1,18 +0,0 @@ -{ - "sources": [ - { - "git": { - "name": ".", - "remote": "https://github.com/googleapis/java-pubsub.git", - "sha": "4bcbde4b8646291eb46a98786fe62c4f118fc3e8" - } - }, - { - "git": { - "name": "synthtool", - "remote": "https://github.com/googleapis/synthtool.git", - "sha": "2e7bd5cc66a3f0b90ce1c150eb35c89eeb9872d6" - } - } - ] -} \ No newline at end of file diff --git a/.github/release-please.yml b/.github/release-please.yml index dce2c8450..dd5ccf112 100644 --- a/.github/release-please.yml +++ b/.github/release-please.yml @@ -1,2 +1,33 @@ +bumpMinorPreMajor: true +handleGHRelease: true releaseType: java-yoshi -bumpMinorPreMajor: true \ No newline at end of file +branches: + - branch: 1.111.0-sp + releaseType: java-lts + - branch: java7 + - branch: 1.114.x + releaseType: java-backport + - branch: 1.116.x + releaseType: java-backport + - branch: 1.117.x + releaseType: java-backport + - branch: 1.120.x + releaseType: java-backport + - branch: 1.121.x + releaseType: java-backport + - branch: 1.123.x + releaseType: java-backport + - branch: 1.125.x + releaseType: java-backport + - branch: 1.129.x + releaseType: java-backport + - branch: 1.137.x + releaseType: java-backport + - branch: 1.140.x + releaseType: java-backport + - branch: protobuf-4.x-rc + manifest: true + - bumpMinorPreMajor: true + handleGHRelease: true + releaseType: java-backport + branch: 1.147.x diff --git a/.github/release-trigger.yml b/.github/release-trigger.yml new file mode 100644 index 000000000..d8f21db74 --- /dev/null +++ b/.github/release-trigger.yml @@ -0,0 +1,2 @@ +enabled: true +multiScmName: java-pubsub diff --git a/.github/scripts/update_generation_config.sh b/.github/scripts/update_generation_config.sh new file mode 100644 index 000000000..f448fafd7 --- /dev/null +++ b/.github/scripts/update_generation_config.sh @@ -0,0 +1,192 @@ +#!/bin/bash +set -ex +# This script should be run at the root of the repository. +# This script is used to update googleapis_commitish, gapic_generator_version, +# and libraries_bom_version in generation configuration at the time of running +# and create a pull request. + +# The following commands need to be installed before running the script: +# 1. git +# 2. gh +# 3. jq + +# Utility functions +# Get the latest released version of a Maven artifact. +function get_latest_released_version() { + local group_id=$1 + local artifact_id=$2 + group_id_url_path="$(sed 's|\.|/|g' <<< "${group_id}")" + url="https://repo1.maven.org/maven2/${group_id_url_path}/${artifact_id}/maven-metadata.xml" + xml_content=$(curl -s --fail "${url}") + + # 1. Extract all version tags + # 2. Strip the XML tags to leave just the version numbers + # 3. Filter for strictly numbers.numbers.numbers (e.g., 2.54.0) + # 4. Sort by version (V) and take the last one (tail -n 1) + latest=$(echo "${xml_content}" \ + | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' \ + | sed -E 's/<[^>]+>//g' \ + | sort -V \ + | tail -n 1) + + if [[ -z "${latest}" ]]; then + echo "The latest version of ${group_id}:${artifact_id} is empty." + echo "The returned json from maven.org is invalid: ${json_content}" + exit 1 + else + echo "${latest}" + fi +} + +# Update a key to a new value in the generation config. +function update_config() { + local key_word=$1 + local new_value=$2 + local file=$3 + echo "Update ${key_word} to ${new_value} in ${file}" + sed -i -e "s/^${key_word}.*$/${key_word}: ${new_value}/" "${file}" +} + +# Update an action to a new version in GitHub action. +# the second argument must have the git tag (including "v"). +function update_action() { + local key_word=$1 + local new_value=$2 + local file=$3 + echo "Update ${key_word} to ${new_value} in ${file}" + # use a different delimiter because the key_word contains "/". + sed -i -e "s|${key_word}@[^ ]*$|${key_word}@${new_value}|" "${file}" +} + +# The parameters of this script is: +# 1. base_branch, the base branch of the result pull request. +# 2. repo, organization/repo-name, e.g., googleapis/google-cloud-java +# 3. [optional] generation_config, the path to the generation configuration, +# the default value is generation_config.yaml in the repository root. +# 4. [optional] workflow, the library generation workflow file, +# the default value is .github/workflows/hermetic_library_generation.yaml. +while [[ $# -gt 0 ]]; do +key="$1" +case "${key}" in + --base_branch) + base_branch="$2" + shift + ;; + --repo) + repo="$2" + shift + ;; + --generation_config) + generation_config="$2" + shift + ;; + --workflow) + workflow="$2" + shift + ;; + *) + echo "Invalid option: [$1]" + exit 1 + ;; +esac +shift +done + +if [ -z "${base_branch}" ]; then + echo "missing required argument --base_branch" + exit 1 +fi + +if [ -z "${repo}" ]; then + echo "missing required argument --repo" + exit 1 +fi + +if [ -z "${generation_config}" ]; then + generation_config="generation_config.yaml" + echo "Use default generation config: ${generation_config}" +fi + +if [ -z "${workflow}" ]; then + workflow=".github/workflows/hermetic_library_generation.yaml" + echo "Use default library generation workflow file: ${workflow}" +fi + +current_branch="generate-libraries-${base_branch}" +title="chore: Update generation configuration at $(date)" + +git checkout "${base_branch}" +# Try to find a open pull request associated with the branch +pr_num=$(gh pr list -s open -H "${current_branch}" -q . --json number | jq ".[] | .number") +# Create a branch if there's no open pull request associated with the +# branch; otherwise checkout the pull request. +if [ -z "${pr_num}" ]; then + git checkout -b "${current_branch}" + # Push the current branch to remote so that we can + # compare the commits later. + git push -u origin "${current_branch}" +else + gh pr checkout "${pr_num}" +fi + +# Only allow fast-forward merging; exit with non-zero result if there's merging +# conflict. +git merge -m "chore: merge ${base_branch} into ${current_branch}" "${base_branch}" + +mkdir tmp-googleapis +# Use partial clone because only commit history is needed. +git clone --filter=blob:none https://github.com/googleapis/googleapis.git tmp-googleapis +pushd tmp-googleapis +git pull +latest_commit=$(git rev-parse HEAD) +popd +rm -rf tmp-googleapis +update_config "googleapis_commitish" "${latest_commit}" "${generation_config}" + +# Update gapic-generator-java version to the latest +latest_gapic_generator_version=$(get_latest_released_version "com.google.api" "gapic-generator-java") +update_config "gapic_generator_version" "${latest_gapic_generator_version}" "${generation_config}" + +# Update the GitHub Actions reference to the latest. +# After the google-cloud-java monorepo migration of sdk-platform-java, +# we cannot rely on the gapic-generator-java version tag. Let's use +# the gapic-libraries-bom version +latest_gapic_libraries_bom_version=$(get_latest_released_version "com.google.cloud" "gapic-libraries-bom") +update_action "googleapis/google-cloud-java/sdk-platform-java/.github/scripts" \ + "v${latest_gapic_libraries_bom_version}" \ + "${workflow}" + +# Update libraries-bom version to the latest +latest_version=$(get_latest_released_version "com.google.cloud" "libraries-bom") +update_config "libraries_bom_version" "${latest_version}" "${generation_config}" + +git add "${generation_config}" "${workflow}" +changed_files=$(git diff --cached --name-only) +if [[ "${changed_files}" == "" ]]; then + echo "The latest generation config is not changed." + echo "Skip committing to the pull request." +else + git commit -m "${title}" +fi + +# There are potentially at most two commits: merge commit and change commit. +# We want to exit the script if no commit happens (otherwise this will be an +# infinite loop). +# `git cherry` is a way to find whether the local branch has commits that are +# not in the remote branch. +# If we find any such commit, push them to remote branch. +unpushed_commit=$(git cherry -v "origin/${current_branch}" | wc -l) +if [[ "${unpushed_commit}" -eq 0 ]]; then + echo "No unpushed commits, exit" + exit 0 +fi + +if [ -z "${pr_num}" ]; then + git remote add remote_repo https://cloud-java-bot:"${GH_TOKEN}@github.com/${repo}.git" + git fetch -q remote_repo + git push -f remote_repo "${current_branch}" + gh pr create --title "${title}" --head "${current_branch}" --body "${title}" --base "${base_branch}" +else + git push + gh pr edit "${pr_num}" --title "${title}" --body "${title}" +fi diff --git a/.github/sync-repo-settings.yaml b/.github/sync-repo-settings.yaml index b36eb7dee..1f09ebd60 100644 --- a/.github/sync-repo-settings.yaml +++ b/.github/sync-repo-settings.yaml @@ -1,49 +1,243 @@ - -# Whether or not rebase-merging is enabled on this repository. -# Defaults to `true` rebaseMergeAllowed: false - -# Whether or not squash-merging is enabled on this repository. -# Defaults to `true` squashMergeAllowed: true - -# Whether or not PRs are merged with a merge commit on this repository. -# Defaults to `false` mergeCommitAllowed: false - -# Rules for master branch protection branchProtectionRules: -# Identifies the protection rule pattern. Name of the branch to be protected. -# Defaults to `master` -- pattern: master - # Can admins overwrite branch protection. - # Defaults to `true` - isAdminEnforced: true - # Number of approving reviews required to update matching branches. - # Defaults to `1` - requiredApprovingReviewCount: 1 - # Are reviews from code owners required to update matching branches. - # Defaults to `false` - requiresCodeOwnerReviews: true - # Require up to date branches - requiresStrictStatusChecks: false - # List of required status check contexts that must pass for commits to be accepted to matching branches. - requiredStatusCheckContexts: - - "dependencies (8)" - - "dependencies (11)" - - "linkage-monitor" - - "lint" - - "clirr" - - "units (7)" - - "units (8)" - - "units (11)" - - "Kokoro - Test: Integration" - - "cla/google" -# List of explicit permissions to add (additive only) + - pattern: main + isAdminEnforced: true + requiredApprovingReviewCount: 1 + requiresCodeOwnerReviews: true + requiresStrictStatusChecks: false + requiredStatusCheckContexts: + - dependencies (17) + - lint + - clirr + - units (8) + - units (11) + - 'Kokoro - Test: Integration' + - cla/google + - 'Kokoro - Test: Java GraalVM Native Image A' + - 'Kokoro - Test: Java GraalVM Native Image B' + - 'Kokoro - Test: Java GraalVM Native Image C' + - javadoc + - library_generation + - unmanaged_dependency_check + - pattern: 1.111.0-sp + isAdminEnforced: true + requiredApprovingReviewCount: 1 + requiresCodeOwnerReviews: true + requiresStrictStatusChecks: false + requiredStatusCheckContexts: + - dependencies (8) + - dependencies (11) + - lint + - clirr + - units (8) + - units (11) + - 'Kokoro - Test: Integration' + - Kokoro - Against Pub/Sub Lite samples + - cla/google + - pattern: java7 + isAdminEnforced: true + requiredApprovingReviewCount: 1 + requiresCodeOwnerReviews: true + requiresStrictStatusChecks: false + requiredStatusCheckContexts: + - dependencies (8) + - dependencies (11) + - lint + - clirr + - units (8) + - units (11) + - 'Kokoro - Test: Integration' + - Kokoro - Against Pub/Sub Lite samples + - cla/google + - pattern: 1.114.x + isAdminEnforced: true + requiredApprovingReviewCount: 1 + requiresCodeOwnerReviews: true + requiresStrictStatusChecks: false + requiredStatusCheckContexts: + - dependencies (8) + - dependencies (11) + - lint + - clirr + - units (8) + - units (11) + - 'Kokoro - Test: Integration' + - Kokoro - Against Pub/Sub Lite samples + - cla/google + - pattern: 1.116.x + isAdminEnforced: true + requiredApprovingReviewCount: 1 + requiresCodeOwnerReviews: true + requiresStrictStatusChecks: false + requiredStatusCheckContexts: + - dependencies (8) + - dependencies (11) + - lint + - clirr + - units (8) + - units (11) + - 'Kokoro - Test: Integration' + - Kokoro - Against Pub/Sub Lite samples + - cla/google + - pattern: 1.117.x + isAdminEnforced: true + requiredApprovingReviewCount: 1 + requiresCodeOwnerReviews: true + requiresStrictStatusChecks: false + requiredStatusCheckContexts: + - dependencies (8) + - dependencies (11) + - lint + - clirr + - units (8) + - units (11) + - 'Kokoro - Test: Integration' + - Kokoro - Against Pub/Sub Lite samples + - cla/google + - pattern: 1.120.x + isAdminEnforced: true + requiredApprovingReviewCount: 1 + requiresCodeOwnerReviews: true + requiresStrictStatusChecks: false + requiredStatusCheckContexts: + - dependencies (8) + - dependencies (11) + - lint + - clirr + - units (8) + - units (11) + - 'Kokoro - Test: Integration' + - Kokoro - Against Pub/Sub Lite samples + - cla/google + - 'Kokoro - Test: Java GraalVM Native Image' + - 'Kokoro - Test: Java 17 GraalVM Native Image' + - pattern: 1.121.x + isAdminEnforced: true + requiredApprovingReviewCount: 1 + requiresCodeOwnerReviews: true + requiresStrictStatusChecks: false + requiredStatusCheckContexts: + - dependencies (8) + - dependencies (11) + - lint + - clirr + - units (8) + - units (11) + - 'Kokoro - Test: Integration' + - Kokoro - Against Pub/Sub Lite samples + - cla/google + - 'Kokoro - Test: Java GraalVM Native Image' + - 'Kokoro - Test: Java 17 GraalVM Native Image' + - pattern: 1.123.x + isAdminEnforced: true + requiredApprovingReviewCount: 1 + requiresCodeOwnerReviews: true + requiresStrictStatusChecks: false + requiredStatusCheckContexts: + - dependencies (17) + - lint + - clirr + - units (8) + - units (11) + - 'Kokoro - Test: Integration' + - Kokoro - Against Pub/Sub Lite samples + - cla/google + - 'Kokoro - Test: Java GraalVM Native Image' + - 'Kokoro - Test: Java 17 GraalVM Native Image' + - pattern: 1.125.x + isAdminEnforced: true + requiredApprovingReviewCount: 1 + requiresCodeOwnerReviews: true + requiresStrictStatusChecks: false + requiredStatusCheckContexts: + - dependencies (17) + - lint + - clirr + - units (8) + - units (11) + - 'Kokoro - Test: Integration' + - cla/google + - 'Kokoro - Test: Java GraalVM Native Image' + - 'Kokoro - Test: Java 17 GraalVM Native Image' + - javadoc + - pattern: 1.129.x + isAdminEnforced: true + requiredApprovingReviewCount: 1 + requiresCodeOwnerReviews: true + requiresStrictStatusChecks: false + requiredStatusCheckContexts: + - dependencies (17) + - lint + - clirr + - units (8) + - units (11) + - 'Kokoro - Test: Integration' + - cla/google + - 'Kokoro - Test: Java GraalVM Native Image' + - 'Kokoro - Test: Java 17 GraalVM Native Image' + - javadoc + - pattern: 1.137.x + isAdminEnforced: true + requiredApprovingReviewCount: 1 + requiresCodeOwnerReviews: true + requiresStrictStatusChecks: false + requiredStatusCheckContexts: + - dependencies (17) + - lint + - clirr + - units (8) + - units (11) + - 'Kokoro - Test: Integration' + - cla/google + - 'Kokoro - Test: Java GraalVM Native Image' + - 'Kokoro - Test: Java 17 GraalVM Native Image' + - javadoc + - library_generation + - unmanaged_dependency_check + - pattern: 1.140.x + isAdminEnforced: true + requiredApprovingReviewCount: 1 + requiresCodeOwnerReviews: true + requiresStrictStatusChecks: false + requiredStatusCheckContexts: + - dependencies (17) + - lint + - clirr + - units (8) + - units (11) + - 'Kokoro - Test: Integration' + - cla/google + - 'Kokoro - Test: Java GraalVM Native Image A' + - 'Kokoro - Test: Java GraalVM Native Image B' + - 'Kokoro - Test: Java GraalVM Native Image C' + - javadoc + - library_generation + - unmanaged_dependency_check + - pattern: 1.147.x + isAdminEnforced: true + requiredApprovingReviewCount: 1 + requiresCodeOwnerReviews: true + requiresStrictStatusChecks: false + requiredStatusCheckContexts: + - dependencies (17) + - lint + - clirr + - units (8) + - units (11) + - 'Kokoro - Test: Integration' + - cla/google + - 'Kokoro - Test: Java GraalVM Native Image A' + - 'Kokoro - Test: Java GraalVM Native Image B' + - 'Kokoro - Test: Java GraalVM Native Image C' + - javadoc + - library_generation + - unmanaged_dependency_check permissionRules: -- team: yoshi-admins - permission: admin -- team: yoshi-java-admins - permission: admin -- team: yoshi-java - permission: push + - team: yoshi-admins + permission: admin + - team: yoshi-java-admins + permission: admin + - team: cloud-sdk-java-team + permission: push diff --git a/.github/trusted-contribution.yml b/.github/trusted-contribution.yml index f247d5c78..88d3ac9bf 100644 --- a/.github/trusted-contribution.yml +++ b/.github/trusted-contribution.yml @@ -1,2 +1,9 @@ trustedContributors: -- renovate-bot \ No newline at end of file +- renovate-bot +- gcf-owl-bot[bot] + +annotations: +- type: comment + text: "/gcbrun" +- type: label + text: "kokoro:force-run" diff --git a/.github/workflows/approve-readme.yaml b/.github/workflows/approve-readme.yaml index 7513acaeb..59f00b8eb 100644 --- a/.github/workflows/approve-readme.yaml +++ b/.github/workflows/approve-readme.yaml @@ -1,3 +1,18 @@ +# Copyright 2022 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. +# Github action job to test core java library features on +# downstream client libraries before they are released. on: pull_request: name: auto-merge-readme @@ -6,7 +21,7 @@ jobs: runs-on: ubuntu-latest if: github.repository_owner == 'googleapis' && github.head_ref == 'autosynth-readme' steps: - - uses: actions/github-script@v3 + - uses: actions/github-script@v7 with: github-token: ${{secrets.YOSHI_APPROVER_TOKEN}} script: | diff --git a/.github/workflows/auto-release.yaml b/.github/workflows/auto-release.yaml index 9b4fd4d83..0cda6b04f 100644 --- a/.github/workflows/auto-release.yaml +++ b/.github/workflows/auto-release.yaml @@ -1,3 +1,18 @@ +# Copyright 2022 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. +# Github action job to test core java library features on +# downstream client libraries before they are released. on: pull_request: name: auto-release @@ -6,7 +21,7 @@ jobs: runs-on: ubuntu-latest if: contains(github.head_ref, 'release-please') steps: - - uses: actions/github-script@v3 + - uses: actions/github-script@v8 with: github-token: ${{secrets.YOSHI_APPROVER_TOKEN}} debug: true @@ -16,13 +31,13 @@ jobs: return; } - // only approve PRs like "chore: release " - if ( !context.payload.pull_request.title.startsWith("chore: release") ) { + // only approve PRs like "chore(main): release " + if ( !context.payload.pull_request.title.startsWith("chore(main): release") ) { return; } // only approve PRs with pom.xml and versions.txt changes - const filesPromise = github.pulls.listFiles.endpoint({ + const filesPromise = github.rest.pulls.listFiles.endpoint({ owner: context.repo.owner, repo: context.repo.repo, pull_number: context.payload.pull_request.number, @@ -54,7 +69,7 @@ jobs: return; } - const promise = github.pulls.list.endpoint({ + const promise = github.rest.pulls.list.endpoint({ owner: context.repo.owner, repo: context.repo.repo, state: 'open' @@ -71,7 +86,7 @@ jobs: } // approve release PR - await github.pulls.createReview({ + await github.rest.pulls.createReview({ owner: context.repo.owner, repo: context.repo.repo, body: 'Rubber stamped release!', @@ -80,7 +95,7 @@ jobs: }); // attach kokoro:force-run and automerge labels - await github.issues.addLabels({ + await github.rest.issues.addLabels({ owner: context.repo.owner, repo: context.repo.repo, issue_number: context.payload.pull_request.number, diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index def8b3a2c..b9b8be0c3 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,34 +1,72 @@ +# Copyright 2022 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. +# Github action job to test core java library features on +# downstream client libraries before they are released. on: push: branches: - - master + - main pull_request: name: ci jobs: units: runs-on: ubuntu-latest strategy: + fail-fast: false matrix: - java: [7, 8, 11] + java: [11, 17, 21, 25] steps: - - uses: actions/checkout@v2 - - uses: actions/setup-java@v1 + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 with: + distribution: temurin java-version: ${{matrix.java}} - run: java -version - run: .kokoro/build.sh env: JOB_TYPE: test - - name: coverage - uses: codecov/codecov-action@v1 - with: - name: actions ${{matrix.java}} + units-java8: + # Building using Java 17 and run the tests with Java 8 runtime + name: "units (8)" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + java-version: 8 + distribution: temurin + - name: "Set jvm system property environment variable for surefire plugin (unit tests)" + # Maven surefire plugin (unit tests) allows us to specify JVM to run the tests. + # https://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#jvm + run: echo "SUREFIRE_JVM_OPT=-Djvm=${JAVA_HOME}/bin/java" >> $GITHUB_ENV + shell: bash + - uses: actions/setup-java@v4 + with: + java-version: 17 + distribution: temurin + - run: .kokoro/build.sh + env: + JOB_TYPE: test windows: runs-on: windows-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-java@v1 + - name: Support longpaths + run: git config --system core.longpaths true + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 with: + distribution: temurin java-version: 8 - run: java -version - run: .kokoro/build.bat @@ -38,34 +76,35 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - java: [8, 11] + java: [17] steps: - - uses: actions/checkout@v2 - - uses: actions/setup-java@v1 + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 with: + distribution: temurin java-version: ${{matrix.java}} - run: java -version - run: .kokoro/dependencies.sh - linkage-monitor: + javadoc: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-java@v1 + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 with: - java-version: 8 + distribution: temurin + java-version: 17 - run: java -version - - name: Install artifacts to local Maven repository - run: .kokoro/build.sh - shell: bash - - name: Validate any conflicts with regard to com.google.cloud:libraries-bom (latest release) - uses: GoogleCloudPlatform/cloud-opensource-java/linkage-monitor@v1-linkagemonitor + - run: .kokoro/build.sh + env: + JOB_TYPE: javadoc lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-java@v1 + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 with: - java-version: 8 + distribution: temurin + java-version: 17 - run: java -version - run: .kokoro/build.sh env: @@ -73,11 +112,12 @@ jobs: clirr: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-java@v1 + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 with: + distribution: temurin java-version: 8 - run: java -version - run: .kokoro/build.sh env: - JOB_TYPE: clirr \ No newline at end of file + JOB_TYPE: clirr diff --git a/.github/workflows/hermetic_library_generation.yaml b/.github/workflows/hermetic_library_generation.yaml new file mode 100644 index 000000000..fe2fc8cff --- /dev/null +++ b/.github/workflows/hermetic_library_generation.yaml @@ -0,0 +1,45 @@ +# Copyright 2024 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. +# GitHub action job to test core java library features on +# downstream client libraries before they are released. +name: Hermetic library generation upon generation config change through pull requests +on: + pull_request: + +env: + REPO_FULL_NAME: ${{ github.event.pull_request.head.repo.full_name }} + GITHUB_REPOSITORY: ${{ github.repository }} +jobs: + library_generation: + runs-on: ubuntu-latest + steps: + - name: Determine whether the pull request comes from a fork + run: | + if [[ "${GITHUB_REPOSITORY}" != "${REPO_FULL_NAME}" ]]; then + echo "This PR comes from a fork. Skip library generation." + echo "SHOULD_RUN=false" >> $GITHUB_ENV + else + echo "SHOULD_RUN=true" >> $GITHUB_ENV + fi + - uses: actions/checkout@v6 + if: env.SHOULD_RUN == 'true' + with: + fetch-depth: 0 + token: ${{ secrets.CLOUD_JAVA_BOT_GITHUB_TOKEN }} + - uses: googleapis/google-cloud-java/sdk-platform-java/.github/scripts@v1.85.0 + if: env.SHOULD_RUN == 'true' + with: + base_ref: ${{ github.base_ref }} + head_ref: ${{ github.head_ref }} + token: ${{ secrets.CLOUD_JAVA_BOT_GITHUB_TOKEN }} diff --git a/.github/workflows/renovate_config_check.yaml b/.github/workflows/renovate_config_check.yaml new file mode 100644 index 000000000..8c922936b --- /dev/null +++ b/.github/workflows/renovate_config_check.yaml @@ -0,0 +1,24 @@ +name: Renovate Bot Config Validation + +on: + pull_request: + paths: + - 'renovate.json' + - '.github/workflows/renovate_config_check.yaml' + +jobs: + renovate_bot_config_validation: + runs-on: ubuntu-24.04 + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '22' + + - name: Run Renovate Config Validator + run: | + npx --package renovate@43.136.0 renovate-config-validator diff --git a/.github/workflows/samples.yaml b/.github/workflows/samples.yaml index 016279315..3c00d025e 100644 --- a/.github/workflows/samples.yaml +++ b/.github/workflows/samples.yaml @@ -5,10 +5,10 @@ jobs: checkstyle: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: actions/setup-java@v1 with: - java-version: 8 + java-version: 11 - name: Run checkstyle run: mvn -P lint --quiet --batch-mode checkstyle:check working-directory: samples diff --git a/.github/workflows/unmanaged_dependency_check.yaml b/.github/workflows/unmanaged_dependency_check.yaml new file mode 100644 index 000000000..c2f165680 --- /dev/null +++ b/.github/workflows/unmanaged_dependency_check.yaml @@ -0,0 +1,22 @@ +on: + pull_request: +name: Unmanaged dependency check +jobs: + unmanaged_dependency_check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - uses: actions/setup-java@v5 + with: + distribution: temurin + java-version: 11 + - name: Install modules + shell: bash + run: | + # No argument to build.sh installs the modules in local Maven + # repository + .kokoro/build.sh + - name: Unmanaged dependency check + uses: googleapis/google-cloud-java/sdk-platform-java/java-shared-dependencies/unmanaged-dependency-check@v1.85.0 + with: + bom-path: google-cloud-pubsub-bom/pom.xml diff --git a/.github/workflows/update_generation_config.yaml b/.github/workflows/update_generation_config.yaml new file mode 100644 index 000000000..8de9d67ea --- /dev/null +++ b/.github/workflows/update_generation_config.yaml @@ -0,0 +1,47 @@ +# Copyright 2024 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. +# GitHub action job to test core java library features on +# downstream client libraries before they are released. +name: Update generation configuration +on: + schedule: + - cron: '0 2 * * *' + workflow_dispatch: + +jobs: + update-generation-config: + runs-on: ubuntu-24.04 + env: + # the branch into which the pull request is merged + base_branch: main + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ secrets.CLOUD_JAVA_BOT_GITHUB_TOKEN }} + - name: Install Dependencies + shell: bash + run: sudo apt-get update && sudo apt-get install -y libxml2-utils + - name: Update params in generation config to latest + shell: bash + run: | + set -x + [ -z "$(git config user.email)" ] && git config --global user.email "cloud-java-bot@google.com" + [ -z "$(git config user.name)" ] && git config --global user.name "cloud-java-bot" + bash .github/scripts/update_generation_config.sh \ + --base_branch "${base_branch}" \ + --repo ${{ github.repository }} + env: + GH_TOKEN: ${{ secrets.CLOUD_JAVA_BOT_GITHUB_TOKEN }} + diff --git a/.kokoro/build.bat b/.kokoro/build.bat index 05826ad93..067cf4a4c 100644 --- a/.kokoro/build.bat +++ b/.kokoro/build.bat @@ -1,3 +1,18 @@ +:: Copyright 2022 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. +:: Github action job to test core java library features on +:: downstream client libraries before they are released. :: See documentation in type-shell-output.bat "C:\Program Files\Git\bin\bash.exe" %~dp0build.sh diff --git a/.kokoro/build.sh b/.kokoro/build.sh index fdfa0c36e..41903cda1 100755 --- a/.kokoro/build.sh +++ b/.kokoro/build.sh @@ -23,8 +23,8 @@ cd ${scriptDir}/.. # include common functions source ${scriptDir}/common.sh -# Print out Java version -java -version +# Print out Maven & Java version +mvn -version echo ${JOB_TYPE} # attempt to install 3 times with exponential backoff (starting with 10 seconds) @@ -37,7 +37,7 @@ retry_with_backoff 3 10 \ -Dgcloud.download.skip=true \ -T 1C -# if GOOGLE_APPLICATION_CREDIENTIALS is specified as a relative path prepend Kokoro root directory onto it +# if GOOGLE_APPLICATION_CREDENTIALS is specified as a relative path, prepend Kokoro root directory onto it if [[ ! -z "${GOOGLE_APPLICATION_CREDENTIALS}" && "${GOOGLE_APPLICATION_CREDENTIALS}" != /* ]]; then export GOOGLE_APPLICATION_CREDENTIALS=$(realpath ${KOKORO_GFILE_DIR}/${GOOGLE_APPLICATION_CREDENTIALS}) fi @@ -47,11 +47,12 @@ set +e case ${JOB_TYPE} in test) - mvn test -B -Dclirr.skip=true -Denforcer.skip=true + echo "SUREFIRE_JVM_OPT: ${SUREFIRE_JVM_OPT}" + mvn test -B -ntp -Dclirr.skip=true -Denforcer.skip=true ${SUREFIRE_JVM_OPT} RETURN_CODE=$? ;; lint) - mvn com.coveo:fmt-maven-plugin:check + mvn com.spotify.fmt:fmt-maven-plugin:check RETURN_CODE=$? ;; javadoc) @@ -69,6 +70,16 @@ integration) verify RETURN_CODE=$? ;; +graalvm) + # Run Unit and Integration Tests with Native Image + mvn -B ${INTEGRATION_TEST_ARGS} -ntp -Pnative -Penable-integration-tests test + RETURN_CODE=$? + ;; +graalvm17) + # Run Unit and Integration Tests with Native Image + mvn -B ${INTEGRATION_TEST_ARGS} -ntp -Pnative -Penable-integration-tests test + RETURN_CODE=$? + ;; samples) SAMPLES_DIR=samples # only run ITs in snapshot/ on presubmit PRs. run ITs in all 3 samples/ subdirectories otherwise. @@ -79,6 +90,46 @@ samples) if [[ -f ${SAMPLES_DIR}/pom.xml ]] then + for FILE in ${KOKORO_GFILE_DIR}/secret_manager/*-samples-secrets; do + [[ -f "$FILE" ]] || continue + source "$FILE" + done + + pushd ${SAMPLES_DIR} + mvn -B \ + -Penable-samples \ + -ntp \ + -DtrimStackTrace=false \ + -Dclirr.skip=true \ + -Denforcer.skip=true \ + -fae \ + verify + RETURN_CODE=$? + popd + else + echo "no sample pom.xml found - skipping sample tests" + fi + ;; +presubmit-against-pubsublite-samples) + ## cd to the directory one level above the root of the repo + cd ${scriptDir}/../.. + git clone https://github.com/googleapis/java-pubsublite.git + pushd java-pubsublite/ + + SAMPLES_DIR=samples + # Only run ITs in in snippets/ on presubmit PRs. + if [[ ! -z ${KOKORO_GITHUB_PULL_REQUEST_NUMBER} ]] + then + SAMPLES_DIR=samples/snippets + fi + + if [[ -f ${SAMPLES_DIR}/pom.xml ]] + then + for FILE in ${KOKORO_GFILE_DIR}/secret_manager/*-samples-secrets; do + [[ -f "$FILE" ]] || continue + source "$FILE" + done + pushd ${SAMPLES_DIR} mvn -B \ -Penable-samples \ diff --git a/.kokoro/coerce_logs.sh b/.kokoro/coerce_logs.sh index 5cf7ba49e..46edbf7f2 100755 --- a/.kokoro/coerce_logs.sh +++ b/.kokoro/coerce_logs.sh @@ -28,7 +28,6 @@ job=$(basename ${KOKORO_JOB_NAME}) echo "coercing sponge logs..." for xml in `find . -name *-sponge_log.xml` do - echo "processing ${xml}" class=$(basename ${xml} | cut -d- -f2) dir=$(dirname ${xml})/${job}/${class} text=$(dirname ${xml})/${class}-sponge_log.txt diff --git a/.kokoro/common.sh b/.kokoro/common.sh index ace89f45a..f8f957af1 100644 --- a/.kokoro/common.sh +++ b/.kokoro/common.sh @@ -55,4 +55,6 @@ function retry_with_backoff { ## Helper functionss function now() { date +"%Y-%m-%d %H:%M:%S" | tr -d '\n'; } function msg() { println "$*" >&2; } -function println() { printf '%s\n' "$(now) $*"; } \ No newline at end of file +function println() { printf '%s\n' "$(now) $*"; } + +## Helper comment to trigger updated repo dependency release \ No newline at end of file diff --git a/.kokoro/continuous/readme.cfg b/.kokoro/continuous/readme.cfg deleted file mode 100644 index cc3ada374..000000000 --- a/.kokoro/continuous/readme.cfg +++ /dev/null @@ -1,55 +0,0 @@ -# Copyright 2020 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. - -# Format: //devtools/kokoro/config/proto/build.proto - -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/python-multi" -} - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/java-pubsub/.kokoro/readme.sh" -} - -# Build logs will be here -action { - define_artifacts { - regex: "**/*sponge_log.xml" - regex: "**/*sponge_log.log" - } -} - -# The github token is stored here. -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "yoshi-automation-github-key" - # TODO(theacodes): remove this after secrets have globally propagated - backend_type: FASTCONFIGPUSH - } - } -} - -# Common env vars for all repositories and builds. -env_vars: { - key: "GITHUB_USER" - value: "yoshi-automation" -} -env_vars: { - key: "GITHUB_EMAIL" - value: "yoshi-automation@google.com" -} diff --git a/.kokoro/dependencies.sh b/.kokoro/dependencies.sh index 0fb8c8436..bd8960246 100755 --- a/.kokoro/dependencies.sh +++ b/.kokoro/dependencies.sh @@ -14,6 +14,7 @@ # limitations under the License. set -eo pipefail +shopt -s nullglob ## Get the directory of the build script scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}")) @@ -27,63 +28,32 @@ source ${scriptDir}/common.sh java -version echo $JOB_TYPE -export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=128m" +function determineMavenOpts() { + local javaVersion=$( + # filter down to the version line, then pull out the version between quotes, + # then trim the version number down to its minimal number (removing any + # update or suffix number). + java -version 2>&1 | grep "version" \ + | sed -E 's/^.*"(.*?)".*$/\1/g' \ + | sed -E 's/^(1\.[0-9]\.0).*$/\1/g' + ) + + if [[ $javaVersion == 17* ]] + then + # MaxPermSize is no longer supported as of jdk 17 + echo -n "-Xmx1024m" + else + echo -n "-Xmx1024m -XX:MaxPermSize=128m" + fi +} + +export MAVEN_OPTS=$(determineMavenOpts) # this should run maven enforcer retry_with_backoff 3 10 \ mvn install -B -V -ntp \ -DskipTests=true \ + -Dmaven.javadoc.skip=true \ -Dclirr.skip=true mvn -B dependency:analyze -DfailOnWarning=true - -echo "****************** DEPENDENCY LIST COMPLETENESS CHECK *******************" -## Run dependency list completeness check -function completenessCheck() { - # Output dep list with compile scope generated using the original pom - # Running mvn dependency:list on Java versions that support modules will also include the module of the dependency. - # This is stripped from the output as it is not present in the flattened pom. - # Only dependencies with 'compile' or 'runtime' scope are included from original dependency list. - msg "Generating dependency list using original pom..." - mvn dependency:list -f pom.xml -DincludeScope=runtime -Dsort=true | grep '\[INFO] .*:.*:.*:.*:.*' | sed -e s/\\s--\\smodule.*// >.org-list.txt - - # Output dep list generated using the flattened pom (only 'compile' and 'runtime' scopes) - msg "Generating dependency list using flattened pom..." - mvn dependency:list -f .flattened-pom.xml -DincludeScope=runtime -Dsort=true | grep '\[INFO] .*:.*:.*:.*:.*' >.new-list.txt - - # Compare two dependency lists - msg "Comparing dependency lists..." - diff .org-list.txt .new-list.txt >.diff.txt - if [[ $? == 0 ]] - then - msg "Success. No diff!" - else - msg "Diff found. See below: " - msg "You can also check .diff.txt file located in $1." - cat .diff.txt - return 1 - fi -} - -# Allow failures to continue running the script -set +e - -error_count=0 -for path in $(find -name ".flattened-pom.xml") -do - # Check flattened pom in each dir that contains it for completeness - dir=$(dirname "$path") - pushd "$dir" - completenessCheck "$dir" - error_count=$(($error_count + $?)) - popd -done - -if [[ $error_count == 0 ]] -then - msg "All checks passed." - exit 0 -else - msg "Errors found. See log statements above." - exit 1 -fi diff --git a/.kokoro/nightly/integration.cfg b/.kokoro/nightly/integration.cfg index 0048c8ece..5a95c6828 100644 --- a/.kokoro/nightly/integration.cfg +++ b/.kokoro/nightly/integration.cfg @@ -13,16 +13,16 @@ env_vars: { # TODO: remove this after we've migrated all tests and scripts env_vars: { key: "GCLOUD_PROJECT" - value: "gcloud-devel" + value: "java-docs-samples-testing" } env_vars: { key: "GOOGLE_CLOUD_PROJECT" - value: "gcloud-devel" + value: "java-docs-samples-testing" } env_vars: { - key: "ENABLE_BUILD_COP" + key: "ENABLE_FLAKYBOT" value: "true" } @@ -35,3 +35,4 @@ env_vars: { key: "SECRET_MANAGER_KEYS" value: "java-it-service-account" } + diff --git a/.kokoro/nightly/java11-integration.cfg b/.kokoro/nightly/java11-integration.cfg new file mode 100644 index 000000000..6a6ef94ef --- /dev/null +++ b/.kokoro/nightly/java11-integration.cfg @@ -0,0 +1,38 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-public-resources/java11014" +} + +env_vars: { + key: "JOB_TYPE" + value: "integration" +} +# TODO: remove this after we've migrated all tests and scripts +env_vars: { + key: "GCLOUD_PROJECT" + value: "gcloud-devel" +} + +env_vars: { + key: "GOOGLE_CLOUD_PROJECT" + value: "gcloud-devel" +} + +env_vars: { + key: "ENABLE_FLAKYBOT" + value: "true" +} + +env_vars: { + key: "GOOGLE_APPLICATION_CREDENTIALS" + value: "secret_manager/java-it-service-account" +} + +env_vars: { + key: "SECRET_MANAGER_KEYS" + value: "java-it-service-account" +} + diff --git a/.kokoro/nightly/samples.cfg b/.kokoro/nightly/samples.cfg index f25429314..9761fd864 100644 --- a/.kokoro/nightly/samples.cfg +++ b/.kokoro/nightly/samples.cfg @@ -33,6 +33,6 @@ env_vars: { } env_vars: { - key: "ENABLE_BUILD_COP" + key: "ENABLE_FLAKYBOT" value: "true" } diff --git a/.kokoro/presubmit/graalvm-native-a.cfg b/.kokoro/presubmit/graalvm-native-a.cfg new file mode 100644 index 000000000..7b8ea75fc --- /dev/null +++ b/.kokoro/presubmit/graalvm-native-a.cfg @@ -0,0 +1,38 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_a:3.62.0" # {x-version-update:google-cloud-shared-dependencies:current} +} + +env_vars: { + key: "JOB_TYPE" + value: "graalvm" +} + +# TODO: remove this after we've migrated all tests and scripts +env_vars: { + key: "GCLOUD_PROJECT" + value: "gcloud-devel" +} + +env_vars: { + key: "GOOGLE_CLOUD_PROJECT" + value: "gcloud-devel" +} + +env_vars: { + key: "GOOGLE_APPLICATION_CREDENTIALS" + value: "secret_manager/java-it-service-account" +} + +env_vars: { + key: "SECRET_MANAGER_KEYS" + value: "java-it-service-account" +} + +env_vars: { + key: "IT_SERVICE_ACCOUNT_EMAIL" + value: "it-service-account@gcloud-devel.iam.gserviceaccount.com" +} \ No newline at end of file diff --git a/.kokoro/presubmit/graalvm-native-b.cfg b/.kokoro/presubmit/graalvm-native-b.cfg new file mode 100644 index 000000000..53ecdc6d6 --- /dev/null +++ b/.kokoro/presubmit/graalvm-native-b.cfg @@ -0,0 +1,38 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_b:3.62.0" # {x-version-update:google-cloud-shared-dependencies:current} +} + +env_vars: { + key: "JOB_TYPE" + value: "graalvm" +} + +# TODO: remove this after we've migrated all tests and scripts +env_vars: { + key: "GCLOUD_PROJECT" + value: "gcloud-devel" +} + +env_vars: { + key: "GOOGLE_CLOUD_PROJECT" + value: "gcloud-devel" +} + +env_vars: { + key: "GOOGLE_APPLICATION_CREDENTIALS" + value: "secret_manager/java-it-service-account" +} + +env_vars: { + key: "SECRET_MANAGER_KEYS" + value: "java-it-service-account" +} + +env_vars: { + key: "IT_SERVICE_ACCOUNT_EMAIL" + value: "it-service-account@gcloud-devel.iam.gserviceaccount.com" +} \ No newline at end of file diff --git a/.kokoro/presubmit/graalvm-native-c.cfg b/.kokoro/presubmit/graalvm-native-c.cfg new file mode 100644 index 000000000..f9e58f879 --- /dev/null +++ b/.kokoro/presubmit/graalvm-native-c.cfg @@ -0,0 +1,38 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_c:3.62.0" # {x-version-update:google-cloud-shared-dependencies:current} +} + +env_vars: { + key: "JOB_TYPE" + value: "graalvm" +} + +# TODO: remove this after we've migrated all tests and scripts +env_vars: { + key: "GCLOUD_PROJECT" + value: "gcloud-devel" +} + +env_vars: { + key: "GOOGLE_CLOUD_PROJECT" + value: "gcloud-devel" +} + +env_vars: { + key: "GOOGLE_APPLICATION_CREDENTIALS" + value: "secret_manager/java-it-service-account" +} + +env_vars: { + key: "SECRET_MANAGER_KEYS" + value: "java-it-service-account" +} + +env_vars: { + key: "IT_SERVICE_ACCOUNT_EMAIL" + value: "it-service-account@gcloud-devel.iam.gserviceaccount.com" +} \ No newline at end of file diff --git a/.kokoro/presubmit/integration.cfg b/.kokoro/presubmit/integration.cfg index dded67a9d..5864c603e 100644 --- a/.kokoro/presubmit/integration.cfg +++ b/.kokoro/presubmit/integration.cfg @@ -31,3 +31,4 @@ env_vars: { key: "SECRET_MANAGER_KEYS" value: "java-it-service-account" } + diff --git a/.kokoro/presubmit/presubmit-against-pubsublite-samples.cfg b/.kokoro/presubmit/presubmit-against-pubsublite-samples.cfg new file mode 100644 index 000000000..7efa00b77 --- /dev/null +++ b/.kokoro/presubmit/presubmit-against-pubsublite-samples.cfg @@ -0,0 +1,38 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java11" +} + +env_vars: { + key: "JOB_TYPE" + value: "presubmit-against-pubsublite-samples" +} + +# TODO: remove this after we've migrated all tests and scripts +env_vars: { + key: "GCLOUD_PROJECT" + value: "java-docs-samples-testing" +} + +env_vars: { + key: "GOOGLE_CLOUD_PROJECT" + value: "java-docs-samples-testing" +} + +env_vars: { + key: "GOOGLE_CLOUD_PROJECT_NUMBER" + value: "779844219229" +} + +env_vars: { + key: "GOOGLE_APPLICATION_CREDENTIALS" + value: "secret_manager/java-docs-samples-service-account" +} + +env_vars: { + key: "SECRET_MANAGER_KEYS" + value: "java-docs-samples-service-account" +} \ No newline at end of file diff --git a/.kokoro/release/bump_snapshot.cfg b/.kokoro/release/bump_snapshot.cfg deleted file mode 100644 index a2a5982a8..000000000 --- a/.kokoro/release/bump_snapshot.cfg +++ /dev/null @@ -1,53 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Build logs will be here -action { - define_artifacts { - regex: "**/*sponge_log.xml" - } -} - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "java-pubsub/.kokoro/trampoline.sh" - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:10-user" -} - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/java-pubsub/.kokoro/release/bump_snapshot.sh" -} - -# tokens used by release-please to keep an up-to-date release PR. -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "github-magic-proxy-key-release-please" - } - } -} - -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "github-magic-proxy-token-release-please" - } - } -} - -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "github-magic-proxy-url-release-please" - } - } -} diff --git a/.kokoro/release/bump_snapshot.sh b/.kokoro/release/bump_snapshot.sh deleted file mode 100755 index bf54b4900..000000000 --- a/.kokoro/release/bump_snapshot.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash - -# Copyright 2019 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. - -set -eo pipefail - -export NPM_CONFIG_PREFIX=/home/node/.npm-global - -if [ -f ${KOKORO_KEYSTORE_DIR}/73713_github-magic-proxy-url-release-please ]; then - # Groom the snapshot release PR immediately after publishing a release - npx release-please release-pr --token=${KOKORO_KEYSTORE_DIR}/73713_github-magic-proxy-token-release-please \ - --repo-url=googleapis/java-pubsub \ - --package-name="pubsub" \ - --api-url=${KOKORO_KEYSTORE_DIR}/73713_github-magic-proxy-url-release-please \ - --proxy-key=${KOKORO_KEYSTORE_DIR}/73713_github-magic-proxy-key-release-please \ - --snapshot \ - --release-type=java-auth-yoshi -fi diff --git a/.kokoro/release/common.cfg b/.kokoro/release/common.cfg deleted file mode 100644 index 7eeae74d5..000000000 --- a/.kokoro/release/common.cfg +++ /dev/null @@ -1,49 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "java-pubsub/.kokoro/trampoline.sh" - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/java8" -} - -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 70247 - keyname: "maven-gpg-keyring" - } - } -} - -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 70247 - keyname: "maven-gpg-passphrase" - } - } -} - -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 70247 - keyname: "maven-gpg-pubkeyring" - } - } -} - -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 70247 - keyname: "sonatype-credentials" - } - } -} diff --git a/.kokoro/release/common.sh b/.kokoro/release/common.sh deleted file mode 100755 index 6e3f65999..000000000 --- a/.kokoro/release/common.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash -# Copyright 2018 Google Inc. -# -# 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. - -set -eo pipefail - -# Get secrets from keystore and set and environment variables -setup_environment_secrets() { - export GPG_PASSPHRASE=$(cat ${KOKORO_KEYSTORE_DIR}/70247_maven-gpg-passphrase) - export GPG_TTY=$(tty) - export GPG_HOMEDIR=/gpg - mkdir $GPG_HOMEDIR - mv ${KOKORO_KEYSTORE_DIR}/70247_maven-gpg-pubkeyring $GPG_HOMEDIR/pubring.gpg - mv ${KOKORO_KEYSTORE_DIR}/70247_maven-gpg-keyring $GPG_HOMEDIR/secring.gpg - export SONATYPE_USERNAME=$(cat ${KOKORO_KEYSTORE_DIR}/70247_sonatype-credentials | cut -f1 -d'|') - export SONATYPE_PASSWORD=$(cat ${KOKORO_KEYSTORE_DIR}/70247_sonatype-credentials | cut -f2 -d'|') -} - -create_settings_xml_file() { - echo " - - - ossrh - ${SONATYPE_USERNAME} - ${SONATYPE_PASSWORD} - - - sonatype-nexus-staging - ${SONATYPE_USERNAME} - ${SONATYPE_PASSWORD} - - - sonatype-nexus-snapshots - ${SONATYPE_USERNAME} - ${SONATYPE_PASSWORD} - - -" > $1 -} \ No newline at end of file diff --git a/.kokoro/release/drop.cfg b/.kokoro/release/drop.cfg deleted file mode 100644 index fa56231bd..000000000 --- a/.kokoro/release/drop.cfg +++ /dev/null @@ -1,6 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/java-pubsub/.kokoro/release/drop.sh" -} diff --git a/.kokoro/release/drop.sh b/.kokoro/release/drop.sh deleted file mode 100755 index 5c4551efa..000000000 --- a/.kokoro/release/drop.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -# Copyright 2018 Google Inc. -# -# 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. - -set -eo pipefail - -# STAGING_REPOSITORY_ID must be set -if [ -z "${STAGING_REPOSITORY_ID}" ]; then - echo "Missing STAGING_REPOSITORY_ID environment variable" - exit 1 -fi - -source $(dirname "$0")/common.sh -pushd $(dirname "$0")/../../ - -setup_environment_secrets -create_settings_xml_file "settings.xml" - -mvn nexus-staging:drop -B \ - --settings=settings.xml \ - -DstagingRepositoryId=${STAGING_REPOSITORY_ID} diff --git a/.kokoro/release/promote.cfg b/.kokoro/release/promote.cfg deleted file mode 100644 index 08d54e6ab..000000000 --- a/.kokoro/release/promote.cfg +++ /dev/null @@ -1,6 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/java-pubsub/.kokoro/release/promote.sh" -} diff --git a/.kokoro/release/promote.sh b/.kokoro/release/promote.sh deleted file mode 100755 index 1fa95fa53..000000000 --- a/.kokoro/release/promote.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -# Copyright 2018 Google Inc. -# -# 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. - -set -eo pipefail - -# STAGING_REPOSITORY_ID must be set -if [ -z "${STAGING_REPOSITORY_ID}" ]; then - echo "Missing STAGING_REPOSITORY_ID environment variable" - exit 1 -fi - -source $(dirname "$0")/common.sh - -pushd $(dirname "$0")/../../ - -setup_environment_secrets -create_settings_xml_file "settings.xml" - -mvn nexus-staging:release -B \ - -DperformRelease=true \ - --settings=settings.xml \ - -DstagingRepositoryId=${STAGING_REPOSITORY_ID} diff --git a/.kokoro/release/publish_javadoc.cfg b/.kokoro/release/publish_javadoc.cfg deleted file mode 100644 index 9e3e80619..000000000 --- a/.kokoro/release/publish_javadoc.cfg +++ /dev/null @@ -1,23 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/doc-templates/" - -env_vars: { - key: "STAGING_BUCKET" - value: "docs-staging" -} - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/java-pubsub/.kokoro/release/publish_javadoc.sh" -} - - -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "docuploader_service_account" - } - } -} diff --git a/.kokoro/release/publish_javadoc.sh b/.kokoro/release/publish_javadoc.sh deleted file mode 100755 index 8e29d1dc6..000000000 --- a/.kokoro/release/publish_javadoc.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/bash -# Copyright 2019 Google Inc. -# -# 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. - -set -eo pipefail - -if [[ -z "${CREDENTIALS}" ]]; then - CREDENTIALS=${KOKORO_KEYSTORE_DIR}/73713_docuploader_service_account -fi - -if [[ -z "${STAGING_BUCKET}" ]]; then - echo "Need to set STAGING_BUCKET environment variable" - exit 1 -fi - -if [[ -z "${STAGING_BUCKET_V2}" ]]; then - echo "Need to set STAGING_BUCKET_V2 environment variable" - exit 1 -fi - -# work from the git root directory -pushd $(dirname "$0")/../../ - -# install docuploader package -python3 -m pip install gcp-docuploader - -# compile all packages -mvn clean install -B -q -DskipTests=true - -export NAME=google-cloud-pubsub -export VERSION=$(grep ${NAME}: versions.txt | cut -d: -f3) - -# build the docs -mvn site -B -q - -pushd target/site/apidocs - -# create metadata -python3 -m docuploader create-metadata \ - --name ${NAME} \ - --version ${VERSION} \ - --language java - -# upload docs -python3 -m docuploader upload . \ - --credentials ${CREDENTIALS} \ - --staging-bucket ${STAGING_BUCKET} diff --git a/.kokoro/release/publish_javadoc11.cfg b/.kokoro/release/publish_javadoc11.cfg deleted file mode 100644 index f56e0021b..000000000 --- a/.kokoro/release/publish_javadoc11.cfg +++ /dev/null @@ -1,30 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# cloud-rad production -env_vars: { - key: "STAGING_BUCKET_V2" - value: "docs-staging-v2" -} - -# Configure the docker image for kokoro-trampoline -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/java11" -} - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/java-pubsub/.kokoro/release/publish_javadoc11.sh" -} - -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "docuploader_service_account" - } - } -} - -# Downloads docfx doclet resource. This will be in ${KOKORO_GFILE_DIR}/ -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/docfx" diff --git a/.kokoro/release/publish_javadoc11.sh b/.kokoro/release/publish_javadoc11.sh deleted file mode 100755 index bbf99213d..000000000 --- a/.kokoro/release/publish_javadoc11.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/bash -# Copyright 2021 Google Inc. -# -# 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. - -set -eo pipefail - -if [[ -z "${CREDENTIALS}" ]]; then - CREDENTIALS=${KOKORO_KEYSTORE_DIR}/73713_docuploader_service_account -fi - -if [[ -z "${STAGING_BUCKET_V2}" ]]; then - echo "Need to set STAGING_BUCKET_V2 environment variable" - exit 1 -fi - -# work from the git root directory -pushd $(dirname "$0")/../../ - -# install docuploader package -python3 -m pip install gcp-docuploader - -# compile all packages -mvn clean install -B -q -DskipTests=true - -export NAME=google-cloud-pubsub -export VERSION=$(grep ${NAME}: versions.txt | cut -d: -f3) - -# V3 generates docfx yml from javadoc -# generate yml -mvn clean site -B -q -P docFX - -# copy README to docfx-yml dir and rename index.md -cp README.md target/docfx-yml/index.md - -pushd target/docfx-yml - -# create metadata -python3 -m docuploader create-metadata \ - --name ${NAME} \ - --version ${VERSION} \ - --language java - -# upload yml to production bucket -python3 -m docuploader upload . \ - --credentials ${CREDENTIALS} \ - --staging-bucket ${STAGING_BUCKET_V2} \ - --destination-prefix docfx diff --git a/.kokoro/release/snapshot.cfg b/.kokoro/release/snapshot.cfg deleted file mode 100644 index 3c445f2dc..000000000 --- a/.kokoro/release/snapshot.cfg +++ /dev/null @@ -1,6 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/java-pubsub/.kokoro/release/snapshot.sh" -} \ No newline at end of file diff --git a/.kokoro/release/snapshot.sh b/.kokoro/release/snapshot.sh deleted file mode 100755 index 098168a73..000000000 --- a/.kokoro/release/snapshot.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash -# Copyright 2019 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. - -set -eo pipefail - -source $(dirname "$0")/common.sh -MAVEN_SETTINGS_FILE=$(realpath $(dirname "$0")/../../)/settings.xml -pushd $(dirname "$0")/../../ - -# ensure we're trying to push a snapshot (no-result returns non-zero exit code) -grep SNAPSHOT versions.txt - -setup_environment_secrets -create_settings_xml_file "settings.xml" - -mvn clean install deploy -B \ - --settings ${MAVEN_SETTINGS_FILE} \ - -DperformRelease=true \ - -Dgpg.executable=gpg \ - -Dgpg.passphrase=${GPG_PASSPHRASE} \ - -Dgpg.homedir=${GPG_HOMEDIR} diff --git a/.kokoro/release/stage.cfg b/.kokoro/release/stage.cfg deleted file mode 100644 index 587130b55..000000000 --- a/.kokoro/release/stage.cfg +++ /dev/null @@ -1,19 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/java-pubsub/.kokoro/release/stage.sh" -} - -# Need to save the properties file -action { - define_artifacts { - regex: "github/java-pubsub/target/nexus-staging/staging/*.properties" - strip_prefix: "github/java-pubsub" - } -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem" -} diff --git a/.kokoro/release/stage.sh b/.kokoro/release/stage.sh deleted file mode 100755 index 16126d2eb..000000000 --- a/.kokoro/release/stage.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash -# Copyright 2018 Google Inc. -# -# 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. - -set -eo pipefail - -# Start the releasetool reporter -python3 -m pip install gcp-releasetool -python3 -m releasetool publish-reporter-script > /tmp/publisher-script; source /tmp/publisher-script - -source $(dirname "$0")/common.sh -source $(dirname "$0")/../common.sh -MAVEN_SETTINGS_FILE=$(realpath $(dirname "$0")/../../)/settings.xml -pushd $(dirname "$0")/../../ - -setup_environment_secrets -create_settings_xml_file "settings.xml" - -# attempt to stage 3 times with exponential backoff (starting with 10 seconds) -retry_with_backoff 3 10 \ - mvn clean install deploy -B \ - --settings ${MAVEN_SETTINGS_FILE} \ - -DskipTests=true \ - -DperformRelease=true \ - -Dgpg.executable=gpg \ - -Dgpg.passphrase=${GPG_PASSPHRASE} \ - -Dgpg.homedir=${GPG_HOMEDIR} - -if [[ -n "${AUTORELEASE_PR}" ]] -then - mvn nexus-staging:release -B \ - -DperformRelease=true \ - --settings=settings.xml -fi \ No newline at end of file diff --git a/.kokoro/trampoline.sh b/.kokoro/trampoline.sh index 9da0f8398..8b69b793c 100644 --- a/.kokoro/trampoline.sh +++ b/.kokoro/trampoline.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2018 Google Inc. +# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/.readme-partials.yaml b/.readme-partials.yaml index c68686327..640d3b70b 100644 --- a/.readme-partials.yaml +++ b/.readme-partials.yaml @@ -6,12 +6,12 @@ custom_content: | ```java import com.google.cloud.pubsub.v1.TopicAdminClient; - import com.google.pubsub.v1.ProjectTopicName; + import com.google.pubsub.v1.TopicName; ``` Then, to create the topic, use the following code: ```java - ProjectTopicName topic = ProjectTopicName.of("test-project", "test-topic"); + TopicName topic = TopicName.of("test-project", "test-topic"); try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) { topicAdminClient.createTopic(topic); } @@ -65,14 +65,14 @@ custom_content: | ```java import com.google.cloud.pubsub.v1.SubscriptionAdminClient; import com.google.pubsub.v1.PushConfig; - import com.google.pubsub.v1.ProjectSubscriptionName; - import com.google.pubsub.v1.ProjectTopicName; + import com.google.pubsub.v1.SubscriptionName; + import com.google.pubsub.v1.TopicName; ``` Then, to create the subscription, use the following code: ```java - ProjectTopicName topic = ProjectTopicName.of("test-project", "test-topic"); - ProjectSubscriptionName subscription = ProjectSubscriptionName.of("test-project", "test-subscription"); + TopicName topic = TopicName.of("test-project", "test-topic"); + SubscriptionName subscription = SubscriptionName.of("test-project", "test-subscription"); try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) { subscriptionAdminClient.createSubscription(subscription, topic, PushConfig.getDefaultInstance(), 0); @@ -90,13 +90,13 @@ custom_content: | import com.google.cloud.pubsub.v1.Subscriber; import com.google.common.util.concurrent.MoreExecutors; import com.google.pubsub.v1.PubsubMessage; - import com.google.pubsub.v1.ProjectSubscriptionName; - import com.google.pubsub.v1.ProjectTopicName; + import com.google.pubsub.v1.SubscriptionName; + import com.google.pubsub.v1.TopicName; ``` Then, to pull messages asynchronously, use the following code: ```java - ProjectSubscriptionName subscription = ProjectSubscriptionName.of("test-project", "test-subscription"); + SubscriptionName subscription = SubscriptionName.of("test-project", "test-subscription"); MessageReceiver receiver = new MessageReceiver() { @@ -109,7 +109,7 @@ custom_content: | Subscriber subscriber = null; try { - subscriber = Subscriber.newBuilder(subscription, receiver).build(); + subscriber = Subscriber.newBuilder(subscription.toString(), receiver).build(); subscriber.addListener( new Subscriber.Listener() { @Override diff --git a/.repo-metadata.json b/.repo-metadata.json index 93da177cf..31cf00630 100644 --- a/.repo-metadata.json +++ b/.repo-metadata.json @@ -1,17 +1,20 @@ { - "name": "pubsub", + "api_shortname": "pubsub", "name_pretty": "Cloud Pub/Sub", - "api_reference": "https://cloud.google.com/pubsub/", "product_documentation": "https://cloud.google.com/pubsub/docs/", - "client_documentation": "https://googleapis.dev/java/google-cloud-pubsub/latest/index.html", "api_description": "is designed to provide reliable, many-to-many, asynchronous messaging between applications. Publisher applications can send messages to a topic and other applications can subscribe to that topic to receive the messages. By decoupling senders and receivers, Google Cloud Pub/Sub allows developers to communicate between independently written applications.", - "issue_tracker": "https://issuetracker.google.com/savedsearches/559741", - "release_level": "ga", + "client_documentation": "https://cloud.google.com/java/docs/reference/google-cloud-pubsub/latest/history", + "release_level": "stable", + "transport": "both", "language": "java", "repo": "googleapis/java-pubsub", "repo_short": "java-pubsub", "distribution_name": "com.google.cloud:google-cloud-pubsub", - "codeowner_team": "@googleapis/api-pubsub", "api_id": "pubsub.googleapis.com", - "requires_billing": true + "library_type": "GAPIC_COMBO", + "requires_billing": true, + "api_reference": "https://cloud.google.com/pubsub/", + "codeowner_team": "@googleapis/pubsub-team", + "issue_tracker": "https://issuetracker.google.com/savedsearches/559741", + "recommended_package": "com.google.cloud.pubsub.v1" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 70ebb3a1c..dcd6ad089 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,2224 @@ # Changelog +## [1.150.2](https://github.com/googleapis/java-pubsub/compare/v1.150.1...v1.150.2) (2026-05-07) + + +### Bug Fixes + +* **deps:** Update the Java code generator (gapic-generator-java) to 2.72.0 ([a9b68a2](https://github.com/googleapis/java-pubsub/commit/a9b68a20208246b435739a1169d240a55c89695c)) + + +### Dependencies + +* Update dependency com.google.cloud:sdk-platform-java-config to v3.62.0 ([#2729](https://github.com/googleapis/java-pubsub/issues/2729)) ([77e0c65](https://github.com/googleapis/java-pubsub/commit/77e0c652c73a2fb790f01b76f2f32d95092188cb)) +* Update googleapis/google-cloud-java action to v1.86.0 ([#2727](https://github.com/googleapis/java-pubsub/issues/2727)) ([3da5b3b](https://github.com/googleapis/java-pubsub/commit/3da5b3baa1c4d97e58208b3c1de5533f2b10bf40)) + +## [1.150.1](https://github.com/googleapis/java-pubsub/compare/v1.150.0...v1.150.1) (2026-04-14) + + +### Bug Fixes + +* **deps:** Update the Java code generator (gapic-generator-java) to 2.71.0 ([49cb97f](https://github.com/googleapis/java-pubsub/commit/49cb97ff6d8f1a12abc6689cadc04c888baab723)) +* Increase streaming pull timeout ([49cb97f](https://github.com/googleapis/java-pubsub/commit/49cb97ff6d8f1a12abc6689cadc04c888baab723)) + + +### Dependencies + +* Update dependency com.google.cloud:sdk-platform-java-config to v3.61.0 ([#2714](https://github.com/googleapis/java-pubsub/issues/2714)) ([7f6dbcc](https://github.com/googleapis/java-pubsub/commit/7f6dbcc11c41c682bee16818436d036a1df68512)) + + +### Documentation + +* Fix documentation URL AIInference MessageTransform service_account_email field ([49cb97f](https://github.com/googleapis/java-pubsub/commit/49cb97ff6d8f1a12abc6689cadc04c888baab723)) + +## [1.150.0](https://github.com/googleapis/java-pubsub/compare/v1.149.0...v1.150.0) (2026-03-23) + + +### Features + +* Add BigtableConfig type ([f69de7e](https://github.com/googleapis/java-pubsub/commit/f69de7ee2cb5b96adbf3fc5b11e1f8a3bbbd0bee)) + + +### Bug Fixes + +* **deps:** Update the Java code generator (gapic-generator-java) to 2.68.0 ([f69de7e](https://github.com/googleapis/java-pubsub/commit/f69de7ee2cb5b96adbf3fc5b11e1f8a3bbbd0bee)) + + +### Dependencies + +* Update dependency com.google.cloud:sdk-platform-java-config to v3.58.0 ([#2709](https://github.com/googleapis/java-pubsub/issues/2709)) ([e82a6ff](https://github.com/googleapis/java-pubsub/commit/e82a6ff52154f3acaaf8195a90e2966666353609)) + +## [1.149.0](https://github.com/googleapis/java-pubsub/compare/v1.148.0...v1.149.0) (2026-02-26) + + +### Features + +* Add client library debug logging ([c4e10b9](https://github.com/googleapis/java-pubsub/commit/c4e10b95880d0db61b62e89c58d269c755d9e11e)) + + +### Bug Fixes + +* **deps:** Update the Java code generator (gapic-generator-java) to 2.67.0 ([c85f4ea](https://github.com/googleapis/java-pubsub/commit/c85f4eaaf2b28e7c0c544d5a4a92a197112e7723)) +* Do not use directExecutor() for the publish callback when ordering is enabled ([#2693](https://github.com/googleapis/java-pubsub/issues/2693)) ([c7ecd2b](https://github.com/googleapis/java-pubsub/commit/c7ecd2b5aac2719ca55a93d6bd5b9afc9aeb5a9c)) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-bigquery to v2.59.0 ([#2690](https://github.com/googleapis/java-pubsub/issues/2690)) ([bed9464](https://github.com/googleapis/java-pubsub/commit/bed94648ceede888a244d21082b7e403fbae0aaa)) +* Update dependency com.google.cloud:google-cloud-core to v2.65.0 ([#2681](https://github.com/googleapis/java-pubsub/issues/2681)) ([e291b0d](https://github.com/googleapis/java-pubsub/commit/e291b0d98d576f0beceb49af002fc501ad31683f)) +* Update dependency com.google.cloud:google-cloud-storage to v2.63.0 ([#2676](https://github.com/googleapis/java-pubsub/issues/2676)) ([2a1ebea](https://github.com/googleapis/java-pubsub/commit/2a1ebea9d101cc650e1276e30063f87193eb1f6e)) +* Update dependency com.google.cloud:sdk-platform-java-config to v3.57.0 ([#2696](https://github.com/googleapis/java-pubsub/issues/2696)) ([dd02393](https://github.com/googleapis/java-pubsub/commit/dd02393c586de6cfe7d91d9579a490533876c7f1)) +* Update dependency com.google.protobuf:protobuf-java-util to v4.33.5 ([#2678](https://github.com/googleapis/java-pubsub/issues/2678)) ([70b781c](https://github.com/googleapis/java-pubsub/commit/70b781c51dc82de76ff1417c1c0ab4b012cb7cc0)) +* Update googleapis/sdk-platform-java action to v2.67.0 ([#2683](https://github.com/googleapis/java-pubsub/issues/2683)) ([9d5fa5b](https://github.com/googleapis/java-pubsub/commit/9d5fa5b04c633879567b2025bc045ef2e6b48b59)) + +## [1.148.0](https://github.com/googleapis/java-pubsub/compare/v1.147.0...v1.148.0) (2026-02-11) + + +### Features + +* Next release from main branch is 1.148.0 ([#2686](https://github.com/googleapis/java-pubsub/issues/2686)) ([6b133e8](https://github.com/googleapis/java-pubsub/commit/6b133e8277bba25ab8f91d970d8d79e8bdaaa7e7)) + + +### Dependencies + +* Update dependency com.google.cloud:sdk-platform-java-config to v3.56.1 ([#2682](https://github.com/googleapis/java-pubsub/issues/2682)) ([1a94be9](https://github.com/googleapis/java-pubsub/commit/1a94be982e291c8cbf1ac2ec4aa6a84a4dabd17d)) + +## [1.147.0](https://github.com/googleapis/java-pubsub/compare/v1.146.0...v1.147.0) (2026-01-27) + + +### Features + +* Enable Subscriber StreamingPull keepalives by increasing the StreamingPull protocol version ([#2672](https://github.com/googleapis/java-pubsub/issues/2672)) ([18a592d](https://github.com/googleapis/java-pubsub/commit/18a592d81971ca99fa8fac0b355b02c4c3646bf2)) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-bigquery to v2.58.0 ([#2639](https://github.com/googleapis/java-pubsub/issues/2639)) ([afe27d8](https://github.com/googleapis/java-pubsub/commit/afe27d881379ad2564961b439176c61d0e9ce663)) +* Update dependency com.google.cloud:google-cloud-core to v2.64.0 ([#2641](https://github.com/googleapis/java-pubsub/issues/2641)) ([93368a3](https://github.com/googleapis/java-pubsub/commit/93368a3e9aec90e42a944d76e79559f3f35ac792)) +* Update dependency com.google.cloud:google-cloud-storage to v2.62.0 ([#2643](https://github.com/googleapis/java-pubsub/issues/2643)) ([6a4f059](https://github.com/googleapis/java-pubsub/commit/6a4f0595610e06ba1fa58fe916c7f5a1f09245ca)) +* Update dependency com.google.protobuf:protobuf-java-util to v4.33.4 ([#2656](https://github.com/googleapis/java-pubsub/issues/2656)) ([0973b81](https://github.com/googleapis/java-pubsub/commit/0973b81b82493e7a7df1764e4f29435abe545d50)) +* Update dependency org.assertj:assertj-core to v3.27.7 [security] ([#2670](https://github.com/googleapis/java-pubsub/issues/2670)) ([32d75fd](https://github.com/googleapis/java-pubsub/commit/32d75fd9096bb56286c98636d5a8fa6a23508f60)) + +## [1.146.0](https://github.com/googleapis/java-pubsub/compare/v1.145.0...v1.146.0) (2026-01-26) + + +### Features + +* **deps:** Update the Java code generator (gapic-generator-java) to 2.66.0 ([a7edd5b](https://github.com/googleapis/java-pubsub/commit/a7edd5b705557bcf72ca47dc8219677ba8595f8c)) + + +### Dependencies + +* Update dependency com.google.cloud:sdk-platform-java-config to v3.56.0 ([#2664](https://github.com/googleapis/java-pubsub/issues/2664)) ([6d44cf3](https://github.com/googleapis/java-pubsub/commit/6d44cf3b94e6fe8603e3d8bb9357643f0315fa4e)) +* Update googleapis/sdk-platform-java action to v2.66.0 ([#2665](https://github.com/googleapis/java-pubsub/issues/2665)) ([1f95f3a](https://github.com/googleapis/java-pubsub/commit/1f95f3ac56ef371b7eee05aa2d294e0e4ca6ad84)) + +## [1.145.0](https://github.com/googleapis/java-pubsub/compare/v1.144.1...v1.145.0) (2026-01-15) + + +### Features + +* Add AIInference MessageTransform type ([fe73614](https://github.com/googleapis/java-pubsub/commit/fe73614cdb6c2aca445c46e917c325cbfee3adfd)) + + +### Bug Fixes + +* **deps:** Update the Java code generator (gapic-generator-java) to 2.65.1 ([fe73614](https://github.com/googleapis/java-pubsub/commit/fe73614cdb6c2aca445c46e917c325cbfee3adfd)) + + +### Dependencies + +* Update dependency com.google.cloud:sdk-platform-java-config to v3.55.1 ([#2658](https://github.com/googleapis/java-pubsub/issues/2658)) ([1a11309](https://github.com/googleapis/java-pubsub/commit/1a1130914420b45d628553218a3fa4d477216143)) +* Update googleapis/sdk-platform-java action to v2.65.1 ([#2657](https://github.com/googleapis/java-pubsub/issues/2657)) ([72dd566](https://github.com/googleapis/java-pubsub/commit/72dd5668ab2e71a24bed66c55173ab9ff5093ced)) + + +### Documentation + +* Add tags documentation links to Pub/Sub resource tags fields ([fe73614](https://github.com/googleapis/java-pubsub/commit/fe73614cdb6c2aca445c46e917c325cbfee3adfd)) + +## [1.144.1](https://github.com/googleapis/java-pubsub/compare/v1.144.0...v1.144.1) (2025-12-22) + + +### Bug Fixes + +* Lower the Subscriber protocol version to disable the streaming pull keepalive feature ([#2652](https://github.com/googleapis/java-pubsub/issues/2652)) ([ca99c2a](https://github.com/googleapis/java-pubsub/commit/ca99c2a2cea8201ea6f71e7383bd6123ec32ebdc)) + +## [1.144.0](https://github.com/googleapis/java-pubsub/compare/v1.143.1...v1.144.0) (2025-12-11) + + +### Features + +* Add keepalive feature to tear down streams in their absence ([#2605](https://github.com/googleapis/java-pubsub/issues/2605)) ([99aca4f](https://github.com/googleapis/java-pubsub/commit/99aca4f3fd1792b02da78320bed39e53dc8af23c)) +* Make v1 the default protocolVersion ([#2623](https://github.com/googleapis/java-pubsub/issues/2623)) ([12f014d](https://github.com/googleapis/java-pubsub/commit/12f014d9030b2472e508fa75a71f43e671a64583)) + + +### Bug Fixes + +* **deps:** Update the Java code generator (gapic-generator-java) to 2.64.2 ([b4b7f83](https://github.com/googleapis/java-pubsub/commit/b4b7f839b2be1ce003667018a10d9c460e4b63b1)) + + +### Dependencies + +* Update actions/checkout action to v5 ([#2613](https://github.com/googleapis/java-pubsub/issues/2613)) ([a69ffdd](https://github.com/googleapis/java-pubsub/commit/a69ffdd9ecb5dae557a847ae7ec5c1a06431bef7)) +* Update actions/checkout action to v6 ([#2619](https://github.com/googleapis/java-pubsub/issues/2619)) ([6cd2bb6](https://github.com/googleapis/java-pubsub/commit/6cd2bb6e9c927dd192833efc7c3549dfa9c84f57)) +* Update dependency com.google.cloud:google-cloud-bigquery to v2.56.0 ([#2617](https://github.com/googleapis/java-pubsub/issues/2617)) ([13d5e3d](https://github.com/googleapis/java-pubsub/commit/13d5e3d8e4069a0e94db3cf825eb821d06cc9345)) +* Update dependency com.google.cloud:google-cloud-core to v2.62.1 ([#2608](https://github.com/googleapis/java-pubsub/issues/2608)) ([fee0500](https://github.com/googleapis/java-pubsub/commit/fee0500bf6a0e309ca5f162810e22a2ca4c5b7eb)) +* Update dependency com.google.cloud:google-cloud-core to v2.62.2 ([#2632](https://github.com/googleapis/java-pubsub/issues/2632)) ([2d567d1](https://github.com/googleapis/java-pubsub/commit/2d567d16f7f546586156e2e2ee17c433fbec5fc2)) +* Update dependency com.google.cloud:google-cloud-storage to v2.60.0 ([#2610](https://github.com/googleapis/java-pubsub/issues/2610)) ([1cae247](https://github.com/googleapis/java-pubsub/commit/1cae247322fff1b6588a4b523e601e41a4284c64)) +* Update dependency com.google.cloud:sdk-platform-java-config to v3.54.2 ([#2633](https://github.com/googleapis/java-pubsub/issues/2633)) ([5081aac](https://github.com/googleapis/java-pubsub/commit/5081aac1fc26fcaca004c730982d0e56ed36e32f)) +* Update dependency com.google.protobuf:protobuf-java-util to v4.33.1 ([#2612](https://github.com/googleapis/java-pubsub/issues/2612)) ([e92debc](https://github.com/googleapis/java-pubsub/commit/e92debccf9e87971c2d9fee34baffb4b534f24a3)) +* Update dependency com.google.protobuf:protobuf-java-util to v4.33.2 ([#2625](https://github.com/googleapis/java-pubsub/issues/2625)) ([900783f](https://github.com/googleapis/java-pubsub/commit/900783ff8b135b42088c37b48cdc1a7ee44d4e08)) + + +### Documentation + +* Add the IDENTIFIER field behavior annotation to fields of Cloud Pub/Sub methods that represent a specific identity and need to be sourced with additional care ([b4b7f83](https://github.com/googleapis/java-pubsub/commit/b4b7f839b2be1ce003667018a10d9c460e4b63b1)) + +## [1.143.1](https://github.com/googleapis/java-pubsub/compare/v1.143.0...v1.143.1) (2025-11-13) + + +### Bug Fixes + +* Deflake WaiterTest ([#2600](https://github.com/googleapis/java-pubsub/issues/2600)) ([298c8db](https://github.com/googleapis/java-pubsub/commit/298c8db04616341da040935636b1a04ce5f022a0)) +* **deps:** Update the Java code generator (gapic-generator-java) to 2.64.1 ([b210251](https://github.com/googleapis/java-pubsub/commit/b2102516bf833c2704c85cb348b67bb7cbfdb3a6)) + + +### Dependencies + +* Remove OpenTelemetry semconv dependency ([#2611](https://github.com/googleapis/java-pubsub/issues/2611)) ([240fc37](https://github.com/googleapis/java-pubsub/commit/240fc3784db3860eb2668946fbf861beed2647d7)) +* Update actions/checkout action to v5 ([#2592](https://github.com/googleapis/java-pubsub/issues/2592)) ([6ca466d](https://github.com/googleapis/java-pubsub/commit/6ca466d382ddde9780ae1c8627092d731e314f90)) +* Update dependency com.google.cloud:google-cloud-bigquery to v2.55.3 ([#2602](https://github.com/googleapis/java-pubsub/issues/2602)) ([d14106c](https://github.com/googleapis/java-pubsub/commit/d14106cc278c98d3f954f959e2dd3764ebd20fc2)) +* Update dependency com.google.cloud:google-cloud-core to v2.61.0 ([#2588](https://github.com/googleapis/java-pubsub/issues/2588)) ([244cf75](https://github.com/googleapis/java-pubsub/commit/244cf758bf46f8431a17b1d8e76d1d90c494fc76)) +* Update dependency com.google.cloud:google-cloud-storage to v2.59.0 ([#2603](https://github.com/googleapis/java-pubsub/issues/2603)) ([d9d05bf](https://github.com/googleapis/java-pubsub/commit/d9d05bfa18580cdacdfa9378d30b56ce0ae0d4d2)) +* Update dependency com.google.cloud:sdk-platform-java-config to v3.54.1 ([#2609](https://github.com/googleapis/java-pubsub/issues/2609)) ([c99373f](https://github.com/googleapis/java-pubsub/commit/c99373f2d25c6b9f1bcb6aace3c6625375310a16)) +* Update dependency com.google.protobuf:protobuf-java-util to v4.33.0 ([#2587](https://github.com/googleapis/java-pubsub/issues/2587)) ([33724ce](https://github.com/googleapis/java-pubsub/commit/33724cef79e3f7e798c5ef222ee7dff3565555f8)) + +## [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) + + +### Features + +* Support the protocol version in StreamingPullRequest ([af40810](https://github.com/googleapis/java-pubsub/commit/af40810ea0668ce4e8c4d69bdbb4b281073976d0)) + + +### Bug Fixes + +* **deps:** Update the Java code generator (gapic-generator-java) to 2.62.3 ([af40810](https://github.com/googleapis/java-pubsub/commit/af40810ea0668ce4e8c4d69bdbb4b281073976d0)) + + +### Dependencies + +* Update actions/checkout action to v5 ([#2562](https://github.com/googleapis/java-pubsub/issues/2562)) ([b7fa499](https://github.com/googleapis/java-pubsub/commit/b7fa49968e85dfeba8a84ea29f8ddf9d33ef22c5)) +* Update actions/checkout action to v5 ([#2573](https://github.com/googleapis/java-pubsub/issues/2573)) ([4153dba](https://github.com/googleapis/java-pubsub/commit/4153dbacb386b130780c8d1e5596e3502af8e32b)) +* Update dependency com.google.cloud:google-cloud-bigquery to v2.55.1 ([#2566](https://github.com/googleapis/java-pubsub/issues/2566)) ([66c9ec4](https://github.com/googleapis/java-pubsub/commit/66c9ec4a26b76ca384dce71a8ab6bce8cd34b8a3)) +* Update dependency com.google.cloud:google-cloud-core to v2.60.2 ([#2557](https://github.com/googleapis/java-pubsub/issues/2557)) ([460bcd9](https://github.com/googleapis/java-pubsub/commit/460bcd9158e7058f710f43200b7b7737eb47839c)) +* Update dependency com.google.cloud:google-cloud-core to v2.60.3 ([#2571](https://github.com/googleapis/java-pubsub/issues/2571)) ([ac2c85a](https://github.com/googleapis/java-pubsub/commit/ac2c85ad62525aee236af54f6b5c9b1eacf4d22a)) +* Update dependency com.google.cloud:google-cloud-storage to v2.58.0 ([#2561](https://github.com/googleapis/java-pubsub/issues/2561)) ([0189388](https://github.com/googleapis/java-pubsub/commit/0189388edb4d618d65f33718922ca1b11f71cb15)) +* Update dependency com.google.cloud:sdk-platform-java-config to v3.52.3 ([#2572](https://github.com/googleapis/java-pubsub/issues/2572)) ([0785ee4](https://github.com/googleapis/java-pubsub/commit/0785ee490e858c104c420046e0098d81154ae273)) +* Update dependency org.assertj:assertj-core to v3.27.6 ([#2560](https://github.com/googleapis/java-pubsub/issues/2560)) ([c82766a](https://github.com/googleapis/java-pubsub/commit/c82766a9efb2bb4df01fb7fdcb35259db39e05c7)) + +## [1.141.5](https://github.com/googleapis/java-pubsub/compare/v1.141.4...v1.141.5) (2025-09-24) + + +### Bug Fixes + +* **deps:** Update the Java code generator (gapic-generator-java) to 2.62.2 ([c02d304](https://github.com/googleapis/java-pubsub/commit/c02d304f5213410eda5f26fe98c96a5c1d4bf9d8)) + + +### Dependencies + +* Update actions/checkout action to v5 ([#2539](https://github.com/googleapis/java-pubsub/issues/2539)) ([83144e6](https://github.com/googleapis/java-pubsub/commit/83144e6d4110fbe15f4357270a292cfcbcc35dd6)) +* Update actions/github-script action to v8 ([#2542](https://github.com/googleapis/java-pubsub/issues/2542)) ([0e6f0da](https://github.com/googleapis/java-pubsub/commit/0e6f0daccfdca248b3b80ef7dfb0bd7a4baa607c)) +* Update dependency com.google.cloud:google-cloud-bigquery to v2.55.0 ([#2553](https://github.com/googleapis/java-pubsub/issues/2553)) ([15b9e66](https://github.com/googleapis/java-pubsub/commit/15b9e66f27cd6e57b808b96f3e15f08b1f0d7727)) +* Update dependency com.google.cloud:google-cloud-core to v2.60.1 ([#2543](https://github.com/googleapis/java-pubsub/issues/2543)) ([fbb45ce](https://github.com/googleapis/java-pubsub/commit/fbb45cee9e3740f8ac94b5fbaa65b97b8db09b1e)) +* Update dependency com.google.cloud:google-cloud-storage to v2.57.0 ([#2547](https://github.com/googleapis/java-pubsub/issues/2547)) ([133f8c7](https://github.com/googleapis/java-pubsub/commit/133f8c7995880c2d1e75b69d61c50254d4f9fede)) +* Update dependency com.google.cloud:sdk-platform-java-config to v3.52.2 ([#2558](https://github.com/googleapis/java-pubsub/issues/2558)) ([0623ac5](https://github.com/googleapis/java-pubsub/commit/0623ac54f735b076ccee165fc59a4a088309766a)) +* Update dependency com.google.protobuf:protobuf-java-util to v4.32.1 ([#2551](https://github.com/googleapis/java-pubsub/issues/2551)) ([49722cb](https://github.com/googleapis/java-pubsub/commit/49722cb65e3b7cad01cf4389e1cf716a6ac1eb03)) +* Update googleapis/sdk-platform-java action to v2.62.2 ([#2559](https://github.com/googleapis/java-pubsub/issues/2559)) ([3f1d901](https://github.com/googleapis/java-pubsub/commit/3f1d90186899efe035179363408979a372e85a56)) + +## [1.141.4](https://github.com/googleapis/java-pubsub/compare/v1.141.3...v1.141.4) (2025-09-11) + + +### Bug Fixes + +* **deps:** Update the Java code generator (gapic-generator-java) to 2.62.1 ([ac08d5f](https://github.com/googleapis/java-pubsub/commit/ac08d5f6ead8071ab0e068e32fd5ae0ae2731c34)) + + +### Dependencies + +* Update actions/checkout action to v5 ([#2531](https://github.com/googleapis/java-pubsub/issues/2531)) ([f687f11](https://github.com/googleapis/java-pubsub/commit/f687f117fc435ee8b1f15b8802ecc989f1e2747e)) +* Update actions/setup-java action to v5 ([#2535](https://github.com/googleapis/java-pubsub/issues/2535)) ([2ed87d2](https://github.com/googleapis/java-pubsub/commit/2ed87d2b7e28af99cfda00b4b69fb5cb2f448584)) +* Update dependency com.google.cloud:google-cloud-bigquery to v2.54.2 ([#2538](https://github.com/googleapis/java-pubsub/issues/2538)) ([10a8283](https://github.com/googleapis/java-pubsub/commit/10a8283292e58b0c73b9c57ff36ddd71b8b83467)) +* Update dependency com.google.cloud:google-cloud-storage to v2.56.0 ([#2536](https://github.com/googleapis/java-pubsub/issues/2536)) ([80d9ca1](https://github.com/googleapis/java-pubsub/commit/80d9ca10d3a2656852422858f032bb6629102cfb)) +* Update dependency com.google.cloud:sdk-platform-java-config to v3.52.1 ([#2544](https://github.com/googleapis/java-pubsub/issues/2544)) ([9fe7550](https://github.com/googleapis/java-pubsub/commit/9fe75506eedf42f31b95ddf2699cf332334caf0d)) +* Update googleapis/sdk-platform-java action to v2.62.1 ([#2545](https://github.com/googleapis/java-pubsub/issues/2545)) ([17f28ef](https://github.com/googleapis/java-pubsub/commit/17f28ef853a21303346a305e4d8e9b63a916edc7)) + +## [1.141.3](https://github.com/googleapis/java-pubsub/compare/v1.141.2...v1.141.3) (2025-08-19) + + +### Bug Fixes + +* Use the system executor instead of a separate thread pool for EOD ack/modack callbacks ([#2526](https://github.com/googleapis/java-pubsub/issues/2526)) ([ffeb017](https://github.com/googleapis/java-pubsub/commit/ffeb017a58ca486688105738f180d70df33a74de)) + + +### Dependencies + +* Update actions/checkout action to v5 ([#2520](https://github.com/googleapis/java-pubsub/issues/2520)) ([409398a](https://github.com/googleapis/java-pubsub/commit/409398a40f71866d5a84b4542d582777ee240a08)) +* Update dependency com.google.cloud:google-cloud-bigquery to v2.54.1 ([#2523](https://github.com/googleapis/java-pubsub/issues/2523)) ([0678a74](https://github.com/googleapis/java-pubsub/commit/0678a74dc22f73cd8ec8c4893c1a8dd60449b128)) +* Update dependency com.google.cloud:google-cloud-core to v2.60.0 ([#2527](https://github.com/googleapis/java-pubsub/issues/2527)) ([0166e21](https://github.com/googleapis/java-pubsub/commit/0166e21012f0bc2ccb2e832d6f27e60ad3382456)) +* Update dependency com.google.cloud:google-cloud-storage to v2.55.0 ([#2517](https://github.com/googleapis/java-pubsub/issues/2517)) ([b67acf1](https://github.com/googleapis/java-pubsub/commit/b67acf1294249be308568f49f287897ae55ced08)) +* Update dependency com.google.cloud:sdk-platform-java-config to v3.52.0 ([#2528](https://github.com/googleapis/java-pubsub/issues/2528)) ([e424d11](https://github.com/googleapis/java-pubsub/commit/e424d11ffe0fbe242c59dec44ac1af2f9bd80173)) +* Update dependency com.google.protobuf:protobuf-java-util to v4.32.0 ([#2524](https://github.com/googleapis/java-pubsub/issues/2524)) ([44ff087](https://github.com/googleapis/java-pubsub/commit/44ff0873171f8fe2e7cd79b4550f8ec94ea2c99a)) +* Update dependency org.assertj:assertj-core to v3.27.4 ([#2518](https://github.com/googleapis/java-pubsub/issues/2518)) ([67695bc](https://github.com/googleapis/java-pubsub/commit/67695bc50eafc475866eb6c300b3359083ecfe00)) + +## [1.141.2](https://github.com/googleapis/java-pubsub/compare/v1.141.1...v1.141.2) (2025-08-05) + + +### Bug Fixes + +* **deps:** Update the Java code generator (gapic-generator-java) to 2.61.0 ([42eb599](https://github.com/googleapis/java-pubsub/commit/42eb5992557457a5ae4512334267113266c220ac)) +* Use a separate cached thread pool for handling ack and modack response callback for EOD-enabled subscriptions ([#2505](https://github.com/googleapis/java-pubsub/issues/2505)) ([224c269](https://github.com/googleapis/java-pubsub/commit/224c269e3bd0ae4cfc4b24ac85495911b8e2b90c)) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-bigquery to v2.54.0 ([#2506](https://github.com/googleapis/java-pubsub/issues/2506)) ([6bf8e62](https://github.com/googleapis/java-pubsub/commit/6bf8e62b1144568292e832dc8031a70a2c5b9ad7)) +* Update dependency com.google.cloud:google-cloud-core to v2.59.0 ([#2507](https://github.com/googleapis/java-pubsub/issues/2507)) ([070cf07](https://github.com/googleapis/java-pubsub/commit/070cf07b1d529c34d4f633b37ce1d35d14768325)) +* Update dependency com.google.cloud:google-cloud-storage to v2.54.0 ([#2510](https://github.com/googleapis/java-pubsub/issues/2510)) ([0fd589e](https://github.com/googleapis/java-pubsub/commit/0fd589e2ee80730b442f569b770fe16208feb4ba)) +* Update dependency com.google.cloud:sdk-platform-java-config to v3.51.0 ([#2508](https://github.com/googleapis/java-pubsub/issues/2508)) ([a7be2a7](https://github.com/googleapis/java-pubsub/commit/a7be2a74327499b1acb2fe159e6f7465d6c8f798)) +* Update googleapis/sdk-platform-java action to v2.61.0 ([#2509](https://github.com/googleapis/java-pubsub/issues/2509)) ([32df6b6](https://github.com/googleapis/java-pubsub/commit/32df6b694f9aee2cf7132c2d817f9736d69060f3)) + +## [1.141.1](https://github.com/googleapis/java-pubsub/compare/v1.141.0...v1.141.1) (2025-07-28) + + +### Bug Fixes + +* **deps:** Update the Java code generator (gapic-generator-java) to 2.60.2 ([7afae21](https://github.com/googleapis/java-pubsub/commit/7afae21e5e3df16742646363ca199ec14c42bc21)) +* Remove element_count_limit and request_byte_limit from pubsub_gapic.yaml ([7afae21](https://github.com/googleapis/java-pubsub/commit/7afae21e5e3df16742646363ca199ec14c42bc21)) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-bigquery to v2.53.0 ([#2489](https://github.com/googleapis/java-pubsub/issues/2489)) ([5a454b9](https://github.com/googleapis/java-pubsub/commit/5a454b9c36419dcfaf79edb1ec1d066b20836f87)) +* Update dependency com.google.cloud:google-cloud-core to v2.58.2 ([#2493](https://github.com/googleapis/java-pubsub/issues/2493)) ([9a1c17e](https://github.com/googleapis/java-pubsub/commit/9a1c17e50e5fc9a807532d289a7f6e8b5d412f59)) +* Update dependency com.google.cloud:google-cloud-storage to v2.53.3 ([#2486](https://github.com/googleapis/java-pubsub/issues/2486)) ([9416cc9](https://github.com/googleapis/java-pubsub/commit/9416cc99f826b80412b0e5eba0068a35b82390c6)) +* Update dependency com.google.cloud:sdk-platform-java-config to v3.50.2 ([#2494](https://github.com/googleapis/java-pubsub/issues/2494)) ([9f73ef0](https://github.com/googleapis/java-pubsub/commit/9f73ef0dcaabb4a536741336eb6cfc6601b75f65)) +* Update dependency org.xerial.snappy:snappy-java to v1.1.10.8 ([#2492](https://github.com/googleapis/java-pubsub/issues/2492)) ([a55e214](https://github.com/googleapis/java-pubsub/commit/a55e214ffad8371eb82a1d49b8b1eadcacf15392)) + +## [1.141.0](https://github.com/googleapis/java-pubsub/compare/v1.140.2...v1.141.0) (2025-07-11) + + +### Features + +* Add MessageTransformationFailureReason to IngestionFailureEvent ([8271399](https://github.com/googleapis/java-pubsub/commit/8271399cc6348f69ba034b676cce2aa7592122a4)) +* Next release from main branch is 1.141.0 ([#2481](https://github.com/googleapis/java-pubsub/issues/2481)) ([bd9f385](https://github.com/googleapis/java-pubsub/commit/bd9f3850efa77ce759b4f281aecd9645666cb0f7)) + + +### Bug Fixes + +* **deps:** Update the Java code generator (gapic-generator-java) to 2.60.1 ([c9ef2cd](https://github.com/googleapis/java-pubsub/commit/c9ef2cda2c6ad20d5e57fe3ccf69f845f7ef36b7)) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-bigquery to v2.52.0 ([#2467](https://github.com/googleapis/java-pubsub/issues/2467)) ([fe08a6f](https://github.com/googleapis/java-pubsub/commit/fe08a6f1f6ee18e97c752f82786016999f6ab12c)) +* Update dependency com.google.cloud:google-cloud-core to v2.58.1 ([#2476](https://github.com/googleapis/java-pubsub/issues/2476)) ([96a2354](https://github.com/googleapis/java-pubsub/commit/96a23544fce609c7b19a00638a767926c304d3f8)) +* Update dependency com.google.cloud:google-cloud-storage to v2.53.2 ([#2469](https://github.com/googleapis/java-pubsub/issues/2469)) ([fa51a01](https://github.com/googleapis/java-pubsub/commit/fa51a01ed39393b7cad25fb39a1c87099def830a)) +* Update dependency com.google.cloud:sdk-platform-java-config to v3.50.1 ([#2477](https://github.com/googleapis/java-pubsub/issues/2477)) ([e1657cb](https://github.com/googleapis/java-pubsub/commit/e1657cbeae5f2c3c9680ef6b5ff2b1ea5549f4ba)) +* Update googleapis/sdk-platform-java action to v2.60.0 ([#2471](https://github.com/googleapis/java-pubsub/issues/2471)) ([2b0e8e0](https://github.com/googleapis/java-pubsub/commit/2b0e8e0b58432f0975c15d0d01f185dc81de6caf)) +* Update googleapis/sdk-platform-java action to v2.60.1 ([#2475](https://github.com/googleapis/java-pubsub/issues/2475)) ([e7c0b5d](https://github.com/googleapis/java-pubsub/commit/e7c0b5d44f0ad53adfac6ec26572baad54d04dee)) + +## [1.140.2](https://github.com/googleapis/java-pubsub/compare/v1.140.1...v1.140.2) (2025-06-25) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-bigquery to v2.51.0 ([#2457](https://github.com/googleapis/java-pubsub/issues/2457)) ([d74215a](https://github.com/googleapis/java-pubsub/commit/d74215a6f1e641ba75997e2e43bef348fb9c4a3c)) +* Update dependency com.google.cloud:google-cloud-core to v2.58.0 ([#2443](https://github.com/googleapis/java-pubsub/issues/2443)) ([d4599d9](https://github.com/googleapis/java-pubsub/commit/d4599d93b780b6ef20ad44582aeb8c1cd35f99d4)) +* Update dependency com.google.cloud:google-cloud-storage to v2.53.1 ([#2452](https://github.com/googleapis/java-pubsub/issues/2452)) ([b4af237](https://github.com/googleapis/java-pubsub/commit/b4af2370bb875ee8d0047f67a72e8c6d62547a12)) +* Update dependency com.google.cloud:sdk-platform-java-config to v3.50.0 ([#2461](https://github.com/googleapis/java-pubsub/issues/2461)) ([715916a](https://github.com/googleapis/java-pubsub/commit/715916aeedbe696b9c4b922e4fb2bbf76f8b201a)) +* Update dependency com.google.cloud.opentelemetry:exporter-trace to v0.36.0 ([#2440](https://github.com/googleapis/java-pubsub/issues/2440)) ([50a3eb9](https://github.com/googleapis/java-pubsub/commit/50a3eb9276b4711b8161a021d055238abc0e20de)) +* Update dependency com.google.protobuf:protobuf-java-util to v4.31.1 ([#2442](https://github.com/googleapis/java-pubsub/issues/2442)) ([a0be1bb](https://github.com/googleapis/java-pubsub/commit/a0be1bbe601575f05fb00f6d616b51de8f23238d)) +* Update dependency org.easymock:easymock to v5.6.0 ([#2069](https://github.com/googleapis/java-pubsub/issues/2069)) ([5f144a4](https://github.com/googleapis/java-pubsub/commit/5f144a461c6749ec7e2cf900399f386094451244)) +* Update googleapis/sdk-platform-java action to v2.60.0 ([#2462](https://github.com/googleapis/java-pubsub/issues/2462)) ([ee8e5c7](https://github.com/googleapis/java-pubsub/commit/ee8e5c7166f2ac4eb706241e42f4ce84afcc2668)) +* Update googleapis/sdk-platform-java action to v2.60.0 ([#2464](https://github.com/googleapis/java-pubsub/issues/2464)) ([7a0af37](https://github.com/googleapis/java-pubsub/commit/7a0af37c01e747d8f40145b7b4438eaadab9e01a)) + +## [1.140.1](https://github.com/googleapis/java-pubsub/compare/v1.140.0...v1.140.1) (2025-06-05) + + +### Bug Fixes + +* **deps:** Update the Java code generator (gapic-generator-java) to 2.59.0 ([0eece50](https://github.com/googleapis/java-pubsub/commit/0eece5012fbaf887a5c062beba433dbb30edbf43)) + + +### Dependencies + +* Update dependency com.google.cloud:sdk-platform-java-config to v3.49.0 ([#2448](https://github.com/googleapis/java-pubsub/issues/2448)) ([d89a14d](https://github.com/googleapis/java-pubsub/commit/d89a14d6569fc914d877cc24d66c42684a812eba)) + +## [1.140.0](https://github.com/googleapis/java-pubsub/compare/v1.139.4...v1.140.0) (2025-06-03) + + +### Features + +* Add SchemaViolationReason to IngestionFailureEvent ([21cc376](https://github.com/googleapis/java-pubsub/commit/21cc3764aaa6fc05eb4a5078a72dae30694fba91)) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-bigquery to v2.50.1 ([#2435](https://github.com/googleapis/java-pubsub/issues/2435)) ([b37c557](https://github.com/googleapis/java-pubsub/commit/b37c5573e1d0d7eada4ce4ec6a052521ea11cff1)) +* Update dependency com.google.cloud:google-cloud-storage to v2.52.3 ([#2436](https://github.com/googleapis/java-pubsub/issues/2436)) ([4f309d1](https://github.com/googleapis/java-pubsub/commit/4f309d151d4bd584a33a0bb8882d0614a1b9d533)) +* Update dependency com.google.cloud:sdk-platform-java-config to v3.49.0 ([#2444](https://github.com/googleapis/java-pubsub/issues/2444)) ([a59135c](https://github.com/googleapis/java-pubsub/commit/a59135c6859d0aa5c247a6a1f60872c959123cc7)) +* Update dependency com.google.cloud:sdk-platform-java-config to v3.49.0 ([#2446](https://github.com/googleapis/java-pubsub/issues/2446)) ([6434be1](https://github.com/googleapis/java-pubsub/commit/6434be16560fdc8797b7c930b06df38c0972c96c)) +* Update dependency com.google.protobuf:protobuf-java-util to v4.31.0 ([#2430](https://github.com/googleapis/java-pubsub/issues/2430)) ([232fac1](https://github.com/googleapis/java-pubsub/commit/232fac1c47e0d3680dcc8d56b69d65ed0d379dde)) +* Update googleapis/sdk-platform-java action to v2.59.0 ([#2445](https://github.com/googleapis/java-pubsub/issues/2445)) ([12d4cfb](https://github.com/googleapis/java-pubsub/commit/12d4cfb7d67dbb163b3a545ea2ebae450e88283d)) + + +### Documentation + +* **sample:** Update the subscribe with error listener and subscribe with exactly-once samples ([#2437](https://github.com/googleapis/java-pubsub/issues/2437)) ([17c142b](https://github.com/googleapis/java-pubsub/commit/17c142b20efb79f9c71fc6306cb3ee4e15c5e06f)) + +## [1.139.4](https://github.com/googleapis/java-pubsub/compare/v1.139.3...v1.139.4) (2025-05-15) + + +### Bug Fixes + +* **deps:** Update the Java code generator (gapic-generator-java) to 2.57.0 ([017eb0f](https://github.com/googleapis/java-pubsub/commit/017eb0f78423fde3edd42a07677df49512085633)) +* **deps:** Update the Java code generator (gapic-generator-java) to 2.58.0 ([3713edb](https://github.com/googleapis/java-pubsub/commit/3713edb9420f792b7c7ad4e430ca05b5942656ff)) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-bigquery to v2.50.0 ([#2422](https://github.com/googleapis/java-pubsub/issues/2422)) ([993b2d0](https://github.com/googleapis/java-pubsub/commit/993b2d06ce6b45bb72faa9d6959cddc14a9cf60e)) +* Update dependency com.google.cloud:google-cloud-core to v2.55.0 ([#2413](https://github.com/googleapis/java-pubsub/issues/2413)) ([3e181e7](https://github.com/googleapis/java-pubsub/commit/3e181e7c4469eadcf6f148ee0a30aae1cfa825f3)) +* Update dependency com.google.cloud:google-cloud-core to v2.56.0 ([#2427](https://github.com/googleapis/java-pubsub/issues/2427)) ([b2a3e35](https://github.com/googleapis/java-pubsub/commit/b2a3e35ced2d1715c37207f98740889635326dc1)) +* Update dependency com.google.cloud:google-cloud-storage to v2.52.2 ([#2421](https://github.com/googleapis/java-pubsub/issues/2421)) ([1224ee5](https://github.com/googleapis/java-pubsub/commit/1224ee51da27e447560076b0d51ba90515566bd9)) +* Update dependency com.google.cloud:sdk-platform-java-config to v3.47.0 ([#2418](https://github.com/googleapis/java-pubsub/issues/2418)) ([5f87661](https://github.com/googleapis/java-pubsub/commit/5f876612eb4a54faec3af2c9043aec0adf51e2ec)) +* Update dependency com.google.cloud:sdk-platform-java-config to v3.48.0 ([#2428](https://github.com/googleapis/java-pubsub/issues/2428)) ([cfa91fa](https://github.com/googleapis/java-pubsub/commit/cfa91fa0e85f3f1e517627da3e5befcd46f0803a)) +* Update dependency com.google.cloud.opentelemetry:exporter-trace to v0.34.0 ([#2376](https://github.com/googleapis/java-pubsub/issues/2376)) ([06768cd](https://github.com/googleapis/java-pubsub/commit/06768cd1ac86ae7ae7b91b020cc174b4423e1b9a)) + + +### Documentation + +* **sample:** Add samples for topic and subscription SMTs ([#2388](https://github.com/googleapis/java-pubsub/issues/2388)) ([f35de28](https://github.com/googleapis/java-pubsub/commit/f35de28396fda595e6ea68c1755a4253d6b097d6)) + +## [1.139.3](https://github.com/googleapis/java-pubsub/compare/v1.139.2...v1.139.3) (2025-05-06) + + +### Dependencies + +* Update dependency com.google.cloud:sdk-platform-java-config to v3.47.0 ([#2414](https://github.com/googleapis/java-pubsub/issues/2414)) ([d78823f](https://github.com/googleapis/java-pubsub/commit/d78823ffc93307c14f44e992cf13e926880fbe94)) +* Update googleapis/sdk-platform-java action to v2.57.0 ([#2415](https://github.com/googleapis/java-pubsub/issues/2415)) ([1ddf9b8](https://github.com/googleapis/java-pubsub/commit/1ddf9b81e432aeb9af9e6b8bb2d2e9786159faba)) + +## [1.139.2](https://github.com/googleapis/java-pubsub/compare/v1.139.1...v1.139.2) (2025-05-05) + + +### Bug Fixes + +* **deps:** Update the Java code generator (gapic-generator-java) to 2.56.3 ([2b928a8](https://github.com/googleapis/java-pubsub/commit/2b928a8a946ebf84470bd2e2bb064b52c4f11ea2)) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-bigquery to v2.49.2 ([#2399](https://github.com/googleapis/java-pubsub/issues/2399)) ([ff48708](https://github.com/googleapis/java-pubsub/commit/ff4870815864a6216a1ce4b606fcec3df7f58fd4)) +* Update dependency com.google.cloud:google-cloud-core to v2.54.3 ([#2393](https://github.com/googleapis/java-pubsub/issues/2393)) ([0ffa26a](https://github.com/googleapis/java-pubsub/commit/0ffa26ac3abceabcfba5d57cdb36f27f5a164ce3)) +* Update dependency com.google.cloud:google-cloud-storage to v2.52.1 ([#2396](https://github.com/googleapis/java-pubsub/issues/2396)) ([283a6e1](https://github.com/googleapis/java-pubsub/commit/283a6e14f61764c210ed23f4ada23ad21bbdb306)) +* Update dependency com.google.cloud:sdk-platform-java-config to v3.46.3 ([#2406](https://github.com/googleapis/java-pubsub/issues/2406)) ([8963ed0](https://github.com/googleapis/java-pubsub/commit/8963ed0acbe8bf3a110a05ced27979f102cd3035)) + +## [1.139.1](https://github.com/googleapis/java-pubsub/compare/v1.139.0...v1.139.1) (2025-04-25) + + +### Dependencies + +* Update dependency com.google.cloud:sdk-platform-java-config to v3.46.2 ([#2394](https://github.com/googleapis/java-pubsub/issues/2394)) ([17f7fd7](https://github.com/googleapis/java-pubsub/commit/17f7fd77553a7ccd55029edb74829f1fe86a680c)) + +## [1.139.0](https://github.com/googleapis/java-pubsub/compare/v1.138.0...v1.139.0) (2025-04-25) + + +### Features + +* Generate renamed go pubsub admin clients ([4472d7b](https://github.com/googleapis/java-pubsub/commit/4472d7baff4894a7c5cf0efc7eadd83ec8801d7a)) + + +### Bug Fixes + +* Add retries for ack and modack operations that don't return with a metadata map ([#2385](https://github.com/googleapis/java-pubsub/issues/2385)) ([00070b7](https://github.com/googleapis/java-pubsub/commit/00070b74e54fcb62b91a4d72a88d3b20b2425a94)) +* **deps:** Update the Java code generator (gapic-generator-java) to 2.56.2 ([4472d7b](https://github.com/googleapis/java-pubsub/commit/4472d7baff4894a7c5cf0efc7eadd83ec8801d7a)) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-bigquery to v2.49.0 ([#2380](https://github.com/googleapis/java-pubsub/issues/2380)) ([405e485](https://github.com/googleapis/java-pubsub/commit/405e485bbe503357a0616ec72de8fea00cb91c9c)) +* Update dependency com.google.cloud:google-cloud-core to v2.53.1 ([#2365](https://github.com/googleapis/java-pubsub/issues/2365)) ([748058f](https://github.com/googleapis/java-pubsub/commit/748058fc018e3a36dedd576404037bf8c016c794)) +* Update dependency com.google.cloud:google-cloud-storage to v2.50.0 ([#2372](https://github.com/googleapis/java-pubsub/issues/2372)) ([b81164a](https://github.com/googleapis/java-pubsub/commit/b81164aa5682c8046ebfa44e1e47579e4c3fcd28)) +* Update dependency com.google.protobuf:protobuf-java-util to v4.30.1 ([#2364](https://github.com/googleapis/java-pubsub/issues/2364)) ([05eb9c0](https://github.com/googleapis/java-pubsub/commit/05eb9c0ce5179ff9e8656544258adc02a59336e5)) +* Update dependency com.google.protobuf:protobuf-java-util to v4.30.2 ([#2383](https://github.com/googleapis/java-pubsub/issues/2383)) ([4119cc0](https://github.com/googleapis/java-pubsub/commit/4119cc03895873f94ddef10850753fb59384a8fc)) + + +### Documentation + +* Update documentation for JavaScriptUDF to indicate that the `message_id` metadata field is optional instead of required ([f904786](https://github.com/googleapis/java-pubsub/commit/f904786f87e80cdc09bba947cd53e42dffb7132e)) + +## [1.138.0](https://github.com/googleapis/java-pubsub/compare/v1.137.1...v1.138.0) (2025-03-14) + + +### Features + +* Deprecate `enabled` field for message transforms and add `disabled` field ([76b2a3d](https://github.com/googleapis/java-pubsub/commit/76b2a3dc1f001dfeb3f8974a4cc4de843b7383bc)) +* Next release from main branch is 1.138.0 ([#2361](https://github.com/googleapis/java-pubsub/issues/2361)) ([b6ba56c](https://github.com/googleapis/java-pubsub/commit/b6ba56c04619660d2660a660eaacbda7de9f8608)) + + +### Bug Fixes + +* **deps:** Update the Java code generator (gapic-generator-java) to 2.55.1 ([76b2a3d](https://github.com/googleapis/java-pubsub/commit/76b2a3dc1f001dfeb3f8974a4cc4de843b7383bc)) +* Prevent excessive string parsing when publishing and receiving messages to improve performance ([#2317](https://github.com/googleapis/java-pubsub/issues/2317)) ([07b1350](https://github.com/googleapis/java-pubsub/commit/07b135001b4726c9bafafe90c80d369f25f04956)) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-bigquery to v2.48.1 ([#2356](https://github.com/googleapis/java-pubsub/issues/2356)) ([7d3d2e4](https://github.com/googleapis/java-pubsub/commit/7d3d2e4690539ebbe7ab521c2c345b06cba766ea)) +* Update dependency com.google.cloud:google-cloud-storage to v2.49.0 ([#2358](https://github.com/googleapis/java-pubsub/issues/2358)) ([81d3435](https://github.com/googleapis/java-pubsub/commit/81d34352d332ee9c4935e7908b6b9a2383d3a8ba)) +* Update dependency com.google.cloud:sdk-platform-java-config to v3.45.1 ([#2366](https://github.com/googleapis/java-pubsub/issues/2366)) ([15899d1](https://github.com/googleapis/java-pubsub/commit/15899d127131747c51c71c94d66ff581f70278f3)) +* Update googleapis/sdk-platform-java action to v2.55.1 ([#2367](https://github.com/googleapis/java-pubsub/issues/2367)) ([de6f84a](https://github.com/googleapis/java-pubsub/commit/de6f84a43a27e954c0dc635158c43c5db4d07dfa)) + +## [1.137.1](https://github.com/googleapis/java-pubsub/compare/v1.137.0...v1.137.1) (2025-02-26) + + +### Bug Fixes + +* **deps:** Update the Java code generator (gapic-generator-java) to 2.54.0 ([ccf670f](https://github.com/googleapis/java-pubsub/commit/ccf670f9dc755770d40b9d1bf2c870c0452aa39e)) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-bigquery to v2.48.0 ([#2343](https://github.com/googleapis/java-pubsub/issues/2343)) ([3bbd7e1](https://github.com/googleapis/java-pubsub/commit/3bbd7e1e812a7a00cfff36a0c1d8a5212d4e134a)) +* Update dependency com.google.cloud:google-cloud-core to v2.52.0 ([#2348](https://github.com/googleapis/java-pubsub/issues/2348)) ([f0977b4](https://github.com/googleapis/java-pubsub/commit/f0977b40479823ce5b7e90f864261f11115610ca)) +* Update dependency com.google.cloud:sdk-platform-java-config to v3.44.0 ([#2349](https://github.com/googleapis/java-pubsub/issues/2349)) ([90ed10b](https://github.com/googleapis/java-pubsub/commit/90ed10b474f7a59286365d8a6ad676d9a4f4113b)) +* Update googleapis/sdk-platform-java action to v2.54.0 ([#2347](https://github.com/googleapis/java-pubsub/issues/2347)) ([ac8db2d](https://github.com/googleapis/java-pubsub/commit/ac8db2dda6cd5f0bdf689052bb37cb2eaab08c46)) + +## [1.137.0](https://github.com/googleapis/java-pubsub/compare/v1.136.1...v1.137.0) (2025-02-12) + + +### Features + +* Add support for message transforms to Topic and Subscription ([3889a05](https://github.com/googleapis/java-pubsub/commit/3889a05a5c5d7479d3cc6b6dc0b0c425d41efd5d)) + + +### Bug Fixes + +* **deps:** Update the Java code generator (gapic-generator-java) to 2.53.0 ([b952e58](https://github.com/googleapis/java-pubsub/commit/b952e5826748bc680936a79b14d75f5873e6db06)) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-bigquery to v2.47.0 ([#2331](https://github.com/googleapis/java-pubsub/issues/2331)) ([216feef](https://github.com/googleapis/java-pubsub/commit/216feef976595cd03e282f8d8effa2ac8430c419)) +* Update dependency com.google.cloud:google-cloud-core to v2.51.0 ([#2338](https://github.com/googleapis/java-pubsub/issues/2338)) ([ac2403e](https://github.com/googleapis/java-pubsub/commit/ac2403ecd21aad0d44c5b06fce2853f9a433adbd)) +* Update dependency com.google.cloud:google-cloud-storage to v2.48.1 ([#2332](https://github.com/googleapis/java-pubsub/issues/2332)) ([23fd7a8](https://github.com/googleapis/java-pubsub/commit/23fd7a8f4ab2438b72f3a6da5613f5deb0ac307e)) +* Update dependency com.google.cloud:google-cloud-storage to v2.48.2 ([#2341](https://github.com/googleapis/java-pubsub/issues/2341)) ([eeb99a9](https://github.com/googleapis/java-pubsub/commit/eeb99a997fa2e7154dcc228b964ff47867738122)) +* Update dependency com.google.cloud:sdk-platform-java-config to v3.43.0 ([#2336](https://github.com/googleapis/java-pubsub/issues/2336)) ([996f4eb](https://github.com/googleapis/java-pubsub/commit/996f4ebdfa6b5cb38dbe37d4be981ca7d941bc0d)) + + +### Documentation + +* A comment for field `code` in message `.google.pubsub.v1.JavaScriptUDF` is changed ([3889a05](https://github.com/googleapis/java-pubsub/commit/3889a05a5c5d7479d3cc6b6dc0b0c425d41efd5d)) + +## [1.136.1](https://github.com/googleapis/java-pubsub/compare/v1.136.0...v1.136.1) (2025-01-28) + + +### Bug Fixes + +* **deps:** Update the Java code generator (gapic-generator-java) to 2.52.0 ([0d8c8bf](https://github.com/googleapis/java-pubsub/commit/0d8c8bffc85804d5a64ec0d35893ad9e0062807e)) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-bigquery to v2.46.0 ([#2309](https://github.com/googleapis/java-pubsub/issues/2309)) ([97bd44e](https://github.com/googleapis/java-pubsub/commit/97bd44e04c440320e45c2b4336677d8d266a39a2)) +* Update dependency com.google.cloud:google-cloud-core to v2.49.1 ([#2300](https://github.com/googleapis/java-pubsub/issues/2300)) ([cf2822b](https://github.com/googleapis/java-pubsub/commit/cf2822b7363e13e4730753cbb5ca3510c77f5f55)) +* Update dependency com.google.cloud:google-cloud-core to v2.50.0 ([#2321](https://github.com/googleapis/java-pubsub/issues/2321)) ([5c40bcd](https://github.com/googleapis/java-pubsub/commit/5c40bcd4d401d919b990e6a7d3151660ead76eb0)) +* Update dependency com.google.cloud:google-cloud-storage to v2.47.0 ([#2303](https://github.com/googleapis/java-pubsub/issues/2303)) ([707f842](https://github.com/googleapis/java-pubsub/commit/707f84271559dfe96fa11edffb307df145ceea47)) +* Update dependency com.google.cloud:google-cloud-storage to v2.48.0 ([#2322](https://github.com/googleapis/java-pubsub/issues/2322)) ([93b9419](https://github.com/googleapis/java-pubsub/commit/93b9419d210cedeab03f408dab4c74c9fcf18b59)) +* Update dependency com.google.cloud:sdk-platform-java-config to v3.42.0 ([#2324](https://github.com/googleapis/java-pubsub/issues/2324)) ([84e8562](https://github.com/googleapis/java-pubsub/commit/84e856250867b2441cceed2315c312bd661c353c)) +* Update dependency com.google.protobuf:protobuf-java-util to v4.29.3 ([#2302](https://github.com/googleapis/java-pubsub/issues/2302)) ([9e90e2c](https://github.com/googleapis/java-pubsub/commit/9e90e2ca26b2aea48563859358dde84640eb40d0)) +* Update dependency org.assertj:assertj-core to v3.27.3 ([#2313](https://github.com/googleapis/java-pubsub/issues/2313)) ([5e80b57](https://github.com/googleapis/java-pubsub/commit/5e80b57d2ffd58e6a0bb9f5e0e78bb46d6fe2530)) +* Update googleapis/sdk-platform-java action to v2.52.0 ([#2320](https://github.com/googleapis/java-pubsub/issues/2320)) ([01dd3de](https://github.com/googleapis/java-pubsub/commit/01dd3deaef392aa51c60d28c1f3cbb81bff2a5cb)) + + +### Documentation + +* Add samples and tests for ingestion from Kafka sources ([#2315](https://github.com/googleapis/java-pubsub/issues/2315)) ([eea603b](https://github.com/googleapis/java-pubsub/commit/eea603ba3f05be85d58a69cd5c3469e2088a7446)) + +## [1.136.0](https://github.com/googleapis/java-pubsub/compare/v1.135.0...v1.136.0) (2025-01-10) + + +### Features + +* Add Kafka-based sources to IngestionDataSourceSettings proto and IngestionFailureEvent proto ([2947169](https://github.com/googleapis/java-pubsub/commit/2947169c009fa553202bc1e44276cf5a7954cd96)) + + +### Bug Fixes + +* **deps:** Update the Java code generator (gapic-generator-java) to 2.51.1 ([9c166f7](https://github.com/googleapis/java-pubsub/commit/9c166f76db78b0c6b2e0218460d5c0336102717a)) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-bigquery to v2.45.0 ([#2292](https://github.com/googleapis/java-pubsub/issues/2292)) ([79a8982](https://github.com/googleapis/java-pubsub/commit/79a89823c6cbcc9a718f44856040b1525863cab6)) +* Update dependency com.google.cloud:google-cloud-storage to v2.46.0 ([#2291](https://github.com/googleapis/java-pubsub/issues/2291)) ([7b60884](https://github.com/googleapis/java-pubsub/commit/7b60884cc4e17df616155f7530a056c4c5e3af29)) +* Update dependency com.google.cloud:sdk-platform-java-config to v3.41.1 ([#2301](https://github.com/googleapis/java-pubsub/issues/2301)) ([53c1a8a](https://github.com/googleapis/java-pubsub/commit/53c1a8abdd3114e0f432b3b6618133fb93e44636)) +* Update dependency com.google.protobuf:protobuf-java-util to v4.29.2 ([#2294](https://github.com/googleapis/java-pubsub/issues/2294)) ([48d4ac1](https://github.com/googleapis/java-pubsub/commit/48d4ac1ab2f0b9f9005292977c288f55322dd16a)) +* Update dependency org.assertj:assertj-core to v3.27.2 ([#2296](https://github.com/googleapis/java-pubsub/issues/2296)) ([e5b68a5](https://github.com/googleapis/java-pubsub/commit/e5b68a563aa6ebb2bd69665624fc7fc6aef50b64)) +* Update googleapis/sdk-platform-java action to v2.51.1 ([#2298](https://github.com/googleapis/java-pubsub/issues/2298)) ([16e0144](https://github.com/googleapis/java-pubsub/commit/16e0144d83c149b60e7b8fca6c4e61546d93462f)) + +## [1.135.0](https://github.com/googleapis/java-pubsub/compare/v1.134.2...v1.135.0) (2024-12-12) + + +### Features + +* Introduce `java.time` variables and methods ([#2271](https://github.com/googleapis/java-pubsub/issues/2271)) ([7edfd9c](https://github.com/googleapis/java-pubsub/commit/7edfd9c315405c7703509fb9b7bc4f0d2686d870)) + + +### Bug Fixes + +* **deps:** Update the Java code generator (gapic-generator-java) to 2.51.0 ([0b0d52c](https://github.com/googleapis/java-pubsub/commit/0b0d52c8fca179a913a8b04d76b44748f1886f45)) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-bigquery to v2.44.0 ([#2270](https://github.com/googleapis/java-pubsub/issues/2270)) ([a5f70a9](https://github.com/googleapis/java-pubsub/commit/a5f70a9c2397a2c8f4642729922b742a3df01ed6)) +* Update dependency com.google.cloud:google-cloud-core to v2.48.0 ([#2263](https://github.com/googleapis/java-pubsub/issues/2263)) ([d7e5588](https://github.com/googleapis/java-pubsub/commit/d7e55886b62826f54f0bb12a6bfa4ef67dee6521)) +* Update dependency com.google.cloud:google-cloud-core to v2.49.0 ([#2285](https://github.com/googleapis/java-pubsub/issues/2285)) ([cd94a19](https://github.com/googleapis/java-pubsub/commit/cd94a1987271eea4d7744286a7daeb071bb9456a)) +* Update dependency com.google.cloud:google-cloud-storage to v2.45.0 ([#2268](https://github.com/googleapis/java-pubsub/issues/2268)) ([80a09e6](https://github.com/googleapis/java-pubsub/commit/80a09e69111229080c413eff8426bd0b3d50458d)) +* Update dependency com.google.cloud:sdk-platform-java-config to v3.41.0 ([#2286](https://github.com/googleapis/java-pubsub/issues/2286)) ([0c0a1b9](https://github.com/googleapis/java-pubsub/commit/0c0a1b9231953e5c9878e0dfcf5a55d01794f6c4)) +* Update dependency com.google.protobuf:protobuf-java-util to v4.29.0 ([#2276](https://github.com/googleapis/java-pubsub/issues/2276)) ([54ef88d](https://github.com/googleapis/java-pubsub/commit/54ef88d7f822d8130717e3be9bcf7fe9901d6cb0)) +* Update dependency com.google.protobuf:protobuf-java-util to v4.29.1 ([#2279](https://github.com/googleapis/java-pubsub/issues/2279)) ([de3c9e1](https://github.com/googleapis/java-pubsub/commit/de3c9e1c7f2fe6413d0ae7a18955f16611df95c6)) +* Update googleapis/sdk-platform-java action to v2.51.0 ([#2284](https://github.com/googleapis/java-pubsub/issues/2284)) ([0be820e](https://github.com/googleapis/java-pubsub/commit/0be820e2044253bf484d88d703ce2dfade7aa137)) + + +### Documentation + +* Fix repository URL in samples README ([#2280](https://github.com/googleapis/java-pubsub/issues/2280)) ([8aeff1a](https://github.com/googleapis/java-pubsub/commit/8aeff1a375f3aa989d2c4bde0ed3dd2f329601fc)) + +## [1.134.2](https://github.com/googleapis/java-pubsub/compare/v1.134.1...v1.134.2) (2024-11-18) + + +### Bug Fixes + +* **deps:** Update the Java code generator (gapic-generator-java) to 2.49.0 ([77546e0](https://github.com/googleapis/java-pubsub/commit/77546e0548e72e331523fb4f30edd1577b5fe6ea)) +* **deps:** Update the Java code generator (gapic-generator-java) to 2.50.0 ([3f21af3](https://github.com/googleapis/java-pubsub/commit/3f21af3e3fbc6ef49ecbe80712350d8712133c59)) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-bigquery to v2.43.3 ([#2256](https://github.com/googleapis/java-pubsub/issues/2256)) ([f7fbc6c](https://github.com/googleapis/java-pubsub/commit/f7fbc6c7e4f7d8a8b31d4778d2cd8c55efcb9be1)) +* Update dependency com.google.cloud:google-cloud-core to v2.47.0 ([#2249](https://github.com/googleapis/java-pubsub/issues/2249)) ([3df5729](https://github.com/googleapis/java-pubsub/commit/3df572918523738e8f2f28299efa811aa23e297b)) +* Update dependency com.google.cloud:google-cloud-storage to v2.44.1 ([#2240](https://github.com/googleapis/java-pubsub/issues/2240)) ([f8dae4d](https://github.com/googleapis/java-pubsub/commit/f8dae4d68c1835930d4e39522a354cdfcc4cdd84)) +* Update googleapis/sdk-platform-java action to v2.50.0 ([#2261](https://github.com/googleapis/java-pubsub/issues/2261)) ([d0aab7d](https://github.com/googleapis/java-pubsub/commit/d0aab7d157c628ff5b8787b8c75dfaedc7a7305f)) +* Update sdk platform java dependencies ([#2262](https://github.com/googleapis/java-pubsub/issues/2262)) ([b689fe2](https://github.com/googleapis/java-pubsub/commit/b689fe262b3a4c90264669ec87408bfeb6dc7659)) + +## [1.134.1](https://github.com/googleapis/java-pubsub/compare/v1.134.0...v1.134.1) (2024-10-26) + + +### Dependencies + +* Update dependency com.google.cloud:sdk-platform-java-config to v3.39.0 ([#2251](https://github.com/googleapis/java-pubsub/issues/2251)) ([083cc7c](https://github.com/googleapis/java-pubsub/commit/083cc7c930fa2728d2322c1343b0fc025f9e255d)) +* Update googleapis/sdk-platform-java action to v2.49.0 ([#2250](https://github.com/googleapis/java-pubsub/issues/2250)) ([af0f194](https://github.com/googleapis/java-pubsub/commit/af0f194369d4a9f16dd14378aa90280adc194d98)) + +## [1.134.0](https://github.com/googleapis/java-pubsub/compare/v1.133.1...v1.134.0) (2024-10-23) + + +### Features + +* Add IngestionFailureEvent to the external proto ([6c67798](https://github.com/googleapis/java-pubsub/commit/6c67798c6b7442d77eb30fbba874344f32a926b4)) +* Track batch size using serialized size of PublishRequest ([#2113](https://github.com/googleapis/java-pubsub/issues/2113)) ([be78e64](https://github.com/googleapis/java-pubsub/commit/be78e64f9fdfc9ddf0790189311fac673754e219)) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-bigquery to v2.43.1 ([#2202](https://github.com/googleapis/java-pubsub/issues/2202)) ([acaf5f2](https://github.com/googleapis/java-pubsub/commit/acaf5f2e3686a939d4b972c73a4d039142f753df)) +* Update dependency com.google.cloud:google-cloud-core to v2.46.0 ([#2238](https://github.com/googleapis/java-pubsub/issues/2238)) ([dc06d54](https://github.com/googleapis/java-pubsub/commit/dc06d5456ab6fe8d94b7b845ca9159391949517f)) +* Update dependency com.google.cloud:google-cloud-storage to v2.43.2 ([#2226](https://github.com/googleapis/java-pubsub/issues/2226)) ([eb87c04](https://github.com/googleapis/java-pubsub/commit/eb87c04619f7bdaf59ce2b562a96b8c25d3c8196)) +* Update dependency com.google.cloud.opentelemetry:exporter-trace to v0.33.0 ([#2225](https://github.com/googleapis/java-pubsub/issues/2225)) ([cc1b072](https://github.com/googleapis/java-pubsub/commit/cc1b0726009524ddee3c2ce7f1446608dd3bc752)) +* Update dependency com.google.protobuf:protobuf-java-util to v4.28.3 ([#2237](https://github.com/googleapis/java-pubsub/issues/2237)) ([75abe83](https://github.com/googleapis/java-pubsub/commit/75abe83a9b14c2e5cc3f136ff97b5340bfa904db)) +* Update dependency org.apache.avro:avro to v1.11.4 [security] ([#2223](https://github.com/googleapis/java-pubsub/issues/2223)) ([31f276b](https://github.com/googleapis/java-pubsub/commit/31f276b10a96c53ecbd828972a9e3457c0c7c700)) +* Update sdk platform java dependencies ([#2239](https://github.com/googleapis/java-pubsub/issues/2239)) ([8f4f855](https://github.com/googleapis/java-pubsub/commit/8f4f8556414aaef731a7226dcbffe59d91819775)) + + +### Documentation + +* Add OpenTelemetry samples ([#2208](https://github.com/googleapis/java-pubsub/issues/2208)) ([c447fe5](https://github.com/googleapis/java-pubsub/commit/c447fe500ba48ba4fde27d97f10ef7664d09363b)) + +## [1.133.1](https://github.com/googleapis/java-pubsub/compare/v1.133.0...v1.133.1) (2024-10-07) + + +### Bug Fixes + +* **deps:** Update the Java code generator (gapic-generator-java) to 2.47.0 ([ccd23af](https://github.com/googleapis/java-pubsub/commit/ccd23afd99e7cb5a28747b06d0a97d1cb8163391)) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-core to v2.45.0 ([#2213](https://github.com/googleapis/java-pubsub/issues/2213)) ([5ee969b](https://github.com/googleapis/java-pubsub/commit/5ee969bb9ed873073895881062ec72f419bbc837)) +* Update dependency com.google.cloud:sdk-platform-java-config to v3.37.0 ([#2214](https://github.com/googleapis/java-pubsub/issues/2214)) ([d938709](https://github.com/googleapis/java-pubsub/commit/d93870934f610cffb705837ed8391eb276a18c05)) +* Update googleapis/sdk-platform-java action to v2.47.0 ([#2212](https://github.com/googleapis/java-pubsub/issues/2212)) ([6a9723d](https://github.com/googleapis/java-pubsub/commit/6a9723d2872c82bbb525119cac7471d1a2f3b7cd)) + + +### Documentation + +* Add ingestion from GCS sample ([#2211](https://github.com/googleapis/java-pubsub/issues/2211)) ([ddb7391](https://github.com/googleapis/java-pubsub/commit/ddb739113b38d4e2f4617a105cd0ab071f21d4de)) +* Update emulator sample to create a topic and publish to it ([#2039](https://github.com/googleapis/java-pubsub/issues/2039)) ([21d5cfc](https://github.com/googleapis/java-pubsub/commit/21d5cfc3b9484ffc2c1a0084b8bc2f6f76b6bf62)) + +## [1.133.0](https://github.com/googleapis/java-pubsub/compare/v1.132.4...v1.133.0) (2024-10-01) + + +### Features + +* Add OpenTelemetry tracing to the Publisher and Subscriber ([#2086](https://github.com/googleapis/java-pubsub/issues/2086)) ([db522b6](https://github.com/googleapis/java-pubsub/commit/db522b60f1bbec9cc1bfa0c37477044fd2f807c7)) + + +### Dependencies + +* Update dependency com.google.cloud.opentelemetry:exporter-trace to v0.32.0 ([#2205](https://github.com/googleapis/java-pubsub/issues/2205)) ([76f17e4](https://github.com/googleapis/java-pubsub/commit/76f17e4149bf369f2be12fe9d316a23a7f49f137)) +* Update dependency org.assertj:assertj-core to v3.26.3 ([#2204](https://github.com/googleapis/java-pubsub/issues/2204)) ([71c2e76](https://github.com/googleapis/java-pubsub/commit/71c2e762e94895c465c4e737ed8bf7bc583a9c14)) + +## [1.132.4](https://github.com/googleapis/java-pubsub/compare/v1.132.3...v1.132.4) (2024-09-30) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-storage to v2.43.1 ([#2194](https://github.com/googleapis/java-pubsub/issues/2194)) ([979e420](https://github.com/googleapis/java-pubsub/commit/979e420377327cf3843ac23151d8b44a7e5188c5)) +* Update dependency ubuntu to v24 ([#2193](https://github.com/googleapis/java-pubsub/issues/2193)) ([f295b01](https://github.com/googleapis/java-pubsub/commit/f295b01cb93fe26612c79c3d2ba0bb68f0404d7e)) + +## [1.132.3](https://github.com/googleapis/java-pubsub/compare/v1.132.2...v1.132.3) (2024-09-26) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-bigquery to v2.42.3 ([#2173](https://github.com/googleapis/java-pubsub/issues/2173)) ([294d039](https://github.com/googleapis/java-pubsub/commit/294d03974ab236c2ee5d0e420e8913eb6fc65fc9)) +* Update dependency com.google.cloud:google-cloud-core to v2.44.0 ([#2184](https://github.com/googleapis/java-pubsub/issues/2184)) ([faecb3b](https://github.com/googleapis/java-pubsub/commit/faecb3b90cb259ae376b8481ec30511ce19279bf)) +* Update dependency com.google.cloud:google-cloud-core to v2.44.1 ([#2190](https://github.com/googleapis/java-pubsub/issues/2190)) ([9ea45dc](https://github.com/googleapis/java-pubsub/commit/9ea45dc13f11076890cfff35e7acf2eafc2af70a)) +* Update dependency com.google.cloud:google-cloud-storage to v2.43.0 ([#2174](https://github.com/googleapis/java-pubsub/issues/2174)) ([ae800d7](https://github.com/googleapis/java-pubsub/commit/ae800d7b3ffd19302b416f03fad8b20e93afce8f)) +* Update dependency com.google.cloud:sdk-platform-java-config to v3.36.0 ([#2185](https://github.com/googleapis/java-pubsub/issues/2185)) ([5ca2c7c](https://github.com/googleapis/java-pubsub/commit/5ca2c7c52497514af30e4522f0ae245d0f8d73ce)) +* Update dependency com.google.cloud:sdk-platform-java-config to v3.36.1 ([#2191](https://github.com/googleapis/java-pubsub/issues/2191)) ([555216e](https://github.com/googleapis/java-pubsub/commit/555216ee5bf9cfbba6664f133fc7cde1101f5f0b)) +* Update dependency com.google.protobuf:protobuf-java-util to v4.28.2 ([#2179](https://github.com/googleapis/java-pubsub/issues/2179)) ([c9bbd2c](https://github.com/googleapis/java-pubsub/commit/c9bbd2cf3525e3ebdf9ce3af7fe50a16a87c9837)) + +## [1.132.2](https://github.com/googleapis/java-pubsub/compare/v1.132.1...v1.132.2) (2024-09-11) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-bigquery to v2.42.1 ([#2152](https://github.com/googleapis/java-pubsub/issues/2152)) ([1457489](https://github.com/googleapis/java-pubsub/commit/1457489cb51c12bc7ad8ab8ddcf2252a2f513a79)) +* Update dependency com.google.cloud:google-cloud-bigquery to v2.42.2 ([#2157](https://github.com/googleapis/java-pubsub/issues/2157)) ([d671347](https://github.com/googleapis/java-pubsub/commit/d671347004a68c53cdf3fdfb9d1a7ed992ee162f)) +* Update dependency com.google.cloud:google-cloud-core to v2.43.0 ([#2161](https://github.com/googleapis/java-pubsub/issues/2161)) ([05a37b7](https://github.com/googleapis/java-pubsub/commit/05a37b786686c24f87eec5e9919c16b2b67465be)) +* Update dependency com.google.cloud:google-cloud-storage to v2.42.0 ([#2145](https://github.com/googleapis/java-pubsub/issues/2145)) ([77c3e78](https://github.com/googleapis/java-pubsub/commit/77c3e78d34e894c05653371027cd2b1d12cea9d0)) +* Update dependency com.google.cloud:sdk-platform-java-config to v3.35.0 ([#2162](https://github.com/googleapis/java-pubsub/issues/2162)) ([27eaffd](https://github.com/googleapis/java-pubsub/commit/27eaffd5fa55789b456eaeba98f6800343f3685e)) +* Update dependency com.google.protobuf:protobuf-java-util to v4.27.4 ([#2153](https://github.com/googleapis/java-pubsub/issues/2153)) ([32c78b3](https://github.com/googleapis/java-pubsub/commit/32c78b31e7a904fb6b6a2b55f81e7e3ab7525add)) +* Update dependency com.google.protobuf:protobuf-java-util to v4.28.0 ([#2155](https://github.com/googleapis/java-pubsub/issues/2155)) ([5f61fe1](https://github.com/googleapis/java-pubsub/commit/5f61fe13f6fea1d30ab0e85be0221e70056369f6)) +* Update dependency com.google.protobuf:protobuf-java-util to v4.28.1 ([#2167](https://github.com/googleapis/java-pubsub/issues/2167)) ([bb8ea71](https://github.com/googleapis/java-pubsub/commit/bb8ea717ed0234fdbb582f2915a016fd37657448)) +* Update dependency org.xerial.snappy:snappy-java to v1.1.10.7 ([#2165](https://github.com/googleapis/java-pubsub/issues/2165)) ([e7fb60e](https://github.com/googleapis/java-pubsub/commit/e7fb60ecccb8bb9fbc6147210491a52ee0f5a817)) + +## [1.132.1](https://github.com/googleapis/java-pubsub/compare/v1.132.0...v1.132.1) (2024-08-20) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-core to v2.42.0 ([#2140](https://github.com/googleapis/java-pubsub/issues/2140)) ([80dca35](https://github.com/googleapis/java-pubsub/commit/80dca35cebb1061f3d2a852ff9929519e69283cc)) +* Update dependency com.google.cloud:sdk-platform-java-config to v3.34.0 ([#2141](https://github.com/googleapis/java-pubsub/issues/2141)) ([273fbf3](https://github.com/googleapis/java-pubsub/commit/273fbf3f752444a397b0e743c5c6de1a539291ea)) +* Update dependency com.google.protobuf:protobuf-java-util to v4.27.3 ([#2127](https://github.com/googleapis/java-pubsub/issues/2127)) ([8523b4f](https://github.com/googleapis/java-pubsub/commit/8523b4f67f45ac219671c0d588bac7e9dc450dcb)) +* Update dependency org.xerial.snappy:snappy-java to v1.1.10.6 ([#2135](https://github.com/googleapis/java-pubsub/issues/2135)) ([102ff84](https://github.com/googleapis/java-pubsub/commit/102ff844594687b3bbaca1ff92e650fe9e8d3f1e)) + +## [1.132.0](https://github.com/googleapis/java-pubsub/compare/v1.131.0...v1.132.0) (2024-08-01) + + +### Features + +* Enable hermetic library generation ([#2048](https://github.com/googleapis/java-pubsub/issues/2048)) ([283a5e8](https://github.com/googleapis/java-pubsub/commit/283a5e89837071678f8dd94b8b8adfad91a6766c)) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-bigquery to v2.41.0 ([#2093](https://github.com/googleapis/java-pubsub/issues/2093)) ([217b8a3](https://github.com/googleapis/java-pubsub/commit/217b8a3f5419f80402d349b8873d7302eeb35e3f)) +* Update dependency com.google.cloud:google-cloud-bigquery to v2.42.0 ([#2124](https://github.com/googleapis/java-pubsub/issues/2124)) ([24ebe24](https://github.com/googleapis/java-pubsub/commit/24ebe2402fe6278348d87b5a4259c365a819877f)) +* Update dependency com.google.cloud:google-cloud-core to v2.41.0 ([#2120](https://github.com/googleapis/java-pubsub/issues/2120)) ([1f6428a](https://github.com/googleapis/java-pubsub/commit/1f6428a8b79369a239664b9ea7cd38e024db9724)) +* Update dependency com.google.cloud:google-cloud-storage to v2.40.1 ([#2095](https://github.com/googleapis/java-pubsub/issues/2095)) ([0d64d6c](https://github.com/googleapis/java-pubsub/commit/0d64d6cf7799a176297ceaa1475b7cb29a64bebc)) +* Update dependency com.google.cloud:google-cloud-storage to v2.41.0 ([#2129](https://github.com/googleapis/java-pubsub/issues/2129)) ([2348d20](https://github.com/googleapis/java-pubsub/commit/2348d2022bc400b7f187d3db7f43aff94d8884a8)) +* Update dependency com.google.cloud:sdk-platform-java-config to v3.33.0 ([#2121](https://github.com/googleapis/java-pubsub/issues/2121)) ([7fbea6d](https://github.com/googleapis/java-pubsub/commit/7fbea6d0c922dd3485f19eafccc42869efd0e5ed)) +* Update dependency com.google.protobuf:protobuf-java-util to v4.27.2 ([#2091](https://github.com/googleapis/java-pubsub/issues/2091)) ([9859f11](https://github.com/googleapis/java-pubsub/commit/9859f1181a12bc683eaf4a6345bf2528a5463c59)) +* Update dependency org.junit.vintage:junit-vintage-engine to v5.10.3 ([#2096](https://github.com/googleapis/java-pubsub/issues/2096)) ([42f12ed](https://github.com/googleapis/java-pubsub/commit/42f12ed3270e66beae316deb729b445c94dcb1a8)) + + +### Documentation + +* **samples:** Optimistic subscribe sample ([#2063](https://github.com/googleapis/java-pubsub/issues/2063)) ([53a4844](https://github.com/googleapis/java-pubsub/commit/53a4844f09eace777142b8cdcd06bc07cef0b432)) + +## [1.131.0](https://github.com/googleapis/java-pubsub/compare/v1.130.1...v1.131.0) (2024-06-25) + + +### Features + +* Add use_topic_schema for Cloud Storage Subscriptions ([#2082](https://github.com/googleapis/java-pubsub/issues/2082)) ([11d67d4](https://github.com/googleapis/java-pubsub/commit/11d67d44152ccca008dda071683d9932c59af41d)) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-core to v2.40.0 ([#2087](https://github.com/googleapis/java-pubsub/issues/2087)) ([26b01c9](https://github.com/googleapis/java-pubsub/commit/26b01c921f2700947a1653702be0234cf84cccef)) +* Update dependency com.google.cloud:sdk-platform-java-config to v3.32.0 ([#2088](https://github.com/googleapis/java-pubsub/issues/2088)) ([aebc3ed](https://github.com/googleapis/java-pubsub/commit/aebc3ed779e0847077742dedc7c2c0a9d8a1ab10)) + +## [1.130.1](https://github.com/googleapis/java-pubsub/compare/v1.130.0...v1.130.1) (2024-06-13) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-bigquery to v2.40.3 ([#2071](https://github.com/googleapis/java-pubsub/issues/2071)) ([0844bfb](https://github.com/googleapis/java-pubsub/commit/0844bfb0a500ae0b4a0f63fcb45ffffeaf609e3d)) +* Update dependency com.google.cloud:google-cloud-storage to v2.40.0 ([#2066](https://github.com/googleapis/java-pubsub/issues/2066)) ([dfcaeb5](https://github.com/googleapis/java-pubsub/commit/dfcaeb5b59466d86ac5b5bf74655ce359e7d5713)) +* Update dependency com.google.protobuf:protobuf-java-util to v4.27.1 ([#2065](https://github.com/googleapis/java-pubsub/issues/2065)) ([6baf69a](https://github.com/googleapis/java-pubsub/commit/6baf69a99adb75fba49c2289bca3ffd08720f8f4)) + +## [1.130.0](https://github.com/googleapis/java-pubsub/compare/v1.129.7...v1.130.0) (2024-06-03) + + +### Features + +* [java] allow passing libraries_bom_version from env ([#1967](https://github.com/googleapis/java-pubsub/issues/1967)) ([#2033](https://github.com/googleapis/java-pubsub/issues/2033)) ([825c5f8](https://github.com/googleapis/java-pubsub/commit/825c5f83e0fd2fd6b1f4856b9c555d71110a03e1)) +* Add service_account_email for export subscriptions ([#2054](https://github.com/googleapis/java-pubsub/issues/2054)) ([670db3e](https://github.com/googleapis/java-pubsub/commit/670db3e1b665e6f5aec3cd7bf3639e9242f20151)) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-core to v2.39.0 ([#2057](https://github.com/googleapis/java-pubsub/issues/2057)) ([43446d2](https://github.com/googleapis/java-pubsub/commit/43446d22ad2140f1b18fd1dde5dab03a901580bc)) +* Update dependency com.google.cloud:sdk-platform-java-config to v3.31.0 ([#2058](https://github.com/googleapis/java-pubsub/issues/2058)) ([a998ef5](https://github.com/googleapis/java-pubsub/commit/a998ef5359942486ea47bfd50f154314ae37be33)) + +## [1.129.7](https://github.com/googleapis/java-pubsub/compare/v1.129.6...v1.129.7) (2024-05-29) + + +### Dependencies + +* Change scope of grpc-inprocess dependency from runtime to test ([#2038](https://github.com/googleapis/java-pubsub/issues/2038)) ([1ab45c9](https://github.com/googleapis/java-pubsub/commit/1ab45c9eaee35d4bfeb332244c74f1253b77c166)) +* Update dependency com.google.cloud:google-cloud-bigquery to v2.40.2 ([#2046](https://github.com/googleapis/java-pubsub/issues/2046)) ([f81c5e1](https://github.com/googleapis/java-pubsub/commit/f81c5e1b977e6da19aac6a40c1389ddcc4643e3c)) +* Update dependency com.google.protobuf:protobuf-java-util to v4.27.0 ([#2044](https://github.com/googleapis/java-pubsub/issues/2044)) ([37e94ce](https://github.com/googleapis/java-pubsub/commit/37e94ce13a2998b5e3f69e9ad3d4ab68af108d64)) + +## [1.129.6](https://github.com/googleapis/java-pubsub/compare/v1.129.5...v1.129.6) (2024-05-23) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-storage to v2.39.0 ([#2040](https://github.com/googleapis/java-pubsub/issues/2040)) ([eb6bd9c](https://github.com/googleapis/java-pubsub/commit/eb6bd9c559073429d8338b9d8fa83e0e3f61b8e9)) +* Update dependency org.graalvm.buildtools:native-maven-plugin to v0.10.2 ([#2035](https://github.com/googleapis/java-pubsub/issues/2035)) ([40fdd7a](https://github.com/googleapis/java-pubsub/commit/40fdd7a71aa07d6c64ac6f96d7c6642af3563280)) + +## [1.129.5](https://github.com/googleapis/java-pubsub/compare/v1.129.4...v1.129.5) (2024-05-16) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-core to v2.38.1 ([#2027](https://github.com/googleapis/java-pubsub/issues/2027)) ([535edf6](https://github.com/googleapis/java-pubsub/commit/535edf6496700bc5c5fb0b5cfa1cac6be5d62875)) +* Update dependency com.google.cloud:sdk-platform-java-config to v3.30.1 ([#2028](https://github.com/googleapis/java-pubsub/issues/2028)) ([aedcffd](https://github.com/googleapis/java-pubsub/commit/aedcffdaedbaa30627c96f96bfa5430bd4666cf0)) + +## [1.129.4](https://github.com/googleapis/java-pubsub/compare/v1.129.3...v1.129.4) (2024-05-10) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-bigquery to v2.40.0 ([#2016](https://github.com/googleapis/java-pubsub/issues/2016)) ([beee523](https://github.com/googleapis/java-pubsub/commit/beee523ffc501a33b99a4ee82ccdb04b83391403)) +* Update dependency com.google.cloud:google-cloud-bigquery to v2.40.1 ([#2021](https://github.com/googleapis/java-pubsub/issues/2021)) ([0873594](https://github.com/googleapis/java-pubsub/commit/0873594c000f470c6193ebe8b4d091701670ef06)) +* Update dependency com.google.cloud:google-cloud-storage to v2.38.0 ([#2019](https://github.com/googleapis/java-pubsub/issues/2019)) ([ba3dffc](https://github.com/googleapis/java-pubsub/commit/ba3dffc3ac8cf173362307c24bc46e815c64db40)) + +## [1.129.3](https://github.com/googleapis/java-pubsub/compare/v1.129.2...v1.129.3) (2024-05-06) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-core to v2.38.0 ([#2011](https://github.com/googleapis/java-pubsub/issues/2011)) ([4a547d0](https://github.com/googleapis/java-pubsub/commit/4a547d08d02f3abaf23bfb8e5ed65e40c131bb94)) +* Update dependency com.google.cloud:sdk-platform-java-config to v3.30.0 ([#2012](https://github.com/googleapis/java-pubsub/issues/2012)) ([811d0e6](https://github.com/googleapis/java-pubsub/commit/811d0e609b5eb6eaf9c921828255407d9db68293)) + +## [1.129.2](https://github.com/googleapis/java-pubsub/compare/v1.129.1...v1.129.2) (2024-04-30) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-bigquery to v2.39.1 ([#2006](https://github.com/googleapis/java-pubsub/issues/2006)) ([a7f4afb](https://github.com/googleapis/java-pubsub/commit/a7f4afbc870536a7964594bc1d5b9a2eb5076cce)) + +## [1.129.1](https://github.com/googleapis/java-pubsub/compare/v1.129.0...v1.129.1) (2024-04-25) + + +### Bug Fixes + +* **deps:** Update the Java code generator (gapic-generator-java) to 2.39.0 ([#2000](https://github.com/googleapis/java-pubsub/issues/2000)) ([09ee49a](https://github.com/googleapis/java-pubsub/commit/09ee49a8304089f4388cfbde58127d46fe07a5a1)) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-bigquery to v2.39.0 ([#2002](https://github.com/googleapis/java-pubsub/issues/2002)) ([88517fe](https://github.com/googleapis/java-pubsub/commit/88517fe69a7a9577aa79b693957bf56a56d0980c)) +* Update dependency com.google.cloud:google-cloud-core to v2.37.0 ([#1997](https://github.com/googleapis/java-pubsub/issues/1997)) ([b4573ae](https://github.com/googleapis/java-pubsub/commit/b4573ae6c93ca47bc802616ae3715fc10163bf2e)) +* Update dependency com.google.cloud:google-cloud-storage to v2.37.0 ([#1999](https://github.com/googleapis/java-pubsub/issues/1999)) ([cff6d6a](https://github.com/googleapis/java-pubsub/commit/cff6d6a5fc297eb5254a409d495bda458dfebcd6)) +* Update dependency com.google.cloud:sdk-platform-java-config to v3.29.0 ([#1998](https://github.com/googleapis/java-pubsub/issues/1998)) ([bb80924](https://github.com/googleapis/java-pubsub/commit/bb80924e55bc97db82650d4ae2bdebf406c68f98)) + +## [1.129.0](https://github.com/googleapis/java-pubsub/compare/v1.128.1...v1.129.0) (2024-04-17) + + +### Features + +* Add `libraries_bom_version` in metadata ([#1956](https://github.com/googleapis/java-pubsub/issues/1956)) ([#1990](https://github.com/googleapis/java-pubsub/issues/1990)) ([18cfa73](https://github.com/googleapis/java-pubsub/commit/18cfa73208bdf9b6a1a597bac740056abfcb03ef)) + + +### Dependencies + +* Update actions/setup-java action to v4 ([#1978](https://github.com/googleapis/java-pubsub/issues/1978)) ([64a0df3](https://github.com/googleapis/java-pubsub/commit/64a0df337c91f965e4d8960801e10f90f78c46cd)) + +## [1.128.1](https://github.com/googleapis/java-pubsub/compare/v1.128.0...v1.128.1) (2024-04-10) + + +### Dependencies + +* Update actions/checkout action to v4 ([#1975](https://github.com/googleapis/java-pubsub/issues/1975)) ([618abdd](https://github.com/googleapis/java-pubsub/commit/618abdd44dd9670a5d6a1ca3c923e3d0621c6248)) +* Update actions/github-script action to v7 ([#1976](https://github.com/googleapis/java-pubsub/issues/1976)) ([c836172](https://github.com/googleapis/java-pubsub/commit/c8361722544ec4170b94651e77b02634938c7883)) + +## [1.128.0](https://github.com/googleapis/java-pubsub/compare/v1.127.3...v1.128.0) (2024-04-03) + + +### Features + +* Add custom datetime format for Cloud Storage subscriptions ([#1970](https://github.com/googleapis/java-pubsub/issues/1970)) ([7113f06](https://github.com/googleapis/java-pubsub/commit/7113f065973bb8b56ab811e0589ffb7975873679)) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-bigquery to v2.38.2 ([#1965](https://github.com/googleapis/java-pubsub/issues/1965)) ([ec3b386](https://github.com/googleapis/java-pubsub/commit/ec3b38665ddc6336f975d597d27c4aa25732c474)) +* Update dependency com.google.cloud:google-cloud-storage to v2.36.1 ([#1968](https://github.com/googleapis/java-pubsub/issues/1968)) ([524109c](https://github.com/googleapis/java-pubsub/commit/524109c1afc5118c79fd97769e194a1325322107)) +* Update dependency com.google.protobuf:protobuf-java-util to v4.26.1 ([#1972](https://github.com/googleapis/java-pubsub/issues/1972)) ([53c1120](https://github.com/googleapis/java-pubsub/commit/53c112033dc721cf91aceddfc1eeb3c6daddb45e)) + + +### Documentation + +* Add Kinesis ingestion samples ([#1947](https://github.com/googleapis/java-pubsub/issues/1947)) ([5b5c14b](https://github.com/googleapis/java-pubsub/commit/5b5c14ba31636c037c2b8d6a166bd48670e23688)) + +## [1.127.3](https://github.com/googleapis/java-pubsub/compare/v1.127.2...v1.127.3) (2024-03-20) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-core to v2.36.0 ([#1955](https://github.com/googleapis/java-pubsub/issues/1955)) ([d25d14a](https://github.com/googleapis/java-pubsub/commit/d25d14ad4694c5a914f9d07018cb0f6b9af4f9aa)) +* Update dependency com.google.cloud:google-cloud-core to v2.36.1 ([#1962](https://github.com/googleapis/java-pubsub/issues/1962)) ([96c1c97](https://github.com/googleapis/java-pubsub/commit/96c1c971fa4dced85cb2ed4e9db3e3fb47eb82c6)) +* Update dependency com.google.cloud:google-cloud-storage to v2.36.0 ([#1957](https://github.com/googleapis/java-pubsub/issues/1957)) ([0d8c182](https://github.com/googleapis/java-pubsub/commit/0d8c182653ea1ffd429465e91075760c1501eb34)) +* Update dependency com.google.cloud:sdk-platform-java-config to v3.28.0 ([#1956](https://github.com/googleapis/java-pubsub/issues/1956)) ([183df2c](https://github.com/googleapis/java-pubsub/commit/183df2caeed8e0df53ef9668232e4949ec4719a9)) +* Update dependency com.google.cloud:sdk-platform-java-config to v3.28.1 ([#1960](https://github.com/googleapis/java-pubsub/issues/1960)) ([faa45a4](https://github.com/googleapis/java-pubsub/commit/faa45a4efeaee5b45f9a4cc89dc2917f56a66797)) +* Update dependency com.google.protobuf:protobuf-java-util to v4 ([#1951](https://github.com/googleapis/java-pubsub/issues/1951)) ([243ec9a](https://github.com/googleapis/java-pubsub/commit/243ec9ab47212bbe701b16882c92a9b3d5d4aeaa)) + +## [1.127.2](https://github.com/googleapis/java-pubsub/compare/v1.127.1...v1.127.2) (2024-03-10) + + +### Bug Fixes + +* **deps:** Update the Java code generator (gapic-generator-java) to 2.37.0 ([#1938](https://github.com/googleapis/java-pubsub/issues/1938)) ([1435c4e](https://github.com/googleapis/java-pubsub/commit/1435c4e4d25d789fadbfc2c54c2f90b138693b40)) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-bigquery to v2.38.1 ([#1944](https://github.com/googleapis/java-pubsub/issues/1944)) ([76317e1](https://github.com/googleapis/java-pubsub/commit/76317e1fe60467b4bbe9b4867d0a29e983ce687f)) +* Update dependency com.google.cloud:google-cloud-storage to v2.35.0 ([#1942](https://github.com/googleapis/java-pubsub/issues/1942)) ([989f7ba](https://github.com/googleapis/java-pubsub/commit/989f7bac5bada7ac5d6e68c742af0290cb757e4b)) +* Update dependency com.google.cloud:google-cloud-storage to v2.35.0 ([#1946](https://github.com/googleapis/java-pubsub/issues/1946)) ([b94989d](https://github.com/googleapis/java-pubsub/commit/b94989df6c5ae6f62e648016cef2e008a3b9ed05)) + +## [1.127.1](https://github.com/googleapis/java-pubsub/compare/v1.127.0...v1.127.1) (2024-03-04) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-bigquery to v2.38.0 ([#1931](https://github.com/googleapis/java-pubsub/issues/1931)) ([357c901](https://github.com/googleapis/java-pubsub/commit/357c901029a8bc5fb9800a7fae6f3d93080c0a0d)) +* Update dependency com.google.cloud:google-cloud-core to v2.35.0 ([#1936](https://github.com/googleapis/java-pubsub/issues/1936)) ([785e6d1](https://github.com/googleapis/java-pubsub/commit/785e6d1e4f2234d2c49183fc06d3f73de537171b)) +* Update dependency com.google.cloud:sdk-platform-java-config to v3.27.0 ([#1937](https://github.com/googleapis/java-pubsub/issues/1937)) ([75e7e5e](https://github.com/googleapis/java-pubsub/commit/75e7e5e9eede53e87a6bc8ccda957990ea9b0673)) + +## [1.127.0](https://github.com/googleapis/java-pubsub/compare/v1.126.6...v1.127.0) (2024-02-28) + + +### Features + +* Add an API method for reordering firewall policies ([#1868](https://github.com/googleapis/java-pubsub/issues/1868)) ([2039f7e](https://github.com/googleapis/java-pubsub/commit/2039f7e9bee9db1991fae1118e4a6b8ad88ea30c)) +* Add universe domain support for Java ([#1904](https://github.com/googleapis/java-pubsub/issues/1904)) ([1e316d3](https://github.com/googleapis/java-pubsub/commit/1e316d33d2b7c87f6b76580cd9f905fe90a664c7)) +* Next release from main branch is 1.126.0 ([#1933](https://github.com/googleapis/java-pubsub/issues/1933)) ([255d8bc](https://github.com/googleapis/java-pubsub/commit/255d8bca3509e9a9dc2d82c95fabb32590423565)) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-bigquery to v2.37.2 ([#1918](https://github.com/googleapis/java-pubsub/issues/1918)) ([b8846f9](https://github.com/googleapis/java-pubsub/commit/b8846f9dbf71854af1379c40669e017dd4e005d1)) +* Update dependency com.google.cloud:google-cloud-storage to v2.34.0 ([#1917](https://github.com/googleapis/java-pubsub/issues/1917)) ([4a7d6b9](https://github.com/googleapis/java-pubsub/commit/4a7d6b971f0d16d867c56679d1e7bfbba4e4a67a)) +* Update dependency com.google.protobuf:protobuf-java-util to v3.25.3 ([#1919](https://github.com/googleapis/java-pubsub/issues/1919)) ([4bf13bb](https://github.com/googleapis/java-pubsub/commit/4bf13bb5f346a53ecf8e1e73e5f3b6d1c99ddf93)) +* Update dependency org.graalvm.buildtools:native-maven-plugin to v0.10.1 ([#1923](https://github.com/googleapis/java-pubsub/issues/1923)) ([cd704bd](https://github.com/googleapis/java-pubsub/commit/cd704bd57b2596d82f2f791476a109a771995b4d)) + +## [1.126.6](https://github.com/googleapis/java-pubsub/compare/v1.126.5...v1.126.6) (2024-02-14) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-core to v2.33.0 ([#1912](https://github.com/googleapis/java-pubsub/issues/1912)) ([9691c6f](https://github.com/googleapis/java-pubsub/commit/9691c6fabd82eb07fcb5135019be8d6fb260ce6f)) +* Update dependency com.google.cloud:sdk-platform-java-config to v3.25.0 ([#1913](https://github.com/googleapis/java-pubsub/issues/1913)) ([9636c55](https://github.com/googleapis/java-pubsub/commit/9636c5526e5cf4507bed69349321b686ddf7ab27)) + +## [1.126.5](https://github.com/googleapis/java-pubsub/compare/v1.126.4...v1.126.5) (2024-02-12) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-bigquery to v2.37.1 ([#1898](https://github.com/googleapis/java-pubsub/issues/1898)) ([fc0dc96](https://github.com/googleapis/java-pubsub/commit/fc0dc962bcb7467fe4008263a80d1ed1e29167a0)) +* Update dependency com.google.cloud:google-cloud-storage to v2.33.0 ([#1900](https://github.com/googleapis/java-pubsub/issues/1900)) ([0efceb4](https://github.com/googleapis/java-pubsub/commit/0efceb4f4068c70565676dc2ddcf629ec4f0489f)) +* Update dependency org.graalvm.buildtools:junit-platform-native to v0.10.0 ([#1887](https://github.com/googleapis/java-pubsub/issues/1887)) ([2bfa5cc](https://github.com/googleapis/java-pubsub/commit/2bfa5cc894e5a14b1d890bdcad348eeb14520f95)) +* Update dependency org.graalvm.buildtools:native-maven-plugin to v0.10.0 ([#1888](https://github.com/googleapis/java-pubsub/issues/1888)) ([5017789](https://github.com/googleapis/java-pubsub/commit/5017789c996246ece0c5428c68c9c6681b760bca)) +* Update dependency org.junit.vintage:junit-vintage-engine to v5.10.2 ([#1891](https://github.com/googleapis/java-pubsub/issues/1891)) ([231ba51](https://github.com/googleapis/java-pubsub/commit/231ba51c8bd2e6a8f3e0171626d35761bd07ae19)) + +## [1.126.4](https://github.com/googleapis/java-pubsub/compare/v1.126.3...v1.126.4) (2024-02-09) + + +### Bug Fixes + +* Message ordering fix for [#1889](https://github.com/googleapis/java-pubsub/issues/1889) ([#1903](https://github.com/googleapis/java-pubsub/issues/1903)) ([22a87c6](https://github.com/googleapis/java-pubsub/commit/22a87c67f07b55266e277f83f5ceb17d9f32f67e)) + +## [1.126.3](https://github.com/googleapis/java-pubsub/compare/v1.126.2...v1.126.3) (2024-02-08) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-core to v2.32.0 ([#1885](https://github.com/googleapis/java-pubsub/issues/1885)) ([a2063cf](https://github.com/googleapis/java-pubsub/commit/a2063cf8f1f792f5ad1994bff00f367b399c0ff2)) + +## [1.126.2](https://github.com/googleapis/java-pubsub/compare/v1.126.1...v1.126.2) (2024-01-26) + + +### Bug Fixes + +* **deps:** Update the Java code generator (gapic-generator-java) to 2.32.0 ([#1875](https://github.com/googleapis/java-pubsub/issues/1875)) ([0aac3e4](https://github.com/googleapis/java-pubsub/commit/0aac3e4c9c5671ce8f3b98056cc3710cd5ca9d07)) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-bigquery to v2.37.0 ([#1878](https://github.com/googleapis/java-pubsub/issues/1878)) ([16dee8b](https://github.com/googleapis/java-pubsub/commit/16dee8bce115f59d8518ca1ae0e39dd87d81f802)) + +## [1.126.1](https://github.com/googleapis/java-pubsub/compare/v1.126.0...v1.126.1) (2024-01-25) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-bigquery to v2.36.0 ([#1840](https://github.com/googleapis/java-pubsub/issues/1840)) ([8c5117d](https://github.com/googleapis/java-pubsub/commit/8c5117d02511acd5469d863ea483f6e765e29292)) +* Update dependency com.google.cloud:google-cloud-core to v2.30.0 ([#1853](https://github.com/googleapis/java-pubsub/issues/1853)) ([db36def](https://github.com/googleapis/java-pubsub/commit/db36deff6a4187cb98ddd68259efd6034762060e)) +* Update dependency com.google.cloud:google-cloud-core to v2.31.0 ([#1872](https://github.com/googleapis/java-pubsub/issues/1872)) ([06db9a0](https://github.com/googleapis/java-pubsub/commit/06db9a05a80b2d7f38aefff2d5e0b33e3fa1a2c9)) +* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.22.0 ([#1865](https://github.com/googleapis/java-pubsub/issues/1865)) ([f4c6f51](https://github.com/googleapis/java-pubsub/commit/f4c6f5112e8285264a497b3a141c31f77fea6ee2)) +* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.23.0 ([#1873](https://github.com/googleapis/java-pubsub/issues/1873)) ([0d445f1](https://github.com/googleapis/java-pubsub/commit/0d445f173574433aed2770d9cc949672221b839e)) +* Update dependency com.google.cloud:google-cloud-storage to v2.32.0 ([#1857](https://github.com/googleapis/java-pubsub/issues/1857)) ([d673e55](https://github.com/googleapis/java-pubsub/commit/d673e55e69f60f5a6f6bae10e2f62d7fd0dfa89f)) +* Update dependency com.google.cloud:google-cloud-storage to v2.32.1 ([#1874](https://github.com/googleapis/java-pubsub/issues/1874)) ([adae8a4](https://github.com/googleapis/java-pubsub/commit/adae8a4aadb08532076fd02710d0e41336ec096c)) +* Update dependency com.google.protobuf:protobuf-java-util to v3.25.2 ([#1858](https://github.com/googleapis/java-pubsub/issues/1858)) ([8fa6354](https://github.com/googleapis/java-pubsub/commit/8fa635427927e1859332896b8373abccd5881949)) + +## [1.126.0](https://github.com/googleapis/java-pubsub/compare/v1.125.13...v1.126.0) (2024-01-13) + + +### Features + +* Add `use_table_schema` field to BigQueryConfig ([#1838](https://github.com/googleapis/java-pubsub/issues/1838)) ([8653f4f](https://github.com/googleapis/java-pubsub/commit/8653f4f3dbd61466b8ea05b342c5f66c9e536cf1)) + + +### Bug Fixes + +* **deps:** Update the Java code generator (gapic-generator-java) to 2.31.0 ([#1855](https://github.com/googleapis/java-pubsub/issues/1855)) ([7e733d2](https://github.com/googleapis/java-pubsub/commit/7e733d20093e0cd492758dd1ff3efc3a72eb1e0c)) +* Swap writer and reader schema to correct places in sample ([#1849](https://github.com/googleapis/java-pubsub/issues/1849)) ([1c79ad7](https://github.com/googleapis/java-pubsub/commit/1c79ad7336f51ffd4e177be5c2f2a7de902b47b8)) +* Temporarily remove publisher tests causing timeouts ([#1860](https://github.com/googleapis/java-pubsub/issues/1860)) ([a8fa24d](https://github.com/googleapis/java-pubsub/commit/a8fa24d7185d5345e746f8e2563afffe08f3bd6e)) +* Use message ordering enabled property that comes with streaming pull responses ([#1851](https://github.com/googleapis/java-pubsub/issues/1851)) ([d816138](https://github.com/googleapis/java-pubsub/commit/d8161380e232fd4be408e6298827423907a027fb)) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.21.0 ([#1854](https://github.com/googleapis/java-pubsub/issues/1854)) ([b36825b](https://github.com/googleapis/java-pubsub/commit/b36825bf476f8bf83a7ca594932e03d06bc05f07)) +* Update dependency com.google.cloud:google-cloud-storage to v2.30.1 ([#1841](https://github.com/googleapis/java-pubsub/issues/1841)) ([d6f1352](https://github.com/googleapis/java-pubsub/commit/d6f1352ec3debe106ba238343c0c05b9278dc964)) + +## [1.125.13](https://github.com/googleapis/java-pubsub/compare/v1.125.12...v1.125.13) (2023-11-30) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-core to v2.28.0 ([#1830](https://github.com/googleapis/java-pubsub/issues/1830)) ([8990b7c](https://github.com/googleapis/java-pubsub/commit/8990b7ca7cfbb08cd117f59bbf18c67dd1e7fb18)) +* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.20.0 ([#1831](https://github.com/googleapis/java-pubsub/issues/1831)) ([d188af8](https://github.com/googleapis/java-pubsub/commit/d188af8815927b409f72c968cbd6a8685976d08b)) +* Update dependency com.google.protobuf:protobuf-java-util to v3.25.1 ([#1816](https://github.com/googleapis/java-pubsub/issues/1816)) ([e4f2b26](https://github.com/googleapis/java-pubsub/commit/e4f2b2605b17024f983a8ccf50ed19d169c15d90)) + +## [1.125.12](https://github.com/googleapis/java-pubsub/compare/v1.125.11...v1.125.12) (2023-11-21) + + +### Bug Fixes + +* Concurrent modification of processing receievd messages ([#1807](https://github.com/googleapis/java-pubsub/issues/1807)) ([d162126](https://github.com/googleapis/java-pubsub/commit/d16212627b0d9b6616e0a9b20af2c430e2f6b36f)) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-bigquery to v2.34.2 ([#1821](https://github.com/googleapis/java-pubsub/issues/1821)) ([c21ba1a](https://github.com/googleapis/java-pubsub/commit/c21ba1a51acf3411e7f9793f579a103ee1d36f38)) +* Update dependency com.google.cloud:google-cloud-storage to v2.29.1 ([#1817](https://github.com/googleapis/java-pubsub/issues/1817)) ([e179b94](https://github.com/googleapis/java-pubsub/commit/e179b94b7034fbb6c10775b0fe469ab129c0d6c8)) +* Update dependency org.junit.vintage:junit-vintage-engine to v5.10.1 ([#1819](https://github.com/googleapis/java-pubsub/issues/1819)) ([af84aa3](https://github.com/googleapis/java-pubsub/commit/af84aa3f5434d3e8ff2122b72cae0fc1c7323742)) + +## [1.125.11](https://github.com/googleapis/java-pubsub/compare/v1.125.10...v1.125.11) (2023-11-01) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-core to v2.27.0 ([#1810](https://github.com/googleapis/java-pubsub/issues/1810)) ([edd89f3](https://github.com/googleapis/java-pubsub/commit/edd89f36061cd1518f81eb7b33e42cf5c35c659d)) +* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.19.0 ([#1811](https://github.com/googleapis/java-pubsub/issues/1811)) ([d671bcb](https://github.com/googleapis/java-pubsub/commit/d671bcb9b0e6c425eb33bdafea9c20b543020363)) + +## [1.125.10](https://github.com/googleapis/java-pubsub/compare/v1.125.9...v1.125.10) (2023-10-31) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-storage to v2.29.0 ([#1800](https://github.com/googleapis/java-pubsub/issues/1800)) ([8c43cc2](https://github.com/googleapis/java-pubsub/commit/8c43cc2443f333c646c27cee4ee70434167213ba)) + + +### Documentation + +* Adding a GCS subscription example ([#1762](https://github.com/googleapis/java-pubsub/issues/1762)) ([3ce824c](https://github.com/googleapis/java-pubsub/commit/3ce824c78c7eaf37fc3bc0ed2a4b3b1d952ed9bc)) +* Renaming the CreateUnwrappedPushSubscription File ([#1794](https://github.com/googleapis/java-pubsub/issues/1794)) ([3264290](https://github.com/googleapis/java-pubsub/commit/326429092ac73d184b5e887ce5107220f96199b7)) + +## [1.125.9](https://github.com/googleapis/java-pubsub/compare/v1.125.8...v1.125.9) (2023-10-27) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-bigquery to v2.34.0 ([#1795](https://github.com/googleapis/java-pubsub/issues/1795)) ([670daf1](https://github.com/googleapis/java-pubsub/commit/670daf1c74242dfa54e9747924d094cbcaac4d37)) + +## [1.125.8](https://github.com/googleapis/java-pubsub/compare/v1.125.7...v1.125.8) (2023-10-23) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-core to v2.26.0 ([#1780](https://github.com/googleapis/java-pubsub/issues/1780)) ([2d38175](https://github.com/googleapis/java-pubsub/commit/2d381751b51cb69b6ab248ee56fe9ce5bf7f5cd5)) +* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.18.0 ([#1781](https://github.com/googleapis/java-pubsub/issues/1781)) ([5b6cb15](https://github.com/googleapis/java-pubsub/commit/5b6cb15ce9f459061875329ba1fc6d4b84909666)) +* Update dependency org.graalvm.buildtools:junit-platform-native to v0.9.28 ([#1782](https://github.com/googleapis/java-pubsub/issues/1782)) ([c9be478](https://github.com/googleapis/java-pubsub/commit/c9be478c3558928fc603c81fc07c4d8ba6d853b4)) +* Update dependency org.graalvm.buildtools:native-maven-plugin to v0.9.28 ([#1783](https://github.com/googleapis/java-pubsub/issues/1783)) ([5e39b79](https://github.com/googleapis/java-pubsub/commit/5e39b799d5d7b41325f9564a6044c0f0b4b05fdc)) + + +### Documentation + +* Modified some descriptions ([#1773](https://github.com/googleapis/java-pubsub/issues/1773)) ([17bd055](https://github.com/googleapis/java-pubsub/commit/17bd05512ba71083eb898a3ff8c5dc53c9bbb08d)) + +## [1.125.7](https://github.com/googleapis/java-pubsub/compare/v1.125.6...v1.125.7) (2023-10-17) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-bigquery to v2.33.2 ([#1770](https://github.com/googleapis/java-pubsub/issues/1770)) ([db73af7](https://github.com/googleapis/java-pubsub/commit/db73af7bca53faae2e135ec9a1899e36ac19025c)) + +## [1.125.6](https://github.com/googleapis/java-pubsub/compare/v1.125.5...v1.125.6) (2023-10-10) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-bigquery to v2.33.1 ([#1756](https://github.com/googleapis/java-pubsub/issues/1756)) ([239f474](https://github.com/googleapis/java-pubsub/commit/239f474fefd2313a6842c63c4202d835008647e3)) +* Update dependency com.google.cloud:google-cloud-core to v2.25.0 ([#1764](https://github.com/googleapis/java-pubsub/issues/1764)) ([72404ea](https://github.com/googleapis/java-pubsub/commit/72404eabcc3695b8072091587515562d852a6108)) +* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.17.0 ([#1765](https://github.com/googleapis/java-pubsub/issues/1765)) ([a447292](https://github.com/googleapis/java-pubsub/commit/a447292d07ae1d9b03866dbdd9549c1b10564b28)) +* Update dependency com.google.protobuf:protobuf-java-util to v3.24.4 ([#1760](https://github.com/googleapis/java-pubsub/issues/1760)) ([10a64c6](https://github.com/googleapis/java-pubsub/commit/10a64c6b872a14decf3a799ebd985395358dc32c)) + +## [1.125.5](https://github.com/googleapis/java-pubsub/compare/v1.125.4...v1.125.5) (2023-09-28) + + +### Dependencies + +* Update gapic-generator-java to 2.26.0 ([935849c](https://github.com/googleapis/java-pubsub/commit/935849cedbb70a0821be56828dd0abeccbccc21c)) + +## [1.125.4](https://github.com/googleapis/java-pubsub/compare/v1.125.3...v1.125.4) (2023-09-28) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-bigquery to v2.33.0 ([#1750](https://github.com/googleapis/java-pubsub/issues/1750)) ([bcbfcd0](https://github.com/googleapis/java-pubsub/commit/bcbfcd0dd65c2ca0f20d3579109728737f1292bc)) + +## [1.125.3](https://github.com/googleapis/java-pubsub/compare/v1.125.2...v1.125.3) (2023-09-27) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-core to v2.24.1 ([#1737](https://github.com/googleapis/java-pubsub/issues/1737)) ([48a4432](https://github.com/googleapis/java-pubsub/commit/48a44321ad34edd8c297ccc57445ec36916171cb)) +* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.16.1 ([#1738](https://github.com/googleapis/java-pubsub/issues/1738)) ([e2cf7c1](https://github.com/googleapis/java-pubsub/commit/e2cf7c110b72dff695a46a972687a595216934e6)) +* Update dependency org.apache.avro:avro to v1.11.3 ([#1740](https://github.com/googleapis/java-pubsub/issues/1740)) ([971b35f](https://github.com/googleapis/java-pubsub/commit/971b35f5d26263ef3c1d83b6282680ac1608c032)) +* Update dependency org.xerial.snappy:snappy-java to v1.1.10.4 [security] ([#1742](https://github.com/googleapis/java-pubsub/issues/1742)) ([70ba500](https://github.com/googleapis/java-pubsub/commit/70ba500cc014cb9d0e1799997aa0682239b97cde)) +* Update dependency org.xerial.snappy:snappy-java to v1.1.10.5 ([#1746](https://github.com/googleapis/java-pubsub/issues/1746)) ([a4b1994](https://github.com/googleapis/java-pubsub/commit/a4b199414cad5cb061330832b2bf2a8bbe76bcbd)) + +## [1.125.2](https://github.com/googleapis/java-pubsub/compare/v1.125.1...v1.125.2) (2023-09-18) + + +### Dependencies + +* Update dependency org.graalvm.buildtools:junit-platform-native to v0.9.27 ([#1730](https://github.com/googleapis/java-pubsub/issues/1730)) ([687a855](https://github.com/googleapis/java-pubsub/commit/687a855580a9c8fe7f0d4a8952cb3ca46ff6f736)) +* Update dependency org.graalvm.buildtools:native-maven-plugin to v0.9.27 ([#1731](https://github.com/googleapis/java-pubsub/issues/1731)) ([403b7e7](https://github.com/googleapis/java-pubsub/commit/403b7e72c275464a67f6998bb975d95026a8480d)) + +## [1.125.1](https://github.com/googleapis/java-pubsub/compare/v1.125.0...v1.125.1) (2023-09-14) + + +### Dependencies + +* Update actions/checkout action to v4 - abandoned ([#1719](https://github.com/googleapis/java-pubsub/issues/1719)) ([b82f15a](https://github.com/googleapis/java-pubsub/commit/b82f15a099f3366620f5e22764b043911ebd88d1)) +* Update dependency com.google.cloud:google-cloud-bigquery to v2.32.0 ([#1725](https://github.com/googleapis/java-pubsub/issues/1725)) ([f40f09a](https://github.com/googleapis/java-pubsub/commit/f40f09a185c035cc03b6be6ec62f880da9f7b377)) + +## [1.125.0](https://github.com/googleapis/java-pubsub/compare/v1.124.2...v1.125.0) (2023-09-12) + + +### Features + +* Receipt modack ([#1540](https://github.com/googleapis/java-pubsub/issues/1540)) ([74d8da9](https://github.com/googleapis/java-pubsub/commit/74d8da97c42b672e3f9f26b9a535d6bac948a402)) + + +### Bug Fixes + +* Make retry policy back off more aggressively for RPCs that retry RESOURCE_EXHAUSTD ([#1704](https://github.com/googleapis/java-pubsub/issues/1704)) ([f61e7e0](https://github.com/googleapis/java-pubsub/commit/f61e7e0e2895a90e30ecf4dcbfa8c70022947d9e)) + + +### Dependencies + +* Update actions/checkout action to v4 ([#1712](https://github.com/googleapis/java-pubsub/issues/1712)) ([404c492](https://github.com/googleapis/java-pubsub/commit/404c492823306c1448c62383b9ea88cf9e43b970)) +* Update dependency com.google.cloud:google-cloud-bigquery to v2.31.2 ([#1713](https://github.com/googleapis/java-pubsub/issues/1713)) ([32cb43c](https://github.com/googleapis/java-pubsub/commit/32cb43cce40f7a39602eb7d9b39a88eb229fc4ef)) +* Update dependency com.google.cloud:google-cloud-core to v2.23.0 ([#1717](https://github.com/googleapis/java-pubsub/issues/1717)) ([929f778](https://github.com/googleapis/java-pubsub/commit/929f778e341aefe61206e55de828bf5a86e4efd3)) +* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.15.0 ([#1718](https://github.com/googleapis/java-pubsub/issues/1718)) ([0eeaa19](https://github.com/googleapis/java-pubsub/commit/0eeaa19a640513e80d595ca7c4016e26fc30871b)) +* Update dependency com.google.protobuf:protobuf-java-util to v3.24.3 ([#1698](https://github.com/googleapis/java-pubsub/issues/1698)) ([1157fbf](https://github.com/googleapis/java-pubsub/commit/1157fbff92204eae55bb24ad803f0b8e1336ac10)) +* Update dependency org.easymock:easymock to v5.2.0 ([#1711](https://github.com/googleapis/java-pubsub/issues/1711)) ([313f6dd](https://github.com/googleapis/java-pubsub/commit/313f6dd8b82fbc57df066615e285325969b6d2e4)) +* Update dependency org.graalvm.buildtools:junit-platform-native to v0.9.25 ([#1709](https://github.com/googleapis/java-pubsub/issues/1709)) ([1cc8a53](https://github.com/googleapis/java-pubsub/commit/1cc8a53a416acdd5f9cd4fc598f2f5f182a2ad44)) +* Update dependency org.graalvm.buildtools:junit-platform-native to v0.9.26 ([#1715](https://github.com/googleapis/java-pubsub/issues/1715)) ([f2cc75f](https://github.com/googleapis/java-pubsub/commit/f2cc75f960521e8be50cf354e00024d66fb8f7fb)) +* Update dependency org.graalvm.buildtools:native-maven-plugin to v0.9.25 ([#1710](https://github.com/googleapis/java-pubsub/issues/1710)) ([9764c3f](https://github.com/googleapis/java-pubsub/commit/9764c3f740cd726ad09cef82039561bd145fbe0c)) +* Update dependency org.graalvm.buildtools:native-maven-plugin to v0.9.26 ([#1716](https://github.com/googleapis/java-pubsub/issues/1716)) ([6c9e949](https://github.com/googleapis/java-pubsub/commit/6c9e9493ec7aeaa0711ad2155fa6a549937284df)) + +## [1.124.2](https://github.com/googleapis/java-pubsub/compare/v1.124.1...v1.124.2) (2023-08-15) + + +### Bug Fixes + +* Update Publish retry backoff settings ([#1686](https://github.com/googleapis/java-pubsub/issues/1686)) ([63a74d9](https://github.com/googleapis/java-pubsub/commit/63a74d98fdee56a98819d135a676a67fcc24961a)) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-bigquery to v2.31.1 ([#1697](https://github.com/googleapis/java-pubsub/issues/1697)) ([9e90790](https://github.com/googleapis/java-pubsub/commit/9e907901e0f5f78adfffb3e61974e9f8fd756f96)) +* Update dependency org.graalvm.buildtools:junit-platform-native to v0.9.24 ([#1695](https://github.com/googleapis/java-pubsub/issues/1695)) ([ec64036](https://github.com/googleapis/java-pubsub/commit/ec640361a471111001f22667fa7e38123b731025)) +* Update dependency org.graalvm.buildtools:native-maven-plugin to v0.9.24 ([#1696](https://github.com/googleapis/java-pubsub/issues/1696)) ([cc9ae19](https://github.com/googleapis/java-pubsub/commit/cc9ae19865c0ece3789a8c2fa22afb5fbd306dc9)) + +## [1.124.1](https://github.com/googleapis/java-pubsub/compare/v1.124.0...v1.124.1) (2023-08-03) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-core to v2.22.0 ([#1687](https://github.com/googleapis/java-pubsub/issues/1687)) ([220f318](https://github.com/googleapis/java-pubsub/commit/220f3181562a848cd786cc0126e8e3ad382787c7)) +* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.14.0 ([#1688](https://github.com/googleapis/java-pubsub/issues/1688)) ([0ded9f1](https://github.com/googleapis/java-pubsub/commit/0ded9f172af637db5d4302b146a24ecdd5b1bde2)) + +## [1.124.0](https://github.com/googleapis/java-pubsub/compare/v1.123.20...v1.124.0) (2023-07-27) + + +### Features + +* Setup 1.123.x lts branch ([#1676](https://github.com/googleapis/java-pubsub/issues/1676)) ([a60b887](https://github.com/googleapis/java-pubsub/commit/a60b88772d69d367f90bbe61bc4e157338193b0f)) + + +### Documentation + +* Clarified where ordering_key will be written if write_metadata is set ([#1675](https://github.com/googleapis/java-pubsub/issues/1675)) ([462746c](https://github.com/googleapis/java-pubsub/commit/462746cfbf9b712118b67349f2f4f4cebf45932a)) + +## [1.123.20](https://github.com/googleapis/java-pubsub/compare/v1.123.19...v1.123.20) (2023-07-25) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-bigquery to v2.31.0 ([#1671](https://github.com/googleapis/java-pubsub/issues/1671)) ([c51d396](https://github.com/googleapis/java-pubsub/commit/c51d39688464c51ffdb046368b4f8e926360d72e)) + +## [1.123.19](https://github.com/googleapis/java-pubsub/compare/v1.123.18...v1.123.19) (2023-07-25) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-bigquery to v2.30.1 ([#1656](https://github.com/googleapis/java-pubsub/issues/1656)) ([4fe4bc4](https://github.com/googleapis/java-pubsub/commit/4fe4bc49d82753e3e185f0a2c4694d80e48808f7)) +* Update dependency com.google.cloud:google-cloud-core to v2.21.1 ([#1662](https://github.com/googleapis/java-pubsub/issues/1662)) ([e10292c](https://github.com/googleapis/java-pubsub/commit/e10292c16f24870a91584f716545ff210302a7bc)) +* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.13.1 ([#1663](https://github.com/googleapis/java-pubsub/issues/1663)) ([50f4ff1](https://github.com/googleapis/java-pubsub/commit/50f4ff10140699a02d1ec550b05ff6d1aa39c762)) +* Update dependency org.junit.vintage:junit-vintage-engine to v5.10.0 ([#1666](https://github.com/googleapis/java-pubsub/issues/1666)) ([d8712a3](https://github.com/googleapis/java-pubsub/commit/d8712a31459b8f9497dff7a866c8a8795ca60af9)) +* Update dependency org.xerial.snappy:snappy-java to v1.1.10.3 ([#1665](https://github.com/googleapis/java-pubsub/issues/1665)) ([ad1c515](https://github.com/googleapis/java-pubsub/commit/ad1c5157eadc4bf2d43b7dc332ac4150d732912d)) + +## [1.123.18](https://github.com/googleapis/java-pubsub/compare/v1.123.17...v1.123.18) (2023-07-17) + + +### Documentation + +* Tightened requirements on cloud storage subscription filename suffixes ([#1639](https://github.com/googleapis/java-pubsub/issues/1639)) ([34a182a](https://github.com/googleapis/java-pubsub/commit/34a182a1655c843cd728850b278ba2e9ce9a5680)) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-core to v2.21.0 ([#1650](https://github.com/googleapis/java-pubsub/issues/1650)) ([69879d4](https://github.com/googleapis/java-pubsub/commit/69879d4c9d7a220f9c5a38b144d49e71ad3b94d0)) +* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.13.0 ([#1651](https://github.com/googleapis/java-pubsub/issues/1651)) ([83fdbe2](https://github.com/googleapis/java-pubsub/commit/83fdbe2435d8fa03b5648272a794874ff910fcb6)) +* Update dependency com.google.protobuf:protobuf-java-util to v3.23.4 ([#1649](https://github.com/googleapis/java-pubsub/issues/1649)) ([9f9c5ca](https://github.com/googleapis/java-pubsub/commit/9f9c5ca2abddde274c79cf36bf2aea91b7b8b455)) +* Update dependency org.apache.avro:avro to v1.11.2 ([#1646](https://github.com/googleapis/java-pubsub/issues/1646)) ([5859fe4](https://github.com/googleapis/java-pubsub/commit/5859fe4c6540fa577942f38e117798d3c3cdc498)) +* Update dependency org.xerial.snappy:snappy-java to v1.1.10.2 ([#1654](https://github.com/googleapis/java-pubsub/issues/1654)) ([05445f0](https://github.com/googleapis/java-pubsub/commit/05445f0ccf1cd78a604ec267d7a146cdd1770c59)) + +## [1.123.17](https://github.com/googleapis/java-pubsub/compare/v1.123.16...v1.123.17) (2023-06-26) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-bigquery to v2.29.0 ([#1633](https://github.com/googleapis/java-pubsub/issues/1633)) ([20096e7](https://github.com/googleapis/java-pubsub/commit/20096e7b64f9b62051f51ad28aa49b95f78b3e6b)) + +## [1.123.16](https://github.com/googleapis/java-pubsub/compare/v1.123.15...v1.123.16) (2023-06-26) + + +### Dependencies + +* Update dependency com.google.protobuf:protobuf-java-util to v3.23.3 ([#1634](https://github.com/googleapis/java-pubsub/issues/1634)) ([2481c4b](https://github.com/googleapis/java-pubsub/commit/2481c4b8799bbe78542b4a8dd6c2484be08f30a1)) + +## [1.123.15](https://github.com/googleapis/java-pubsub/compare/v1.123.14...v1.123.15) (2023-06-22) + + +### Bug Fixes + +* Fixing the shutdown logic for streaming subscriber connection ([#1613](https://github.com/googleapis/java-pubsub/issues/1613)) ([09aff9c](https://github.com/googleapis/java-pubsub/commit/09aff9c59bab646c0bae857f3bca9dc8e9eeebd1)) + + +### Documentation + +* Adding pubsub emulator example ([#1602](https://github.com/googleapis/java-pubsub/issues/1602)) ([8ded110](https://github.com/googleapis/java-pubsub/commit/8ded11041c63f1f75f0612c081ba6b476b6b89b8)) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-bigquery to v2.27.0 ([#1599](https://github.com/googleapis/java-pubsub/issues/1599)) ([3b4b7d0](https://github.com/googleapis/java-pubsub/commit/3b4b7d0522d8eb136800dd546acb8880b8b28e9e)) +* Update dependency com.google.cloud:google-cloud-bigquery to v2.27.1 ([#1614](https://github.com/googleapis/java-pubsub/issues/1614)) ([a974e08](https://github.com/googleapis/java-pubsub/commit/a974e08b45d49ca275c19a4e94e66b4b831a0fad)) +* Update dependency com.google.cloud:google-cloud-bigquery to v2.28.0 ([#1626](https://github.com/googleapis/java-pubsub/issues/1626)) ([a4a02b4](https://github.com/googleapis/java-pubsub/commit/a4a02b4fd0a3827c3e321c56223731f0a828e8c5)) +* Update dependency com.google.cloud:google-cloud-core to v2.20.0 ([#1629](https://github.com/googleapis/java-pubsub/issues/1629)) ([5f88f4f](https://github.com/googleapis/java-pubsub/commit/5f88f4f5f6fd1c8f2c0e7523b6919a6a477d785c)) +* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.12.0 ([#1630](https://github.com/googleapis/java-pubsub/issues/1630)) ([b444a9d](https://github.com/googleapis/java-pubsub/commit/b444a9d825300519681a205a833ae9d816e89cf2)) +* Update dependency org.graalvm.buildtools:junit-platform-native to v0.9.23 ([#1623](https://github.com/googleapis/java-pubsub/issues/1623)) ([b5f8e49](https://github.com/googleapis/java-pubsub/commit/b5f8e4961dd473c98641d8b78c958db1e0e8d01e)) +* Update dependency org.graalvm.buildtools:native-maven-plugin to v0.9.23 ([#1624](https://github.com/googleapis/java-pubsub/issues/1624)) ([68ada24](https://github.com/googleapis/java-pubsub/commit/68ada243897a763e04d4858ad052050e09326371)) +* Update dependency org.xerial.snappy:snappy-java to v1.1.10.1 - abandoned ([#1616](https://github.com/googleapis/java-pubsub/issues/1616)) ([48ec282](https://github.com/googleapis/java-pubsub/commit/48ec282753f8068df135cee55febe5dba97be1b5)) +* Update dependency org.xerial.snappy:snappy-java to v1.1.10.1 [security] ([#1620](https://github.com/googleapis/java-pubsub/issues/1620)) ([a1cb267](https://github.com/googleapis/java-pubsub/commit/a1cb2673f5e6556472a87a0fb2acbc3e0ddfd933)) + +## [1.123.14](https://github.com/googleapis/java-pubsub/compare/v1.123.13...v1.123.14) (2023-06-12) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-core to v2.19.0 ([#1604](https://github.com/googleapis/java-pubsub/issues/1604)) ([7ac609e](https://github.com/googleapis/java-pubsub/commit/7ac609e44c20db73460fe39919439c3a2b597454)) +* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.11.0 ([#1605](https://github.com/googleapis/java-pubsub/issues/1605)) ([077ac04](https://github.com/googleapis/java-pubsub/commit/077ac04214be23f6693734c157925a5607ada869)) + +## [1.123.13](https://github.com/googleapis/java-pubsub/compare/v1.123.12...v1.123.13) (2023-05-30) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-bigquery to v2.26.0 ([#1582](https://github.com/googleapis/java-pubsub/issues/1582)) ([a7c09b7](https://github.com/googleapis/java-pubsub/commit/a7c09b763845fc78e5382f79365467d4bdb8a24d)) +* Update dependency com.google.cloud:google-cloud-bigquery to v2.26.1 ([#1585](https://github.com/googleapis/java-pubsub/issues/1585)) ([e2c37bf](https://github.com/googleapis/java-pubsub/commit/e2c37bfcee74a6f95cc3c15cf1f9d3d1602b77ff)) +* Update dependency com.google.cloud:google-cloud-core to v2.18.1 ([#1591](https://github.com/googleapis/java-pubsub/issues/1591)) ([1637f0d](https://github.com/googleapis/java-pubsub/commit/1637f0db2a89b20d28a6812b6abb4f36bfd46f80)) +* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.10.0 ([#1592](https://github.com/googleapis/java-pubsub/issues/1592)) ([a6be7b7](https://github.com/googleapis/java-pubsub/commit/a6be7b7870ba776fd9b39a0b16d45ba51fcc8ad6)) +* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.10.1 ([#1594](https://github.com/googleapis/java-pubsub/issues/1594)) ([52263ce](https://github.com/googleapis/java-pubsub/commit/52263ce63d4cbda649121e465f4bdc78bbfa8e44)) +* Update dependency org.xerial.snappy:snappy-java to v1.1.10.0 ([#1590](https://github.com/googleapis/java-pubsub/issues/1590)) ([338f31f](https://github.com/googleapis/java-pubsub/commit/338f31f96deb09fe93e1306986a7887d285a9d06)) + +## [1.123.12](https://github.com/googleapis/java-pubsub/compare/v1.123.11...v1.123.12) (2023-05-12) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-bigquery to v2.25.0 ([#1566](https://github.com/googleapis/java-pubsub/issues/1566)) ([7e63280](https://github.com/googleapis/java-pubsub/commit/7e632806b83b5c849ea50fdf3085b2db7bdbeff3)) +* Update dependency com.google.cloud:google-cloud-core to v2.17.0 ([#1574](https://github.com/googleapis/java-pubsub/issues/1574)) ([9c80f14](https://github.com/googleapis/java-pubsub/commit/9c80f1493a5149a76b55d9f1d178684e1b5dde80)) +* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.9.0 ([#1576](https://github.com/googleapis/java-pubsub/issues/1576)) ([03a027f](https://github.com/googleapis/java-pubsub/commit/03a027fb2619444511d25ef7100c7ac850c1dca1)) +* Update dependency org.easymock:easymock to v5.1.0 ([#1448](https://github.com/googleapis/java-pubsub/issues/1448)) ([5ad86fe](https://github.com/googleapis/java-pubsub/commit/5ad86fe783a2fcdfe6102a9916c65b1c4139b3da)) +* Update dependency org.graalvm.buildtools:junit-platform-native to v0.9.22 ([#1570](https://github.com/googleapis/java-pubsub/issues/1570)) ([bbe9a8b](https://github.com/googleapis/java-pubsub/commit/bbe9a8b6594a0e6b777ceb3b97e8d625446e34e4)) +* Update dependency org.graalvm.buildtools:native-maven-plugin to v0.9.22 ([#1571](https://github.com/googleapis/java-pubsub/issues/1571)) ([e7b62d3](https://github.com/googleapis/java-pubsub/commit/e7b62d35aa3c73f55a474d406da094ded02d07f1)) +* Update dependency org.xerial.snappy:snappy-java to v1.1.9.0 - abandoned ([#1471](https://github.com/googleapis/java-pubsub/issues/1471)) ([1620e00](https://github.com/googleapis/java-pubsub/commit/1620e00cf1632699fa37a78059dfb86e707dbccc)) +* Update dependency org.xerial.snappy:snappy-java to v1.1.9.1 ([#1572](https://github.com/googleapis/java-pubsub/issues/1572)) ([1ec2fec](https://github.com/googleapis/java-pubsub/commit/1ec2feca66ab8b29edf8f9dd0d4b8df8261e709a)) + +## [1.123.11](https://github.com/googleapis/java-pubsub/compare/v1.123.10...v1.123.11) (2023-04-27) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-core to v2.15.0 ([#1558](https://github.com/googleapis/java-pubsub/issues/1558)) ([acf0a4f](https://github.com/googleapis/java-pubsub/commit/acf0a4f1b893b5be19167e87b958e722e53b2aee)) +* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.8.0 ([#1561](https://github.com/googleapis/java-pubsub/issues/1561)) ([13bfd09](https://github.com/googleapis/java-pubsub/commit/13bfd09a9ba81e725a61f2b36c5d38fabcd8df56)) +* Update dependency org.junit.vintage:junit-vintage-engine to v5.9.3 ([#1563](https://github.com/googleapis/java-pubsub/issues/1563)) ([c2329d2](https://github.com/googleapis/java-pubsub/commit/c2329d289d3447e72904d20e9c89065b59d7e6de)) + +## [1.123.10](https://github.com/googleapis/java-pubsub/compare/v1.123.9...v1.123.10) (2023-04-17) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-bigquery to v2.24.5 ([#1555](https://github.com/googleapis/java-pubsub/issues/1555)) ([7d81b06](https://github.com/googleapis/java-pubsub/commit/7d81b063465f23b1779c2137bc1706dafdaea042)) +* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.7.0 ([#1551](https://github.com/googleapis/java-pubsub/issues/1551)) ([bccf566](https://github.com/googleapis/java-pubsub/commit/bccf566c6072aa34ebad451880835625217f9fe4)) + +## [1.123.9](https://github.com/googleapis/java-pubsub/compare/v1.123.8...v1.123.9) (2023-04-13) + + +### Dependencies + +* Update dependency org.graalvm.buildtools:junit-platform-native to v0.9.21 ([#1547](https://github.com/googleapis/java-pubsub/issues/1547)) ([e78f210](https://github.com/googleapis/java-pubsub/commit/e78f210c9b72b0b9fb561ef8f41eb1aa2d8be4d7)) +* Update dependency org.graalvm.buildtools:native-maven-plugin to v0.9.21 ([#1548](https://github.com/googleapis/java-pubsub/issues/1548)) ([42957f8](https://github.com/googleapis/java-pubsub/commit/42957f8c93a07c7db5e3f007644b9508ef9dfe73)) + +## [1.123.8](https://github.com/googleapis/java-pubsub/compare/v1.123.7...v1.123.8) (2023-04-04) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.6.0 ([#1541](https://github.com/googleapis/java-pubsub/issues/1541)) ([828db7c](https://github.com/googleapis/java-pubsub/commit/828db7cfde91284db019b85552d64ca92e8ebe07)) + +## [1.123.7](https://github.com/googleapis/java-pubsub/compare/v1.123.6...v1.123.7) (2023-03-21) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.5.0 ([#1532](https://github.com/googleapis/java-pubsub/issues/1532)) ([d63fba7](https://github.com/googleapis/java-pubsub/commit/d63fba73d5ea445144f625f7b67622351694c818)) + +## [1.123.6](https://github.com/googleapis/java-pubsub/compare/v1.123.5...v1.123.6) (2023-03-14) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-bigquery to v2.23.2 ([#1512](https://github.com/googleapis/java-pubsub/issues/1512)) ([60e889e](https://github.com/googleapis/java-pubsub/commit/60e889e587511cc948af440be7733dc4af531dd1)) + +## [1.123.5](https://github.com/googleapis/java-pubsub/compare/v1.123.4...v1.123.5) (2023-03-03) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-core to v2.12.0 ([#1509](https://github.com/googleapis/java-pubsub/issues/1509)) ([6f70d8a](https://github.com/googleapis/java-pubsub/commit/6f70d8a96577ac93647f4d13adc6b31889efeddf)) +* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.4.0 ([#1510](https://github.com/googleapis/java-pubsub/issues/1510)) ([0d0ece7](https://github.com/googleapis/java-pubsub/commit/0d0ece70f1527932abb04d9719de68a1367c5881)) + +## [1.123.4](https://github.com/googleapis/java-pubsub/compare/v1.123.3...v1.123.4) (2023-02-22) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-bigquery to v2.23.0 ([#1496](https://github.com/googleapis/java-pubsub/issues/1496)) ([713d727](https://github.com/googleapis/java-pubsub/commit/713d727db447f02e3c6cc7dfbb656fcebba54121)) + +## [1.123.3](https://github.com/googleapis/java-pubsub/compare/v1.123.2...v1.123.3) (2023-02-22) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-bigquery to v2.21.0 ([#1470](https://github.com/googleapis/java-pubsub/issues/1470)) ([105c293](https://github.com/googleapis/java-pubsub/commit/105c2933d3f71389e2629e4871767199fe53f7f4)) +* Update dependency com.google.cloud:google-cloud-bigquery to v2.22.0 ([#1489](https://github.com/googleapis/java-pubsub/issues/1489)) ([665436c](https://github.com/googleapis/java-pubsub/commit/665436cb9a0900fd62a6197e73baecf13de21597)) +* Update dependency com.google.cloud:google-cloud-core to v2.10.0 ([#1464](https://github.com/googleapis/java-pubsub/issues/1464)) ([8cab4e2](https://github.com/googleapis/java-pubsub/commit/8cab4e2f0b8455a30aa71a7915a836730ee7f059)) +* Update dependency com.google.cloud:google-cloud-core to v2.11.0 ([#1490](https://github.com/googleapis/java-pubsub/issues/1490)) ([c42474a](https://github.com/googleapis/java-pubsub/commit/c42474a8c1a98e7533edef47acf9c7210b99a56e)) +* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.3.0 ([#1491](https://github.com/googleapis/java-pubsub/issues/1491)) ([e5e3227](https://github.com/googleapis/java-pubsub/commit/e5e32273a515cf9ce22ffffb58a8f7a252556526)) +* Update dependency org.graalvm.buildtools:junit-platform-native to v0.9.20 ([#1484](https://github.com/googleapis/java-pubsub/issues/1484)) ([8206d12](https://github.com/googleapis/java-pubsub/commit/8206d129d819617a3dd8ebdab531d3fc7b7289f1)) +* Update dependency org.graalvm.buildtools:native-maven-plugin to v0.9.20 ([#1485](https://github.com/googleapis/java-pubsub/issues/1485)) ([d0e9b2a](https://github.com/googleapis/java-pubsub/commit/d0e9b2a8197f91029ae26fdec7e88f7ca38dab79)) + +## [1.123.2](https://github.com/googleapis/java-pubsub/compare/v1.123.1...v1.123.2) (2023-02-06) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.2.0 ([#1474](https://github.com/googleapis/java-pubsub/issues/1474)) ([5fccae4](https://github.com/googleapis/java-pubsub/commit/5fccae49f912a24c14d144fdcc9617d5a5ae110a)) + +## [1.123.1](https://github.com/googleapis/java-pubsub/compare/v1.123.0...v1.123.1) (2023-01-20) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-bigquery to v2.20.2 ([#1441](https://github.com/googleapis/java-pubsub/issues/1441)) ([a675556](https://github.com/googleapis/java-pubsub/commit/a67555664a070eb03b6f8bb7115e32e2b9d9a11a)) +* Update dependency com.google.cloud:google-cloud-core to v2.9.2 ([#1449](https://github.com/googleapis/java-pubsub/issues/1449)) ([e68c9e0](https://github.com/googleapis/java-pubsub/commit/e68c9e0e0808c441e04049154fb0c44f42fed562)) +* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.1.2 ([#1463](https://github.com/googleapis/java-pubsub/issues/1463)) ([e9e6649](https://github.com/googleapis/java-pubsub/commit/e9e664951b027979969e983c7e525aff6e4ddc68)) +* Update dependency com.google.protobuf:protobuf-java-util to v3.21.12 ([#1437](https://github.com/googleapis/java-pubsub/issues/1437)) ([88f7a99](https://github.com/googleapis/java-pubsub/commit/88f7a991c43e6358ccc3ad248473400a2a0e50e8)) +* Update dependency org.junit.vintage:junit-vintage-engine to v5.9.2 ([#1451](https://github.com/googleapis/java-pubsub/issues/1451)) ([054572a](https://github.com/googleapis/java-pubsub/commit/054572a86ecc2cedcdbcf3eae8c9fb07caed504a)) + +## [1.123.0](https://github.com/googleapis/java-pubsub/compare/v1.122.2...v1.123.0) (2023-01-10) + + +### Features + +* Add schema evolution methods and fields ([#1384](https://github.com/googleapis/java-pubsub/issues/1384)) ([746a6e0](https://github.com/googleapis/java-pubsub/commit/746a6e040eb94d73bfbaece051d08c60c9885326)) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.1.1 ([#1450](https://github.com/googleapis/java-pubsub/issues/1450)) ([2dcbcad](https://github.com/googleapis/java-pubsub/commit/2dcbcadfa56282733ab7998ec9cf360f0a71eaca)) + +## [1.122.2](https://github.com/googleapis/java-pubsub/compare/v1.122.1...v1.122.2) (2022-12-15) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-core to v2.9.0 ([#1435](https://github.com/googleapis/java-pubsub/issues/1435)) ([786c493](https://github.com/googleapis/java-pubsub/commit/786c49303bc196e548b00ef0cf39d766e8fd71a8)) +* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.1.0 ([#1436](https://github.com/googleapis/java-pubsub/issues/1436)) ([a40337b](https://github.com/googleapis/java-pubsub/commit/a40337b493454d20a12f70b7817de7b0f2584b84)) + +## [1.122.1](https://github.com/googleapis/java-pubsub/compare/v1.122.0...v1.122.1) (2022-12-02) + + +### Dependencies + +* Update dependency org.graalvm.buildtools:junit-platform-native to v0.9.19 ([#1428](https://github.com/googleapis/java-pubsub/issues/1428)) ([bfa9c3d](https://github.com/googleapis/java-pubsub/commit/bfa9c3d5f8f7b0d3103fe5d398ed3f753e1bedca)) +* Update dependency org.graalvm.buildtools:native-maven-plugin to v0.9.19 ([#1429](https://github.com/googleapis/java-pubsub/issues/1429)) ([d3c44e7](https://github.com/googleapis/java-pubsub/commit/d3c44e77532068e53d7d64dd182295ab6b9644bd)) + +## [1.122.0](https://github.com/googleapis/java-pubsub/compare/v1.121.1...v1.122.0) (2022-12-01) + + +### Features + +* Next release from main branch is 1.122.0 ([#1409](https://github.com/googleapis/java-pubsub/issues/1409)) ([dad2c82](https://github.com/googleapis/java-pubsub/commit/dad2c82cc22ed40def105514a4bc8446375dc70e)) + + +### Dependencies + +* Update dependency com.google.protobuf:protobuf-java-util to v3.21.10 ([#1425](https://github.com/googleapis/java-pubsub/issues/1425)) ([39c22cb](https://github.com/googleapis/java-pubsub/commit/39c22cb99dadd1dea874e0a57cf2c9fb0dd67328)) + +## [1.121.1](https://github.com/googleapis/java-pubsub/compare/v1.121.0...v1.121.1) (2022-11-21) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-bigquery to v2.18.0 ([#1375](https://github.com/googleapis/java-pubsub/issues/1375)) ([b6ada4e](https://github.com/googleapis/java-pubsub/commit/b6ada4e06397d785b6747bd989fe6cd9d6e76801)) +* Update dependency com.google.cloud:google-cloud-bigquery to v2.19.1 ([#1416](https://github.com/googleapis/java-pubsub/issues/1416)) ([e140a49](https://github.com/googleapis/java-pubsub/commit/e140a4975a5bff4c73254784409f4f3dda27db09)) +* Update dependency org.graalvm.buildtools:junit-platform-native to v0.9.18 ([#1413](https://github.com/googleapis/java-pubsub/issues/1413)) ([b3fb828](https://github.com/googleapis/java-pubsub/commit/b3fb828480f491e4275adf0b6367aeb51ac0569e)) +* Update dependency org.graalvm.buildtools:native-maven-plugin to v0.9.18 ([#1414](https://github.com/googleapis/java-pubsub/issues/1414)) ([74d2dc3](https://github.com/googleapis/java-pubsub/commit/74d2dc3329f6d4e33c977fa1e73df1aca278b9b3)) + +## [1.121.0](https://github.com/googleapis/java-pubsub/compare/v1.120.25...v1.121.0) (2022-11-16) + + +### Features + +* Next release from main branch is 1.121.0 ([#1406](https://github.com/googleapis/java-pubsub/issues/1406)) ([1b25b0e](https://github.com/googleapis/java-pubsub/commit/1b25b0e01a7b1068dbebaa5d6516419c11e31b96)) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-core to v2.8.28 ([#1399](https://github.com/googleapis/java-pubsub/issues/1399)) ([ec1cae8](https://github.com/googleapis/java-pubsub/commit/ec1cae87596921078478ed96a22b9ca5b138f729)) +* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.0.6 ([#1395](https://github.com/googleapis/java-pubsub/issues/1395)) ([a3c32ea](https://github.com/googleapis/java-pubsub/commit/a3c32eadb8e6d4ce730f2f2d1f8960ccd6269ecb)) + +## [1.120.25](https://github.com/googleapis/java-pubsub/compare/v1.120.24...v1.120.25) (2022-11-09) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-core to v2.8.27 ([#1391](https://github.com/googleapis/java-pubsub/issues/1391)) ([dd9f1c3](https://github.com/googleapis/java-pubsub/commit/dd9f1c366c9aa5f78dccc01a4dc3e2ee42290be3)) +* Update dependency com.google.protobuf:protobuf-java-util to v3.21.9 ([#1370](https://github.com/googleapis/java-pubsub/issues/1370)) ([8b753a4](https://github.com/googleapis/java-pubsub/commit/8b753a452a3f778402b61565d38a9a2ce90f084a)) +* Update dependency org.graalvm.buildtools:junit-platform-native to v0.9.17 ([#1389](https://github.com/googleapis/java-pubsub/issues/1389)) ([6def6bb](https://github.com/googleapis/java-pubsub/commit/6def6bbff8c31af6a008fee89654a13b0db1550f)) +* Update dependency org.graalvm.buildtools:native-maven-plugin to v0.9.17 ([#1388](https://github.com/googleapis/java-pubsub/issues/1388)) ([0924923](https://github.com/googleapis/java-pubsub/commit/0924923039e30716d66ad8ca519fbdae88946807)) + +## [1.120.24](https://github.com/googleapis/java-pubsub/compare/v1.120.23...v1.120.24) (2022-10-28) + + +### Bug Fixes + +* Adding an explicit check to prevent empty publishes ([#1376](https://github.com/googleapis/java-pubsub/issues/1376)) ([689d7da](https://github.com/googleapis/java-pubsub/commit/689d7da1fee7c7def401ba114feef3607cd12cf5)) + +## [1.120.23](https://github.com/googleapis/java-pubsub/compare/v1.120.22...v1.120.23) (2022-10-27) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-core to v2.8.22 ([#1361](https://github.com/googleapis/java-pubsub/issues/1361)) ([0355868](https://github.com/googleapis/java-pubsub/commit/03558680b9fb6493c2c3f1f4b65d8a35668b440f)) +* Update dependency com.google.cloud:google-cloud-core to v2.8.24 ([#1368](https://github.com/googleapis/java-pubsub/issues/1368)) ([9776aad](https://github.com/googleapis/java-pubsub/commit/9776aad7391544b1e0bd2fbe8576180206943bef)) +* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.0.5 ([#1362](https://github.com/googleapis/java-pubsub/issues/1362)) ([d32c591](https://github.com/googleapis/java-pubsub/commit/d32c591af87b66d8ca9df599ad18183aae31bf15)) +* Update dependency com.google.protobuf:protobuf-java-util to v3.21.8 ([#1356](https://github.com/googleapis/java-pubsub/issues/1356)) ([dc1e0ca](https://github.com/googleapis/java-pubsub/commit/dc1e0ca44c3668d7c9e780d50261dd81ce1d4ee9)) +* Update dependency org.easymock:easymock to v5.0.1 ([#1365](https://github.com/googleapis/java-pubsub/issues/1365)) ([2a807a5](https://github.com/googleapis/java-pubsub/commit/2a807a5b319ed3821da7dac84e4cb4923d07fed7)) +* Update dependency org.graalvm.buildtools:junit-platform-native to v0.9.16 ([#1358](https://github.com/googleapis/java-pubsub/issues/1358)) ([226e105](https://github.com/googleapis/java-pubsub/commit/226e1050b0b643cea46bad7cf77d2a9e8857fb02)) +* Update dependency org.graalvm.buildtools:native-maven-plugin to v0.9.16 ([#1359](https://github.com/googleapis/java-pubsub/issues/1359)) ([3f10227](https://github.com/googleapis/java-pubsub/commit/3f10227cfd7d9029e92e7575771544c7e4b4dd67)) + +## [1.120.22](https://github.com/googleapis/java-pubsub/compare/v1.120.21...v1.120.22) (2022-10-18) + + +### Dependencies + +* Update dependency org.easymock:easymock to v5 ([#1350](https://github.com/googleapis/java-pubsub/issues/1350)) ([1e88543](https://github.com/googleapis/java-pubsub/commit/1e88543393ac16a79288c80d3561f7e5c50f11af)) +* Update dependency org.graalvm.buildtools:junit-platform-native to v0.9.15 ([#1351](https://github.com/googleapis/java-pubsub/issues/1351)) ([2af7579](https://github.com/googleapis/java-pubsub/commit/2af757971fd54855936ad95e0cd3f6ab13d50edc)) +* Update dependency org.graalvm.buildtools:native-maven-plugin to v0.9.15 ([#1352](https://github.com/googleapis/java-pubsub/issues/1352)) ([379e39b](https://github.com/googleapis/java-pubsub/commit/379e39bdb6ed3cd50c5f034fb5ecd40905b43bda)) + +## [1.120.21](https://github.com/googleapis/java-pubsub/compare/v1.120.20...v1.120.21) (2022-10-14) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-bigquery to v2.17.0 ([#1334](https://github.com/googleapis/java-pubsub/issues/1334)) ([d2edb44](https://github.com/googleapis/java-pubsub/commit/d2edb4457a5a5fdee006b34b1de265b7e73a26e1)) +* Update dependency com.google.cloud:google-cloud-bigquery to v2.17.1 ([#1340](https://github.com/googleapis/java-pubsub/issues/1340)) ([2b9c2e8](https://github.com/googleapis/java-pubsub/commit/2b9c2e8af4f83dd8d51272a0539c7ade05041a68)) +* Update dependency com.google.cloud:google-cloud-core to v2.8.21 ([#1341](https://github.com/googleapis/java-pubsub/issues/1341)) ([d219a56](https://github.com/googleapis/java-pubsub/commit/d219a56de3c5a3e5455c3ca063bf0e363a4c476a)) +* Update dependency org.graalvm.buildtools:junit-platform-native to v0.9.14 ([#1296](https://github.com/googleapis/java-pubsub/issues/1296)) ([00f61aa](https://github.com/googleapis/java-pubsub/commit/00f61aab905300986945bb67a8737779c3f72da6)) + +## [1.120.20](https://github.com/googleapis/java-pubsub/compare/v1.120.19...v1.120.20) (2022-10-05) + + +### Bug Fixes + +* update protobuf to v3.21.7 ([7c3ea60](https://github.com/googleapis/java-pubsub/commit/7c3ea6016e4288beab722a0c53c5ea132794e2bd)) + +## [1.120.19](https://github.com/googleapis/java-pubsub/compare/v1.120.18...v1.120.19) (2022-10-03) + + +### Dependencies + +* Update dependency cachetools to v5 ([#1324](https://github.com/googleapis/java-pubsub/issues/1324)) ([72b6d5f](https://github.com/googleapis/java-pubsub/commit/72b6d5f7ce6b464c1f1653699178e989c7eb6a75)) +* Update dependency certifi to v2022.9.24 ([#1303](https://github.com/googleapis/java-pubsub/issues/1303)) ([dc05237](https://github.com/googleapis/java-pubsub/commit/dc052371a1a83a194cb0098f93a8e8dd57d8e5d4)) +* Update dependency charset-normalizer to v2.1.1 ([#1308](https://github.com/googleapis/java-pubsub/issues/1308)) ([fedf2e1](https://github.com/googleapis/java-pubsub/commit/fedf2e1f98bf77de6d6cac18e745819e8250df57)) +* Update dependency click to v8.1.3 ([#1309](https://github.com/googleapis/java-pubsub/issues/1309)) ([0ddcb5b](https://github.com/googleapis/java-pubsub/commit/0ddcb5b324ecc4e3a8cc98bc2ef0d210061a79d5)) +* Update dependency com.google.cloud:google-cloud-core to v2.8.15 ([#1299](https://github.com/googleapis/java-pubsub/issues/1299)) ([11f220c](https://github.com/googleapis/java-pubsub/commit/11f220ca32bf82c87746837e12ae878ee9578704)) +* Update dependency com.google.cloud:google-cloud-core to v2.8.16 ([#1301](https://github.com/googleapis/java-pubsub/issues/1301)) ([186c794](https://github.com/googleapis/java-pubsub/commit/186c79497057847aa577b47d169e3535274b0a2d)) +* Update dependency com.google.cloud:google-cloud-core to v2.8.17 ([#1326](https://github.com/googleapis/java-pubsub/issues/1326)) ([361a2f2](https://github.com/googleapis/java-pubsub/commit/361a2f2ae44098d280c1244479954638d4321a69)) +* Update dependency com.google.cloud:google-cloud-core to v2.8.18 ([#1328](https://github.com/googleapis/java-pubsub/issues/1328)) ([ae23532](https://github.com/googleapis/java-pubsub/commit/ae23532092c80e3b4abe8e1b51f2ef67bb991428)) +* Update dependency com.google.cloud:google-cloud-core to v2.8.20 ([#1329](https://github.com/googleapis/java-pubsub/issues/1329)) ([c37b88e](https://github.com/googleapis/java-pubsub/commit/c37b88e209dd1d58035385676d7c1dfca0da2c4e)) +* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.0.4 ([#1330](https://github.com/googleapis/java-pubsub/issues/1330)) ([0f6cc6c](https://github.com/googleapis/java-pubsub/commit/0f6cc6c01e6afeb717487e7435575d243bd0203d)) +* Update dependency com.google.protobuf:protobuf-java-util to v3.21.7 ([#1327](https://github.com/googleapis/java-pubsub/issues/1327)) ([6355eb0](https://github.com/googleapis/java-pubsub/commit/6355eb0ed1fa94a36fbb0169e4b6dc7faed165ff)) +* Update dependency gcp-releasetool to v1.8.8 ([#1304](https://github.com/googleapis/java-pubsub/issues/1304)) ([1c7c6eb](https://github.com/googleapis/java-pubsub/commit/1c7c6eb10a184919d36f7738f4594cd7aff9f87b)) +* Update dependency google-api-core to v2.10.1 ([#1310](https://github.com/googleapis/java-pubsub/issues/1310)) ([14725f2](https://github.com/googleapis/java-pubsub/commit/14725f248082c4397b0058d25984a61a9bf2c5c9)) +* Update dependency google-auth to v2.11.1 ([#1305](https://github.com/googleapis/java-pubsub/issues/1305)) ([a6954d1](https://github.com/googleapis/java-pubsub/commit/a6954d1cf17cb0247e5e153001ec983fb957b410)) +* Update dependency google-auth to v2.12.0 ([#1313](https://github.com/googleapis/java-pubsub/issues/1313)) ([ffcebe4](https://github.com/googleapis/java-pubsub/commit/ffcebe43542d4ab3b2cea1c2dcb5e6b345c4905b)) +* Update dependency google-cloud-core to v2.3.2 ([#1306](https://github.com/googleapis/java-pubsub/issues/1306)) ([fbb4460](https://github.com/googleapis/java-pubsub/commit/fbb44605794a350889ae300f697b76ed9ff41af2)) +* Update dependency importlib-metadata to v4.12.0 ([#1314](https://github.com/googleapis/java-pubsub/issues/1314)) ([e319df0](https://github.com/googleapis/java-pubsub/commit/e319df0bce76b1d8ba25b410225377d624070926)) +* Update dependency jeepney to v0.8.0 ([#1315](https://github.com/googleapis/java-pubsub/issues/1315)) ([5ed336e](https://github.com/googleapis/java-pubsub/commit/5ed336ef0b29fa89a1a508fbc2d3870b5ecff6d3)) +* Update dependency jinja2 to v3.1.2 ([#1316](https://github.com/googleapis/java-pubsub/issues/1316)) ([14ecdc6](https://github.com/googleapis/java-pubsub/commit/14ecdc6f3492e404957f1b16744a4928198d9e92)) +* Update dependency keyring to v23.9.3 ([#1317](https://github.com/googleapis/java-pubsub/issues/1317)) ([3e783d4](https://github.com/googleapis/java-pubsub/commit/3e783d47e8face65ef33b5bc7ca0bf7f0e35ca02)) +* Update dependency markupsafe to v2.1.1 ([#1318](https://github.com/googleapis/java-pubsub/issues/1318)) ([ecd9c76](https://github.com/googleapis/java-pubsub/commit/ecd9c76e2a9cce5c7f9dd6e9a8b84f748f69666a)) +* Update dependency org.graalvm.buildtools:native-maven-plugin to v0.9.14 ([#1297](https://github.com/googleapis/java-pubsub/issues/1297)) ([7e7ce60](https://github.com/googleapis/java-pubsub/commit/7e7ce60533386afdcd1b313603c468125ad0cb7d)) +* Update dependency protobuf to v3.20.2 ([#1319](https://github.com/googleapis/java-pubsub/issues/1319)) ([f5123fa](https://github.com/googleapis/java-pubsub/commit/f5123fa69ec7ac191d13c86823d105332853d944)) +* Update dependency pyjwt to v2.5.0 ([#1320](https://github.com/googleapis/java-pubsub/issues/1320)) ([a568462](https://github.com/googleapis/java-pubsub/commit/a568462b971908eb3424c9bbb5f49a6543c80fd3)) +* Update dependency requests to v2.28.1 ([#1321](https://github.com/googleapis/java-pubsub/issues/1321)) ([41b105a](https://github.com/googleapis/java-pubsub/commit/41b105a798aa9bcf2ce7ccde34efe119e76d963b)) +* Update dependency typing-extensions to v4.3.0 ([#1322](https://github.com/googleapis/java-pubsub/issues/1322)) ([288cd7e](https://github.com/googleapis/java-pubsub/commit/288cd7eaf90e219c735a89822e3858085e8423fd)) +* Update dependency zipp to v3.8.1 ([#1323](https://github.com/googleapis/java-pubsub/issues/1323)) ([e78a284](https://github.com/googleapis/java-pubsub/commit/e78a284cf07b9bac56087bbbb9f940ee976a3b4a)) + +## [1.120.18](https://github.com/googleapis/java-pubsub/compare/v1.120.17...v1.120.18) (2022-09-21) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-core to v2.8.13 ([#1288](https://github.com/googleapis/java-pubsub/issues/1288)) ([708a1df](https://github.com/googleapis/java-pubsub/commit/708a1df692b64d86915133ac4ae87e45f4d669d8)) +* Update dependency com.google.cloud:google-cloud-core to v2.8.14 ([#1291](https://github.com/googleapis/java-pubsub/issues/1291)) ([1c479de](https://github.com/googleapis/java-pubsub/commit/1c479de525a28fc323697d9a4e92f6ee3215a18f)) +* Update dependency org.junit.vintage:junit-vintage-engine to v5.9.1 ([#1289](https://github.com/googleapis/java-pubsub/issues/1289)) ([216ba7d](https://github.com/googleapis/java-pubsub/commit/216ba7db4f0fab29c4bf9fc785387b23f64beb5e)) + +## [1.120.17](https://github.com/googleapis/java-pubsub/compare/v1.120.16...v1.120.17) (2022-09-20) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-bigquery to v2.16.1 ([#1281](https://github.com/googleapis/java-pubsub/issues/1281)) ([aca8ee9](https://github.com/googleapis/java-pubsub/commit/aca8ee98dc74ecc53045f7b84326d85406163338)) +* Update dependency com.google.cloud:google-cloud-core to v2.8.12 ([#1278](https://github.com/googleapis/java-pubsub/issues/1278)) ([4ae1156](https://github.com/googleapis/java-pubsub/commit/4ae115666ba195dca90171a7e1ff81bb6cfcf123)) +* Update dependency com.google.protobuf:protobuf-java-util to v3.21.6 ([#1277](https://github.com/googleapis/java-pubsub/issues/1277)) ([a5aa281](https://github.com/googleapis/java-pubsub/commit/a5aa281787b7a92516ebcc7654d419d9cbd5abc3)) + +## [1.120.16](https://github.com/googleapis/java-pubsub/compare/v1.120.15...v1.120.16) (2022-09-15) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.0.3 ([#1279](https://github.com/googleapis/java-pubsub/issues/1279)) ([654ea40](https://github.com/googleapis/java-pubsub/commit/654ea400f5df0b2544f4b668e1f5ee72f3ea54d2)) + +## [1.120.15](https://github.com/googleapis/java-pubsub/compare/v1.120.14...v1.120.15) (2022-09-13) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-bigquery to v2.16.0 ([#1271](https://github.com/googleapis/java-pubsub/issues/1271)) ([439215a](https://github.com/googleapis/java-pubsub/commit/439215aaee1572859d323139c7a86e086a331486)) + +## [1.120.14](https://github.com/googleapis/java-pubsub/compare/v1.120.13...v1.120.14) (2022-09-10) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-bigquery to v2.15.0 ([#1259](https://github.com/googleapis/java-pubsub/issues/1259)) ([257cb8f](https://github.com/googleapis/java-pubsub/commit/257cb8f1b38a885dc4c8fb473a79fee1f01a2b57)) +* Update dependency com.google.cloud:google-cloud-core to v2.8.10 ([#1258](https://github.com/googleapis/java-pubsub/issues/1258)) ([37e0034](https://github.com/googleapis/java-pubsub/commit/37e0034660855fc327d3843f8aa78bcda03fe158)) +* Update dependency com.google.cloud:google-cloud-core to v2.8.11 ([#1264](https://github.com/googleapis/java-pubsub/issues/1264)) ([a19bc7a](https://github.com/googleapis/java-pubsub/commit/a19bc7a6bd54a9223575c23df1cac7b2583eb61a)) +* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.0.2 ([#1265](https://github.com/googleapis/java-pubsub/issues/1265)) ([52da9da](https://github.com/googleapis/java-pubsub/commit/52da9dae19399e03af8d20c0c29aa600b7e31ed3)) + +## [1.120.13](https://github.com/googleapis/java-pubsub/compare/v1.120.12...v1.120.13) (2022-08-24) + + +### Dependencies + +* update dependency com.google.cloud:google-cloud-bigquery to v2.14.7 ([#1254](https://github.com/googleapis/java-pubsub/issues/1254)) ([775c993](https://github.com/googleapis/java-pubsub/commit/775c99353d96bcbc0704626999a7af79cf0e557f)) + +## [1.120.12](https://github.com/googleapis/java-pubsub/compare/v1.120.11...v1.120.12) (2022-08-18) + + +### Dependencies + +* update dependency com.google.cloud:google-cloud-bigquery to v2.14.4 ([#1242](https://github.com/googleapis/java-pubsub/issues/1242)) ([08cfe80](https://github.com/googleapis/java-pubsub/commit/08cfe805e71831e040f63755acde17ec45c21418)) +* update dependency com.google.cloud:google-cloud-bigquery to v2.14.6 ([#1245](https://github.com/googleapis/java-pubsub/issues/1245)) ([7f933ee](https://github.com/googleapis/java-pubsub/commit/7f933ee35055c608e9f5b72251583060943a79ea)) +* update dependency com.google.cloud:google-cloud-core to v2.8.9 ([#1250](https://github.com/googleapis/java-pubsub/issues/1250)) ([7c8fd41](https://github.com/googleapis/java-pubsub/commit/7c8fd4183523b876983c89d4b7994746b11964c3)) +* update dependency com.google.protobuf:protobuf-java-util to v3.21.5 ([#1243](https://github.com/googleapis/java-pubsub/issues/1243)) ([37eaff8](https://github.com/googleapis/java-pubsub/commit/37eaff859422bb215ace202ffd0adf8a651dadb5)) + +## [1.120.11](https://github.com/googleapis/java-pubsub/compare/v1.120.10...v1.120.11) (2022-08-06) + + +### Bug Fixes + +* fix dependency declaration to properly include runtime scope ([#1238](https://github.com/googleapis/java-pubsub/issues/1238)) ([e9a4ce5](https://github.com/googleapis/java-pubsub/commit/e9a4ce59fdf3773fa41698579984af525a277f38)) + + +### Dependencies + +* update dependency com.google.cloud:google-cloud-bigquery to v2.14.2 ([#1235](https://github.com/googleapis/java-pubsub/issues/1235)) ([e2af6c3](https://github.com/googleapis/java-pubsub/commit/e2af6c358ef9e7a0d35179bc4a7c793bbc6a0960)) +* update dependency com.google.cloud:google-cloud-bigquery to v2.14.3 ([#1236](https://github.com/googleapis/java-pubsub/issues/1236)) ([399e8d7](https://github.com/googleapis/java-pubsub/commit/399e8d71d5b4aed2fa48e8cba2dce963d25693e3)) + +## [1.120.10](https://github.com/googleapis/java-pubsub/compare/v1.120.9...v1.120.10) (2022-08-04) + + +### Dependencies + +* update dependency com.google.cloud:google-cloud-core to v2.8.8 ([#1231](https://github.com/googleapis/java-pubsub/issues/1231)) ([9d13dd8](https://github.com/googleapis/java-pubsub/commit/9d13dd8bc43e24815884dde421409136958d4b0f)) + +## [1.120.9](https://github.com/googleapis/java-pubsub/compare/v1.120.8...v1.120.9) (2022-08-03) + + +### Dependencies + +* update dependency com.google.cloud:google-cloud-core to v2.8.7 ([#1227](https://github.com/googleapis/java-pubsub/issues/1227)) ([e967b2c](https://github.com/googleapis/java-pubsub/commit/e967b2c393a601c7e9dfba33ec2f19ef6e9757c1)) +* update dependency com.google.cloud:google-cloud-shared-dependencies to v3.0.1 ([#1226](https://github.com/googleapis/java-pubsub/issues/1226)) ([8fab566](https://github.com/googleapis/java-pubsub/commit/8fab566e2b0ff726bd9a1dff842b11f5c6c9b00b)) + +## [1.120.8](https://github.com/googleapis/java-pubsub/compare/v1.120.7...v1.120.8) (2022-08-02) + + +### Dependencies + +* update dependency com.google.cloud:google-cloud-core to v2.8.6 ([#1222](https://github.com/googleapis/java-pubsub/issues/1222)) ([55eebf5](https://github.com/googleapis/java-pubsub/commit/55eebf55785a700a67dc3a97b21837acf14d9a64)) + +## [1.120.7](https://github.com/googleapis/java-pubsub/compare/v1.120.6...v1.120.7) (2022-08-01) + + +### Bug Fixes + +* Updated log level from WARNING -> INFO for EOD failures ([#1218](https://github.com/googleapis/java-pubsub/issues/1218)) ([8782533](https://github.com/googleapis/java-pubsub/commit/8782533204fcc312c1063763f5073db83c72382f)) + +## [1.120.6](https://github.com/googleapis/java-pubsub/compare/v1.120.5...v1.120.6) (2022-08-01) + + +### Dependencies + +* update dependency com.google.cloud:google-cloud-bigquery to v2.14.1 ([#1215](https://github.com/googleapis/java-pubsub/issues/1215)) ([5667492](https://github.com/googleapis/java-pubsub/commit/56674928f2e671487c8d4c0dad4e45368da47e0e)) +* update dependency com.google.cloud:google-cloud-core to v2.8.5 ([#1213](https://github.com/googleapis/java-pubsub/issues/1213)) ([5db0c2c](https://github.com/googleapis/java-pubsub/commit/5db0c2cafcf27a80ac4e18c623fc22c2af252774)) +* update dependency com.google.protobuf:protobuf-java-util to v3.21.4 ([#1214](https://github.com/googleapis/java-pubsub/issues/1214)) ([bfc53d9](https://github.com/googleapis/java-pubsub/commit/bfc53d9fb616b4ee22e2c39dbaf1eed7354142a7)) +* update dependency org.apache.avro:avro to v1.11.1 ([#1210](https://github.com/googleapis/java-pubsub/issues/1210)) ([fafcded](https://github.com/googleapis/java-pubsub/commit/fafcdede6b4e5ef5098b8b04a53d9e42b59cda3d)) + +## [1.120.5](https://github.com/googleapis/java-pubsub/compare/v1.120.4...v1.120.5) (2022-07-30) + + +### Dependencies + +* update dependency com.google.cloud:google-cloud-shared-dependencies to v3 ([#1207](https://github.com/googleapis/java-pubsub/issues/1207)) ([d355509](https://github.com/googleapis/java-pubsub/commit/d355509be963b7d2c357d2c9dd3f97eaa5fd8717)) + +## [1.120.4](https://github.com/googleapis/java-pubsub/compare/v1.120.3...v1.120.4) (2022-07-29) + + +### Bug Fixes + +* updating return types of ack/nack futures to be consistent with publish ([#1204](https://github.com/googleapis/java-pubsub/issues/1204)) ([6e73ab9](https://github.com/googleapis/java-pubsub/commit/6e73ab9618f61ee1915e52abe3b80e356bc3c13f)) + +## [1.120.3](https://github.com/googleapis/java-pubsub/compare/v1.120.2...v1.120.3) (2022-07-27) + + +### Dependencies + +* update dependency org.junit.vintage:junit-vintage-engine to v5.9.0 ([#1201](https://github.com/googleapis/java-pubsub/issues/1201)) ([f18e562](https://github.com/googleapis/java-pubsub/commit/f18e5628f54b0ae6858cd046a11824a1698c50c6)) + +## [1.120.2](https://github.com/googleapis/java-pubsub/compare/v1.120.1...v1.120.2) (2022-07-25) + + +### Bug Fixes + +* enable longpaths support for windows test ([#1485](https://github.com/googleapis/java-pubsub/issues/1485)) ([#1191](https://github.com/googleapis/java-pubsub/issues/1191)) ([c4b8d90](https://github.com/googleapis/java-pubsub/commit/c4b8d90a158a3360d626df8ca6378212e09f5a47)) +* PubSubMessage leak on MessageDispatcher ([#1197](https://github.com/googleapis/java-pubsub/issues/1197)) ([1b8c440](https://github.com/googleapis/java-pubsub/commit/1b8c440fccc51dc2291c43b2972b1f5c08dfd65a)) + + +### Dependencies + +* update dependency org.graalvm.buildtools:junit-platform-native to v0.9.13 ([#1189](https://github.com/googleapis/java-pubsub/issues/1189)) ([0d96f8e](https://github.com/googleapis/java-pubsub/commit/0d96f8e2006c145de039d2f00c5eb1d8830eae3d)) +* update dependency org.graalvm.buildtools:native-maven-plugin to v0.9.13 ([#1190](https://github.com/googleapis/java-pubsub/issues/1190)) ([c604080](https://github.com/googleapis/java-pubsub/commit/c6040802bcf97d063e2b91cdb5fa7fe3c3e3b807)) + +## [1.120.1](https://github.com/googleapis/java-pubsub/compare/v1.120.0...v1.120.1) (2022-07-11) + + +### Dependencies + +* update dependency com.google.cloud:google-cloud-bigquery to v2.13.8 ([#1179](https://github.com/googleapis/java-pubsub/issues/1179)) ([5fc8f86](https://github.com/googleapis/java-pubsub/commit/5fc8f86b30cafaba1acde6f1f807b345e3b3b953)) +* update dependency com.google.cloud:google-cloud-core to v2.8.1 ([#1178](https://github.com/googleapis/java-pubsub/issues/1178)) ([0052a6c](https://github.com/googleapis/java-pubsub/commit/0052a6c093030eaefa412cb0a8e35787a9b35c01)) +* update dependency com.google.protobuf:protobuf-java-util to v3.21.2 ([#1176](https://github.com/googleapis/java-pubsub/issues/1176)) ([8ffe189](https://github.com/googleapis/java-pubsub/commit/8ffe189170e58cab1de630c41cab6cd8346f98b0)) + +## [1.120.0](https://github.com/googleapis/java-pubsub/compare/v1.119.1...v1.120.0) (2022-06-30) + + +### Features + +* Enable REST transport for most of Java and Go clients ([#1162](https://github.com/googleapis/java-pubsub/issues/1162)) ([c8ebb13](https://github.com/googleapis/java-pubsub/commit/c8ebb1319b7714c03308d8e7af53912b6b6a0d44)) + + +### Documentation + +* **sample:** clean up README of native image sample ([#1166](https://github.com/googleapis/java-pubsub/issues/1166)) ([890987c](https://github.com/googleapis/java-pubsub/commit/890987c0b285c9c5a5224f676e070ceefb90fe02)) + + +### Dependencies + +* update dependency com.google.cloud:google-cloud-bigquery to v2.13.5 ([#1172](https://github.com/googleapis/java-pubsub/issues/1172)) ([51f4da0](https://github.com/googleapis/java-pubsub/commit/51f4da048e298e6184e9a6bf931a9f1307534c61)) +* update dependency com.google.cloud:google-cloud-bigquery to v2.13.6 ([#1175](https://github.com/googleapis/java-pubsub/issues/1175)) ([9385452](https://github.com/googleapis/java-pubsub/commit/938545266b6b15f93fe82aa253b55ca4d4fd7e22)) +* update dependency com.google.cloud:google-cloud-core to v2.8.0 ([#1171](https://github.com/googleapis/java-pubsub/issues/1171)) ([4b7888f](https://github.com/googleapis/java-pubsub/commit/4b7888f582752982e2c9e1fd03472f5172fa9910)) +* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.13.0 ([#1173](https://github.com/googleapis/java-pubsub/issues/1173)) ([925be09](https://github.com/googleapis/java-pubsub/commit/925be095bd8a227f4b49d357dcd386b4149a86f9)) +* update dependency org.graalvm.buildtools:junit-platform-native to v0.9.12 ([#1169](https://github.com/googleapis/java-pubsub/issues/1169)) ([e8e93e6](https://github.com/googleapis/java-pubsub/commit/e8e93e6c47e2c0a3546453a3aa23263ff3878a55)) +* update dependency org.graalvm.buildtools:native-maven-plugin to v0.9.12 ([#1170](https://github.com/googleapis/java-pubsub/issues/1170)) ([1327e89](https://github.com/googleapis/java-pubsub/commit/1327e89e2e491afe0b05fb458bbea296a8ae101f)) + +## [1.119.1](https://github.com/googleapis/java-pubsub/compare/v1.119.0...v1.119.1) (2022-06-06) + + +### Dependencies + +* update dependency com.google.protobuf:protobuf-java-util to v3.21.0 ([#1152](https://github.com/googleapis/java-pubsub/issues/1152)) ([d015371](https://github.com/googleapis/java-pubsub/commit/d015371c91e22a1c03494da37a2523110c3437e0)) +* update dependency com.google.protobuf:protobuf-java-util to v3.21.1 ([#1154](https://github.com/googleapis/java-pubsub/issues/1154)) ([61aeecf](https://github.com/googleapis/java-pubsub/commit/61aeecf6c40ad0b9aa93ea48acc8cca0fe4e3764)) + +## [1.119.0](https://github.com/googleapis/java-pubsub/compare/v1.118.0...v1.119.0) (2022-05-23) + + +### Features + +* add BigQuery configuration for subscriptions ([#1133](https://github.com/googleapis/java-pubsub/issues/1133)) ([6f271db](https://github.com/googleapis/java-pubsub/commit/6f271db0feadcd338e2c5a0735e3828df5327772)) +* add build scripts for native image testing in Java 17 ([#1440](https://github.com/googleapis/java-pubsub/issues/1440)) ([#1145](https://github.com/googleapis/java-pubsub/issues/1145)) ([2f89017](https://github.com/googleapis/java-pubsub/commit/2f89017c4a9737d0db1456b0b9903ec07a9392e8)) + + +### Dependencies + +* update dependency com.google.cloud:google-cloud-core to v2.7.1 ([#1141](https://github.com/googleapis/java-pubsub/issues/1141)) ([851a119](https://github.com/googleapis/java-pubsub/commit/851a1190725d381232270bd80f6b82929f680f5f)) +* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.11.0 ([#1142](https://github.com/googleapis/java-pubsub/issues/1142)) ([3cf6d82](https://github.com/googleapis/java-pubsub/commit/3cf6d82f85bdb49f8b5a4f9805506e8a2fafc53c)) +* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.12.0 ([#1148](https://github.com/googleapis/java-pubsub/issues/1148)) ([b5b004b](https://github.com/googleapis/java-pubsub/commit/b5b004b69a0d1154f51233e1e47facc1cd13c716)) + +## [1.118.0](https://github.com/googleapis/java-pubsub/compare/v1.117.0...v1.118.0) (2022-05-18) + + +### Features + +* creating java backport ([#1120](https://github.com/googleapis/java-pubsub/issues/1120)) ([d88f417](https://github.com/googleapis/java-pubsub/commit/d88f4175356b0fdeb0697cfb1a7e6cd83ac0b7a5)) +* next release from main branch is 1.118.0 ([#1127](https://github.com/googleapis/java-pubsub/issues/1127)) ([67605a7](https://github.com/googleapis/java-pubsub/commit/67605a7efb36da5b9e123efb8fe69c58d4cfcbfd)) + + +### Bug Fixes + +* Too many leases ([#1135](https://github.com/googleapis/java-pubsub/issues/1135)) ([c9bcec5](https://github.com/googleapis/java-pubsub/commit/c9bcec531bf175684306e50eaf7ef96ee60cba78)) + +## [1.117.0](https://github.com/googleapis/java-pubsub/compare/v1.116.4...v1.117.0) (2022-05-10) + + +### Features + +* Adding grpc compression support for publisher client ([#1000](https://github.com/googleapis/java-pubsub/issues/1000)) ([4ad1a3f](https://github.com/googleapis/java-pubsub/commit/4ad1a3fc6e334b6b4efe2167dbe6976c5b5625a6)) +* AuditConfig for IAM v1 ([a1c9b74](https://github.com/googleapis/java-pubsub/commit/a1c9b7448494f50736b9eb5864d49d38a7936280)) + + +### Bug Fixes + +* added exactly once delivery files to owlbot config ([#1106](https://github.com/googleapis/java-pubsub/issues/1106)) ([bb6f105](https://github.com/googleapis/java-pubsub/commit/bb6f105873f94faf564773d821b8d5d01bac94ca)) +* adding BetaApi annotation on AckReplyConsumerWithResponse for Exactly Once Delivery ([#1097](https://github.com/googleapis/java-pubsub/issues/1097)) ([0e89054](https://github.com/googleapis/java-pubsub/commit/0e890546727657ddb5cb23e58d9c57dd65d978f2)) +* removed beta api annotation for ordering keys ([#1094](https://github.com/googleapis/java-pubsub/issues/1094)) ([3f140fb](https://github.com/googleapis/java-pubsub/commit/3f140fbacf3a157b503b081e7c6964a60ae09466)) + + +### Dependencies + +* error_prone_annotations from the shared deps BOM ([#1102](https://github.com/googleapis/java-pubsub/issues/1102)) ([3bb2bec](https://github.com/googleapis/java-pubsub/commit/3bb2bec6534e97b2ee84ac5271819f3aea568a85)) +* update dependency com.google.protobuf:protobuf-java-util to v3.20.1 ([#1100](https://github.com/googleapis/java-pubsub/issues/1100)) ([063b7aa](https://github.com/googleapis/java-pubsub/commit/063b7aa3e10fc4f74278fc36c73af8ac68dce26d)) + + +### Documentation + +* **sample:** remove unused native-image-support dependency ([#1103](https://github.com/googleapis/java-pubsub/issues/1103)) ([e7d9000](https://github.com/googleapis/java-pubsub/commit/e7d9000cd0c236d5ff222e13ca3bc25911aa9bd9)) + +### [1.116.4](https://github.com/googleapis/java-pubsub/compare/v1.116.3...v1.116.4) (2022-04-19) + + +### Dependencies + +* update dependency com.google.cloud:google-cloud-core to v2.6.1 ([#1084](https://github.com/googleapis/java-pubsub/issues/1084)) ([b1c4d89](https://github.com/googleapis/java-pubsub/commit/b1c4d899e98fc58bdcd6a38b4544497e65ca591d)) +* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.10.0 ([#1085](https://github.com/googleapis/java-pubsub/issues/1085)) ([4826dcb](https://github.com/googleapis/java-pubsub/commit/4826dcb4ce80e165a4c2c7e65a8d6931ebb0abc9)) +* update dependency com.google.cloud:native-image-support to v0.13.1 ([#1086](https://github.com/googleapis/java-pubsub/issues/1086)) ([98c7b2b](https://github.com/googleapis/java-pubsub/commit/98c7b2be08e80744b6bc8e38c327e3874b755df9)) +* update dependency com.google.errorprone:error_prone_annotations to v2.12.1 ([#1080](https://github.com/googleapis/java-pubsub/issues/1080)) ([d13bd94](https://github.com/googleapis/java-pubsub/commit/d13bd94074740b870c90a216715dfe18bbd6c248)) +* update dependency com.google.errorprone:error_prone_annotations to v2.13.0 ([#1083](https://github.com/googleapis/java-pubsub/issues/1083)) ([3b8cbcb](https://github.com/googleapis/java-pubsub/commit/3b8cbcbee1b7451adcdf1305d90960f682889c44)) +* update dependency com.google.errorprone:error_prone_annotations to v2.13.1 ([#1087](https://github.com/googleapis/java-pubsub/issues/1087)) ([34121f0](https://github.com/googleapis/java-pubsub/commit/34121f0d9943735a231d4c1e045df4f7e822268e)) +* update dependency com.google.protobuf:protobuf-java-util to v3.20.0 ([#1078](https://github.com/googleapis/java-pubsub/issues/1078)) ([b064d6c](https://github.com/googleapis/java-pubsub/commit/b064d6ca8b2b1e6e083dc273073b3734d434ef8c)) + +### [1.116.3](https://github.com/googleapis/java-pubsub/compare/v1.116.2...v1.116.3) (2022-03-29) + + +### Dependencies + +* update dependency com.google.cloud:google-cloud-core to v2.5.11 ([#1070](https://github.com/googleapis/java-pubsub/issues/1070)) ([662e2ec](https://github.com/googleapis/java-pubsub/commit/662e2ec8c4130c237bcfc61efe2e42a9912c8df0)) +* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.9.0 ([#1072](https://github.com/googleapis/java-pubsub/issues/1072)) ([56f9e91](https://github.com/googleapis/java-pubsub/commit/56f9e91b3accdf59b077771141fd42d09ebecdf1)) +* update dependency com.google.cloud:native-image-support to v0.12.11 ([#1071](https://github.com/googleapis/java-pubsub/issues/1071)) ([82f4501](https://github.com/googleapis/java-pubsub/commit/82f4501b84ea97b2903f51d8cae2011c1b96abf4)) + +### [1.116.2](https://github.com/googleapis/java-pubsub/compare/v1.116.1...v1.116.2) (2022-03-24) + + +### Dependencies + +* update dependency org.graalvm.buildtools:junit-platform-native to v0.9.11 ([#1064](https://github.com/googleapis/java-pubsub/issues/1064)) ([3ebcc5e](https://github.com/googleapis/java-pubsub/commit/3ebcc5e262bf420fd2ba36f26d8b6350b56f989d)) +* update dependency org.graalvm.buildtools:native-maven-plugin to v0.9.11 ([#1065](https://github.com/googleapis/java-pubsub/issues/1065)) ([d1ce9c6](https://github.com/googleapis/java-pubsub/commit/d1ce9c6cc9fc9c8030c117bff1b0d2d8e317107c)) + +### [1.116.1](https://github.com/googleapis/java-pubsub/compare/v1.116.0...v1.116.1) (2022-03-22) + + +### Bug Fixes + +* added a maximum metadata size when creating the subscriber ([#1061](https://github.com/googleapis/java-pubsub/issues/1061)) ([3a8c83b](https://github.com/googleapis/java-pubsub/commit/3a8c83b973a1dfbae2ca037125574d74034218ce)) +* Removed EnableExactlyOnceDelivery from Builders ([#1052](https://github.com/googleapis/java-pubsub/issues/1052)) ([9add538](https://github.com/googleapis/java-pubsub/commit/9add53894981d862ac1348d0b641e472b3b3aa79)) + + +### Dependencies + +* update dependency com.google.cloud:google-cloud-core to v2.5.10 ([#1057](https://github.com/googleapis/java-pubsub/issues/1057)) ([0b7d19f](https://github.com/googleapis/java-pubsub/commit/0b7d19fe39326c36152267e4d2a13a2b51530ac2)) +* update dependency com.google.cloud:google-cloud-core to v2.5.8 ([#1050](https://github.com/googleapis/java-pubsub/issues/1050)) ([c7551d6](https://github.com/googleapis/java-pubsub/commit/c7551d621343eac4476a16579763e3aab7f71ea9)) +* update dependency com.google.cloud:google-cloud-core to v2.5.9 ([#1054](https://github.com/googleapis/java-pubsub/issues/1054)) ([5b3227f](https://github.com/googleapis/java-pubsub/commit/5b3227f4013a5121a3db34702f90be5a9ba41748)) +* update dependency com.google.cloud:native-image-support to v0.12.10 ([#1058](https://github.com/googleapis/java-pubsub/issues/1058)) ([af2b364](https://github.com/googleapis/java-pubsub/commit/af2b3640eb22e8e78f5beea07a73e2b3127cce71)) +* update dependency com.google.cloud:native-image-support to v0.12.7 ([#1042](https://github.com/googleapis/java-pubsub/issues/1042)) ([fd52aa8](https://github.com/googleapis/java-pubsub/commit/fd52aa8ffaa4d7cb8e0ad19bb6993b5616eb81df)) +* update dependency com.google.cloud:native-image-support to v0.12.8 ([#1051](https://github.com/googleapis/java-pubsub/issues/1051)) ([da2d3fa](https://github.com/googleapis/java-pubsub/commit/da2d3fa91fe4f07455fbe0aa3ccac15e456666c7)) +* update dependency com.google.cloud:native-image-support to v0.12.9 ([#1053](https://github.com/googleapis/java-pubsub/issues/1053)) ([6e97d52](https://github.com/googleapis/java-pubsub/commit/6e97d5222994dc567bc24ab3457f3431ed000134)) +* update dependency org.graalvm.buildtools:junit-platform-native to v0.9.10 ([#1043](https://github.com/googleapis/java-pubsub/issues/1043)) ([5884bdf](https://github.com/googleapis/java-pubsub/commit/5884bdfafc5ee621935b620e763ca6c0adf67ff7)) +* update dependency org.graalvm.buildtools:native-maven-plugin to v0.9.10 ([#1044](https://github.com/googleapis/java-pubsub/issues/1044)) ([158e7f8](https://github.com/googleapis/java-pubsub/commit/158e7f884660a312b7168cecfa85cf594071a7be)) + + +### Documentation + +* **sample:** Add sample for Native Image support in Pub/Sub ([#1026](https://github.com/googleapis/java-pubsub/issues/1026)) ([a4fa69b](https://github.com/googleapis/java-pubsub/commit/a4fa69b99f34304f7ee7a56fb3c633f018905f09)) +* **sample:** use Java 8 for native image sample ([#1060](https://github.com/googleapis/java-pubsub/issues/1060)) ([2d5c010](https://github.com/googleapis/java-pubsub/commit/2d5c0109fe797698749d2c198cbb5a8a1a9d11dc)) + +## [1.116.0](https://github.com/googleapis/java-pubsub/compare/v1.115.5...v1.116.0) (2022-03-04) + + +### Features + +* exactly once support v3 ([#1022](https://github.com/googleapis/java-pubsub/issues/1022)) ([02ed621](https://github.com/googleapis/java-pubsub/commit/02ed621f5ca6c96e1bb63cd9a5ed137896313c4f)) + + +### Bug Fixes + +* removing misspelled field, add correctly spelled field ([#1011](https://github.com/googleapis/java-pubsub/issues/1011)) ([2e8b681](https://github.com/googleapis/java-pubsub/commit/2e8b68111c1d50a5322ad1fdc5d3b93561090e98)) + + +### Dependencies + +* update dependency com.google.cloud:google-cloud-core to v2.5.4 ([#1017](https://github.com/googleapis/java-pubsub/issues/1017)) ([55c53e3](https://github.com/googleapis/java-pubsub/commit/55c53e34448a0fda7c4ea1fb087bd2dc2dc8e163)) +* update dependency com.google.cloud:google-cloud-core to v2.5.6 ([#1038](https://github.com/googleapis/java-pubsub/issues/1038)) ([c319f59](https://github.com/googleapis/java-pubsub/commit/c319f59f26973dbb0b88f9ccd6c60b3e480392a8)) +* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.8.0 ([#1035](https://github.com/googleapis/java-pubsub/issues/1035)) ([10dba36](https://github.com/googleapis/java-pubsub/commit/10dba36088a54860061d5435ac51ef7101eec891)) + +### [1.115.5](https://github.com/googleapis/java-pubsub/compare/v1.115.4...v1.115.5) (2022-02-11) + + +### Dependencies + +* update actions/github-script action to v6 ([#1010](https://github.com/googleapis/java-pubsub/issues/1010)) ([04ee4c9](https://github.com/googleapis/java-pubsub/commit/04ee4c98bd2c09bbb58bc73c501386c2e7fc927d)) +* update dependency com.google.cloud:google-cloud-core to v2.5.3 ([#1008](https://github.com/googleapis/java-pubsub/issues/1008)) ([0eacfb0](https://github.com/googleapis/java-pubsub/commit/0eacfb0b54f82cf05aa3d100a59d11c5fe0c40ae)) + +### [1.115.4](https://github.com/googleapis/java-pubsub/compare/v1.115.3...v1.115.4) (2022-02-10) + + +### Dependencies + +* update dependency com.google.cloud:google-cloud-core to v2.5.1 ([#1004](https://github.com/googleapis/java-pubsub/issues/1004)) ([8f6879b](https://github.com/googleapis/java-pubsub/commit/8f6879b8021bf8e6b351249a0352fd0537110fcd)) + +### [1.115.3](https://github.com/googleapis/java-pubsub/compare/v1.115.2...v1.115.3) (2022-02-08) + + +### Dependencies + +* update dependency com.google.cloud:google-cloud-core to v2.5.0 ([#995](https://github.com/googleapis/java-pubsub/issues/995)) ([3b3b90a](https://github.com/googleapis/java-pubsub/commit/3b3b90ad1cf520fa8cdfea180002745789ebfce9)) + +### [1.115.2](https://github.com/googleapis/java-pubsub/compare/v1.115.1...v1.115.2) (2022-02-03) + + +### Dependencies + +* **java:** update actions/github-script action to v5 ([#1339](https://github.com/googleapis/java-pubsub/issues/1339)) ([#984](https://github.com/googleapis/java-pubsub/issues/984)) ([9a1cc0e](https://github.com/googleapis/java-pubsub/commit/9a1cc0eaf344e2f9cded1c331b0e71543f20ef65)) +* update dependency com.google.cloud:google-cloud-core to v2.4.0 ([#986](https://github.com/googleapis/java-pubsub/issues/986)) ([8cdf7a0](https://github.com/googleapis/java-pubsub/commit/8cdf7a0b1dffa1c01e9c739d79af552e6b42796e)) +* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.7.0 ([#988](https://github.com/googleapis/java-pubsub/issues/988)) ([8993760](https://github.com/googleapis/java-pubsub/commit/89937606134be8e0eb8b7669c6243f1f3b8a9aad)) +* update dependency com.google.errorprone:error_prone_annotations to v2.11.0 ([#983](https://github.com/googleapis/java-pubsub/issues/983)) ([abcbb32](https://github.com/googleapis/java-pubsub/commit/abcbb32e442948ff4637df8b657a7f8a0abd3062)) +* update dependency com.google.protobuf:protobuf-java-util to v3.19.3 ([#973](https://github.com/googleapis/java-pubsub/issues/973)) ([13a9f96](https://github.com/googleapis/java-pubsub/commit/13a9f9645661324cc26b23b9eca5d833bf9d089f)) +* update dependency com.google.protobuf:protobuf-java-util to v3.19.4 ([#987](https://github.com/googleapis/java-pubsub/issues/987)) ([ff71dc7](https://github.com/googleapis/java-pubsub/commit/ff71dc73c9950973512920073a0f0491527a0678)) + +### [1.115.1](https://www.github.com/googleapis/java-pubsub/compare/v1.115.0...v1.115.1) (2022-01-07) + + +### Dependencies + +* update dependency com.google.cloud:google-cloud-core to v2.3.4 ([#955](https://www.github.com/googleapis/java-pubsub/issues/955)) ([b39ecd5](https://www.github.com/googleapis/java-pubsub/commit/b39ecd5db18c99461206b287eb403199eea7a654)) +* update dependency com.google.cloud:google-cloud-core to v2.3.5 ([#959](https://www.github.com/googleapis/java-pubsub/issues/959)) ([5efec45](https://www.github.com/googleapis/java-pubsub/commit/5efec45e1761b642bcef309a45de4342e0f553f7)) +* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.6.0 ([#957](https://www.github.com/googleapis/java-pubsub/issues/957)) ([b562ce8](https://www.github.com/googleapis/java-pubsub/commit/b562ce8550d227d99352df17c5c01221153f94fd)) +* update dependency com.google.protobuf:protobuf-java-util to v3.19.2 ([#954](https://www.github.com/googleapis/java-pubsub/issues/954)) ([a1ac149](https://www.github.com/googleapis/java-pubsub/commit/a1ac1491f0c682da6d84e69477823d2446a9c475)) + +## [1.115.0](https://www.github.com/googleapis/java-pubsub/compare/v1.114.7...v1.115.0) (2021-12-05) + + +### Features + +* creating java backport ([#895](https://www.github.com/googleapis/java-pubsub/issues/895)) ([51b01e2](https://www.github.com/googleapis/java-pubsub/commit/51b01e254a4be87a8a779fbc5da697c70920d82f)) + + +### Bug Fixes + +* **java:** java 17 dependency arguments ([#1266](https://www.github.com/googleapis/java-pubsub/issues/1266)) ([#888](https://www.github.com/googleapis/java-pubsub/issues/888)) ([ed3ae2f](https://www.github.com/googleapis/java-pubsub/commit/ed3ae2fb0a0c72073f6bae5dc4111424740fd883)) + + +### Dependencies + +* update dependency com.google.cloud:google-cloud-core to v2.3.0 ([#913](https://www.github.com/googleapis/java-pubsub/issues/913)) ([adfd456](https://www.github.com/googleapis/java-pubsub/commit/adfd4562a8041d71af65cd98cf1d17b881e35dd3)) +* update dependency com.google.cloud:google-cloud-core to v2.3.1 ([#927](https://www.github.com/googleapis/java-pubsub/issues/927)) ([9fcc996](https://www.github.com/googleapis/java-pubsub/commit/9fcc9965284f6a57dc79f31eb96a2e430cef72e4)) +* update dependency com.google.cloud:google-cloud-core to v2.3.2 ([#941](https://www.github.com/googleapis/java-pubsub/issues/941)) ([41f881b](https://www.github.com/googleapis/java-pubsub/commit/41f881b2d075f9ee730f5eaf24885146d9fadccf)) +* update dependency com.google.cloud:google-cloud-core to v2.3.3 ([#943](https://www.github.com/googleapis/java-pubsub/issues/943)) ([df3a5fe](https://www.github.com/googleapis/java-pubsub/commit/df3a5fecd4d87ae79cba312109242146b84f9e55)) +* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.5.0 ([#919](https://www.github.com/googleapis/java-pubsub/issues/919)) ([4adf335](https://www.github.com/googleapis/java-pubsub/commit/4adf335b78ce6b13af22c3c3a64c4ea1a24f05cd)) +* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.5.1 ([#942](https://www.github.com/googleapis/java-pubsub/issues/942)) ([44cdcf5](https://www.github.com/googleapis/java-pubsub/commit/44cdcf5d3f1815654b9b255c1096e290a7db9030)) +* update dependency com.google.errorprone:error_prone_annotations to v2.10.0 ([#901](https://www.github.com/googleapis/java-pubsub/issues/901)) ([8733144](https://www.github.com/googleapis/java-pubsub/commit/8733144854aaebfec0cd5f03ab14d820c6d22c0e)) +* update dependency com.google.protobuf:protobuf-java-util to v3.19.1 ([#885](https://www.github.com/googleapis/java-pubsub/issues/885)) ([d0a02a9](https://www.github.com/googleapis/java-pubsub/commit/d0a02a9f320b254a3e4ef60bfff47a6bb3a2427f)) +* update dependency org.apache.avro:avro to v1.11.0 ([#894](https://www.github.com/googleapis/java-pubsub/issues/894)) ([b7ba1a8](https://www.github.com/googleapis/java-pubsub/commit/b7ba1a871c4c26f50d87b41c2627b6e6aef63b3c)) +* update gson to 2.8.9 ([ec97e93](https://www.github.com/googleapis/java-pubsub/commit/ec97e93ae53666d5c5cad71821f12cefa4fbaf2e)) + +### [1.114.7](https://www.github.com/googleapis/java-pubsub/compare/v1.114.6...v1.114.7) (2021-10-19) + + +### Dependencies + +* update dependency com.google.cloud:google-cloud-core to v2.1.8 ([#877](https://www.github.com/googleapis/java-pubsub/issues/877)) ([c76329b](https://www.github.com/googleapis/java-pubsub/commit/c76329b06f2f620662f4fe4ffefa897daea8703b)) +* update dependency com.google.cloud:google-cloud-core to v2.2.0 ([#881](https://www.github.com/googleapis/java-pubsub/issues/881)) ([1eb4a1f](https://www.github.com/googleapis/java-pubsub/commit/1eb4a1f0a7d318b88cd04f4aefd3191f289e8a0f)) +* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.4.0 ([#882](https://www.github.com/googleapis/java-pubsub/issues/882)) ([2c367bb](https://www.github.com/googleapis/java-pubsub/commit/2c367bb22860cbbfa57fca70a436919ac6aa8084)) + +### [1.114.6](https://www.github.com/googleapis/java-pubsub/compare/v1.114.5...v1.114.6) (2021-10-05) + + +### Dependencies + +* update dependency com.google.protobuf:protobuf-java-util to v3.18.1 ([#870](https://www.github.com/googleapis/java-pubsub/issues/870)) ([5188e39](https://www.github.com/googleapis/java-pubsub/commit/5188e39a13b97d9fa943c89d9082f58afa3d9d98)) + +### [1.114.5](https://www.github.com/googleapis/java-pubsub/compare/v1.114.4...v1.114.5) (2021-09-27) + + +### Bug Fixes + +* do not block forever if message size > flow control limits ([#847](https://www.github.com/googleapis/java-pubsub/issues/847)) ([f4ca4b2](https://www.github.com/googleapis/java-pubsub/commit/f4ca4b2d12730d5cef64d6f986b140de2c51147d)) +* reset resource ids before test retries ([#852](https://www.github.com/googleapis/java-pubsub/issues/852)) ([3769e53](https://www.github.com/googleapis/java-pubsub/commit/3769e53225e1c4e32a1a0d5179c2a333258d69a8)) + + +### Documentation + +* **samples:** add readme ([#849](https://www.github.com/googleapis/java-pubsub/issues/849)) ([66135cf](https://www.github.com/googleapis/java-pubsub/commit/66135cf20c4d3c3ffc881b52f0273a14881ac97b)) + + +### Dependencies + +* update dependency com.google.cloud:google-cloud-core to v2.1.5 ([#854](https://www.github.com/googleapis/java-pubsub/issues/854)) ([374b8c3](https://www.github.com/googleapis/java-pubsub/commit/374b8c3f25aedd9ebdbb0d8075a201c482dadd40)) +* update dependency com.google.cloud:google-cloud-core to v2.1.6 ([#855](https://www.github.com/googleapis/java-pubsub/issues/855)) ([9fabfc3](https://www.github.com/googleapis/java-pubsub/commit/9fabfc3177ebb08082557803801ade0e12e2e36d)) +* update dependency com.google.cloud:google-cloud-core to v2.1.7 ([#858](https://www.github.com/googleapis/java-pubsub/issues/858)) ([2cd94b5](https://www.github.com/googleapis/java-pubsub/commit/2cd94b57529f683465c8fd969cbf4a435d214b60)) +* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.3.0 ([#856](https://www.github.com/googleapis/java-pubsub/issues/856)) ([ab47c15](https://www.github.com/googleapis/java-pubsub/commit/ab47c15a92978fbc994ed2db02ad1f24ed640fd0)) + +### [1.114.4](https://www.github.com/googleapis/java-pubsub/compare/v1.114.3...v1.114.4) (2021-09-17) + + +### Dependencies + +* update dependency com.google.cloud:google-cloud-core to v2.1.4 ([#835](https://www.github.com/googleapis/java-pubsub/issues/835)) ([2ab94ab](https://www.github.com/googleapis/java-pubsub/commit/2ab94abdc18c010496c50827c1f2eff02dae68e0)) +* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.2.1 ([#836](https://www.github.com/googleapis/java-pubsub/issues/836)) ([39770c9](https://www.github.com/googleapis/java-pubsub/commit/39770c9a6641273e4839b758d67ecbf2abd3a63f)) +* update dependency com.google.protobuf:protobuf-java-util to v3.18.0 ([#841](https://www.github.com/googleapis/java-pubsub/issues/841)) ([f5d515c](https://www.github.com/googleapis/java-pubsub/commit/f5d515c718c39dcfb5bf9375e624c1b1c28eb892)) + +### [1.114.3](https://www.github.com/googleapis/java-pubsub/compare/v1.114.2...v1.114.3) (2021-08-31) + + +### Bug Fixes + +* Set publish timeouts to be consistent with desired values ([#820](https://www.github.com/googleapis/java-pubsub/issues/820)) ([826dc10](https://www.github.com/googleapis/java-pubsub/commit/826dc10f5bb373e88b06d390fc2029960a2cad7c)) + + +### Dependencies + +* update dependency com.google.cloud:google-cloud-core to v2.1.2 ([#823](https://www.github.com/googleapis/java-pubsub/issues/823)) ([cc0786f](https://www.github.com/googleapis/java-pubsub/commit/cc0786f0c8e8c88df15563204953ff8870244fd5)) +* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.2.0 ([#824](https://www.github.com/googleapis/java-pubsub/issues/824)) ([32623af](https://www.github.com/googleapis/java-pubsub/commit/32623af172e367b61a5bcb10c0001d5488b1e772)) + +### [1.114.2](https://www.github.com/googleapis/java-pubsub/compare/v1.114.1...v1.114.2) (2021-08-24) + + +### Dependencies + +* update dependency com.google.cloud:google-cloud-core to v2.1.1 ([#813](https://www.github.com/googleapis/java-pubsub/issues/813)) ([e7b0c3c](https://www.github.com/googleapis/java-pubsub/commit/e7b0c3c002e816027c945cac4487394cefd26892)) + +### [1.114.1](https://www.github.com/googleapis/java-pubsub/compare/v1.114.0...v1.114.1) (2021-08-23) + + +### Dependencies + +* update dependency com.google.cloud:google-cloud-core to v2.1.0 ([#806](https://www.github.com/googleapis/java-pubsub/issues/806)) ([744eacd](https://www.github.com/googleapis/java-pubsub/commit/744eacd007c9de224790b75eb5c060acaf6245ec)) +* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.1.0 ([#807](https://www.github.com/googleapis/java-pubsub/issues/807)) ([e88ff93](https://www.github.com/googleapis/java-pubsub/commit/e88ff93b0fc476f27221d9e5e4c81811a26815ac)) + +## [1.114.0](https://www.github.com/googleapis/java-pubsub/compare/v1.113.9...v1.114.0) (2021-08-23) + + +### Features + +* add topic retention support ([#803](https://www.github.com/googleapis/java-pubsub/issues/803)) ([898faf8](https://www.github.com/googleapis/java-pubsub/commit/898faf810276901c4ea878278ec55b80664098f7)) + + +### Dependencies + +* update dependency com.google.errorprone:error_prone_annotations to v2.9.0 ([#797](https://www.github.com/googleapis/java-pubsub/issues/797)) ([70bb91d](https://www.github.com/googleapis/java-pubsub/commit/70bb91d7a5cbb6da82837d7bd42a08b4b4fe648e)) + +### [1.113.9](https://www.github.com/googleapis/java-pubsub/compare/v1.113.8...v1.113.9) (2021-08-11) + + +### Dependencies + +* update dependency com.google.api.grpc:grpc-google-cloud-pubsub-v1 to v1.96.0 ([#786](https://www.github.com/googleapis/java-pubsub/issues/786)) ([57c3c2b](https://www.github.com/googleapis/java-pubsub/commit/57c3c2bfd467fd02a03ec581d9254fe3c9c68f8b)) +* update dependency com.google.api.grpc:proto-google-cloud-pubsub-v1 to v1.96.0 ([#787](https://www.github.com/googleapis/java-pubsub/issues/787)) ([7940378](https://www.github.com/googleapis/java-pubsub/commit/7940378db1394e3c5631ec854fa57b35cfb12094)) +* update dependency com.google.cloud:google-cloud-core to v2.0.5 ([#783](https://www.github.com/googleapis/java-pubsub/issues/783)) ([de3d475](https://www.github.com/googleapis/java-pubsub/commit/de3d47544bfe370330dd6b569927cf77204201bf)) +* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.0.1 ([#788](https://www.github.com/googleapis/java-pubsub/issues/788)) ([5d39f85](https://www.github.com/googleapis/java-pubsub/commit/5d39f850040a2c60c5c87a7669f924121e0b8b0a)) + +### [1.113.8](https://www.github.com/googleapis/java-pubsub/compare/v1.113.7...v1.113.8) (2021-08-11) + + +### Dependencies + +* update dependency com.google.cloud:google-cloud-core to v2.0.4 ([#772](https://www.github.com/googleapis/java-pubsub/issues/772)) ([37cb279](https://www.github.com/googleapis/java-pubsub/commit/37cb2797cfce84e53b56b37de19c9b467eca91c4)) + +### [1.113.7](https://www.github.com/googleapis/java-pubsub/compare/v1.113.6...v1.113.7) (2021-08-11) + + +### Dependencies + +* update dependency com.google.cloud:google-cloud-core to v2.0.3 ([#768](https://www.github.com/googleapis/java-pubsub/issues/768)) ([2ba610b](https://www.github.com/googleapis/java-pubsub/commit/2ba610bb1134b43c641608364248c794eec5a295)) + +### [1.113.6](https://www.github.com/googleapis/java-pubsub/compare/v1.113.5...v1.113.6) (2021-08-06) + + +### Dependencies + +* update dependency com.google.cloud:google-cloud-core to v2 ([#759](https://www.github.com/googleapis/java-pubsub/issues/759)) ([9afc2a3](https://www.github.com/googleapis/java-pubsub/commit/9afc2a3d0b94cf71feda5fed23841bdb7814f422)) +* update dependency com.google.cloud:google-cloud-shared-dependencies to v2 ([#762](https://www.github.com/googleapis/java-pubsub/issues/762)) ([ee939c2](https://www.github.com/googleapis/java-pubsub/commit/ee939c2166ec3dfea0e6132f6198e3a7693659a1)) +* update dependency com.google.errorprone:error_prone_annotations to v2.8.0 ([#745](https://www.github.com/googleapis/java-pubsub/issues/745)) ([554d602](https://www.github.com/googleapis/java-pubsub/commit/554d60273b53ab4a06b13fa0c39b13e3c3e815e1)) +* update dependency com.google.errorprone:error_prone_annotations to v2.8.1 ([#758](https://www.github.com/googleapis/java-pubsub/issues/758)) ([09650e4](https://www.github.com/googleapis/java-pubsub/commit/09650e4d1201be0c738b8853d9271084c808c2be)) + +### [1.113.5](https://www.github.com/googleapis/java-pubsub/compare/v1.113.4...v1.113.5) (2021-07-02) + + +### Bug Fixes + +* Add `shopt -s nullglob` to dependencies script ([#724](https://www.github.com/googleapis/java-pubsub/issues/724)) ([25840d6](https://www.github.com/googleapis/java-pubsub/commit/25840d60c62123b71c64e3b2fea2b33d4c4c2fb4)) + + +### Dependencies + +* update dependency com.google.cloud:google-cloud-core to v1.95.3 ([#725](https://www.github.com/googleapis/java-pubsub/issues/725)) ([ae3b284](https://www.github.com/googleapis/java-pubsub/commit/ae3b2840eb25458d054c25a3c9879a8a5aa8883a)) +* update dependency com.google.cloud:google-cloud-core to v1.95.4 ([#730](https://www.github.com/googleapis/java-pubsub/issues/730)) ([b6453b3](https://www.github.com/googleapis/java-pubsub/commit/b6453b3026184e757a6f29c1baeece14ca4cc4f2)) +* update dependency com.google.cloud:google-cloud-shared-dependencies to v1.4.0 ([#732](https://www.github.com/googleapis/java-pubsub/issues/732)) ([78b26c0](https://www.github.com/googleapis/java-pubsub/commit/78b26c0de4a11b88295c2861917ee354e2793bf8)) + +### [1.113.4](https://www.github.com/googleapis/java-pubsub/compare/v1.113.3...v1.113.4) (2021-06-22) + + +### Bug Fixes + +* allow retries for subscriber unary rpcs ([#721](https://www.github.com/googleapis/java-pubsub/issues/721)) ([3f0a6d2](https://www.github.com/googleapis/java-pubsub/commit/3f0a6d2474dcbac604991c45298c7b89fefa27a7)) +* Update dependencies.sh to not break on mac ([#718](https://www.github.com/googleapis/java-pubsub/issues/718)) ([0ebad0a](https://www.github.com/googleapis/java-pubsub/commit/0ebad0a2c92f00126d9c00aec1af3c73333c3a31)) + +### [1.113.3](https://www.github.com/googleapis/java-pubsub/compare/v1.113.2...v1.113.3) (2021-06-09) + + +### Dependencies + +* update dependency com.google.cloud:google-cloud-core to v1.95.2 ([#707](https://www.github.com/googleapis/java-pubsub/issues/707)) ([60c7a68](https://www.github.com/googleapis/java-pubsub/commit/60c7a68fefd54525958c3b195142d8613405f5d2)) + +### [1.113.2](https://www.github.com/googleapis/java-pubsub/compare/v1.113.1...v1.113.2) (2021-06-09) + + +### Dependencies + +* update dependency com.google.cloud:google-cloud-core to v1.95.1 ([#701](https://www.github.com/googleapis/java-pubsub/issues/701)) ([c91e208](https://www.github.com/googleapis/java-pubsub/commit/c91e208efd04218dd5dd4f69743307375c8d6f06)) +* update dependency com.google.protobuf:protobuf-java-util to v3.17.3 ([#700](https://www.github.com/googleapis/java-pubsub/issues/700)) ([60f9b8d](https://www.github.com/googleapis/java-pubsub/commit/60f9b8d950d20a7b5a0fccad082d9014cd44d20c)) + +### [1.113.1](https://www.github.com/googleapis/java-pubsub/compare/v1.113.0...v1.113.1) (2021-06-07) + + +### Dependencies + +* update dependency com.google.cloud:google-cloud-core to v1.95.0 ([#691](https://www.github.com/googleapis/java-pubsub/issues/691)) ([bc75411](https://www.github.com/googleapis/java-pubsub/commit/bc754112599c744374f95237bb7e9b8b4d374531)) +* update dependency com.google.cloud:google-cloud-shared-dependencies to v1.3.0 ([#692](https://www.github.com/googleapis/java-pubsub/issues/692)) ([1ba00a2](https://www.github.com/googleapis/java-pubsub/commit/1ba00a2da7ecd8447a182ae2f9c644c7b01fe8bd)) +* update dependency com.google.protobuf:protobuf-java-util to v3.17.2 ([#690](https://www.github.com/googleapis/java-pubsub/issues/690)) ([2ac440c](https://www.github.com/googleapis/java-pubsub/commit/2ac440cbb55dd24d5783fb74b77b5dfc97aed951)) + +## [1.113.0](https://www.github.com/googleapis/java-pubsub/compare/v1.112.5...v1.113.0) (2021-05-31) + + +### Features + +* add `gcf-owl-bot[bot]` to `ignoreAuthors` ([#673](https://www.github.com/googleapis/java-pubsub/issues/673)) ([51dfca3](https://www.github.com/googleapis/java-pubsub/commit/51dfca3049f87e8bc1163c03eaef0556be3eefdf)) + + +### Dependencies + +* update dependency com.google.cloud:google-cloud-shared-dependencies to v1.2.0 ([#672](https://www.github.com/googleapis/java-pubsub/issues/672)) ([2cc9ec5](https://www.github.com/googleapis/java-pubsub/commit/2cc9ec5f1418f23a89129bdfc038dcf461097b88)) +* update dependency com.google.errorprone:error_prone_annotations to v2.7.1 ([#667](https://www.github.com/googleapis/java-pubsub/issues/667)) ([885be5c](https://www.github.com/googleapis/java-pubsub/commit/885be5c37992b8b1175c55b407db0f833241a0d1)) +* update dependency com.google.protobuf:protobuf-java-util to v3.17.1 ([#679](https://www.github.com/googleapis/java-pubsub/issues/679)) ([e7ef708](https://www.github.com/googleapis/java-pubsub/commit/e7ef7088999f60dc8bd5268c0315a8e1e4639ae0)) + +### [1.112.5](https://www.github.com/googleapis/java-pubsub/compare/v1.112.4...v1.112.5) (2021-05-14) + + +### Dependencies + +* update dependency com.google.protobuf:protobuf-java-util to v3.17.0 ([#660](https://www.github.com/googleapis/java-pubsub/issues/660)) ([5f33acf](https://www.github.com/googleapis/java-pubsub/commit/5f33acf204bd5d3a62eb06fc64a4ad779458ed82)) + +### [1.112.4](https://www.github.com/googleapis/java-pubsub/compare/v1.112.3...v1.112.4) (2021-05-12) + + +### Dependencies + +* update dependency com.google.cloud:google-cloud-shared-dependencies to v1.1.0 ([#651](https://www.github.com/googleapis/java-pubsub/issues/651)) ([96ab1d4](https://www.github.com/googleapis/java-pubsub/commit/96ab1d4ea484215fb951704d0d2f0dbbf2802544)) +* update dependency com.google.protobuf:protobuf-java-util to v3.16.0 ([#647](https://www.github.com/googleapis/java-pubsub/issues/647)) ([7fcc503](https://www.github.com/googleapis/java-pubsub/commit/7fcc503a790d28f3d07e07c0ca286a1ee031f38b)) + +### [1.112.3](https://www.github.com/googleapis/java-pubsub/compare/v1.112.2...v1.112.3) (2021-04-26) + + +### Dependencies + +* update dependency com.google.cloud:google-cloud-core to v1.94.8 ([#624](https://www.github.com/googleapis/java-pubsub/issues/624)) ([e1d6632](https://www.github.com/googleapis/java-pubsub/commit/e1d663262b618223d021f8304718f4b939423002)) + +### [1.112.2](https://www.github.com/googleapis/java-pubsub/compare/v1.112.1...v1.112.2) (2021-04-24) + + +### Bug Fixes + +* release scripts from issuing overlapping phases ([#610](https://www.github.com/googleapis/java-pubsub/issues/610)) ([70246e8](https://www.github.com/googleapis/java-pubsub/commit/70246e8fd24c7e85b0384d99bd3895094383ff5e)) +* typo ([#603](https://www.github.com/googleapis/java-pubsub/issues/603)) ([60b087d](https://www.github.com/googleapis/java-pubsub/commit/60b087d2e2afbadaff5dd0a3b946d46b61acbf95)) + + +### Dependencies + +* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.21.1 ([#614](https://www.github.com/googleapis/java-pubsub/issues/614)) ([61e2ea1](https://www.github.com/googleapis/java-pubsub/commit/61e2ea112a4d44219adb20f087e7847114be4261)) +* update dependency com.google.cloud:google-cloud-shared-dependencies to v1 ([#626](https://www.github.com/googleapis/java-pubsub/issues/626)) ([a9884a9](https://www.github.com/googleapis/java-pubsub/commit/a9884a9beede67ce90616be2f1bdd7da1aa6f867)) +* update dependency org.easymock:easymock to v4.3 ([#612](https://www.github.com/googleapis/java-pubsub/issues/612)) ([b08e816](https://www.github.com/googleapis/java-pubsub/commit/b08e81604341381543b13f68bb0695c55d0a7575)) + +### [1.112.1](https://www.github.com/googleapis/java-pubsub/compare/v1.112.0...v1.112.1) (2021-04-12) + + +### Dependencies + +* update dependency com.google.cloud:google-cloud-core to v1.94.6 ([#590](https://www.github.com/googleapis/java-pubsub/issues/590)) ([902b149](https://www.github.com/googleapis/java-pubsub/commit/902b149b04d5d74b84051c4b09e54b14df20f6a2)) +* update dependency com.google.cloud:google-cloud-core to v1.94.7 ([#597](https://www.github.com/googleapis/java-pubsub/issues/597)) ([312966d](https://www.github.com/googleapis/java-pubsub/commit/312966d58c494864d57821ed1a75c84fd3de1aab)) +* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.21.0 ([#592](https://www.github.com/googleapis/java-pubsub/issues/592)) ([f81b792](https://www.github.com/googleapis/java-pubsub/commit/f81b7929659b03d620789fef5dfc9e8fcb418c66)) +* update dependency com.google.errorprone:error_prone_annotations to v2.6.0 ([#585](https://www.github.com/googleapis/java-pubsub/issues/585)) ([8316bce](https://www.github.com/googleapis/java-pubsub/commit/8316bced8cf506a470c2f07cc578eda86305dd4e)) +* update dependency com.google.protobuf:protobuf-java-util to v3.15.7 ([#586](https://www.github.com/googleapis/java-pubsub/issues/586)) ([616e77d](https://www.github.com/googleapis/java-pubsub/commit/616e77df843a70edf7d5d972156b2e2371d928e4)) +* update dependency com.google.protobuf:protobuf-java-util to v3.15.8 ([#589](https://www.github.com/googleapis/java-pubsub/issues/589)) ([8adde2d](https://www.github.com/googleapis/java-pubsub/commit/8adde2d6741c8bc264f00e34255368ef527aa9ce)) +* update dependency org.apache.avro:avro to v1.10.2 ([#575](https://www.github.com/googleapis/java-pubsub/issues/575)) ([acd0c19](https://www.github.com/googleapis/java-pubsub/commit/acd0c1953aa4728699a03566632f4b1bf8bbe177)) + +## [1.112.0](https://www.github.com/googleapis/java-pubsub/compare/v1.111.4...v1.112.0) (2021-03-16) + + +### Features + +* expose default client configs ([#541](https://www.github.com/googleapis/java-pubsub/issues/541)) ([01e6daf](https://www.github.com/googleapis/java-pubsub/commit/01e6dafb569a37c661463b79f5afbfba4f6d188d)) + + +### Bug Fixes + +* properly shutdown subscriber stub on permanent streaming pull failure ([#539](https://www.github.com/googleapis/java-pubsub/issues/539)) ([adbcc0c](https://www.github.com/googleapis/java-pubsub/commit/adbcc0c6777e35eae24b538e6c48f9ef7485a786)) +* update MessageDispatcher to not extend deadlines of messages which arrive early to 60s ([#570](https://www.github.com/googleapis/java-pubsub/issues/570)) ([e174e20](https://www.github.com/googleapis/java-pubsub/commit/e174e2043f64563f4d2868537aeb90d948233166)) + + +### Dependencies + +* update dependency com.google.cloud:google-cloud-core to v1.94.3 ([#566](https://www.github.com/googleapis/java-pubsub/issues/566)) ([3f23ac6](https://www.github.com/googleapis/java-pubsub/commit/3f23ac6cda00814f74f2c435dd8a05b70ac69d27)) +* update dependency com.google.cloud:google-cloud-core to v1.94.4 ([#568](https://www.github.com/googleapis/java-pubsub/issues/568)) ([21886d3](https://www.github.com/googleapis/java-pubsub/commit/21886d39cdc2a33275c2061578c877b0fa6aee98)) +* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.20.1 ([#564](https://www.github.com/googleapis/java-pubsub/issues/564)) ([0aa4521](https://www.github.com/googleapis/java-pubsub/commit/0aa452121b2fa769221b41c8c1323f3b31b599d1)) +* update dependency com.google.protobuf:protobuf-java-util to v3.15.5 ([#559](https://www.github.com/googleapis/java-pubsub/issues/559)) ([74e6a92](https://www.github.com/googleapis/java-pubsub/commit/74e6a92ca88f006e0fe1a68144ba0cb30a1d140c)) +* update dependency com.google.protobuf:protobuf-java-util to v3.15.6 ([#569](https://www.github.com/googleapis/java-pubsub/issues/569)) ([b6e299f](https://www.github.com/googleapis/java-pubsub/commit/b6e299f6d13dab7d5b2e8c575021371485878bb2)) + + +### Documentation + +* Remove experimental note for schema APIs ([#560](https://www.github.com/googleapis/java-pubsub/issues/560)) ([4b98556](https://www.github.com/googleapis/java-pubsub/commit/4b98556e550802135cfb87d8984f0deec57e8c2e)) + ### [1.111.4](https://www.github.com/googleapis/java-pubsub/compare/v1.111.3...v1.111.4) (2021-02-26) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f2dbdee06..ff092b68e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -53,12 +53,12 @@ mvn -Penable-integration-tests clean verify ## Code Samples -Code Samples must be bundled in separate Maven modules, and guarded by a -Maven profile with the name `enable-samples`. +All code samples must be in compliance with the [java sample formatting guide][3]. +Code Samples must be bundled in separate Maven modules. The samples must be separate from the primary project for a few reasons: -1. Primary projects have a minimum Java version of Java 7 whereas samples have - a minimum Java version of Java 8. Due to this we need the ability to +1. Primary projects have a minimum Java version of Java 8 whereas samples can have + Java version of Java 11. Due to this we need the ability to selectively exclude samples from a build run. 2. Many code samples depend on external GCP services and need credentials to access the service. @@ -68,72 +68,25 @@ The samples must be separate from the primary project for a few reasons: ### Building ```bash -mvn -Penable-samples clean verify +mvn clean verify ``` Some samples require access to GCP services and require a service account: ```bash export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service/account.json -mvn -Penable-samples clean verify +mvn clean verify ``` -### Profile Config - -1. To add samples in a profile to your Maven project, add the following to your -`pom.xml` - - ```xml - - [...] - - - enable-samples - - sample - - - - [...] - - ``` - -2. [Activate](#profile-activation) the profile. -3. Define your samples in a normal Maven project in the `samples/` directory. - ### Code Formatting Code in this repo is formatted with [google-java-format](https://github.com/google/google-java-format). To run formatting on your project, you can run: ``` -mvn com.coveo:fmt-maven-plugin:format +mvn com.spotify.fmt:fmt-maven-plugin:format ``` -### Profile Activation - -To include code samples when building and testing the project, enable the -`enable-samples` Maven profile. - -#### Command line - -To activate the Maven profile on the command line add `-Penable-samples` to your -Maven command. - -#### Maven `settings.xml` - -To activate the Maven profile in your `~/.m2/settings.xml` add an entry of -`enable-samples` following the instructions in [Active Profiles][2]. - -This method has the benefit of applying to all projects you build (and is -respected by IntelliJ IDEA) and is recommended if you are going to be -contributing samples to several projects. - -#### IntelliJ IDEA - -To activate the Maven Profile inside IntelliJ IDEA, follow the instructions in -[Activate Maven profiles][3] to activate `enable-samples`. - [1]: https://cloud.google.com/docs/authentication/getting-started#creating_a_service_account [2]: https://maven.apache.org/settings.html#Active_Profiles -[3]: https://www.jetbrains.com/help/idea/work-with-maven-profiles.html#activate_maven_profiles +[3]: https://github.com/GoogleCloudPlatform/java-docs-samples/blob/main/SAMPLE_FORMAT.md \ No newline at end of file diff --git a/README.md b/README.md index d55457105..1a8adf4e3 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ +**_THIS REPOSITORY IS DEPRECATED. ALL OF ITS CONTENT AND HISTORY HAS BEEN MOVED TO [GOOGLE-CLOUD-JAVA](https://github.com/googleapis/google-cloud-java/tree/main/java-pubsub)_** + + # Google Cloud Pub/Sub Client for Java Java idiomatic client for [Cloud Pub/Sub][product-docs]. @@ -8,16 +11,18 @@ Java idiomatic client for [Cloud Pub/Sub][product-docs]. - [Product Documentation][product-docs] - [Client Library Documentation][javadocs] + ## Quickstart -If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file +If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file: + ```xml com.google.cloud libraries-bom - 19.0.0 + 26.76.0 pom import @@ -34,37 +39,45 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file ``` -If you are using Maven without BOM, add this to your dependencies: +If you are using Maven without the BOM, add this to your dependencies: + ```xml com.google.cloud google-cloud-pubsub - 1.111.4 + 1.148.0 ``` -If you are using Gradle 5.x or later, 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:19.0.0') +implementation platform('com.google.cloud:libraries-bom:26.80.0') -compile 'com.google.cloud:google-cloud-pubsub' +implementation 'com.google.cloud:google-cloud-pubsub' ``` -If you are using Gradle without BOM, add this to your dependencies +If you are using Gradle without BOM, add this to your dependencies: + ```Groovy -compile 'com.google.cloud:google-cloud-pubsub:1.111.4' +implementation 'com.google.cloud:google-cloud-pubsub:1.150.2' ``` -If you are using SBT, add this to your dependencies +If you are using SBT, add this to your dependencies: + ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-pubsub" % "1.111.4" +libraryDependencies += "com.google.cloud" % "google-cloud-pubsub" % "1.150.2" ``` ## Authentication See the [Authentication][authentication] section in the base directory's README. +## Authorization + +The client application making API calls must be granted [authorization scopes][auth-scopes] required for the desired Cloud Pub/Sub APIs, and the authenticated principal must have the [IAM role(s)][predefined-iam-roles] required to access GCP resources using the Cloud Pub/Sub API calls. + ## Getting Started ### Prerequisites @@ -72,7 +85,7 @@ See the [Authentication][authentication] section in the base directory's README. You will need a [Google Cloud Platform Console][developer-console] project with the Cloud Pub/Sub [API enabled][enable-api]. You will need to [enable billing][enable-billing] to use Google Cloud Pub/Sub. [Follow these instructions][create-project] to get your project set up. You will also need to set up the local development environment by -[installing the Google Cloud SDK][cloud-sdk] and running the following commands in command line: +[installing the Google Cloud Command Line Interface][cloud-cli] and running the following commands in command line: `gcloud auth login` and `gcloud config set project [YOUR PROJECT ID]`. ### Installation and setup @@ -96,12 +109,12 @@ publishers. Add the following imports at the top of your file: ```java import com.google.cloud.pubsub.v1.TopicAdminClient; -import com.google.pubsub.v1.ProjectTopicName; +import com.google.pubsub.v1.TopicName; ``` Then, to create the topic, use the following code: ```java -ProjectTopicName topic = ProjectTopicName.of("test-project", "test-topic"); +TopicName topic = TopicName.of("test-project", "test-topic"); try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) { topicAdminClient.createTopic(topic); } @@ -155,14 +168,14 @@ single, specific topic. Add the following imports at the top of your file: ```java import com.google.cloud.pubsub.v1.SubscriptionAdminClient; import com.google.pubsub.v1.PushConfig; -import com.google.pubsub.v1.ProjectSubscriptionName; -import com.google.pubsub.v1.ProjectTopicName; +import com.google.pubsub.v1.SubscriptionName; +import com.google.pubsub.v1.TopicName; ``` Then, to create the subscription, use the following code: ```java -ProjectTopicName topic = ProjectTopicName.of("test-project", "test-topic"); -ProjectSubscriptionName subscription = ProjectSubscriptionName.of("test-project", "test-subscription"); +TopicName topic = TopicName.of("test-project", "test-topic"); +SubscriptionName subscription = SubscriptionName.of("test-project", "test-subscription"); try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) { subscriptionAdminClient.createSubscription(subscription, topic, PushConfig.getDefaultInstance(), 0); @@ -180,13 +193,13 @@ import com.google.cloud.pubsub.v1.MessageReceiver; import com.google.cloud.pubsub.v1.Subscriber; import com.google.common.util.concurrent.MoreExecutors; import com.google.pubsub.v1.PubsubMessage; -import com.google.pubsub.v1.ProjectSubscriptionName; -import com.google.pubsub.v1.ProjectTopicName; +import com.google.pubsub.v1.SubscriptionName; +import com.google.pubsub.v1.TopicName; ``` Then, to pull messages asynchronously, use the following code: ```java -ProjectSubscriptionName subscription = ProjectSubscriptionName.of("test-project", "test-subscription"); +SubscriptionName subscription = SubscriptionName.of("test-project", "test-subscription"); MessageReceiver receiver = new MessageReceiver() { @@ -199,7 +212,7 @@ MessageReceiver receiver = Subscriber subscriber = null; try { - subscriber = Subscriber.newBuilder(subscription, receiver).build(); + subscriber = Subscriber.newBuilder(subscription.toString(), receiver).build(); subscriber.addListener( new Subscriber.Listener() { @Override @@ -226,59 +239,87 @@ In [CreateTopicAndPublishMessages.java](https://github.com/googleapis/google-clo ## Samples -Samples are in the [`samples/`](https://github.com/googleapis/java-pubsub/tree/master/samples) directory. The samples' `README.md` -has instructions for running the samples. +Samples are in the [`samples/`](https://github.com/googleapis/java-pubsub/tree/main/samples) directory. | Sample | Source Code | Try it | | --------------------------- | --------------------------------- | ------ | -| Create Avro Schema Example | [source code](https://github.com/googleapis/java-pubsub/blob/master/samples/snippets/src/main/java/pubsub/CreateAvroSchemaExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/CreateAvroSchemaExample.java) | -| Create Proto Schema Example | [source code](https://github.com/googleapis/java-pubsub/blob/master/samples/snippets/src/main/java/pubsub/CreateProtoSchemaExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/CreateProtoSchemaExample.java) | -| Create Pull Subscription Example | [source code](https://github.com/googleapis/java-pubsub/blob/master/samples/snippets/src/main/java/pubsub/CreatePullSubscriptionExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/CreatePullSubscriptionExample.java) | -| Create Push Subscription Example | [source code](https://github.com/googleapis/java-pubsub/blob/master/samples/snippets/src/main/java/pubsub/CreatePushSubscriptionExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/CreatePushSubscriptionExample.java) | -| Create Subscription With Dead Letter Policy Example | [source code](https://github.com/googleapis/java-pubsub/blob/master/samples/snippets/src/main/java/pubsub/CreateSubscriptionWithDeadLetterPolicyExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/CreateSubscriptionWithDeadLetterPolicyExample.java) | -| Create Subscription With Ordering | [source code](https://github.com/googleapis/java-pubsub/blob/master/samples/snippets/src/main/java/pubsub/CreateSubscriptionWithOrdering.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/CreateSubscriptionWithOrdering.java) | -| Create Topic Example | [source code](https://github.com/googleapis/java-pubsub/blob/master/samples/snippets/src/main/java/pubsub/CreateTopicExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/CreateTopicExample.java) | -| Create Topic With Schema Example | [source code](https://github.com/googleapis/java-pubsub/blob/master/samples/snippets/src/main/java/pubsub/CreateTopicWithSchemaExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/CreateTopicWithSchemaExample.java) | -| Delete Schema Example | [source code](https://github.com/googleapis/java-pubsub/blob/master/samples/snippets/src/main/java/pubsub/DeleteSchemaExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/DeleteSchemaExample.java) | -| Delete Subscription Example | [source code](https://github.com/googleapis/java-pubsub/blob/master/samples/snippets/src/main/java/pubsub/DeleteSubscriptionExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/DeleteSubscriptionExample.java) | -| Delete Topic Example | [source code](https://github.com/googleapis/java-pubsub/blob/master/samples/snippets/src/main/java/pubsub/DeleteTopicExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/DeleteTopicExample.java) | -| Detach Subscription Example | [source code](https://github.com/googleapis/java-pubsub/blob/master/samples/snippets/src/main/java/pubsub/DetachSubscriptionExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/DetachSubscriptionExample.java) | -| Get Schema Example | [source code](https://github.com/googleapis/java-pubsub/blob/master/samples/snippets/src/main/java/pubsub/GetSchemaExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/GetSchemaExample.java) | -| Get Subscription Policy Example | [source code](https://github.com/googleapis/java-pubsub/blob/master/samples/snippets/src/main/java/pubsub/GetSubscriptionPolicyExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/GetSubscriptionPolicyExample.java) | -| Get Topic Policy Example | [source code](https://github.com/googleapis/java-pubsub/blob/master/samples/snippets/src/main/java/pubsub/GetTopicPolicyExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/GetTopicPolicyExample.java) | -| List Schemas Example | [source code](https://github.com/googleapis/java-pubsub/blob/master/samples/snippets/src/main/java/pubsub/ListSchemasExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/ListSchemasExample.java) | -| List Subscriptions In Project Example | [source code](https://github.com/googleapis/java-pubsub/blob/master/samples/snippets/src/main/java/pubsub/ListSubscriptionsInProjectExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/ListSubscriptionsInProjectExample.java) | -| List Subscriptions In Topic Example | [source code](https://github.com/googleapis/java-pubsub/blob/master/samples/snippets/src/main/java/pubsub/ListSubscriptionsInTopicExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/ListSubscriptionsInTopicExample.java) | -| List Topics Example | [source code](https://github.com/googleapis/java-pubsub/blob/master/samples/snippets/src/main/java/pubsub/ListTopicsExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/ListTopicsExample.java) | -| Publish Avro Records Example | [source code](https://github.com/googleapis/java-pubsub/blob/master/samples/snippets/src/main/java/pubsub/PublishAvroRecordsExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/PublishAvroRecordsExample.java) | -| Publish Protobuf Messages Example | [source code](https://github.com/googleapis/java-pubsub/blob/master/samples/snippets/src/main/java/pubsub/PublishProtobufMessagesExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/PublishProtobufMessagesExample.java) | -| Publish With Batch Settings Example | [source code](https://github.com/googleapis/java-pubsub/blob/master/samples/snippets/src/main/java/pubsub/PublishWithBatchSettingsExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/PublishWithBatchSettingsExample.java) | -| Publish With Concurrency Control Example | [source code](https://github.com/googleapis/java-pubsub/blob/master/samples/snippets/src/main/java/pubsub/PublishWithConcurrencyControlExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/PublishWithConcurrencyControlExample.java) | -| Publish With Custom Attributes Example | [source code](https://github.com/googleapis/java-pubsub/blob/master/samples/snippets/src/main/java/pubsub/PublishWithCustomAttributesExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/PublishWithCustomAttributesExample.java) | -| Publish With Error Handler Example | [source code](https://github.com/googleapis/java-pubsub/blob/master/samples/snippets/src/main/java/pubsub/PublishWithErrorHandlerExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/PublishWithErrorHandlerExample.java) | -| Publish With Ordering Keys | [source code](https://github.com/googleapis/java-pubsub/blob/master/samples/snippets/src/main/java/pubsub/PublishWithOrderingKeys.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/PublishWithOrderingKeys.java) | -| Publish With Retry Settings Example | [source code](https://github.com/googleapis/java-pubsub/blob/master/samples/snippets/src/main/java/pubsub/PublishWithRetrySettingsExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/PublishWithRetrySettingsExample.java) | -| Publisher Example | [source code](https://github.com/googleapis/java-pubsub/blob/master/samples/snippets/src/main/java/pubsub/PublisherExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/PublisherExample.java) | -| Receive Messages With Delivery Attempts Example | [source code](https://github.com/googleapis/java-pubsub/blob/master/samples/snippets/src/main/java/pubsub/ReceiveMessagesWithDeliveryAttemptsExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/ReceiveMessagesWithDeliveryAttemptsExample.java) | -| Remove Dead Letter Policy Example | [source code](https://github.com/googleapis/java-pubsub/blob/master/samples/snippets/src/main/java/pubsub/RemoveDeadLetterPolicyExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/RemoveDeadLetterPolicyExample.java) | -| Resume Publish With Ordering Keys | [source code](https://github.com/googleapis/java-pubsub/blob/master/samples/snippets/src/main/java/pubsub/ResumePublishWithOrderingKeys.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/ResumePublishWithOrderingKeys.java) | -| Set Subscription Policy Example | [source code](https://github.com/googleapis/java-pubsub/blob/master/samples/snippets/src/main/java/pubsub/SetSubscriptionPolicyExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/SetSubscriptionPolicyExample.java) | -| Set Topic Policy Example | [source code](https://github.com/googleapis/java-pubsub/blob/master/samples/snippets/src/main/java/pubsub/SetTopicPolicyExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/SetTopicPolicyExample.java) | -| Subscribe Async Example | [source code](https://github.com/googleapis/java-pubsub/blob/master/samples/snippets/src/main/java/pubsub/SubscribeAsyncExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/SubscribeAsyncExample.java) | -| Subscribe Sync Example | [source code](https://github.com/googleapis/java-pubsub/blob/master/samples/snippets/src/main/java/pubsub/SubscribeSyncExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/SubscribeSyncExample.java) | -| Subscribe Sync With Lease Example | [source code](https://github.com/googleapis/java-pubsub/blob/master/samples/snippets/src/main/java/pubsub/SubscribeSyncWithLeaseExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/SubscribeSyncWithLeaseExample.java) | -| Subscribe With Avro Schema Example | [source code](https://github.com/googleapis/java-pubsub/blob/master/samples/snippets/src/main/java/pubsub/SubscribeWithAvroSchemaExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/SubscribeWithAvroSchemaExample.java) | -| Subscribe With Concurrency Control Example | [source code](https://github.com/googleapis/java-pubsub/blob/master/samples/snippets/src/main/java/pubsub/SubscribeWithConcurrencyControlExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/SubscribeWithConcurrencyControlExample.java) | -| Subscribe With Custom Attributes Example | [source code](https://github.com/googleapis/java-pubsub/blob/master/samples/snippets/src/main/java/pubsub/SubscribeWithCustomAttributesExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/SubscribeWithCustomAttributesExample.java) | -| Subscribe With Error Listener Example | [source code](https://github.com/googleapis/java-pubsub/blob/master/samples/snippets/src/main/java/pubsub/SubscribeWithErrorListenerExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/SubscribeWithErrorListenerExample.java) | -| Subscribe With Flow Control Settings Example | [source code](https://github.com/googleapis/java-pubsub/blob/master/samples/snippets/src/main/java/pubsub/SubscribeWithFlowControlSettingsExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/SubscribeWithFlowControlSettingsExample.java) | -| Subscribe With Proto Schema Example | [source code](https://github.com/googleapis/java-pubsub/blob/master/samples/snippets/src/main/java/pubsub/SubscribeWithProtoSchemaExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/SubscribeWithProtoSchemaExample.java) | -| Test Subscription Permissions Example | [source code](https://github.com/googleapis/java-pubsub/blob/master/samples/snippets/src/main/java/pubsub/TestSubscriptionPermissionsExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/TestSubscriptionPermissionsExample.java) | -| Test Topic Permissions Example | [source code](https://github.com/googleapis/java-pubsub/blob/master/samples/snippets/src/main/java/pubsub/TestTopicPermissionsExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/TestTopicPermissionsExample.java) | -| Update Dead Letter Policy Example | [source code](https://github.com/googleapis/java-pubsub/blob/master/samples/snippets/src/main/java/pubsub/UpdateDeadLetterPolicyExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/UpdateDeadLetterPolicyExample.java) | -| Update Push Configuration Example | [source code](https://github.com/googleapis/java-pubsub/blob/master/samples/snippets/src/main/java/pubsub/UpdatePushConfigurationExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/UpdatePushConfigurationExample.java) | -| State | [source code](https://github.com/googleapis/java-pubsub/blob/master/samples/snippets/src/main/java/utilities/State.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/utilities/State.java) | -| State Proto | [source code](https://github.com/googleapis/java-pubsub/blob/master/samples/snippets/src/main/java/utilities/StateProto.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/utilities/StateProto.java) | +| Commit Avro Schema Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/CommitAvroSchemaExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/CommitAvroSchemaExample.java) | +| Commit Proto Schema Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/CommitProtoSchemaExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/CommitProtoSchemaExample.java) | +| Create Avro Schema Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/CreateAvroSchemaExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/CreateAvroSchemaExample.java) | +| Create Big Query Subscription Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/CreateBigQuerySubscriptionExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/CreateBigQuerySubscriptionExample.java) | +| Create Cloud Storage Subscription Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/CreateCloudStorageSubscriptionExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/CreateCloudStorageSubscriptionExample.java) | +| Create Proto Schema Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/CreateProtoSchemaExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/CreateProtoSchemaExample.java) | +| Create Pull Subscription Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/CreatePullSubscriptionExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/CreatePullSubscriptionExample.java) | +| Create Push Subscription Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/CreatePushSubscriptionExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/CreatePushSubscriptionExample.java) | +| Create Subscription With Dead Letter Policy Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/CreateSubscriptionWithDeadLetterPolicyExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/CreateSubscriptionWithDeadLetterPolicyExample.java) | +| Create Subscription With Exactly Once Delivery | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/CreateSubscriptionWithExactlyOnceDelivery.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/CreateSubscriptionWithExactlyOnceDelivery.java) | +| Create Subscription With Filtering | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/CreateSubscriptionWithFiltering.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/CreateSubscriptionWithFiltering.java) | +| Create Subscription With Ordering | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/CreateSubscriptionWithOrdering.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/CreateSubscriptionWithOrdering.java) | +| Create Subscription With Smt Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/CreateSubscriptionWithSmtExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/CreateSubscriptionWithSmtExample.java) | +| Create Topic Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/CreateTopicExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/CreateTopicExample.java) | +| Create Topic With Aws Msk Ingestion Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/CreateTopicWithAwsMskIngestionExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/CreateTopicWithAwsMskIngestionExample.java) | +| Create Topic With Azure Event Hubs Ingestion Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/CreateTopicWithAzureEventHubsIngestionExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/CreateTopicWithAzureEventHubsIngestionExample.java) | +| Create Topic With Cloud Storage Ingestion Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/CreateTopicWithCloudStorageIngestionExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/CreateTopicWithCloudStorageIngestionExample.java) | +| Create Topic With Confluent Cloud Ingestion Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/CreateTopicWithConfluentCloudIngestionExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/CreateTopicWithConfluentCloudIngestionExample.java) | +| Create Topic With Kinesis Ingestion Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/CreateTopicWithKinesisIngestionExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/CreateTopicWithKinesisIngestionExample.java) | +| Create Topic With Schema Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/CreateTopicWithSchemaExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/CreateTopicWithSchemaExample.java) | +| Create Topic With Schema Revisions Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/CreateTopicWithSchemaRevisionsExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/CreateTopicWithSchemaRevisionsExample.java) | +| Create Topic With Smt Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/CreateTopicWithSmtExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/CreateTopicWithSmtExample.java) | +| Create Unwrapped Push Subscription Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/CreateUnwrappedPushSubscriptionExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/CreateUnwrappedPushSubscriptionExample.java) | +| Delete Schema Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/DeleteSchemaExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/DeleteSchemaExample.java) | +| Delete Schema Revision Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/DeleteSchemaRevisionExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/DeleteSchemaRevisionExample.java) | +| Delete Subscription Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/DeleteSubscriptionExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/DeleteSubscriptionExample.java) | +| Delete Topic Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/DeleteTopicExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/DeleteTopicExample.java) | +| Detach Subscription Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/DetachSubscriptionExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/DetachSubscriptionExample.java) | +| Get Schema Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/GetSchemaExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/GetSchemaExample.java) | +| Get Schema Revision Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/GetSchemaRevisionExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/GetSchemaRevisionExample.java) | +| Get Subscription Policy Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/GetSubscriptionPolicyExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/GetSubscriptionPolicyExample.java) | +| Get Topic Policy Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/GetTopicPolicyExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/GetTopicPolicyExample.java) | +| List Schema Revisions Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/ListSchemaRevisionsExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/ListSchemaRevisionsExample.java) | +| List Schemas Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/ListSchemasExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/ListSchemasExample.java) | +| List Subscriptions In Project Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/ListSubscriptionsInProjectExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/ListSubscriptionsInProjectExample.java) | +| List Subscriptions In Topic Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/ListSubscriptionsInTopicExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/ListSubscriptionsInTopicExample.java) | +| List Topics Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/ListTopicsExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/ListTopicsExample.java) | +| Open Telemetry Publisher Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/OpenTelemetryPublisherExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/OpenTelemetryPublisherExample.java) | +| Open Telemetry Subscriber Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/OpenTelemetrySubscriberExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/OpenTelemetrySubscriberExample.java) | +| Optimistic Subscribe Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/OptimisticSubscribeExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/OptimisticSubscribeExample.java) | +| Publish Avro Records Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/PublishAvroRecordsExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/PublishAvroRecordsExample.java) | +| Publish Protobuf Messages Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/PublishProtobufMessagesExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/PublishProtobufMessagesExample.java) | +| Publish With Batch Settings Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/PublishWithBatchSettingsExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/PublishWithBatchSettingsExample.java) | +| Publish With Concurrency Control Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/PublishWithConcurrencyControlExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/PublishWithConcurrencyControlExample.java) | +| Publish With Custom Attributes Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/PublishWithCustomAttributesExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/PublishWithCustomAttributesExample.java) | +| Publish With Error Handler Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/PublishWithErrorHandlerExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/PublishWithErrorHandlerExample.java) | +| Publish With Flow Control Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/PublishWithFlowControlExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/PublishWithFlowControlExample.java) | +| Publish With Grpc Compression Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/PublishWithGrpcCompressionExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/PublishWithGrpcCompressionExample.java) | +| Publish With Ordering Keys | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/PublishWithOrderingKeys.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/PublishWithOrderingKeys.java) | +| Publish With Retry Settings Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/PublishWithRetrySettingsExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/PublishWithRetrySettingsExample.java) | +| Publisher Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/PublisherExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/PublisherExample.java) | +| Receive Messages With Delivery Attempts Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/ReceiveMessagesWithDeliveryAttemptsExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/ReceiveMessagesWithDeliveryAttemptsExample.java) | +| Remove Dead Letter Policy Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/RemoveDeadLetterPolicyExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/RemoveDeadLetterPolicyExample.java) | +| Resume Publish With Ordering Keys | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/ResumePublishWithOrderingKeys.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/ResumePublishWithOrderingKeys.java) | +| Rollback Schema Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/RollbackSchemaExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/RollbackSchemaExample.java) | +| Set Subscription Policy Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/SetSubscriptionPolicyExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/SetSubscriptionPolicyExample.java) | +| Set Topic Policy Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/SetTopicPolicyExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/SetTopicPolicyExample.java) | +| Subscribe Async Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/SubscribeAsyncExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/SubscribeAsyncExample.java) | +| Subscribe Sync Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/SubscribeSyncExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/SubscribeSyncExample.java) | +| Subscribe Sync With Lease Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/SubscribeSyncWithLeaseExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/SubscribeSyncWithLeaseExample.java) | +| Subscribe With Avro Schema Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/SubscribeWithAvroSchemaExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/SubscribeWithAvroSchemaExample.java) | +| Subscribe With Avro Schema Revisions Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/SubscribeWithAvroSchemaRevisionsExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/SubscribeWithAvroSchemaRevisionsExample.java) | +| Subscribe With Concurrency Control Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/SubscribeWithConcurrencyControlExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/SubscribeWithConcurrencyControlExample.java) | +| Subscribe With Custom Attributes Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/SubscribeWithCustomAttributesExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/SubscribeWithCustomAttributesExample.java) | +| Subscribe With Error Listener Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/SubscribeWithErrorListenerExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/SubscribeWithErrorListenerExample.java) | +| Subscribe With Exactly Once Consumer With Response Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/SubscribeWithExactlyOnceConsumerWithResponseExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/SubscribeWithExactlyOnceConsumerWithResponseExample.java) | +| Subscribe With Flow Control Settings Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/SubscribeWithFlowControlSettingsExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/SubscribeWithFlowControlSettingsExample.java) | +| Subscribe With Proto Schema Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/SubscribeWithProtoSchemaExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/SubscribeWithProtoSchemaExample.java) | +| Test Subscription Permissions Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/TestSubscriptionPermissionsExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/TestSubscriptionPermissionsExample.java) | +| Test Topic Permissions Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/TestTopicPermissionsExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/TestTopicPermissionsExample.java) | +| Update Dead Letter Policy Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/UpdateDeadLetterPolicyExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/UpdateDeadLetterPolicyExample.java) | +| Update Push Configuration Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/UpdatePushConfigurationExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/UpdatePushConfigurationExample.java) | +| Update Topic Schema Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/UpdateTopicSchemaExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/UpdateTopicSchemaExample.java) | +| Update Topic Type Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/UpdateTopicTypeExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/UpdateTopicTypeExample.java) | +| Use Pub Sub Emulator Example | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/pubsub/UsePubSubEmulatorExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/pubsub/UsePubSubEmulatorExample.java) | +| State | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/utilities/State.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/utilities/State.java) | +| State Proto | [source code](https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/main/java/utilities/StateProto.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-pubsub&page=editor&open_in_editor=samples/snippets/src/main/java/utilities/StateProto.java) | @@ -286,9 +327,53 @@ has instructions for running the samples. To get help, follow the instructions in the [shared Troubleshooting document][troubleshooting]. -## Java Versions +## Transport + +Cloud Pub/Sub uses both gRPC and HTTP/JSON for the transport layer. + +## Supported Java Versions + +Java 8 or above is required for using this client. + +Google's Java client libraries, +[Google Cloud Client Libraries][cloudlibs] +and +[Google Cloud API Libraries][apilibs], +follow the +[Oracle Java SE support roadmap][oracle] +(see the Oracle Java SE Product Releases section). -Java 7 or above is required for using this client. +### For new development + +In general, new feature development occurs with support for the lowest Java +LTS version covered by Oracle's Premier Support (which typically lasts 5 years +from initial General Availability). If the minimum required JVM for a given +library is changed, it is accompanied by a [semver][semver] major release. + +Java 11 and (in September 2021) Java 17 are the best choices for new +development. + +### Keeping production systems current + +Google tests its client libraries with all current LTS versions covered by +Oracle's Extended Support (which typically lasts 8 years from initial +General Availability). + +#### Legacy support + +Google's client libraries support legacy versions of Java runtimes with long +term stable libraries that don't receive feature updates on a best efforts basis +as it may not be possible to backport all patches. + +Google provides updates on a best efforts basis to apps that continue to use +Java 7, though apps might need to upgrade to current versions of the library +that supports their JVM. + +#### Where to find specific information + +The latest versions and the supported Java versions are identified on +the individual GitHub repository `github.com/GoogleAPIs/java-SERVICENAME` +and on [google-cloud-java][g-c-j]. ## Versioning @@ -296,6 +381,7 @@ Java 7 or above is required for using this client. This library follows [Semantic Versioning](http://semver.org/). + ## Contributing @@ -307,46 +393,36 @@ Please note that this project is released with a Contributor Code of Conduct. By this project you agree to abide by its terms. See [Code of Conduct][code-of-conduct] for more information. + ## License Apache 2.0 - See [LICENSE][license] for more information. -## CI Status - -Java Version | Status ------------- | ------ -Java 7 | [![Kokoro CI][kokoro-badge-image-1]][kokoro-badge-link-1] -Java 8 | [![Kokoro CI][kokoro-badge-image-2]][kokoro-badge-link-2] -Java 8 OSX | [![Kokoro CI][kokoro-badge-image-3]][kokoro-badge-link-3] -Java 8 Windows | [![Kokoro CI][kokoro-badge-image-4]][kokoro-badge-link-4] -Java 11 | [![Kokoro CI][kokoro-badge-image-5]][kokoro-badge-link-5] - Java is a registered trademark of Oracle and/or its affiliates. [product-docs]: https://cloud.google.com/pubsub/docs/ -[javadocs]: https://googleapis.dev/java/google-cloud-pubsub/latest/index.html -[kokoro-badge-image-1]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-pubsub/java7.svg -[kokoro-badge-link-1]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-pubsub/java7.html -[kokoro-badge-image-2]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-pubsub/java8.svg -[kokoro-badge-link-2]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-pubsub/java8.html -[kokoro-badge-image-3]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-pubsub/java8-osx.svg -[kokoro-badge-link-3]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-pubsub/java8-osx.html -[kokoro-badge-image-4]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-pubsub/java8-win.svg -[kokoro-badge-link-4]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-pubsub/java8-win.html -[kokoro-badge-image-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-pubsub/java11.svg -[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-ga-green +[javadocs]: https://cloud.google.com/java/docs/reference/google-cloud-pubsub/latest/history +[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://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-pubsub&core=gav +[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-pubsub/1.150.2 [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 +[iam-policy]: https://cloud.google.com/iam/docs/overview#cloud-iam-policy [developer-console]: https://console.developers.google.com/ [create-project]: https://cloud.google.com/resource-manager/docs/creating-managing-projects -[cloud-sdk]: https://cloud.google.com/sdk/ -[troubleshooting]: https://github.com/googleapis/google-cloud-common/blob/master/troubleshooting/readme.md#troubleshooting -[contributing]: https://github.com/googleapis/java-pubsub/blob/master/CONTRIBUTING.md -[code-of-conduct]: https://github.com/googleapis/java-pubsub/blob/master/CODE_OF_CONDUCT.md#contributor-code-of-conduct -[license]: https://github.com/googleapis/java-pubsub/blob/master/LICENSE +[cloud-cli]: https://cloud.google.com/cli +[troubleshooting]: https://github.com/googleapis/google-cloud-java/blob/main/TROUBLESHOOTING.md +[contributing]: https://github.com/googleapis/java-pubsub/blob/main/CONTRIBUTING.md +[code-of-conduct]: https://github.com/googleapis/java-pubsub/blob/main/CODE_OF_CONDUCT.md#contributor-code-of-conduct +[license]: https://github.com/googleapis/java-pubsub/blob/main/LICENSE [enable-billing]: https://cloud.google.com/apis/docs/getting-started#enabling_billing [enable-api]: https://console.cloud.google.com/flows/enableapi?apiid=pubsub.googleapis.com [libraries-bom]: https://github.com/GoogleCloudPlatform/cloud-opensource-java/wiki/The-Google-Cloud-Platform-Libraries-BOM [shell_img]: https://gstatic.com/cloudssh/images/open-btn.png + +[semver]: https://semver.org/ +[cloudlibs]: https://cloud.google.com/apis/docs/client-libraries-explained +[apilibs]: https://cloud.google.com/apis/docs/client-libraries-explained#google_api_client_libraries +[oracle]: https://www.oracle.com/java/technologies/java-se-support-roadmap.html +[g-c-j]: http://github.com/googleapis/google-cloud-java diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 000000000..8b58ae9c0 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,7 @@ +# Security Policy + +To report a security issue, please use [g.co/vulnz](https://g.co/vulnz). + +The Google Security Team will respond within 5 working days of your report on g.co/vulnz. + +We use g.co/vulnz for our intake, and do coordination and disclosure here using GitHub Security Advisory to privately discuss and fix the issue. diff --git a/generation_config.yaml b/generation_config.yaml new file mode 100644 index 000000000..e6044361b --- /dev/null +++ b/generation_config.yaml @@ -0,0 +1,23 @@ +gapic_generator_version: 2.72.0 +googleapis_commitish: c2648728afb6deff882cfc4167a21abd382870fa +libraries_bom_version: 26.80.0 +libraries: + - api_shortname: pubsub + name_pretty: Cloud Pub/Sub + api_reference: https://cloud.google.com/pubsub/ + product_documentation: https://cloud.google.com/pubsub/docs/ + client_documentation: https://cloud.google.com/java/docs/reference/google-cloud-pubsub/latest/history + api_description: is designed to provide reliable, many-to-many, asynchronous messaging between applications. Publisher applications can send messages to a topic and other applications can subscribe to that topic to receive the messages. By decoupling senders and receivers, Google Cloud Pub/Sub allows developers to communicate between independently written applications. + issue_tracker: https://issuetracker.google.com/savedsearches/559741 + release_level: stable + language: java + repo: googleapis/java-pubsub + repo_short: java-pubsub + distribution_name: com.google.cloud:google-cloud-pubsub + codeowner_team: '@googleapis/pubsub-team' + api_id: pubsub.googleapis.com + library_type: GAPIC_COMBO + requires_billing: true + recommended_package: com.google.cloud.pubsub.v1 + GAPICs: + - proto_path: google/pubsub/v1 diff --git a/google-cloud-pubsub-bom/pom.xml b/google-cloud-pubsub-bom/pom.xml index ea64cce92..6da6aad59 100644 --- a/google-cloud-pubsub-bom/pom.xml +++ b/google-cloud-pubsub-bom/pom.xml @@ -1,14 +1,14 @@ - + 4.0.0 com.google.cloud google-cloud-pubsub-bom - 1.111.5-SNAPSHOT + 1.150.3-SNAPSHOT pom com.google.cloud - google-cloud-shared-config - 0.11.0 + sdk-platform-java-config + 3.62.0 Google Cloud pubsub BOM @@ -39,17 +39,6 @@ https://github.com/googleapis/java-pubsub - - - sonatype-nexus-snapshots - https://oss.sonatype.org/content/repositories/snapshots - - - sonatype-nexus-staging - https://oss.sonatype.org/service/local/staging/deploy/maven2/ - - - The Apache Software License, Version 2.0 @@ -60,21 +49,20 @@ - - com.google.api.grpc - proto-google-cloud-pubsub-v1 - 1.93.5-SNAPSHOT + com.google.cloud + google-cloud-pubsub + 1.150.3-SNAPSHOT com.google.api.grpc grpc-google-cloud-pubsub-v1 - 1.93.5-SNAPSHOT + 1.132.3-SNAPSHOT - com.google.cloud - google-cloud-pubsub - 1.111.5-SNAPSHOT + com.google.api.grpc + proto-google-cloud-pubsub-v1 + 1.132.3-SNAPSHOT @@ -90,4 +78,4 @@ - \ No newline at end of file + diff --git a/google-cloud-pubsub/EnableAutoValue.txt b/google-cloud-pubsub/EnableAutoValue.txt new file mode 100644 index 000000000..e69de29bb diff --git a/google-cloud-pubsub/clirr-ignored-differences.xml b/google-cloud-pubsub/clirr-ignored-differences.xml new file mode 100644 index 000000000..e4629e32e --- /dev/null +++ b/google-cloud-pubsub/clirr-ignored-differences.xml @@ -0,0 +1,24 @@ + + + + + 7005 + + com/google/cloud/pubsub/v1/MessageDispatcher$Builder + *(org.threeten.bp.Duration) + *(java.time.Duration) + + + 7005 + + com/google/cloud/pubsub/v1/StreamingSubscriberConnection$Builder + *(org.threeten.bp.Duration) + *(java.time.Duration) + + + 7002 + + com/google/cloud/pubsub/v1/StreamingSubscriberConnection$Builder + * setEodAckCallbackExecutor(*) + + diff --git a/google-cloud-pubsub/pom.xml b/google-cloud-pubsub/pom.xml index df03465bb..a0d5f9483 100644 --- a/google-cloud-pubsub/pom.xml +++ b/google-cloud-pubsub/pom.xml @@ -1,9 +1,9 @@ - + 4.0.0 com.google.cloud google-cloud-pubsub - 1.111.5-SNAPSHOT + 1.150.3-SNAPSHOT jar Google Cloud Pub/Sub https://github.com/googleapis/java-pubsub @@ -11,7 +11,7 @@ com.google.cloud google-cloud-pubsub-parent - 1.111.5-SNAPSHOT + 1.150.3-SNAPSHOT google-cloud-pubsub @@ -24,6 +24,7 @@ io.grpc grpc-stub + runtime io.grpc @@ -41,7 +42,10 @@ com.google.api.grpc proto-google-common-protos - + + com.google.auth + google-auth-library-oauth2-http + com.google.api.grpc proto-google-cloud-pubsub-v1 @@ -62,6 +66,10 @@ com.google.api gax-grpc + + com.google.api + gax-httpjson + org.threeten threetenbp @@ -76,7 +84,8 @@ io.grpc - grpc-core + grpc-inprocess + test com.google.errorprone @@ -89,6 +98,15 @@ com.google.http-client google-http-client + runtime + + + io.opentelemetry + opentelemetry-api + + + io.opentelemetry + opentelemetry-context @@ -106,6 +124,13 @@ org.easymock easymock test + + + + org.mockito + mockito-core + test com.google.cloud @@ -127,13 +152,40 @@ opencensus-impl test + + io.opentelemetry + opentelemetry-sdk-trace + test + + + io.opentelemetry + opentelemetry-sdk-testing + test + + + org.assertj + assertj-core + test + + + com.google.api + gax + testlib + test + com.google.api gax-grpc testlib test + + com.google.api + gax-httpjson + testlib + test + @@ -142,35 +194,18 @@ org.apache.maven.plugins maven-dependency-plugin - 3.1.2 + com.google.auth:google-auth-library-oauth2-http:jar io.opencensus:opencensus-impl javax.annotation:javax.annotation-api + org.assertj:assertj-core - - maven-compiler-plugin - 3.8.1 - - 1.7 - 1.7 - UTF-8 - -Xlint:unchecked - - - com.google.auto.value - auto-value - ${auto-value-annotation.version} - - - - - org.codehaus.mojo flatten-maven-plugin @@ -192,4 +227,4 @@ - \ No newline at end of file + diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/AckReplyConsumerImpl.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/AckReplyConsumerImpl.java new file mode 100644 index 000000000..f9d4bd15a --- /dev/null +++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/AckReplyConsumerImpl.java @@ -0,0 +1,37 @@ +/* + * Copyright 2022 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 com.google.api.core.SettableApiFuture; + +public class AckReplyConsumerImpl implements AckReplyConsumer { + final SettableApiFuture ackReplySettableApiFuture; + + public AckReplyConsumerImpl( + final SettableApiFuture ackReplySettableApiFuture) { + this.ackReplySettableApiFuture = ackReplySettableApiFuture; + } + + @Override + public void ack() { + ackReplySettableApiFuture.set(MessageDispatcher.AckReply.ACK); + } + + @Override + public void nack() { + ackReplySettableApiFuture.set(MessageDispatcher.AckReply.NACK); + } +} diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/AckReplyConsumerWithResponse.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/AckReplyConsumerWithResponse.java new file mode 100644 index 000000000..445ba7287 --- /dev/null +++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/AckReplyConsumerWithResponse.java @@ -0,0 +1,55 @@ +/* + * Copyright 2022 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 com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; + +/** + * Acknowledging a message in Pub/Sub means that you are done with it, and it will not be delivered + * to this subscription again. You should avoid acknowledging messages until you have *finished* + * processing them, so that in the event of a failure, you receive the message again. + * + *

If exactly-once delivery is enabled on the subscription, the future returned by the ack/nack + * methods track the state of acknowledgement operation by the server. If the future completes + * successfully, the message is guaranteed NOT to be re-delivered. Otherwise, the future will + * contain an exception with more details about the failure and the message may be re-delivered. + * + *

If exactly-once delivery is NOT enabled on the subscription, the future returns immediately + * with an AckResponse.SUCCESS. Because re-deliveries are possible, you should ensure that your + * processing code is idempotent, as you may receive any given message more than once. + */ +@BetaApi( + "This is a preview feature. For more details, see" + + " https://cloud.google.com/pubsub/docs/exactly-once-delivery.") +public interface AckReplyConsumerWithResponse { + /** + * Acknowledges that the message has been successfully processed. The service will not send the + * message again. + * + *

A future representing the server response is returned + */ + ApiFuture ack(); + + /** + * Signals that the message has not been successfully processed. The service should resend the + * message. + * + *

A future representing the server response is returned + */ + ApiFuture nack(); +} diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/AckReplyConsumerWithResponseImpl.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/AckReplyConsumerWithResponseImpl.java new file mode 100644 index 000000000..6e78a1392 --- /dev/null +++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/AckReplyConsumerWithResponseImpl.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 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 com.google.api.core.ApiFuture; +import com.google.api.core.SettableApiFuture; + +public class AckReplyConsumerWithResponseImpl implements AckReplyConsumerWithResponse { + final SettableApiFuture ackReplySettableApiFuture; + final SettableApiFuture messageFuture; + + public AckReplyConsumerWithResponseImpl( + SettableApiFuture ackReplySettableApiFuture, + SettableApiFuture messageFuture) { + this.ackReplySettableApiFuture = ackReplySettableApiFuture; + this.messageFuture = messageFuture; + } + + @Override + public ApiFuture ack() { + ackReplySettableApiFuture.set(MessageDispatcher.AckReply.ACK); + return messageFuture; + } + + @Override + public ApiFuture nack() { + ackReplySettableApiFuture.set(MessageDispatcher.AckReply.NACK); + return messageFuture; + } +} diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/AckRequestData.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/AckRequestData.java new file mode 100644 index 000000000..5cab83f49 --- /dev/null +++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/AckRequestData.java @@ -0,0 +1,104 @@ +/* + * Copyright 2022 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 com.google.api.core.SettableApiFuture; +import java.util.Optional; + +public class AckRequestData { + private final String ackId; + private final Optional> messageFuture; + private PubsubMessageWrapper messageWrapper; + + protected AckRequestData(Builder builder) { + this.ackId = builder.ackId; + this.messageFuture = builder.messageFuture; + this.messageWrapper = builder.messageWrapper; + } + + public String getAckId() { + return ackId; + } + + public SettableApiFuture getMessageFutureIfExists() { + return this.messageFuture.orElse(null); + } + + /** + * Returns an empty PubsubMessageWrapper with OpenTelemetry tracing disabled. This allows methods + * that use this method to be unit tested. + */ + public PubsubMessageWrapper getMessageWrapper() { + if (this.messageWrapper == null) { + return PubsubMessageWrapper.newBuilder(null, null).build(); + } + return messageWrapper; + } + + public AckRequestData setResponse(AckResponse ackResponse, boolean setResponseOnSuccess) { + if (this.messageFuture.isPresent() && !this.messageFuture.get().isDone()) { + switch (ackResponse) { + case SUCCESSFUL: + if (setResponseOnSuccess) { + this.messageFuture.get().set(ackResponse); + } + break; + case INVALID: + case OTHER: + case PERMISSION_DENIED: + case FAILED_PRECONDITION: + // Non-succesful messages will get set for both acks, nacks, and modacks + this.messageFuture.get().set(ackResponse); + break; + } + } + return this; + } + + public boolean hasMessageFuture() { + return this.messageFuture.isPresent(); + } + + public static Builder newBuilder(String ackId) { + return new Builder(ackId); + } + + /** Builder of {@link AckRequestData AckRequestData}. */ + protected static final class Builder { + private final String ackId; + private Optional> messageFuture = Optional.empty(); + private PubsubMessageWrapper messageWrapper; + + protected Builder(String ackId) { + this.ackId = ackId; + } + + public Builder setMessageFuture(SettableApiFuture messageFuture) { + this.messageFuture = Optional.of(messageFuture); + return this; + } + + public Builder setMessageWrapper(PubsubMessageWrapper messageWrapper) { + this.messageWrapper = messageWrapper; + return this; + } + + public AckRequestData build() { + return new AckRequestData(this); + } + } +} diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/AckResponse.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/AckResponse.java new file mode 100644 index 000000000..162d87bc1 --- /dev/null +++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/AckResponse.java @@ -0,0 +1,25 @@ +/* + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * 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; + +public enum AckResponse { + PERMISSION_DENIED, + FAILED_PRECONDITION, + SUCCESSFUL, + INVALID, + OTHER +} diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/LoggingUtil.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/LoggingUtil.java new file mode 100644 index 000000000..dbc3a5d86 --- /dev/null +++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/LoggingUtil.java @@ -0,0 +1,146 @@ +/* + * Copyright 2026 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 com.google.pubsub.v1.PubsubMessage; +import java.util.logging.Level; +import java.util.logging.Logger; + +public final class LoggingUtil { + // Instantiate all loggers as static final fields to maintain strong references + + private static final Logger slowAckLogger = Logger.getLogger("slow-ack"); + private static final Logger callbackDeliveryLogger = Logger.getLogger("callback-delivery"); + private static final Logger expiryLogger = Logger.getLogger("expiry"); + private static final Logger callbackExceptionsLogger = Logger.getLogger("callback-exceptions"); + private static final Logger ackBatchLogger = Logger.getLogger("ack-batch"); + private static final Logger subscriberFlowControlLogger = + Logger.getLogger("subscriber-flow-control"); + private static final Logger ackNackLogger = Logger.getLogger("ack-nack"); + private static final Logger publishBatchLogger = Logger.getLogger("publish-batch"); + private static final Logger subscriberStreamsLogger = Logger.getLogger("subscriber-streams"); + + public enum SubSystem { + SLOW_ACK(slowAckLogger), + CALLBACK_DELIVERY(callbackDeliveryLogger), + EXPIRY(expiryLogger), + CALLBACK_EXCEPTIONS(callbackExceptionsLogger), + ACK_BATCH(ackBatchLogger), + SUBSCRIBER_FLOW_CONTROL(subscriberFlowControlLogger), + ACK_NACK(ackNackLogger), + PUBLISH_BATCH(publishBatchLogger), + SUBSCRIBER_STREAMS(subscriberStreamsLogger); + + private final Logger logger; + + SubSystem(Logger logger) { + this.logger = logger; + } + + public Logger getLogger() { + return logger; + } + } + + public LoggingUtil() {} + + private String getSubscriptionLogPrefix( + PubsubMessageWrapper messageWrapper, String ackId, boolean exactlyOnceDeliveryEnabled) { + if (messageWrapper == null || messageWrapper.getPubsubMessage() == null) { + return " Ack ID: " + + ackId + + ", Exactly Once Delivery: " + + exactlyOnceDeliveryEnabled + + " (Message details not available)"; + } + + PubsubMessage message = messageWrapper.getPubsubMessage(); + String messageId = message.getMessageId(); + String orderingKey = message.getOrderingKey(); + + StringBuilder sb = new StringBuilder(); + sb.append("Message ID: ").append(messageId); + sb.append(", Ack ID: ").append(ackId); + if (orderingKey != null && !orderingKey.isEmpty()) { + sb.append(", Ordering Key: ").append(orderingKey); + } + sb.append(", Exactly Once Delivery: ").append(exactlyOnceDeliveryEnabled); + return sb.toString(); + } + + private String getPublisherLogPrefix(PubsubMessageWrapper messageWrapper) { + if (messageWrapper == null || messageWrapper.getPubsubMessage() == null) { + return " (Message details not available)"; + } + + PubsubMessage message = messageWrapper.getPubsubMessage(); + String messageId = message.getMessageId(); + String orderingKey = message.getOrderingKey(); + + StringBuilder sb = new StringBuilder(); + sb.append("Message ID: ").append(messageId); + if (orderingKey != null && !orderingKey.isEmpty()) { + sb.append(", Ordering Key: ").append(orderingKey); + } + return sb.toString(); + } + + public void logSubscriber( + SubSystem subSystem, + Level level, + String msg, + PubsubMessageWrapper messageWrapper, + String ackId, + boolean exactlyOnceDeliveryEnabled) { + Logger logger = subSystem.getLogger(); + if (logger.isLoggable(level)) { + String prefix = getSubscriptionLogPrefix(messageWrapper, ackId, exactlyOnceDeliveryEnabled); + logger.log(level, prefix + " - " + msg); + } + } + + public void logSubscriberWithThrowable( + SubSystem subSystem, + Level level, + String msg, + PubsubMessageWrapper messageWrapper, + String ackId, + boolean exactlyOnceDeliveryEnabled, + Throwable throwable) { + Logger logger = subSystem.getLogger(); + if (logger.isLoggable(level)) { + String prefix = getSubscriptionLogPrefix(messageWrapper, ackId, exactlyOnceDeliveryEnabled); + logger.log(level, prefix + " - " + msg, throwable); + } + } + + public void logPublisher( + SubSystem subSystem, Level level, String msg, PubsubMessageWrapper messageWrapper) { + Logger logger = subSystem.getLogger(); + if (logger.isLoggable(level)) { + String prefix = getPublisherLogPrefix(messageWrapper); + logger.log(level, prefix + " - " + msg); + } + } + + public void logEvent(SubSystem subSystem, Level level, String msg, Object... params) { + Logger logger = subSystem.getLogger(); + if (logger.isLoggable(level)) { + logger.log(level, msg, params); + } + } +} 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 f0eab3ba6..f2f7cd2e7 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 @@ -28,12 +28,17 @@ import com.google.common.util.concurrent.MoreExecutors; import com.google.pubsub.v1.PubsubMessage; import com.google.pubsub.v1.ReceivedMessage; +import com.google.pubsub.v1.SubscriptionName; +import java.time.Duration; +import java.time.Instant; +import java.time.temporal.ChronoUnit; import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.Executor; @@ -47,9 +52,6 @@ import java.util.concurrent.locks.ReentrantLock; import java.util.logging.Level; import java.util.logging.Logger; -import org.threeten.bp.Duration; -import org.threeten.bp.Instant; -import org.threeten.bp.temporal.ChronoUnit; /** * Dispatches messages to a message receiver while handling the messages acking and lease @@ -57,9 +59,11 @@ */ class MessageDispatcher { private static final Logger logger = Logger.getLogger(MessageDispatcher.class.getName()); - private static final double PERCENTILE_FOR_ACK_DEADLINE_UPDATES = 99.9; + private LoggingUtil loggingUtil = new LoggingUtil(); + @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; @@ -68,23 +72,33 @@ class MessageDispatcher { private final Duration ackExpirationPadding; private final Duration maxAckExtensionPeriod; - private final int maxSecondsPerAckExtension; - private final MessageReceiver receiver; + private int minDurationPerAckExtensionSeconds; + private final boolean minDurationPerAckExtensionDefaultUsed; + private final int maxDurationPerAckExtensionSeconds; + private final boolean maxDurationPerAckExtensionDefaultUsed; + + // Only one of receiver or receiverWithAckResponse will be set + private MessageReceiver receiver; + private MessageReceiverWithAckResponse receiverWithAckResponse; + private final AckProcessor ackProcessor; private final FlowController flowController; + + private AtomicBoolean exactlyOnceDeliveryEnabled = new AtomicBoolean(false); + private AtomicBoolean messageOrderingEnabled = new AtomicBoolean(false); + private final Waiter messagesWaiter; // Maps ID to "total expiration time". If it takes longer than this, stop extending. private final ConcurrentMap pendingMessages = new ConcurrentHashMap<>(); - private final LinkedBlockingQueue pendingAcks = new LinkedBlockingQueue<>(); - private final LinkedBlockingQueue pendingNacks = new LinkedBlockingQueue<>(); - private final LinkedBlockingQueue pendingReceipts = new LinkedBlockingQueue<>(); - - // The deadline should be set before use. Here, set it to something unreasonable, - // so we fail loudly if we mess up. - private final AtomicInteger messageDeadlineSeconds = new AtomicInteger(60); + private final LinkedBlockingQueue pendingAcks = new LinkedBlockingQueue<>(); + private final LinkedBlockingQueue pendingNacks = new LinkedBlockingQueue<>(); + private final LinkedBlockingQueue pendingReceipts = new LinkedBlockingQueue<>(); + private final LinkedHashMap outstandingReceipts = + new LinkedHashMap(); + private final AtomicInteger messageDeadlineSeconds = new AtomicInteger(); private final AtomicBoolean extendDeadline = new AtomicBoolean(true); private final Lock jobLock; private ScheduledFuture backgroundJob; @@ -93,27 +107,13 @@ class MessageDispatcher { // To keep track of number of seconds the receiver takes to process messages. private final Distribution ackLatencyDistribution; - /** Stores the data needed to asynchronously modify acknowledgement deadlines. */ - static class PendingModifyAckDeadline { - final List ackIds; - final int deadlineExtensionSeconds; + 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); - PendingModifyAckDeadline(int deadlineExtensionSeconds, String... ackIds) { - this(deadlineExtensionSeconds, Arrays.asList(ackIds)); - } - - private PendingModifyAckDeadline(int deadlineExtensionSeconds, Collection ackIds) { - this.ackIds = new ArrayList(ackIds); - this.deadlineExtensionSeconds = deadlineExtensionSeconds; - } - - @Override - public String toString() { - return String.format( - "PendingModifyAckDeadline{extension: %d sec, ackIds: %s}", - deadlineExtensionSeconds, ackIds); - } - } + private final double slowAckPercentile = 99.0; /** Internal representation of a reply to a Pubsub message, to be sent back to the service. */ public enum AckReply { @@ -123,21 +123,30 @@ public enum AckReply { /** Handles callbacks for acking/nacking messages from the {@link MessageReceiver}. */ private class AckHandler implements ApiFutureCallback { - private final String ackId; + private final AckRequestData ackRequestData; private final int outstandingBytes; private final long receivedTimeMillis; private final Instant totalExpiration; - private AckHandler(String ackId, int outstandingBytes, Instant totalExpiration) { - this.ackId = ackId; + private AckHandler( + AckRequestData ackRequestData, int outstandingBytes, Instant totalExpiration) { + this.ackRequestData = ackRequestData; this.outstandingBytes = outstandingBytes; this.receivedTimeMillis = clock.millisTime(); this.totalExpiration = totalExpiration; } + public AckRequestData getAckRequestData() { + return ackRequestData; + } + + public SettableApiFuture getMessageFutureIfExists() { + return this.ackRequestData.getMessageFutureIfExists(); + } + /** Stop extending deadlines for this message and free flow control. */ private void forget() { - if (pendingMessages.remove(ackId) == null) { + if (pendingMessages.remove(this.ackRequestData.getAckId()) == null) { /* * We're forgetting the message for the second time. Probably because we ran out of total * expiration, forget the message, then the user finishes working on the message, and forget @@ -151,66 +160,121 @@ private void forget() { @Override public void onFailure(Throwable t) { - logger.log( + loggingUtil.logSubscriberWithThrowable( + LoggingUtil.SubSystem.CALLBACK_EXCEPTIONS, Level.WARNING, - "MessageReceiver failed to process ack ID: " + ackId + ", the message will be nacked.", + "MessageReceiver exception.", + this.ackRequestData.getMessageWrapper(), + this.ackRequestData.getAckId(), + exactlyOnceDeliveryEnabled.get(), t); - pendingNacks.add(ackId); + this.ackRequestData.setResponse(AckResponse.OTHER, false); + pendingNacks.add(this.ackRequestData); + tracer.endSubscribeProcessSpan(this.ackRequestData.getMessageWrapper(), "nack"); forget(); } @Override public void onSuccess(AckReply reply) { - LinkedBlockingQueue destination; + int ackLatency = + Ints.saturatedCast((long) Math.ceil((clock.millisTime() - receivedTimeMillis) / 1000D)); + if (ackLatency >= ackLatencyDistribution.getPercentile(slowAckPercentile)) { + loggingUtil.logSubscriber( + LoggingUtil.SubSystem.SLOW_ACK, + Level.FINE, + String.format( + "Message ack duration of %d is higher than the p99 ack duration", ackLatency), + this.ackRequestData.getMessageWrapper(), + this.ackRequestData.getAckId(), + exactlyOnceDeliveryEnabled.get()); + } + switch (reply) { case ACK: - destination = pendingAcks; - // Record the latency rounded to the next closest integer. - ackLatencyDistribution.record( - Ints.saturatedCast( - (long) Math.ceil((clock.millisTime() - receivedTimeMillis) / 1000D))); + 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(ackLatency); + tracer.endSubscribeProcessSpan(this.ackRequestData.getMessageWrapper(), "ack"); + } + loggingUtil.logSubscriber( + LoggingUtil.SubSystem.ACK_NACK, + Level.FINE, + "Ack called on message.", + this.ackRequestData.getMessageWrapper(), + this.ackRequestData.getAckId(), + exactlyOnceDeliveryEnabled.get()); break; case NACK: - destination = pendingNacks; + pendingNacks.add(this.ackRequestData); + tracer.endSubscribeProcessSpan(this.ackRequestData.getMessageWrapper(), "nack"); + loggingUtil.logSubscriber( + LoggingUtil.SubSystem.ACK_NACK, + Level.FINE, + "Nack called on message.", + this.ackRequestData.getMessageWrapper(), + this.ackRequestData.getAckId(), + exactlyOnceDeliveryEnabled.get()); break; default: throw new IllegalArgumentException(String.format("AckReply: %s not supported", reply)); } - destination.add(ackId); forget(); } } interface AckProcessor { - void sendAckOperations( - List acksToSend, List ackDeadlineExtensions); + public void sendAckOperations(List ackRequestDataList); + + public void sendModackOperations(List modackRequestDataList); } - MessageDispatcher( - MessageReceiver receiver, - AckProcessor ackProcessor, - Duration ackExpirationPadding, - Duration maxAckExtensionPeriod, - Duration maxDurationPerAckExtension, - Distribution ackLatencyDistribution, - FlowController flowController, - Executor executor, - ScheduledExecutorService systemExecutor, - ApiClock clock) { - this.executor = executor; - this.systemExecutor = systemExecutor; - this.ackExpirationPadding = ackExpirationPadding; - this.maxAckExtensionPeriod = maxAckExtensionPeriod; - this.maxSecondsPerAckExtension = Math.toIntExact(maxDurationPerAckExtension.getSeconds()); - this.receiver = receiver; - this.ackProcessor = ackProcessor; - this.flowController = flowController; - // 601 buckets of 1s resolution from 0s to MAX_ACK_DEADLINE_SECONDS - this.ackLatencyDistribution = ackLatencyDistribution; + private MessageDispatcher(Builder builder) { + executor = builder.executor; + systemExecutor = builder.systemExecutor; + ackExpirationPadding = builder.ackExpirationPadding; + maxAckExtensionPeriod = builder.maxAckExtensionPeriod; + + minDurationPerAckExtensionSeconds = + Math.toIntExact(builder.minDurationPerAckExtension.getSeconds()); + minDurationPerAckExtensionDefaultUsed = builder.minDurationPerAckExtensionDefaultUsed; + maxDurationPerAckExtensionSeconds = + Math.toIntExact(builder.maxDurationPerAckExtension.getSeconds()); + maxDurationPerAckExtensionDefaultUsed = builder.maxDurationPerAckExtensionDefaultUsed; + + // Start the deadline at the minimum ack deadline so messages which arrive before this is + // updated will not have a long ack deadline. + if (minDurationPerAckExtensionDefaultUsed) { + messageDeadlineSeconds.set(Math.toIntExact(Subscriber.MIN_STREAM_ACK_DEADLINE.getSeconds())); + } else { + messageDeadlineSeconds.set(minDurationPerAckExtensionSeconds); + } + + receiver = builder.receiver; + receiverWithAckResponse = builder.receiverWithAckResponse; + + ackProcessor = builder.ackProcessor; + flowController = builder.flowController; + ackLatencyDistribution = builder.ackLatencyDistribution; + clock = builder.clock; jobLock = new ReentrantLock(); messagesWaiter = new Waiter(); - this.clock = clock; - this.sequentialExecutor = new SequentialExecutorService.AutoExecutor(executor); + sequentialExecutor = new SequentialExecutorService.AutoExecutor(builder.executor); + + subscriptionNameObject = SubscriptionName.parse(builder.subscriptionName); + enableOpenTelemetryTracing = builder.enableOpenTelemetryTracing; + if (builder.tracer != null) { + tracer = builder.tracer; + } + this.subscriberShutdownSettings = builder.subscriberShutdownSettings; + } + + private boolean shouldSetMessageFuture() { + return receiverWithAckResponse != null; } void start() { @@ -255,7 +319,7 @@ public void run() { newDeadlineSec - ackExpirationPadding.getSeconds(), TimeUnit.SECONDS); } - processOutstandingAckOperations(); + processOutstandingOperations(); } catch (Throwable t) { // Catch everything so that one run failing doesn't prevent subsequent runs. logger.log(Level.WARNING, "failed to run periodic job", t); @@ -270,8 +334,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) { @@ -285,7 +403,6 @@ void stop() { } finally { jobLock.unlock(); } - processOutstandingAckOperations(); } @InternalApi @@ -298,24 +415,117 @@ int getMessageDeadlineSeconds() { return messageDeadlineSeconds.get(); } + @InternalApi + void setExactlyOnceDeliveryEnabled(boolean exactlyOnceDeliveryEnabled) { + // Sanity check that we are changing the exactlyOnceDeliveryEnabled state + if (exactlyOnceDeliveryEnabled == this.exactlyOnceDeliveryEnabled.get()) { + return; + } + + this.exactlyOnceDeliveryEnabled.set(exactlyOnceDeliveryEnabled); + + // If a custom value for minDurationPerAckExtension, we should respect that + if (!minDurationPerAckExtensionDefaultUsed) { + return; + } + + // We just need to update the minDurationPerAckExtensionSeconds as the + // maxDurationPerAckExtensionSeconds does not change + int possibleNewMinAckDeadlineExtensionSeconds; + + if (exactlyOnceDeliveryEnabled) { + possibleNewMinAckDeadlineExtensionSeconds = + Math.toIntExact( + Subscriber.DEFAULT_MIN_ACK_DEADLINE_EXTENSION_EXACTLY_ONCE_DELIVERY.getSeconds()); + } else { + possibleNewMinAckDeadlineExtensionSeconds = + Math.toIntExact(Subscriber.DEFAULT_MIN_ACK_DEADLINE_EXTENSION.getSeconds()); + } + + // If we are not using the default maxDurationAckExtension, check if the + // minAckDeadlineExtensionExactlyOnceDelivery needs to be bounded by the set max + if (!maxDurationPerAckExtensionDefaultUsed + && (possibleNewMinAckDeadlineExtensionSeconds > maxDurationPerAckExtensionSeconds)) { + minDurationPerAckExtensionSeconds = maxDurationPerAckExtensionSeconds; + } else { + minDurationPerAckExtensionSeconds = possibleNewMinAckDeadlineExtensionSeconds; + } + } + + @InternalApi + void setMessageOrderingEnabled(boolean messageOrderingEnabled) { + this.messageOrderingEnabled.set(messageOrderingEnabled); + } + + @InternalApi + boolean getNackImmediatelyShutdownInProgress() { + return nackImmediatelyShutdownInProgress.get(); + } + private static class OutstandingMessage { - private final ReceivedMessage receivedMessage; private final AckHandler ackHandler; - private OutstandingMessage(ReceivedMessage receivedMessage, AckHandler ackHandler) { - this.receivedMessage = receivedMessage; + private OutstandingMessage(AckHandler ackHandler) { this.ackHandler = ackHandler; } + + public PubsubMessageWrapper messageWrapper() { + return this.ackHandler.ackRequestData.getMessageWrapper(); + } + } + + private static class ReceiptCompleteData { + private OutstandingMessage outstandingMessage; + private Boolean receiptComplete; + + private ReceiptCompleteData(OutstandingMessage outstandingMessage) { + this.outstandingMessage = outstandingMessage; + this.receiptComplete = false; + } + + private OutstandingMessage getOutstandingMessage() { + return this.outstandingMessage; + } + + private Boolean isReceiptComplete() { + return this.receiptComplete; + } + + private void notifyReceiptComplete() { + this.receiptComplete = true; + } } void processReceivedMessages(List messages) { Instant totalExpiration = now().plus(maxAckExtensionPeriod); List outstandingBatch = new ArrayList<>(messages.size()); for (ReceivedMessage message : messages) { + AckRequestData.Builder builder = AckRequestData.newBuilder(message.getAckId()); + if (shouldSetMessageFuture()) { + builder.setMessageFuture(SettableApiFuture.create()); + } + PubsubMessageWrapper messageWrapper = + PubsubMessageWrapper.newBuilder( + message.getMessage(), + subscriptionNameObject, + message.getAckId(), + message.getDeliveryAttempt()) + .build(); + builder.setMessageWrapper(messageWrapper); + tracer.startSubscriberSpan(messageWrapper, this.exactlyOnceDeliveryEnabled.get()); + + AckRequestData ackRequestData = builder.build(); AckHandler ackHandler = - new AckHandler( - message.getAckId(), message.getMessage().getSerializedSize(), totalExpiration); - if (pendingMessages.putIfAbsent(message.getAckId(), ackHandler) != null) { + new AckHandler(ackRequestData, message.getMessage().getSerializedSize(), totalExpiration); + OutstandingMessage outstandingMessage = new OutstandingMessage(ackHandler); + + if (this.exactlyOnceDeliveryEnabled.get()) { + // For exactly once deliveries we don't add to outstanding batch because we first + // process the receipt modack. If that is successful then we process the message. + synchronized (outstandingReceipts) { + outstandingReceipts.put(message.getAckId(), new ReceiptCompleteData(outstandingMessage)); + } + } else if (pendingMessages.putIfAbsent(message.getAckId(), ackHandler) != null) { // putIfAbsent puts ackHandler if ackID isn't previously mapped, then return the // previously-mapped element. // If the previous element is not null, we already have the message and the new one is @@ -325,57 +535,128 @@ void processReceivedMessages(List messages) { // we want to eventually // totally expire so that pubsub service sends us the message again. continue; + } else { + outstandingBatch.add(outstandingMessage); } - outstandingBatch.add(new OutstandingMessage(message, ackHandler)); - pendingReceipts.add(message.getAckId()); + pendingReceipts.add(ackRequestData); } - processBatch(outstandingBatch); } + void notifyAckSuccess(AckRequestData ackRequestData) { + synchronized (outstandingReceipts) { + if (outstandingReceipts.containsKey(ackRequestData.getAckId())) { + outstandingReceipts.get(ackRequestData.getAckId()).notifyReceiptComplete(); + List outstandingBatch = new ArrayList<>(); + + for (Iterator> it = + outstandingReceipts.entrySet().iterator(); + it.hasNext(); ) { + Map.Entry receipt = it.next(); + // If receipt is complete then add to outstandingBatch to process the batch + if (receipt.getValue().isReceiptComplete()) { + it.remove(); + if (pendingMessages.putIfAbsent( + receipt.getKey(), receipt.getValue().getOutstandingMessage().ackHandler) + == null) { + outstandingBatch.add(receipt.getValue().getOutstandingMessage()); + } + } else { + break; + } + } + processBatch(outstandingBatch); + } + } + } + + void notifyAckFailed(AckRequestData ackRequestData) { + synchronized (outstandingReceipts) { + outstandingReceipts.remove(ackRequestData.getAckId()); + } + + // When notifying that an ack/modack has failed, due to a non-retryable error, + // we attempt to remove the message from the pending messages and release it from the flow + // controller so that we no longer attempt to extend the message's ack deadline. + if (pendingMessages.remove(ackRequestData.getAckId()) == null) { + /* + * We're forgetting the message for the second time. This may occur on modacks because the message passed + * its total expiration and was forgotten and then the user finishes working on the message + * which forgets the message again. Additionally, when a failed ack occurs, we will have already forgotten + * the message, so we don't need to here. Turns the second forget into a no-op so we don't free twice. + */ + return; + } + flowController.release(1, ackRequestData.getMessageWrapper().getSerializedSize()); + messagesWaiter.incrementPendingCount(-1); + } + private void processBatch(List batch) { messagesWaiter.incrementPendingCount(batch.size()); for (OutstandingMessage message : batch) { // This is a blocking flow controller. We have already incremented messagesWaiter, so // shutdown will block on processing of all these messages anyway. + tracer.startSubscribeConcurrencyControlSpan(message.messageWrapper()); try { - flowController.reserve(1, message.receivedMessage.getMessage().getSerializedSize()); + loggingUtil.logSubscriber( + LoggingUtil.SubSystem.SUBSCRIBER_FLOW_CONTROL, + Level.FINE, + "Flow controller is blocking.", + message.messageWrapper(), + message.messageWrapper().getAckId(), + exactlyOnceDeliveryEnabled.get()); + flowController.reserve(1, message.messageWrapper().getPubsubMessage().getSerializedSize()); + loggingUtil.logSubscriber( + LoggingUtil.SubSystem.SUBSCRIBER_FLOW_CONTROL, + Level.FINE, + "Flow controller is done blocking.", + message.messageWrapper(), + message.messageWrapper().getAckId(), + exactlyOnceDeliveryEnabled.get()); + tracer.endSubscribeConcurrencyControlSpan(message.messageWrapper()); } catch (FlowControlException unexpectedException) { // This should be a blocking flow controller and never throw an exception. + loggingUtil.logSubscriberWithThrowable( + LoggingUtil.SubSystem.SUBSCRIBER_FLOW_CONTROL, + Level.FINE, + "Flow controller unexpected exception.", + message.messageWrapper(), + message.messageWrapper().getAckId(), + exactlyOnceDeliveryEnabled.get(), + unexpectedException); + tracer.setSubscribeConcurrencyControlSpanException( + message.messageWrapper(), unexpectedException); throw new IllegalStateException("Flow control unexpected exception", unexpectedException); } - processOutstandingMessage(addDeliveryInfoCount(message.receivedMessage), message.ackHandler); + addDeliveryInfoCount(message.messageWrapper()); + processOutstandingMessage(message.ackHandler); } } - private PubsubMessage addDeliveryInfoCount(ReceivedMessage receivedMessage) { - PubsubMessage originalMessage = receivedMessage.getMessage(); - int deliveryAttempt = receivedMessage.getDeliveryAttempt(); + private void addDeliveryInfoCount(PubsubMessageWrapper messageWrapper) { + PubsubMessage originalMessage = messageWrapper.getPubsubMessage(); + int deliveryAttempt = messageWrapper.getDeliveryAttempt(); // Delivery Attempt will be set to 0 if DeadLetterPolicy is not set on the subscription. In // this case, do not populate the PubsubMessage with the delivery attempt attribute. if (deliveryAttempt > 0) { - return PubsubMessage.newBuilder(originalMessage) - .putAttributes("googclient_deliveryattempt", Integer.toString(deliveryAttempt)) - .build(); + messageWrapper.setPubsubMessage( + PubsubMessage.newBuilder(originalMessage) + .putAttributes("googclient_deliveryattempt", Integer.toString(deliveryAttempt)) + .build()); } - return originalMessage; } - private void processOutstandingMessage(final PubsubMessage message, final AckHandler ackHandler) { - final SettableApiFuture response = SettableApiFuture.create(); - final AckReplyConsumer consumer = - new AckReplyConsumer() { - @Override - public void ack() { - response.set(AckReply.ACK); - } + private void processOutstandingMessage(final AckHandler ackHandler) { + // Get the PubsubMessageWrapper and the PubsubMessage it wraps that are stored withing the + // AckHandler object. + PubsubMessageWrapper messageWrapper = ackHandler.ackRequestData.getMessageWrapper(); + PubsubMessage message = messageWrapper.getPubsubMessage(); + + // This future is for internal bookkeeping to be sent to the StreamingSubscriberConnection + // use below in the consumers + SettableApiFuture ackReplySettableApiFuture = SettableApiFuture.create(); + ApiFutures.addCallback(ackReplySettableApiFuture, ackHandler, MoreExecutors.directExecutor()); - @Override - public void nack() { - response.set(AckReply.NACK); - } - }; - ApiFutures.addCallback(response, ackHandler, MoreExecutors.directExecutor()); Runnable deliverMessageTask = new Runnable() { @Override @@ -389,45 +670,79 @@ public void run() { // so it was probably sent to someone else. Don't work on it. // Don't nack it either, because we'd be nacking someone else's message. ackHandler.forget(); + tracer.setSubscriberSpanExpirationResult(messageWrapper); + loggingUtil.logSubscriber( + LoggingUtil.SubSystem.EXPIRY, + Level.FINE, + "Message expired.", + messageWrapper, + ackHandler.ackRequestData.getAckId(), + exactlyOnceDeliveryEnabled.get()); return; } - - receiver.receiveMessage(message, consumer); + tracer.startSubscribeProcessSpan(messageWrapper); + loggingUtil.logSubscriber( + LoggingUtil.SubSystem.CALLBACK_DELIVERY, + Level.FINE, + "Message delivered.", + messageWrapper, + ackHandler.ackRequestData.getAckId(), + exactlyOnceDeliveryEnabled.get()); + if (shouldSetMessageFuture()) { + // This is the message future that is propagated to the user + SettableApiFuture messageFuture = + ackHandler.getMessageFutureIfExists(); + final AckReplyConsumerWithResponse ackReplyConsumerWithResponse = + new AckReplyConsumerWithResponseImpl(ackReplySettableApiFuture, messageFuture); + receiverWithAckResponse.receiveMessage(message, ackReplyConsumerWithResponse); + } else { + final AckReplyConsumer ackReplyConsumer = + new AckReplyConsumerImpl(ackReplySettableApiFuture); + receiver.receiveMessage(message, ackReplyConsumer); + } } catch (Exception e) { - response.setException(e); + ackReplySettableApiFuture.setException(e); } } }; - if (message.getOrderingKey().isEmpty()) { + if (!messageOrderingEnabled.get() || message.getOrderingKey().isEmpty()) { executor.execute(deliverMessageTask); } else { + tracer.startSubscribeSchedulerSpan(messageWrapper); sequentialExecutor.submit(message.getOrderingKey(), deliverMessageTask); + tracer.endSubscribeSchedulerSpan(messageWrapper); } } /** Compute the ideal deadline, set subsequent modacks to this deadline, and return it. */ @InternalApi int computeDeadlineSeconds() { - int sec = ackLatencyDistribution.getPercentile(PERCENTILE_FOR_ACK_DEADLINE_UPDATES); - - if ((maxSecondsPerAckExtension > 0) && (sec > maxSecondsPerAckExtension)) { - sec = maxSecondsPerAckExtension; + int deadlineSeconds = ackLatencyDistribution.getPercentile(PERCENTILE_FOR_ACK_DEADLINE_UPDATES); + + // Bound deadlineSeconds by extensions + if (!maxDurationPerAckExtensionDefaultUsed + && (deadlineSeconds > maxDurationPerAckExtensionSeconds)) { + deadlineSeconds = maxDurationPerAckExtensionSeconds; + } else if (deadlineSeconds < minDurationPerAckExtensionSeconds) { + deadlineSeconds = minDurationPerAckExtensionSeconds; } - // Use Ints.constrainToRange when we get guava 21. - if (sec < Subscriber.MIN_ACK_DEADLINE_SECONDS) { - sec = Subscriber.MIN_ACK_DEADLINE_SECONDS; - } else if (sec > Subscriber.MAX_ACK_DEADLINE_SECONDS) { - sec = Subscriber.MAX_ACK_DEADLINE_SECONDS; + // Bound deadlineSeconds by hard limits in subscriber + if (deadlineSeconds < Subscriber.MIN_STREAM_ACK_DEADLINE.getSeconds()) { + deadlineSeconds = Math.toIntExact(Subscriber.MIN_STREAM_ACK_DEADLINE.getSeconds()); + } else if (deadlineSeconds > Subscriber.MAX_STREAM_ACK_DEADLINE.getSeconds()) { + deadlineSeconds = Math.toIntExact(Subscriber.MAX_STREAM_ACK_DEADLINE.getSeconds()); } - return sec; + + return deadlineSeconds; } @InternalApi void extendDeadlines() { int extendSeconds = getMessageDeadlineSeconds(); - List modacks = new ArrayList<>(); - PendingModifyAckDeadline modack = new PendingModifyAckDeadline(extendSeconds); + int numAckIdToSend = 0; + Map deadlineExtensionModacks = + new HashMap(); Instant now = now(); Instant extendTo = now.plusSeconds(extendSeconds); @@ -435,7 +750,12 @@ void extendDeadlines() { String ackId = entry.getKey(); Instant totalExpiration = entry.getValue().totalExpiration; if (totalExpiration.isAfter(extendTo)) { - modack.ackIds.add(ackId); + ModackRequestData modackRequestData = + deadlineExtensionModacks.computeIfAbsent( + extendSeconds, + deadlineExtensionSeconds -> new ModackRequestData(deadlineExtensionSeconds)); + modackRequestData.addAckRequestData(entry.getValue().getAckRequestData()); + numAckIdToSend++; continue; } @@ -444,43 +764,191 @@ void extendDeadlines() { entry.getValue().forget(); if (totalExpiration.isAfter(now)) { int sec = Math.max(1, (int) now.until(totalExpiration, ChronoUnit.SECONDS)); - modacks.add(new PendingModifyAckDeadline(sec, ackId)); + ModackRequestData modackRequestData = + deadlineExtensionModacks.computeIfAbsent( + sec, extensionSeconds -> new ModackRequestData(extensionSeconds)); + modackRequestData.addAckRequestData(entry.getValue().getAckRequestData()); + numAckIdToSend++; } } - logger.log(Level.FINER, "Sending {0} modacks", modack.ackIds.size() + modacks.size()); - modacks.add(modack); - List acksToSend = Collections.emptyList(); - ackProcessor.sendAckOperations(acksToSend, modacks); + if (numAckIdToSend > 0) { + logger.log(Level.FINER, "Sending {0} modacks", numAckIdToSend); + ackProcessor.sendModackOperations( + new ArrayList(deadlineExtensionModacks.values())); + } } @InternalApi - void processOutstandingAckOperations() { - List modifyAckDeadlinesToSend = new ArrayList<>(); + void processOutstandingOperations() { + + List modackRequestData = new ArrayList(); - List acksToSend = new ArrayList<>(); - pendingAcks.drainTo(acksToSend); - logger.log(Level.FINER, "Sending {0} acks", acksToSend.size()); + // Nacks are modacks with an expiration of 0 + List nackRequestDataList = new ArrayList(); + pendingNacks.drainTo(nackRequestDataList); - PendingModifyAckDeadline nacksToSend = new PendingModifyAckDeadline(0); - pendingNacks.drainTo(nacksToSend.ackIds); - logger.log(Level.FINER, "Sending {0} nacks", nacksToSend.ackIds.size()); - if (!nacksToSend.ackIds.isEmpty()) { - modifyAckDeadlinesToSend.add(nacksToSend); + if (!nackRequestDataList.isEmpty()) { + modackRequestData.add(new ModackRequestData(0, nackRequestDataList)); } - PendingModifyAckDeadline receiptsToSend = - new PendingModifyAckDeadline(getMessageDeadlineSeconds()); - pendingReceipts.drainTo(receiptsToSend.ackIds); - logger.log(Level.FINER, "Sending {0} receipts", receiptsToSend.ackIds.size()); - if (!receiptsToSend.ackIds.isEmpty()) { - modifyAckDeadlinesToSend.add(receiptsToSend); + List ackRequestDataReceipts = new ArrayList(); + pendingReceipts.drainTo(ackRequestDataReceipts); + if (!ackRequestDataReceipts.isEmpty() && !getNackImmediatelyShutdownInProgress()) { + ModackRequestData receiptModack = + new ModackRequestData(this.getMessageDeadlineSeconds(), ackRequestDataReceipts); + receiptModack.setIsReceiptModack(true); + modackRequestData.add(receiptModack); } - ackProcessor.sendAckOperations(acksToSend, modifyAckDeadlinesToSend); + ackProcessor.sendModackOperations(modackRequestData); + + List ackRequestDataList = new ArrayList(); + pendingAcks.drainTo(ackRequestDataList); + loggingUtil.logEvent( + LoggingUtil.SubSystem.ACK_BATCH, + Level.FINE, + "Sending {0} ACKs, {1} NACKs, {2} receipts. Exactly Once Delivery: {3}", + new Object[] { + ackRequestDataList.size(), + nackRequestDataList.size(), + ackRequestDataReceipts.size(), + exactlyOnceDeliveryEnabled.get() + }); + + ackProcessor.sendAckOperations(ackRequestDataList); } private Instant now() { return Instant.ofEpochMilli(clock.millisTime()); } + + /** Builder of {@link MessageDispatcher MessageDispatchers}. */ + public static final class Builder { + private MessageReceiver receiver; + private MessageReceiverWithAckResponse receiverWithAckResponse; + + private AckProcessor ackProcessor; + private Duration ackExpirationPadding; + private Duration maxAckExtensionPeriod; + private Duration minDurationPerAckExtension; + private boolean minDurationPerAckExtensionDefaultUsed; + private Duration maxDurationPerAckExtension; + private boolean maxDurationPerAckExtensionDefaultUsed; + + private Distribution ackLatencyDistribution; + private FlowController flowController; + + private Executor executor; + private ScheduledExecutorService systemExecutor; + private ApiClock clock; + + private String subscriptionName; + private boolean enableOpenTelemetryTracing; + private OpenTelemetryPubsubTracer tracer; + private SubscriberShutdownSettings subscriberShutdownSettings; + + protected Builder(MessageReceiver receiver) { + this.receiver = receiver; + } + + protected Builder(MessageReceiverWithAckResponse receiverWithAckResponse) { + this.receiverWithAckResponse = receiverWithAckResponse; + } + + public Builder setAckProcessor(AckProcessor ackProcessor) { + this.ackProcessor = ackProcessor; + return this; + } + + public Builder setAckExpirationPadding(Duration ackExpirationPadding) { + this.ackExpirationPadding = ackExpirationPadding; + return this; + } + + public Builder setMaxAckExtensionPeriod(Duration maxAckExtensionPeriod) { + this.maxAckExtensionPeriod = maxAckExtensionPeriod; + return this; + } + + public Builder setMinDurationPerAckExtension(Duration minDurationPerAckExtension) { + this.minDurationPerAckExtension = minDurationPerAckExtension; + return this; + } + + public Builder setMinDurationPerAckExtensionDefaultUsed( + boolean minDurationPerAckExtensionDefaultUsed) { + this.minDurationPerAckExtensionDefaultUsed = minDurationPerAckExtensionDefaultUsed; + return this; + } + + public Builder setMaxDurationPerAckExtension(Duration maxDurationPerAckExtension) { + this.maxDurationPerAckExtension = maxDurationPerAckExtension; + return this; + } + + public Builder setMaxDurationPerAckExtensionDefaultUsed( + boolean maxDurationPerAckExtensionDefaultUsed) { + this.maxDurationPerAckExtensionDefaultUsed = maxDurationPerAckExtensionDefaultUsed; + return this; + } + + public Builder setAckLatencyDistribution(Distribution ackLatencyDistribution) { + this.ackLatencyDistribution = ackLatencyDistribution; + return this; + } + + public Builder setFlowController(FlowController flowController) { + this.flowController = flowController; + return this; + } + + public Builder setExecutor(Executor executor) { + this.executor = executor; + return this; + } + + public Builder setSystemExecutor(ScheduledExecutorService systemExecutor) { + this.systemExecutor = systemExecutor; + return this; + } + + public Builder setApiClock(ApiClock clock) { + this.clock = clock; + return this; + } + + public Builder setSubscriptionName(String subscriptionName) { + this.subscriptionName = subscriptionName; + return this; + } + + public Builder setEnableOpenTelemetryTracing(boolean enableOpenTelemetryTracing) { + this.enableOpenTelemetryTracing = enableOpenTelemetryTracing; + return this; + } + + public Builder setTracer(OpenTelemetryPubsubTracer tracer) { + this.tracer = tracer; + return this; + } + + public Builder setSubscriberShutdownSettings( + SubscriberShutdownSettings subscriberShutdownSettings) { + this.subscriberShutdownSettings = subscriberShutdownSettings; + return this; + } + + public MessageDispatcher build() { + return new MessageDispatcher(this); + } + } + + public static Builder newBuilder(MessageReceiver receiver) { + return new Builder(receiver); + } + + public static Builder newBuilder(MessageReceiverWithAckResponse receiverWithAckResponse) { + return new Builder(receiverWithAckResponse); + } } diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/MessageReceiverWithAckResponse.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/MessageReceiverWithAckResponse.java new file mode 100644 index 000000000..49792be07 --- /dev/null +++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/MessageReceiverWithAckResponse.java @@ -0,0 +1,23 @@ +/* + * Copyright 2022 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 com.google.pubsub.v1.PubsubMessage; + +public interface MessageReceiverWithAckResponse { + void receiveMessage(PubsubMessage message, AckReplyConsumerWithResponse consumer); +} diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/ModackRequestData.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/ModackRequestData.java new file mode 100644 index 000000000..54c7436af --- /dev/null +++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/ModackRequestData.java @@ -0,0 +1,62 @@ +/* + * Copyright 2022 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 java.util.*; + +class ModackRequestData { + private final int deadlineExtensionSeconds; + private List ackRequestData; + private boolean isReceiptModack; + + ModackRequestData(int deadlineExtensionSeconds) { + this.deadlineExtensionSeconds = deadlineExtensionSeconds; + this.ackRequestData = new ArrayList(); + } + + ModackRequestData(int deadlineExtensionSeconds, AckRequestData... ackRequestData) { + this.deadlineExtensionSeconds = deadlineExtensionSeconds; + this.ackRequestData = Arrays.asList(ackRequestData); + } + + ModackRequestData(int deadlineExtensionSeconds, List ackRequestData) { + this.deadlineExtensionSeconds = deadlineExtensionSeconds; + this.ackRequestData = ackRequestData; + } + + public int getDeadlineExtensionSeconds() { + return deadlineExtensionSeconds; + } + + public List getAckRequestData() { + return ackRequestData; + } + + public boolean getIsReceiptModack() { + return isReceiptModack; + } + + public ModackRequestData addAckRequestData(AckRequestData ackRequestData) { + this.ackRequestData.add(ackRequestData); + return this; + } + + public ModackRequestData setIsReceiptModack(boolean isReceiptModack) { + this.isReceiptModack = isReceiptModack; + return this; + } +} diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/OpenTelemetryPubsubTracer.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/OpenTelemetryPubsubTracer.java new file mode 100644 index 000000000..3de448458 --- /dev/null +++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/OpenTelemetryPubsubTracer.java @@ -0,0 +1,463 @@ +/* + * Copyright 2024 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 com.google.pubsub.v1.PubsubMessage; +import com.google.pubsub.v1.SubscriptionName; +import com.google.pubsub.v1.TopicName; +import io.opentelemetry.api.common.Attributes; +import io.opentelemetry.api.common.AttributesBuilder; +import io.opentelemetry.api.trace.Span; +import io.opentelemetry.api.trace.SpanBuilder; +import io.opentelemetry.api.trace.SpanKind; +import io.opentelemetry.api.trace.StatusCode; +import io.opentelemetry.api.trace.Tracer; +import io.opentelemetry.context.Context; +import java.util.List; + +public class OpenTelemetryPubsubTracer { + private final Tracer tracer; + private boolean enabled = false; + + private static final String PUBLISH_FLOW_CONTROL_SPAN_NAME = "publisher flow control"; + private static final String PUBLISH_BATCHING_SPAN_NAME = "publisher batching"; + private static final String SUBSCRIBE_CONCURRENCY_CONTROL_SPAN_NAME = + "subscriber concurrency control"; + private static final String SUBSCRIBE_SCHEDULER_SPAN_NAME = "subscriber scheduler"; + + private static final String MESSAGING_SYSTEM_ATTR_KEY = "messaging.system"; + private static final String MESSAGING_DESTINATION_NAME_ATTR_KEY = "messaging.destination.name"; + private static final String CODE_FUNCTION_ATTR_KEY = "code.function"; + private static final String MESSAGING_OPERATION_ATTR_KEY = "messaging.operation"; + private static final String MESSAGING_BATCH_MESSAGE_COUNT_ATTR_KEY = + "messaging.batch.message_count"; + private static final String MESSAGING_MESSAGE_ID_ATTR_KEY = "messaging.message.id"; + private static final String MESSAGE_SIZE_ATTR_KEY = "messaging.message.body.size"; + private static final String ORDERING_KEY_ATTR_KEY = "messaging.gcp_pubsub.message.ordering_key"; + private static final String MESSAGE_ACK_ID_ATTR_KEY = "messaging.gcp_pubsub.message.ack_id"; + private static final String MESSAGE_EXACTLY_ONCE_ATTR_KEY = + "messaging.gcp_pubsub.message.exactly_once_delivery"; + private static final String MESSAGE_DELIVERY_ATTEMPT_ATTR_KEY = + "messaging.gcp_pubsub.message.delivery_attempt"; + private static final String ACK_DEADLINE_ATTR_KEY = "messaging.gcp_pubsub.message.ack_deadline"; + private static final String RECEIPT_MODACK_ATTR_KEY = "messaging.gcp_pubsub.is_receipt_modack"; + private static final String PROJECT_ATTR_KEY = "gcp.project_id"; + private static final String PUBLISH_RPC_SPAN_SUFFIX = " publish"; + + private static final String MESSAGING_SYSTEM_VALUE = "gcp_pubsub"; + + OpenTelemetryPubsubTracer(Tracer tracer, boolean enableOpenTelemetry) { + this.tracer = tracer; + if (this.tracer != null && enableOpenTelemetry) { + this.enabled = true; + } + } + + /** Populates attributes that are common the publisher parent span and publish RPC span. */ + private static final AttributesBuilder createCommonSpanAttributesBuilder( + String destinationName, String projectName, String codeFunction, String operation) { + AttributesBuilder attributesBuilder = + Attributes.builder() + .put(MESSAGING_SYSTEM_ATTR_KEY, MESSAGING_SYSTEM_VALUE) + .put(MESSAGING_DESTINATION_NAME_ATTR_KEY, destinationName) + .put(PROJECT_ATTR_KEY, projectName) + .put(CODE_FUNCTION_ATTR_KEY, codeFunction); + if (operation != null) { + attributesBuilder.put(MESSAGING_OPERATION_ATTR_KEY, operation); + } + + return attributesBuilder; + } + + private Span startChildSpan(String name, Span parent) { + return tracer.spanBuilder(name).setParent(Context.current().with(parent)).startSpan(); + } + + /** + * Creates and starts the parent span with the appropriate span attributes and injects the span + * context into the {@link PubsubMessage} attributes. + */ + void startPublisherSpan(PubsubMessageWrapper message) { + if (!enabled) { + return; + } + AttributesBuilder attributesBuilder = + createCommonSpanAttributesBuilder( + message.getTopicName(), message.getTopicProject(), "publish", "create"); + + attributesBuilder.put(MESSAGE_SIZE_ATTR_KEY, message.getDataSize()); + if (!message.getOrderingKey().isEmpty()) { + attributesBuilder.put(ORDERING_KEY_ATTR_KEY, message.getOrderingKey()); + } + + Span publisherSpan = + tracer + .spanBuilder(message.getTopicName() + " create") + .setSpanKind(SpanKind.PRODUCER) + .setAllAttributes(attributesBuilder.build()) + .startSpan(); + + message.setPublisherSpan(publisherSpan); + if (publisherSpan.getSpanContext().isValid()) { + message.injectSpanContext(); + } + } + + void endPublisherSpan(PubsubMessageWrapper message) { + if (!enabled) { + return; + } + message.endPublisherSpan(); + } + + void setPublisherMessageIdSpanAttribute(PubsubMessageWrapper message, String messageId) { + if (!enabled) { + return; + } + message.setPublisherMessageIdSpanAttribute(messageId); + } + + /** Creates a span for publish-side flow control as a child of the parent publisher span. */ + void startPublishFlowControlSpan(PubsubMessageWrapper message) { + if (!enabled) { + return; + } + Span publisherSpan = message.getPublisherSpan(); + if (publisherSpan != null) + message.setPublishFlowControlSpan( + startChildSpan(PUBLISH_FLOW_CONTROL_SPAN_NAME, publisherSpan)); + } + + void endPublishFlowControlSpan(PubsubMessageWrapper message) { + if (!enabled) { + return; + } + message.endPublishFlowControlSpan(); + } + + void setPublishFlowControlSpanException(PubsubMessageWrapper message, Throwable t) { + if (!enabled) { + return; + } + message.setPublishFlowControlSpanException(t); + } + + /** Creates a span for publish message batching as a child of the parent publisher span. */ + void startPublishBatchingSpan(PubsubMessageWrapper message) { + if (!enabled) { + return; + } + Span publisherSpan = message.getPublisherSpan(); + if (publisherSpan != null) { + message.setPublishBatchingSpan(startChildSpan(PUBLISH_BATCHING_SPAN_NAME, publisherSpan)); + } + } + + void endPublishBatchingSpan(PubsubMessageWrapper message) { + if (!enabled) { + return; + } + message.endPublishBatchingSpan(); + } + + /** + * Creates, starts, and returns a publish RPC span for the given message batch. Bi-directional + * links with the publisher parent span are created for sampled messages in the batch. + */ + Span startPublishRpcSpan(TopicName topicName, List messages) { + if (!enabled) { + return null; + } + Attributes attributes = + createCommonSpanAttributesBuilder( + topicName.getTopic(), topicName.getProject(), "publishCall", "publish") + .put(MESSAGING_BATCH_MESSAGE_COUNT_ATTR_KEY, messages.size()) + .build(); + SpanBuilder publishRpcSpanBuilder = + tracer + .spanBuilder(topicName.getTopic() + PUBLISH_RPC_SPAN_SUFFIX) + .setSpanKind(SpanKind.CLIENT) + .setAllAttributes(attributes); + Attributes linkAttributes = + Attributes.builder().put(MESSAGING_OPERATION_ATTR_KEY, "publish").build(); + for (PubsubMessageWrapper message : messages) { + if (message.getPublisherSpan().getSpanContext().isSampled()) + publishRpcSpanBuilder.addLink(message.getPublisherSpan().getSpanContext(), linkAttributes); + } + Span publishRpcSpan = publishRpcSpanBuilder.startSpan(); + + for (PubsubMessageWrapper message : messages) { + if (publishRpcSpan.getSpanContext().isSampled()) { + message.getPublisherSpan().addLink(publishRpcSpan.getSpanContext(), linkAttributes); + message.addPublishStartEvent(); + } + } + return publishRpcSpan; + } + + /** Ends the given publish RPC span if it exists. */ + void endPublishRpcSpan(Span publishRpcSpan) { + if (!enabled) { + return; + } + if (publishRpcSpan != null) { + publishRpcSpan.end(); + } + } + + /** + * Sets an error status and records an exception when an exception is thrown when publishing the + * message batch. + */ + void setPublishRpcSpanException(Span publishRpcSpan, Throwable t) { + if (!enabled) { + return; + } + if (publishRpcSpan != null) { + publishRpcSpan.setStatus(StatusCode.ERROR, "Exception thrown on publish RPC."); + publishRpcSpan.recordException(t); + publishRpcSpan.end(); + } + } + + void startSubscriberSpan(PubsubMessageWrapper message, boolean exactlyOnceDeliveryEnabled) { + if (!enabled) { + return; + } + AttributesBuilder attributesBuilder = + createCommonSpanAttributesBuilder( + message.getSubscriptionName(), message.getSubscriptionProject(), "onResponse", null); + + attributesBuilder + .put(MESSAGING_MESSAGE_ID_ATTR_KEY, message.getMessageId()) + .put(MESSAGE_SIZE_ATTR_KEY, message.getDataSize()) + .put(MESSAGE_ACK_ID_ATTR_KEY, message.getAckId()) + .put(MESSAGE_EXACTLY_ONCE_ATTR_KEY, exactlyOnceDeliveryEnabled); + if (!message.getOrderingKey().isEmpty()) { + attributesBuilder.put(ORDERING_KEY_ATTR_KEY, message.getOrderingKey()); + } + if (message.getDeliveryAttempt() > 0) { + attributesBuilder.put(MESSAGE_DELIVERY_ATTEMPT_ATTR_KEY, message.getDeliveryAttempt()); + } + Attributes attributes = attributesBuilder.build(); + Context publisherSpanContext = message.extractSpanContext(attributes); + message.setPublisherSpan(Span.fromContextOrNull(publisherSpanContext)); + message.setSubscriberSpan( + tracer + .spanBuilder(message.getSubscriptionName() + " subscribe") + .setSpanKind(SpanKind.CONSUMER) + .setParent(publisherSpanContext) + .setAllAttributes(attributes) + .startSpan()); + } + + void endSubscriberSpan(PubsubMessageWrapper message) { + if (!enabled) { + return; + } + message.endSubscriberSpan(); + } + + void setSubscriberSpanExpirationResult(PubsubMessageWrapper message) { + if (!enabled) { + return; + } + message.setSubscriberSpanExpirationResult(); + } + + void setSubscriberSpanException(PubsubMessageWrapper message, Throwable t, String exception) { + if (!enabled) { + return; + } + message.setSubscriberSpanException(t, exception); + } + + /** Creates a span for subscribe concurrency control as a child of the parent subscriber span. */ + void startSubscribeConcurrencyControlSpan(PubsubMessageWrapper message) { + if (!enabled) { + return; + } + Span subscriberSpan = message.getSubscriberSpan(); + if (subscriberSpan != null) { + message.setSubscribeConcurrencyControlSpan( + startChildSpan(SUBSCRIBE_CONCURRENCY_CONTROL_SPAN_NAME, subscriberSpan)); + } + } + + void endSubscribeConcurrencyControlSpan(PubsubMessageWrapper message) { + if (!enabled) { + return; + } + message.endSubscribeConcurrencyControlSpan(); + } + + void setSubscribeConcurrencyControlSpanException(PubsubMessageWrapper message, Throwable t) { + if (!enabled) { + return; + } + message.setSubscribeConcurrencyControlSpanException(t); + } + + /** + * Creates a span for subscribe ordering key scheduling as a child of the parent subscriber span. + */ + void startSubscribeSchedulerSpan(PubsubMessageWrapper message) { + if (!enabled) { + return; + } + Span subscriberSpan = message.getSubscriberSpan(); + if (subscriberSpan != null) { + message.setSubscribeSchedulerSpan( + startChildSpan(SUBSCRIBE_SCHEDULER_SPAN_NAME, subscriberSpan)); + } + } + + void endSubscribeSchedulerSpan(PubsubMessageWrapper message) { + if (!enabled) { + return; + } + message.endSubscribeSchedulerSpan(); + } + + /** Creates a span for subscribe message processing as a child of the parent subscriber span. */ + void startSubscribeProcessSpan(PubsubMessageWrapper message) { + if (!enabled) { + return; + } + Span subscriberSpan = message.getSubscriberSpan(); + if (subscriberSpan != null) { + Span subscribeProcessSpan = + startChildSpan(message.getSubscriptionName() + " process", subscriberSpan); + subscribeProcessSpan.setAttribute(MESSAGING_SYSTEM_ATTR_KEY, MESSAGING_SYSTEM_VALUE); + Span publisherSpan = message.getPublisherSpan(); + if (publisherSpan != null) { + subscribeProcessSpan.addLink(publisherSpan.getSpanContext()); + } + message.setSubscribeProcessSpan(subscribeProcessSpan); + } + } + + void endSubscribeProcessSpan(PubsubMessageWrapper message, String action) { + if (!enabled) { + return; + } + message.endSubscribeProcessSpan(action); + } + + /** + * Creates, starts, and returns spans for ModAck, Nack, and Ack RPC requests. Bi-directional links + * to parent subscribe span for sampled messages are added. + */ + Span startSubscribeRpcSpan( + SubscriptionName subscriptionName, + String rpcOperation, + List messages, + int ackDeadline, + boolean isReceiptModack) { + if (!enabled) { + return null; + } + String codeFunction = rpcOperation == "ack" ? "sendAckOperations" : "sendModAckOperations"; + AttributesBuilder attributesBuilder = + createCommonSpanAttributesBuilder( + subscriptionName.getSubscription(), + subscriptionName.getProject(), + codeFunction, + rpcOperation) + .put(MESSAGING_BATCH_MESSAGE_COUNT_ATTR_KEY, messages.size()); + + // Ack deadline and receipt modack are specific to the modack operation + if (rpcOperation == "modack") { + attributesBuilder + .put(ACK_DEADLINE_ATTR_KEY, ackDeadline) + .put(RECEIPT_MODACK_ATTR_KEY, isReceiptModack); + } + + SpanBuilder rpcSpanBuilder = + tracer + .spanBuilder(subscriptionName.getSubscription() + " " + rpcOperation) + .setSpanKind(SpanKind.CLIENT) + .setAllAttributes(attributesBuilder.build()); + Attributes linkAttributes = + Attributes.builder().put(MESSAGING_OPERATION_ATTR_KEY, rpcOperation).build(); + for (PubsubMessageWrapper message : messages) { + if (message.getSubscriberSpan().getSpanContext().isSampled()) { + rpcSpanBuilder.addLink(message.getSubscriberSpan().getSpanContext(), linkAttributes); + } + } + Span rpcSpan = rpcSpanBuilder.startSpan(); + + for (PubsubMessageWrapper message : messages) { + if (rpcSpan.getSpanContext().isSampled()) { + message.getSubscriberSpan().addLink(rpcSpan.getSpanContext(), linkAttributes); + switch (rpcOperation) { + case "ack": + message.addAckStartEvent(); + break; + case "modack": + message.addModAckStartEvent(); + break; + case "nack": + message.addNackStartEvent(); + break; + } + } + } + return rpcSpan; + } + + /** Ends the given subscribe RPC span if it exists. */ + void endSubscribeRpcSpan(Span rpcSpan) { + if (!enabled) { + return; + } + if (rpcSpan != null) { + rpcSpan.end(); + } + } + + /** + * Sets an error status and records an exception when an exception is thrown when handling a + * subscribe-side RPC. + */ + void setSubscribeRpcSpanException(Span rpcSpan, boolean isModack, int ackDeadline, Throwable t) { + if (!enabled) { + return; + } + if (rpcSpan != null) { + String operation = !isModack ? "ack" : (ackDeadline == 0 ? "nack" : "modack"); + rpcSpan.setStatus(StatusCode.ERROR, "Exception thrown on " + operation + " RPC."); + rpcSpan.recordException(t); + rpcSpan.end(); + } + } + + /** Adds the appropriate subscribe-side RPC end event. */ + void addEndRpcEvent( + PubsubMessageWrapper message, boolean rpcSampled, boolean isModack, int ackDeadline) { + if (!enabled || !rpcSampled) { + return; + } + if (!isModack) { + message.addAckEndEvent(); + } else if (ackDeadline == 0) { + message.addNackEndEvent(); + } else { + message.addModAckEndEvent(); + } + } +} diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/Publisher.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/Publisher.java index d29a619fd..56c920bcf 100644 --- a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/Publisher.java +++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/Publisher.java @@ -27,6 +27,7 @@ import com.google.api.gax.batching.BatchingSettings; import com.google.api.gax.batching.FlowControlSettings; import com.google.api.gax.batching.FlowController; +import com.google.api.gax.batching.FlowController.LimitExceededBehavior; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; import com.google.api.gax.core.CredentialsProvider; @@ -34,6 +35,7 @@ import com.google.api.gax.core.ExecutorProvider; import com.google.api.gax.core.FixedExecutorProvider; import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.GrpcCallContext; import com.google.api.gax.retrying.RetrySettings; import com.google.api.gax.rpc.HeaderProvider; import com.google.api.gax.rpc.NoHeaderProvider; @@ -44,12 +46,18 @@ import com.google.cloud.pubsub.v1.stub.PublisherStub; import com.google.cloud.pubsub.v1.stub.PublisherStubSettings; import com.google.common.base.Preconditions; +import com.google.protobuf.CodedOutputStream; import com.google.pubsub.v1.PublishRequest; import com.google.pubsub.v1.PublishResponse; import com.google.pubsub.v1.PubsubMessage; import com.google.pubsub.v1.TopicName; import com.google.pubsub.v1.TopicNames; +import io.grpc.CallOptions; +import io.opentelemetry.api.OpenTelemetry; +import io.opentelemetry.api.trace.Span; +import io.opentelemetry.api.trace.Tracer; import java.io.IOException; +import java.time.Duration; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; @@ -58,6 +66,7 @@ import java.util.Map; import java.util.concurrent.Callable; import java.util.concurrent.CountDownLatch; +import java.util.concurrent.Executor; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; @@ -66,7 +75,6 @@ import java.util.concurrent.locks.ReentrantLock; import java.util.logging.Level; import java.util.logging.Logger; -import org.threeten.bp.Duration; /** * A Cloud Pub/Sub publisher, that is @@ -87,8 +95,15 @@ */ public class Publisher implements PublisherInterface { private static final Logger logger = Logger.getLogger(Publisher.class.getName()); + private LoggingUtil loggingUtil = new LoggingUtil(); + + private static final String GZIP_COMPRESSION = "gzip"; + + private static final String OPEN_TELEMETRY_TRACER_NAME = "com.google.cloud.pubsub.v1"; private final String topicName; + private final int topicNameSize; + private final TopicName topicNameObject; private final BatchingSettings batchingSettings; private final boolean enableMessageOrdering; @@ -113,6 +128,16 @@ public class Publisher implements PublisherInterface { private MessageFlowController flowController = null; + private final boolean enableCompression; + private final long compressionBytesThreshold; + + private final GrpcCallContext publishContext; + private final GrpcCallContext publishContextWithCompression; + + private final boolean enableOpenTelemetryTracing; + private final OpenTelemetry openTelemetry; + private OpenTelemetryPubsubTracer tracer = new OpenTelemetryPubsubTracer(null, false); + /** The maximum number of messages in one request. Defined by the API. */ public static long getApiMaxRequestElementCount() { return 1000L; @@ -125,6 +150,9 @@ public static long getApiMaxRequestBytes() { private Publisher(Builder builder) throws IOException { topicName = builder.topicName; + topicNameSize = + CodedOutputStream.computeStringSize(PublishRequest.TOPIC_FIELD_NUMBER, this.topicName); + topicNameObject = TopicName.parse(this.topicName); this.batchingSettings = builder.batchingSettings; FlowControlSettings flowControl = this.batchingSettings.getFlowControlSettings(); @@ -139,6 +167,17 @@ private Publisher(Builder builder) throws IOException { this.enableMessageOrdering = builder.enableMessageOrdering; this.messageTransform = builder.messageTransform; + this.enableCompression = builder.enableCompression; + this.compressionBytesThreshold = builder.compressionBytesThreshold; + this.enableOpenTelemetryTracing = builder.enableOpenTelemetryTracing; + this.openTelemetry = builder.openTelemetry; + if (this.openTelemetry != null && this.enableOpenTelemetryTracing) { + Tracer openTelemetryTracer = builder.openTelemetry.getTracer(OPEN_TELEMETRY_TRACER_NAME); + if (openTelemetryTracer != null) { + this.tracer = + new OpenTelemetryPubsubTracer(openTelemetryTracer, this.enableOpenTelemetryTracing); + } + } messagesBatches = new HashMap<>(); messagesBatchLock = new ReentrantLock(); @@ -163,7 +202,7 @@ private Publisher(Builder builder) throws IOException { // key? retrySettingsBuilder .setMaxAttempts(Integer.MAX_VALUE) - .setTotalTimeout(Duration.ofNanos(Long.MAX_VALUE)); + .setTotalTimeoutDuration(Duration.ofNanos(Long.MAX_VALUE)); } PublisherStubSettings.Builder stubSettings = @@ -172,6 +211,7 @@ private Publisher(Builder builder) throws IOException { .setExecutorProvider(FixedExecutorProvider.create(executor)) .setTransportChannelProvider(builder.channelProvider) .setEndpoint(builder.endpoint) + .setUniverseDomain(builder.universeDomain) .setHeaderProvider(builder.headerProvider); stubSettings .publishSettings() @@ -190,6 +230,10 @@ private Publisher(Builder builder) throws IOException { backgroundResources = new BackgroundResourceAggregation(backgroundResourceList); shutdown = new AtomicBoolean(false); messagesWaiter = new Waiter(); + this.publishContext = GrpcCallContext.createDefault(); + this.publishContextWithCompression = + GrpcCallContext.createDefault() + .withCallOptions(CallOptions.DEFAULT.withCompression(GZIP_COMPRESSION)); } /** Topic which the publisher publishes to. */ @@ -241,17 +285,23 @@ public ApiFuture publish(PubsubMessage message) { + "Publisher client. Please create a Publisher client with " + "setEnableMessageOrdering(true) in the builder."); - final OutstandingPublish outstandingPublish = - new OutstandingPublish(messageTransform.apply(message)); + PubsubMessageWrapper messageWrapper = + PubsubMessageWrapper.newBuilder(messageTransform.apply(message), topicNameObject).build(); + tracer.startPublisherSpan(messageWrapper); + + final OutstandingPublish outstandingPublish = new OutstandingPublish(messageWrapper); if (flowController != null) { + tracer.startPublishFlowControlSpan(messageWrapper); try { flowController.acquire(outstandingPublish.messageSize); + tracer.endPublishFlowControlSpan(messageWrapper); } catch (FlowController.FlowControlException e) { if (!orderingKey.isEmpty()) { sequentialExecutor.stopPublish(orderingKey); } outstandingPublish.publishResult.setException(e); + tracer.setPublishFlowControlSpanException(messageWrapper, e); return outstandingPublish.publishResult; } } @@ -259,6 +309,7 @@ public ApiFuture publish(PubsubMessage message) { List batchesToSend; messagesBatchLock.lock(); try { + tracer.startPublishBatchingSpan(messageWrapper); if (!orderingKey.isEmpty() && sequentialExecutor.keyHasError(orderingKey)) { outstandingPublish.publishResult.setException( SequentialExecutorService.CallbackExecutor.CANCELLATION_EXCEPTION); @@ -266,7 +317,7 @@ public ApiFuture publish(PubsubMessage message) { } MessagesBatch messagesBatch = messagesBatches.get(orderingKey); if (messagesBatch == null) { - messagesBatch = new MessagesBatch(batchingSettings, orderingKey); + messagesBatch = new MessagesBatch(batchingSettings, topicNameSize, orderingKey); messagesBatches.put(orderingKey, messagesBatch); } @@ -316,7 +367,6 @@ public void run() { * * @param key The key for which to resume publishing. */ - @BetaApi("Ordering is not yet fully supported and requires special project enablements.") public void resumePublish(String key) { Preconditions.checkState(!shutdown.get(), "Cannot publish on a shut-down publisher."); sequentialExecutor.resumePublish(key); @@ -431,16 +481,43 @@ private void publishAllWithoutInflightForKey(final String orderingKey) { } private ApiFuture publishCall(OutstandingBatch outstandingBatch) { + GrpcCallContext context = publishContext; + if (enableCompression && outstandingBatch.batchSizeBytes >= compressionBytesThreshold) { + context = publishContextWithCompression; + } + + int numMessagesInBatch = outstandingBatch.size(); + List pubsubMessagesList = new ArrayList(numMessagesInBatch); + List messageWrappers = outstandingBatch.getMessageWrappers(); + for (PubsubMessageWrapper messageWrapper : messageWrappers) { + tracer.endPublishBatchingSpan(messageWrapper); + pubsubMessagesList.add(messageWrapper.getPubsubMessage()); + } + + outstandingBatch.publishRpcSpan = tracer.startPublishRpcSpan(topicNameObject, messageWrappers); + return publisherStub .publishCallable() .futureCall( PublishRequest.newBuilder() .setTopic(topicName) - .addAllMessages(outstandingBatch.getMessages()) - .build()); + .addAllMessages(pubsubMessagesList) + .build(), + context); } private void publishOutstandingBatch(final OutstandingBatch outstandingBatch) { + if (outstandingBatch.size() == 0) { + logger.log(Level.WARNING, "Attempted to publish batch with zero messages."); + return; + } + + loggingUtil.logPublisher( + LoggingUtil.SubSystem.PUBLISH_BATCH, + Level.FINE, + String.format("Attempting to batch publish %d messages", outstandingBatch.size()), + outstandingBatch.getMessageWrappers().get(0)); + final ApiFutureCallback futureCallback = new ApiFutureCallback() { @Override @@ -493,6 +570,7 @@ public void onFailure(Throwable t) { }; ApiFuture future; + Executor callbackExecutor = directExecutor(); if (outstandingBatch.orderingKey == null || outstandingBatch.orderingKey.isEmpty()) { future = publishCall(outstandingBatch); } else { @@ -505,8 +583,9 @@ public ApiFuture call() { return publishCall(outstandingBatch); } }); + callbackExecutor = this.executor; } - ApiFutures.addCallback(future, futureCallback, directExecutor()); + ApiFutures.addCallback(future, futureCallback, callbackExecutor); } private final class OutstandingBatch { @@ -515,6 +594,7 @@ private final class OutstandingBatch { int attempt; int batchSizeBytes; final String orderingKey; + Span publishRpcSpan; OutstandingBatch( List outstandingPublishes, int batchSizeBytes, String orderingKey) { @@ -529,24 +609,29 @@ int size() { return outstandingPublishes.size(); } - private List getMessages() { - List results = new ArrayList<>(outstandingPublishes.size()); + private List getMessageWrappers() { + List results = new ArrayList<>(outstandingPublishes.size()); for (OutstandingPublish outstandingPublish : outstandingPublishes) { - results.add(outstandingPublish.message); + results.add(outstandingPublish.messageWrapper); } return results; } private void onFailure(Throwable t) { + tracer.setPublishRpcSpanException(publishRpcSpan, t); + for (OutstandingPublish outstandingPublish : outstandingPublishes) { if (flowController != null) { flowController.release(outstandingPublish.messageSize); } outstandingPublish.publishResult.setException(t); + tracer.endPublisherSpan(outstandingPublish.messageWrapper); } } private void onSuccess(Iterable results) { + tracer.endPublishRpcSpan(publishRpcSpan); + Iterator messagesResultsIt = outstandingPublishes.iterator(); for (String messageId : results) { OutstandingPublish nextPublish = messagesResultsIt.next(); @@ -554,19 +639,23 @@ private void onSuccess(Iterable results) { flowController.release(nextPublish.messageSize); } nextPublish.publishResult.set(messageId); + tracer.setPublisherMessageIdSpanAttribute(nextPublish.messageWrapper, messageId); + tracer.endPublisherSpan(nextPublish.messageWrapper); } } } private static final class OutstandingPublish { final SettableApiFuture publishResult; - final PubsubMessage message; + final PubsubMessageWrapper messageWrapper; final int messageSize; - OutstandingPublish(PubsubMessage message) { + OutstandingPublish(PubsubMessageWrapper messageWrapper) { this.publishResult = SettableApiFuture.create(); - this.message = message; - this.messageSize = message.getSerializedSize(); + this.messageWrapper = messageWrapper; + this.messageSize = + CodedOutputStream.computeMessageSize( + PublishRequest.MESSAGES_FIELD_NUMBER, messageWrapper.getPubsubMessage()); } } @@ -657,11 +746,14 @@ public static final class Builder { static final long DEFAULT_REQUEST_BYTES_THRESHOLD = 1000L; // 1 kB static final Duration DEFAULT_DELAY_THRESHOLD = Duration.ofMillis(1); private static final Duration DEFAULT_INITIAL_RPC_TIMEOUT = Duration.ofSeconds(5); - private static final Duration DEFAULT_MAX_RPC_TIMEOUT = Duration.ofSeconds(600); + private static final Duration DEFAULT_MAX_RPC_TIMEOUT = Duration.ofSeconds(60); private static final Duration DEFAULT_TOTAL_TIMEOUT = Duration.ofSeconds(600); + private static final Duration DEFAULT_INITIAL_RETRY_DELAY = Duration.ofMillis(100); + private static final Duration DEFAULT_MAX_RETRY_DELAY = Duration.ofSeconds(60); + private static final double DEFAULT_MULTIPLIER = 4; static final BatchingSettings DEFAULT_BATCHING_SETTINGS = BatchingSettings.newBuilder() - .setDelayThreshold(DEFAULT_DELAY_THRESHOLD) + .setDelayThresholdDuration(DEFAULT_DELAY_THRESHOLD) .setRequestByteThreshold(DEFAULT_REQUEST_BYTES_THRESHOLD) .setElementCountThreshold(DEFAULT_ELEMENT_COUNT_THRESHOLD) .setFlowControlSettings( @@ -671,13 +763,13 @@ public static final class Builder { .build(); static final RetrySettings DEFAULT_RETRY_SETTINGS = RetrySettings.newBuilder() - .setTotalTimeout(DEFAULT_TOTAL_TIMEOUT) - .setInitialRetryDelay(Duration.ofMillis(100)) - .setRetryDelayMultiplier(1.3) - .setMaxRetryDelay(Duration.ofSeconds(60)) - .setInitialRpcTimeout(DEFAULT_INITIAL_RPC_TIMEOUT) - .setRpcTimeoutMultiplier(1) - .setMaxRpcTimeout(DEFAULT_MAX_RPC_TIMEOUT) + .setTotalTimeoutDuration(DEFAULT_TOTAL_TIMEOUT) + .setInitialRetryDelayDuration(DEFAULT_INITIAL_RETRY_DELAY) + .setRetryDelayMultiplier(DEFAULT_MULTIPLIER) + .setMaxRetryDelayDuration(DEFAULT_MAX_RETRY_DELAY) + .setInitialRpcTimeoutDuration(DEFAULT_INITIAL_RPC_TIMEOUT) + .setRpcTimeoutMultiplier(DEFAULT_MULTIPLIER) + .setMaxRpcTimeoutDuration(DEFAULT_MAX_RPC_TIMEOUT) .build(); static final boolean DEFAULT_ENABLE_MESSAGE_ORDERING = false; private static final int THREADS_PER_CPU = 5; @@ -685,9 +777,12 @@ public static final class Builder { InstantiatingExecutorProvider.newBuilder() .setExecutorThreadCount(THREADS_PER_CPU * Runtime.getRuntime().availableProcessors()) .build(); + static final boolean DEFAULT_ENABLE_COMPRESSION = false; + static final long DEFAULT_COMPRESSION_BYTES_THRESHOLD = 240L; String topicName; - private String endpoint = PublisherStubSettings.getDefaultEndpoint(); + private String endpoint = null; + private String universeDomain = null; // Batching options BatchingSettings batchingSettings = DEFAULT_BATCHING_SETTINGS; @@ -714,6 +809,12 @@ public PubsubMessage apply(PubsubMessage input) { } }; + private boolean enableCompression = DEFAULT_ENABLE_COMPRESSION; + private long compressionBytesThreshold = DEFAULT_COMPRESSION_BYTES_THRESHOLD; + + private boolean enableOpenTelemetryTracing = false; + private OpenTelemetry openTelemetry = null; + private Builder(String topic) { this.topicName = Preconditions.checkNotNull(topic); } @@ -776,6 +877,11 @@ public Builder setBatchingSettings(BatchingSettings batchingSettings) { Preconditions.checkArgument(batchingSettings.getRequestByteThreshold() > 0); Preconditions.checkNotNull(batchingSettings.getDelayThreshold()); Preconditions.checkArgument(batchingSettings.getDelayThreshold().toMillis() > 0); + FlowControlSettings flowControlSettings = batchingSettings.getFlowControlSettings(); + if (flowControlSettings.getLimitExceededBehavior() != LimitExceededBehavior.Ignore) { + Preconditions.checkArgument(flowControlSettings.getMaxOutstandingElementCount() > 0); + Preconditions.checkArgument(flowControlSettings.getMaxOutstandingRequestBytes() > 0); + } this.batchingSettings = batchingSettings; return this; } @@ -783,15 +889,14 @@ public Builder setBatchingSettings(BatchingSettings batchingSettings) { /** Configures the Publisher's retry parameters. */ public Builder setRetrySettings(RetrySettings retrySettings) { Preconditions.checkArgument( - retrySettings.getTotalTimeout().compareTo(MIN_TOTAL_TIMEOUT) >= 0); + retrySettings.getTotalTimeoutDuration().compareTo(MIN_TOTAL_TIMEOUT) >= 0); Preconditions.checkArgument( - retrySettings.getInitialRpcTimeout().compareTo(MIN_RPC_TIMEOUT) >= 0); + retrySettings.getInitialRpcTimeoutDuration().compareTo(MIN_RPC_TIMEOUT) >= 0); this.retrySettings = retrySettings; return this; } /** Sets the message ordering option. */ - @BetaApi("Ordering is not yet fully supported and requires special project enablements.") public Builder setEnableMessageOrdering(boolean enableMessageOrdering) { this.enableMessageOrdering = enableMessageOrdering; return this; @@ -820,6 +925,47 @@ public Builder setEndpoint(String endpoint) { return this; } + /** Gives the ability to override the universe domain. */ + public Builder setUniverseDomain(String universeDomain) { + this.universeDomain = universeDomain; + return this; + } + + /** Gives the ability to enable transport compression. */ + public Builder setEnableCompression(boolean enableCompression) { + this.enableCompression = enableCompression; + return this; + } + + /** + * Sets the threshold (in bytes) above which messages are compressed for transport. Only takes + * effect if setEnableCompression(true) is also called." + */ + public Builder setCompressionBytesThreshold(long compressionBytesThreshold) { + this.compressionBytesThreshold = compressionBytesThreshold; + return this; + } + + /** + * OpenTelemetry will be enabled if setEnableOpenTelemetry is true and and instance of + * OpenTelemetry has been provied. Warning: traces are subject to change. The name and + * attributes of a span might change without notice. Only use run traces interactively. Don't + * use in automation. Running non-interactive traces can cause problems if the underlying trace + * architecture changes without notice. + */ + + /** Gives the ability to enable Open Telemetry Tracing */ + public Builder setEnableOpenTelemetryTracing(boolean enableOpenTelemetryTracing) { + this.enableOpenTelemetryTracing = enableOpenTelemetryTracing; + return this; + } + + /** Sets the instance of OpenTelemetry for the Publisher class. */ + public Builder setOpenTelemetry(OpenTelemetry openTelemetry) { + this.openTelemetry = openTelemetry; + return this; + } + /** Returns the default BatchingSettings used by the client if settings are not provided. */ public static BatchingSettings getDefaultBatchingSettings() { return DEFAULT_BATCHING_SETTINGS; @@ -856,6 +1002,12 @@ private static class MessageFlowController { } void acquire(long messageSize) throws FlowController.FlowControlException { + if (messageSize > byteLimit) { + logger.log( + Level.WARNING, + "Attempted to publish message with byte size > request byte flow control limit."); + throw new FlowController.MaxOutstandingRequestBytesReachedException(byteLimit); + } lock.lock(); try { if (outstandingMessages >= messageLimit @@ -960,12 +1112,15 @@ void release(long messageSize) { private class MessagesBatch { private List messages; + private int initialBatchedBytes; private int batchedBytes; private String orderingKey; private final BatchingSettings batchingSettings; - private MessagesBatch(BatchingSettings batchingSettings, String orderingKey) { + private MessagesBatch( + BatchingSettings batchingSettings, int initialBatchedBytes, String orderingKey) { this.batchingSettings = batchingSettings; + this.initialBatchedBytes = initialBatchedBytes; this.orderingKey = orderingKey; reset(); } @@ -978,7 +1133,7 @@ private OutstandingBatch popOutstandingBatch() { private void reset() { messages = new LinkedList<>(); - batchedBytes = 0; + batchedBytes = initialBatchedBytes; } private boolean isEmpty() { @@ -1017,7 +1172,9 @@ && getBatchedBytes() + outstandingPublish.messageSize >= getMaxBatchBytes()) { // immediately. // Alternatively if after adding the message we have reached the batch max messages then we // have a batch to send. - if ((hasBatchingBytes() && outstandingPublish.messageSize >= getMaxBatchBytes()) + // Note that exceeding {@link Publisher#getApiMaxRequestBytes()} will result in failed + // publishes without compression and may yet fail if a request is not sufficiently compressed. + if ((hasBatchingBytes() && getBatchedBytes() >= getMaxBatchBytes()) || getMessagesCount() == batchingSettings.getElementCountThreshold()) { batchesToSend.add(popOutstandingBatch()); } diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/PubsubMessageWrapper.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/PubsubMessageWrapper.java new file mode 100644 index 000000000..19864a26f --- /dev/null +++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/PubsubMessageWrapper.java @@ -0,0 +1,422 @@ +/* + * Copyright 2024 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 com.google.pubsub.v1.PubsubMessage; +import com.google.pubsub.v1.SubscriptionName; +import com.google.pubsub.v1.TopicName; +import io.opentelemetry.api.common.Attributes; +import io.opentelemetry.api.trace.Span; +import io.opentelemetry.api.trace.StatusCode; +import io.opentelemetry.api.trace.propagation.W3CTraceContextPropagator; +import io.opentelemetry.context.Context; +import io.opentelemetry.context.propagation.TextMapGetter; +import io.opentelemetry.context.propagation.TextMapSetter; + +/** + * A wrapper class for a {@link PubsubMessage} object that handles creation and tracking of + * OpenTelemetry {@link Span} objects for different operations that occur during publishing. + */ +public class PubsubMessageWrapper { + private PubsubMessage message; + + private final TopicName topicName; + private final SubscriptionName subscriptionName; + + // Attributes set only for messages received from a streaming pull response. + private final String ackId; + private final int deliveryAttempt; + + private static final String PUBLISH_START_EVENT = "publish start"; + private static final String PUBLISH_END_EVENT = "publish end"; + + private static final String MODACK_START_EVENT = "modack start"; + private static final String MODACK_END_EVENT = "modack end"; + private static final String NACK_START_EVENT = "nack start"; + private static final String NACK_END_EVENT = "nack end"; + private static final String ACK_START_EVENT = "ack start"; + private static final String ACK_END_EVENT = "ack end"; + + private static final String GOOGCLIENT_PREFIX = "googclient_"; + + private static final String MESSAGING_MESSAGE_ID_ATTR_KEY = "messaging.message.id"; + private static final String MESSAGE_RESULT_ATTR_KEY = "messaging.gcp_pubsub.result"; + + private Span publisherSpan; + private Span publishFlowControlSpan; + private Span publishBatchingSpan; + + private Span subscriberSpan; + private Span subscribeConcurrencyControlSpan; + private Span subscribeSchedulerSpan; + private Span subscribeProcessSpan; + + private PubsubMessageWrapper(Builder builder) { + this.message = builder.message; + this.topicName = builder.topicName; + this.subscriptionName = builder.subscriptionName; + this.ackId = builder.ackId; + this.deliveryAttempt = builder.deliveryAttempt; + } + + static Builder newBuilder(PubsubMessage message, TopicName topicName) { + return new Builder(message, topicName); + } + + static Builder newBuilder( + PubsubMessage message, SubscriptionName subscriptionName, String ackId, int deliveryAttempt) { + return new Builder(message, subscriptionName, ackId, deliveryAttempt); + } + + /** Returns the PubsubMessage associated with this wrapper. */ + PubsubMessage getPubsubMessage() { + return message; + } + + void setPubsubMessage(PubsubMessage message) { + this.message = message; + } + + /** Returns the TopicName for this wrapper as a string. */ + String getTopicName() { + if (topicName != null) { + return topicName.getTopic(); + } + return ""; + } + + String getTopicProject() { + if (topicName != null) { + return topicName.getProject(); + } + return ""; + } + + /** Returns the SubscriptionName for this wrapper as a string. */ + String getSubscriptionName() { + if (subscriptionName != null) { + return subscriptionName.getSubscription(); + } + return ""; + } + + String getSubscriptionProject() { + if (subscriptionName != null) { + return subscriptionName.getProject(); + } + return ""; + } + + String getMessageId() { + return message.getMessageId(); + } + + String getAckId() { + return ackId; + } + + int getDataSize() { + return message.getData().size(); + } + + int getSerializedSize() { + return message.getSerializedSize(); + } + + String getOrderingKey() { + return message.getOrderingKey(); + } + + int getDeliveryAttempt() { + return deliveryAttempt; + } + + Span getPublisherSpan() { + return publisherSpan; + } + + void setPublisherSpan(Span span) { + this.publisherSpan = span; + } + + void setPublishFlowControlSpan(Span span) { + this.publishFlowControlSpan = span; + } + + void setPublishBatchingSpan(Span span) { + this.publishBatchingSpan = span; + } + + Span getSubscriberSpan() { + return subscriberSpan; + } + + void setSubscriberSpan(Span span) { + this.subscriberSpan = span; + } + + void setSubscribeConcurrencyControlSpan(Span span) { + this.subscribeConcurrencyControlSpan = span; + } + + void setSubscribeSchedulerSpan(Span span) { + this.subscribeSchedulerSpan = span; + } + + void setSubscribeProcessSpan(Span span) { + this.subscribeProcessSpan = span; + } + + /** Creates a publish start event that is tied to the publish RPC span time. */ + void addPublishStartEvent() { + if (publisherSpan != null) { + publisherSpan.addEvent(PUBLISH_START_EVENT); + } + } + + /** + * Sets the message ID attribute in the publisher parent span. This is called after the publish + * RPC returns with a message ID. + */ + void setPublisherMessageIdSpanAttribute(String messageId) { + if (publisherSpan != null) { + publisherSpan.setAttribute(MESSAGING_MESSAGE_ID_ATTR_KEY, messageId); + } + } + + /** Ends the publisher parent span if it exists. */ + void endPublisherSpan() { + if (publisherSpan != null) { + publisherSpan.addEvent(PUBLISH_END_EVENT); + publisherSpan.end(); + } + } + + /** Ends the publish flow control span if it exists. */ + void endPublishFlowControlSpan() { + if (publishFlowControlSpan != null) { + publishFlowControlSpan.end(); + } + } + + /** Ends the publish batching span if it exists. */ + void endPublishBatchingSpan() { + if (publishBatchingSpan != null) { + publishBatchingSpan.end(); + } + } + + /** + * Sets an error status and records an exception when an exception is thrown during flow control. + */ + void setPublishFlowControlSpanException(Throwable t) { + if (publishFlowControlSpan != null) { + publishFlowControlSpan.setStatus( + StatusCode.ERROR, "Exception thrown during publish flow control."); + publishFlowControlSpan.recordException(t); + endAllPublishSpans(); + } + } + + /** + * Creates start and end events for ModAcks, Nacks, and Acks that are tied to the corresponding + * RPC span start and end times. + */ + void addModAckStartEvent() { + if (subscriberSpan != null) { + subscriberSpan.addEvent(MODACK_START_EVENT); + } + } + + void addModAckEndEvent() { + if (subscriberSpan != null) { + subscriberSpan.addEvent(MODACK_END_EVENT); + } + } + + void addNackStartEvent() { + if (subscriberSpan != null) { + subscriberSpan.addEvent(NACK_START_EVENT); + } + } + + void addNackEndEvent() { + if (subscriberSpan != null) { + subscriberSpan.addEvent(NACK_END_EVENT); + } + } + + void addAckStartEvent() { + if (subscriberSpan != null) { + subscriberSpan.addEvent(ACK_START_EVENT); + } + } + + void addAckEndEvent() { + if (subscriberSpan != null) { + subscriberSpan.addEvent(ACK_END_EVENT); + } + } + + /** Ends the subscriber parent span if exists. */ + void endSubscriberSpan() { + if (subscriberSpan != null) { + subscriberSpan.end(); + } + } + + /** Ends the subscribe concurreny control span if exists. */ + void endSubscribeConcurrencyControlSpan() { + if (subscribeConcurrencyControlSpan != null) { + subscribeConcurrencyControlSpan.end(); + } + } + + /** Ends the subscribe scheduler span if exists. */ + void endSubscribeSchedulerSpan() { + if (subscribeSchedulerSpan != null) { + subscribeSchedulerSpan.end(); + } + } + + /** + * Ends the subscribe process span if it exists, creates an event with the appropriate result, and + * sets the result on the parent subscriber span. + */ + void endSubscribeProcessSpan(String action) { + if (subscribeProcessSpan != null) { + subscribeProcessSpan.addEvent(action + " called"); + subscribeProcessSpan.end(); + subscriberSpan.setAttribute(MESSAGE_RESULT_ATTR_KEY, action); + } + } + + /** Sets an exception on the subscriber span during Ack/ModAck/Nack failures */ + void setSubscriberSpanException(Throwable t, String exception) { + if (subscriberSpan != null) { + subscriberSpan.setStatus(StatusCode.ERROR, exception); + subscriberSpan.recordException(t); + endAllSubscribeSpans(); + } + } + + /** Sets result of the parent subscriber span to expired and ends its. */ + void setSubscriberSpanExpirationResult() { + if (subscriberSpan != null) { + subscriberSpan.setAttribute(MESSAGE_RESULT_ATTR_KEY, "expired"); + endSubscriberSpan(); + } + } + + /** + * Sets an error status and records an exception when an exception is thrown subscriber + * concurrency control. + */ + void setSubscribeConcurrencyControlSpanException(Throwable t) { + if (subscribeConcurrencyControlSpan != null) { + subscribeConcurrencyControlSpan.setStatus( + StatusCode.ERROR, "Exception thrown during subscribe concurrency control."); + subscribeConcurrencyControlSpan.recordException(t); + endAllSubscribeSpans(); + } + } + + /** Ends all publisher-side spans associated with this message wrapper. */ + private void endAllPublishSpans() { + endPublishFlowControlSpan(); + endPublishBatchingSpan(); + endPublisherSpan(); + } + + /** Ends all subscriber-side spans associated with this message wrapper. */ + private void endAllSubscribeSpans() { + endSubscribeConcurrencyControlSpan(); + endSubscribeSchedulerSpan(); + endSubscriberSpan(); + } + + /** + * Injects the span context into the attributes of a Pub/Sub message for propagation to the + * subscriber client. + */ + void injectSpanContext() { + TextMapSetter injectMessageAttributes = + new TextMapSetter() { + @Override + public void set(PubsubMessageWrapper carrier, String key, String value) { + PubsubMessage newMessage = + PubsubMessage.newBuilder(carrier.message) + .putAttributes(GOOGCLIENT_PREFIX + key, value) + .build(); + carrier.message = newMessage; + } + }; + W3CTraceContextPropagator.getInstance() + .inject(Context.current().with(publisherSpan), this, injectMessageAttributes); + } + + /** + * Extracts the span context from the attributes of a Pub/Sub message and creates the parent + * subscriber span using that context. + */ + Context extractSpanContext(Attributes attributes) { + TextMapGetter extractMessageAttributes = + new TextMapGetter() { + @Override + public String get(PubsubMessageWrapper carrier, String key) { + return carrier.message.getAttributesOrDefault(GOOGCLIENT_PREFIX + key, ""); + } + + public Iterable keys(PubsubMessageWrapper carrier) { + return carrier.message.getAttributesMap().keySet(); + } + }; + Context context = + W3CTraceContextPropagator.getInstance() + .extract(Context.current(), this, extractMessageAttributes); + return context; + } + + /** Builder of {@link PubsubMessageWrapper PubsubMessageWrapper}. */ + static final class Builder { + private PubsubMessage message = null; + private TopicName topicName = null; + private SubscriptionName subscriptionName = null; + private String ackId = null; + private int deliveryAttempt = 0; + + public Builder(PubsubMessage message, TopicName topicName) { + this.message = message; + this.topicName = topicName; + } + + public Builder( + PubsubMessage message, + SubscriptionName subscriptionName, + String ackId, + int deliveryAttempt) { + this.message = message; + this.subscriptionName = subscriptionName; + this.ackId = ackId; + this.deliveryAttempt = deliveryAttempt; + } + + public PubsubMessageWrapper build() { + return new PubsubMessageWrapper(this); + } + } +} diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/SchemaServiceClient.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/SchemaServiceClient.java index 4ccac0cfd..74f1e9f1f 100644 --- a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/SchemaServiceClient.java +++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/SchemaServiceClient.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 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 + * 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, @@ -13,12 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.pubsub.v1; -import com.google.api.core.ApiFunction; import com.google.api.core.ApiFuture; import com.google.api.core.ApiFutures; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.paging.AbstractFixedSizeCollection; import com.google.api.gax.paging.AbstractPage; @@ -28,13 +27,23 @@ import com.google.cloud.pubsub.v1.stub.SchemaServiceStub; import com.google.cloud.pubsub.v1.stub.SchemaServiceStubSettings; import com.google.common.util.concurrent.MoreExecutors; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; import com.google.protobuf.Empty; +import com.google.pubsub.v1.CommitSchemaRequest; import com.google.pubsub.v1.CreateSchemaRequest; import com.google.pubsub.v1.DeleteSchemaRequest; +import com.google.pubsub.v1.DeleteSchemaRevisionRequest; import com.google.pubsub.v1.GetSchemaRequest; +import com.google.pubsub.v1.ListSchemaRevisionsRequest; +import com.google.pubsub.v1.ListSchemaRevisionsResponse; import com.google.pubsub.v1.ListSchemasRequest; import com.google.pubsub.v1.ListSchemasResponse; import com.google.pubsub.v1.ProjectName; +import com.google.pubsub.v1.RollbackSchemaRequest; import com.google.pubsub.v1.Schema; import com.google.pubsub.v1.SchemaName; import com.google.pubsub.v1.ValidateMessageRequest; @@ -46,40 +55,269 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND SERVICE +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * Service Description: + * Service Description: Service for doing schema-related operations. * *

This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: * - *

- * 
+ * 
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
  * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
  *   ProjectName parent = ProjectName.of("[PROJECT]");
  *   Schema schema = Schema.newBuilder().build();
- *   String schemaId = "";
+ *   String schemaId = "schemaId-697673060";
  *   Schema response = schemaServiceClient.createSchema(parent, schema, schemaId);
  * }
- * 
- * 
+ * }
* - *

Note: close() needs to be called on the schemaServiceClient object to clean up resources such + *

Note: close() needs to be called on the SchemaServiceClient object to clean up resources such * as threads. In the example above, try-with-resources is used, which automatically calls close(). * - *

The surface of this class includes several types of Java methods for each of the API's - * methods: - * - *

    - *
  1. A "flattened" method. With this type of method, the fields of the request type have been - * converted into function parameters. It may be the case that not all fields are available as - * parameters, and not every API method will have a flattened method entry point. - *
  2. A "request object" method. This type of method only takes one parameter, a request object, - * which must be constructed before the call. Not every API method will have a request object - * method. - *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API - * callable object, which can be used to initiate calls to the service. - *
+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Methods
MethodDescriptionMethod Variants

CreateSchema

Creates a schema.

+ *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ *
    + *
  • createSchema(CreateSchemaRequest request) + *

+ *

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

+ *
    + *
  • createSchema(ProjectName parent, Schema schema, String schemaId) + *

  • createSchema(String parent, Schema schema, String schemaId) + *

+ *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ *
    + *
  • createSchemaCallable() + *

+ *

GetSchema

Gets a schema.

+ *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ *
    + *
  • getSchema(GetSchemaRequest request) + *

+ *

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

+ *
    + *
  • getSchema(SchemaName name) + *

  • getSchema(String name) + *

+ *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ *
    + *
  • getSchemaCallable() + *

+ *

ListSchemas

Lists schemas in a project.

+ *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ *
    + *
  • listSchemas(ListSchemasRequest request) + *

+ *

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

+ *
    + *
  • listSchemas(ProjectName parent) + *

  • listSchemas(String parent) + *

+ *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ *
    + *
  • listSchemasPagedCallable() + *

  • listSchemasCallable() + *

+ *

ListSchemaRevisions

Lists all schema revisions for the named schema.

+ *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ *
    + *
  • listSchemaRevisions(ListSchemaRevisionsRequest request) + *

+ *

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

+ *
    + *
  • listSchemaRevisions(SchemaName name) + *

  • listSchemaRevisions(String name) + *

+ *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ *
    + *
  • listSchemaRevisionsPagedCallable() + *

  • listSchemaRevisionsCallable() + *

+ *

CommitSchema

Commits a new schema revision to an existing schema.

+ *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ *
    + *
  • commitSchema(CommitSchemaRequest request) + *

+ *

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

+ *
    + *
  • commitSchema(SchemaName name, Schema schema) + *

  • commitSchema(String name, Schema schema) + *

+ *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ *
    + *
  • commitSchemaCallable() + *

+ *

RollbackSchema

Creates a new schema revision that is a copy of the provided revision_id.

+ *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ *
    + *
  • rollbackSchema(RollbackSchemaRequest request) + *

+ *

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

+ *
    + *
  • rollbackSchema(SchemaName name, String revisionId) + *

  • rollbackSchema(String name, String revisionId) + *

+ *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ *
    + *
  • rollbackSchemaCallable() + *

+ *

DeleteSchemaRevision

Deletes a specific schema revision.

+ *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ *
    + *
  • deleteSchemaRevision(DeleteSchemaRevisionRequest request) + *

+ *

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

+ *
    + *
  • deleteSchemaRevision(SchemaName name, String revisionId) + *

  • deleteSchemaRevision(String name, String revisionId) + *

+ *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ *
    + *
  • deleteSchemaRevisionCallable() + *

+ *

DeleteSchema

Deletes a schema.

+ *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ *
    + *
  • deleteSchema(DeleteSchemaRequest request) + *

+ *

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

+ *
    + *
  • deleteSchema(SchemaName name) + *

  • deleteSchema(String name) + *

+ *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ *
    + *
  • deleteSchemaCallable() + *

+ *

ValidateSchema

Validates a schema.

+ *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ *
    + *
  • validateSchema(ValidateSchemaRequest request) + *

+ *

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

+ *
    + *
  • validateSchema(ProjectName parent, Schema schema) + *

  • validateSchema(String parent, Schema schema) + *

+ *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ *
    + *
  • validateSchemaCallable() + *

+ *

ValidateMessage

Validates a message against a schema.

+ *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ *
    + *
  • validateMessage(ValidateMessageRequest request) + *

+ *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ *
    + *
  • validateMessageCallable() + *

+ *

SetIamPolicy

Sets the access control policy on the specified resource. Replacesany existing policy. + *

Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors.

+ *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ *
    + *
  • setIamPolicy(SetIamPolicyRequest request) + *

+ *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ *
    + *
  • setIamPolicyCallable() + *

+ *

GetIamPolicy

Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set.

+ *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ *
    + *
  • getIamPolicy(GetIamPolicyRequest request) + *

+ *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ *
    + *
  • getIamPolicyCallable() + *

+ *

TestIamPermissions

Returns permissions that a caller has on the specified resource. If theresource does not exist, this will return an empty set ofpermissions, not a `NOT_FOUND` error. + *

Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning.

+ *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ *
    + *
  • testIamPermissions(TestIamPermissionsRequest request) + *

+ *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ *
    + *
  • testIamPermissionsCallable() + *

+ *
* *

See the individual methods for example code. * @@ -92,29 +330,49 @@ * *

To customize credentials: * - *

- * 
+ * 
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
  * SchemaServiceSettings schemaServiceSettings =
  *     SchemaServiceSettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
  *         .build();
- * SchemaServiceClient schemaServiceClient =
- *     SchemaServiceClient.create(schemaServiceSettings);
- * 
- * 
+ * SchemaServiceClient schemaServiceClient = SchemaServiceClient.create(schemaServiceSettings); + * }
* - * To customize the endpoint: + *

To customize the endpoint: * - *

- * 
+ * 
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
  * SchemaServiceSettings schemaServiceSettings =
  *     SchemaServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
- * SchemaServiceClient schemaServiceClient =
- *     SchemaServiceClient.create(schemaServiceSettings);
- * 
- * 
+ * SchemaServiceClient schemaServiceClient = SchemaServiceClient.create(schemaServiceSettings); + * }
+ * + *

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over + * the wire: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * SchemaServiceSettings schemaServiceSettings =
+ *     SchemaServiceSettings.newHttpJsonBuilder().build();
+ * SchemaServiceClient schemaServiceClient = SchemaServiceClient.create(schemaServiceSettings);
+ * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ -@Generated("by gapic-generator") +@Generated("by gapic-generator-java") public class SchemaServiceClient implements BackgroundResource { private final SchemaServiceSettings settings; private final SchemaServiceStub stub; @@ -135,9 +393,8 @@ public static final SchemaServiceClient create(SchemaServiceSettings settings) /** * Constructs an instance of SchemaServiceClient, using the given stub for making calls. This is - * for advanced usage - prefer to use SchemaServiceSettings}. + * for advanced usage - prefer using create(SchemaServiceSettings). */ - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final SchemaServiceClient create(SchemaServiceStub stub) { return new SchemaServiceClient(stub); } @@ -152,7 +409,6 @@ protected SchemaServiceClient(SchemaServiceSettings settings) throws IOException this.stub = ((SchemaServiceStubSettings) settings.getStubSettings()).createStub(); } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected SchemaServiceClient(SchemaServiceStub stub) { this.settings = null; this.stub = stub; @@ -162,25 +418,29 @@ public final SchemaServiceSettings getSettings() { return settings; } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public SchemaServiceStub getStub() { return stub; } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a schema. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
    *   ProjectName parent = ProjectName.of("[PROJECT]");
    *   Schema schema = Schema.newBuilder().build();
-   *   String schemaId = "";
+   *   String schemaId = "schemaId-697673060";
    *   Schema response = schemaServiceClient.createSchema(parent, schema, schemaId);
    * }
-   * 
+ * }
* * @param parent Required. The name of the project in which to create the schema. Format is * `projects/{project-id}`. @@ -189,7 +449,7 @@ public SchemaServiceStub getStub() { * will have a `name` made using the given `parent` and `schema_id`. * @param schemaId The ID to use for the schema, which will become the final component of the * schema's resource name. - *

See https://cloud.google.com/pubsub/docs/admin#resource_names for resource name + *

See https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names for resource name * constraints. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -203,20 +463,25 @@ public final Schema createSchema(ProjectName parent, Schema schema, String schem return createSchema(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a schema. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
+   *   String parent = ProjectName.of("[PROJECT]").toString();
    *   Schema schema = Schema.newBuilder().build();
-   *   String schemaId = "";
-   *   Schema response = schemaServiceClient.createSchema(parent.toString(), schema, schemaId);
+   *   String schemaId = "schemaId-697673060";
+   *   Schema response = schemaServiceClient.createSchema(parent, schema, schemaId);
    * }
-   * 
+ * }
* * @param parent Required. The name of the project in which to create the schema. Format is * `projects/{project-id}`. @@ -225,7 +490,7 @@ public final Schema createSchema(ProjectName parent, Schema schema, String schem * will have a `name` made using the given `parent` and `schema_id`. * @param schemaId The ID to use for the schema, which will become the final component of the * schema's resource name. - *

See https://cloud.google.com/pubsub/docs/admin#resource_names for resource name + *

See https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names for resource name * constraints. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -239,23 +504,28 @@ public final Schema createSchema(String parent, Schema schema, String schemaId) return createSchema(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a schema. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   Schema schema = Schema.newBuilder().build();
-   *   CreateSchemaRequest request = CreateSchemaRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setSchema(schema)
-   *     .build();
+   *   CreateSchemaRequest request =
+   *       CreateSchemaRequest.newBuilder()
+   *           .setParent(ProjectName.of("[PROJECT]").toString())
+   *           .setSchema(Schema.newBuilder().build())
+   *           .setSchemaId("schemaId-697673060")
+   *           .build();
    *   Schema response = schemaServiceClient.createSchema(request);
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -264,42 +534,52 @@ public final Schema createSchema(CreateSchemaRequest request) { return createSchemaCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a schema. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   Schema schema = Schema.newBuilder().build();
-   *   CreateSchemaRequest request = CreateSchemaRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setSchema(schema)
-   *     .build();
-   *   ApiFuture<Schema> future = schemaServiceClient.createSchemaCallable().futureCall(request);
-   *   // Do something
+   *   CreateSchemaRequest request =
+   *       CreateSchemaRequest.newBuilder()
+   *           .setParent(ProjectName.of("[PROJECT]").toString())
+   *           .setSchema(Schema.newBuilder().build())
+   *           .setSchemaId("schemaId-697673060")
+   *           .build();
+   *   ApiFuture future = schemaServiceClient.createSchemaCallable().futureCall(request);
+   *   // Do something.
    *   Schema response = future.get();
    * }
-   * 
+ * }
*/ public final UnaryCallable createSchemaCallable() { return stub.createSchemaCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets a schema. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
    *   SchemaName name = SchemaName.of("[PROJECT]", "[SCHEMA]");
    *   Schema response = schemaServiceClient.getSchema(name);
    * }
-   * 
+ * }
* * @param name Required. The name of the schema to get. Format is * `projects/{project}/schemas/{schema}`. @@ -311,18 +591,23 @@ public final Schema getSchema(SchemaName name) { return getSchema(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets a schema. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
-   *   SchemaName name = SchemaName.of("[PROJECT]", "[SCHEMA]");
-   *   Schema response = schemaServiceClient.getSchema(name.toString());
+   *   String name = SchemaName.of("[PROJECT]", "[SCHEMA]").toString();
+   *   Schema response = schemaServiceClient.getSchema(name);
    * }
-   * 
+ * }
* * @param name Required. The name of the schema to get. Format is * `projects/{project}/schemas/{schema}`. @@ -333,21 +618,27 @@ public final Schema getSchema(String name) { return getSchema(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets a schema. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
-   *   SchemaName name = SchemaName.of("[PROJECT]", "[SCHEMA]");
-   *   GetSchemaRequest request = GetSchemaRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
+   *   GetSchemaRequest request =
+   *       GetSchemaRequest.newBuilder()
+   *           .setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
+   *           .setView(SchemaView.forNumber(0))
+   *           .build();
    *   Schema response = schemaServiceClient.getSchema(request);
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -356,42 +647,53 @@ public final Schema getSchema(GetSchemaRequest request) { return getSchemaCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets a schema. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
-   *   SchemaName name = SchemaName.of("[PROJECT]", "[SCHEMA]");
-   *   GetSchemaRequest request = GetSchemaRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Schema> future = schemaServiceClient.getSchemaCallable().futureCall(request);
-   *   // Do something
+   *   GetSchemaRequest request =
+   *       GetSchemaRequest.newBuilder()
+   *           .setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
+   *           .setView(SchemaView.forNumber(0))
+   *           .build();
+   *   ApiFuture future = schemaServiceClient.getSchemaCallable().futureCall(request);
+   *   // Do something.
    *   Schema response = future.get();
    * }
-   * 
+ * }
*/ public final UnaryCallable getSchemaCallable() { return stub.getSchemaCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists schemas in a project. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
    *   ProjectName parent = ProjectName.of("[PROJECT]");
    *   for (Schema element : schemaServiceClient.listSchemas(parent).iterateAll()) {
    *     // doThingsWith(element);
    *   }
    * }
-   * 
+ * }
* * @param parent Required. The name of the project in which to list schemas. Format is * `projects/{project-id}`. @@ -405,20 +707,25 @@ public final ListSchemasPagedResponse listSchemas(ProjectName parent) { return listSchemas(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists schemas in a project. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   for (Schema element : schemaServiceClient.listSchemas(parent.toString()).iterateAll()) {
+   *   String parent = ProjectName.of("[PROJECT]").toString();
+   *   for (Schema element : schemaServiceClient.listSchemas(parent).iterateAll()) {
    *     // doThingsWith(element);
    *   }
    * }
-   * 
+ * }
* * @param parent Required. The name of the project in which to list schemas. Format is * `projects/{project-id}`. @@ -429,23 +736,31 @@ public final ListSchemasPagedResponse listSchemas(String parent) { return listSchemas(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists schemas in a project. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   ListSchemasRequest request = ListSchemasRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
+   *   ListSchemasRequest request =
+   *       ListSchemasRequest.newBuilder()
+   *           .setParent(ProjectName.of("[PROJECT]").toString())
+   *           .setView(SchemaView.forNumber(0))
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
    *   for (Schema element : schemaServiceClient.listSchemas(request).iterateAll()) {
    *     // doThingsWith(element);
    *   }
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -454,43 +769,59 @@ public final ListSchemasPagedResponse listSchemas(ListSchemasRequest request) { return listSchemasPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists schemas in a project. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   ListSchemasRequest request = ListSchemasRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   ApiFuture<ListSchemasPagedResponse> future = schemaServiceClient.listSchemasPagedCallable().futureCall(request);
-   *   // Do something
+   *   ListSchemasRequest request =
+   *       ListSchemasRequest.newBuilder()
+   *           .setParent(ProjectName.of("[PROJECT]").toString())
+   *           .setView(SchemaView.forNumber(0))
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future = schemaServiceClient.listSchemasPagedCallable().futureCall(request);
+   *   // Do something.
    *   for (Schema element : future.get().iterateAll()) {
    *     // doThingsWith(element);
    *   }
    * }
-   * 
+ * }
*/ public final UnaryCallable listSchemasPagedCallable() { return stub.listSchemasPagedCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists schemas in a project. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   ListSchemasRequest request = ListSchemasRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
+   *   ListSchemasRequest request =
+   *       ListSchemasRequest.newBuilder()
+   *           .setParent(ProjectName.of("[PROJECT]").toString())
+   *           .setView(SchemaView.forNumber(0))
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
    *   while (true) {
    *     ListSchemasResponse response = schemaServiceClient.listSchemasCallable().call(request);
    *     for (Schema element : response.getSchemasList()) {
@@ -504,24 +835,565 @@ public final ListSchemasPagedResponse listSchemas(ListSchemasRequest request) {
    *     }
    *   }
    * }
-   * 
+ * }
*/ public final UnaryCallable listSchemasCallable() { return stub.listSchemasCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists all schema revisions for the named schema. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
+   *   SchemaName name = SchemaName.of("[PROJECT]", "[SCHEMA]");
+   *   for (Schema element : schemaServiceClient.listSchemaRevisions(name).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @param name Required. The name of the schema to list revisions for. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListSchemaRevisionsPagedResponse listSchemaRevisions(SchemaName name) { + ListSchemaRevisionsRequest request = + ListSchemaRevisionsRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); + return listSchemaRevisions(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists all schema revisions for the named schema. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
+   *   String name = SchemaName.of("[PROJECT]", "[SCHEMA]").toString();
+   *   for (Schema element : schemaServiceClient.listSchemaRevisions(name).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @param name Required. The name of the schema to list revisions for. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListSchemaRevisionsPagedResponse listSchemaRevisions(String name) { + ListSchemaRevisionsRequest request = + ListSchemaRevisionsRequest.newBuilder().setName(name).build(); + return listSchemaRevisions(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists all schema revisions for the named schema. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
+   *   ListSchemaRevisionsRequest request =
+   *       ListSchemaRevisionsRequest.newBuilder()
+   *           .setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
+   *           .setView(SchemaView.forNumber(0))
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   for (Schema element : schemaServiceClient.listSchemaRevisions(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListSchemaRevisionsPagedResponse listSchemaRevisions( + ListSchemaRevisionsRequest request) { + return listSchemaRevisionsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists all schema revisions for the named schema. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
+   *   ListSchemaRevisionsRequest request =
+   *       ListSchemaRevisionsRequest.newBuilder()
+   *           .setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
+   *           .setView(SchemaView.forNumber(0))
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future =
+   *       schemaServiceClient.listSchemaRevisionsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Schema element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listSchemaRevisionsPagedCallable() { + return stub.listSchemaRevisionsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists all schema revisions for the named schema. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
+   *   ListSchemaRevisionsRequest request =
+   *       ListSchemaRevisionsRequest.newBuilder()
+   *           .setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
+   *           .setView(SchemaView.forNumber(0))
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   while (true) {
+   *     ListSchemaRevisionsResponse response =
+   *         schemaServiceClient.listSchemaRevisionsCallable().call(request);
+   *     for (Schema element : response.getSchemasList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listSchemaRevisionsCallable() { + return stub.listSchemaRevisionsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Commits a new schema revision to an existing schema. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
+   *   SchemaName name = SchemaName.of("[PROJECT]", "[SCHEMA]");
+   *   Schema schema = Schema.newBuilder().build();
+   *   Schema response = schemaServiceClient.commitSchema(name, schema);
+   * }
+   * }
+ * + * @param name Required. The name of the schema we are revising. Format is + * `projects/{project}/schemas/{schema}`. + * @param schema Required. The schema revision to commit. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Schema commitSchema(SchemaName name, Schema schema) { + CommitSchemaRequest request = + CommitSchemaRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .setSchema(schema) + .build(); + return commitSchema(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Commits a new schema revision to an existing schema. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
+   *   String name = SchemaName.of("[PROJECT]", "[SCHEMA]").toString();
+   *   Schema schema = Schema.newBuilder().build();
+   *   Schema response = schemaServiceClient.commitSchema(name, schema);
+   * }
+   * }
+ * + * @param name Required. The name of the schema we are revising. Format is + * `projects/{project}/schemas/{schema}`. + * @param schema Required. The schema revision to commit. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Schema commitSchema(String name, Schema schema) { + CommitSchemaRequest request = + CommitSchemaRequest.newBuilder().setName(name).setSchema(schema).build(); + return commitSchema(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Commits a new schema revision to an existing schema. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
+   *   CommitSchemaRequest request =
+   *       CommitSchemaRequest.newBuilder()
+   *           .setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
+   *           .setSchema(Schema.newBuilder().build())
+   *           .build();
+   *   Schema response = schemaServiceClient.commitSchema(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Schema commitSchema(CommitSchemaRequest request) { + return commitSchemaCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Commits a new schema revision to an existing schema. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
+   *   CommitSchemaRequest request =
+   *       CommitSchemaRequest.newBuilder()
+   *           .setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
+   *           .setSchema(Schema.newBuilder().build())
+   *           .build();
+   *   ApiFuture future = schemaServiceClient.commitSchemaCallable().futureCall(request);
+   *   // Do something.
+   *   Schema response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable commitSchemaCallable() { + return stub.commitSchemaCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a new schema revision that is a copy of the provided revision_id. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
+   *   SchemaName name = SchemaName.of("[PROJECT]", "[SCHEMA]");
+   *   String revisionId = "revisionId-1507445162";
+   *   Schema response = schemaServiceClient.rollbackSchema(name, revisionId);
+   * }
+   * }
+ * + * @param name Required. The schema being rolled back with revision id. + * @param revisionId Required. The revision ID to roll back to. It must be a revision of the same + * schema. + *

Example: c7cfa2a8 + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Schema rollbackSchema(SchemaName name, String revisionId) { + RollbackSchemaRequest request = + RollbackSchemaRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .setRevisionId(revisionId) + .build(); + return rollbackSchema(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a new schema revision that is a copy of the provided revision_id. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
+   *   String name = SchemaName.of("[PROJECT]", "[SCHEMA]").toString();
+   *   String revisionId = "revisionId-1507445162";
+   *   Schema response = schemaServiceClient.rollbackSchema(name, revisionId);
+   * }
+   * }
+ * + * @param name Required. The schema being rolled back with revision id. + * @param revisionId Required. The revision ID to roll back to. It must be a revision of the same + * schema. + *

Example: c7cfa2a8 + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Schema rollbackSchema(String name, String revisionId) { + RollbackSchemaRequest request = + RollbackSchemaRequest.newBuilder().setName(name).setRevisionId(revisionId).build(); + return rollbackSchema(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a new schema revision that is a copy of the provided revision_id. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
+   *   RollbackSchemaRequest request =
+   *       RollbackSchemaRequest.newBuilder()
+   *           .setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
+   *           .setRevisionId("revisionId-1507445162")
+   *           .build();
+   *   Schema response = schemaServiceClient.rollbackSchema(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Schema rollbackSchema(RollbackSchemaRequest request) { + return rollbackSchemaCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a new schema revision that is a copy of the provided revision_id. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
+   *   RollbackSchemaRequest request =
+   *       RollbackSchemaRequest.newBuilder()
+   *           .setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
+   *           .setRevisionId("revisionId-1507445162")
+   *           .build();
+   *   ApiFuture future = schemaServiceClient.rollbackSchemaCallable().futureCall(request);
+   *   // Do something.
+   *   Schema response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable rollbackSchemaCallable() { + return stub.rollbackSchemaCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes a specific schema revision. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
+   *   SchemaName name = SchemaName.of("[PROJECT]", "[SCHEMA]");
+   *   String revisionId = "revisionId-1507445162";
+   *   Schema response = schemaServiceClient.deleteSchemaRevision(name, revisionId);
+   * }
+   * }
+ * + * @param name Required. The name of the schema revision to be deleted, with a revision ID + * explicitly included. + *

Example: `projects/123/schemas/my-schema{@literal @}c7cfa2a8` + * @param revisionId Optional. This field is deprecated and should not be used for specifying the + * revision ID. The revision ID should be specified via the `name` parameter. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Schema deleteSchemaRevision(SchemaName name, String revisionId) { + DeleteSchemaRevisionRequest request = + DeleteSchemaRevisionRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .setRevisionId(revisionId) + .build(); + return deleteSchemaRevision(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes a specific schema revision. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
+   *   String name = SchemaName.of("[PROJECT]", "[SCHEMA]").toString();
+   *   String revisionId = "revisionId-1507445162";
+   *   Schema response = schemaServiceClient.deleteSchemaRevision(name, revisionId);
+   * }
+   * }
+ * + * @param name Required. The name of the schema revision to be deleted, with a revision ID + * explicitly included. + *

Example: `projects/123/schemas/my-schema{@literal @}c7cfa2a8` + * @param revisionId Optional. This field is deprecated and should not be used for specifying the + * revision ID. The revision ID should be specified via the `name` parameter. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Schema deleteSchemaRevision(String name, String revisionId) { + DeleteSchemaRevisionRequest request = + DeleteSchemaRevisionRequest.newBuilder().setName(name).setRevisionId(revisionId).build(); + return deleteSchemaRevision(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes a specific schema revision. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
+   *   DeleteSchemaRevisionRequest request =
+   *       DeleteSchemaRevisionRequest.newBuilder()
+   *           .setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
+   *           .setRevisionId("revisionId-1507445162")
+   *           .build();
+   *   Schema response = schemaServiceClient.deleteSchemaRevision(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Schema deleteSchemaRevision(DeleteSchemaRevisionRequest request) { + return deleteSchemaRevisionCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes a specific schema revision. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
+   *   DeleteSchemaRevisionRequest request =
+   *       DeleteSchemaRevisionRequest.newBuilder()
+   *           .setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
+   *           .setRevisionId("revisionId-1507445162")
+   *           .build();
+   *   ApiFuture future =
+   *       schemaServiceClient.deleteSchemaRevisionCallable().futureCall(request);
+   *   // Do something.
+   *   Schema response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable deleteSchemaRevisionCallable() { + return stub.deleteSchemaRevisionCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a schema. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
    *   SchemaName name = SchemaName.of("[PROJECT]", "[SCHEMA]");
    *   schemaServiceClient.deleteSchema(name);
    * }
-   * 
+ * }
* * @param name Required. Name of the schema to delete. Format is * `projects/{project}/schemas/{schema}`. @@ -533,18 +1405,23 @@ public final void deleteSchema(SchemaName name) { deleteSchema(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a schema. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
-   *   SchemaName name = SchemaName.of("[PROJECT]", "[SCHEMA]");
-   *   schemaServiceClient.deleteSchema(name.toString());
+   *   String name = SchemaName.of("[PROJECT]", "[SCHEMA]").toString();
+   *   schemaServiceClient.deleteSchema(name);
    * }
-   * 
+ * }
* * @param name Required. Name of the schema to delete. Format is * `projects/{project}/schemas/{schema}`. @@ -555,21 +1432,26 @@ public final void deleteSchema(String name) { deleteSchema(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a schema. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
-   *   SchemaName name = SchemaName.of("[PROJECT]", "[SCHEMA]");
-   *   DeleteSchemaRequest request = DeleteSchemaRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
+   *   DeleteSchemaRequest request =
+   *       DeleteSchemaRequest.newBuilder()
+   *           .setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
+   *           .build();
    *   schemaServiceClient.deleteSchema(request);
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -578,41 +1460,51 @@ public final void deleteSchema(DeleteSchemaRequest request) { deleteSchemaCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a schema. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
-   *   SchemaName name = SchemaName.of("[PROJECT]", "[SCHEMA]");
-   *   DeleteSchemaRequest request = DeleteSchemaRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Void> future = schemaServiceClient.deleteSchemaCallable().futureCall(request);
-   *   // Do something
+   *   DeleteSchemaRequest request =
+   *       DeleteSchemaRequest.newBuilder()
+   *           .setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
+   *           .build();
+   *   ApiFuture future = schemaServiceClient.deleteSchemaCallable().futureCall(request);
+   *   // Do something.
    *   future.get();
    * }
-   * 
+ * }
*/ public final UnaryCallable deleteSchemaCallable() { return stub.deleteSchemaCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Validates a schema. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
    *   ProjectName parent = ProjectName.of("[PROJECT]");
    *   Schema schema = Schema.newBuilder().build();
    *   ValidateSchemaResponse response = schemaServiceClient.validateSchema(parent, schema);
    * }
-   * 
+ * }
* * @param parent Required. The name of the project in which to validate schemas. Format is * `projects/{project-id}`. @@ -628,19 +1520,24 @@ public final ValidateSchemaResponse validateSchema(ProjectName parent, Schema sc return validateSchema(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Validates a schema. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
+   *   String parent = ProjectName.of("[PROJECT]").toString();
    *   Schema schema = Schema.newBuilder().build();
-   *   ValidateSchemaResponse response = schemaServiceClient.validateSchema(parent.toString(), schema);
+   *   ValidateSchemaResponse response = schemaServiceClient.validateSchema(parent, schema);
    * }
-   * 
+ * }
* * @param parent Required. The name of the project in which to validate schemas. Format is * `projects/{project-id}`. @@ -653,23 +1550,27 @@ public final ValidateSchemaResponse validateSchema(String parent, Schema schema) return validateSchema(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Validates a schema. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   Schema schema = Schema.newBuilder().build();
-   *   ValidateSchemaRequest request = ValidateSchemaRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setSchema(schema)
-   *     .build();
+   *   ValidateSchemaRequest request =
+   *       ValidateSchemaRequest.newBuilder()
+   *           .setParent(ProjectName.of("[PROJECT]").toString())
+   *           .setSchema(Schema.newBuilder().build())
+   *           .build();
    *   ValidateSchemaResponse response = schemaServiceClient.validateSchema(request);
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -678,46 +1579,58 @@ public final ValidateSchemaResponse validateSchema(ValidateSchemaRequest request return validateSchemaCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Validates a schema. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   Schema schema = Schema.newBuilder().build();
-   *   ValidateSchemaRequest request = ValidateSchemaRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setSchema(schema)
-   *     .build();
-   *   ApiFuture<ValidateSchemaResponse> future = schemaServiceClient.validateSchemaCallable().futureCall(request);
-   *   // Do something
+   *   ValidateSchemaRequest request =
+   *       ValidateSchemaRequest.newBuilder()
+   *           .setParent(ProjectName.of("[PROJECT]").toString())
+   *           .setSchema(Schema.newBuilder().build())
+   *           .build();
+   *   ApiFuture future =
+   *       schemaServiceClient.validateSchemaCallable().futureCall(request);
+   *   // Do something.
    *   ValidateSchemaResponse response = future.get();
    * }
-   * 
+ * }
*/ public final UnaryCallable validateSchemaCallable() { return stub.validateSchemaCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Validates a message against a schema. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   ValidateMessageRequest request = ValidateMessageRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
+   *   ValidateMessageRequest request =
+   *       ValidateMessageRequest.newBuilder()
+   *           .setParent(ProjectName.of("[PROJECT]").toString())
+   *           .setMessage(ByteString.EMPTY)
+   *           .setEncoding(Encoding.forNumber(0))
+   *           .build();
    *   ValidateMessageResponse response = schemaServiceClient.validateMessage(request);
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -726,29 +1639,228 @@ public final ValidateMessageResponse validateMessage(ValidateMessageRequest requ return validateMessageCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Validates a message against a schema. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   ValidateMessageRequest request = ValidateMessageRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   ApiFuture<ValidateMessageResponse> future = schemaServiceClient.validateMessageCallable().futureCall(request);
-   *   // Do something
+   *   ValidateMessageRequest request =
+   *       ValidateMessageRequest.newBuilder()
+   *           .setParent(ProjectName.of("[PROJECT]").toString())
+   *           .setMessage(ByteString.EMPTY)
+   *           .setEncoding(Encoding.forNumber(0))
+   *           .build();
+   *   ApiFuture future =
+   *       schemaServiceClient.validateMessageCallable().futureCall(request);
+   *   // Do something.
    *   ValidateMessageResponse response = future.get();
    * }
-   * 
+ * }
*/ public final UnaryCallable validateMessageCallable() { return stub.validateMessageCallable(); } + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Sets the access control policy on the specified resource. Replacesany existing policy. + * + *

Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
+   *   SetIamPolicyRequest request =
+   *       SetIamPolicyRequest.newBuilder()
+   *           .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
+   *           .setPolicy(Policy.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   Policy response = schemaServiceClient.setIamPolicy(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Policy setIamPolicy(SetIamPolicyRequest request) { + return setIamPolicyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Sets the access control policy on the specified resource. Replacesany existing policy. + * + *

Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
+   *   SetIamPolicyRequest request =
+   *       SetIamPolicyRequest.newBuilder()
+   *           .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
+   *           .setPolicy(Policy.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   ApiFuture future = schemaServiceClient.setIamPolicyCallable().futureCall(request);
+   *   // Do something.
+   *   Policy response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable setIamPolicyCallable() { + return stub.setIamPolicyCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets the access control policy for a resource. Returns an empty policyif the resource exists + * and does not have a policy set. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
+   *   GetIamPolicyRequest request =
+   *       GetIamPolicyRequest.newBuilder()
+   *           .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
+   *           .setOptions(GetPolicyOptions.newBuilder().build())
+   *           .build();
+   *   Policy response = schemaServiceClient.getIamPolicy(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Policy getIamPolicy(GetIamPolicyRequest request) { + return getIamPolicyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets the access control policy for a resource. Returns an empty policyif the resource exists + * and does not have a policy set. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
+   *   GetIamPolicyRequest request =
+   *       GetIamPolicyRequest.newBuilder()
+   *           .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
+   *           .setOptions(GetPolicyOptions.newBuilder().build())
+   *           .build();
+   *   ApiFuture future = schemaServiceClient.getIamPolicyCallable().futureCall(request);
+   *   // Do something.
+   *   Policy response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getIamPolicyCallable() { + return stub.getIamPolicyCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns permissions that a caller has on the specified resource. If theresource does not exist, + * this will return an empty set ofpermissions, not a `NOT_FOUND` error. + * + *

Note: This operation is designed to be used for buildingpermission-aware UIs and + * command-line tools, not for authorizationchecking. This operation may "fail open" without + * warning. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
+   *   TestIamPermissionsRequest request =
+   *       TestIamPermissionsRequest.newBuilder()
+   *           .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
+   *           .addAllPermissions(new ArrayList())
+   *           .build();
+   *   TestIamPermissionsResponse response = schemaServiceClient.testIamPermissions(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsRequest request) { + return testIamPermissionsCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns permissions that a caller has on the specified resource. If theresource does not exist, + * this will return an empty set ofpermissions, not a `NOT_FOUND` error. + * + *

Note: This operation is designed to be used for buildingpermission-aware UIs and + * command-line tools, not for authorizationchecking. This operation may "fail open" without + * warning. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
+   *   TestIamPermissionsRequest request =
+   *       TestIamPermissionsRequest.newBuilder()
+   *           .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
+   *           .addAllPermissions(new ArrayList())
+   *           .build();
+   *   ApiFuture future =
+   *       schemaServiceClient.testIamPermissionsCallable().futureCall(request);
+   *   // Do something.
+   *   TestIamPermissionsResponse response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable + testIamPermissionsCallable() { + return stub.testIamPermissionsCallable(); + } + @Override public final void close() { stub.close(); @@ -793,14 +1905,7 @@ public static ApiFuture createAsync( ApiFuture futurePage = ListSchemasPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( - futurePage, - new ApiFunction() { - @Override - public ListSchemasPagedResponse apply(ListSchemasPage input) { - return new ListSchemasPagedResponse(input); - } - }, - MoreExecutors.directExecutor()); + futurePage, input -> new ListSchemasPagedResponse(input), MoreExecutors.directExecutor()); } private ListSchemasPagedResponse(ListSchemasPage page) { @@ -858,4 +1963,84 @@ protected ListSchemasFixedSizeCollection createCollection( return new ListSchemasFixedSizeCollection(pages, collectionSize); } } + + public static class ListSchemaRevisionsPagedResponse + extends AbstractPagedListResponse< + ListSchemaRevisionsRequest, + ListSchemaRevisionsResponse, + Schema, + ListSchemaRevisionsPage, + ListSchemaRevisionsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListSchemaRevisionsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + input -> new ListSchemaRevisionsPagedResponse(input), + MoreExecutors.directExecutor()); + } + + private ListSchemaRevisionsPagedResponse(ListSchemaRevisionsPage page) { + super(page, ListSchemaRevisionsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListSchemaRevisionsPage + extends AbstractPage< + ListSchemaRevisionsRequest, + ListSchemaRevisionsResponse, + Schema, + ListSchemaRevisionsPage> { + + private ListSchemaRevisionsPage( + PageContext context, + ListSchemaRevisionsResponse response) { + super(context, response); + } + + private static ListSchemaRevisionsPage createEmptyPage() { + return new ListSchemaRevisionsPage(null, null); + } + + @Override + protected ListSchemaRevisionsPage createPage( + PageContext context, + ListSchemaRevisionsResponse response) { + return new ListSchemaRevisionsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListSchemaRevisionsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListSchemaRevisionsRequest, + ListSchemaRevisionsResponse, + Schema, + ListSchemaRevisionsPage, + ListSchemaRevisionsFixedSizeCollection> { + + private ListSchemaRevisionsFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListSchemaRevisionsFixedSizeCollection createEmptyCollection() { + return new ListSchemaRevisionsFixedSizeCollection(null, 0); + } + + @Override + protected ListSchemaRevisionsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListSchemaRevisionsFixedSizeCollection(pages, collectionSize); + } + } } diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/SchemaServiceSettings.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/SchemaServiceSettings.java index 4d2590c18..44585d85c 100644 --- a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/SchemaServiceSettings.java +++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/SchemaServiceSettings.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 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 + * 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, @@ -13,8 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.pubsub.v1; +import static com.google.cloud.pubsub.v1.SchemaServiceClient.ListSchemaRevisionsPagedResponse; import static com.google.cloud.pubsub.v1.SchemaServiceClient.ListSchemasPagedResponse; import com.google.api.core.ApiFunction; @@ -22,6 +24,7 @@ import com.google.api.gax.core.GoogleCredentialsProvider; import com.google.api.gax.core.InstantiatingExecutorProvider; import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.ClientContext; import com.google.api.gax.rpc.ClientSettings; @@ -29,12 +32,22 @@ import com.google.api.gax.rpc.TransportChannelProvider; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.cloud.pubsub.v1.stub.SchemaServiceStubSettings; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; import com.google.protobuf.Empty; +import com.google.pubsub.v1.CommitSchemaRequest; import com.google.pubsub.v1.CreateSchemaRequest; import com.google.pubsub.v1.DeleteSchemaRequest; +import com.google.pubsub.v1.DeleteSchemaRevisionRequest; import com.google.pubsub.v1.GetSchemaRequest; +import com.google.pubsub.v1.ListSchemaRevisionsRequest; +import com.google.pubsub.v1.ListSchemaRevisionsResponse; import com.google.pubsub.v1.ListSchemasRequest; import com.google.pubsub.v1.ListSchemasResponse; +import com.google.pubsub.v1.RollbackSchemaRequest; import com.google.pubsub.v1.Schema; import com.google.pubsub.v1.ValidateMessageRequest; import com.google.pubsub.v1.ValidateMessageResponse; @@ -44,7 +57,7 @@ import java.util.List; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link SchemaServiceClient}. * @@ -59,24 +72,43 @@ *

The builder of this class is recursive, so contained classes are themselves builders. When * build() is called, the tree of builders is called to create the complete settings object. * - *

For example, to set the total timeout of createSchema to 30 seconds: + *

For example, to set the + * [RetrySettings](https://cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.retrying.RetrySettings) + * of createSchema: * - *

- * 
- * SchemaServiceSettings.Builder schemaServiceSettingsBuilder =
- *     SchemaServiceSettings.newBuilder();
+ * 
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * SchemaServiceSettings.Builder schemaServiceSettingsBuilder = SchemaServiceSettings.newBuilder();
  * schemaServiceSettingsBuilder
  *     .createSchemaSettings()
  *     .setRetrySettings(
- *         schemaServiceSettingsBuilder.createSchemaSettings().getRetrySettings().toBuilder()
- *             .setTotalTimeout(Duration.ofSeconds(30))
+ *         schemaServiceSettingsBuilder
+ *             .createSchemaSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
+ *             .setInitialRetryDelayDuration(Duration.ofSeconds(1))
+ *             .setInitialRpcTimeoutDuration(Duration.ofSeconds(5))
+ *             .setMaxAttempts(5)
+ *             .setMaxRetryDelayDuration(Duration.ofSeconds(30))
+ *             .setMaxRpcTimeoutDuration(Duration.ofSeconds(60))
+ *             .setRetryDelayMultiplier(1.3)
+ *             .setRpcTimeoutMultiplier(1.5)
+ *             .setTotalTimeoutDuration(Duration.ofSeconds(300))
  *             .build());
  * SchemaServiceSettings schemaServiceSettings = schemaServiceSettingsBuilder.build();
- * 
- * 
+ * }
+ * + * Please refer to the [Client Side Retry + * Guide](https://docs.cloud.google.com/java/docs/client-retries) for additional support in setting + * retries. */ -@Generated("by gapic-generator") +@Generated("by gapic-generator-java") public class SchemaServiceSettings extends ClientSettings { + /** Returns the object with the settings used for calls to createSchema. */ public UnaryCallSettings createSchemaSettings() { return ((SchemaServiceStubSettings) getStubSettings()).createSchemaSettings(); @@ -93,6 +125,28 @@ public UnaryCallSettings getSchemaSettings() { return ((SchemaServiceStubSettings) getStubSettings()).listSchemasSettings(); } + /** Returns the object with the settings used for calls to listSchemaRevisions. */ + public PagedCallSettings< + ListSchemaRevisionsRequest, ListSchemaRevisionsResponse, ListSchemaRevisionsPagedResponse> + listSchemaRevisionsSettings() { + return ((SchemaServiceStubSettings) getStubSettings()).listSchemaRevisionsSettings(); + } + + /** Returns the object with the settings used for calls to commitSchema. */ + public UnaryCallSettings commitSchemaSettings() { + return ((SchemaServiceStubSettings) getStubSettings()).commitSchemaSettings(); + } + + /** Returns the object with the settings used for calls to rollbackSchema. */ + public UnaryCallSettings rollbackSchemaSettings() { + return ((SchemaServiceStubSettings) getStubSettings()).rollbackSchemaSettings(); + } + + /** Returns the object with the settings used for calls to deleteSchemaRevision. */ + public UnaryCallSettings deleteSchemaRevisionSettings() { + return ((SchemaServiceStubSettings) getStubSettings()).deleteSchemaRevisionSettings(); + } + /** Returns the object with the settings used for calls to deleteSchema. */ public UnaryCallSettings deleteSchemaSettings() { return ((SchemaServiceStubSettings) getStubSettings()).deleteSchemaSettings(); @@ -109,6 +163,22 @@ public UnaryCallSettings validate return ((SchemaServiceStubSettings) getStubSettings()).validateMessageSettings(); } + /** Returns the object with the settings used for calls to setIamPolicy. */ + public UnaryCallSettings setIamPolicySettings() { + return ((SchemaServiceStubSettings) getStubSettings()).setIamPolicySettings(); + } + + /** Returns the object with the settings used for calls to getIamPolicy. */ + public UnaryCallSettings getIamPolicySettings() { + return ((SchemaServiceStubSettings) getStubSettings()).getIamPolicySettings(); + } + + /** Returns the object with the settings used for calls to testIamPermissions. */ + public UnaryCallSettings + testIamPermissionsSettings() { + return ((SchemaServiceStubSettings) getStubSettings()).testIamPermissionsSettings(); + } + public static final SchemaServiceSettings create(SchemaServiceStubSettings stub) throws IOException { return new SchemaServiceSettings.Builder(stub.toBuilder()).build(); @@ -134,25 +204,36 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde return SchemaServiceStubSettings.defaultCredentialsProviderBuilder(); } - /** Returns a builder for the default ChannelProvider for this service. */ + /** Returns a builder for the default gRPC ChannelProvider for this service. */ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { return SchemaServiceStubSettings.defaultGrpcTransportProviderBuilder(); } + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return SchemaServiceStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + public static TransportChannelProvider defaultTransportChannelProvider() { return SchemaServiceStubSettings.defaultTransportChannelProvider(); } - @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { return SchemaServiceStubSettings.defaultApiClientHeaderProviderBuilder(); } - /** Returns a new builder for this class. */ + /** Returns a new gRPC builder for this class. */ public static Builder newBuilder() { return Builder.createDefault(); } + /** Returns a new REST builder for this class. */ + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + /** Returns a new builder for this class. */ public static Builder newBuilder(ClientContext clientContext) { return new Builder(clientContext); @@ -169,18 +250,15 @@ protected SchemaServiceSettings(Builder settingsBuilder) throws IOException { /** Builder for SchemaServiceSettings. */ public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { - this((ClientContext) null); + this(((ClientContext) null)); } protected Builder(ClientContext clientContext) { super(SchemaServiceStubSettings.newBuilder(clientContext)); } - private static Builder createDefault() { - return new Builder(SchemaServiceStubSettings.newBuilder()); - } - protected Builder(SchemaServiceSettings settings) { super(settings.getStubSettings().toBuilder()); } @@ -189,18 +267,25 @@ protected Builder(SchemaServiceStubSettings.Builder stubSettings) { super(stubSettings); } + private static Builder createDefault() { + return new Builder(SchemaServiceStubSettings.newBuilder()); + } + + private static Builder createHttpJsonDefault() { + return new Builder(SchemaServiceStubSettings.newHttpJsonBuilder()); + } + public SchemaServiceStubSettings.Builder getStubSettingsBuilder() { return ((SchemaServiceStubSettings.Builder) getStubSettings()); } - // NEXT_MAJOR_VER: remove 'throws Exception' /** * Applies the given settings updater function to all of the unary API methods in this service. * *

Note: This method does not support applying settings to streaming methods. */ public Builder applyToAllUnaryMethods( - ApiFunction, Void> settingsUpdater) throws Exception { + ApiFunction, Void> settingsUpdater) { super.applyToAllUnaryMethods( getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); return this; @@ -223,6 +308,31 @@ public UnaryCallSettings.Builder getSchemaSettings() { return getStubSettingsBuilder().listSchemasSettings(); } + /** Returns the builder for the settings used for calls to listSchemaRevisions. */ + public PagedCallSettings.Builder< + ListSchemaRevisionsRequest, + ListSchemaRevisionsResponse, + ListSchemaRevisionsPagedResponse> + listSchemaRevisionsSettings() { + return getStubSettingsBuilder().listSchemaRevisionsSettings(); + } + + /** Returns the builder for the settings used for calls to commitSchema. */ + public UnaryCallSettings.Builder commitSchemaSettings() { + return getStubSettingsBuilder().commitSchemaSettings(); + } + + /** Returns the builder for the settings used for calls to rollbackSchema. */ + public UnaryCallSettings.Builder rollbackSchemaSettings() { + return getStubSettingsBuilder().rollbackSchemaSettings(); + } + + /** Returns the builder for the settings used for calls to deleteSchemaRevision. */ + public UnaryCallSettings.Builder + deleteSchemaRevisionSettings() { + return getStubSettingsBuilder().deleteSchemaRevisionSettings(); + } + /** Returns the builder for the settings used for calls to deleteSchema. */ public UnaryCallSettings.Builder deleteSchemaSettings() { return getStubSettingsBuilder().deleteSchemaSettings(); @@ -240,6 +350,22 @@ public UnaryCallSettings.Builder deleteSchemaSetting return getStubSettingsBuilder().validateMessageSettings(); } + /** Returns the builder for the settings used for calls to setIamPolicy. */ + public UnaryCallSettings.Builder setIamPolicySettings() { + return getStubSettingsBuilder().setIamPolicySettings(); + } + + /** Returns the builder for the settings used for calls to getIamPolicy. */ + public UnaryCallSettings.Builder getIamPolicySettings() { + return getStubSettingsBuilder().getIamPolicySettings(); + } + + /** Returns the builder for the settings used for calls to testIamPermissions. */ + public UnaryCallSettings.Builder + testIamPermissionsSettings() { + return getStubSettingsBuilder().testIamPermissionsSettings(); + } + @Override public SchemaServiceSettings build() throws IOException { return new SchemaServiceSettings(this); diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/StatusUtil.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/StatusUtil.java index a7b8e1faa..56c19306d 100644 --- a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/StatusUtil.java +++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/StatusUtil.java @@ -25,6 +25,26 @@ private StatusUtil() { // Static class, not instantiable. } + static AckResponse getFailedAckResponse(Throwable t) { + if (!(t instanceof ApiException)) { + return AckResponse.OTHER; + } + + ApiException apiException = (ApiException) t; + AckResponse failedAckResponse; + switch (apiException.getStatusCode().getCode()) { + case FAILED_PRECONDITION: + failedAckResponse = AckResponse.FAILED_PRECONDITION; + break; + case PERMISSION_DENIED: + failedAckResponse = AckResponse.PERMISSION_DENIED; + break; + default: + failedAckResponse = AckResponse.OTHER; + } + return failedAckResponse; + } + static boolean isRetryable(Throwable error) { if (!(error instanceof ApiException)) { return true; 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 249d896b7..24c580b6c 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 @@ -16,7 +16,6 @@ package com.google.cloud.pubsub.v1; -import static com.google.cloud.pubsub.v1.Subscriber.DEFAULT_MAX_DURATION_PER_ACK_EXTENSION; import static com.google.common.util.concurrent.MoreExecutors.directExecutor; import com.google.api.core.AbstractApiService; @@ -24,7 +23,6 @@ import com.google.api.core.ApiFuture; import com.google.api.core.ApiFutureCallback; import com.google.api.core.ApiFutures; -import com.google.api.core.InternalApi; import com.google.api.core.SettableApiFuture; import com.google.api.gax.batching.FlowControlSettings; import com.google.api.gax.batching.FlowController; @@ -37,50 +35,81 @@ import com.google.api.gax.rpc.ResponseObserver; import com.google.api.gax.rpc.StreamController; import com.google.cloud.pubsub.v1.MessageDispatcher.AckProcessor; -import com.google.cloud.pubsub.v1.MessageDispatcher.PendingModifyAckDeadline; import com.google.cloud.pubsub.v1.stub.SubscriberStub; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; import com.google.common.util.concurrent.MoreExecutors; +import com.google.protobuf.Any; import com.google.protobuf.Empty; +import com.google.protobuf.InvalidProtocolBufferException; import com.google.pubsub.v1.AcknowledgeRequest; import com.google.pubsub.v1.ModifyAckDeadlineRequest; import com.google.pubsub.v1.StreamingPullRequest; import com.google.pubsub.v1.StreamingPullResponse; +import com.google.pubsub.v1.SubscriptionName; +import com.google.rpc.ErrorInfo; import io.grpc.Status; +import io.grpc.protobuf.StatusProto; +import io.opentelemetry.api.trace.Span; +import java.time.Duration; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; import java.util.List; +import java.util.Map; +import java.util.Set; import java.util.UUID; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.Executor; import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; import java.util.logging.Level; import java.util.logging.Logger; import javax.annotation.Nullable; -import org.threeten.bp.Duration; /** Implementation of {@link AckProcessor} based on Cloud Pub/Sub streaming pull. */ final class StreamingSubscriberConnection extends AbstractApiService implements AckProcessor { private static final Logger logger = Logger.getLogger(StreamingSubscriberConnection.class.getName()); + private LoggingUtil loggingUtil = new LoggingUtil(); - @InternalApi static final Duration DEFAULT_STREAM_ACK_DEADLINE = Duration.ofSeconds(60); - @InternalApi static final Duration MAX_STREAM_ACK_DEADLINE = Duration.ofSeconds(600); - @InternalApi static final Duration MIN_STREAM_ACK_DEADLINE = Duration.ofSeconds(10); private static final Duration INITIAL_CHANNEL_RECONNECT_BACKOFF = Duration.ofMillis(100); private static final Duration MAX_CHANNEL_RECONNECT_BACKOFF = Duration.ofSeconds(10); + + private static final long INITIAL_ACK_OPERATIONS_RECONNECT_BACKOFF_MILLIS = 100; + private static final long MAX_ACK_OPERATIONS_RECONNECT_BACKOFF_MILLIS = + Duration.ofSeconds(10).toMillis(); private static final int MAX_PER_REQUEST_CHANGES = 1000; - private final Duration streamAckDeadline; - private final SubscriberStub stub; + private final String PERMANENT_FAILURE_INVALID_ACK_ID_METADATA = + "PERMANENT_FAILURE_INVALID_ACK_ID"; + private final String TRANSIENT_FAILURE_METADATA_PREFIX = "TRANSIENT_"; + + private Duration inititalStreamAckDeadline; + + private final Map> streamMetadata; + + private final SubscriberStub subscriberStub; private final int channelAffinity; + private final long protocolVersion; private final String subscription; + private final SubscriptionName subscriptionNameObject; private final ScheduledExecutorService systemExecutor; + private final ApiClock clock; private final MessageDispatcher messageDispatcher; private final FlowControlSettings flowControlSettings; private final boolean useLegacyFlowControl; + // Keeps track of requests without closed futures + private final Set pendingRequests = ConcurrentHashMap.newKeySet(); + private final AtomicLong channelReconnectBackoffMillis = new AtomicLong(INITIAL_CHANNEL_RECONNECT_BACKOFF.toMillis()); private final Waiter ackOperationsWaiter = new Waiter(); @@ -88,6 +117,8 @@ final class StreamingSubscriberConnection extends AbstractApiService implements private final Lock lock = new ReentrantLock(); private ClientStream clientStream; + private AtomicBoolean exactlyOnceDeliveryEnabled = new AtomicBoolean(false); + /** * The same clientId is used across all streaming pull connections that are created. This is * intentional, as it indicates to the server that any guarantees made for a stream that @@ -95,53 +126,105 @@ final class StreamingSubscriberConnection extends AbstractApiService implements */ private final String clientId = UUID.randomUUID().toString(); - public StreamingSubscriberConnection( - String subscription, - MessageReceiver receiver, - Duration ackExpirationPadding, - Duration maxAckExtensionPeriod, - Duration maxDurationPerAckExtension, - Distribution ackLatencyDistribution, - SubscriberStub stub, - int channelAffinity, - FlowControlSettings flowControlSettings, - boolean useLegacyFlowControl, - FlowController flowController, - ScheduledExecutorService executor, - ScheduledExecutorService systemExecutor, - ApiClock clock) { - this.subscription = subscription; - this.systemExecutor = systemExecutor; - if (maxDurationPerAckExtension.compareTo(DEFAULT_MAX_DURATION_PER_ACK_EXTENSION) == 0) { - this.streamAckDeadline = DEFAULT_STREAM_ACK_DEADLINE; - } else if (maxDurationPerAckExtension.compareTo(MIN_STREAM_ACK_DEADLINE) < 0) { - this.streamAckDeadline = MIN_STREAM_ACK_DEADLINE; - } else if (maxDurationPerAckExtension.compareTo(MAX_STREAM_ACK_DEADLINE) > 0) { - this.streamAckDeadline = MAX_STREAM_ACK_DEADLINE; + private final boolean enableOpenTelemetryTracing; + private OpenTelemetryPubsubTracer tracer = new OpenTelemetryPubsubTracer(null, false); + private final SubscriberShutdownSettings subscriberShutdownSettings; + + private final boolean enableKeepalive; + private static final long KEEP_ALIVE_SUPPORT_VERSION = 1; + private static final Duration CLIENT_PING_INTERVAL = Duration.ofSeconds(30); + private ScheduledFuture pingSchedulerHandle; + + private static final Duration SERVER_MONITOR_INTERVAL = Duration.ofSeconds(10); + private static final Duration SERVER_PING_TIMEOUT_DURATION = Duration.ofSeconds(15); + private final AtomicLong lastServerResponseTime; + private final AtomicLong lastClientPingTime; + private ScheduledFuture serverMonitorHandle; + + 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 + if (builder.maxDurationPerAckExtensionDefaultUsed) { + inititalStreamAckDeadline = Subscriber.STREAM_ACK_DEADLINE_DEFAULT; + } else if (builder.maxDurationPerAckExtension.compareTo(Subscriber.MIN_STREAM_ACK_DEADLINE) + < 0) { + // We will not be able to extend more than the default minimum + inititalStreamAckDeadline = Subscriber.MIN_STREAM_ACK_DEADLINE; + } else if (builder.maxDurationPerAckExtension.compareTo(Subscriber.MAX_STREAM_ACK_DEADLINE) + > 0) { + // Will not be able to extend past the max + inititalStreamAckDeadline = Subscriber.MAX_STREAM_ACK_DEADLINE; + } else { + inititalStreamAckDeadline = builder.maxDurationPerAckExtension; + } + + streamMetadata = + ImmutableMap.of("x-goog-request-params", ImmutableList.of("subscription=" + subscription)); + + subscriberStub = builder.subscriberStub; + channelAffinity = builder.channelAffinity; + protocolVersion = builder.protocolVersion; + + MessageDispatcher.Builder messageDispatcherBuilder; + if (builder.receiver != null) { + messageDispatcherBuilder = MessageDispatcher.newBuilder(builder.receiver); } else { - this.streamAckDeadline = maxDurationPerAckExtension; - } - this.stub = stub; - this.channelAffinity = channelAffinity; - this.messageDispatcher = - new MessageDispatcher( - receiver, - this, - ackExpirationPadding, - maxAckExtensionPeriod, - maxDurationPerAckExtension, - ackLatencyDistribution, - flowController, - executor, - systemExecutor, - clock); - this.flowControlSettings = flowControlSettings; - this.useLegacyFlowControl = useLegacyFlowControl; + messageDispatcherBuilder = MessageDispatcher.newBuilder(builder.receiverWithAckResponse); + } + + enableOpenTelemetryTracing = builder.enableOpenTelemetryTracing; + if (builder.tracer != null) { + tracer = builder.tracer; + } + this.subscriberShutdownSettings = builder.subscriberShutdownSettings; + + messageDispatcher = + messageDispatcherBuilder + .setAckProcessor(this) + .setAckExpirationPadding(builder.ackExpirationPadding) + .setMaxAckExtensionPeriod(builder.maxAckExtensionPeriod) + .setMinDurationPerAckExtension(builder.minDurationPerAckExtension) + .setMinDurationPerAckExtensionDefaultUsed(builder.minDurationPerAckExtensionDefaultUsed) + .setMaxDurationPerAckExtension(builder.maxDurationPerAckExtension) + .setMaxDurationPerAckExtensionDefaultUsed(builder.maxDurationPerAckExtensionDefaultUsed) + .setAckLatencyDistribution(builder.ackLatencyDistribution) + .setFlowController(builder.flowController) + .setExecutor(builder.executor) + .setSystemExecutor(builder.systemExecutor) + .setApiClock(builder.clock) + .setSubscriptionName(subscription) + .setEnableOpenTelemetryTracing(enableOpenTelemetryTracing) + .setTracer(tracer) + .setSubscriberShutdownSettings(subscriberShutdownSettings) + .build(); + + flowControlSettings = builder.flowControlSettings; + useLegacyFlowControl = builder.useLegacyFlowControl; + enableKeepalive = protocolVersion >= KEEP_ALIVE_SUPPORT_VERSION; + lastServerResponseTime = new AtomicLong(clock.nanoTime()); + lastClientPingTime = new AtomicLong(-1L); + } + + public StreamingSubscriberConnection setExactlyOnceDeliveryEnabled( + boolean isExactlyOnceDeliveryEnabled) { + exactlyOnceDeliveryEnabled.set(isExactlyOnceDeliveryEnabled); + return this; + } + + public boolean getExactlyOnceDeliveryEnabled() { + return exactlyOnceDeliveryEnabled.get(); } @Override protected void doStart() { logger.config("Starting subscriber."); + loggingUtil.logEvent( + LoggingUtil.SubSystem.SUBSCRIBER_STREAMS, Level.FINE, "Opening stream.", ""); messageDispatcher.start(); initialize(); notifyStarted(); @@ -149,20 +232,40 @@ protected void doStart() { @Override protected void doStop() { - runShutdown(); - + loggingUtil.logEvent( + LoggingUtil.SubSystem.SUBSCRIBER_STREAMS, Level.FINE, "Closing stream.", ""); lock.lock(); try { clientStream.closeSendWithError(Status.CANCELLED.asException()); } finally { lock.unlock(); - notifyStopped(); } + + if (enableKeepalive) { + stopClientPinger(); + stopServerMonitor(); + } + + runShutdown(); + notifyStopped(); } 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 { @@ -191,8 +294,22 @@ public void onStart(StreamController controller) { @Override public void onResponse(StreamingPullResponse response) { + if (enableKeepalive) { + lastServerResponseTime.set(clock.nanoTime()); + } + channelReconnectBackoffMillis.set(INITIAL_CHANNEL_RECONNECT_BACKOFF.toMillis()); + + boolean exactlyOnceDeliveryEnabledResponse = + response.getSubscriptionProperties().getExactlyOnceDeliveryEnabled(); + boolean messageOrderingEnabledResponse = + response.getSubscriptionProperties().getMessageOrderingEnabled(); + + setExactlyOnceDeliveryEnabled(exactlyOnceDeliveryEnabledResponse); + messageDispatcher.setExactlyOnceDeliveryEnabled(exactlyOnceDeliveryEnabledResponse); + messageDispatcher.setMessageOrderingEnabled(messageOrderingEnabledResponse); messageDispatcher.processReceivedMessages(response.getReceivedMessagesList()); + // Only request more if we're not shutdown. // If errorFuture is done, the stream has either failed or hung up, // and we don't need to request. @@ -210,11 +327,19 @@ public void onResponse(StreamingPullResponse response) { @Override public void onError(Throwable t) { + if (enableKeepalive) { + stopClientPinger(); + stopServerMonitor(); + } errorFuture.setException(t); } @Override public void onComplete() { + if (enableKeepalive) { + stopClientPinger(); + stopServerMonitor(); + } logger.fine("Streaming pull terminated successfully!"); errorFuture.set(null); } @@ -222,13 +347,18 @@ public void onComplete() { private void initialize() { final SettableApiFuture errorFuture = SettableApiFuture.create(); + final ResponseObserver responseObserver = new StreamingPullResponseObserver(errorFuture); + ClientStream initClientStream = - stub.streamingPullCallable() + subscriberStub + .streamingPullCallable() .splitCall( responseObserver, - GrpcCallContext.createDefault().withChannelAffinity(channelAffinity)); + GrpcCallContext.createDefault() + .withChannelAffinity(channelAffinity) + .withExtraHeaders(streamMetadata)); logger.log(Level.FINER, "Initializing stream to subscription {0}", subscription); // We need to set streaming ack deadline, but it's not useful since we'll modack to send receipt @@ -236,7 +366,7 @@ private void initialize() { initClientStream.send( StreamingPullRequest.newBuilder() .setSubscription(subscription) - .setStreamAckDeadlineSeconds((int) streamAckDeadline.getSeconds()) + .setStreamAckDeadlineSeconds(Math.toIntExact(inititalStreamAckDeadline.getSeconds())) .setClientId(clientId) .setMaxOutstandingMessages( this.useLegacyFlowControl @@ -246,6 +376,7 @@ private void initialize() { this.useLegacyFlowControl ? 0 : valueOrZero(flowControlSettings.getMaxOutstandingRequestBytes())) + .setProtocolVersion(protocolVersion) .build()); /** @@ -260,6 +391,13 @@ private void initialize() { lock.unlock(); } + if (enableKeepalive) { + lastServerResponseTime.set(clock.nanoTime()); + lastClientPingTime.set(-1L); + startClientPinger(); + startServerMonitor(); + } + ApiFutures.addCallback( errorFuture, new ApiFutureCallback() { @@ -276,6 +414,10 @@ public void onSuccess(@Nullable Void result) { @Override public void onFailure(Throwable cause) { + if (enableKeepalive) { + stopClientPinger(); + stopServerMonitor(); + } if (!isAlive()) { // we don't care about subscription failures when we're no longer running. logger.log(Level.FINE, "pull failure after service no longer running", cause); @@ -287,6 +429,7 @@ public void onFailure(Throwable cause) { cause, GrpcStatusCode.of(Status.fromThrowable(cause).getCode()), false); logger.log(Level.SEVERE, "terminated streaming with exception", gaxException); runShutdown(); + setFailureFutureOutstandingMessages(cause); notifyFailed(gaxException); return; } @@ -319,52 +462,592 @@ private boolean isAlive() { return state == State.RUNNING || state == State.STARTING; } + private void startClientPinger() { + if (pingSchedulerHandle != null) { + pingSchedulerHandle.cancel(false); + } + + pingSchedulerHandle = + systemExecutor.scheduleAtFixedRate( + () -> { + try { + lock.lock(); + try { + if (clientStream != null && isAlive()) { + clientStream.send(StreamingPullRequest.newBuilder().build()); + lastClientPingTime.set(clock.nanoTime()); + logger.log(Level.FINEST, "Sent client keepalive ping"); + } + } finally { + lock.unlock(); + } + } catch (Exception e) { + logger.log(Level.FINE, "Error sending client keepalive ping", e); + } + }, + 0, + CLIENT_PING_INTERVAL.getSeconds(), + TimeUnit.SECONDS); + } + + private void stopClientPinger() { + if (pingSchedulerHandle != null) { + pingSchedulerHandle.cancel(false); + pingSchedulerHandle = null; + } + } + + private void startServerMonitor() { + if (serverMonitorHandle != null) { + serverMonitorHandle.cancel(false); + } + + serverMonitorHandle = + systemExecutor.scheduleAtFixedRate( + () -> { + try { + if (!isAlive()) { + return; + } + + long now = clock.nanoTime(); + long lastResponse = lastServerResponseTime.get(); + long lastPing = lastClientPingTime.get(); + + if (lastPing <= lastResponse) { + return; + } + + Duration elapsedSincePing = Duration.ofNanos(now - lastPing); + if (elapsedSincePing.compareTo(SERVER_PING_TIMEOUT_DURATION) < 0) { + return; + } + + logger.log( + Level.INFO, + "No response from server for {0} seconds since last ping. Closing stream.", + elapsedSincePing.getSeconds()); + + lock.lock(); + try { + if (clientStream != null) { + clientStream.closeSendWithError( + Status.UNAVAILABLE + .withDescription("Keepalive timeout with server") + .asException()); + } + } finally { + lock.unlock(); + } + stopServerMonitor(); + } catch (Exception e) { + logger.log(Level.FINE, "Error in server keepalive monitor", e); + } + }, + SERVER_MONITOR_INTERVAL.getSeconds(), + SERVER_MONITOR_INTERVAL.getSeconds(), + TimeUnit.SECONDS); + } + + private void stopServerMonitor() { + if (serverMonitorHandle != null) { + serverMonitorHandle.cancel(false); + serverMonitorHandle = null; + } + } + + public void setResponseOutstandingMessages(AckResponse ackResponse) { + // We will close the futures with ackResponse - if there are multiple references to the same + // future they will be handled appropriately + logger.log( + Level.WARNING, "Setting response: {0} on outstanding messages", ackResponse.toString()); + for (AckRequestData ackRequestData : pendingRequests) { + ackRequestData.setResponse(ackResponse, false); + } + + // Clear our pending requests + pendingRequests.clear(); + } + + private void setFailureFutureOutstandingMessages(Throwable t) { + AckResponse ackResponse; + + if (getExactlyOnceDeliveryEnabled()) { + ackResponse = StatusUtil.getFailedAckResponse(t); + } else { + // We should set success regardless if ExactlyOnceDelivery is not enabled + ackResponse = AckResponse.SUCCESSFUL; + } + + setResponseOutstandingMessages(ackResponse); + } + @Override - public void sendAckOperations( - List acksToSend, List ackDeadlineExtensions) { - ApiFutureCallback loggingCallback = - new ApiFutureCallback() { - @Override - public void onSuccess(Empty empty) { - ackOperationsWaiter.incrementPendingCount(-1); - } + public void sendAckOperations(List ackRequestDataList) { + sendAckOperations(ackRequestDataList, INITIAL_ACK_OPERATIONS_RECONNECT_BACKOFF_MILLIS); + } - @Override - public void onFailure(Throwable t) { - ackOperationsWaiter.incrementPendingCount(-1); - Level level = isAlive() ? Level.WARNING : Level.FINER; - logger.log(level, "failed to send operations", t); - } - }; + @Override + public void sendModackOperations(List modackRequestDataList) { + sendModackOperations(modackRequestDataList, INITIAL_ACK_OPERATIONS_RECONNECT_BACKOFF_MILLIS); + } + + private void sendAckOperations( + List ackRequestDataList, long currentBackoffMillis) { + int pendingOperations = 0; + for (List ackRequestDataInRequestList : + Lists.partition(ackRequestDataList, MAX_PER_REQUEST_CHANGES)) { + List ackIdsInRequest = new ArrayList<>(); + List messagesInRequest = new ArrayList<>(); + for (AckRequestData ackRequestData : ackRequestDataInRequestList) { + ackIdsInRequest.add(ackRequestData.getAckId()); + messagesInRequest.add(ackRequestData.getMessageWrapper()); + if (ackRequestData.hasMessageFuture()) { + // Add to our pending requests if we care about the response + pendingRequests.add(ackRequestData); + } + } + // Creates an Ack span to be passed to the callback + Span rpcSpan = + tracer.startSubscribeRpcSpan(subscriptionNameObject, "ack", messagesInRequest, 0, false); + ApiFutureCallback callback = + getCallback(ackRequestDataInRequestList, 0, false, currentBackoffMillis, rpcSpan); + ApiFuture ackFuture = + subscriberStub + .acknowledgeCallable() + .futureCall( + AcknowledgeRequest.newBuilder() + .setSubscription(subscription) + .addAllAckIds(ackIdsInRequest) + .build()); + ApiFutures.addCallback(ackFuture, callback, getCallbackExecutor()); + pendingOperations++; + } + ackOperationsWaiter.incrementPendingCount(pendingOperations); + } + private void sendModackOperations( + List modackRequestDataList, long currentBackoffMillis) { + // Send modacks int pendingOperations = 0; - for (PendingModifyAckDeadline modack : ackDeadlineExtensions) { - for (List idChunk : Lists.partition(modack.ackIds, MAX_PER_REQUEST_CHANGES)) { - ApiFuture future = - stub.modifyAckDeadlineCallable() + for (ModackRequestData modackRequestData : modackRequestDataList) { + for (List ackRequestDataInRequestList : + Lists.partition(modackRequestData.getAckRequestData(), MAX_PER_REQUEST_CHANGES)) { + List ackIdsInRequest = new ArrayList<>(); + List messagesInRequest = new ArrayList<>(); + for (AckRequestData ackRequestData : ackRequestDataInRequestList) { + ackIdsInRequest.add(ackRequestData.getAckId()); + messagesInRequest.add(ackRequestData.getMessageWrapper()); + if (ackRequestData.hasMessageFuture()) { + // Add to our pending requests if we care about the response + pendingRequests.add(ackRequestData); + } + } + int deadlineExtensionSeconds = modackRequestData.getDeadlineExtensionSeconds(); + String rpcOperation = deadlineExtensionSeconds == 0 ? "nack" : "modack"; + // Creates either a ModAck span or a Nack span depending on the given ack deadline + Span rpcSpan = + tracer.startSubscribeRpcSpan( + subscriptionNameObject, + rpcOperation, + messagesInRequest, + deadlineExtensionSeconds, + modackRequestData.getIsReceiptModack()); + ApiFutureCallback callback = + getCallback( + ackRequestDataInRequestList, + deadlineExtensionSeconds, + true, + currentBackoffMillis, + rpcSpan); + ApiFuture modackFuture = + subscriberStub + .modifyAckDeadlineCallable() .futureCall( ModifyAckDeadlineRequest.newBuilder() .setSubscription(subscription) - .addAllAckIds(idChunk) - .setAckDeadlineSeconds(modack.deadlineExtensionSeconds) + .addAllAckIds(ackIdsInRequest) + .setAckDeadlineSeconds(modackRequestData.getDeadlineExtensionSeconds()) .build()); - ApiFutures.addCallback(future, loggingCallback, directExecutor()); + ApiFutures.addCallback(modackFuture, callback, getCallbackExecutor()); pendingOperations++; } } + ackOperationsWaiter.incrementPendingCount(pendingOperations); + } - for (List idChunk : Lists.partition(acksToSend, MAX_PER_REQUEST_CHANGES)) { - ApiFuture future = - stub.acknowledgeCallable() - .futureCall( - AcknowledgeRequest.newBuilder() - .setSubscription(subscription) - .addAllAckIds(idChunk) - .build()); - ApiFutures.addCallback(future, loggingCallback, directExecutor()); - pendingOperations++; + private Map getMetadataMapFromThrowable(Throwable t) + throws InvalidProtocolBufferException { + // This converts a Throwable (from a "OK" grpc response) to a map of metadata + // will be of the format: + // { + // "ACK-ID-1": "PERMANENT_*", + // "ACK-ID-2": "TRANSIENT_*" + // } + com.google.rpc.Status status = StatusProto.fromThrowable(t); + Map metadataMap = new HashMap<>(); + if (status != null) { + for (Any any : status.getDetailsList()) { + if (any.is(ErrorInfo.class)) { + ErrorInfo errorInfo = any.unpack(ErrorInfo.class); + metadataMap = errorInfo.getMetadataMap(); + } + } } + return metadataMap; + } - ackOperationsWaiter.incrementPendingCount(pendingOperations); + private ApiFutureCallback getCallback( + List ackRequestDataList, + int deadlineExtensionSeconds, + boolean isModack, + long currentBackoffMillis, + Span rpcSpan) { + // This callback handles retries, and sets message futures + + // Check if ack or nack + boolean setResponseOnSuccess = (!isModack || (deadlineExtensionSeconds == 0)) ? true : false; + + boolean rpcSpanSampled = rpcSpan == null ? false : rpcSpan.getSpanContext().isSampled(); + + return new ApiFutureCallback() { + @Override + public void onSuccess(Empty empty) { + ackOperationsWaiter.incrementPendingCount(-1); + + tracer.endSubscribeRpcSpan(rpcSpan); + + for (AckRequestData ackRequestData : ackRequestDataList) { + // 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( + ackRequestData.getMessageWrapper(), + rpcSpanSampled, + isModack, + deadlineExtensionSeconds); + if (!isModack || deadlineExtensionSeconds == 0) { + tracer.endSubscriberSpan(ackRequestData.getMessageWrapper()); + } + } + } + + @Override + public void onFailure(Throwable t) { + // Remove from our pending operations + ackOperationsWaiter.incrementPendingCount(-1); + + Level level = isAlive() ? Level.WARNING : Level.FINER; + logger.log(level, "failed to send operations", t); + + tracer.setSubscribeRpcSpanException(rpcSpan, isModack, deadlineExtensionSeconds, t); + + if (!getExactlyOnceDeliveryEnabled()) { + if (enableOpenTelemetryTracing) { + for (AckRequestData ackRequestData : ackRequestDataList) { + tracer.addEndRpcEvent( + ackRequestData.getMessageWrapper(), + rpcSpanSampled, + isModack, + deadlineExtensionSeconds); + if (!isModack || deadlineExtensionSeconds == 0) { + tracer.endSubscriberSpan(ackRequestData.getMessageWrapper()); + } + } + } + return; + } + List ackRequestDataArrayRetryList = new ArrayList<>(); + try { + Map metadataMap = getMetadataMapFromThrowable(t); + if (metadataMap.isEmpty()) { + String operation = isModack ? "ModifyAckDeadline" : "Acknowledge"; + if (!StatusUtil.isRetryable(t)) { + logger.log(Level.WARNING, "Un-retryable error on " + operation, t); + ackRequestDataList.forEach( + ackRequestData -> { + AckResponse failedAckResponse = StatusUtil.getFailedAckResponse(t); + ackRequestData.setResponse(failedAckResponse, setResponseOnSuccess); + messageDispatcher.notifyAckFailed(ackRequestData); + tracer.addEndRpcEvent( + ackRequestData.getMessageWrapper(), + rpcSpanSampled, + isModack, + deadlineExtensionSeconds); + tracer.setSubscriberSpanException( + ackRequestData.getMessageWrapper(), t, "Error with no metadata map"); + ackRequestData + .getMessageWrapper() + .setSubscriberSpanException(t, "Error with no metadata map"); + pendingRequests.remove(ackRequestData); + }); + } else { + logger.log(Level.INFO, "Retryable error on " + operation + ", will resend", t); + ackRequestDataArrayRetryList.addAll(ackRequestDataList); + ackRequestDataList.forEach( + ackRequestData -> { + pendingRequests.remove(ackRequestData); + }); + } + } else { + ackRequestDataList.forEach( + ackRequestData -> { + String ackId = ackRequestData.getAckId(); + if (metadataMap.containsKey(ackId)) { + // An error occured + String errorMessage = metadataMap.get(ackId); + if (errorMessage.startsWith(TRANSIENT_FAILURE_METADATA_PREFIX)) { + // Retry all "TRANSIENT_*" error messages - do not set message future + logger.log(Level.INFO, "Transient error message, will resend", errorMessage); + ackRequestDataArrayRetryList.add(ackRequestData); + } else if (errorMessage.equals(PERMANENT_FAILURE_INVALID_ACK_ID_METADATA)) { + // Permanent failure + logger.log( + Level.INFO, + "Permanent error invalid ack id message, will not resend", + errorMessage); + ackRequestData.setResponse(AckResponse.INVALID, setResponseOnSuccess); + messageDispatcher.notifyAckFailed(ackRequestData); + tracer.addEndRpcEvent( + ackRequestData.getMessageWrapper(), + rpcSpanSampled, + isModack, + deadlineExtensionSeconds); + tracer.setSubscriberSpanException( + ackRequestData.getMessageWrapper(), t, "Invalid ack ID"); + } else { + logger.log( + Level.INFO, "Unknown error message, will not resend", errorMessage); + ackRequestData.setResponse(AckResponse.OTHER, setResponseOnSuccess); + messageDispatcher.notifyAckFailed(ackRequestData); + tracer.addEndRpcEvent( + ackRequestData.getMessageWrapper(), + rpcSpanSampled, + isModack, + deadlineExtensionSeconds); + tracer.setSubscriberSpanException( + ackRequestData.getMessageWrapper(), t, "Unknown error message"); + ackRequestData + .getMessageWrapper() + .setSubscriberSpanException(t, "Unknown error message"); + } + } else { + ackRequestData.setResponse(AckResponse.SUCCESSFUL, setResponseOnSuccess); + messageDispatcher.notifyAckSuccess(ackRequestData); + tracer.endSubscriberSpan(ackRequestData.getMessageWrapper()); + tracer.addEndRpcEvent( + ackRequestData.getMessageWrapper(), + rpcSpanSampled, + isModack, + deadlineExtensionSeconds); + } + // Remove from our pending + pendingRequests.remove(ackRequestData); + }); + } + } catch (InvalidProtocolBufferException e) { + // If we fail to parse out the errorInfo, we should retry all + logger.log( + Level.WARNING, "Exception occurred when parsing throwable {0} for errorInfo", t); + ackRequestDataArrayRetryList.addAll(ackRequestDataList); + } + + // Handle retries + if (!ackRequestDataArrayRetryList.isEmpty()) { + long newBackoffMillis = + Math.min(currentBackoffMillis * 2, MAX_ACK_OPERATIONS_RECONNECT_BACKOFF_MILLIS); + systemExecutor.schedule( + new Runnable() { + @Override + public void run() { + if (isModack) { + // Create a new modackRequest with only the retries + ModackRequestData modackRequestData = + new ModackRequestData( + deadlineExtensionSeconds, ackRequestDataArrayRetryList); + sendModackOperations( + Collections.singletonList(modackRequestData), newBackoffMillis); + } else { + sendAckOperations(ackRequestDataArrayRetryList, newBackoffMillis); + } + } + }, + currentBackoffMillis, + TimeUnit.MILLISECONDS); + } + } + }; + } + + // If exactly-once is enabled, we hold a lock for the ack/modack response callback, so we want to + // avoid using the directExecutor() which runs the callback on the invoking thread. Instead, we + // want to schedule the callback to be run on a different thread. + private Executor getCallbackExecutor() { + if (!getExactlyOnceDeliveryEnabled()) { + return directExecutor(); + } + return systemExecutor; + } + + /** Builder of {@link StreamingSubscriberConnection StreamingSubscriberConnections}. */ + public static final class Builder { + private MessageReceiver receiver; + private MessageReceiverWithAckResponse receiverWithAckResponse; + private String subscription; + private Duration ackExpirationPadding; + private Duration maxAckExtensionPeriod; + private Duration minDurationPerAckExtension; + private boolean minDurationPerAckExtensionDefaultUsed; + private Duration maxDurationPerAckExtension; + private boolean maxDurationPerAckExtensionDefaultUsed; + + private Distribution ackLatencyDistribution; + private SubscriberStub subscriberStub; + private int channelAffinity; + private long protocolVersion; + private FlowController flowController; + private FlowControlSettings flowControlSettings; + private boolean useLegacyFlowControl; + private ScheduledExecutorService executor; + private ScheduledExecutorService systemExecutor; + private ApiClock clock; + + private boolean enableOpenTelemetryTracing; + private OpenTelemetryPubsubTracer tracer; + private SubscriberShutdownSettings subscriberShutdownSettings; + + protected Builder(MessageReceiver receiver) { + this.receiver = receiver; + } + + protected Builder(MessageReceiverWithAckResponse receiverWithAckResponse) { + this.receiverWithAckResponse = receiverWithAckResponse; + } + + public Builder setSubscription(String subscription) { + this.subscription = subscription; + return this; + } + + public Builder setAckExpirationPadding(Duration ackExpirationPadding) { + this.ackExpirationPadding = ackExpirationPadding; + return this; + } + + public Builder setMaxAckExtensionPeriod(Duration maxAckExtensionPeriod) { + this.maxAckExtensionPeriod = maxAckExtensionPeriod; + return this; + } + + public Builder setMinDurationPerAckExtension(Duration minDurationPerAckExtension) { + this.minDurationPerAckExtension = minDurationPerAckExtension; + return this; + } + + public Builder setMinDurationPerAckExtensionDefaultUsed( + boolean minDurationPerAckExtensionDefaultUsed) { + this.minDurationPerAckExtensionDefaultUsed = minDurationPerAckExtensionDefaultUsed; + return this; + } + + public Builder setMaxDurationPerAckExtension(Duration maxDurationPerAckExtension) { + this.maxDurationPerAckExtension = maxDurationPerAckExtension; + return this; + } + + public Builder setMaxDurationPerAckExtensionDefaultUsed( + boolean maxDurationPerAckExtensionDefaultUsed) { + this.maxDurationPerAckExtensionDefaultUsed = maxDurationPerAckExtensionDefaultUsed; + return this; + } + + public Builder setAckLatencyDistribution(Distribution ackLatencyDistribution) { + this.ackLatencyDistribution = ackLatencyDistribution; + return this; + } + + public Builder setSubscriberStub(SubscriberStub subscriberStub) { + this.subscriberStub = subscriberStub; + return this; + } + + public Builder setChannelAffinity(int channelAffinity) { + this.channelAffinity = channelAffinity; + return this; + } + + public Builder setProtocolVersion(long protocolVersion) { + this.protocolVersion = protocolVersion; + return this; + } + + public Builder setFlowController(FlowController flowController) { + this.flowController = flowController; + return this; + } + + public Builder setFlowControlSettings(FlowControlSettings flowControlSettings) { + this.flowControlSettings = flowControlSettings; + return this; + } + + public Builder setUseLegacyFlowControl(boolean useLegacyFlowControl) { + this.useLegacyFlowControl = useLegacyFlowControl; + return this; + } + + public Builder setExecutor(ScheduledExecutorService executor) { + this.executor = executor; + return this; + } + + public Builder setSystemExecutor(ScheduledExecutorService systemExecutor) { + this.systemExecutor = systemExecutor; + return this; + } + + public Builder setClock(ApiClock clock) { + this.clock = clock; + return this; + } + + public Builder setEnableOpenTelemetryTracing(boolean enableOpenTelemetryTracing) { + this.enableOpenTelemetryTracing = enableOpenTelemetryTracing; + return this; + } + + public Builder setTracer(OpenTelemetryPubsubTracer tracer) { + this.tracer = tracer; + return this; + } + + public Builder setSubscriberShutdownSettings( + SubscriberShutdownSettings subscriberShutdownSettings) { + this.subscriberShutdownSettings = subscriberShutdownSettings; + return this; + } + + public StreamingSubscriberConnection build() { + return new StreamingSubscriberConnection(this); + } + } + + public static Builder newBuilder(MessageReceiver receiver) { + return new Builder(receiver); + } + + public static Builder newBuilder(MessageReceiverWithAckResponse receiverWithAckResponse) { + return new Builder(receiverWithAckResponse); } } 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 4c3791b37..a2d4f3b38 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 @@ -16,13 +16,15 @@ package com.google.cloud.pubsub.v1; +import static com.google.api.gax.util.TimeConversionUtils.toJavaTimeDuration; + import com.google.api.core.AbstractApiService; import com.google.api.core.ApiClock; -import com.google.api.core.ApiFunction; import com.google.api.core.ApiService; import com.google.api.core.BetaApi; import com.google.api.core.CurrentMillisClock; import com.google.api.core.InternalApi; +import com.google.api.core.ObsoleteApi; import com.google.api.gax.batching.FlowControlSettings; import com.google.api.gax.batching.FlowController; import com.google.api.gax.batching.FlowController.LimitExceededBehavior; @@ -35,7 +37,6 @@ import com.google.api.gax.rpc.HeaderProvider; import com.google.api.gax.rpc.NoHeaderProvider; import com.google.api.gax.rpc.TransportChannelProvider; -import com.google.api.gax.rpc.UnaryCallSettings; import com.google.auth.oauth2.GoogleCredentials; import com.google.cloud.pubsub.v1.stub.GrpcSubscriberStub; import com.google.cloud.pubsub.v1.stub.SubscriberStub; @@ -45,6 +46,8 @@ import com.google.common.util.concurrent.ThreadFactoryBuilder; import com.google.pubsub.v1.ProjectSubscriptionName; import com.google.pubsub.v1.PubsubMessage; +import io.opentelemetry.api.OpenTelemetry; +import io.opentelemetry.api.trace.Tracer; import java.io.IOException; import java.util.ArrayList; import java.util.List; @@ -55,7 +58,6 @@ import java.util.logging.Level; import java.util.logging.Logger; import javax.annotation.Nullable; -import org.threeten.bp.Duration; /** * A Cloud Pub/Sub subscriber that is @@ -91,55 +93,102 @@ * details. */ public class Subscriber extends AbstractApiService implements SubscriberInterface { - @InternalApi static final Duration DEFAULT_MAX_DURATION_PER_ACK_EXTENSION = Duration.ofMillis(0); private static final int THREADS_PER_CHANNEL = 5; private static final int MAX_INBOUND_MESSAGE_SIZE = 20 * 1024 * 1024; // 20MB API maximum message size. - @InternalApi static final int MAX_ACK_DEADLINE_SECONDS = 600; - @InternalApi static final int MIN_ACK_DEADLINE_SECONDS = 10; - private static final Duration UNARY_TIMEOUT = Duration.ofSeconds(60); - private static final Duration ACK_EXPIRATION_PADDING = Duration.ofSeconds(5); + + private static final int MAX_INBOUND_METADATA_SIZE = + 4 * 1024 * 1024; // 4MB API maximum metadata size + + @InternalApi + static final java.time.Duration DEFAULT_MAX_ACK_EXTENSION_PERIOD = + java.time.Duration.ofMinutes(60); + + @InternalApi + static final java.time.Duration DEFAULT_MIN_ACK_DEADLINE_EXTENSION_EXACTLY_ONCE_DELIVERY = + java.time.Duration.ofMinutes(1); + + @InternalApi + static final java.time.Duration DEFAULT_MIN_ACK_DEADLINE_EXTENSION = + java.time.Duration.ofMinutes(0); + + @InternalApi + static final java.time.Duration DEFAULT_MAX_ACK_DEADLINE_EXTENSION = + java.time.Duration.ofSeconds(0); + + @InternalApi + static final java.time.Duration MIN_STREAM_ACK_DEADLINE = java.time.Duration.ofSeconds(10); + + @InternalApi + static final java.time.Duration MAX_STREAM_ACK_DEADLINE = java.time.Duration.ofSeconds(600); + + @InternalApi + static final java.time.Duration STREAM_ACK_DEADLINE_DEFAULT = java.time.Duration.ofSeconds(60); + + @InternalApi + static final java.time.Duration STREAM_ACK_DEADLINE_EXACTLY_ONCE_DELIVERY_DEFAULT = + java.time.Duration.ofSeconds(60); + + @InternalApi + static final java.time.Duration ACK_EXPIRATION_PADDING_DEFAULT = java.time.Duration.ofSeconds(5); private static final Logger logger = Logger.getLogger(Subscriber.class.getName()); + private static final String OPEN_TELEMETRY_TRACER_NAME = "com.google.cloud.pubsub.v1"; + private final String subscriptionName; private final FlowControlSettings flowControlSettings; private final boolean useLegacyFlowControl; - private final Duration maxAckExtensionPeriod; - private final Duration maxDurationPerAckExtension; + private final java.time.Duration maxAckExtensionPeriod; + private final java.time.Duration maxDurationPerAckExtension; + private final boolean maxDurationPerAckExtensionDefaultUsed; + private final java.time.Duration minDurationPerAckExtension; + private final boolean minDurationPerAckExtensionDefaultUsed; + private final long protocolVersion = 1L; + // The ExecutorProvider used to generate executors for processing messages. private final ExecutorProvider executorProvider; // An instantiation of the SystemExecutorProvider used for processing acks // and other system actions. @Nullable private final ScheduledExecutorService alarmsExecutor; + private final Distribution ackLatencyDistribution = - new Distribution(MAX_ACK_DEADLINE_SECONDS + 1); + new Distribution(Math.toIntExact(MAX_STREAM_ACK_DEADLINE.getSeconds()) + 1); - private SubscriberStub subStub; + private SubscriberStub subscriberStub; private final SubscriberStubSettings subStubSettings; private final FlowController flowController; private final int numPullers; private final MessageReceiver receiver; + private final MessageReceiverWithAckResponse receiverWithAckResponse; private final List streamingSubscriberConnections; private final ApiClock clock; private final List backgroundResources = new ArrayList<>(); + 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; + receiverWithAckResponse = builder.receiverWithAckResponse; flowControlSettings = builder.flowControlSettings; useLegacyFlowControl = builder.useLegacyFlowControl; - subscriptionName = builder.subscriptionName; + subscriptionName = builder.subscription; maxAckExtensionPeriod = builder.maxAckExtensionPeriod; maxDurationPerAckExtension = builder.maxDurationPerAckExtension; + maxDurationPerAckExtensionDefaultUsed = builder.maxDurationPerAckExtensionDefaultUsed; + minDurationPerAckExtension = builder.minDurationPerAckExtension; + minDurationPerAckExtensionDefaultUsed = builder.minDurationPerAckExtensionDefaultUsed; + clock = builder.clock.isPresent() ? builder.clock.get() : CurrentMillisClock.getDefaultClock(); flowController = new FlowController( - builder - .flowControlSettings - .toBuilder() + builder.flowControlSettings.toBuilder() .setLimitExceededBehavior(LimitExceededBehavior.Block) .build()); @@ -167,26 +216,30 @@ private Subscriber(Builder builder) { .setTransportChannelProvider(channelProvider) .setHeaderProvider(builder.headerProvider) .setEndpoint(builder.endpoint) - .applyToAllUnaryMethods( - new ApiFunction, Void>() { - @Override - public Void apply(UnaryCallSettings.Builder settingsBuilder) { - settingsBuilder.setSimpleTimeoutNoRetries(UNARY_TIMEOUT); - return null; - } - }) + .setUniverseDomain(builder.universeDomain) .build(); // TODO(pongad): what about internal header?? } catch (Exception e) { throw new IllegalStateException(e); } + 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) { + this.tracer = + new OpenTelemetryPubsubTracer(openTelemetryTracer, this.enableOpenTelemetryTracing); + } + } + streamingSubscriberConnections = new ArrayList(numPullers); // We regularly look up the distribution for a good subscription deadline. - // So we seed the distribution with something reasonable to start with. + // So we seed the distribution with the minimum value to start with. // Distribution is percentile-based, so this value will eventually lose importance. - ackLatencyDistribution.record(60); + ackLatencyDistribution.record(Math.toIntExact(MIN_STREAM_ACK_DEADLINE.getSeconds())); } /** @@ -200,6 +253,11 @@ public static Builder newBuilder(ProjectSubscriptionName subscription, MessageRe return newBuilder(subscription.toString(), receiver); } + public static Builder newBuilder( + ProjectSubscriptionName subscription, MessageReceiverWithAckResponse receiver) { + return newBuilder(subscription.toString(), receiver); + } + /** * Constructs a new {@link Builder}. * @@ -211,6 +269,10 @@ public static Builder newBuilder(String subscription, MessageReceiver receiver) return new Builder(subscription, receiver); } + public static Builder newBuilder(String subscription, MessageReceiverWithAckResponse receiver) { + return new Builder(subscription, receiver); + } + /** Returns the delivery attempt count for a received {@link PubsubMessage} */ public static Integer getDeliveryAttempt(PubsubMessage message) { if (!message.containsAttributes("googclient_deliveryattempt")) { @@ -273,7 +335,7 @@ protected void doStart() { logger.log(Level.FINE, "Starting subscriber group."); try { - this.subStub = GrpcSubscriberStub.create(subStubSettings); + this.subscriberStub = GrpcSubscriberStub.create(subStubSettings); } catch (IOException e) { // doesn't matter what we throw, the Service will just catch it and fail to start. throw new IllegalStateException(e); @@ -307,7 +369,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) { @@ -319,9 +380,15 @@ 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(); - subStub.shutdownNow(); + subscriberStub.shutdownNow(); } private void startStreamingConnections() { @@ -332,22 +399,40 @@ private void startStreamingConnections() { backgroundResources.add(new ExecutorAsBackgroundResource((executor))); } - streamingSubscriberConnections.add( - new StreamingSubscriberConnection( - subscriptionName, - receiver, - ACK_EXPIRATION_PADDING, - maxAckExtensionPeriod, - maxDurationPerAckExtension, - ackLatencyDistribution, - subStub, - i, - flowControlSettings, - useLegacyFlowControl, - flowController, - executor, - alarmsExecutor, - clock)); + StreamingSubscriberConnection.Builder streamingSubscriberConnectionBuilder; + + if (receiverWithAckResponse != null) { + streamingSubscriberConnectionBuilder = + StreamingSubscriberConnection.newBuilder(receiverWithAckResponse); + } else { + streamingSubscriberConnectionBuilder = StreamingSubscriberConnection.newBuilder(receiver); + } + + StreamingSubscriberConnection streamingSubscriberConnection = + streamingSubscriberConnectionBuilder + .setSubscription(subscriptionName) + .setAckExpirationPadding(ACK_EXPIRATION_PADDING_DEFAULT) + .setMaxAckExtensionPeriod(maxAckExtensionPeriod) + .setMinDurationPerAckExtension(minDurationPerAckExtension) + .setMinDurationPerAckExtensionDefaultUsed(minDurationPerAckExtensionDefaultUsed) + .setMaxDurationPerAckExtension(maxDurationPerAckExtension) + .setMaxDurationPerAckExtensionDefaultUsed(maxDurationPerAckExtensionDefaultUsed) + .setAckLatencyDistribution(ackLatencyDistribution) + .setSubscriberStub(subscriberStub) + .setChannelAffinity(i) + .setFlowControlSettings(flowControlSettings) + .setFlowController(flowController) + .setUseLegacyFlowControl(useLegacyFlowControl) + .setExecutor(executor) + .setSystemExecutor(alarmsExecutor) + .setClock(clock) + .setEnableOpenTelemetryTracing(enableOpenTelemetryTracing) + .setTracer(tracer) + .setSubscriberShutdownSettings(subscriberShutdownSettings) + .setProtocolVersion(protocolVersion) + .build(); + + streamingSubscriberConnections.add(streamingSubscriberConnection); } startConnections( streamingSubscriberConnections, @@ -370,8 +455,8 @@ public void failed(State from, Throwable failure) { } } - private void stopAllStreamingConnections() { - stopConnections(streamingSubscriberConnections); + private void stopAllStreamingConnections(long deadlineMillis) { + stopConnections(streamingSubscriberConnections, deadlineMillis); } private void shutdownBackgroundResources() { @@ -391,7 +476,7 @@ private void startConnections( } } - private void stopConnections(List connections) { + private void stopConnections(List connections, long deadlineMillis) { ArrayList liveConnections; synchronized (connections) { liveConnections = new ArrayList(connections); @@ -402,18 +487,25 @@ 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. } } } /** Builder of {@link Subscriber Subscribers}. */ public static final class Builder { - private static final Duration DEFAULT_MAX_ACK_EXTENSION_PERIOD = Duration.ofMinutes(60); static final FlowControlSettings DEFAULT_FLOW_CONTROL_SETTINGS = FlowControlSettings.newBuilder() .setMaxOutstandingElementCount(1000L) @@ -426,11 +518,15 @@ public static final class Builder { .build(); private static final AtomicInteger SYSTEM_EXECUTOR_COUNTER = new AtomicInteger(); - private String subscriptionName; + private String subscription; private MessageReceiver receiver; + private MessageReceiverWithAckResponse receiverWithAckResponse; - private Duration maxAckExtensionPeriod = DEFAULT_MAX_ACK_EXTENSION_PERIOD; - private Duration maxDurationPerAckExtension = DEFAULT_MAX_DURATION_PER_ACK_EXTENSION; + private java.time.Duration maxAckExtensionPeriod = DEFAULT_MAX_ACK_EXTENSION_PERIOD; + private java.time.Duration minDurationPerAckExtension = DEFAULT_MIN_ACK_DEADLINE_EXTENSION; + private boolean minDurationPerAckExtensionDefaultUsed = true; + private java.time.Duration maxDurationPerAckExtension = DEFAULT_MAX_ACK_DEADLINE_EXTENSION; + private boolean maxDurationPerAckExtensionDefaultUsed = true; private boolean useLegacyFlowControl = false; private FlowControlSettings flowControlSettings = DEFAULT_FLOW_CONTROL_SETTINGS; @@ -440,20 +536,33 @@ public static final class Builder { private TransportChannelProvider channelProvider = SubscriptionAdminSettings.defaultGrpcTransportProviderBuilder() .setMaxInboundMessageSize(MAX_INBOUND_MESSAGE_SIZE) - .setKeepAliveTime(Duration.ofMinutes(5)) + .setMaxInboundMetadataSize(MAX_INBOUND_METADATA_SIZE) + .setKeepAliveTimeDuration(java.time.Duration.ofMinutes(5)) .build(); private HeaderProvider headerProvider = new NoHeaderProvider(); private CredentialsProvider credentialsProvider = SubscriptionAdminSettings.defaultCredentialsProviderBuilder().build(); private Optional clock = Optional.absent(); private int parallelPullCount = 1; - private String endpoint = SubscriberStubSettings.getDefaultEndpoint(); + private String endpoint = null; + private String universeDomain = null; + + private boolean enableOpenTelemetryTracing = false; + private OpenTelemetry openTelemetry = null; - Builder(String subscriptionName, MessageReceiver receiver) { - this.subscriptionName = subscriptionName; + private SubscriberShutdownSettings subscriberShutdownSettings = + SubscriberShutdownSettings.newBuilder().build(); + + Builder(String subscription, MessageReceiver receiver) { + this.subscription = subscription; this.receiver = receiver; } + Builder(String subscription, MessageReceiverWithAckResponse receiverWithAckResponse) { + this.subscription = subscription; + this.receiverWithAckResponse = receiverWithAckResponse; + } + /** * {@code ChannelProvider} to use to create Channels, which must point at Cloud Pub/Sub * endpoint. @@ -522,6 +631,15 @@ public Builder setUseLegacyFlowControl(boolean value) { return this; } + /** + * This method is obsolete. Use {@link #setMaxAckExtensionPeriodDuration(java.time.Duration)} + * instead. + */ + @ObsoleteApi("Use setMaxAckExtensionPeriodDuration(java.time.Duration) instead") + public Builder setMaxAckExtensionPeriod(org.threeten.bp.Duration maxAckExtensionPeriod) { + return setMaxAckExtensionPeriodDuration(toJavaTimeDuration(maxAckExtensionPeriod)); + } + /** * Set the maximum period a message ack deadline will be extended. Defaults to one hour. * @@ -531,12 +649,22 @@ public Builder setUseLegacyFlowControl(boolean value) { * *

A zero duration effectively disables auto deadline extensions. */ - public Builder setMaxAckExtensionPeriod(Duration maxAckExtensionPeriod) { + public Builder setMaxAckExtensionPeriodDuration(java.time.Duration maxAckExtensionPeriod) { Preconditions.checkArgument(maxAckExtensionPeriod.toMillis() >= 0); this.maxAckExtensionPeriod = maxAckExtensionPeriod; return this; } + /** + * This method is obsolete. Use {@link + * #setMaxDurationPerAckExtensionDuration(java.time.Duration)} instead. + */ + @ObsoleteApi("Use setMaxDurationPerAckExtensionDuration(java.time.Duration) instead") + public Builder setMaxDurationPerAckExtension( + org.threeten.bp.Duration maxDurationPerAckExtension) { + return setMaxDurationPerAckExtensionDuration(toJavaTimeDuration(maxDurationPerAckExtension)); + } + /** * Set the upper bound for a single mod ack extention period. * @@ -547,9 +675,50 @@ public Builder setMaxAckExtensionPeriod(Duration maxAckExtensionPeriod) { * *

MaxDurationPerAckExtension configuration can be disabled by specifying a zero duration. */ - public Builder setMaxDurationPerAckExtension(Duration maxDurationPerAckExtension) { - Preconditions.checkArgument(maxDurationPerAckExtension.toMillis() >= 0); + public Builder setMaxDurationPerAckExtensionDuration( + java.time.Duration maxDurationPerAckExtension) { + // If a non-default min is set, make sure min is less than max + Preconditions.checkArgument( + maxDurationPerAckExtension.toMillis() >= 0 + && (this.minDurationPerAckExtensionDefaultUsed + || (this.minDurationPerAckExtension.toMillis() + < maxDurationPerAckExtension.toMillis()))); this.maxDurationPerAckExtension = maxDurationPerAckExtension; + this.maxDurationPerAckExtensionDefaultUsed = false; + return this; + } + + /** + * This method is obsolete. Use {@link + * #setMinDurationPerAckExtensionDuration(java.time.Duration)} instead. + */ + @ObsoleteApi("Use setMinDurationPerAckExtensionDuration(java.time.Duration) instead") + public Builder setMinDurationPerAckExtension( + org.threeten.bp.Duration minDurationPerAckExtension) { + return setMinDurationPerAckExtensionDuration(toJavaTimeDuration(minDurationPerAckExtension)); + } + + /** + * Set the lower bound for a single mod ack extention period. + * + *

The ack deadline will continue to be extended by up to this duration until + * MinAckExtensionPeriod is reached. Setting MinDurationPerAckExtension bounds the minimum + * amount of time before a mesage re-delivery in the event the Subscriber fails to extend the + * deadline. + * + *

MinDurationPerAckExtension configuration can be disabled by specifying a zero duration. + */ + public Builder setMinDurationPerAckExtensionDuration( + java.time.Duration minDurationPerAckExtension) { + // If a non-default max is set, make sure min is less than max + Preconditions.checkArgument( + minDurationPerAckExtension.toMillis() >= 0 + && (this.maxDurationPerAckExtensionDefaultUsed + || (minDurationPerAckExtension.toMillis() + < this.maxDurationPerAckExtension.toMillis()))); + + this.minDurationPerAckExtension = minDurationPerAckExtension; + this.minDurationPerAckExtensionDefaultUsed = false; return this; } @@ -592,12 +761,51 @@ public Builder setEndpoint(String endpoint) { return this; } + /** Gives the ability to override the universe domain. */ + public Builder setUniverseDomain(String universeDomain) { + this.universeDomain = universeDomain; + return this; + } + /** Gives the ability to set a custom clock. */ Builder setClock(ApiClock clock) { this.clock = Optional.of(clock); return this; } + /** + * OpenTelemetry will be enabled if setEnableOpenTelemetry is true and and instance of + * OpenTelemetry has been provied. Warning: traces are subject to change. The name and + * attributes of a span might change without notice. Only use run traces interactively. Don't + * use in automation. Running non-interactive traces can cause problems if the underlying trace + * architecture changes without notice. + */ + + /** Gives the ability to enable Open Telemetry Tracing */ + public Builder setEnableOpenTelemetryTracing(boolean enableOpenTelemetryTracing) { + this.enableOpenTelemetryTracing = enableOpenTelemetryTracing; + return this; + } + + /** Sets the instance of OpenTelemetry for the Publisher class. */ + public Builder setOpenTelemetry(OpenTelemetry openTelemetry) { + this.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 6c5b7a43d..26a764dab 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 @@ -1,11 +1,11 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 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 + * 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, @@ -13,12 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.pubsub.v1; -import com.google.api.core.ApiFunction; import com.google.api.core.ApiFuture; import com.google.api.core.ApiFutures; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.paging.AbstractFixedSizeCollection; import com.google.api.gax.paging.AbstractPage; @@ -35,6 +34,7 @@ import com.google.iam.v1.TestIamPermissionsRequest; import com.google.iam.v1.TestIamPermissionsResponse; import com.google.protobuf.Empty; +import com.google.protobuf.FieldMask; import com.google.pubsub.v1.AcknowledgeRequest; import com.google.pubsub.v1.CreateSnapshotRequest; import com.google.pubsub.v1.DeleteSnapshotRequest; @@ -57,9 +57,11 @@ import com.google.pubsub.v1.SeekRequest; import com.google.pubsub.v1.SeekResponse; import com.google.pubsub.v1.Snapshot; +import com.google.pubsub.v1.SnapshotName; import com.google.pubsub.v1.StreamingPullRequest; import com.google.pubsub.v1.StreamingPullResponse; import com.google.pubsub.v1.Subscription; +import com.google.pubsub.v1.SubscriptionName; import com.google.pubsub.v1.TopicName; import com.google.pubsub.v1.UpdateSnapshotRequest; import com.google.pubsub.v1.UpdateSubscriptionRequest; @@ -68,46 +70,386 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND SERVICE +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Service Description: The service that an application uses to manipulate subscriptions and to * consume messages from a subscription via the `Pull` method or by establishing a bi-directional * stream using the `StreamingPull` method. * - *

To retrieve messages from a subscription, see the Subscriber class. - * *

This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: * - *

- * 
+ * 
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
  * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- *   ProjectSubscriptionName name = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
+ *   SubscriptionName name = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
  *   TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
  *   PushConfig pushConfig = PushConfig.newBuilder().build();
- *   int ackDeadlineSeconds = 0;
- *   Subscription response = subscriptionAdminClient.createSubscription(name, topic, pushConfig, ackDeadlineSeconds);
+ *   int ackDeadlineSeconds = 2135351438;
+ *   Subscription response =
+ *       subscriptionAdminClient.createSubscription(name, topic, pushConfig, ackDeadlineSeconds);
  * }
- * 
- * 
+ * }
* - *

Note: close() needs to be called on the subscriptionAdminClient object to clean up resources + *

Note: close() needs to be called on the SubscriptionAdminClient object to clean up resources * such as threads. In the example above, try-with-resources is used, which automatically calls * close(). * - *

The surface of this class includes several types of Java methods for each of the API's - * methods: - * - *

    - *
  1. A "flattened" method. With this type of method, the fields of the request type have been - * converted into function parameters. It may be the case that not all fields are available as - * parameters, and not every API method will have a flattened method entry point. - *
  2. A "request object" method. This type of method only takes one parameter, a request object, - * which must be constructed before the call. Not every API method will have a request object - * method. - *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API - * callable object, which can be used to initiate calls to the service. - *
+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Methods
MethodDescriptionMethod Variants

CreateSubscription

Creates a subscription to a given topic. See the [resource name rules] (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). If the subscription already exists, returns `ALREADY_EXISTS`. If the corresponding topic doesn't exist, returns `NOT_FOUND`. + *

If the name is not provided in the request, the server will assign a random name for this subscription on the same project as the topic, conforming to the [resource name format] (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). The generated name is populated in the returned Subscription object. Note that for REST API requests, you must specify a name in the request.

+ *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ *
    + *
  • createSubscription(Subscription request) + *

+ *

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

+ *
    + *
  • createSubscription(SubscriptionName name, TopicName topic, PushConfig pushConfig, int ackDeadlineSeconds) + *

  • createSubscription(SubscriptionName name, String topic, PushConfig pushConfig, int ackDeadlineSeconds) + *

  • createSubscription(String name, TopicName topic, PushConfig pushConfig, int ackDeadlineSeconds) + *

  • createSubscription(String name, String topic, PushConfig pushConfig, int ackDeadlineSeconds) + *

+ *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ *
    + *
  • createSubscriptionCallable() + *

+ *

GetSubscription

Gets the configuration details of a subscription.

+ *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ *
    + *
  • getSubscription(GetSubscriptionRequest request) + *

+ *

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

+ *
    + *
  • getSubscription(SubscriptionName subscription) + *

  • getSubscription(String subscription) + *

+ *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ *
    + *
  • getSubscriptionCallable() + *

+ *

UpdateSubscription

Updates an existing subscription by updating the fields specified in the update mask. Note that certain properties of a subscription, such as its topic, are not modifiable.

+ *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ *
    + *
  • updateSubscription(UpdateSubscriptionRequest request) + *

+ *

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

+ *
    + *
  • updateSubscription(Subscription subscription, FieldMask updateMask) + *

+ *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ *
    + *
  • updateSubscriptionCallable() + *

+ *

ListSubscriptions

Lists matching subscriptions.

+ *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ *
    + *
  • listSubscriptions(ListSubscriptionsRequest request) + *

+ *

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

+ *
    + *
  • listSubscriptions(ProjectName project) + *

  • listSubscriptions(String project) + *

+ *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ *
    + *
  • listSubscriptionsPagedCallable() + *

  • listSubscriptionsCallable() + *

+ *

DeleteSubscription

Deletes an existing subscription. All messages retained in the subscription are immediately dropped. Calls to `Pull` after deletion will return `NOT_FOUND`. After a subscription is deleted, a new one may be created with the same name, but the new one has no association with the old subscription or its topic unless the same topic is specified.

+ *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ *
    + *
  • deleteSubscription(DeleteSubscriptionRequest request) + *

+ *

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

+ *
    + *
  • deleteSubscription(SubscriptionName subscription) + *

  • deleteSubscription(String subscription) + *

+ *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ *
    + *
  • deleteSubscriptionCallable() + *

+ *

ModifyAckDeadline

Modifies the ack deadline for a specific message. This method is useful to indicate that more time is needed to process a message by the subscriber, or to make the message available for redelivery if the processing was interrupted. Note that this does not modify the subscription-level `ackDeadlineSeconds` used for subsequent messages.

+ *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ *
    + *
  • modifyAckDeadline(ModifyAckDeadlineRequest request) + *

+ *

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

+ *
    + *
  • modifyAckDeadline(SubscriptionName subscription, List<String> ackIds, int ackDeadlineSeconds) + *

  • modifyAckDeadline(String subscription, List<String> ackIds, int ackDeadlineSeconds) + *

+ *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ *
    + *
  • modifyAckDeadlineCallable() + *

+ *

Acknowledge

Acknowledges the messages associated with the `ack_ids` in the `AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages from the subscription. + *

Acknowledging a message whose ack deadline has expired may succeed, but such a message may be redelivered later. Acknowledging a message more than once will not result in an error.

+ *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ *
    + *
  • acknowledge(AcknowledgeRequest request) + *

+ *

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

+ *
    + *
  • acknowledge(SubscriptionName subscription, List<String> ackIds) + *

  • acknowledge(String subscription, List<String> ackIds) + *

+ *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ *
    + *
  • acknowledgeCallable() + *

+ *

Pull

Pulls messages from the server.

+ *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ *
    + *
  • pull(PullRequest request) + *

+ *

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

+ *
    + *
  • pull(SubscriptionName subscription, int maxMessages) + *

  • pull(String subscription, int maxMessages) + *

  • pull(SubscriptionName subscription, boolean returnImmediately, int maxMessages) + *

  • pull(String subscription, boolean returnImmediately, int maxMessages) + *

+ *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ *
    + *
  • pullCallable() + *

+ *

StreamingPull

Establishes a stream with the server, which sends messages down to the client. The client streams acknowledgments and ack deadline modifications back to the server. The server will close the stream and return the status on any error. The server may close the stream with status `UNAVAILABLE` to reassign server-side resources, in which case, the client should re-establish the stream. Flow control can be achieved by configuring the underlying RPC channel.

+ *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ *
    + *
  • streamingPullCallable() + *

+ *

ModifyPushConfig

Modifies the `PushConfig` for a specified subscription. + *

This may be used to change a push subscription to a pull one (signified by an empty `PushConfig`) or vice versa, or change the endpoint URL and other attributes of a push subscription. Messages will accumulate for delivery continuously through the call regardless of changes to the `PushConfig`.

+ *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ *
    + *
  • modifyPushConfig(ModifyPushConfigRequest request) + *

+ *

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

+ *
    + *
  • modifyPushConfig(SubscriptionName subscription, PushConfig pushConfig) + *

  • modifyPushConfig(String subscription, PushConfig pushConfig) + *

+ *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ *
    + *
  • modifyPushConfigCallable() + *

+ *

GetSnapshot

Gets the configuration details of a snapshot. Snapshots are used in [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot.

+ *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ *
    + *
  • getSnapshot(GetSnapshotRequest request) + *

+ *

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

+ *
    + *
  • getSnapshot(SnapshotName snapshot) + *

  • getSnapshot(String snapshot) + *

+ *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ *
    + *
  • getSnapshotCallable() + *

+ *

ListSnapshots

Lists the existing snapshots. Snapshots are used in [Seek]( https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot.

+ *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ *
    + *
  • listSnapshots(ListSnapshotsRequest request) + *

+ *

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

+ *
    + *
  • listSnapshots(ProjectName project) + *

  • listSnapshots(String project) + *

+ *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ *
    + *
  • listSnapshotsPagedCallable() + *

  • listSnapshotsCallable() + *

+ *

CreateSnapshot

Creates a snapshot from the requested subscription. Snapshots are used in [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot. If the snapshot already exists, returns `ALREADY_EXISTS`. If the requested subscription doesn't exist, returns `NOT_FOUND`. If the backlog in the subscription is too old -- and the resulting snapshot would expire in less than 1 hour -- then `FAILED_PRECONDITION` is returned. See also the `Snapshot.expire_time` field. If the name is not provided in the request, the server will assign a random name for this snapshot on the same project as the subscription, conforming to the [resource name format] (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). The generated name is populated in the returned Snapshot object. Note that for REST API requests, you must specify a name in the request.

+ *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ *
    + *
  • createSnapshot(CreateSnapshotRequest request) + *

+ *

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

+ *
    + *
  • createSnapshot(SnapshotName name, SubscriptionName subscription) + *

  • createSnapshot(SnapshotName name, String subscription) + *

  • createSnapshot(String name, SubscriptionName subscription) + *

  • createSnapshot(String name, String subscription) + *

+ *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ *
    + *
  • createSnapshotCallable() + *

+ *

UpdateSnapshot

Updates an existing snapshot by updating the fields specified in the update mask. Snapshots are used in [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot.

+ *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ *
    + *
  • updateSnapshot(UpdateSnapshotRequest request) + *

+ *

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

+ *
    + *
  • updateSnapshot(Snapshot snapshot, FieldMask updateMask) + *

+ *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ *
    + *
  • updateSnapshotCallable() + *

+ *

DeleteSnapshot

Removes an existing snapshot. Snapshots are used in [Seek] (https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot. When the snapshot is deleted, all messages retained in the snapshot are immediately dropped. After a snapshot is deleted, a new one may be created with the same name, but the new one has no association with the old snapshot or its subscription, unless the same subscription is specified.

+ *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ *
    + *
  • deleteSnapshot(DeleteSnapshotRequest request) + *

+ *

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

+ *
    + *
  • deleteSnapshot(SnapshotName snapshot) + *

  • deleteSnapshot(String snapshot) + *

+ *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ *
    + *
  • deleteSnapshotCallable() + *

+ *

Seek

Seeks an existing subscription to a point in time or to a given snapshot, whichever is provided in the request. Snapshots are used in [Seek] (https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot. Note that both the subscription and the snapshot must be on the same topic.

+ *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ *
    + *
  • seek(SeekRequest request) + *

+ *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ *
    + *
  • seekCallable() + *

+ *

SetIamPolicy

Sets the access control policy on the specified resource. Replacesany existing policy. + *

Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors.

+ *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ *
    + *
  • setIamPolicy(SetIamPolicyRequest request) + *

+ *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ *
    + *
  • setIamPolicyCallable() + *

+ *

GetIamPolicy

Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set.

+ *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ *
    + *
  • getIamPolicy(GetIamPolicyRequest request) + *

+ *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ *
    + *
  • getIamPolicyCallable() + *

+ *

TestIamPermissions

Returns permissions that a caller has on the specified resource. If theresource does not exist, this will return an empty set ofpermissions, not a `NOT_FOUND` error. + *

Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning.

+ *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ *
    + *
  • testIamPermissions(TestIamPermissionsRequest request) + *

+ *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ *
    + *
  • testIamPermissionsCallable() + *

+ *
* *

See the individual methods for example code. * @@ -120,29 +462,52 @@ * *

To customize credentials: * - *

- * 
+ * 
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
  * SubscriptionAdminSettings subscriptionAdminSettings =
  *     SubscriptionAdminSettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
  *         .build();
  * SubscriptionAdminClient subscriptionAdminClient =
  *     SubscriptionAdminClient.create(subscriptionAdminSettings);
- * 
- * 
+ * }
* - * To customize the endpoint: + *

To customize the endpoint: * - *

- * 
+ * 
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
  * SubscriptionAdminSettings subscriptionAdminSettings =
  *     SubscriptionAdminSettings.newBuilder().setEndpoint(myEndpoint).build();
  * SubscriptionAdminClient subscriptionAdminClient =
  *     SubscriptionAdminClient.create(subscriptionAdminSettings);
- * 
- * 
+ * }
+ * + *

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over + * the wire: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * SubscriptionAdminSettings subscriptionAdminSettings =
+ *     SubscriptionAdminSettings.newHttpJsonBuilder().build();
+ * SubscriptionAdminClient subscriptionAdminClient =
+ *     SubscriptionAdminClient.create(subscriptionAdminSettings);
+ * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ -@Generated("by gapic-generator") +@Generated("by gapic-generator-java") public class SubscriptionAdminClient implements BackgroundResource { private final SubscriptionAdminSettings settings; private final SubscriberStub stub; @@ -163,9 +528,8 @@ public static final SubscriptionAdminClient create(SubscriptionAdminSettings set /** * Constructs an instance of SubscriptionAdminClient, using the given stub for making calls. This - * is for advanced usage - prefer to use SubscriptionAdminSettings}. + * is for advanced usage - prefer using create(SubscriptionAdminSettings). */ - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final SubscriptionAdminClient create(SubscriberStub stub) { return new SubscriptionAdminClient(stub); } @@ -180,7 +544,6 @@ protected SubscriptionAdminClient(SubscriptionAdminSettings settings) throws IOE this.stub = ((SubscriberStubSettings) settings.getStubSettings()).createStub(); } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected SubscriptionAdminClient(SubscriberStub stub) { this.settings = null; this.stub = stub; @@ -190,37 +553,42 @@ public final SubscriptionAdminSettings getSettings() { return settings; } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public SubscriberStub getStub() { return stub; } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a subscription to a given topic. See the [resource name rules] - * (https://cloud.google.com/pubsub/docs/admin#resource_names). If the subscription already - * exists, returns `ALREADY_EXISTS`. If the corresponding topic doesn't exist, returns + * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). If the subscription + * already exists, returns `ALREADY_EXISTS`. If the corresponding topic doesn't exist, returns * `NOT_FOUND`. * *

If the name is not provided in the request, the server will assign a random name for this * subscription on the same project as the topic, conforming to the [resource name format] - * (https://cloud.google.com/pubsub/docs/admin#resource_names). The generated name is populated in - * the returned Subscription object. Note that for REST API requests, you must specify a name in - * the request. + * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). The generated name is + * populated in the returned Subscription object. Note that for REST API requests, you must + * specify a name in the request. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ProjectSubscriptionName name = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
+   *   SubscriptionName name = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
    *   TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
    *   PushConfig pushConfig = PushConfig.newBuilder().build();
-   *   int ackDeadlineSeconds = 0;
-   *   Subscription response = subscriptionAdminClient.createSubscription(name, topic, pushConfig, ackDeadlineSeconds);
+   *   int ackDeadlineSeconds = 2135351438;
+   *   Subscription response =
+   *       subscriptionAdminClient.createSubscription(name, topic, pushConfig, ackDeadlineSeconds);
    * }
-   * 
+ * }
* - * @param name Required. The name of the subscription. It must have the format + * @param name Required. Identifier. The name of the subscription. It must have the format * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must start with a * letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores * (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 @@ -228,14 +596,13 @@ public SubscriberStub getStub() { * @param topic Required. The name of the topic from which this subscription is receiving * messages. Format is `projects/{project}/topics/{topic}`. The value of this field will be * `_deleted-topic_` if the topic has been deleted. - * @param pushConfig If push delivery is used with this subscription, this field is used to - * configure it. An empty `pushConfig` signifies that the subscriber will pull and ack - * messages using API methods. - * @param ackDeadlineSeconds The approximate amount of time (on a best-effort basis) Pub/Sub waits - * for the subscriber to acknowledge receipt before resending the message. In the interval - * after the message is delivered and before it is acknowledged, it is considered to be - * <i>outstanding</i>. During that time period, the message will not be - * redelivered (on a best-effort basis). + * @param pushConfig Optional. If push delivery is used with this subscription, this field is used + * to configure it. + * @param ackDeadlineSeconds Optional. The approximate amount of time (on a best-effort basis) + * Pub/Sub waits for the subscriber to acknowledge receipt before resending the message. In + * the interval after the message is delivered and before it is acknowledged, it is considered + * to be _outstanding_. During that time period, the message will not be redelivered (on a + * best-effort basis). *

For pull subscriptions, this value is used as the initial value for the ack deadline. To * override this value for a given message, call `ModifyAckDeadline` with the corresponding * `ack_id` if using non-streaming pull or send the `ack_id` in a @@ -249,10 +616,7 @@ public SubscriberStub getStub() { * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Subscription createSubscription( - ProjectSubscriptionName name, - TopicName topic, - PushConfig pushConfig, - int ackDeadlineSeconds) { + SubscriptionName name, TopicName topic, PushConfig pushConfig, int ackDeadlineSeconds) { Subscription request = Subscription.newBuilder() .setName(name == null ? null : name.toString()) @@ -263,32 +627,108 @@ public final Subscription createSubscription( return createSubscription(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a subscription to a given topic. See the [resource name rules] - * (https://cloud.google.com/pubsub/docs/admin#resource_names). If the subscription already - * exists, returns `ALREADY_EXISTS`. If the corresponding topic doesn't exist, returns + * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). If the subscription + * already exists, returns `ALREADY_EXISTS`. If the corresponding topic doesn't exist, returns * `NOT_FOUND`. * *

If the name is not provided in the request, the server will assign a random name for this * subscription on the same project as the topic, conforming to the [resource name format] - * (https://cloud.google.com/pubsub/docs/admin#resource_names). The generated name is populated in - * the returned Subscription object. Note that for REST API requests, you must specify a name in - * the request. + * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). The generated name is + * populated in the returned Subscription object. Note that for REST API requests, you must + * specify a name in the request. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ProjectSubscriptionName name = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
+   *   SubscriptionName name = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
+   *   String topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString();
+   *   PushConfig pushConfig = PushConfig.newBuilder().build();
+   *   int ackDeadlineSeconds = 2135351438;
+   *   Subscription response =
+   *       subscriptionAdminClient.createSubscription(name, topic, pushConfig, ackDeadlineSeconds);
+   * }
+   * }
+ * + * @param name Required. Identifier. The name of the subscription. It must have the format + * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must start with a + * letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores + * (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 + * and 255 characters in length, and it must not start with `"goog"`. + * @param topic Required. The name of the topic from which this subscription is receiving + * messages. Format is `projects/{project}/topics/{topic}`. The value of this field will be + * `_deleted-topic_` if the topic has been deleted. + * @param pushConfig Optional. If push delivery is used with this subscription, this field is used + * to configure it. + * @param ackDeadlineSeconds Optional. The approximate amount of time (on a best-effort basis) + * Pub/Sub waits for the subscriber to acknowledge receipt before resending the message. In + * the interval after the message is delivered and before it is acknowledged, it is considered + * to be _outstanding_. During that time period, the message will not be redelivered (on a + * best-effort basis). + *

For pull subscriptions, this value is used as the initial value for the ack deadline. To + * override this value for a given message, call `ModifyAckDeadline` with the corresponding + * `ack_id` if using non-streaming pull or send the `ack_id` in a + * `StreamingModifyAckDeadlineRequest` if using streaming pull. The minimum custom deadline + * you can specify is 10 seconds. The maximum custom deadline you can specify is 600 seconds + * (10 minutes). If this parameter is 0, a default value of 10 seconds is used. + *

For push delivery, this value is also used to set the request timeout for the call to + * the push endpoint. + *

If the subscriber never acknowledges the message, the Pub/Sub system will eventually + * redeliver the message. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Subscription createSubscription( + SubscriptionName name, String topic, PushConfig pushConfig, int ackDeadlineSeconds) { + Subscription request = + Subscription.newBuilder() + .setName(name == null ? null : name.toString()) + .setTopic(topic) + .setPushConfig(pushConfig) + .setAckDeadlineSeconds(ackDeadlineSeconds) + .build(); + return createSubscription(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a subscription to a given topic. See the [resource name rules] + * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). If the subscription + * already exists, returns `ALREADY_EXISTS`. If the corresponding topic doesn't exist, returns + * `NOT_FOUND`. + * + *

If the name is not provided in the request, the server will assign a random name for this + * subscription on the same project as the topic, conforming to the [resource name format] + * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). The generated name is + * populated in the returned Subscription object. Note that for REST API requests, you must + * specify a name in the request. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *   String name = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
    *   TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
    *   PushConfig pushConfig = PushConfig.newBuilder().build();
-   *   int ackDeadlineSeconds = 0;
-   *   Subscription response = subscriptionAdminClient.createSubscription(name.toString(), topic.toString(), pushConfig, ackDeadlineSeconds);
+   *   int ackDeadlineSeconds = 2135351438;
+   *   Subscription response =
+   *       subscriptionAdminClient.createSubscription(name, topic, pushConfig, ackDeadlineSeconds);
    * }
-   * 
+ * }
* - * @param name Required. The name of the subscription. It must have the format + * @param name Required. Identifier. The name of the subscription. It must have the format * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must start with a * letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores * (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 @@ -296,14 +736,83 @@ public final Subscription createSubscription( * @param topic Required. The name of the topic from which this subscription is receiving * messages. Format is `projects/{project}/topics/{topic}`. The value of this field will be * `_deleted-topic_` if the topic has been deleted. - * @param pushConfig If push delivery is used with this subscription, this field is used to - * configure it. An empty `pushConfig` signifies that the subscriber will pull and ack - * messages using API methods. - * @param ackDeadlineSeconds The approximate amount of time (on a best-effort basis) Pub/Sub waits - * for the subscriber to acknowledge receipt before resending the message. In the interval - * after the message is delivered and before it is acknowledged, it is considered to be - * <i>outstanding</i>. During that time period, the message will not be - * redelivered (on a best-effort basis). + * @param pushConfig Optional. If push delivery is used with this subscription, this field is used + * to configure it. + * @param ackDeadlineSeconds Optional. The approximate amount of time (on a best-effort basis) + * Pub/Sub waits for the subscriber to acknowledge receipt before resending the message. In + * the interval after the message is delivered and before it is acknowledged, it is considered + * to be _outstanding_. During that time period, the message will not be redelivered (on a + * best-effort basis). + *

For pull subscriptions, this value is used as the initial value for the ack deadline. To + * override this value for a given message, call `ModifyAckDeadline` with the corresponding + * `ack_id` if using non-streaming pull or send the `ack_id` in a + * `StreamingModifyAckDeadlineRequest` if using streaming pull. The minimum custom deadline + * you can specify is 10 seconds. The maximum custom deadline you can specify is 600 seconds + * (10 minutes). If this parameter is 0, a default value of 10 seconds is used. + *

For push delivery, this value is also used to set the request timeout for the call to + * the push endpoint. + *

If the subscriber never acknowledges the message, the Pub/Sub system will eventually + * redeliver the message. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Subscription createSubscription( + String name, TopicName topic, PushConfig pushConfig, int ackDeadlineSeconds) { + Subscription request = + Subscription.newBuilder() + .setName(name) + .setTopic(topic == null ? null : topic.toString()) + .setPushConfig(pushConfig) + .setAckDeadlineSeconds(ackDeadlineSeconds) + .build(); + return createSubscription(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a subscription to a given topic. See the [resource name rules] + * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). If the subscription + * already exists, returns `ALREADY_EXISTS`. If the corresponding topic doesn't exist, returns + * `NOT_FOUND`. + * + *

If the name is not provided in the request, the server will assign a random name for this + * subscription on the same project as the topic, conforming to the [resource name format] + * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). The generated name is + * populated in the returned Subscription object. Note that for REST API requests, you must + * specify a name in the request. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *   String name = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
+   *   String topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString();
+   *   PushConfig pushConfig = PushConfig.newBuilder().build();
+   *   int ackDeadlineSeconds = 2135351438;
+   *   Subscription response =
+   *       subscriptionAdminClient.createSubscription(name, topic, pushConfig, ackDeadlineSeconds);
+   * }
+   * }
+ * + * @param name Required. Identifier. The name of the subscription. It must have the format + * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must start with a + * letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores + * (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 + * and 255 characters in length, and it must not start with `"goog"`. + * @param topic Required. The name of the topic from which this subscription is receiving + * messages. Format is `projects/{project}/topics/{topic}`. The value of this field will be + * `_deleted-topic_` if the topic has been deleted. + * @param pushConfig Optional. If push delivery is used with this subscription, this field is used + * to configure it. + * @param ackDeadlineSeconds Optional. The approximate amount of time (on a best-effort basis) + * Pub/Sub waits for the subscriber to acknowledge receipt before resending the message. In + * the interval after the message is delivered and before it is acknowledged, it is considered + * to be _outstanding_. During that time period, the message will not be redelivered (on a + * best-effort basis). *

For pull subscriptions, this value is used as the initial value for the ack deadline. To * override this value for a given message, call `ModifyAckDeadline` with the corresponding * `ack_id` if using non-streaming pull or send the `ack_id` in a @@ -328,32 +837,56 @@ public final Subscription createSubscription( return createSubscription(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a subscription to a given topic. See the [resource name rules] - * (https://cloud.google.com/pubsub/docs/admin#resource_names). If the subscription already - * exists, returns `ALREADY_EXISTS`. If the corresponding topic doesn't exist, returns + * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). If the subscription + * already exists, returns `ALREADY_EXISTS`. If the corresponding topic doesn't exist, returns * `NOT_FOUND`. * *

If the name is not provided in the request, the server will assign a random name for this * subscription on the same project as the topic, conforming to the [resource name format] - * (https://cloud.google.com/pubsub/docs/admin#resource_names). The generated name is populated in - * the returned Subscription object. Note that for REST API requests, you must specify a name in - * the request. + * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). The generated name is + * populated in the returned Subscription object. Note that for REST API requests, you must + * specify a name in the request. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ProjectSubscriptionName name = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
-   *   TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
-   *   Subscription request = Subscription.newBuilder()
-   *     .setName(name.toString())
-   *     .setTopic(topic.toString())
-   *     .build();
+   *   Subscription request =
+   *       Subscription.newBuilder()
+   *           .setName(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
+   *           .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
+   *           .setPushConfig(PushConfig.newBuilder().build())
+   *           .setBigqueryConfig(BigQueryConfig.newBuilder().build())
+   *           .setCloudStorageConfig(CloudStorageConfig.newBuilder().build())
+   *           .setBigtableConfig(BigtableConfig.newBuilder().build())
+   *           .setAckDeadlineSeconds(2135351438)
+   *           .setRetainAckedMessages(true)
+   *           .setMessageRetentionDuration(Duration.newBuilder().build())
+   *           .putAllLabels(new HashMap())
+   *           .setEnableMessageOrdering(true)
+   *           .setExpirationPolicy(ExpirationPolicy.newBuilder().build())
+   *           .setFilter("filter-1274492040")
+   *           .setDeadLetterPolicy(DeadLetterPolicy.newBuilder().build())
+   *           .setRetryPolicy(RetryPolicy.newBuilder().build())
+   *           .setDetached(true)
+   *           .setEnableExactlyOnceDelivery(true)
+   *           .setTopicMessageRetentionDuration(Duration.newBuilder().build())
+   *           .setAnalyticsHubSubscriptionInfo(
+   *               Subscription.AnalyticsHubSubscriptionInfo.newBuilder().build())
+   *           .addAllMessageTransforms(new ArrayList())
+   *           .putAllTags(new HashMap())
+   *           .build();
    *   Subscription response = subscriptionAdminClient.createSubscription(request);
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -414,8 +947,8 @@ public final Subscription createSubscription(Subscription request) { *

If the subscriber never acknowledges the message, the Pub/Sub system will eventually * redeliver the message. * @throws com.google.api.gax.rpc.ApiException if the remote call fails - * @deprecated Use {@link #createSubscription(ProjectSubscriptionName, TopicName, PushConfig, - * int)} instead. + * @deprecated Use {@link #createSubscription(SubscriptionName, TopicName, PushConfig, int)} + * instead. */ @Deprecated public final Subscription createSubscription( @@ -433,7 +966,7 @@ public final Subscription createSubscription( return createSubscription(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a subscription to a given topic. See the [resource name rules] * (https://cloud.google.com/pubsub/docs/admin#resource_names). If the subscription already @@ -448,87 +981,266 @@ public final Subscription createSubscription( * *

Sample code: * - *


+   * 
{@code
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   ProjectSubscriptionName name = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
-   *   TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
-   *   Subscription request = Subscription.newBuilder()
-   *     .setName(name.toString())
-   *     .setTopic(topic.toString())
-   *     .build();
-   *   ApiFuture<Subscription> future = subscriptionAdminClient.createSubscriptionCallable().futureCall(request);
-   *   // Do something
-   *   Subscription response = future.get();
-   * }
-   * 
- */ - public final UnaryCallable createSubscriptionCallable() { - return stub.createSubscriptionCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Gets the configuration details of a subscription. - * - *

Sample code: - * - *


-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
-   *   Subscription response = subscriptionAdminClient.getSubscription(subscription);
+   *   String topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString();
+   *   PushConfig pushConfig = PushConfig.newBuilder().build();
+   *   int ackDeadlineSeconds = 2135351438;
+   *   Subscription response =
+   *       subscriptionAdminClient.createSubscription(name, topic, pushConfig, ackDeadlineSeconds);
    * }
-   * 
+ * }
* - * @param subscription Required. The name of the subscription to get. Format is - * `projects/{project}/subscriptions/{sub}`. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails + * @param name Required. The name of the subscription. It must have the format + * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must start with a + * letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores + * (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 + * and 255 characters in length, and it must not start with `"goog"`. + * @param topic Required. The name of the topic from which this subscription is receiving + * messages. Format is `projects/{project}/topics/{topic}`. The value of this field will be + * `_deleted-topic_` if the topic has been deleted. + * @param pushConfig If push delivery is used with this subscription, this field is used to + * configure it. An empty `pushConfig` signifies that the subscriber will pull and ack + * messages using API methods. + * @param ackDeadlineSeconds The approximate amount of time (on a best-effort basis) Pub/Sub waits + * for the subscriber to acknowledge receipt before resending the message. In the interval + * after the message is delivered and before it is acknowledged, it is considered to be + * <i>outstanding</i>. During that time period, the message will not be + * redelivered (on a best-effort basis). + *

For pull subscriptions, this value is used as the initial value for the ack deadline. To + * override this value for a given message, call `ModifyAckDeadline` with the corresponding + * `ack_id` if using non-streaming pull or send the `ack_id` in a + * `StreamingModifyAckDeadlineRequest` if using streaming pull. The minimum custom deadline + * you can specify is 10 seconds. The maximum custom deadline you can specify is 600 seconds + * (10 minutes). If this parameter is 0, a default value of 10 seconds is used. + *

For push delivery, this value is also used to set the request timeout for the call to + * the push endpoint. + *

If the subscriber never acknowledges the message, the Pub/Sub system will eventually + * redeliver the message. + * @deprecated Use {@link #createSubscription(SubscriptionName, String, PushConfig, int)} instead. */ - public final Subscription getSubscription(ProjectSubscriptionName subscription) { - GetSubscriptionRequest request = - GetSubscriptionRequest.newBuilder() - .setSubscription(subscription == null ? null : subscription.toString()) + @Deprecated + public final Subscription createSubscription( + ProjectSubscriptionName name, String topic, PushConfig pushConfig, int ackDeadlineSeconds) { + Subscription request = + Subscription.newBuilder() + .setName(name == null ? null : name.toString()) + .setTopic(topic) + .setPushConfig(pushConfig) + .setAckDeadlineSeconds(ackDeadlineSeconds) .build(); - return getSubscription(request); + return createSubscription(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * Gets the configuration details of a subscription. + * Creates a subscription to a given topic. See the [resource name rules] + * (https://cloud.google.com/pubsub/docs/admin#resource_names). If the subscription already + * exists, returns `ALREADY_EXISTS`. If the corresponding topic doesn't exist, returns + * `NOT_FOUND`. + * + *

If the name is not provided in the request, the server will assign a random name for this + * subscription on the same project as the topic, conforming to the [resource name format] + * (https://cloud.google.com/pubsub/docs/admin#resource_names). The generated name is populated in + * the returned Subscription object. Note that for REST API requests, you must specify a name in + * the request. * *

Sample code: * - *


+   * 
{@code
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
-   *   Subscription response = subscriptionAdminClient.getSubscription(subscription.toString());
+   *   ProjectSubscriptionName name = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
+   *   TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
+   *   PushConfig pushConfig = PushConfig.newBuilder().build();
+   *   int ackDeadlineSeconds = 2135351438;
+   *   Subscription response =
+   *       subscriptionAdminClient.createSubscription(name, topic, pushConfig, ackDeadlineSeconds);
    * }
-   * 
- * - * @param subscription Required. The name of the subscription to get. Format is - * `projects/{project}/subscriptions/{sub}`. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final Subscription getSubscription(String subscription) { - GetSubscriptionRequest request = - GetSubscriptionRequest.newBuilder().setSubscription(subscription).build(); - return getSubscription(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Gets the configuration details of a subscription. + * }
+ * + * @param name Required. The name of the subscription. It must have the format + * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must start with a + * letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores + * (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 + * and 255 characters in length, and it must not start with `"goog"`. + * @param topic Required. The name of the topic from which this subscription is receiving + * messages. Format is `projects/{project}/topics/{topic}`. The value of this field will be + * `_deleted-topic_` if the topic has been deleted. + * @param pushConfig If push delivery is used with this subscription, this field is used to + * configure it. An empty `pushConfig` signifies that the subscriber will pull and ack + * messages using API methods. + * @param ackDeadlineSeconds The approximate amount of time (on a best-effort basis) Pub/Sub waits + * for the subscriber to acknowledge receipt before resending the message. In the interval + * after the message is delivered and before it is acknowledged, it is considered to be + * <i>outstanding</i>. During that time period, the message will not be + * redelivered (on a best-effort basis). + *

For pull subscriptions, this value is used as the initial value for the ack deadline. To + * override this value for a given message, call `ModifyAckDeadline` with the corresponding + * `ack_id` if using non-streaming pull or send the `ack_id` in a + * `StreamingModifyAckDeadlineRequest` if using streaming pull. The minimum custom deadline + * you can specify is 10 seconds. The maximum custom deadline you can specify is 600 seconds + * (10 minutes). If this parameter is 0, a default value of 10 seconds is used. + *

For push delivery, this value is also used to set the request timeout for the call to + * the push endpoint. + *

If the subscriber never acknowledges the message, the Pub/Sub system will eventually + * redeliver the message. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + * @deprecated Use {@link #createSubscription(SubscriptionName, TopicName, PushConfig, int)} + * instead. + */ + @Deprecated + public final Subscription createSubscription( + ProjectSubscriptionName name, + TopicName topic, + PushConfig pushConfig, + int ackDeadlineSeconds) { + Subscription request = + Subscription.newBuilder() + .setName(name == null ? null : name.toString()) + .setTopic(topic == null ? null : topic.toString()) + .setPushConfig(pushConfig) + .setAckDeadlineSeconds(ackDeadlineSeconds) + .build(); + return createSubscription(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a subscription to a given topic. See the [resource name rules] + * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). If the subscription + * already exists, returns `ALREADY_EXISTS`. If the corresponding topic doesn't exist, returns + * `NOT_FOUND`. + * + *

If the name is not provided in the request, the server will assign a random name for this + * subscription on the same project as the topic, conforming to the [resource name format] + * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). The generated name is + * populated in the returned Subscription object. Note that for REST API requests, you must + * specify a name in the request. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
-   *   GetSubscriptionRequest request = GetSubscriptionRequest.newBuilder()
-   *     .setSubscription(subscription.toString())
-   *     .build();
+   *   Subscription request =
+   *       Subscription.newBuilder()
+   *           .setName(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
+   *           .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
+   *           .setPushConfig(PushConfig.newBuilder().build())
+   *           .setBigqueryConfig(BigQueryConfig.newBuilder().build())
+   *           .setCloudStorageConfig(CloudStorageConfig.newBuilder().build())
+   *           .setBigtableConfig(BigtableConfig.newBuilder().build())
+   *           .setAckDeadlineSeconds(2135351438)
+   *           .setRetainAckedMessages(true)
+   *           .setMessageRetentionDuration(Duration.newBuilder().build())
+   *           .putAllLabels(new HashMap())
+   *           .setEnableMessageOrdering(true)
+   *           .setExpirationPolicy(ExpirationPolicy.newBuilder().build())
+   *           .setFilter("filter-1274492040")
+   *           .setDeadLetterPolicy(DeadLetterPolicy.newBuilder().build())
+   *           .setRetryPolicy(RetryPolicy.newBuilder().build())
+   *           .setDetached(true)
+   *           .setEnableExactlyOnceDelivery(true)
+   *           .setTopicMessageRetentionDuration(Duration.newBuilder().build())
+   *           .setAnalyticsHubSubscriptionInfo(
+   *               Subscription.AnalyticsHubSubscriptionInfo.newBuilder().build())
+   *           .addAllMessageTransforms(new ArrayList())
+   *           .putAllTags(new HashMap())
+   *           .build();
+   *   ApiFuture future =
+   *       subscriptionAdminClient.createSubscriptionCallable().futureCall(request);
+   *   // Do something.
+   *   Subscription response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable createSubscriptionCallable() { + return stub.createSubscriptionCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets the configuration details of a subscription. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *   SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
+   *   Subscription response = subscriptionAdminClient.getSubscription(subscription);
+   * }
+   * }
+ * + * @param subscription Required. The name of the subscription to get. Format is + * `projects/{project}/subscriptions/{sub}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Subscription getSubscription(SubscriptionName subscription) { + GetSubscriptionRequest request = + GetSubscriptionRequest.newBuilder() + .setSubscription(subscription == null ? null : subscription.toString()) + .build(); + return getSubscription(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets the configuration details of a subscription. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *   String subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
+   *   Subscription response = subscriptionAdminClient.getSubscription(subscription);
+   * }
+   * }
+ * + * @param subscription Required. The name of the subscription to get. Format is + * `projects/{project}/subscriptions/{sub}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Subscription getSubscription(String subscription) { + GetSubscriptionRequest request = + GetSubscriptionRequest.newBuilder().setSubscription(subscription).build(); + return getSubscription(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets the configuration details of a subscription. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *   GetSubscriptionRequest request =
+   *       GetSubscriptionRequest.newBuilder()
+   *           .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
+   *           .build();
    *   Subscription response = subscriptionAdminClient.getSubscription(request);
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -537,53 +1249,117 @@ public final Subscription getSubscription(GetSubscriptionRequest request) { return getSubscriptionCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets the configuration details of a subscription. * *

Sample code: * - *


+   * 
{@code
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
-   *   GetSubscriptionRequest request = GetSubscriptionRequest.newBuilder()
-   *     .setSubscription(subscription.toString())
-   *     .build();
-   *   ApiFuture<Subscription> future = subscriptionAdminClient.getSubscriptionCallable().futureCall(request);
-   *   // Do something
+   *   Subscription response = subscriptionAdminClient.getSubscription(subscription);
+   * }
+   * }
+ * + * @param subscription Required. The name of the subscription to get. Format is + * `projects/{project}/subscriptions/{sub}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + * @deprecated Use {@link #getSubscription(SubscriptionName)} instead. + */ + @Deprecated + public final Subscription getSubscription(ProjectSubscriptionName subscription) { + GetSubscriptionRequest request = + GetSubscriptionRequest.newBuilder() + .setSubscription(subscription == null ? null : subscription.toString()) + .build(); + return getSubscription(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets the configuration details of a subscription. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *   GetSubscriptionRequest request =
+   *       GetSubscriptionRequest.newBuilder()
+   *           .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
+   *           .build();
+   *   ApiFuture future =
+   *       subscriptionAdminClient.getSubscriptionCallable().futureCall(request);
+   *   // Do something.
    *   Subscription response = future.get();
    * }
-   * 
+ * }
*/ public final UnaryCallable getSubscriptionCallable() { return stub.getSubscriptionCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * Updates an existing subscription. Note that certain properties of a subscription, such as its - * topic, are not modifiable. + * Updates an existing subscription by updating the fields specified in the update mask. Note that + * certain properties of a subscription, such as its topic, are not modifiable. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *   Subscription subscription = Subscription.newBuilder().build();
+   *   FieldMask updateMask = FieldMask.newBuilder().build();
+   *   Subscription response = subscriptionAdminClient.updateSubscription(subscription, updateMask);
+   * }
+   * }
+ * + * @param subscription Required. The updated subscription object. + * @param updateMask Required. Indicates which fields in the provided subscription to update. Must + * be specified and non-empty. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Subscription updateSubscription(Subscription subscription, FieldMask updateMask) { + UpdateSubscriptionRequest request = + UpdateSubscriptionRequest.newBuilder() + .setSubscription(subscription) + .setUpdateMask(updateMask) + .build(); + return updateSubscription(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates an existing subscription by updating the fields specified in the update mask. Note that + * certain properties of a subscription, such as its topic, are not modifiable. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   int ackDeadlineSeconds = 42;
-   *   Subscription subscription = Subscription.newBuilder()
-   *     .setAckDeadlineSeconds(ackDeadlineSeconds)
-   *     .build();
-   *   String pathsElement = "ack_deadline_seconds";
-   *   List<String> paths = Arrays.asList(pathsElement);
-   *   FieldMask updateMask = FieldMask.newBuilder()
-   *     .addAllPaths(paths)
-   *     .build();
-   *   UpdateSubscriptionRequest request = UpdateSubscriptionRequest.newBuilder()
-   *     .setSubscription(subscription)
-   *     .setUpdateMask(updateMask)
-   *     .build();
+   *   UpdateSubscriptionRequest request =
+   *       UpdateSubscriptionRequest.newBuilder()
+   *           .setSubscription(Subscription.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
    *   Subscription response = subscriptionAdminClient.updateSubscription(request);
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -592,52 +1368,55 @@ public final Subscription updateSubscription(UpdateSubscriptionRequest request) return updateSubscriptionCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * Updates an existing subscription. Note that certain properties of a subscription, such as its - * topic, are not modifiable. + * Updates an existing subscription by updating the fields specified in the update mask. Note that + * certain properties of a subscription, such as its topic, are not modifiable. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   int ackDeadlineSeconds = 42;
-   *   Subscription subscription = Subscription.newBuilder()
-   *     .setAckDeadlineSeconds(ackDeadlineSeconds)
-   *     .build();
-   *   String pathsElement = "ack_deadline_seconds";
-   *   List<String> paths = Arrays.asList(pathsElement);
-   *   FieldMask updateMask = FieldMask.newBuilder()
-   *     .addAllPaths(paths)
-   *     .build();
-   *   UpdateSubscriptionRequest request = UpdateSubscriptionRequest.newBuilder()
-   *     .setSubscription(subscription)
-   *     .setUpdateMask(updateMask)
-   *     .build();
-   *   ApiFuture<Subscription> future = subscriptionAdminClient.updateSubscriptionCallable().futureCall(request);
-   *   // Do something
+   *   UpdateSubscriptionRequest request =
+   *       UpdateSubscriptionRequest.newBuilder()
+   *           .setSubscription(Subscription.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   ApiFuture future =
+   *       subscriptionAdminClient.updateSubscriptionCallable().futureCall(request);
+   *   // Do something.
    *   Subscription response = future.get();
    * }
-   * 
+ * }
*/ public final UnaryCallable updateSubscriptionCallable() { return stub.updateSubscriptionCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists matching subscriptions. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   ProjectName project = ProjectName.of("[PROJECT]");
    *   for (Subscription element : subscriptionAdminClient.listSubscriptions(project).iterateAll()) {
    *     // doThingsWith(element);
    *   }
    * }
-   * 
+ * }
* * @param project Required. The name of the project in which to list subscriptions. Format is * `projects/{project-id}`. @@ -651,20 +1430,25 @@ public final ListSubscriptionsPagedResponse listSubscriptions(ProjectName projec return listSubscriptions(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists matching subscriptions. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ProjectName project = ProjectName.of("[PROJECT]");
-   *   for (Subscription element : subscriptionAdminClient.listSubscriptions(project.toString()).iterateAll()) {
+   *   String project = ProjectName.of("[PROJECT]").toString();
+   *   for (Subscription element : subscriptionAdminClient.listSubscriptions(project).iterateAll()) {
    *     // doThingsWith(element);
    *   }
    * }
-   * 
+ * }
* * @param project Required. The name of the project in which to list subscriptions. Format is * `projects/{project-id}`. @@ -676,23 +1460,30 @@ public final ListSubscriptionsPagedResponse listSubscriptions(String project) { return listSubscriptions(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists matching subscriptions. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ProjectName project = ProjectName.of("[PROJECT]");
-   *   ListSubscriptionsRequest request = ListSubscriptionsRequest.newBuilder()
-   *     .setProject(project.toString())
-   *     .build();
+   *   ListSubscriptionsRequest request =
+   *       ListSubscriptionsRequest.newBuilder()
+   *           .setProject(ProjectName.of("[PROJECT]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
    *   for (Subscription element : subscriptionAdminClient.listSubscriptions(request).iterateAll()) {
    *     // doThingsWith(element);
    *   }
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -701,45 +1492,61 @@ public final ListSubscriptionsPagedResponse listSubscriptions(ListSubscriptionsR return listSubscriptionsPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists matching subscriptions. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ProjectName project = ProjectName.of("[PROJECT]");
-   *   ListSubscriptionsRequest request = ListSubscriptionsRequest.newBuilder()
-   *     .setProject(project.toString())
-   *     .build();
-   *   ApiFuture<ListSubscriptionsPagedResponse> future = subscriptionAdminClient.listSubscriptionsPagedCallable().futureCall(request);
-   *   // Do something
+   *   ListSubscriptionsRequest request =
+   *       ListSubscriptionsRequest.newBuilder()
+   *           .setProject(ProjectName.of("[PROJECT]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future =
+   *       subscriptionAdminClient.listSubscriptionsPagedCallable().futureCall(request);
+   *   // Do something.
    *   for (Subscription element : future.get().iterateAll()) {
    *     // doThingsWith(element);
    *   }
    * }
-   * 
+ * }
*/ public final UnaryCallable listSubscriptionsPagedCallable() { return stub.listSubscriptionsPagedCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists matching subscriptions. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ProjectName project = ProjectName.of("[PROJECT]");
-   *   ListSubscriptionsRequest request = ListSubscriptionsRequest.newBuilder()
-   *     .setProject(project.toString())
-   *     .build();
+   *   ListSubscriptionsRequest request =
+   *       ListSubscriptionsRequest.newBuilder()
+   *           .setProject(ProjectName.of("[PROJECT]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
    *   while (true) {
-   *     ListSubscriptionsResponse response = subscriptionAdminClient.listSubscriptionsCallable().call(request);
+   *     ListSubscriptionsResponse response =
+   *         subscriptionAdminClient.listSubscriptionsCallable().call(request);
    *     for (Subscription element : response.getSubscriptionsList()) {
    *       // doThingsWith(element);
    *     }
@@ -751,14 +1558,14 @@ public final ListSubscriptionsPagedResponse listSubscriptions(ListSubscriptionsR
    *     }
    *   }
    * }
-   * 
+ * }
*/ public final UnaryCallable listSubscriptionsCallable() { return stub.listSubscriptionsCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes an existing subscription. All messages retained in the subscription are immediately * dropped. Calls to `Pull` after deletion will return `NOT_FOUND`. After a subscription is @@ -767,18 +1574,23 @@ public final ListSubscriptionsPagedResponse listSubscriptions(ListSubscriptionsR * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
+   *   SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
    *   subscriptionAdminClient.deleteSubscription(subscription);
    * }
-   * 
+ * }
* * @param subscription Required. The subscription to delete. Format is * `projects/{project}/subscriptions/{sub}`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - public final void deleteSubscription(ProjectSubscriptionName subscription) { + public final void deleteSubscription(SubscriptionName subscription) { DeleteSubscriptionRequest request = DeleteSubscriptionRequest.newBuilder() .setSubscription(subscription == null ? null : subscription.toString()) @@ -786,7 +1598,7 @@ public final void deleteSubscription(ProjectSubscriptionName subscription) { deleteSubscription(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes an existing subscription. All messages retained in the subscription are immediately * dropped. Calls to `Pull` after deletion will return `NOT_FOUND`. After a subscription is @@ -795,12 +1607,17 @@ public final void deleteSubscription(ProjectSubscriptionName subscription) { * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
-   *   subscriptionAdminClient.deleteSubscription(subscription.toString());
+   *   String subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
+   *   subscriptionAdminClient.deleteSubscription(subscription);
    * }
-   * 
+ * }
* * @param subscription Required. The subscription to delete. Format is * `projects/{project}/subscriptions/{sub}`. @@ -812,7 +1629,7 @@ public final void deleteSubscription(String subscription) { deleteSubscription(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes an existing subscription. All messages retained in the subscription are immediately * dropped. Calls to `Pull` after deletion will return `NOT_FOUND`. After a subscription is @@ -821,15 +1638,20 @@ public final void deleteSubscription(String subscription) { * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
-   *   DeleteSubscriptionRequest request = DeleteSubscriptionRequest.newBuilder()
-   *     .setSubscription(subscription.toString())
-   *     .build();
+   *   DeleteSubscriptionRequest request =
+   *       DeleteSubscriptionRequest.newBuilder()
+   *           .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
+   *           .build();
    *   subscriptionAdminClient.deleteSubscription(request);
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -838,7 +1660,7 @@ public final void deleteSubscription(DeleteSubscriptionRequest request) { deleteSubscriptionCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes an existing subscription. All messages retained in the subscription are immediately * dropped. Calls to `Pull` after deletion will return `NOT_FOUND`. After a subscription is @@ -847,127 +1669,105 @@ public final void deleteSubscription(DeleteSubscriptionRequest request) { * *

Sample code: * - *


+   * 
{@code
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
-   *   DeleteSubscriptionRequest request = DeleteSubscriptionRequest.newBuilder()
-   *     .setSubscription(subscription.toString())
-   *     .build();
-   *   ApiFuture<Void> future = subscriptionAdminClient.deleteSubscriptionCallable().futureCall(request);
-   *   // Do something
-   *   future.get();
+   *   subscriptionAdminClient.deleteSubscription(subscription);
    * }
-   * 
+ * }
+ * + * @param subscription Required. The subscription to delete. Format is + * `projects/{project}/subscriptions/{sub}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + * @deprecated Use {@link #deleteSubscription(SubscriptionName)} instead. */ - public final UnaryCallable deleteSubscriptionCallable() { - return stub.deleteSubscriptionCallable(); + @Deprecated + public final void deleteSubscription(ProjectSubscriptionName subscription) { + DeleteSubscriptionRequest request = + DeleteSubscriptionRequest.newBuilder() + .setSubscription(subscription == null ? null : subscription.toString()) + .build(); + deleteSubscription(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * Gets the configuration details of a snapshot. Snapshots are used in <a - * href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a> operations, which - * allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment - * state of messages in an existing subscription to the state captured by a snapshot. + * Deletes an existing subscription. All messages retained in the subscription are immediately + * dropped. Calls to `Pull` after deletion will return `NOT_FOUND`. After a subscription is + * deleted, a new one may be created with the same name, but the new one has no association with + * the old subscription or its topic unless the same topic is specified. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ProjectSnapshotName snapshot = ProjectSnapshotName.of("[PROJECT]", "[SNAPSHOT]");
-   *   Snapshot response = subscriptionAdminClient.getSnapshot(snapshot);
+   *   DeleteSubscriptionRequest request =
+   *       DeleteSubscriptionRequest.newBuilder()
+   *           .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
+   *           .build();
+   *   ApiFuture future =
+   *       subscriptionAdminClient.deleteSubscriptionCallable().futureCall(request);
+   *   // Do something.
+   *   future.get();
    * }
-   * 
- * - * @param snapshot Required. The name of the snapshot to get. Format is - * `projects/{project}/snapshots/{snap}`. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails + * }
*/ - /* package-private */ final Snapshot getSnapshot(ProjectSnapshotName snapshot) { - GetSnapshotRequest request = - GetSnapshotRequest.newBuilder() - .setSnapshot(snapshot == null ? null : snapshot.toString()) - .build(); - return getSnapshot(request); + public final UnaryCallable deleteSubscriptionCallable() { + return stub.deleteSubscriptionCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * Gets the configuration details of a snapshot. Snapshots are used in <a - * href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a> operations, which - * allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment - * state of messages in an existing subscription to the state captured by a snapshot. + * Modifies the ack deadline for a specific message. This method is useful to indicate that more + * time is needed to process a message by the subscriber, or to make the message available for + * redelivery if the processing was interrupted. Note that this does not modify the + * subscription-level `ackDeadlineSeconds` used for subsequent messages. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ProjectSnapshotName snapshot = ProjectSnapshotName.of("[PROJECT]", "[SNAPSHOT]");
-   *   Snapshot response = subscriptionAdminClient.getSnapshot(snapshot.toString());
+   *   SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
+   *   List ackIds = new ArrayList<>();
+   *   int ackDeadlineSeconds = 2135351438;
+   *   subscriptionAdminClient.modifyAckDeadline(subscription, ackIds, ackDeadlineSeconds);
    * }
-   * 
+ * }
* - * @param snapshot Required. The name of the snapshot to get. Format is - * `projects/{project}/snapshots/{snap}`. + * @param subscription Required. The name of the subscription. Format is + * `projects/{project}/subscriptions/{sub}`. + * @param ackIds Required. List of acknowledgment IDs. + * @param ackDeadlineSeconds Required. The new ack deadline with respect to the time this request + * was sent to the Pub/Sub system. For example, if the value is 10, the new ack deadline will + * expire 10 seconds after the `ModifyAckDeadline` call was made. Specifying zero might + * immediately make the message available for delivery to another subscriber client. This + * typically results in an increase in the rate of message redeliveries (that is, duplicates). + * The minimum deadline you can specify is 0 seconds. The maximum deadline you can specify in + * a single request is 600 seconds (10 minutes). * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - /* package-private */ final Snapshot getSnapshot(String snapshot) { - GetSnapshotRequest request = GetSnapshotRequest.newBuilder().setSnapshot(snapshot).build(); - return getSnapshot(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Gets the configuration details of a snapshot. Snapshots are used in <a - * href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a> operations, which - * allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment - * state of messages in an existing subscription to the state captured by a snapshot. - * - *

Sample code: - * - *


-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ProjectSnapshotName snapshot = ProjectSnapshotName.of("[PROJECT]", "[SNAPSHOT]");
-   *   GetSnapshotRequest request = GetSnapshotRequest.newBuilder()
-   *     .setSnapshot(snapshot.toString())
-   *     .build();
-   *   Snapshot response = subscriptionAdminClient.getSnapshot(request);
-   * }
-   * 
- * - * @param request The request object containing all of the parameters for the API call. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - /* package-private */ final Snapshot getSnapshot(GetSnapshotRequest request) { - return getSnapshotCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Gets the configuration details of a snapshot. Snapshots are used in <a - * href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a> operations, which - * allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment - * state of messages in an existing subscription to the state captured by a snapshot. - * - *

Sample code: - * - *


-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ProjectSnapshotName snapshot = ProjectSnapshotName.of("[PROJECT]", "[SNAPSHOT]");
-   *   GetSnapshotRequest request = GetSnapshotRequest.newBuilder()
-   *     .setSnapshot(snapshot.toString())
-   *     .build();
-   *   ApiFuture<Snapshot> future = subscriptionAdminClient.getSnapshotCallable().futureCall(request);
-   *   // Do something
-   *   Snapshot response = future.get();
-   * }
-   * 
- */ - /* package-private */ final UnaryCallable getSnapshotCallable() { - return stub.getSnapshotCallable(); + public final void modifyAckDeadline( + SubscriptionName subscription, List ackIds, int ackDeadlineSeconds) { + ModifyAckDeadlineRequest request = + ModifyAckDeadlineRequest.newBuilder() + .setSubscription(subscription == null ? null : subscription.toString()) + .addAllAckIds(ackIds) + .setAckDeadlineSeconds(ackDeadlineSeconds) + .build(); + modifyAckDeadline(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Modifies the ack deadline for a specific message. This method is useful to indicate that more * time is needed to process a message by the subscriber, or to make the message available for @@ -976,14 +1776,19 @@ public final UnaryCallable deleteSubscriptionC * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
-   *   List<String> ackIds = new ArrayList<>();
-   *   int ackDeadlineSeconds = 0;
+   *   String subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
+   *   List ackIds = new ArrayList<>();
+   *   int ackDeadlineSeconds = 2135351438;
    *   subscriptionAdminClient.modifyAckDeadline(subscription, ackIds, ackDeadlineSeconds);
    * }
-   * 
+ * }
* * @param subscription Required. The name of the subscription. Format is * `projects/{project}/subscriptions/{sub}`. @@ -993,22 +1798,22 @@ public final UnaryCallable deleteSubscriptionC * expire 10 seconds after the `ModifyAckDeadline` call was made. Specifying zero might * immediately make the message available for delivery to another subscriber client. This * typically results in an increase in the rate of message redeliveries (that is, duplicates). - * The minimum deadline you can specify is 0 seconds. The maximum deadline you can specify is - * 600 seconds (10 minutes). + * The minimum deadline you can specify is 0 seconds. The maximum deadline you can specify in + * a single request is 600 seconds (10 minutes). * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - /* package-private */ final void modifyAckDeadline( - ProjectSubscriptionName subscription, List ackIds, int ackDeadlineSeconds) { + public final void modifyAckDeadline( + String subscription, List ackIds, int ackDeadlineSeconds) { ModifyAckDeadlineRequest request = ModifyAckDeadlineRequest.newBuilder() - .setSubscription(subscription == null ? null : subscription.toString()) + .setSubscription(subscription) .addAllAckIds(ackIds) .setAckDeadlineSeconds(ackDeadlineSeconds) .build(); modifyAckDeadline(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Modifies the ack deadline for a specific message. This method is useful to indicate that more * time is needed to process a message by the subscriber, or to make the message available for @@ -1017,14 +1822,47 @@ public final UnaryCallable deleteSubscriptionC * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *   ModifyAckDeadlineRequest request =
+   *       ModifyAckDeadlineRequest.newBuilder()
+   *           .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
+   *           .addAllAckIds(new ArrayList())
+   *           .setAckDeadlineSeconds(2135351438)
+   *           .build();
+   *   subscriptionAdminClient.modifyAckDeadline(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void modifyAckDeadline(ModifyAckDeadlineRequest request) { + modifyAckDeadlineCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Modifies the ack deadline for a specific message. This method is useful to indicate that more + * time is needed to process a message by the subscriber, or to make the message available for + * redelivery if the processing was interrupted. Note that this does not modify the + * subscription-level `ackDeadlineSeconds` used for subsequent messages. + * + *

Sample code: + * + *

{@code
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
-   *   List<String> ackIds = new ArrayList<>();
-   *   int ackDeadlineSeconds = 0;
-   *   subscriptionAdminClient.modifyAckDeadline(subscription.toString(), ackIds, ackDeadlineSeconds);
+   *   List ackIds = new ArrayList<>();
+   *   int ackDeadlineSeconds = 2135351438;
+   *   subscriptionAdminClient.modifyAckDeadline(subscription, ackIds, ackDeadlineSeconds);
    * }
-   * 
+ * }
* * @param subscription Required. The name of the subscription. Format is * `projects/{project}/subscriptions/{sub}`. @@ -1037,49 +1875,21 @@ public final UnaryCallable deleteSubscriptionC * The minimum deadline you can specify is 0 seconds. The maximum deadline you can specify is * 600 seconds (10 minutes). * @throws com.google.api.gax.rpc.ApiException if the remote call fails + * @deprecated Use {@link #modifyAckDeadline(SubscriptionName, List, int)} instead. */ - /* package-private */ final void modifyAckDeadline( - String subscription, List ackIds, int ackDeadlineSeconds) { + @Deprecated + final void modifyAckDeadline( + ProjectSubscriptionName subscription, List ackIds, int ackDeadlineSeconds) { ModifyAckDeadlineRequest request = ModifyAckDeadlineRequest.newBuilder() - .setSubscription(subscription) + .setSubscription(subscription == null ? null : subscription.toString()) .addAllAckIds(ackIds) .setAckDeadlineSeconds(ackDeadlineSeconds) .build(); modifyAckDeadline(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Modifies the ack deadline for a specific message. This method is useful to indicate that more - * time is needed to process a message by the subscriber, or to make the message available for - * redelivery if the processing was interrupted. Note that this does not modify the - * subscription-level `ackDeadlineSeconds` used for subsequent messages. - * - *

Sample code: - * - *


-   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
-   *   List<String> ackIds = new ArrayList<>();
-   *   int ackDeadlineSeconds = 0;
-   *   ModifyAckDeadlineRequest request = ModifyAckDeadlineRequest.newBuilder()
-   *     .setSubscription(subscription.toString())
-   *     .addAllAckIds(ackIds)
-   *     .setAckDeadlineSeconds(ackDeadlineSeconds)
-   *     .build();
-   *   subscriptionAdminClient.modifyAckDeadline(request);
-   * }
-   * 
- * - * @param request The request object containing all of the parameters for the API call. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - /* package-private */ final void modifyAckDeadline(ModifyAckDeadlineRequest request) { - modifyAckDeadlineCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Modifies the ack deadline for a specific message. This method is useful to indicate that more * time is needed to process a message by the subscriber, or to make the message available for @@ -1088,28 +1898,31 @@ public final UnaryCallable deleteSubscriptionC * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
-   *   List<String> ackIds = new ArrayList<>();
-   *   int ackDeadlineSeconds = 0;
-   *   ModifyAckDeadlineRequest request = ModifyAckDeadlineRequest.newBuilder()
-   *     .setSubscription(subscription.toString())
-   *     .addAllAckIds(ackIds)
-   *     .setAckDeadlineSeconds(ackDeadlineSeconds)
-   *     .build();
-   *   ApiFuture<Void> future = subscriptionAdminClient.modifyAckDeadlineCallable().futureCall(request);
-   *   // Do something
+   *   ModifyAckDeadlineRequest request =
+   *       ModifyAckDeadlineRequest.newBuilder()
+   *           .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
+   *           .addAllAckIds(new ArrayList())
+   *           .setAckDeadlineSeconds(2135351438)
+   *           .build();
+   *   ApiFuture future =
+   *       subscriptionAdminClient.modifyAckDeadlineCallable().futureCall(request);
+   *   // Do something.
    *   future.get();
    * }
-   * 
+ * }
*/ - /* package-private */ final UnaryCallable - modifyAckDeadlineCallable() { + public final UnaryCallable modifyAckDeadlineCallable() { return stub.modifyAckDeadlineCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Acknowledges the messages associated with the `ack_ids` in the `AcknowledgeRequest`. The * Pub/Sub system can remove the relevant messages from the subscription. @@ -1119,13 +1932,18 @@ public final UnaryCallable deleteSubscriptionC * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
-   *   List<String> ackIds = new ArrayList<>();
+   *   SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
+   *   List ackIds = new ArrayList<>();
    *   subscriptionAdminClient.acknowledge(subscription, ackIds);
    * }
-   * 
+ * }
* * @param subscription Required. The subscription whose message is being acknowledged. Format is * `projects/{project}/subscriptions/{sub}`. @@ -1133,8 +1951,7 @@ public final UnaryCallable deleteSubscriptionC * returned by the Pub/Sub system in the `Pull` response. Must not be empty. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - /* package-private */ final void acknowledge( - ProjectSubscriptionName subscription, List ackIds) { + public final void acknowledge(SubscriptionName subscription, List ackIds) { AcknowledgeRequest request = AcknowledgeRequest.newBuilder() .setSubscription(subscription == null ? null : subscription.toString()) @@ -1143,7 +1960,7 @@ public final UnaryCallable deleteSubscriptionC acknowledge(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Acknowledges the messages associated with the `ack_ids` in the `AcknowledgeRequest`. The * Pub/Sub system can remove the relevant messages from the subscription. @@ -1153,13 +1970,18 @@ public final UnaryCallable deleteSubscriptionC * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
-   *   List<String> ackIds = new ArrayList<>();
-   *   subscriptionAdminClient.acknowledge(subscription.toString(), ackIds);
+   *   String subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
+   *   List ackIds = new ArrayList<>();
+   *   subscriptionAdminClient.acknowledge(subscription, ackIds);
    * }
-   * 
+ * }
* * @param subscription Required. The subscription whose message is being acknowledged. Format is * `projects/{project}/subscriptions/{sub}`. @@ -1167,13 +1989,13 @@ public final UnaryCallable deleteSubscriptionC * returned by the Pub/Sub system in the `Pull` response. Must not be empty. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - /* package-private */ final void acknowledge(String subscription, List ackIds) { + public final void acknowledge(String subscription, List ackIds) { AcknowledgeRequest request = AcknowledgeRequest.newBuilder().setSubscription(subscription).addAllAckIds(ackIds).build(); acknowledge(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Acknowledges the messages associated with the `ack_ids` in the `AcknowledgeRequest`. The * Pub/Sub system can remove the relevant messages from the subscription. @@ -1183,26 +2005,30 @@ public final UnaryCallable deleteSubscriptionC * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
-   *   List<String> ackIds = new ArrayList<>();
-   *   AcknowledgeRequest request = AcknowledgeRequest.newBuilder()
-   *     .setSubscription(subscription.toString())
-   *     .addAllAckIds(ackIds)
-   *     .build();
+   *   AcknowledgeRequest request =
+   *       AcknowledgeRequest.newBuilder()
+   *           .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
+   *           .addAllAckIds(new ArrayList())
+   *           .build();
    *   subscriptionAdminClient.acknowledge(request);
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - /* package-private */ final void acknowledge(AcknowledgeRequest request) { + public final void acknowledge(AcknowledgeRequest request) { acknowledgeCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Acknowledges the messages associated with the `ack_ids` in the `AcknowledgeRequest`. The * Pub/Sub system can remove the relevant messages from the subscription. @@ -1212,39 +2038,148 @@ public final UnaryCallable deleteSubscriptionC * *

Sample code: * - *


+   * 
{@code
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
-   *   List<String> ackIds = new ArrayList<>();
-   *   AcknowledgeRequest request = AcknowledgeRequest.newBuilder()
-   *     .setSubscription(subscription.toString())
-   *     .addAllAckIds(ackIds)
-   *     .build();
-   *   ApiFuture<Void> future = subscriptionAdminClient.acknowledgeCallable().futureCall(request);
-   *   // Do something
+   *   List ackIds = new ArrayList<>();
+   *   subscriptionAdminClient.acknowledge(subscription, ackIds);
+   * }
+   * }
+ * + * @param subscription Required. The subscription whose message is being acknowledged. Format is + * `projects/{project}/subscriptions/{sub}`. + * @param ackIds Required. The acknowledgment ID for the messages being acknowledged that was + * returned by the Pub/Sub system in the `Pull` response. Must not be empty. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + * @deprecated Use {@link #acknowledge(SubscriptionName, List)} instead. + */ + @Deprecated + public final void acknowledge(ProjectSubscriptionName subscription, List ackIds) { + AcknowledgeRequest request = + AcknowledgeRequest.newBuilder() + .setSubscription(subscription == null ? null : subscription.toString()) + .addAllAckIds(ackIds) + .build(); + acknowledge(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Acknowledges the messages associated with the `ack_ids` in the `AcknowledgeRequest`. The + * Pub/Sub system can remove the relevant messages from the subscription. + * + *

Acknowledging a message whose ack deadline has expired may succeed, but such a message may + * be redelivered later. Acknowledging a message more than once will not result in an error. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *   AcknowledgeRequest request =
+   *       AcknowledgeRequest.newBuilder()
+   *           .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
+   *           .addAllAckIds(new ArrayList())
+   *           .build();
+   *   ApiFuture future = subscriptionAdminClient.acknowledgeCallable().futureCall(request);
+   *   // Do something.
    *   future.get();
    * }
-   * 
+ * }
*/ - /* package-private */ final UnaryCallable acknowledgeCallable() { + public final UnaryCallable acknowledgeCallable() { return stub.acknowledgeCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * Pulls messages from the server. The server may return `UNAVAILABLE` if there are too many - * concurrent pull requests pending for the given subscription. + * Pulls messages from the server. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
-   *   boolean returnImmediately = false;
-   *   int maxMessages = 0;
-   *   PullResponse response = subscriptionAdminClient.pull(subscription, returnImmediately, maxMessages);
+   *   SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
+   *   int maxMessages = 496131527;
+   *   PullResponse response = subscriptionAdminClient.pull(subscription, maxMessages);
    * }
-   * 
+ * }
+ * + * @param subscription Required. The subscription from which messages should be pulled. Format is + * `projects/{project}/subscriptions/{sub}`. + * @param maxMessages Required. The maximum number of messages to return for this request. Must be + * a positive integer. The Pub/Sub system may return fewer than the number specified. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final PullResponse pull(SubscriptionName subscription, int maxMessages) { + PullRequest request = + PullRequest.newBuilder() + .setSubscription(subscription == null ? null : subscription.toString()) + .setMaxMessages(maxMessages) + .build(); + return pull(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Pulls messages from the server. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *   String subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
+   *   int maxMessages = 496131527;
+   *   PullResponse response = subscriptionAdminClient.pull(subscription, maxMessages);
+   * }
+   * }
+ * + * @param subscription Required. The subscription from which messages should be pulled. Format is + * `projects/{project}/subscriptions/{sub}`. + * @param maxMessages Required. The maximum number of messages to return for this request. Must be + * a positive integer. The Pub/Sub system may return fewer than the number specified. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final PullResponse pull(String subscription, int maxMessages) { + PullRequest request = + PullRequest.newBuilder().setSubscription(subscription).setMaxMessages(maxMessages).build(); + return pull(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Pulls messages from the server. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *   SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
+   *   boolean returnImmediately = true;
+   *   int maxMessages = 496131527;
+   *   PullResponse response =
+   *       subscriptionAdminClient.pull(subscription, returnImmediately, maxMessages);
+   * }
+   * }
* * @param subscription Required. The subscription from which messages should be pulled. Format is * `projects/{project}/subscriptions/{sub}`. @@ -1258,8 +2193,8 @@ public final UnaryCallable deleteSubscriptionC * a positive integer. The Pub/Sub system may return fewer than the number specified. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - /* package-private */ final PullResponse pull( - ProjectSubscriptionName subscription, boolean returnImmediately, int maxMessages) { + public final PullResponse pull( + SubscriptionName subscription, boolean returnImmediately, int maxMessages) { PullRequest request = PullRequest.newBuilder() .setSubscription(subscription == null ? null : subscription.toString()) @@ -1269,21 +2204,26 @@ public final UnaryCallable deleteSubscriptionC return pull(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * Pulls messages from the server. The server may return `UNAVAILABLE` if there are too many - * concurrent pull requests pending for the given subscription. + * Pulls messages from the server. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
-   *   boolean returnImmediately = false;
-   *   int maxMessages = 0;
-   *   PullResponse response = subscriptionAdminClient.pull(subscription.toString(), returnImmediately, maxMessages);
+   *   String subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
+   *   boolean returnImmediately = true;
+   *   int maxMessages = 496131527;
+   *   PullResponse response =
+   *       subscriptionAdminClient.pull(subscription, returnImmediately, maxMessages);
    * }
-   * 
+ * }
* * @param subscription Required. The subscription from which messages should be pulled. Format is * `projects/{project}/subscriptions/{sub}`. @@ -1297,8 +2237,7 @@ public final UnaryCallable deleteSubscriptionC * a positive integer. The Pub/Sub system may return fewer than the number specified. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - /* package-private */ final PullResponse pull( - String subscription, boolean returnImmediately, int maxMessages) { + public final PullResponse pull(String subscription, boolean returnImmediately, int maxMessages) { PullRequest request = PullRequest.newBuilder() .setSubscription(subscription) @@ -1308,109 +2247,206 @@ public final UnaryCallable deleteSubscriptionC return pull(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * Pulls messages from the server. The server may return `UNAVAILABLE` if there are too many - * concurrent pull requests pending for the given subscription. + * Pulls messages from the server. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
-   *   int maxMessages = 0;
-   *   PullRequest request = PullRequest.newBuilder()
-   *     .setSubscription(subscription.toString())
-   *     .setMaxMessages(maxMessages)
-   *     .build();
+   *   PullRequest request =
+   *       PullRequest.newBuilder()
+   *           .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
+   *           .setReturnImmediately(true)
+   *           .setMaxMessages(496131527)
+   *           .build();
    *   PullResponse response = subscriptionAdminClient.pull(request);
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - /* package-private */ final PullResponse pull(PullRequest request) { + public final PullResponse pull(PullRequest request) { return pullCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Pulls messages from the server. The server may return `UNAVAILABLE` if there are too many * concurrent pull requests pending for the given subscription. * *

Sample code: * - *


+   * 
{@code
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
-   *   int maxMessages = 0;
-   *   PullRequest request = PullRequest.newBuilder()
-   *     .setSubscription(subscription.toString())
-   *     .setMaxMessages(maxMessages)
-   *     .build();
-   *   ApiFuture<PullResponse> future = subscriptionAdminClient.pullCallable().futureCall(request);
-   *   // Do something
-   *   PullResponse response = future.get();
+   *   int maxMessages = 496131527;
+   *   PullResponse response = subscriptionAdminClient.pull(subscription, maxMessages);
    * }
-   * 
+ * }
+ * + * @param subscription Required. The subscription from which messages should be pulled. Format is + * `projects/{project}/subscriptions/{sub}`. + * @param maxMessages Required. The maximum number of messages to return for this request. Must be + * a positive integer. The Pub/Sub system may return fewer than the number specified. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + * @deprecated Use {@link #pull(SubscriptionName, int)} instead. */ - /* package-private */ final UnaryCallable pullCallable() { - return stub.pullCallable(); + @Deprecated + public final PullResponse pull(ProjectSubscriptionName subscription, int maxMessages) { + PullRequest request = + PullRequest.newBuilder() + .setSubscription(subscription == null ? null : subscription.toString()) + .setMaxMessages(maxMessages) + .build(); + return pull(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * Establishes a stream with the server, which sends messages down to the client. The client - * streams acknowledgements and ack deadline modifications back to the server. The server will - * close the stream and return the status on any error. The server may close the stream with - * status `UNAVAILABLE` to reassign server-side resources, in which case, the client should - * re-establish the stream. Flow control can be achieved by configuring the underlying RPC - * channel. + * Pulls messages from the server. The server may return `UNAVAILABLE` if there are too many + * concurrent pull requests pending for the given subscription. * *

Sample code: * - *


+   * 
{@code
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   BidiStream<StreamingPullRequest, StreamingPullResponse> bidiStream =
-   *       subscriptionAdminClient.streamingPullCallable().call();
-   *
    *   ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
-   *   int streamAckDeadlineSeconds = 0;
-   *   StreamingPullRequest request = StreamingPullRequest.newBuilder()
-   *     .setSubscription(subscription.toString())
-   *     .setStreamAckDeadlineSeconds(streamAckDeadlineSeconds)
-   *     .build();
-   *   bidiStream.send(request);
-   *   for (StreamingPullResponse response : bidiStream) {
-   *     // Do something when receive a response
-   *   }
+   *   boolean returnImmediately = true;
+   *   int maxMessages = 496131527;
+   *   PullResponse response =
+   *       subscriptionAdminClient.pull(subscription, returnImmediately, maxMessages);
    * }
-   * 
- */ - /* package-private */ final BidiStreamingCallable - streamingPullCallable() { - return stub.streamingPullCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Modifies the `PushConfig` for a specified subscription. + * }
* - *

This may be used to change a push subscription to a pull one (signified by an empty + * @param subscription Required. The subscription from which messages should be pulled. Format is + * `projects/{project}/subscriptions/{sub}`. + * @param returnImmediately Optional. If this field set to true, the system will respond + * immediately even if it there are no messages available to return in the `Pull` response. + * Otherwise, the system may wait (for a bounded amount of time) until at least one message is + * available, rather than returning no messages. Warning: setting this field to `true` is + * discouraged because it adversely impacts the performance of `Pull` operations. We recommend + * that users do not set this field. + * @param maxMessages Required. The maximum number of messages to return for this request. Must be + * a positive integer. The Pub/Sub system may return fewer than the number specified. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + * @deprecated Use {@link #pull(SubscriptionName, boolean, int)} instead. + */ + @Deprecated + final PullResponse pull( + ProjectSubscriptionName subscription, boolean returnImmediately, int maxMessages) { + PullRequest request = + PullRequest.newBuilder() + .setSubscription(subscription == null ? null : subscription.toString()) + .setReturnImmediately(returnImmediately) + .setMaxMessages(maxMessages) + .build(); + return pull(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Pulls messages from the server. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *   PullRequest request =
+   *       PullRequest.newBuilder()
+   *           .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
+   *           .setReturnImmediately(true)
+   *           .setMaxMessages(496131527)
+   *           .build();
+   *   ApiFuture future = subscriptionAdminClient.pullCallable().futureCall(request);
+   *   // Do something.
+   *   PullResponse response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable pullCallable() { + return stub.pullCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Establishes a stream with the server, which sends messages down to the client. The client + * streams acknowledgments and ack deadline modifications back to the server. The server will + * close the stream and return the status on any error. The server may close the stream with + * status `UNAVAILABLE` to reassign server-side resources, in which case, the client should + * re-establish the stream. Flow control can be achieved by configuring the underlying RPC + * channel. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *   BidiStream bidiStream =
+   *       subscriptionAdminClient.streamingPullCallable().call();
+   *   StreamingPullRequest request =
+   *       StreamingPullRequest.newBuilder()
+   *           .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
+   *           .addAllAckIds(new ArrayList())
+   *           .addAllModifyDeadlineSeconds(new ArrayList())
+   *           .addAllModifyDeadlineAckIds(new ArrayList())
+   *           .setStreamAckDeadlineSeconds(1875467245)
+   *           .setClientId("clientId908408390")
+   *           .setMaxOutstandingMessages(-1315266996)
+   *           .setMaxOutstandingBytes(-2103098517)
+   *           .setProtocolVersion(-1161610703)
+   *           .build();
+   *   bidiStream.send(request);
+   *   for (StreamingPullResponse response : bidiStream) {
+   *     // Do something when a response is received.
+   *   }
+   * }
+   * }
+ */ + public final BidiStreamingCallable + streamingPullCallable() { + return stub.streamingPullCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Modifies the `PushConfig` for a specified subscription. + * + *

This may be used to change a push subscription to a pull one (signified by an empty * `PushConfig`) or vice versa, or change the endpoint URL and other attributes of a push * subscription. Messages will accumulate for delivery continuously through the call regardless of * changes to the `PushConfig`. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
+   *   SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
    *   PushConfig pushConfig = PushConfig.newBuilder().build();
    *   subscriptionAdminClient.modifyPushConfig(subscription, pushConfig);
    * }
-   * 
+ * }
* * @param subscription Required. The name of the subscription. Format is * `projects/{project}/subscriptions/{sub}`. @@ -1420,7 +2456,7 @@ public final UnaryCallable deleteSubscriptionC * pausing the subscription if `Pull` or `StreamingPull` is not called. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - public final void modifyPushConfig(ProjectSubscriptionName subscription, PushConfig pushConfig) { + public final void modifyPushConfig(SubscriptionName subscription, PushConfig pushConfig) { ModifyPushConfigRequest request = ModifyPushConfigRequest.newBuilder() .setSubscription(subscription == null ? null : subscription.toString()) @@ -1429,7 +2465,7 @@ public final void modifyPushConfig(ProjectSubscriptionName subscription, PushCon modifyPushConfig(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Modifies the `PushConfig` for a specified subscription. * @@ -1440,13 +2476,18 @@ public final void modifyPushConfig(ProjectSubscriptionName subscription, PushCon * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
+   *   String subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
    *   PushConfig pushConfig = PushConfig.newBuilder().build();
-   *   subscriptionAdminClient.modifyPushConfig(subscription.toString(), pushConfig);
+   *   subscriptionAdminClient.modifyPushConfig(subscription, pushConfig);
    * }
-   * 
+ * }
* * @param subscription Required. The name of the subscription. Format is * `projects/{project}/subscriptions/{sub}`. @@ -1465,7 +2506,7 @@ public final void modifyPushConfig(String subscription, PushConfig pushConfig) { modifyPushConfig(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Modifies the `PushConfig` for a specified subscription. * @@ -1476,17 +2517,21 @@ public final void modifyPushConfig(String subscription, PushConfig pushConfig) { * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
-   *   PushConfig pushConfig = PushConfig.newBuilder().build();
-   *   ModifyPushConfigRequest request = ModifyPushConfigRequest.newBuilder()
-   *     .setSubscription(subscription.toString())
-   *     .setPushConfig(pushConfig)
-   *     .build();
+   *   ModifyPushConfigRequest request =
+   *       ModifyPushConfigRequest.newBuilder()
+   *           .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
+   *           .setPushConfig(PushConfig.newBuilder().build())
+   *           .build();
    *   subscriptionAdminClient.modifyPushConfig(request);
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -1495,7 +2540,7 @@ public final void modifyPushConfig(ModifyPushConfigRequest request) { modifyPushConfigCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Modifies the `PushConfig` for a specified subscription. * @@ -1506,25 +2551,223 @@ public final void modifyPushConfig(ModifyPushConfigRequest request) { * *

Sample code: * - *


+   * 
{@code
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
    *   PushConfig pushConfig = PushConfig.newBuilder().build();
-   *   ModifyPushConfigRequest request = ModifyPushConfigRequest.newBuilder()
-   *     .setSubscription(subscription.toString())
-   *     .setPushConfig(pushConfig)
-   *     .build();
-   *   ApiFuture<Void> future = subscriptionAdminClient.modifyPushConfigCallable().futureCall(request);
-   *   // Do something
+   *   subscriptionAdminClient.modifyPushConfig(subscription, pushConfig);
+   * }
+   * }
+ * + * @param subscription Required. The name of the subscription. Format is + * `projects/{project}/subscriptions/{sub}`. + * @param pushConfig Required. The push configuration for future deliveries. + *

An empty `pushConfig` indicates that the Pub/Sub system should stop pushing messages + * from the given subscription and allow messages to be pulled and acknowledged - effectively + * pausing the subscription if `Pull` or `StreamingPull` is not called. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + * @deprecated Use {@link #modifyPushConfig(SubscriptionName, PushConfig)} instead. + */ + @Deprecated + public final void modifyPushConfig(ProjectSubscriptionName subscription, PushConfig pushConfig) { + ModifyPushConfigRequest request = + ModifyPushConfigRequest.newBuilder() + .setSubscription(subscription == null ? null : subscription.toString()) + .setPushConfig(pushConfig) + .build(); + modifyPushConfig(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Modifies the `PushConfig` for a specified subscription. + * + *

This may be used to change a push subscription to a pull one (signified by an empty + * `PushConfig`) or vice versa, or change the endpoint URL and other attributes of a push + * subscription. Messages will accumulate for delivery continuously through the call regardless of + * changes to the `PushConfig`. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *   ModifyPushConfigRequest request =
+   *       ModifyPushConfigRequest.newBuilder()
+   *           .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
+   *           .setPushConfig(PushConfig.newBuilder().build())
+   *           .build();
+   *   ApiFuture future =
+   *       subscriptionAdminClient.modifyPushConfigCallable().futureCall(request);
+   *   // Do something.
    *   future.get();
    * }
-   * 
+ * }
*/ public final UnaryCallable modifyPushConfigCallable() { return stub.modifyPushConfigCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets the configuration details of a snapshot. Snapshots are used in + * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to + * manage message acknowledgments in bulk. That is, you can set the acknowledgment state of + * messages in an existing subscription to the state captured by a snapshot. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *   SnapshotName snapshot = SnapshotName.of("[PROJECT]", "[SNAPSHOT]");
+   *   Snapshot response = subscriptionAdminClient.getSnapshot(snapshot);
+   * }
+   * }
+ * + * @param snapshot Required. The name of the snapshot to get. Format is + * `projects/{project}/snapshots/{snap}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Snapshot getSnapshot(SnapshotName snapshot) { + GetSnapshotRequest request = + GetSnapshotRequest.newBuilder() + .setSnapshot(snapshot == null ? null : snapshot.toString()) + .build(); + return getSnapshot(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets the configuration details of a snapshot. Snapshots are used in + * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to + * manage message acknowledgments in bulk. That is, you can set the acknowledgment state of + * messages in an existing subscription to the state captured by a snapshot. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *   String snapshot = SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString();
+   *   Snapshot response = subscriptionAdminClient.getSnapshot(snapshot);
+   * }
+   * }
+ * + * @param snapshot Required. The name of the snapshot to get. Format is + * `projects/{project}/snapshots/{snap}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Snapshot getSnapshot(String snapshot) { + GetSnapshotRequest request = GetSnapshotRequest.newBuilder().setSnapshot(snapshot).build(); + return getSnapshot(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets the configuration details of a snapshot. Snapshots are used in + * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to + * manage message acknowledgments in bulk. That is, you can set the acknowledgment state of + * messages in an existing subscription to the state captured by a snapshot. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *   GetSnapshotRequest request =
+   *       GetSnapshotRequest.newBuilder()
+   *           .setSnapshot(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString())
+   *           .build();
+   *   Snapshot response = subscriptionAdminClient.getSnapshot(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Snapshot getSnapshot(GetSnapshotRequest request) { + return getSnapshotCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets the configuration details of a snapshot. Snapshots are used in <a + * href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a> operations, which + * allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment + * state of messages in an existing subscription to the state captured by a snapshot. + * + *

Sample code: + * + *

{@code
+   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *   ProjectSnapshotName snapshot = ProjectSnapshotName.of("[PROJECT]", "[SNAPSHOT]");
+   *   Snapshot response = subscriptionAdminClient.getSnapshot(snapshot);
+   * }
+   * }
+ * + * @param snapshot Required. The name of the snapshot to get. Format is + * `projects/{project}/snapshots/{snap}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + * @deprecated Use Use {@link #getSnapshot(SnapshotName)} instead. + */ + @Deprecated + public final Snapshot getSnapshot(ProjectSnapshotName snapshot) { + GetSnapshotRequest request = + GetSnapshotRequest.newBuilder() + .setSnapshot(snapshot == null ? null : snapshot.toString()) + .build(); + return getSnapshot(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets the configuration details of a snapshot. Snapshots are used in + * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to + * manage message acknowledgments in bulk. That is, you can set the acknowledgment state of + * messages in an existing subscription to the state captured by a snapshot. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *   GetSnapshotRequest request =
+   *       GetSnapshotRequest.newBuilder()
+   *           .setSnapshot(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString())
+   *           .build();
+   *   ApiFuture future =
+   *       subscriptionAdminClient.getSnapshotCallable().futureCall(request);
+   *   // Do something.
+   *   Snapshot response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getSnapshotCallable() { + return stub.getSnapshotCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists the existing snapshots. Snapshots are used in [Seek]( * https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage @@ -1533,14 +2776,19 @@ public final UnaryCallable modifyPushConfigCalla * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   ProjectName project = ProjectName.of("[PROJECT]");
    *   for (Snapshot element : subscriptionAdminClient.listSnapshots(project).iterateAll()) {
    *     // doThingsWith(element);
    *   }
    * }
-   * 
+ * }
* * @param project Required. The name of the project in which to list snapshots. Format is * `projects/{project-id}`. @@ -1554,7 +2802,7 @@ public final ListSnapshotsPagedResponse listSnapshots(ProjectName project) { return listSnapshots(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists the existing snapshots. Snapshots are used in [Seek]( * https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage @@ -1563,14 +2811,19 @@ public final ListSnapshotsPagedResponse listSnapshots(ProjectName project) { * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ProjectName project = ProjectName.of("[PROJECT]");
-   *   for (Snapshot element : subscriptionAdminClient.listSnapshots(project.toString()).iterateAll()) {
+   *   String project = ProjectName.of("[PROJECT]").toString();
+   *   for (Snapshot element : subscriptionAdminClient.listSnapshots(project).iterateAll()) {
    *     // doThingsWith(element);
    *   }
    * }
-   * 
+ * }
* * @param project Required. The name of the project in which to list snapshots. Format is * `projects/{project-id}`. @@ -1581,7 +2834,7 @@ public final ListSnapshotsPagedResponse listSnapshots(String project) { return listSnapshots(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists the existing snapshots. Snapshots are used in [Seek]( * https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage @@ -1590,88 +2843,362 @@ public final ListSnapshotsPagedResponse listSnapshots(String project) { * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ProjectName project = ProjectName.of("[PROJECT]");
-   *   ListSnapshotsRequest request = ListSnapshotsRequest.newBuilder()
-   *     .setProject(project.toString())
-   *     .build();
+   *   ListSnapshotsRequest request =
+   *       ListSnapshotsRequest.newBuilder()
+   *           .setProject(ProjectName.of("[PROJECT]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
    *   for (Snapshot element : subscriptionAdminClient.listSnapshots(request).iterateAll()) {
    *     // doThingsWith(element);
    *   }
    * }
-   * 
+ * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListSnapshotsPagedResponse listSnapshots(ListSnapshotsRequest request) { + return listSnapshotsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists the existing snapshots. Snapshots are used in [Seek]( + * https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage + * message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in + * an existing subscription to the state captured by a snapshot. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *   ListSnapshotsRequest request =
+   *       ListSnapshotsRequest.newBuilder()
+   *           .setProject(ProjectName.of("[PROJECT]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future =
+   *       subscriptionAdminClient.listSnapshotsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Snapshot element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listSnapshotsPagedCallable() { + return stub.listSnapshotsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists the existing snapshots. Snapshots are used in [Seek]( + * https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage + * message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in + * an existing subscription to the state captured by a snapshot. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *   ListSnapshotsRequest request =
+   *       ListSnapshotsRequest.newBuilder()
+   *           .setProject(ProjectName.of("[PROJECT]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   while (true) {
+   *     ListSnapshotsResponse response =
+   *         subscriptionAdminClient.listSnapshotsCallable().call(request);
+   *     for (Snapshot element : response.getSnapshotsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable listSnapshotsCallable() { + return stub.listSnapshotsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a snapshot from the requested subscription. Snapshots are used in + * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to + * manage message acknowledgments in bulk. That is, you can set the acknowledgment state of + * messages in an existing subscription to the state captured by a snapshot. If the snapshot + * already exists, returns `ALREADY_EXISTS`. If the requested subscription doesn't exist, returns + * `NOT_FOUND`. If the backlog in the subscription is too old -- and the resulting snapshot would + * expire in less than 1 hour -- then `FAILED_PRECONDITION` is returned. See also the + * `Snapshot.expire_time` field. If the name is not provided in the request, the server will + * assign a random name for this snapshot on the same project as the subscription, conforming to + * the [resource name format] (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). + * The generated name is populated in the returned Snapshot object. Note that for REST API + * requests, you must specify a name in the request. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *   SnapshotName name = SnapshotName.of("[PROJECT]", "[SNAPSHOT]");
+   *   SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
+   *   Snapshot response = subscriptionAdminClient.createSnapshot(name, subscription);
+   * }
+   * }
+ * + * @param name Required. User-provided name for this snapshot. If the name is not provided in the + * request, the server will assign a random name for this snapshot on the same project as the + * subscription. Note that for REST API requests, you must specify a name. See the [resource + * name rules](https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). Format is + * `projects/{project}/snapshots/{snap}`. + * @param subscription Required. The subscription whose backlog the snapshot retains. + * Specifically, the created snapshot is guaranteed to retain: (a) The existing backlog on the + * subscription. More precisely, this is defined as the messages in the subscription's backlog + * that are unacknowledged upon the successful completion of the `CreateSnapshot` request; as + * well as: (b) Any messages published to the subscription's topic following the successful + * completion of the CreateSnapshot request. Format is + * `projects/{project}/subscriptions/{sub}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Snapshot createSnapshot(SnapshotName name, SubscriptionName subscription) { + CreateSnapshotRequest request = + CreateSnapshotRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .setSubscription(subscription == null ? null : subscription.toString()) + .build(); + return createSnapshot(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a snapshot from the requested subscription. Snapshots are used in + * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to + * manage message acknowledgments in bulk. That is, you can set the acknowledgment state of + * messages in an existing subscription to the state captured by a snapshot. If the snapshot + * already exists, returns `ALREADY_EXISTS`. If the requested subscription doesn't exist, returns + * `NOT_FOUND`. If the backlog in the subscription is too old -- and the resulting snapshot would + * expire in less than 1 hour -- then `FAILED_PRECONDITION` is returned. See also the + * `Snapshot.expire_time` field. If the name is not provided in the request, the server will + * assign a random name for this snapshot on the same project as the subscription, conforming to + * the [resource name format] (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). + * The generated name is populated in the returned Snapshot object. Note that for REST API + * requests, you must specify a name in the request. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *   SnapshotName name = SnapshotName.of("[PROJECT]", "[SNAPSHOT]");
+   *   String subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
+   *   Snapshot response = subscriptionAdminClient.createSnapshot(name, subscription);
+   * }
+   * }
+ * + * @param name Required. User-provided name for this snapshot. If the name is not provided in the + * request, the server will assign a random name for this snapshot on the same project as the + * subscription. Note that for REST API requests, you must specify a name. See the [resource + * name rules](https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). Format is + * `projects/{project}/snapshots/{snap}`. + * @param subscription Required. The subscription whose backlog the snapshot retains. + * Specifically, the created snapshot is guaranteed to retain: (a) The existing backlog on the + * subscription. More precisely, this is defined as the messages in the subscription's backlog + * that are unacknowledged upon the successful completion of the `CreateSnapshot` request; as + * well as: (b) Any messages published to the subscription's topic following the successful + * completion of the CreateSnapshot request. Format is + * `projects/{project}/subscriptions/{sub}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Snapshot createSnapshot(SnapshotName name, String subscription) { + CreateSnapshotRequest request = + CreateSnapshotRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .setSubscription(subscription) + .build(); + return createSnapshot(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a snapshot from the requested subscription. Snapshots are used in + * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to + * manage message acknowledgments in bulk. That is, you can set the acknowledgment state of + * messages in an existing subscription to the state captured by a snapshot. If the snapshot + * already exists, returns `ALREADY_EXISTS`. If the requested subscription doesn't exist, returns + * `NOT_FOUND`. If the backlog in the subscription is too old -- and the resulting snapshot would + * expire in less than 1 hour -- then `FAILED_PRECONDITION` is returned. See also the + * `Snapshot.expire_time` field. If the name is not provided in the request, the server will + * assign a random name for this snapshot on the same project as the subscription, conforming to + * the [resource name format] (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). + * The generated name is populated in the returned Snapshot object. Note that for REST API + * requests, you must specify a name in the request. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *   String name = SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString();
+   *   SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
+   *   Snapshot response = subscriptionAdminClient.createSnapshot(name, subscription);
+   * }
+   * }
* - * @param request The request object containing all of the parameters for the API call. + * @param name Required. User-provided name for this snapshot. If the name is not provided in the + * request, the server will assign a random name for this snapshot on the same project as the + * subscription. Note that for REST API requests, you must specify a name. See the [resource + * name rules](https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). Format is + * `projects/{project}/snapshots/{snap}`. + * @param subscription Required. The subscription whose backlog the snapshot retains. + * Specifically, the created snapshot is guaranteed to retain: (a) The existing backlog on the + * subscription. More precisely, this is defined as the messages in the subscription's backlog + * that are unacknowledged upon the successful completion of the `CreateSnapshot` request; as + * well as: (b) Any messages published to the subscription's topic following the successful + * completion of the CreateSnapshot request. Format is + * `projects/{project}/subscriptions/{sub}`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - public final ListSnapshotsPagedResponse listSnapshots(ListSnapshotsRequest request) { - return listSnapshotsPagedCallable().call(request); + public final Snapshot createSnapshot(String name, SubscriptionName subscription) { + CreateSnapshotRequest request = + CreateSnapshotRequest.newBuilder() + .setName(name) + .setSubscription(subscription == null ? null : subscription.toString()) + .build(); + return createSnapshot(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * Lists the existing snapshots. Snapshots are used in [Seek]( - * https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage - * message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in - * an existing subscription to the state captured by a snapshot. + * Creates a snapshot from the requested subscription. Snapshots are used in + * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to + * manage message acknowledgments in bulk. That is, you can set the acknowledgment state of + * messages in an existing subscription to the state captured by a snapshot. If the snapshot + * already exists, returns `ALREADY_EXISTS`. If the requested subscription doesn't exist, returns + * `NOT_FOUND`. If the backlog in the subscription is too old -- and the resulting snapshot would + * expire in less than 1 hour -- then `FAILED_PRECONDITION` is returned. See also the + * `Snapshot.expire_time` field. If the name is not provided in the request, the server will + * assign a random name for this snapshot on the same project as the subscription, conforming to + * the [resource name format] (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). + * The generated name is populated in the returned Snapshot object. Note that for REST API + * requests, you must specify a name in the request. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ProjectName project = ProjectName.of("[PROJECT]");
-   *   ListSnapshotsRequest request = ListSnapshotsRequest.newBuilder()
-   *     .setProject(project.toString())
-   *     .build();
-   *   ApiFuture<ListSnapshotsPagedResponse> future = subscriptionAdminClient.listSnapshotsPagedCallable().futureCall(request);
-   *   // Do something
-   *   for (Snapshot element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
+   *   String name = SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString();
+   *   String subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
+   *   Snapshot response = subscriptionAdminClient.createSnapshot(name, subscription);
    * }
-   * 
+ * }
+ * + * @param name Required. User-provided name for this snapshot. If the name is not provided in the + * request, the server will assign a random name for this snapshot on the same project as the + * subscription. Note that for REST API requests, you must specify a name. See the [resource + * name rules](https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). Format is + * `projects/{project}/snapshots/{snap}`. + * @param subscription Required. The subscription whose backlog the snapshot retains. + * Specifically, the created snapshot is guaranteed to retain: (a) The existing backlog on the + * subscription. More precisely, this is defined as the messages in the subscription's backlog + * that are unacknowledged upon the successful completion of the `CreateSnapshot` request; as + * well as: (b) Any messages published to the subscription's topic following the successful + * completion of the CreateSnapshot request. Format is + * `projects/{project}/subscriptions/{sub}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - public final UnaryCallable - listSnapshotsPagedCallable() { - return stub.listSnapshotsPagedCallable(); + public final Snapshot createSnapshot(String name, String subscription) { + CreateSnapshotRequest request = + CreateSnapshotRequest.newBuilder().setName(name).setSubscription(subscription).build(); + return createSnapshot(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * Lists the existing snapshots. Snapshots are used in [Seek]( - * https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage - * message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in - * an existing subscription to the state captured by a snapshot. + * Creates a snapshot from the requested subscription. Snapshots are used in + * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to + * manage message acknowledgments in bulk. That is, you can set the acknowledgment state of + * messages in an existing subscription to the state captured by a snapshot. If the snapshot + * already exists, returns `ALREADY_EXISTS`. If the requested subscription doesn't exist, returns + * `NOT_FOUND`. If the backlog in the subscription is too old -- and the resulting snapshot would + * expire in less than 1 hour -- then `FAILED_PRECONDITION` is returned. See also the + * `Snapshot.expire_time` field. If the name is not provided in the request, the server will + * assign a random name for this snapshot on the same project as the subscription, conforming to + * the [resource name format] (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). + * The generated name is populated in the returned Snapshot object. Note that for REST API + * requests, you must specify a name in the request. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ProjectName project = ProjectName.of("[PROJECT]");
-   *   ListSnapshotsRequest request = ListSnapshotsRequest.newBuilder()
-   *     .setProject(project.toString())
-   *     .build();
-   *   while (true) {
-   *     ListSnapshotsResponse response = subscriptionAdminClient.listSnapshotsCallable().call(request);
-   *     for (Snapshot element : response.getSnapshotsList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
-   *     }
-   *   }
+   *   CreateSnapshotRequest request =
+   *       CreateSnapshotRequest.newBuilder()
+   *           .setName(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString())
+   *           .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
+   *           .putAllLabels(new HashMap())
+   *           .putAllTags(new HashMap())
+   *           .build();
+   *   Snapshot response = subscriptionAdminClient.createSnapshot(request);
    * }
-   * 
+ * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - public final UnaryCallable listSnapshotsCallable() { - return stub.listSnapshotsCallable(); + public final Snapshot createSnapshot(CreateSnapshotRequest request) { + return createSnapshotCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a snapshot from the requested subscription. Snapshots are used in * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to @@ -1688,13 +3215,13 @@ public final UnaryCallable listSnap * *

Sample code: * - *


+   * 
{@code
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   ProjectSnapshotName name = ProjectSnapshotName.of("[PROJECT]", "[SNAPSHOT]");
    *   ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
    *   Snapshot response = subscriptionAdminClient.createSnapshot(name, subscription);
    * }
-   * 
+ * }
* * @param name Required. User-provided name for this snapshot. If the name is not provided in the * request, the server will assign a random name for this snapshot on the same project as the @@ -1709,7 +3236,9 @@ public final UnaryCallable listSnap * completion of the CreateSnapshot request. Format is * `projects/{project}/subscriptions/{sub}`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails + * @deprecated Use Use {@link #createSnapshot(SnapshotName, SubscriptionName)} instead. */ + @Deprecated public final Snapshot createSnapshot( ProjectSnapshotName name, ProjectSubscriptionName subscription) { CreateSnapshotRequest request = @@ -1720,7 +3249,7 @@ public final Snapshot createSnapshot( return createSnapshot(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a snapshot from the requested subscription. Snapshots are used in * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to @@ -1737,13 +3266,13 @@ public final Snapshot createSnapshot( * *

Sample code: * - *


+   * 
{@code
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ProjectSnapshotName name = ProjectSnapshotName.of("[PROJECT]", "[SNAPSHOT]");
+   *   String name = ProjectSnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString();
    *   ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
-   *   Snapshot response = subscriptionAdminClient.createSnapshot(name.toString(), subscription.toString());
+   *   Snapshot response = subscriptionAdminClient.createSnapshot(name, subscription);
    * }
-   * 
+ * }
* * @param name Required. User-provided name for this snapshot. If the name is not provided in the * request, the server will assign a random name for this snapshot on the same project as the @@ -1758,14 +3287,19 @@ public final Snapshot createSnapshot( * completion of the CreateSnapshot request. Format is * `projects/{project}/subscriptions/{sub}`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails + * @deprecated Use Use {@link #createSnapshot(String, SubscriptionName)} instead. */ - public final Snapshot createSnapshot(String name, String subscription) { + @Deprecated + public final Snapshot createSnapshot(String name, ProjectSubscriptionName subscription) { CreateSnapshotRequest request = - CreateSnapshotRequest.newBuilder().setName(name).setSubscription(subscription).build(); + CreateSnapshotRequest.newBuilder() + .setName(name) + .setSubscription(subscription == null ? null : subscription.toString()) + .build(); return createSnapshot(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a snapshot from the requested subscription. Snapshots are used in * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to @@ -1782,26 +3316,40 @@ public final Snapshot createSnapshot(String name, String subscription) { * *

Sample code: * - *


+   * 
{@code
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   ProjectSnapshotName name = ProjectSnapshotName.of("[PROJECT]", "[SNAPSHOT]");
-   *   ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
-   *   CreateSnapshotRequest request = CreateSnapshotRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .setSubscription(subscription.toString())
-   *     .build();
-   *   Snapshot response = subscriptionAdminClient.createSnapshot(request);
+   *   String subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
+   *   Snapshot response = subscriptionAdminClient.createSnapshot(name, subscription);
    * }
-   * 
+ * }
* - * @param request The request object containing all of the parameters for the API call. + * @param name Required. User-provided name for this snapshot. If the name is not provided in the + * request, the server will assign a random name for this snapshot on the same project as the + * subscription. Note that for REST API requests, you must specify a name. See the <a + * href="https://cloud.google.com/pubsub/docs/admin#resource_names"> resource name + * rules</a>. Format is `projects/{project}/snapshots/{snap}`. + * @param subscription Required. The subscription whose backlog the snapshot retains. + * Specifically, the created snapshot is guaranteed to retain: (a) The existing backlog on the + * subscription. More precisely, this is defined as the messages in the subscription's backlog + * that are unacknowledged upon the successful completion of the `CreateSnapshot` request; as + * well as: (b) Any messages published to the subscription's topic following the successful + * completion of the CreateSnapshot request. Format is + * `projects/{project}/subscriptions/{sub}`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails + * @deprecated Use Use {@link #createSnapshot(SnapshotName, String)} instead. */ - public final Snapshot createSnapshot(CreateSnapshotRequest request) { - return createSnapshotCallable().call(request); + @Deprecated + public final Snapshot createSnapshot(ProjectSnapshotName name, String subscription) { + CreateSnapshotRequest request = + CreateSnapshotRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .setSubscription(subscription) + .build(); + return createSnapshot(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a snapshot from the requested subscription. Snapshots are used in * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to @@ -1812,60 +3360,94 @@ public final Snapshot createSnapshot(CreateSnapshotRequest request) { * expire in less than 1 hour -- then `FAILED_PRECONDITION` is returned. See also the * `Snapshot.expire_time` field. If the name is not provided in the request, the server will * assign a random name for this snapshot on the same project as the subscription, conforming to - * the [resource name format] (https://cloud.google.com/pubsub/docs/admin#resource_names). The - * generated name is populated in the returned Snapshot object. Note that for REST API requests, - * you must specify a name in the request. + * the [resource name format] (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). + * The generated name is populated in the returned Snapshot object. Note that for REST API + * requests, you must specify a name in the request. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ProjectSnapshotName name = ProjectSnapshotName.of("[PROJECT]", "[SNAPSHOT]");
-   *   ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
-   *   CreateSnapshotRequest request = CreateSnapshotRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .setSubscription(subscription.toString())
-   *     .build();
-   *   ApiFuture<Snapshot> future = subscriptionAdminClient.createSnapshotCallable().futureCall(request);
-   *   // Do something
+   *   CreateSnapshotRequest request =
+   *       CreateSnapshotRequest.newBuilder()
+   *           .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);
+   *   // Do something.
    *   Snapshot response = future.get();
    * }
-   * 
+ * }
*/ public final UnaryCallable createSnapshotCallable() { return stub.createSnapshotCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * Updates an existing snapshot. Snapshots are used in <a - * href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a> operations, which - * allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment - * state of messages in an existing subscription to the state captured by a snapshot. + * Updates an existing snapshot by updating the fields specified in the update mask. Snapshots are + * used in [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow + * you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of + * messages in an existing subscription to the state captured by a snapshot. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *   Snapshot snapshot = Snapshot.newBuilder().build();
+   *   FieldMask updateMask = FieldMask.newBuilder().build();
+   *   Snapshot response = subscriptionAdminClient.updateSnapshot(snapshot, updateMask);
+   * }
+   * }
+ * + * @param snapshot Required. The updated snapshot object. + * @param updateMask Required. Indicates which fields in the provided snapshot to update. Must be + * specified and non-empty. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Snapshot updateSnapshot(Snapshot snapshot, FieldMask updateMask) { + UpdateSnapshotRequest request = + UpdateSnapshotRequest.newBuilder().setSnapshot(snapshot).setUpdateMask(updateMask).build(); + return updateSnapshot(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates an existing snapshot by updating the fields specified in the update mask. Snapshots are + * used in [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow + * you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of + * messages in an existing subscription to the state captured by a snapshot. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   long seconds = 123456L;
-   *   Timestamp expireTime = Timestamp.newBuilder()
-   *     .setSeconds(seconds)
-   *     .build();
-   *   Snapshot snapshot = Snapshot.newBuilder()
-   *     .setExpireTime(expireTime)
-   *     .build();
-   *   String pathsElement = "expire_time";
-   *   List<String> paths = Arrays.asList(pathsElement);
-   *   FieldMask updateMask = FieldMask.newBuilder()
-   *     .addAllPaths(paths)
-   *     .build();
-   *   UpdateSnapshotRequest request = UpdateSnapshotRequest.newBuilder()
-   *     .setSnapshot(snapshot)
-   *     .setUpdateMask(updateMask)
-   *     .build();
+   *   UpdateSnapshotRequest request =
+   *       UpdateSnapshotRequest.newBuilder()
+   *           .setSnapshot(Snapshot.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
    *   Snapshot response = subscriptionAdminClient.updateSnapshot(request);
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -1874,44 +3456,39 @@ public final Snapshot updateSnapshot(UpdateSnapshotRequest request) { return updateSnapshotCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * Updates an existing snapshot. Snapshots are used in <a - * href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a> operations, which - * allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment - * state of messages in an existing subscription to the state captured by a snapshot. + * Updates an existing snapshot by updating the fields specified in the update mask. Snapshots are + * used in [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow + * you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of + * messages in an existing subscription to the state captured by a snapshot. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   long seconds = 123456L;
-   *   Timestamp expireTime = Timestamp.newBuilder()
-   *     .setSeconds(seconds)
-   *     .build();
-   *   Snapshot snapshot = Snapshot.newBuilder()
-   *     .setExpireTime(expireTime)
-   *     .build();
-   *   String pathsElement = "expire_time";
-   *   List<String> paths = Arrays.asList(pathsElement);
-   *   FieldMask updateMask = FieldMask.newBuilder()
-   *     .addAllPaths(paths)
-   *     .build();
-   *   UpdateSnapshotRequest request = UpdateSnapshotRequest.newBuilder()
-   *     .setSnapshot(snapshot)
-   *     .setUpdateMask(updateMask)
-   *     .build();
-   *   ApiFuture<Snapshot> future = subscriptionAdminClient.updateSnapshotCallable().futureCall(request);
-   *   // Do something
+   *   UpdateSnapshotRequest request =
+   *       UpdateSnapshotRequest.newBuilder()
+   *           .setSnapshot(Snapshot.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   ApiFuture future =
+   *       subscriptionAdminClient.updateSnapshotCallable().futureCall(request);
+   *   // Do something.
    *   Snapshot response = future.get();
    * }
-   * 
+ * }
*/ public final UnaryCallable updateSnapshotCallable() { return stub.updateSnapshotCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Removes an existing snapshot. Snapshots are used in [Seek] * (https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage @@ -1923,18 +3500,23 @@ public final UnaryCallable updateSnapshotCallab * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ProjectSnapshotName snapshot = ProjectSnapshotName.of("[PROJECT]", "[SNAPSHOT]");
+   *   SnapshotName snapshot = SnapshotName.of("[PROJECT]", "[SNAPSHOT]");
    *   subscriptionAdminClient.deleteSnapshot(snapshot);
    * }
-   * 
+ * }
* * @param snapshot Required. The name of the snapshot to delete. Format is * `projects/{project}/snapshots/{snap}`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - public final void deleteSnapshot(ProjectSnapshotName snapshot) { + public final void deleteSnapshot(SnapshotName snapshot) { DeleteSnapshotRequest request = DeleteSnapshotRequest.newBuilder() .setSnapshot(snapshot == null ? null : snapshot.toString()) @@ -1942,7 +3524,7 @@ public final void deleteSnapshot(ProjectSnapshotName snapshot) { deleteSnapshot(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Removes an existing snapshot. Snapshots are used in [Seek] * (https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage @@ -1954,12 +3536,17 @@ public final void deleteSnapshot(ProjectSnapshotName snapshot) { * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ProjectSnapshotName snapshot = ProjectSnapshotName.of("[PROJECT]", "[SNAPSHOT]");
-   *   subscriptionAdminClient.deleteSnapshot(snapshot.toString());
+   *   String snapshot = SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString();
+   *   subscriptionAdminClient.deleteSnapshot(snapshot);
    * }
-   * 
+ * }
* * @param snapshot Required. The name of the snapshot to delete. Format is * `projects/{project}/snapshots/{snap}`. @@ -1971,7 +3558,7 @@ public final void deleteSnapshot(String snapshot) { deleteSnapshot(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Removes an existing snapshot. Snapshots are used in [Seek] * (https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage @@ -1983,15 +3570,20 @@ public final void deleteSnapshot(String snapshot) { * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ProjectSnapshotName snapshot = ProjectSnapshotName.of("[PROJECT]", "[SNAPSHOT]");
-   *   DeleteSnapshotRequest request = DeleteSnapshotRequest.newBuilder()
-   *     .setSnapshot(snapshot.toString())
-   *     .build();
+   *   DeleteSnapshotRequest request =
+   *       DeleteSnapshotRequest.newBuilder()
+   *           .setSnapshot(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString())
+   *           .build();
    *   subscriptionAdminClient.deleteSnapshot(request);
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -2000,7 +3592,7 @@ public final void deleteSnapshot(DeleteSnapshotRequest request) { deleteSnapshotCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Removes an existing snapshot. Snapshots are used in [Seek] * (https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage @@ -2012,23 +3604,62 @@ public final void deleteSnapshot(DeleteSnapshotRequest request) { * *

Sample code: * - *


+   * 
{@code
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    *   ProjectSnapshotName snapshot = ProjectSnapshotName.of("[PROJECT]", "[SNAPSHOT]");
-   *   DeleteSnapshotRequest request = DeleteSnapshotRequest.newBuilder()
-   *     .setSnapshot(snapshot.toString())
-   *     .build();
-   *   ApiFuture<Void> future = subscriptionAdminClient.deleteSnapshotCallable().futureCall(request);
-   *   // Do something
+   *   subscriptionAdminClient.deleteSnapshot(snapshot);
+   * }
+   * }
+ * + * @param snapshot Required. The name of the snapshot to delete. Format is + * `projects/{project}/snapshots/{snap}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + * @deprecated Use Use {@link #deleteSnapshot(SnapshotName)} instead. + */ + @Deprecated + public final void deleteSnapshot(ProjectSnapshotName snapshot) { + DeleteSnapshotRequest request = + DeleteSnapshotRequest.newBuilder() + .setSnapshot(snapshot == null ? null : snapshot.toString()) + .build(); + deleteSnapshot(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Removes an existing snapshot. Snapshots are used in [Seek] + * (https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage + * message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in + * an existing subscription to the state captured by a snapshot. When the snapshot is deleted, all + * messages retained in the snapshot are immediately dropped. After a snapshot is deleted, a new + * one may be created with the same name, but the new one has no association with the old snapshot + * or its subscription, unless the same subscription is specified. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+   *   DeleteSnapshotRequest request =
+   *       DeleteSnapshotRequest.newBuilder()
+   *           .setSnapshot(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString())
+   *           .build();
+   *   ApiFuture future =
+   *       subscriptionAdminClient.deleteSnapshotCallable().futureCall(request);
+   *   // Do something.
    *   future.get();
    * }
-   * 
+ * }
*/ public final UnaryCallable deleteSnapshotCallable() { return stub.deleteSnapshotCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Seeks an existing subscription to a point in time or to a given snapshot, whichever is provided * in the request. Snapshots are used in [Seek] @@ -2039,15 +3670,20 @@ public final UnaryCallable deleteSnapshotCallable( * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
-   *   SeekRequest request = SeekRequest.newBuilder()
-   *     .setSubscription(subscription.toString())
-   *     .build();
+   *   SeekRequest request =
+   *       SeekRequest.newBuilder()
+   *           .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
+   *           .build();
    *   SeekResponse response = subscriptionAdminClient.seek(request);
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -2056,7 +3692,7 @@ public final SeekResponse seek(SeekRequest request) { return seekCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Seeks an existing subscription to a point in time or to a given snapshot, whichever is provided * in the request. Snapshots are used in [Seek] @@ -2067,41 +3703,51 @@ public final SeekResponse seek(SeekRequest request) { * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
-   *   SeekRequest request = SeekRequest.newBuilder()
-   *     .setSubscription(subscription.toString())
-   *     .build();
-   *   ApiFuture<SeekResponse> future = subscriptionAdminClient.seekCallable().futureCall(request);
-   *   // Do something
+   *   SeekRequest request =
+   *       SeekRequest.newBuilder()
+   *           .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
+   *           .build();
+   *   ApiFuture future = subscriptionAdminClient.seekCallable().futureCall(request);
+   *   // Do something.
    *   SeekResponse response = future.get();
    * }
-   * 
+ * }
*/ public final UnaryCallable seekCallable() { return stub.seekCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * Sets the access control policy on the specified resource. Replaces any existing policy. + * Sets the access control policy on the specified resource. Replacesany existing policy. * - *

Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors. + *

Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ResourceName resource = ProjectName.of("[PROJECT]");
-   *   Policy policy = Policy.newBuilder().build();
-   *   SetIamPolicyRequest request = SetIamPolicyRequest.newBuilder()
-   *     .setResource(resource.toString())
-   *     .setPolicy(policy)
-   *     .build();
+   *   SetIamPolicyRequest request =
+   *       SetIamPolicyRequest.newBuilder()
+   *           .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
+   *           .setPolicy(Policy.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
    *   Policy response = subscriptionAdminClient.setIamPolicy(request);
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -2141,48 +3787,59 @@ public final Policy setIamPolicy(String resource, Policy policy) { return setIamPolicy(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * Sets the access control policy on the specified resource. Replaces any existing policy. + * Sets the access control policy on the specified resource. Replacesany existing policy. * - *

Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors. + *

Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ResourceName resource = ProjectName.of("[PROJECT]");
-   *   Policy policy = Policy.newBuilder().build();
-   *   SetIamPolicyRequest request = SetIamPolicyRequest.newBuilder()
-   *     .setResource(resource.toString())
-   *     .setPolicy(policy)
-   *     .build();
-   *   ApiFuture<Policy> future = subscriptionAdminClient.setIamPolicyCallable().futureCall(request);
-   *   // Do something
+   *   SetIamPolicyRequest request =
+   *       SetIamPolicyRequest.newBuilder()
+   *           .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
+   *           .setPolicy(Policy.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   ApiFuture future = subscriptionAdminClient.setIamPolicyCallable().futureCall(request);
+   *   // Do something.
    *   Policy response = future.get();
    * }
-   * 
+ * }
*/ public final UnaryCallable setIamPolicyCallable() { return stub.setIamPolicyCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * Gets the access control policy for a resource. Returns an empty policy if the resource exists + * Gets the access control policy for a resource. Returns an empty policyif the resource exists * and does not have a policy set. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ResourceName resource = ProjectName.of("[PROJECT]");
-   *   GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder()
-   *     .setResource(resource.toString())
-   *     .build();
+   *   GetIamPolicyRequest request =
+   *       GetIamPolicyRequest.newBuilder()
+   *           .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
+   *           .setOptions(GetPolicyOptions.newBuilder().build())
+   *           .build();
    *   Policy response = subscriptionAdminClient.getIamPolicy(request);
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -2216,51 +3873,61 @@ public final Policy getIamPolicy(String resource) { return getIamPolicy(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * Gets the access control policy for a resource. Returns an empty policy if the resource exists + * Gets the access control policy for a resource. Returns an empty policyif the resource exists * and does not have a policy set. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ResourceName resource = ProjectName.of("[PROJECT]");
-   *   GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder()
-   *     .setResource(resource.toString())
-   *     .build();
-   *   ApiFuture<Policy> future = subscriptionAdminClient.getIamPolicyCallable().futureCall(request);
-   *   // Do something
+   *   GetIamPolicyRequest request =
+   *       GetIamPolicyRequest.newBuilder()
+   *           .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
+   *           .setOptions(GetPolicyOptions.newBuilder().build())
+   *           .build();
+   *   ApiFuture future = subscriptionAdminClient.getIamPolicyCallable().futureCall(request);
+   *   // Do something.
    *   Policy response = future.get();
    * }
-   * 
+ * }
*/ public final UnaryCallable getIamPolicyCallable() { return stub.getIamPolicyCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * Returns permissions that a caller has on the specified resource. If the resource does not - * exist, this will return an empty set of permissions, not a `NOT_FOUND` error. + * Returns permissions that a caller has on the specified resource. If theresource does not exist, + * this will return an empty set ofpermissions, not a `NOT_FOUND` error. * - *

Note: This operation is designed to be used for building permission-aware UIs and - * command-line tools, not for authorization checking. This operation may "fail open" without + *

Note: This operation is designed to be used for buildingpermission-aware UIs and + * command-line tools, not for authorizationchecking. This operation may "fail open" without * warning. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ResourceName resource = ProjectName.of("[PROJECT]");
-   *   List<String> permissions = new ArrayList<>();
-   *   TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder()
-   *     .setResource(resource.toString())
-   *     .addAllPermissions(permissions)
-   *     .build();
+   *   TestIamPermissionsRequest request =
+   *       TestIamPermissionsRequest.newBuilder()
+   *           .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
+   *           .addAllPermissions(new ArrayList())
+   *           .build();
    *   TestIamPermissionsResponse response = subscriptionAdminClient.testIamPermissions(request);
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -2307,30 +3974,35 @@ public final TestIamPermissionsResponse testIamPermissions( return testIamPermissions(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * Returns permissions that a caller has on the specified resource. If the resource does not - * exist, this will return an empty set of permissions, not a `NOT_FOUND` error. + * Returns permissions that a caller has on the specified resource. If theresource does not exist, + * this will return an empty set ofpermissions, not a `NOT_FOUND` error. * - *

Note: This operation is designed to be used for building permission-aware UIs and - * command-line tools, not for authorization checking. This operation may "fail open" without + *

Note: This operation is designed to be used for buildingpermission-aware UIs and + * command-line tools, not for authorizationchecking. This operation may "fail open" without * warning. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
-   *   ResourceName resource = ProjectName.of("[PROJECT]");
-   *   List<String> permissions = new ArrayList<>();
-   *   TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder()
-   *     .setResource(resource.toString())
-   *     .addAllPermissions(permissions)
-   *     .build();
-   *   ApiFuture<TestIamPermissionsResponse> future = subscriptionAdminClient.testIamPermissionsCallable().futureCall(request);
-   *   // Do something
+   *   TestIamPermissionsRequest request =
+   *       TestIamPermissionsRequest.newBuilder()
+   *           .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
+   *           .addAllPermissions(new ArrayList())
+   *           .build();
+   *   ApiFuture future =
+   *       subscriptionAdminClient.testIamPermissionsCallable().futureCall(request);
+   *   // Do something.
    *   TestIamPermissionsResponse response = future.get();
    * }
-   * 
+ * }
*/ public final UnaryCallable testIamPermissionsCallable() { @@ -2382,12 +4054,7 @@ public static ApiFuture createAsync( ListSubscriptionsPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( futurePage, - new ApiFunction() { - @Override - public ListSubscriptionsPagedResponse apply(ListSubscriptionsPage input) { - return new ListSubscriptionsPagedResponse(input); - } - }, + input -> new ListSubscriptionsPagedResponse(input), MoreExecutors.directExecutor()); } @@ -2467,12 +4134,7 @@ public static ApiFuture createAsync( ListSnapshotsPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( futurePage, - new ApiFunction() { - @Override - public ListSnapshotsPagedResponse apply(ListSnapshotsPage input) { - return new ListSnapshotsPagedResponse(input); - } - }, + input -> new ListSnapshotsPagedResponse(input), MoreExecutors.directExecutor()); } diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/SubscriptionAdminSettings.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/SubscriptionAdminSettings.java index 06d12d8ff..8fe62a63f 100644 --- a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/SubscriptionAdminSettings.java +++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/SubscriptionAdminSettings.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.pubsub.v1; import static com.google.cloud.pubsub.v1.SubscriptionAdminClient.ListSnapshotsPagedResponse; @@ -23,6 +24,7 @@ import com.google.api.gax.core.GoogleCredentialsProvider; import com.google.api.gax.core.InstantiatingExecutorProvider; import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.ClientContext; import com.google.api.gax.rpc.ClientSettings; @@ -63,7 +65,7 @@ import java.util.List; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link SubscriptionAdminClient}. * @@ -78,24 +80,44 @@ *

The builder of this class is recursive, so contained classes are themselves builders. When * build() is called, the tree of builders is called to create the complete settings object. * - *

For example, to set the total timeout of createSubscription to 30 seconds: + *

For example, to set the + * [RetrySettings](https://cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.retrying.RetrySettings) + * of createSubscription: * - *

- * 
+ * 
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
  * SubscriptionAdminSettings.Builder subscriptionAdminSettingsBuilder =
  *     SubscriptionAdminSettings.newBuilder();
  * subscriptionAdminSettingsBuilder
  *     .createSubscriptionSettings()
  *     .setRetrySettings(
- *         subscriptionAdminSettingsBuilder.createSubscriptionSettings().getRetrySettings().toBuilder()
- *             .setTotalTimeout(Duration.ofSeconds(30))
+ *         subscriptionAdminSettingsBuilder
+ *             .createSubscriptionSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
+ *             .setInitialRetryDelayDuration(Duration.ofSeconds(1))
+ *             .setInitialRpcTimeoutDuration(Duration.ofSeconds(5))
+ *             .setMaxAttempts(5)
+ *             .setMaxRetryDelayDuration(Duration.ofSeconds(30))
+ *             .setMaxRpcTimeoutDuration(Duration.ofSeconds(60))
+ *             .setRetryDelayMultiplier(1.3)
+ *             .setRpcTimeoutMultiplier(1.5)
+ *             .setTotalTimeoutDuration(Duration.ofSeconds(300))
  *             .build());
  * SubscriptionAdminSettings subscriptionAdminSettings = subscriptionAdminSettingsBuilder.build();
- * 
- * 
+ * }
+ * + * Please refer to the [Client Side Retry + * Guide](https://docs.cloud.google.com/java/docs/client-retries) for additional support in setting + * retries. */ -@Generated("by gapic-generator") +@Generated("by gapic-generator-java") public class SubscriptionAdminSettings extends ClientSettings { + /** Returns the object with the settings used for calls to createSubscription. */ public UnaryCallSettings createSubscriptionSettings() { return ((SubscriberStubSettings) getStubSettings()).createSubscriptionSettings(); @@ -123,29 +145,23 @@ public UnaryCallSettings deleteSubscriptionSet return ((SubscriberStubSettings) getStubSettings()).deleteSubscriptionSettings(); } - /** Returns the object with the settings used for calls to getSnapshot. */ - /* package-private */ UnaryCallSettings getSnapshotSettings() { - return ((SubscriberStubSettings) getStubSettings()).getSnapshotSettings(); - } - /** Returns the object with the settings used for calls to modifyAckDeadline. */ - /* package-private */ UnaryCallSettings - modifyAckDeadlineSettings() { + public UnaryCallSettings modifyAckDeadlineSettings() { return ((SubscriberStubSettings) getStubSettings()).modifyAckDeadlineSettings(); } /** Returns the object with the settings used for calls to acknowledge. */ - /* package-private */ UnaryCallSettings acknowledgeSettings() { + public UnaryCallSettings acknowledgeSettings() { return ((SubscriberStubSettings) getStubSettings()).acknowledgeSettings(); } /** Returns the object with the settings used for calls to pull. */ - /* package-private */ UnaryCallSettings pullSettings() { + public UnaryCallSettings pullSettings() { return ((SubscriberStubSettings) getStubSettings()).pullSettings(); } /** Returns the object with the settings used for calls to streamingPull. */ - /* package-private */ StreamingCallSettings + public StreamingCallSettings streamingPullSettings() { return ((SubscriberStubSettings) getStubSettings()).streamingPullSettings(); } @@ -155,6 +171,11 @@ public UnaryCallSettings modifyPushConfigSetting return ((SubscriberStubSettings) getStubSettings()).modifyPushConfigSettings(); } + /** Returns the object with the settings used for calls to getSnapshot. */ + public UnaryCallSettings getSnapshotSettings() { + return ((SubscriberStubSettings) getStubSettings()).getSnapshotSettings(); + } + /** Returns the object with the settings used for calls to listSnapshots. */ public PagedCallSettings listSnapshotsSettings() { @@ -222,25 +243,36 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde return SubscriberStubSettings.defaultCredentialsProviderBuilder(); } - /** Returns a builder for the default ChannelProvider for this service. */ + /** Returns a builder for the default gRPC ChannelProvider for this service. */ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { return SubscriberStubSettings.defaultGrpcTransportProviderBuilder(); } + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return SubscriberStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + public static TransportChannelProvider defaultTransportChannelProvider() { return SubscriberStubSettings.defaultTransportChannelProvider(); } - @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { return SubscriberStubSettings.defaultApiClientHeaderProviderBuilder(); } - /** Returns a new builder for this class. */ + /** Returns a new gRPC builder for this class. */ public static Builder newBuilder() { return Builder.createDefault(); } + /** Returns a new REST builder for this class. */ + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + /** Returns a new builder for this class. */ public static Builder newBuilder(ClientContext clientContext) { return new Builder(clientContext); @@ -257,18 +289,15 @@ protected SubscriptionAdminSettings(Builder settingsBuilder) throws IOException /** Builder for SubscriptionAdminSettings. */ public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { - this((ClientContext) null); + this(((ClientContext) null)); } protected Builder(ClientContext clientContext) { super(SubscriberStubSettings.newBuilder(clientContext)); } - private static Builder createDefault() { - return new Builder(SubscriberStubSettings.newBuilder()); - } - protected Builder(SubscriptionAdminSettings settings) { super(settings.getStubSettings().toBuilder()); } @@ -277,18 +306,25 @@ protected Builder(SubscriberStubSettings.Builder stubSettings) { super(stubSettings); } + private static Builder createDefault() { + return new Builder(SubscriberStubSettings.newBuilder()); + } + + private static Builder createHttpJsonDefault() { + return new Builder(SubscriberStubSettings.newHttpJsonBuilder()); + } + public SubscriberStubSettings.Builder getStubSettingsBuilder() { return ((SubscriberStubSettings.Builder) getStubSettings()); } - // NEXT_MAJOR_VER: remove 'throws Exception' /** * Applies the given settings updater function to all of the unary API methods in this service. * *

Note: This method does not support applying settings to streaming methods. */ public Builder applyToAllUnaryMethods( - ApiFunction, Void> settingsUpdater) throws Exception { + ApiFunction, Void> settingsUpdater) { super.applyToAllUnaryMethods( getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); return this; @@ -324,31 +360,23 @@ public UnaryCallSettings.Builder createSubscriptionS return getStubSettingsBuilder().deleteSubscriptionSettings(); } - /** Returns the builder for the settings used for calls to getSnapshot. */ - /* package-private */ UnaryCallSettings.Builder - getSnapshotSettings() { - return getStubSettingsBuilder().getSnapshotSettings(); - } - /** Returns the builder for the settings used for calls to modifyAckDeadline. */ - /* package-private */ UnaryCallSettings.Builder - modifyAckDeadlineSettings() { + public UnaryCallSettings.Builder modifyAckDeadlineSettings() { return getStubSettingsBuilder().modifyAckDeadlineSettings(); } /** Returns the builder for the settings used for calls to acknowledge. */ - /* package-private */ UnaryCallSettings.Builder - acknowledgeSettings() { + public UnaryCallSettings.Builder acknowledgeSettings() { return getStubSettingsBuilder().acknowledgeSettings(); } /** Returns the builder for the settings used for calls to pull. */ - /* package-private */ UnaryCallSettings.Builder pullSettings() { + public UnaryCallSettings.Builder pullSettings() { return getStubSettingsBuilder().pullSettings(); } /** Returns the builder for the settings used for calls to streamingPull. */ - /* package-private */ StreamingCallSettings.Builder + public StreamingCallSettings.Builder streamingPullSettings() { return getStubSettingsBuilder().streamingPullSettings(); } @@ -358,6 +386,11 @@ public UnaryCallSettings.Builder modifyPushConfi return getStubSettingsBuilder().modifyPushConfigSettings(); } + /** Returns the builder for the settings used for calls to getSnapshot. */ + public UnaryCallSettings.Builder getSnapshotSettings() { + return getStubSettingsBuilder().getSnapshotSettings(); + } + /** Returns the builder for the settings used for calls to listSnapshots. */ public PagedCallSettings.Builder< ListSnapshotsRequest, ListSnapshotsResponse, ListSnapshotsPagedResponse> 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 52920223e..91dfd103e 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 @@ -1,11 +1,11 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 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 + * 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, @@ -13,12 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.pubsub.v1; -import com.google.api.core.ApiFunction; import com.google.api.core.ApiFuture; import com.google.api.core.ApiFutures; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.paging.AbstractFixedSizeCollection; import com.google.api.gax.paging.AbstractPage; @@ -27,8 +26,6 @@ import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.pubsub.v1.stub.PublisherStub; import com.google.cloud.pubsub.v1.stub.PublisherStubSettings; -import com.google.common.base.Function; -import com.google.common.collect.Iterables; import com.google.common.util.concurrent.MoreExecutors; import com.google.iam.v1.GetIamPolicyRequest; import com.google.iam.v1.Policy; @@ -36,6 +33,7 @@ import com.google.iam.v1.TestIamPermissionsRequest; import com.google.iam.v1.TestIamPermissionsResponse; import com.google.protobuf.Empty; +import com.google.protobuf.FieldMask; import com.google.pubsub.v1.DeleteTopicRequest; import com.google.pubsub.v1.DetachSubscriptionRequest; import com.google.pubsub.v1.DetachSubscriptionResponse; @@ -47,7 +45,6 @@ import com.google.pubsub.v1.ListTopicsRequest; import com.google.pubsub.v1.ListTopicsResponse; import com.google.pubsub.v1.ProjectName; -import com.google.pubsub.v1.ProjectSubscriptionName; import com.google.pubsub.v1.ProjectTopicName; import com.google.pubsub.v1.PublishRequest; import com.google.pubsub.v1.PublishResponse; @@ -60,41 +57,249 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND SERVICE +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Service Description: The service that an application uses to manipulate topics, and to send * messages to a topic. * - *

To publish messages to a topic, see the Publisher class. - * *

This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: * - *

- * 
+ * 
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
  * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
  *   TopicName name = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
  *   Topic response = topicAdminClient.createTopic(name);
  * }
- * 
- * 
+ * }
* - *

Note: close() needs to be called on the topicAdminClient object to clean up resources such as + *

Note: close() needs to be called on the TopicAdminClient object to clean up resources such as * threads. In the example above, try-with-resources is used, which automatically calls close(). * - *

The surface of this class includes several types of Java methods for each of the API's - * methods: - * - *

    - *
  1. A "flattened" method. With this type of method, the fields of the request type have been - * converted into function parameters. It may be the case that not all fields are available as - * parameters, and not every API method will have a flattened method entry point. - *
  2. A "request object" method. This type of method only takes one parameter, a request object, - * which must be constructed before the call. Not every API method will have a request object - * method. - *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API - * callable object, which can be used to initiate calls to the service. - *
+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Methods
MethodDescriptionMethod Variants

CreateTopic

Creates the given topic with the given name. See the [resource name rules] (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names).

+ *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ *
    + *
  • createTopic(Topic request) + *

+ *

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

+ *
    + *
  • createTopic(TopicName name) + *

  • createTopic(String name) + *

+ *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ *
    + *
  • createTopicCallable() + *

+ *

UpdateTopic

Updates an existing topic by updating the fields specified in the update mask. Note that certain properties of a topic are not modifiable.

+ *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ *
    + *
  • updateTopic(UpdateTopicRequest request) + *

+ *

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

+ *
    + *
  • updateTopic(Topic topic, FieldMask updateMask) + *

+ *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ *
    + *
  • updateTopicCallable() + *

+ *

Publish

Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic does not exist.

+ *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ *
    + *
  • publish(PublishRequest request) + *

+ *

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

+ *
    + *
  • publish(TopicName topic, List<PubsubMessage> messages) + *

  • publish(String topic, List<PubsubMessage> messages) + *

+ *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ *
    + *
  • publishCallable() + *

+ *

GetTopic

Gets the configuration of a topic.

+ *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ *
    + *
  • getTopic(GetTopicRequest request) + *

+ *

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

+ *
    + *
  • getTopic(TopicName topic) + *

  • getTopic(String topic) + *

+ *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ *
    + *
  • getTopicCallable() + *

+ *

ListTopics

Lists matching topics.

+ *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ *
    + *
  • listTopics(ListTopicsRequest request) + *

+ *

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

+ *
    + *
  • listTopics(ProjectName project) + *

  • listTopics(String project) + *

+ *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ *
    + *
  • listTopicsPagedCallable() + *

  • listTopicsCallable() + *

+ *

ListTopicSubscriptions

Lists the names of the attached subscriptions on this topic.

+ *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ *
    + *
  • listTopicSubscriptions(ListTopicSubscriptionsRequest request) + *

+ *

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

+ *
    + *
  • listTopicSubscriptions(TopicName topic) + *

  • listTopicSubscriptions(String topic) + *

+ *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ *
    + *
  • listTopicSubscriptionsPagedCallable() + *

  • listTopicSubscriptionsCallable() + *

+ *

ListTopicSnapshots

Lists the names of the snapshots on this topic. Snapshots are used in [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot.

+ *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ *
    + *
  • listTopicSnapshots(ListTopicSnapshotsRequest request) + *

+ *

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

+ *
    + *
  • listTopicSnapshots(TopicName topic) + *

  • listTopicSnapshots(String topic) + *

+ *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ *
    + *
  • listTopicSnapshotsPagedCallable() + *

  • listTopicSnapshotsCallable() + *

+ *

DeleteTopic

Deletes the topic with the given name. Returns `NOT_FOUND` if the topic does not exist. After a topic is deleted, a new topic may be created with the same name; this is an entirely new topic with none of the old configuration or subscriptions. Existing subscriptions to this topic are not deleted, but their `topic` field is set to `_deleted-topic_`.

+ *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ *
    + *
  • deleteTopic(DeleteTopicRequest request) + *

+ *

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

+ *
    + *
  • deleteTopic(TopicName topic) + *

  • deleteTopic(String topic) + *

+ *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ *
    + *
  • deleteTopicCallable() + *

+ *

DetachSubscription

Detaches a subscription from this topic. All messages retained in the subscription are dropped. Subsequent `Pull` and `StreamingPull` requests will return FAILED_PRECONDITION. If the subscription is a push subscription, pushes to the endpoint will stop.

+ *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ *
    + *
  • detachSubscription(DetachSubscriptionRequest request) + *

+ *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ *
    + *
  • detachSubscriptionCallable() + *

+ *

SetIamPolicy

Sets the access control policy on the specified resource. Replacesany existing policy. + *

Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors.

+ *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ *
    + *
  • setIamPolicy(SetIamPolicyRequest request) + *

+ *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ *
    + *
  • setIamPolicyCallable() + *

+ *

GetIamPolicy

Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set.

+ *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ *
    + *
  • getIamPolicy(GetIamPolicyRequest request) + *

+ *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ *
    + *
  • getIamPolicyCallable() + *

+ *

TestIamPermissions

Returns permissions that a caller has on the specified resource. If theresource does not exist, this will return an empty set ofpermissions, not a `NOT_FOUND` error. + *

Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning.

+ *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ *
    + *
  • testIamPermissions(TestIamPermissionsRequest request) + *

+ *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ *
    + *
  • testIamPermissionsCallable() + *

+ *
* *

See the individual methods for example code. * @@ -107,29 +312,48 @@ * *

To customize credentials: * - *

- * 
+ * 
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
  * TopicAdminSettings topicAdminSettings =
  *     TopicAdminSettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
  *         .build();
- * TopicAdminClient topicAdminClient =
- *     TopicAdminClient.create(topicAdminSettings);
- * 
- * 
+ * TopicAdminClient topicAdminClient = TopicAdminClient.create(topicAdminSettings); + * }
* - * To customize the endpoint: + *

To customize the endpoint: * - *

- * 
+ * 
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
  * TopicAdminSettings topicAdminSettings =
  *     TopicAdminSettings.newBuilder().setEndpoint(myEndpoint).build();
- * TopicAdminClient topicAdminClient =
- *     TopicAdminClient.create(topicAdminSettings);
- * 
- * 
+ * TopicAdminClient topicAdminClient = TopicAdminClient.create(topicAdminSettings); + * }
+ * + *

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over + * the wire: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * TopicAdminSettings topicAdminSettings = TopicAdminSettings.newHttpJsonBuilder().build();
+ * TopicAdminClient topicAdminClient = TopicAdminClient.create(topicAdminSettings);
+ * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ -@Generated("by gapic-generator") +@Generated("by gapic-generator-java") public class TopicAdminClient implements BackgroundResource { private final TopicAdminSettings settings; private final PublisherStub stub; @@ -149,9 +373,8 @@ public static final TopicAdminClient create(TopicAdminSettings settings) throws /** * Constructs an instance of TopicAdminClient, using the given stub for making calls. This is for - * advanced usage - prefer to use TopicAdminSettings}. + * advanced usage - prefer using create(TopicAdminSettings). */ - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final TopicAdminClient create(PublisherStub stub) { return new TopicAdminClient(stub); } @@ -165,7 +388,6 @@ protected TopicAdminClient(TopicAdminSettings settings) throws IOException { this.stub = ((PublisherStubSettings) settings.getStubSettings()).createStub(); } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected TopicAdminClient(PublisherStub stub) { this.settings = null; this.stub = stub; @@ -175,26 +397,30 @@ public final TopicAdminSettings getSettings() { return settings; } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public PublisherStub getStub() { return stub; } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates the given topic with the given name. See the [resource name rules] - * (https://cloud.google.com/pubsub/docs/admin#resource_names). + * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    *   TopicName name = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
    *   Topic response = topicAdminClient.createTopic(name);
    * }
-   * 
+ * }
* - * @param name Required. The name of the topic. It must have the format + * @param name Required. Identifier. The name of the topic. It must have the format * `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter, and contain only * letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), * tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters in @@ -206,21 +432,26 @@ public final Topic createTopic(TopicName name) { return createTopic(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates the given topic with the given name. See the [resource name rules] - * (https://cloud.google.com/pubsub/docs/admin#resource_names). + * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   TopicName name = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
-   *   Topic response = topicAdminClient.createTopic(name.toString());
+   *   String name = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString();
+   *   Topic response = topicAdminClient.createTopic(name);
    * }
-   * 
+ * }
* - * @param name Required. The name of the topic. It must have the format + * @param name Required. Identifier. The name of the topic. It must have the format * `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter, and contain only * letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), * tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters in @@ -261,22 +492,38 @@ public final Topic createTopic(ProjectTopicName name) { return createTopic(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates the given topic with the given name. See the [resource name rules] - * (https://cloud.google.com/pubsub/docs/admin#resource_names). + * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   TopicName name = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
-   *   Topic request = Topic.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
+   *   Topic request =
+   *       Topic.newBuilder()
+   *           .setName(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
+   *           .putAllLabels(new HashMap())
+   *           .setMessageStoragePolicy(MessageStoragePolicy.newBuilder().build())
+   *           .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);
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -285,46 +532,100 @@ public final Topic createTopic(Topic request) { return createTopicCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates the given topic with the given name. See the [resource name rules] - * (https://cloud.google.com/pubsub/docs/admin#resource_names). + * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   TopicName name = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
-   *   Topic request = Topic.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Topic> future = topicAdminClient.createTopicCallable().futureCall(request);
-   *   // Do something
+   *   Topic request =
+   *       Topic.newBuilder()
+   *           .setName(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
+   *           .putAllLabels(new HashMap())
+   *           .setMessageStoragePolicy(MessageStoragePolicy.newBuilder().build())
+   *           .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.
    *   Topic response = future.get();
    * }
-   * 
+ * }
*/ public final UnaryCallable createTopicCallable() { return stub.createTopicCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * Updates an existing topic. Note that certain properties of a topic are not modifiable. + * Updates an existing topic by updating the fields specified in the update mask. Note that + * certain properties of a topic are not modifiable. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    *   Topic topic = Topic.newBuilder().build();
    *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   UpdateTopicRequest request = UpdateTopicRequest.newBuilder()
-   *     .setTopic(topic)
-   *     .setUpdateMask(updateMask)
-   *     .build();
+   *   Topic response = topicAdminClient.updateTopic(topic, updateMask);
+   * }
+   * }
+ * + * @param topic Required. The updated topic object. + * @param updateMask Required. Indicates which fields in the provided topic to update. Must be + * specified and non-empty. Note that if `update_mask` contains "message_storage_policy" but + * the `message_storage_policy` is not set in the `topic` provided above, then the updated + * value is determined by the policy configured at the project or organization level. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Topic updateTopic(Topic topic, FieldMask updateMask) { + UpdateTopicRequest request = + UpdateTopicRequest.newBuilder().setTopic(topic).setUpdateMask(updateMask).build(); + return updateTopic(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates an existing topic by updating the fields specified in the update mask. Note that + * certain properties of a topic are not modifiable. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+   *   UpdateTopicRequest request =
+   *       UpdateTopicRequest.newBuilder()
+   *           .setTopic(Topic.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
    *   Topic response = topicAdminClient.updateTopic(request);
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -333,55 +634,60 @@ public final Topic updateTopic(UpdateTopicRequest request) { return updateTopicCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * Updates an existing topic. Note that certain properties of a topic are not modifiable. + * Updates an existing topic by updating the fields specified in the update mask. Note that + * certain properties of a topic are not modifiable. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   Topic topic = Topic.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   UpdateTopicRequest request = UpdateTopicRequest.newBuilder()
-   *     .setTopic(topic)
-   *     .setUpdateMask(updateMask)
-   *     .build();
-   *   ApiFuture<Topic> future = topicAdminClient.updateTopicCallable().futureCall(request);
-   *   // Do something
+   *   UpdateTopicRequest request =
+   *       UpdateTopicRequest.newBuilder()
+   *           .setTopic(Topic.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   ApiFuture future = topicAdminClient.updateTopicCallable().futureCall(request);
+   *   // Do something.
    *   Topic response = future.get();
    * }
-   * 
+ * }
*/ public final UnaryCallable updateTopicCallable() { return stub.updateTopicCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic does not exist. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    *   TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
-   *   ByteString data = ByteString.copyFromUtf8("");
-   *   PubsubMessage messagesElement = PubsubMessage.newBuilder()
-   *     .setData(data)
-   *     .build();
-   *   List<PubsubMessage> messages = Arrays.asList(messagesElement);
+   *   List messages = new ArrayList<>();
    *   PublishResponse response = topicAdminClient.publish(topic, messages);
    * }
-   * 
+ * }
* * @param topic Required. The messages in the request will be published on this topic. Format is * `projects/{project}/topics/{topic}`. * @param messages Required. The messages to publish. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - /* package-private */ final PublishResponse publish( - TopicName topic, List messages) { + public final PublishResponse publish(TopicName topic, List messages) { PublishRequest request = PublishRequest.newBuilder() .setTopic(topic == null ? null : topic.toString()) @@ -390,104 +696,110 @@ public final UnaryCallable updateTopicCallable() { return publish(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic does not exist. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
-   *   ByteString data = ByteString.copyFromUtf8("");
-   *   PubsubMessage messagesElement = PubsubMessage.newBuilder()
-   *     .setData(data)
-   *     .build();
-   *   List<PubsubMessage> messages = Arrays.asList(messagesElement);
-   *   PublishResponse response = topicAdminClient.publish(topic.toString(), messages);
+   *   String topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString();
+   *   List messages = new ArrayList<>();
+   *   PublishResponse response = topicAdminClient.publish(topic, messages);
    * }
-   * 
+ * }
* * @param topic Required. The messages in the request will be published on this topic. Format is * `projects/{project}/topics/{topic}`. * @param messages Required. The messages to publish. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - /* package-private */ final PublishResponse publish(String topic, List messages) { + public final PublishResponse publish(String topic, List messages) { PublishRequest request = PublishRequest.newBuilder().setTopic(topic).addAllMessages(messages).build(); return publish(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic does not exist. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
-   *   ByteString data = ByteString.copyFromUtf8("");
-   *   PubsubMessage messagesElement = PubsubMessage.newBuilder()
-   *     .setData(data)
-   *     .build();
-   *   List<PubsubMessage> messages = Arrays.asList(messagesElement);
-   *   PublishRequest request = PublishRequest.newBuilder()
-   *     .setTopic(topic.toString())
-   *     .addAllMessages(messages)
-   *     .build();
+   *   PublishRequest request =
+   *       PublishRequest.newBuilder()
+   *           .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
+   *           .addAllMessages(new ArrayList())
+   *           .build();
    *   PublishResponse response = topicAdminClient.publish(request);
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - /* package-private */ final PublishResponse publish(PublishRequest request) { + public final PublishResponse publish(PublishRequest request) { return publishCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic does not exist. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
-   *   ByteString data = ByteString.copyFromUtf8("");
-   *   PubsubMessage messagesElement = PubsubMessage.newBuilder()
-   *     .setData(data)
-   *     .build();
-   *   List<PubsubMessage> messages = Arrays.asList(messagesElement);
-   *   PublishRequest request = PublishRequest.newBuilder()
-   *     .setTopic(topic.toString())
-   *     .addAllMessages(messages)
-   *     .build();
-   *   ApiFuture<PublishResponse> future = topicAdminClient.publishCallable().futureCall(request);
-   *   // Do something
+   *   PublishRequest request =
+   *       PublishRequest.newBuilder()
+   *           .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
+   *           .addAllMessages(new ArrayList())
+   *           .build();
+   *   ApiFuture future = topicAdminClient.publishCallable().futureCall(request);
+   *   // Do something.
    *   PublishResponse response = future.get();
    * }
-   * 
+ * }
*/ - /* package-private */ final UnaryCallable publishCallable() { + public final UnaryCallable publishCallable() { return stub.publishCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets the configuration of a topic. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    *   TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
    *   Topic response = topicAdminClient.getTopic(topic);
    * }
-   * 
+ * }
* * @param topic Required. The name of the topic to get. Format is * `projects/{project}/topics/{topic}`. @@ -499,18 +811,23 @@ public final Topic getTopic(TopicName topic) { return getTopic(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets the configuration of a topic. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
-   *   Topic response = topicAdminClient.getTopic(topic.toString());
+   *   String topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString();
+   *   Topic response = topicAdminClient.getTopic(topic);
    * }
-   * 
+ * }
* * @param topic Required. The name of the topic to get. Format is * `projects/{project}/topics/{topic}`. @@ -546,21 +863,26 @@ public final Topic getTopic(ProjectTopicName topic) { return getTopic(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets the configuration of a topic. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
-   *   GetTopicRequest request = GetTopicRequest.newBuilder()
-   *     .setTopic(topic.toString())
-   *     .build();
+   *   GetTopicRequest request =
+   *       GetTopicRequest.newBuilder()
+   *           .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
+   *           .build();
    *   Topic response = topicAdminClient.getTopic(request);
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -569,42 +891,52 @@ public final Topic getTopic(GetTopicRequest request) { return getTopicCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets the configuration of a topic. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
-   *   GetTopicRequest request = GetTopicRequest.newBuilder()
-   *     .setTopic(topic.toString())
-   *     .build();
-   *   ApiFuture<Topic> future = topicAdminClient.getTopicCallable().futureCall(request);
-   *   // Do something
+   *   GetTopicRequest request =
+   *       GetTopicRequest.newBuilder()
+   *           .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
+   *           .build();
+   *   ApiFuture future = topicAdminClient.getTopicCallable().futureCall(request);
+   *   // Do something.
    *   Topic response = future.get();
    * }
-   * 
+ * }
*/ public final UnaryCallable getTopicCallable() { return stub.getTopicCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists matching topics. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    *   ProjectName project = ProjectName.of("[PROJECT]");
    *   for (Topic element : topicAdminClient.listTopics(project).iterateAll()) {
    *     // doThingsWith(element);
    *   }
    * }
-   * 
+ * }
* * @param project Required. The name of the project in which to list topics. Format is * `projects/{project-id}`. @@ -618,20 +950,25 @@ public final ListTopicsPagedResponse listTopics(ProjectName project) { return listTopics(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists matching topics. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   ProjectName project = ProjectName.of("[PROJECT]");
-   *   for (Topic element : topicAdminClient.listTopics(project.toString()).iterateAll()) {
+   *   String project = ProjectName.of("[PROJECT]").toString();
+   *   for (Topic element : topicAdminClient.listTopics(project).iterateAll()) {
    *     // doThingsWith(element);
    *   }
    * }
-   * 
+ * }
* * @param project Required. The name of the project in which to list topics. Format is * `projects/{project-id}`. @@ -642,23 +979,30 @@ public final ListTopicsPagedResponse listTopics(String project) { return listTopics(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists matching topics. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   ProjectName project = ProjectName.of("[PROJECT]");
-   *   ListTopicsRequest request = ListTopicsRequest.newBuilder()
-   *     .setProject(project.toString())
-   *     .build();
+   *   ListTopicsRequest request =
+   *       ListTopicsRequest.newBuilder()
+   *           .setProject(ProjectName.of("[PROJECT]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
    *   for (Topic element : topicAdminClient.listTopics(request).iterateAll()) {
    *     // doThingsWith(element);
    *   }
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -667,42 +1011,56 @@ public final ListTopicsPagedResponse listTopics(ListTopicsRequest request) { return listTopicsPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists matching topics. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   ProjectName project = ProjectName.of("[PROJECT]");
-   *   ListTopicsRequest request = ListTopicsRequest.newBuilder()
-   *     .setProject(project.toString())
-   *     .build();
-   *   ApiFuture<ListTopicsPagedResponse> future = topicAdminClient.listTopicsPagedCallable().futureCall(request);
-   *   // Do something
+   *   ListTopicsRequest request =
+   *       ListTopicsRequest.newBuilder()
+   *           .setProject(ProjectName.of("[PROJECT]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future = topicAdminClient.listTopicsPagedCallable().futureCall(request);
+   *   // Do something.
    *   for (Topic element : future.get().iterateAll()) {
    *     // doThingsWith(element);
    *   }
    * }
-   * 
+ * }
*/ public final UnaryCallable listTopicsPagedCallable() { return stub.listTopicsPagedCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists matching topics. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   ProjectName project = ProjectName.of("[PROJECT]");
-   *   ListTopicsRequest request = ListTopicsRequest.newBuilder()
-   *     .setProject(project.toString())
-   *     .build();
+   *   ListTopicsRequest request =
+   *       ListTopicsRequest.newBuilder()
+   *           .setProject(ProjectName.of("[PROJECT]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
    *   while (true) {
    *     ListTopicsResponse response = topicAdminClient.listTopicsCallable().call(request);
    *     for (Topic element : response.getTopicsList()) {
@@ -716,26 +1074,31 @@ public final UnaryCallable listTopic
    *     }
    *   }
    * }
-   * 
+ * }
*/ public final UnaryCallable listTopicsCallable() { return stub.listTopicsCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists the names of the attached subscriptions on this topic. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    *   TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
-   *   for (ProjectSubscriptionName element : topicAdminClient.listTopicSubscriptions(topic).iterateAllAsProjectSubscriptionName()) {
+   *   for (String element : topicAdminClient.listTopicSubscriptions(topic).iterateAll()) {
    *     // doThingsWith(element);
    *   }
    * }
-   * 
+ * }
* * @param topic Required. The name of the topic that subscriptions are attached to. Format is * `projects/{project}/topics/{topic}`. @@ -749,20 +1112,25 @@ public final ListTopicSubscriptionsPagedResponse listTopicSubscriptions(TopicNam return listTopicSubscriptions(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists the names of the attached subscriptions on this topic. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
-   *   for (ProjectSubscriptionName element : topicAdminClient.listTopicSubscriptions(topic.toString()).iterateAllAsProjectSubscriptionName()) {
+   *   String topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString();
+   *   for (String element : topicAdminClient.listTopicSubscriptions(topic).iterateAll()) {
    *     // doThingsWith(element);
    *   }
    * }
-   * 
+ * }
* * @param topic Required. The name of the topic that subscriptions are attached to. Format is * `projects/{project}/topics/{topic}`. @@ -803,23 +1171,30 @@ public final ListTopicSubscriptionsPagedResponse listTopicSubscriptions(ProjectT return listTopicSubscriptions(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists the names of the attached subscriptions on this topic. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
-   *   ListTopicSubscriptionsRequest request = ListTopicSubscriptionsRequest.newBuilder()
-   *     .setTopic(topic.toString())
-   *     .build();
-   *   for (ProjectSubscriptionName element : topicAdminClient.listTopicSubscriptions(request).iterateAllAsProjectSubscriptionName()) {
+   *   ListTopicSubscriptionsRequest request =
+   *       ListTopicSubscriptionsRequest.newBuilder()
+   *           .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   for (String element : topicAdminClient.listTopicSubscriptions(request).iterateAll()) {
    *     // doThingsWith(element);
    *   }
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -829,46 +1204,62 @@ public final ListTopicSubscriptionsPagedResponse listTopicSubscriptions( return listTopicSubscriptionsPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists the names of the attached subscriptions on this topic. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
-   *   ListTopicSubscriptionsRequest request = ListTopicSubscriptionsRequest.newBuilder()
-   *     .setTopic(topic.toString())
-   *     .build();
-   *   ApiFuture<ListTopicSubscriptionsPagedResponse> future = topicAdminClient.listTopicSubscriptionsPagedCallable().futureCall(request);
-   *   // Do something
-   *   for (ProjectSubscriptionName element : future.get().iterateAllAsProjectSubscriptionName()) {
+   *   ListTopicSubscriptionsRequest request =
+   *       ListTopicSubscriptionsRequest.newBuilder()
+   *           .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future =
+   *       topicAdminClient.listTopicSubscriptionsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (String element : future.get().iterateAll()) {
    *     // doThingsWith(element);
    *   }
    * }
-   * 
+ * }
*/ public final UnaryCallable listTopicSubscriptionsPagedCallable() { return stub.listTopicSubscriptionsPagedCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists the names of the attached subscriptions on this topic. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
-   *   ListTopicSubscriptionsRequest request = ListTopicSubscriptionsRequest.newBuilder()
-   *     .setTopic(topic.toString())
-   *     .build();
+   *   ListTopicSubscriptionsRequest request =
+   *       ListTopicSubscriptionsRequest.newBuilder()
+   *           .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
    *   while (true) {
-   *     ListTopicSubscriptionsResponse response = topicAdminClient.listTopicSubscriptionsCallable().call(request);
-   *     for (ProjectSubscriptionName element : ProjectSubscriptionName.parseList(response.getSubscriptionsList())) {
+   *     ListTopicSubscriptionsResponse response =
+   *         topicAdminClient.listTopicSubscriptionsCallable().call(request);
+   *     for (String element : response.getSubscriptionsList()) {
    *       // doThingsWith(element);
    *     }
    *     String nextPageToken = response.getNextPageToken();
@@ -879,14 +1270,14 @@ public final ListTopicSubscriptionsPagedResponse listTopicSubscriptions(
    *     }
    *   }
    * }
-   * 
+ * }
*/ public final UnaryCallable listTopicSubscriptionsCallable() { return stub.listTopicSubscriptionsCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists the names of the snapshots on this topic. Snapshots are used in * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to @@ -895,20 +1286,25 @@ public final ListTopicSubscriptionsPagedResponse listTopicSubscriptions( * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    *   TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
    *   for (String element : topicAdminClient.listTopicSnapshots(topic).iterateAll()) {
    *     // doThingsWith(element);
    *   }
    * }
-   * 
+ * }
* * @param topic Required. The name of the topic that snapshots are attached to. Format is * `projects/{project}/topics/{topic}`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - /* package-private */ final ListTopicSnapshotsPagedResponse listTopicSnapshots(TopicName topic) { + public final ListTopicSnapshotsPagedResponse listTopicSnapshots(TopicName topic) { ListTopicSnapshotsRequest request = ListTopicSnapshotsRequest.newBuilder() .setTopic(topic == null ? null : topic.toString()) @@ -916,7 +1312,7 @@ public final ListTopicSubscriptionsPagedResponse listTopicSubscriptions( return listTopicSnapshots(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists the names of the snapshots on this topic. Snapshots are used in * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to @@ -925,26 +1321,31 @@ public final ListTopicSubscriptionsPagedResponse listTopicSubscriptions( * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
-   *   for (String element : topicAdminClient.listTopicSnapshots(topic.toString()).iterateAll()) {
+   *   String topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString();
+   *   for (String element : topicAdminClient.listTopicSnapshots(topic).iterateAll()) {
    *     // doThingsWith(element);
    *   }
    * }
-   * 
+ * }
* * @param topic Required. The name of the topic that snapshots are attached to. Format is * `projects/{project}/topics/{topic}`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - /* package-private */ final ListTopicSnapshotsPagedResponse listTopicSnapshots(String topic) { + public final ListTopicSnapshotsPagedResponse listTopicSnapshots(String topic) { ListTopicSnapshotsRequest request = ListTopicSnapshotsRequest.newBuilder().setTopic(topic).build(); return listTopicSnapshots(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists the names of the snapshots on this topic. Snapshots are used in * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to @@ -953,27 +1354,34 @@ public final ListTopicSubscriptionsPagedResponse listTopicSubscriptions( * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
-   *   ListTopicSnapshotsRequest request = ListTopicSnapshotsRequest.newBuilder()
-   *     .setTopic(topic.toString())
-   *     .build();
+   *   ListTopicSnapshotsRequest request =
+   *       ListTopicSnapshotsRequest.newBuilder()
+   *           .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
    *   for (String element : topicAdminClient.listTopicSnapshots(request).iterateAll()) {
    *     // doThingsWith(element);
    *   }
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - /* package-private */ final ListTopicSnapshotsPagedResponse listTopicSnapshots( + public final ListTopicSnapshotsPagedResponse listTopicSnapshots( ListTopicSnapshotsRequest request) { return listTopicSnapshotsPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists the names of the snapshots on this topic. Snapshots are used in * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to @@ -982,27 +1390,34 @@ public final ListTopicSubscriptionsPagedResponse listTopicSubscriptions( * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
-   *   ListTopicSnapshotsRequest request = ListTopicSnapshotsRequest.newBuilder()
-   *     .setTopic(topic.toString())
-   *     .build();
-   *   ApiFuture<ListTopicSnapshotsPagedResponse> future = topicAdminClient.listTopicSnapshotsPagedCallable().futureCall(request);
-   *   // Do something
+   *   ListTopicSnapshotsRequest request =
+   *       ListTopicSnapshotsRequest.newBuilder()
+   *           .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future =
+   *       topicAdminClient.listTopicSnapshotsPagedCallable().futureCall(request);
+   *   // Do something.
    *   for (String element : future.get().iterateAll()) {
    *     // doThingsWith(element);
    *   }
    * }
-   * 
+ * }
*/ - /* package-private */ final UnaryCallable< - ListTopicSnapshotsRequest, ListTopicSnapshotsPagedResponse> + public final UnaryCallable listTopicSnapshotsPagedCallable() { return stub.listTopicSnapshotsPagedCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists the names of the snapshots on this topic. Snapshots are used in * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to @@ -1011,14 +1426,22 @@ public final ListTopicSubscriptionsPagedResponse listTopicSubscriptions( * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
-   *   ListTopicSnapshotsRequest request = ListTopicSnapshotsRequest.newBuilder()
-   *     .setTopic(topic.toString())
-   *     .build();
+   *   ListTopicSnapshotsRequest request =
+   *       ListTopicSnapshotsRequest.newBuilder()
+   *           .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
    *   while (true) {
-   *     ListTopicSnapshotsResponse response = topicAdminClient.listTopicSnapshotsCallable().call(request);
+   *     ListTopicSnapshotsResponse response =
+   *         topicAdminClient.listTopicSnapshotsCallable().call(request);
    *     for (String element : response.getSnapshotsList()) {
    *       // doThingsWith(element);
    *     }
@@ -1030,14 +1453,14 @@ public final ListTopicSubscriptionsPagedResponse listTopicSubscriptions(
    *     }
    *   }
    * }
-   * 
+ * }
*/ - /* package-private */ final UnaryCallable + public final UnaryCallable listTopicSnapshotsCallable() { return stub.listTopicSnapshotsCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the topic with the given name. Returns `NOT_FOUND` if the topic does not exist. After a * topic is deleted, a new topic may be created with the same name; this is an entirely new topic @@ -1046,12 +1469,17 @@ public final ListTopicSubscriptionsPagedResponse listTopicSubscriptions( * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    *   TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
    *   topicAdminClient.deleteTopic(topic);
    * }
-   * 
+ * }
* * @param topic Required. Name of the topic to delete. Format is * `projects/{project}/topics/{topic}`. @@ -1063,7 +1491,7 @@ public final void deleteTopic(TopicName topic) { deleteTopic(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the topic with the given name. Returns `NOT_FOUND` if the topic does not exist. After a * topic is deleted, a new topic may be created with the same name; this is an entirely new topic @@ -1072,12 +1500,17 @@ public final void deleteTopic(TopicName topic) { * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
-   *   topicAdminClient.deleteTopic(topic.toString());
+   *   String topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString();
+   *   topicAdminClient.deleteTopic(topic);
    * }
-   * 
+ * }
* * @param topic Required. Name of the topic to delete. Format is * `projects/{project}/topics/{topic}`. @@ -1116,7 +1549,7 @@ public final void deleteTopic(ProjectTopicName topic) { deleteTopic(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the topic with the given name. Returns `NOT_FOUND` if the topic does not exist. After a * topic is deleted, a new topic may be created with the same name; this is an entirely new topic @@ -1125,15 +1558,20 @@ public final void deleteTopic(ProjectTopicName topic) { * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
-   *   DeleteTopicRequest request = DeleteTopicRequest.newBuilder()
-   *     .setTopic(topic.toString())
-   *     .build();
+   *   DeleteTopicRequest request =
+   *       DeleteTopicRequest.newBuilder()
+   *           .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
+   *           .build();
    *   topicAdminClient.deleteTopic(request);
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -1142,7 +1580,7 @@ public final void deleteTopic(DeleteTopicRequest request) { deleteTopicCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the topic with the given name. Returns `NOT_FOUND` if the topic does not exist. After a * topic is deleted, a new topic may be created with the same name; this is an entirely new topic @@ -1151,41 +1589,112 @@ public final void deleteTopic(DeleteTopicRequest request) { * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
-   *   DeleteTopicRequest request = DeleteTopicRequest.newBuilder()
-   *     .setTopic(topic.toString())
-   *     .build();
-   *   ApiFuture<Void> future = topicAdminClient.deleteTopicCallable().futureCall(request);
-   *   // Do something
+   *   DeleteTopicRequest request =
+   *       DeleteTopicRequest.newBuilder()
+   *           .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
+   *           .build();
+   *   ApiFuture future = topicAdminClient.deleteTopicCallable().futureCall(request);
+   *   // Do something.
    *   future.get();
    * }
-   * 
+ * }
*/ public final UnaryCallable deleteTopicCallable() { return stub.deleteTopicCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * Sets the access control policy on the specified resource. Replaces any existing policy. + * Detaches a subscription from this topic. All messages retained in the subscription are dropped. + * Subsequent `Pull` and `StreamingPull` requests will return FAILED_PRECONDITION. If the + * subscription is a push subscription, pushes to the endpoint will stop. * - *

Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors. + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+   *   DetachSubscriptionRequest request =
+   *       DetachSubscriptionRequest.newBuilder()
+   *           .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
+   *           .build();
+   *   DetachSubscriptionResponse response = topicAdminClient.detachSubscription(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final DetachSubscriptionResponse detachSubscription(DetachSubscriptionRequest request) { + return detachSubscriptionCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Detaches a subscription from this topic. All messages retained in the subscription are dropped. + * Subsequent `Pull` and `StreamingPull` requests will return FAILED_PRECONDITION. If the + * subscription is a push subscription, pushes to the endpoint will stop. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   ResourceName resource = ProjectName.of("[PROJECT]");
-   *   Policy policy = Policy.newBuilder().build();
-   *   SetIamPolicyRequest request = SetIamPolicyRequest.newBuilder()
-   *     .setResource(resource.toString())
-   *     .setPolicy(policy)
-   *     .build();
+   *   DetachSubscriptionRequest request =
+   *       DetachSubscriptionRequest.newBuilder()
+   *           .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
+   *           .build();
+   *   ApiFuture future =
+   *       topicAdminClient.detachSubscriptionCallable().futureCall(request);
+   *   // Do something.
+   *   DetachSubscriptionResponse response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable + detachSubscriptionCallable() { + return stub.detachSubscriptionCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Sets the access control policy on the specified resource. Replacesany existing policy. + * + *

Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+   *   SetIamPolicyRequest request =
+   *       SetIamPolicyRequest.newBuilder()
+   *           .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
+   *           .setPolicy(Policy.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
    *   Policy response = topicAdminClient.setIamPolicy(request);
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -1225,48 +1734,59 @@ public final Policy setIamPolicy(String resource, Policy policy) { return setIamPolicy(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * Sets the access control policy on the specified resource. Replaces any existing policy. + * Sets the access control policy on the specified resource. Replacesany existing policy. * - *

Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors. + *

Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   ResourceName resource = ProjectName.of("[PROJECT]");
-   *   Policy policy = Policy.newBuilder().build();
-   *   SetIamPolicyRequest request = SetIamPolicyRequest.newBuilder()
-   *     .setResource(resource.toString())
-   *     .setPolicy(policy)
-   *     .build();
-   *   ApiFuture<Policy> future = topicAdminClient.setIamPolicyCallable().futureCall(request);
-   *   // Do something
+   *   SetIamPolicyRequest request =
+   *       SetIamPolicyRequest.newBuilder()
+   *           .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
+   *           .setPolicy(Policy.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   ApiFuture future = topicAdminClient.setIamPolicyCallable().futureCall(request);
+   *   // Do something.
    *   Policy response = future.get();
    * }
-   * 
+ * }
*/ public final UnaryCallable setIamPolicyCallable() { return stub.setIamPolicyCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * Gets the access control policy for a resource. Returns an empty policy if the resource exists + * Gets the access control policy for a resource. Returns an empty policyif the resource exists * and does not have a policy set. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   ResourceName resource = ProjectName.of("[PROJECT]");
-   *   GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder()
-   *     .setResource(resource.toString())
-   *     .build();
+   *   GetIamPolicyRequest request =
+   *       GetIamPolicyRequest.newBuilder()
+   *           .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
+   *           .setOptions(GetPolicyOptions.newBuilder().build())
+   *           .build();
    *   Policy response = topicAdminClient.getIamPolicy(request);
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -1300,51 +1820,61 @@ public final Policy getIamPolicy(String resource) { return getIamPolicy(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * Gets the access control policy for a resource. Returns an empty policy if the resource exists + * Gets the access control policy for a resource. Returns an empty policyif the resource exists * and does not have a policy set. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   ResourceName resource = ProjectName.of("[PROJECT]");
-   *   GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder()
-   *     .setResource(resource.toString())
-   *     .build();
-   *   ApiFuture<Policy> future = topicAdminClient.getIamPolicyCallable().futureCall(request);
-   *   // Do something
+   *   GetIamPolicyRequest request =
+   *       GetIamPolicyRequest.newBuilder()
+   *           .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
+   *           .setOptions(GetPolicyOptions.newBuilder().build())
+   *           .build();
+   *   ApiFuture future = topicAdminClient.getIamPolicyCallable().futureCall(request);
+   *   // Do something.
    *   Policy response = future.get();
    * }
-   * 
+ * }
*/ public final UnaryCallable getIamPolicyCallable() { return stub.getIamPolicyCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * Returns permissions that a caller has on the specified resource. If the resource does not - * exist, this will return an empty set of permissions, not a `NOT_FOUND` error. + * Returns permissions that a caller has on the specified resource. If theresource does not exist, + * this will return an empty set ofpermissions, not a `NOT_FOUND` error. * - *

Note: This operation is designed to be used for building permission-aware UIs and - * command-line tools, not for authorization checking. This operation may "fail open" without + *

Note: This operation is designed to be used for buildingpermission-aware UIs and + * command-line tools, not for authorizationchecking. This operation may "fail open" without * warning. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   ResourceName resource = ProjectName.of("[PROJECT]");
-   *   List<String> permissions = new ArrayList<>();
-   *   TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder()
-   *     .setResource(resource.toString())
-   *     .addAllPermissions(permissions)
-   *     .build();
+   *   TestIamPermissionsRequest request =
+   *       TestIamPermissionsRequest.newBuilder()
+   *           .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
+   *           .addAllPermissions(new ArrayList())
+   *           .build();
    *   TestIamPermissionsResponse response = topicAdminClient.testIamPermissions(request);
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -1391,86 +1921,41 @@ public final TestIamPermissionsResponse testIamPermissions( return testIamPermissions(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * Returns permissions that a caller has on the specified resource. If the resource does not - * exist, this will return an empty set of permissions, not a `NOT_FOUND` error. + * Returns permissions that a caller has on the specified resource. If theresource does not exist, + * this will return an empty set ofpermissions, not a `NOT_FOUND` error. * - *

Note: This operation is designed to be used for building permission-aware UIs and - * command-line tools, not for authorization checking. This operation may "fail open" without + *

Note: This operation is designed to be used for buildingpermission-aware UIs and + * command-line tools, not for authorizationchecking. This operation may "fail open" without * warning. * *

Sample code: * - *


+   * 
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   ResourceName resource = ProjectName.of("[PROJECT]");
-   *   List<String> permissions = new ArrayList<>();
-   *   TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder()
-   *     .setResource(resource.toString())
-   *     .addAllPermissions(permissions)
-   *     .build();
-   *   ApiFuture<TestIamPermissionsResponse> future = topicAdminClient.testIamPermissionsCallable().futureCall(request);
-   *   // Do something
+   *   TestIamPermissionsRequest request =
+   *       TestIamPermissionsRequest.newBuilder()
+   *           .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
+   *           .addAllPermissions(new ArrayList())
+   *           .build();
+   *   ApiFuture future =
+   *       topicAdminClient.testIamPermissionsCallable().futureCall(request);
+   *   // Do something.
    *   TestIamPermissionsResponse response = future.get();
    * }
-   * 
+ * }
*/ public final UnaryCallable testIamPermissionsCallable() { return stub.testIamPermissionsCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Detaches a subscription from this topic. All messages retained in the subscription are dropped. - * Subsequent `Pull` and `StreamingPull` requests will return FAILED_PRECONDITION. If the - * subscription is a push subscription, pushes to the endpoint will stop. - * - *

Sample code: - * - *


-   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
-   *   DetachSubscriptionRequest request = DetachSubscriptionRequest.newBuilder()
-   *     .setSubscription(subscription.toString())
-   *     .build();
-   *   DetachSubscriptionResponse response = topicAdminClient.detachSubscription(request);
-   * }
-   * 
- * - * @param request The request object containing all of the parameters for the API call. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final DetachSubscriptionResponse detachSubscription(DetachSubscriptionRequest request) { - return detachSubscriptionCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Detaches a subscription from this topic. All messages retained in the subscription are dropped. - * Subsequent `Pull` and `StreamingPull` requests will return FAILED_PRECONDITION. If the - * subscription is a push subscription, pushes to the endpoint will stop. - * - *

Sample code: - * - *


-   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
-   *   ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
-   *   DetachSubscriptionRequest request = DetachSubscriptionRequest.newBuilder()
-   *     .setSubscription(subscription.toString())
-   *     .build();
-   *   ApiFuture<DetachSubscriptionResponse> future = topicAdminClient.detachSubscriptionCallable().futureCall(request);
-   *   // Do something
-   *   DetachSubscriptionResponse response = future.get();
-   * }
-   * 
- */ - public final UnaryCallable - detachSubscriptionCallable() { - return stub.detachSubscriptionCallable(); - } - @Override public final void close() { stub.close(); @@ -1515,14 +2000,7 @@ public static ApiFuture createAsync( ApiFuture futurePage = ListTopicsPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( - futurePage, - new ApiFunction() { - @Override - public ListTopicsPagedResponse apply(ListTopicsPage input) { - return new ListTopicsPagedResponse(input); - } - }, - MoreExecutors.directExecutor()); + futurePage, input -> new ListTopicsPagedResponse(input), MoreExecutors.directExecutor()); } private ListTopicsPagedResponse(ListTopicsPage page) { @@ -1596,29 +2074,13 @@ public static ApiFuture createAsync( ListTopicSubscriptionsPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( futurePage, - new ApiFunction() { - @Override - public ListTopicSubscriptionsPagedResponse apply(ListTopicSubscriptionsPage input) { - return new ListTopicSubscriptionsPagedResponse(input); - } - }, + input -> new ListTopicSubscriptionsPagedResponse(input), MoreExecutors.directExecutor()); } private ListTopicSubscriptionsPagedResponse(ListTopicSubscriptionsPage page) { super(page, ListTopicSubscriptionsFixedSizeCollection.createEmptyCollection()); } - - public Iterable iterateAllAsProjectSubscriptionName() { - return Iterables.transform( - iterateAll(), - new Function() { - @Override - public ProjectSubscriptionName apply(String arg0) { - return ProjectSubscriptionName.parse(arg0); - } - }); - } } public static class ListTopicSubscriptionsPage @@ -1651,28 +2113,6 @@ public ApiFuture createPageAsync( ApiFuture futureResponse) { return super.createPageAsync(context, futureResponse); } - - public Iterable iterateAllAsProjectSubscriptionName() { - return Iterables.transform( - iterateAll(), - new Function() { - @Override - public ProjectSubscriptionName apply(String arg0) { - return ProjectSubscriptionName.parse(arg0); - } - }); - } - - public Iterable getValuesAsProjectSubscriptionName() { - return Iterables.transform( - getValues(), - new Function() { - @Override - public ProjectSubscriptionName apply(String arg0) { - return ProjectSubscriptionName.parse(arg0); - } - }); - } } public static class ListTopicSubscriptionsFixedSizeCollection @@ -1697,17 +2137,6 @@ protected ListTopicSubscriptionsFixedSizeCollection createCollection( List pages, int collectionSize) { return new ListTopicSubscriptionsFixedSizeCollection(pages, collectionSize); } - - public Iterable getValuesAsProjectSubscriptionName() { - return Iterables.transform( - getValues(), - new Function() { - @Override - public ProjectSubscriptionName apply(String arg0) { - return ProjectSubscriptionName.parse(arg0); - } - }); - } } public static class ListTopicSnapshotsPagedResponse @@ -1725,12 +2154,7 @@ public static ApiFuture createAsync( ListTopicSnapshotsPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( futurePage, - new ApiFunction() { - @Override - public ListTopicSnapshotsPagedResponse apply(ListTopicSnapshotsPage input) { - return new ListTopicSnapshotsPagedResponse(input); - } - }, + input -> new ListTopicSnapshotsPagedResponse(input), MoreExecutors.directExecutor()); } diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/TopicAdminSettings.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/TopicAdminSettings.java index 7c79aabc7..4928dd762 100644 --- a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/TopicAdminSettings.java +++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/TopicAdminSettings.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.pubsub.v1; import static com.google.cloud.pubsub.v1.TopicAdminClient.ListTopicSnapshotsPagedResponse; @@ -24,6 +25,7 @@ import com.google.api.gax.core.GoogleCredentialsProvider; import com.google.api.gax.core.InstantiatingExecutorProvider; import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.BatchingCallSettings; import com.google.api.gax.rpc.ClientContext; @@ -56,7 +58,7 @@ import java.util.List; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link TopicAdminClient}. * @@ -71,24 +73,43 @@ *

The builder of this class is recursive, so contained classes are themselves builders. When * build() is called, the tree of builders is called to create the complete settings object. * - *

For example, to set the total timeout of createTopic to 30 seconds: + *

For example, to set the + * [RetrySettings](https://cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.retrying.RetrySettings) + * of createTopic: * - *

- * 
- * TopicAdminSettings.Builder topicAdminSettingsBuilder =
- *     TopicAdminSettings.newBuilder();
+ * 
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * TopicAdminSettings.Builder topicAdminSettingsBuilder = TopicAdminSettings.newBuilder();
  * topicAdminSettingsBuilder
  *     .createTopicSettings()
  *     .setRetrySettings(
- *         topicAdminSettingsBuilder.createTopicSettings().getRetrySettings().toBuilder()
- *             .setTotalTimeout(Duration.ofSeconds(30))
+ *         topicAdminSettingsBuilder
+ *             .createTopicSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
+ *             .setInitialRetryDelayDuration(Duration.ofSeconds(1))
+ *             .setInitialRpcTimeoutDuration(Duration.ofSeconds(5))
+ *             .setMaxAttempts(5)
+ *             .setMaxRetryDelayDuration(Duration.ofSeconds(30))
+ *             .setMaxRpcTimeoutDuration(Duration.ofSeconds(60))
+ *             .setRetryDelayMultiplier(1.3)
+ *             .setRpcTimeoutMultiplier(1.5)
+ *             .setTotalTimeoutDuration(Duration.ofSeconds(300))
  *             .build());
  * TopicAdminSettings topicAdminSettings = topicAdminSettingsBuilder.build();
- * 
- * 
+ * }
+ * + * Please refer to the [Client Side Retry + * Guide](https://docs.cloud.google.com/java/docs/client-retries) for additional support in setting + * retries. */ -@Generated("by gapic-generator") +@Generated("by gapic-generator-java") public class TopicAdminSettings extends ClientSettings { + /** Returns the object with the settings used for calls to createTopic. */ public UnaryCallSettings createTopicSettings() { return ((PublisherStubSettings) getStubSettings()).createTopicSettings(); @@ -100,7 +121,7 @@ public UnaryCallSettings updateTopicSettings() { } /** Returns the object with the settings used for calls to publish. */ - /* package-private */ BatchingCallSettings publishSettings() { + public BatchingCallSettings publishSettings() { return ((PublisherStubSettings) getStubSettings()).publishSettings(); } @@ -125,7 +146,7 @@ public UnaryCallSettings getTopicSettings() { } /** Returns the object with the settings used for calls to listTopicSnapshots. */ - /* package-private */ PagedCallSettings< + public PagedCallSettings< ListTopicSnapshotsRequest, ListTopicSnapshotsResponse, ListTopicSnapshotsPagedResponse> listTopicSnapshotsSettings() { return ((PublisherStubSettings) getStubSettings()).listTopicSnapshotsSettings(); @@ -136,6 +157,12 @@ public UnaryCallSettings deleteTopicSettings() { return ((PublisherStubSettings) getStubSettings()).deleteTopicSettings(); } + /** Returns the object with the settings used for calls to detachSubscription. */ + public UnaryCallSettings + detachSubscriptionSettings() { + return ((PublisherStubSettings) getStubSettings()).detachSubscriptionSettings(); + } + /** Returns the object with the settings used for calls to setIamPolicy. */ public UnaryCallSettings setIamPolicySettings() { return ((PublisherStubSettings) getStubSettings()).setIamPolicySettings(); @@ -152,12 +179,6 @@ public UnaryCallSettings getIamPolicySettings() { return ((PublisherStubSettings) getStubSettings()).testIamPermissionsSettings(); } - /** Returns the object with the settings used for calls to detachSubscription. */ - public UnaryCallSettings - detachSubscriptionSettings() { - return ((PublisherStubSettings) getStubSettings()).detachSubscriptionSettings(); - } - public static final TopicAdminSettings create(PublisherStubSettings stub) throws IOException { return new TopicAdminSettings.Builder(stub.toBuilder()).build(); } @@ -182,25 +203,36 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde return PublisherStubSettings.defaultCredentialsProviderBuilder(); } - /** Returns a builder for the default ChannelProvider for this service. */ + /** Returns a builder for the default gRPC ChannelProvider for this service. */ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { return PublisherStubSettings.defaultGrpcTransportProviderBuilder(); } + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return PublisherStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + public static TransportChannelProvider defaultTransportChannelProvider() { return PublisherStubSettings.defaultTransportChannelProvider(); } - @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { return PublisherStubSettings.defaultApiClientHeaderProviderBuilder(); } - /** Returns a new builder for this class. */ + /** Returns a new gRPC builder for this class. */ public static Builder newBuilder() { return Builder.createDefault(); } + /** Returns a new REST builder for this class. */ + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + /** Returns a new builder for this class. */ public static Builder newBuilder(ClientContext clientContext) { return new Builder(clientContext); @@ -217,18 +249,15 @@ protected TopicAdminSettings(Builder settingsBuilder) throws IOException { /** Builder for TopicAdminSettings. */ public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { - this((ClientContext) null); + this(((ClientContext) null)); } protected Builder(ClientContext clientContext) { super(PublisherStubSettings.newBuilder(clientContext)); } - private static Builder createDefault() { - return new Builder(PublisherStubSettings.newBuilder()); - } - protected Builder(TopicAdminSettings settings) { super(settings.getStubSettings().toBuilder()); } @@ -237,18 +266,25 @@ protected Builder(PublisherStubSettings.Builder stubSettings) { super(stubSettings); } + private static Builder createDefault() { + return new Builder(PublisherStubSettings.newBuilder()); + } + + private static Builder createHttpJsonDefault() { + return new Builder(PublisherStubSettings.newHttpJsonBuilder()); + } + public PublisherStubSettings.Builder getStubSettingsBuilder() { return ((PublisherStubSettings.Builder) getStubSettings()); } - // NEXT_MAJOR_VER: remove 'throws Exception' /** * Applies the given settings updater function to all of the unary API methods in this service. * *

Note: This method does not support applying settings to streaming methods. */ public Builder applyToAllUnaryMethods( - ApiFunction, Void> settingsUpdater) throws Exception { + ApiFunction, Void> settingsUpdater) { super.applyToAllUnaryMethods( getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); return this; @@ -265,8 +301,7 @@ public UnaryCallSettings.Builder updateTopicSettings( } /** Returns the builder for the settings used for calls to publish. */ - /* package-private */ BatchingCallSettings.Builder - publishSettings() { + public BatchingCallSettings.Builder publishSettings() { return getStubSettingsBuilder().publishSettings(); } @@ -291,7 +326,7 @@ public UnaryCallSettings.Builder getTopicSettings() { } /** Returns the builder for the settings used for calls to listTopicSnapshots. */ - /* package-private */ PagedCallSettings.Builder< + public PagedCallSettings.Builder< ListTopicSnapshotsRequest, ListTopicSnapshotsResponse, ListTopicSnapshotsPagedResponse> listTopicSnapshotsSettings() { return getStubSettingsBuilder().listTopicSnapshotsSettings(); @@ -302,6 +337,12 @@ public UnaryCallSettings.Builder deleteTopicSettings( return getStubSettingsBuilder().deleteTopicSettings(); } + /** Returns the builder for the settings used for calls to detachSubscription. */ + public UnaryCallSettings.Builder + detachSubscriptionSettings() { + return getStubSettingsBuilder().detachSubscriptionSettings(); + } + /** Returns the builder for the settings used for calls to setIamPolicy. */ public UnaryCallSettings.Builder setIamPolicySettings() { return getStubSettingsBuilder().setIamPolicySettings(); @@ -318,12 +359,6 @@ public UnaryCallSettings.Builder getIamPolicySettin return getStubSettingsBuilder().testIamPermissionsSettings(); } - /** Returns the builder for the settings used for calls to detachSubscription. */ - public UnaryCallSettings.Builder - detachSubscriptionSettings() { - return getStubSettingsBuilder().detachSubscriptionSettings(); - } - @Override public TopicAdminSettings build() throws IOException { return new TopicAdminSettings(this); 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/main/java/com/google/cloud/pubsub/v1/gapic_metadata.json b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/gapic_metadata.json new file mode 100644 index 000000000..2cf1c90a4 --- /dev/null +++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/gapic_metadata.json @@ -0,0 +1,168 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "java", + "protoPackage": "google.pubsub.v1", + "libraryPackage": "com.google.cloud.pubsub.v1", + "services": { + "Publisher": { + "clients": { + "grpc": { + "libraryClient": "TopicAdminClient", + "rpcs": { + "CreateTopic": { + "methods": ["createTopic", "createTopic", "createTopic", "createTopicCallable"] + }, + "DeleteTopic": { + "methods": ["deleteTopic", "deleteTopic", "deleteTopic", "deleteTopicCallable"] + }, + "DetachSubscription": { + "methods": ["detachSubscription", "detachSubscriptionCallable"] + }, + "GetIamPolicy": { + "methods": ["getIamPolicy", "getIamPolicyCallable"] + }, + "GetTopic": { + "methods": ["getTopic", "getTopic", "getTopic", "getTopicCallable"] + }, + "ListTopicSnapshots": { + "methods": ["listTopicSnapshots", "listTopicSnapshots", "listTopicSnapshots", "listTopicSnapshotsPagedCallable", "listTopicSnapshotsCallable"] + }, + "ListTopicSubscriptions": { + "methods": ["listTopicSubscriptions", "listTopicSubscriptions", "listTopicSubscriptions", "listTopicSubscriptionsPagedCallable", "listTopicSubscriptionsCallable"] + }, + "ListTopics": { + "methods": ["listTopics", "listTopics", "listTopics", "listTopicsPagedCallable", "listTopicsCallable"] + }, + "Publish": { + "methods": ["publish", "publish", "publish", "publishCallable"] + }, + "SetIamPolicy": { + "methods": ["setIamPolicy", "setIamPolicyCallable"] + }, + "TestIamPermissions": { + "methods": ["testIamPermissions", "testIamPermissionsCallable"] + }, + "UpdateTopic": { + "methods": ["updateTopic", "updateTopic", "updateTopicCallable"] + } + } + } + } + }, + "Subscriber": { + "clients": { + "grpc": { + "libraryClient": "SubscriptionAdminClient", + "rpcs": { + "Acknowledge": { + "methods": ["acknowledge", "acknowledge", "acknowledge", "acknowledgeCallable"] + }, + "CreateSnapshot": { + "methods": ["createSnapshot", "createSnapshot", "createSnapshot", "createSnapshot", "createSnapshot", "createSnapshotCallable"] + }, + "CreateSubscription": { + "methods": ["createSubscription", "createSubscription", "createSubscription", "createSubscription", "createSubscription", "createSubscriptionCallable"] + }, + "DeleteSnapshot": { + "methods": ["deleteSnapshot", "deleteSnapshot", "deleteSnapshot", "deleteSnapshotCallable"] + }, + "DeleteSubscription": { + "methods": ["deleteSubscription", "deleteSubscription", "deleteSubscription", "deleteSubscriptionCallable"] + }, + "GetIamPolicy": { + "methods": ["getIamPolicy", "getIamPolicyCallable"] + }, + "GetSnapshot": { + "methods": ["getSnapshot", "getSnapshot", "getSnapshot", "getSnapshotCallable"] + }, + "GetSubscription": { + "methods": ["getSubscription", "getSubscription", "getSubscription", "getSubscriptionCallable"] + }, + "ListSnapshots": { + "methods": ["listSnapshots", "listSnapshots", "listSnapshots", "listSnapshotsPagedCallable", "listSnapshotsCallable"] + }, + "ListSubscriptions": { + "methods": ["listSubscriptions", "listSubscriptions", "listSubscriptions", "listSubscriptionsPagedCallable", "listSubscriptionsCallable"] + }, + "ModifyAckDeadline": { + "methods": ["modifyAckDeadline", "modifyAckDeadline", "modifyAckDeadline", "modifyAckDeadlineCallable"] + }, + "ModifyPushConfig": { + "methods": ["modifyPushConfig", "modifyPushConfig", "modifyPushConfig", "modifyPushConfigCallable"] + }, + "Pull": { + "methods": ["pull", "pull", "pull", "pull", "pull", "pullCallable"] + }, + "Seek": { + "methods": ["seek", "seekCallable"] + }, + "SetIamPolicy": { + "methods": ["setIamPolicy", "setIamPolicyCallable"] + }, + "StreamingPull": { + "methods": ["streamingPullCallable"] + }, + "TestIamPermissions": { + "methods": ["testIamPermissions", "testIamPermissionsCallable"] + }, + "UpdateSnapshot": { + "methods": ["updateSnapshot", "updateSnapshot", "updateSnapshotCallable"] + }, + "UpdateSubscription": { + "methods": ["updateSubscription", "updateSubscription", "updateSubscriptionCallable"] + } + } + } + } + }, + "SchemaService": { + "clients": { + "grpc": { + "libraryClient": "SchemaServiceClient", + "rpcs": { + "CommitSchema": { + "methods": ["commitSchema", "commitSchema", "commitSchema", "commitSchemaCallable"] + }, + "CreateSchema": { + "methods": ["createSchema", "createSchema", "createSchema", "createSchemaCallable"] + }, + "DeleteSchema": { + "methods": ["deleteSchema", "deleteSchema", "deleteSchema", "deleteSchemaCallable"] + }, + "DeleteSchemaRevision": { + "methods": ["deleteSchemaRevision", "deleteSchemaRevision", "deleteSchemaRevision", "deleteSchemaRevisionCallable"] + }, + "GetIamPolicy": { + "methods": ["getIamPolicy", "getIamPolicyCallable"] + }, + "GetSchema": { + "methods": ["getSchema", "getSchema", "getSchema", "getSchemaCallable"] + }, + "ListSchemaRevisions": { + "methods": ["listSchemaRevisions", "listSchemaRevisions", "listSchemaRevisions", "listSchemaRevisionsPagedCallable", "listSchemaRevisionsCallable"] + }, + "ListSchemas": { + "methods": ["listSchemas", "listSchemas", "listSchemas", "listSchemasPagedCallable", "listSchemasCallable"] + }, + "RollbackSchema": { + "methods": ["rollbackSchema", "rollbackSchema", "rollbackSchema", "rollbackSchemaCallable"] + }, + "SetIamPolicy": { + "methods": ["setIamPolicy", "setIamPolicyCallable"] + }, + "TestIamPermissions": { + "methods": ["testIamPermissions", "testIamPermissionsCallable"] + }, + "ValidateMessage": { + "methods": ["validateMessage", "validateMessageCallable"] + }, + "ValidateSchema": { + "methods": ["validateSchema", "validateSchema", "validateSchema", "validateSchemaCallable"] + } + } + } + } + } + } +} \ No newline at end of file diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/package-info.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/package-info.java index 88af5d794..a85a38b2b 100644 --- a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/package-info.java +++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/package-info.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 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 + * 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, @@ -15,68 +15,74 @@ */ /** - * A client to Cloud Pub/Sub API. + * A client to Cloud Pub/Sub API * *

The interfaces provided are listed below, along with usage samples. * - *

=================== SchemaServiceClient =================== - * - *

Service Description: - * - *

Sample for SchemaServiceClient: - * - *

- * 
- * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
- *   ProjectName parent = ProjectName.of("[PROJECT]");
- *   Schema schema = Schema.newBuilder().build();
- *   String schemaId = "";
- *   Schema response = schemaServiceClient.createSchema(parent, schema, schemaId);
- * }
- * 
- * 
- * - * ================ TopicAdminClient ================ + *

======================= TopicAdminClient ======================= * *

Service Description: The service that an application uses to manipulate topics, and to send * messages to a topic. * - *

To publish messages to a topic, see the Publisher class. - * *

Sample for TopicAdminClient: * - *

- * 
+ * 
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
  * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
  *   TopicName name = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
  *   Topic response = topicAdminClient.createTopic(name);
  * }
- * 
- * 
+ * }
* - * ======================= SubscriptionAdminClient ======================= + *

======================= SubscriptionAdminClient ======================= * *

Service Description: The service that an application uses to manipulate subscriptions and to * consume messages from a subscription via the `Pull` method or by establishing a bi-directional * stream using the `StreamingPull` method. * - *

To retrieve messages from a subscription, see the Subscriber class. - * *

Sample for SubscriptionAdminClient: * - *

- * 
+ * 
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
  * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- *   ProjectSubscriptionName name = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
+ *   SubscriptionName name = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
  *   TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
  *   PushConfig pushConfig = PushConfig.newBuilder().build();
- *   int ackDeadlineSeconds = 0;
- *   Subscription response = subscriptionAdminClient.createSubscription(name, topic, pushConfig, ackDeadlineSeconds);
+ *   int ackDeadlineSeconds = 2135351438;
+ *   Subscription response =
+ *       subscriptionAdminClient.createSubscription(name, topic, pushConfig, ackDeadlineSeconds);
+ * }
+ * }
+ * + *

======================= SchemaServiceClient ======================= + * + *

Service Description: Service for doing schema-related operations. + * + *

Sample for SchemaServiceClient: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
+ *   ProjectName parent = ProjectName.of("[PROJECT]");
+ *   Schema schema = Schema.newBuilder().build();
+ *   String schemaId = "schemaId-697673060";
+ *   Schema response = schemaServiceClient.createSchema(parent, schema, schemaId);
  * }
- * 
- * 
+ * }
*/ -@Generated("by gapic-generator") +@Generated("by gapic-generator-java") package com.google.cloud.pubsub.v1; import javax.annotation.Generated; diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/GrpcPublisherCallableFactory.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/GrpcPublisherCallableFactory.java index d3089ca30..92adc0c86 100644 --- a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/GrpcPublisherCallableFactory.java +++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/GrpcPublisherCallableFactory.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 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 + * 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, @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.pubsub.v1.stub; -import com.google.api.core.BetaApi; import com.google.api.gax.grpc.GrpcCallSettings; import com.google.api.gax.grpc.GrpcCallableFactory; import com.google.api.gax.grpc.GrpcStubCallableFactory; @@ -31,18 +31,19 @@ import com.google.api.gax.rpc.StreamingCallSettings; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; import com.google.longrunning.stub.OperationsStub; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC callable factory implementation for Cloud Pub/Sub API. + * gRPC callable factory implementation for the Publisher service API. * *

This class is for advanced usage. */ -@Generated("by gapic-generator") -@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +@Generated("by gapic-generator-java") public class GrpcPublisherCallableFactory implements GrpcStubCallableFactory { + @Override public UnaryCallable createUnaryCallable( GrpcCallSettings grpcCallSettings, @@ -55,61 +56,58 @@ public UnaryCallable createUnaryCalla public UnaryCallable createPagedCallable( GrpcCallSettings grpcCallSettings, - PagedCallSettings pagedCallSettings, + PagedCallSettings callSettings, ClientContext clientContext) { - return GrpcCallableFactory.createPagedCallable( - grpcCallSettings, pagedCallSettings, clientContext); + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); } @Override public UnaryCallable createBatchingCallable( GrpcCallSettings grpcCallSettings, - BatchingCallSettings batchingCallSettings, + BatchingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBatchingCallable( - grpcCallSettings, batchingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") @Override public OperationCallable createOperationCallable( - GrpcCallSettings grpcCallSettings, - OperationCallSettings operationCallSettings, + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, ClientContext clientContext, OperationsStub operationsStub) { return GrpcCallableFactory.createOperationCallable( - grpcCallSettings, operationCallSettings, clientContext, operationsStub); + grpcCallSettings, callSettings, clientContext, operationsStub); } @Override public BidiStreamingCallable createBidiStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBidiStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ServerStreamingCallable createServerStreamingCallable( GrpcCallSettings grpcCallSettings, - ServerStreamingCallSettings streamingCallSettings, + ServerStreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createServerStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ClientStreamingCallable createClientStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createClientStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } } diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/GrpcPublisherStub.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/GrpcPublisherStub.java index 52cdf25dc..137efe471 100644 --- a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/GrpcPublisherStub.java +++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/GrpcPublisherStub.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 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 + * 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, @@ -13,26 +13,26 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.pubsub.v1.stub; import static com.google.cloud.pubsub.v1.TopicAdminClient.ListTopicSnapshotsPagedResponse; import static com.google.cloud.pubsub.v1.TopicAdminClient.ListTopicSubscriptionsPagedResponse; import static com.google.cloud.pubsub.v1.TopicAdminClient.ListTopicsPagedResponse; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; import com.google.api.gax.grpc.GrpcCallSettings; import com.google.api.gax.grpc.GrpcStubCallableFactory; import com.google.api.gax.rpc.ClientContext; -import com.google.api.gax.rpc.RequestParamsExtractor; +import com.google.api.gax.rpc.RequestParamsBuilder; import com.google.api.gax.rpc.UnaryCallable; -import com.google.common.collect.ImmutableMap; import com.google.iam.v1.GetIamPolicyRequest; import com.google.iam.v1.Policy; import com.google.iam.v1.SetIamPolicyRequest; import com.google.iam.v1.TestIamPermissionsRequest; import com.google.iam.v1.TestIamPermissionsResponse; +import com.google.longrunning.stub.GrpcOperationsStub; import com.google.protobuf.Empty; import com.google.pubsub.v1.DeleteTopicRequest; import com.google.pubsub.v1.DetachSubscriptionRequest; @@ -51,48 +51,53 @@ import io.grpc.MethodDescriptor; import io.grpc.protobuf.ProtoUtils; import java.io.IOException; -import java.util.Map; import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC stub implementation for Cloud Pub/Sub API. + * gRPC stub implementation for the Publisher service API. * *

This class is for advanced usage and reflects the underlying API directly. */ -@Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +@Generated("by gapic-generator-java") public class GrpcPublisherStub extends PublisherStub { - private static final MethodDescriptor createTopicMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.pubsub.v1.Publisher/CreateTopic") .setRequestMarshaller(ProtoUtils.marshaller(Topic.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Topic.getDefaultInstance())) + .setSampledToLocalTracing(true) .build(); + private static final MethodDescriptor updateTopicMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.pubsub.v1.Publisher/UpdateTopic") .setRequestMarshaller(ProtoUtils.marshaller(UpdateTopicRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Topic.getDefaultInstance())) + .setSampledToLocalTracing(true) .build(); + private static final MethodDescriptor publishMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.pubsub.v1.Publisher/Publish") .setRequestMarshaller(ProtoUtils.marshaller(PublishRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(PublishResponse.getDefaultInstance())) + .setSampledToLocalTracing(true) .build(); + private static final MethodDescriptor getTopicMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.pubsub.v1.Publisher/GetTopic") .setRequestMarshaller(ProtoUtils.marshaller(GetTopicRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Topic.getDefaultInstance())) + .setSampledToLocalTracing(true) .build(); + private static final MethodDescriptor listTopicsMethodDescriptor = MethodDescriptor.newBuilder() @@ -100,7 +105,9 @@ public class GrpcPublisherStub extends PublisherStub { .setFullMethodName("google.pubsub.v1.Publisher/ListTopics") .setRequestMarshaller(ProtoUtils.marshaller(ListTopicsRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(ListTopicsResponse.getDefaultInstance())) + .setSampledToLocalTracing(true) .build(); + private static final MethodDescriptor< ListTopicSubscriptionsRequest, ListTopicSubscriptionsResponse> listTopicSubscriptionsMethodDescriptor = @@ -112,7 +119,9 @@ public class GrpcPublisherStub extends PublisherStub { ProtoUtils.marshaller(ListTopicSubscriptionsRequest.getDefaultInstance())) .setResponseMarshaller( ProtoUtils.marshaller(ListTopicSubscriptionsResponse.getDefaultInstance())) + .setSampledToLocalTracing(true) .build(); + private static final MethodDescriptor listTopicSnapshotsMethodDescriptor = MethodDescriptor.newBuilder() @@ -122,28 +131,48 @@ public class GrpcPublisherStub extends PublisherStub { ProtoUtils.marshaller(ListTopicSnapshotsRequest.getDefaultInstance())) .setResponseMarshaller( ProtoUtils.marshaller(ListTopicSnapshotsResponse.getDefaultInstance())) + .setSampledToLocalTracing(true) .build(); + private static final MethodDescriptor deleteTopicMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.pubsub.v1.Publisher/DeleteTopic") .setRequestMarshaller(ProtoUtils.marshaller(DeleteTopicRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) + .setSampledToLocalTracing(true) .build(); + + private static final MethodDescriptor + detachSubscriptionMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.pubsub.v1.Publisher/DetachSubscription") + .setRequestMarshaller( + ProtoUtils.marshaller(DetachSubscriptionRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(DetachSubscriptionResponse.getDefaultInstance())) + .setSampledToLocalTracing(true) + .build(); + private static final MethodDescriptor setIamPolicyMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.iam.v1.IAMPolicy/SetIamPolicy") .setRequestMarshaller(ProtoUtils.marshaller(SetIamPolicyRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Policy.getDefaultInstance())) + .setSampledToLocalTracing(true) .build(); + private static final MethodDescriptor getIamPolicyMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.iam.v1.IAMPolicy/GetIamPolicy") .setRequestMarshaller(ProtoUtils.marshaller(GetIamPolicyRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Policy.getDefaultInstance())) + .setSampledToLocalTracing(true) .build(); + private static final MethodDescriptor testIamPermissionsMethodDescriptor = MethodDescriptor.newBuilder() @@ -153,19 +182,8 @@ public class GrpcPublisherStub extends PublisherStub { ProtoUtils.marshaller(TestIamPermissionsRequest.getDefaultInstance())) .setResponseMarshaller( ProtoUtils.marshaller(TestIamPermissionsResponse.getDefaultInstance())) + .setSampledToLocalTracing(true) .build(); - private static final MethodDescriptor - detachSubscriptionMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName("google.pubsub.v1.Publisher/DetachSubscription") - .setRequestMarshaller( - ProtoUtils.marshaller(DetachSubscriptionRequest.getDefaultInstance())) - .setResponseMarshaller( - ProtoUtils.marshaller(DetachSubscriptionResponse.getDefaultInstance())) - .build(); - - private final BackgroundResource backgroundResources; private final UnaryCallable createTopicCallable; private final UnaryCallable updateTopicCallable; @@ -182,13 +200,15 @@ public class GrpcPublisherStub extends PublisherStub { private final UnaryCallable listTopicSnapshotsPagedCallable; private final UnaryCallable deleteTopicCallable; + private final UnaryCallable + detachSubscriptionCallable; private final UnaryCallable setIamPolicyCallable; private final UnaryCallable getIamPolicyCallable; private final UnaryCallable testIamPermissionsCallable; - private final UnaryCallable - detachSubscriptionCallable; + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; private final GrpcStubCallableFactory callableFactory; public static final GrpcPublisherStub create(PublisherStubSettings settings) throws IOException { @@ -226,71 +246,61 @@ protected GrpcPublisherStub( GrpcStubCallableFactory callableFactory) throws IOException { this.callableFactory = callableFactory; + this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); GrpcCallSettings createTopicTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(createTopicMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(Topic request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("name", String.valueOf(request.getName())); - return params.build(); - } + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("name", String.valueOf(request.getName())); + return builder.build(); }) + .setResourceNameExtractor(request -> request.getName()) .build(); GrpcCallSettings updateTopicTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(updateTopicMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(UpdateTopicRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("topic.name", String.valueOf(request.getTopic().getName())); - return params.build(); - } + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("topic.name", String.valueOf(request.getTopic().getName())); + return builder.build(); }) .build(); GrpcCallSettings publishTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(publishMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(PublishRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("topic", String.valueOf(request.getTopic())); - return params.build(); - } + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("topic", String.valueOf(request.getTopic())); + return builder.build(); }) + .setResourceNameExtractor(request -> request.getTopic()) .build(); GrpcCallSettings getTopicTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(getTopicMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(GetTopicRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("topic", String.valueOf(request.getTopic())); - return params.build(); - } + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("topic", String.valueOf(request.getTopic())); + return builder.build(); }) + .setResourceNameExtractor(request -> request.getTopic()) .build(); GrpcCallSettings listTopicsTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(listTopicsMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(ListTopicsRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("project", String.valueOf(request.getProject())); - return params.build(); - } + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("project", String.valueOf(request.getProject())); + return builder.build(); }) + .setResourceNameExtractor(request -> request.getProject()) .build(); GrpcCallSettings listTopicSubscriptionsTransportSettings = @@ -298,95 +308,81 @@ public Map extract(ListTopicsRequest request) { .newBuilder() .setMethodDescriptor(listTopicSubscriptionsMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(ListTopicSubscriptionsRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("topic", String.valueOf(request.getTopic())); - return params.build(); - } + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("topic", String.valueOf(request.getTopic())); + return builder.build(); }) + .setResourceNameExtractor(request -> request.getTopic()) .build(); GrpcCallSettings listTopicSnapshotsTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(listTopicSnapshotsMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(ListTopicSnapshotsRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("topic", String.valueOf(request.getTopic())); - return params.build(); - } + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("topic", String.valueOf(request.getTopic())); + return builder.build(); }) + .setResourceNameExtractor(request -> request.getTopic()) .build(); GrpcCallSettings deleteTopicTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(deleteTopicMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(DeleteTopicRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("topic", String.valueOf(request.getTopic())); - return params.build(); - } + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("topic", String.valueOf(request.getTopic())); + return builder.build(); }) + .setResourceNameExtractor(request -> request.getTopic()) .build(); + GrpcCallSettings + detachSubscriptionTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(detachSubscriptionMethodDescriptor) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("subscription", String.valueOf(request.getSubscription())); + return builder.build(); + }) + .setResourceNameExtractor(request -> request.getSubscription()) + .build(); GrpcCallSettings setIamPolicyTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(setIamPolicyMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(SetIamPolicyRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("resource", String.valueOf(request.getResource())); - return params.build(); - } + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("resource", String.valueOf(request.getResource())); + return builder.build(); }) + .setResourceNameExtractor(request -> request.getResource()) .build(); GrpcCallSettings getIamPolicyTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(getIamPolicyMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(GetIamPolicyRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("resource", String.valueOf(request.getResource())); - return params.build(); - } + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("resource", String.valueOf(request.getResource())); + return builder.build(); }) + .setResourceNameExtractor(request -> request.getResource()) .build(); GrpcCallSettings testIamPermissionsTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(testIamPermissionsMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(TestIamPermissionsRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("resource", String.valueOf(request.getResource())); - return params.build(); - } - }) - .build(); - GrpcCallSettings - detachSubscriptionTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(detachSubscriptionMethodDescriptor) - .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(DetachSubscriptionRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("subscription", String.valueOf(request.getSubscription())); - return params.build(); - } + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("resource", String.valueOf(request.getResource())); + return builder.build(); }) + .setResourceNameExtractor(request -> request.getResource()) .build(); this.createTopicCallable = @@ -430,6 +426,11 @@ public Map extract(DetachSubscriptionRequest request) { this.deleteTopicCallable = callableFactory.createUnaryCallable( deleteTopicTransportSettings, settings.deleteTopicSettings(), clientContext); + this.detachSubscriptionCallable = + callableFactory.createUnaryCallable( + detachSubscriptionTransportSettings, + settings.detachSubscriptionSettings(), + clientContext); this.setIamPolicyCallable = callableFactory.createUnaryCallable( setIamPolicyTransportSettings, settings.setIamPolicySettings(), clientContext); @@ -441,84 +442,105 @@ public Map extract(DetachSubscriptionRequest request) { testIamPermissionsTransportSettings, settings.testIamPermissionsSettings(), clientContext); - this.detachSubscriptionCallable = - callableFactory.createUnaryCallable( - detachSubscriptionTransportSettings, - settings.detachSubscriptionSettings(), - clientContext); - backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + public GrpcOperationsStub getOperationsStub() { + return operationsStub; } + @Override public UnaryCallable createTopicCallable() { return createTopicCallable; } + @Override public UnaryCallable updateTopicCallable() { return updateTopicCallable; } + @Override public UnaryCallable publishCallable() { return publishCallable; } + @Override public UnaryCallable getTopicCallable() { return getTopicCallable; } - public UnaryCallable listTopicsPagedCallable() { - return listTopicsPagedCallable; - } - + @Override public UnaryCallable listTopicsCallable() { return listTopicsCallable; } - public UnaryCallable - listTopicSubscriptionsPagedCallable() { - return listTopicSubscriptionsPagedCallable; + @Override + public UnaryCallable listTopicsPagedCallable() { + return listTopicsPagedCallable; } + @Override public UnaryCallable listTopicSubscriptionsCallable() { return listTopicSubscriptionsCallable; } - public UnaryCallable - listTopicSnapshotsPagedCallable() { - return listTopicSnapshotsPagedCallable; + @Override + public UnaryCallable + listTopicSubscriptionsPagedCallable() { + return listTopicSubscriptionsPagedCallable; } + @Override public UnaryCallable listTopicSnapshotsCallable() { return listTopicSnapshotsCallable; } + @Override + public UnaryCallable + listTopicSnapshotsPagedCallable() { + return listTopicSnapshotsPagedCallable; + } + + @Override public UnaryCallable deleteTopicCallable() { return deleteTopicCallable; } + @Override + public UnaryCallable + detachSubscriptionCallable() { + return detachSubscriptionCallable; + } + + @Override public UnaryCallable setIamPolicyCallable() { return setIamPolicyCallable; } + @Override public UnaryCallable getIamPolicyCallable() { return getIamPolicyCallable; } + @Override public UnaryCallable testIamPermissionsCallable() { return testIamPermissionsCallable; } - public UnaryCallable - detachSubscriptionCallable() { - return detachSubscriptionCallable; - } - @Override public final void close() { - shutdown(); + try { + backgroundResources.close(); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new IllegalStateException("Failed to close resource", e); + } } @Override diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/GrpcSchemaServiceCallableFactory.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/GrpcSchemaServiceCallableFactory.java index c7e5d89e2..16236bc4b 100644 --- a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/GrpcSchemaServiceCallableFactory.java +++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/GrpcSchemaServiceCallableFactory.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 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 + * 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, @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.pubsub.v1.stub; -import com.google.api.core.BetaApi; import com.google.api.gax.grpc.GrpcCallSettings; import com.google.api.gax.grpc.GrpcCallableFactory; import com.google.api.gax.grpc.GrpcStubCallableFactory; @@ -31,18 +31,19 @@ import com.google.api.gax.rpc.StreamingCallSettings; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; import com.google.longrunning.stub.OperationsStub; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC callable factory implementation for Cloud Pub/Sub API. + * gRPC callable factory implementation for the SchemaService service API. * *

This class is for advanced usage. */ -@Generated("by gapic-generator") -@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +@Generated("by gapic-generator-java") public class GrpcSchemaServiceCallableFactory implements GrpcStubCallableFactory { + @Override public UnaryCallable createUnaryCallable( GrpcCallSettings grpcCallSettings, @@ -55,61 +56,58 @@ public UnaryCallable createUnaryCalla public UnaryCallable createPagedCallable( GrpcCallSettings grpcCallSettings, - PagedCallSettings pagedCallSettings, + PagedCallSettings callSettings, ClientContext clientContext) { - return GrpcCallableFactory.createPagedCallable( - grpcCallSettings, pagedCallSettings, clientContext); + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); } @Override public UnaryCallable createBatchingCallable( GrpcCallSettings grpcCallSettings, - BatchingCallSettings batchingCallSettings, + BatchingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBatchingCallable( - grpcCallSettings, batchingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") @Override public OperationCallable createOperationCallable( - GrpcCallSettings grpcCallSettings, - OperationCallSettings operationCallSettings, + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, ClientContext clientContext, OperationsStub operationsStub) { return GrpcCallableFactory.createOperationCallable( - grpcCallSettings, operationCallSettings, clientContext, operationsStub); + grpcCallSettings, callSettings, clientContext, operationsStub); } @Override public BidiStreamingCallable createBidiStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBidiStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ServerStreamingCallable createServerStreamingCallable( GrpcCallSettings grpcCallSettings, - ServerStreamingCallSettings streamingCallSettings, + ServerStreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createServerStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ClientStreamingCallable createClientStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createClientStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } } diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/GrpcSchemaServiceStub.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/GrpcSchemaServiceStub.java index 220d4592c..a13604e4b 100644 --- a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/GrpcSchemaServiceStub.java +++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/GrpcSchemaServiceStub.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 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 + * 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, @@ -13,25 +13,36 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.pubsub.v1.stub; +import static com.google.cloud.pubsub.v1.SchemaServiceClient.ListSchemaRevisionsPagedResponse; import static com.google.cloud.pubsub.v1.SchemaServiceClient.ListSchemasPagedResponse; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; import com.google.api.gax.grpc.GrpcCallSettings; import com.google.api.gax.grpc.GrpcStubCallableFactory; import com.google.api.gax.rpc.ClientContext; -import com.google.api.gax.rpc.RequestParamsExtractor; +import com.google.api.gax.rpc.RequestParamsBuilder; import com.google.api.gax.rpc.UnaryCallable; -import com.google.common.collect.ImmutableMap; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import com.google.longrunning.stub.GrpcOperationsStub; import com.google.protobuf.Empty; +import com.google.pubsub.v1.CommitSchemaRequest; import com.google.pubsub.v1.CreateSchemaRequest; import com.google.pubsub.v1.DeleteSchemaRequest; +import com.google.pubsub.v1.DeleteSchemaRevisionRequest; import com.google.pubsub.v1.GetSchemaRequest; +import com.google.pubsub.v1.ListSchemaRevisionsRequest; +import com.google.pubsub.v1.ListSchemaRevisionsResponse; import com.google.pubsub.v1.ListSchemasRequest; import com.google.pubsub.v1.ListSchemasResponse; +import com.google.pubsub.v1.RollbackSchemaRequest; import com.google.pubsub.v1.Schema; import com.google.pubsub.v1.ValidateMessageRequest; import com.google.pubsub.v1.ValidateMessageResponse; @@ -40,34 +51,35 @@ import io.grpc.MethodDescriptor; import io.grpc.protobuf.ProtoUtils; import java.io.IOException; -import java.util.Map; import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC stub implementation for Cloud Pub/Sub API. + * gRPC stub implementation for the SchemaService service API. * *

This class is for advanced usage and reflects the underlying API directly. */ -@Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +@Generated("by gapic-generator-java") public class GrpcSchemaServiceStub extends SchemaServiceStub { - private static final MethodDescriptor createSchemaMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.pubsub.v1.SchemaService/CreateSchema") .setRequestMarshaller(ProtoUtils.marshaller(CreateSchemaRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Schema.getDefaultInstance())) + .setSampledToLocalTracing(true) .build(); + private static final MethodDescriptor getSchemaMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.pubsub.v1.SchemaService/GetSchema") .setRequestMarshaller(ProtoUtils.marshaller(GetSchemaRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Schema.getDefaultInstance())) + .setSampledToLocalTracing(true) .build(); + private static final MethodDescriptor listSchemasMethodDescriptor = MethodDescriptor.newBuilder() @@ -76,14 +88,61 @@ public class GrpcSchemaServiceStub extends SchemaServiceStub { .setRequestMarshaller(ProtoUtils.marshaller(ListSchemasRequest.getDefaultInstance())) .setResponseMarshaller( ProtoUtils.marshaller(ListSchemasResponse.getDefaultInstance())) + .setSampledToLocalTracing(true) + .build(); + + private static final MethodDescriptor + listSchemaRevisionsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.pubsub.v1.SchemaService/ListSchemaRevisions") + .setRequestMarshaller( + ProtoUtils.marshaller(ListSchemaRevisionsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListSchemaRevisionsResponse.getDefaultInstance())) + .setSampledToLocalTracing(true) + .build(); + + private static final MethodDescriptor commitSchemaMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.pubsub.v1.SchemaService/CommitSchema") + .setRequestMarshaller(ProtoUtils.marshaller(CommitSchemaRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Schema.getDefaultInstance())) + .setSampledToLocalTracing(true) + .build(); + + private static final MethodDescriptor + rollbackSchemaMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.pubsub.v1.SchemaService/RollbackSchema") + .setRequestMarshaller( + ProtoUtils.marshaller(RollbackSchemaRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Schema.getDefaultInstance())) + .setSampledToLocalTracing(true) .build(); + + private static final MethodDescriptor + deleteSchemaRevisionMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.pubsub.v1.SchemaService/DeleteSchemaRevision") + .setRequestMarshaller( + ProtoUtils.marshaller(DeleteSchemaRevisionRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Schema.getDefaultInstance())) + .setSampledToLocalTracing(true) + .build(); + private static final MethodDescriptor deleteSchemaMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.pubsub.v1.SchemaService/DeleteSchema") .setRequestMarshaller(ProtoUtils.marshaller(DeleteSchemaRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) + .setSampledToLocalTracing(true) .build(); + private static final MethodDescriptor validateSchemaMethodDescriptor = MethodDescriptor.newBuilder() @@ -93,7 +152,9 @@ public class GrpcSchemaServiceStub extends SchemaServiceStub { ProtoUtils.marshaller(ValidateSchemaRequest.getDefaultInstance())) .setResponseMarshaller( ProtoUtils.marshaller(ValidateSchemaResponse.getDefaultInstance())) + .setSampledToLocalTracing(true) .build(); + private static final MethodDescriptor validateMessageMethodDescriptor = MethodDescriptor.newBuilder() @@ -103,20 +164,62 @@ public class GrpcSchemaServiceStub extends SchemaServiceStub { ProtoUtils.marshaller(ValidateMessageRequest.getDefaultInstance())) .setResponseMarshaller( ProtoUtils.marshaller(ValidateMessageResponse.getDefaultInstance())) + .setSampledToLocalTracing(true) .build(); - private final BackgroundResource backgroundResources; + private static final MethodDescriptor setIamPolicyMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.iam.v1.IAMPolicy/SetIamPolicy") + .setRequestMarshaller(ProtoUtils.marshaller(SetIamPolicyRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Policy.getDefaultInstance())) + .setSampledToLocalTracing(true) + .build(); + + private static final MethodDescriptor getIamPolicyMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.iam.v1.IAMPolicy/GetIamPolicy") + .setRequestMarshaller(ProtoUtils.marshaller(GetIamPolicyRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Policy.getDefaultInstance())) + .setSampledToLocalTracing(true) + .build(); + + private static final MethodDescriptor + testIamPermissionsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.iam.v1.IAMPolicy/TestIamPermissions") + .setRequestMarshaller( + ProtoUtils.marshaller(TestIamPermissionsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(TestIamPermissionsResponse.getDefaultInstance())) + .setSampledToLocalTracing(true) + .build(); private final UnaryCallable createSchemaCallable; private final UnaryCallable getSchemaCallable; private final UnaryCallable listSchemasCallable; private final UnaryCallable listSchemasPagedCallable; + private final UnaryCallable + listSchemaRevisionsCallable; + private final UnaryCallable + listSchemaRevisionsPagedCallable; + private final UnaryCallable commitSchemaCallable; + private final UnaryCallable rollbackSchemaCallable; + private final UnaryCallable deleteSchemaRevisionCallable; private final UnaryCallable deleteSchemaCallable; private final UnaryCallable validateSchemaCallable; private final UnaryCallable validateMessageCallable; + private final UnaryCallable setIamPolicyCallable; + private final UnaryCallable getIamPolicyCallable; + private final UnaryCallable + testIamPermissionsCallable; + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; private final GrpcStubCallableFactory callableFactory; public static final GrpcSchemaServiceStub create(SchemaServiceStubSettings settings) @@ -155,86 +258,154 @@ protected GrpcSchemaServiceStub( GrpcStubCallableFactory callableFactory) throws IOException { this.callableFactory = callableFactory; + this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); GrpcCallSettings createSchemaTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(createSchemaMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(CreateSchemaRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("parent", String.valueOf(request.getParent())); - return params.build(); - } + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("parent", String.valueOf(request.getParent())); + return builder.build(); }) + .setResourceNameExtractor(request -> request.getParent()) .build(); GrpcCallSettings getSchemaTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(getSchemaMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(GetSchemaRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("name", String.valueOf(request.getName())); - return params.build(); - } + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("name", String.valueOf(request.getName())); + return builder.build(); }) + .setResourceNameExtractor(request -> request.getName()) .build(); GrpcCallSettings listSchemasTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(listSchemasMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(ListSchemasRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("parent", String.valueOf(request.getParent())); - return params.build(); - } + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("parent", String.valueOf(request.getParent())); + return builder.build(); }) + .setResourceNameExtractor(request -> request.getParent()) + .build(); + GrpcCallSettings + listSchemaRevisionsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listSchemaRevisionsMethodDescriptor) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("name", String.valueOf(request.getName())); + return builder.build(); + }) + .setResourceNameExtractor(request -> request.getName()) + .build(); + GrpcCallSettings commitSchemaTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(commitSchemaMethodDescriptor) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("name", String.valueOf(request.getName())); + return builder.build(); + }) + .setResourceNameExtractor(request -> request.getName()) + .build(); + GrpcCallSettings rollbackSchemaTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(rollbackSchemaMethodDescriptor) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("name", String.valueOf(request.getName())); + return builder.build(); + }) + .setResourceNameExtractor(request -> request.getName()) + .build(); + GrpcCallSettings deleteSchemaRevisionTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(deleteSchemaRevisionMethodDescriptor) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("name", String.valueOf(request.getName())); + return builder.build(); + }) + .setResourceNameExtractor(request -> request.getName()) .build(); GrpcCallSettings deleteSchemaTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(deleteSchemaMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(DeleteSchemaRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("name", String.valueOf(request.getName())); - return params.build(); - } + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("name", String.valueOf(request.getName())); + return builder.build(); }) + .setResourceNameExtractor(request -> request.getName()) .build(); GrpcCallSettings validateSchemaTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(validateSchemaMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(ValidateSchemaRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("parent", String.valueOf(request.getParent())); - return params.build(); - } + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("parent", String.valueOf(request.getParent())); + return builder.build(); }) + .setResourceNameExtractor(request -> request.getParent()) .build(); GrpcCallSettings validateMessageTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(validateMessageMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(ValidateMessageRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("parent", String.valueOf(request.getParent())); - return params.build(); - } + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("parent", String.valueOf(request.getParent())); + return builder.build(); + }) + .setResourceNameExtractor(request -> request.getParent()) + .build(); + GrpcCallSettings setIamPolicyTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(setIamPolicyMethodDescriptor) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("resource", String.valueOf(request.getResource())); + return builder.build(); + }) + .setResourceNameExtractor(request -> request.getResource()) + .build(); + GrpcCallSettings getIamPolicyTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getIamPolicyMethodDescriptor) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("resource", String.valueOf(request.getResource())); + return builder.build(); + }) + .setResourceNameExtractor(request -> request.getResource()) + .build(); + GrpcCallSettings + testIamPermissionsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(testIamPermissionsMethodDescriptor) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("resource", String.valueOf(request.getResource())); + return builder.build(); }) + .setResourceNameExtractor(request -> request.getResource()) .build(); this.createSchemaCallable = @@ -249,6 +420,27 @@ public Map extract(ValidateMessageRequest request) { this.listSchemasPagedCallable = callableFactory.createPagedCallable( listSchemasTransportSettings, settings.listSchemasSettings(), clientContext); + this.listSchemaRevisionsCallable = + callableFactory.createUnaryCallable( + listSchemaRevisionsTransportSettings, + settings.listSchemaRevisionsSettings(), + clientContext); + this.listSchemaRevisionsPagedCallable = + callableFactory.createPagedCallable( + listSchemaRevisionsTransportSettings, + settings.listSchemaRevisionsSettings(), + clientContext); + this.commitSchemaCallable = + callableFactory.createUnaryCallable( + commitSchemaTransportSettings, settings.commitSchemaSettings(), clientContext); + this.rollbackSchemaCallable = + callableFactory.createUnaryCallable( + rollbackSchemaTransportSettings, settings.rollbackSchemaSettings(), clientContext); + this.deleteSchemaRevisionCallable = + callableFactory.createUnaryCallable( + deleteSchemaRevisionTransportSettings, + settings.deleteSchemaRevisionSettings(), + clientContext); this.deleteSchemaCallable = callableFactory.createUnaryCallable( deleteSchemaTransportSettings, settings.deleteSchemaSettings(), clientContext); @@ -258,41 +450,113 @@ public Map extract(ValidateMessageRequest request) { this.validateMessageCallable = callableFactory.createUnaryCallable( validateMessageTransportSettings, settings.validateMessageSettings(), clientContext); + this.setIamPolicyCallable = + callableFactory.createUnaryCallable( + setIamPolicyTransportSettings, settings.setIamPolicySettings(), clientContext); + this.getIamPolicyCallable = + callableFactory.createUnaryCallable( + getIamPolicyTransportSettings, settings.getIamPolicySettings(), clientContext); + this.testIamPermissionsCallable = + callableFactory.createUnaryCallable( + testIamPermissionsTransportSettings, + settings.testIamPermissionsSettings(), + clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } - backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + public GrpcOperationsStub getOperationsStub() { + return operationsStub; } + @Override public UnaryCallable createSchemaCallable() { return createSchemaCallable; } + @Override public UnaryCallable getSchemaCallable() { return getSchemaCallable; } + @Override + public UnaryCallable listSchemasCallable() { + return listSchemasCallable; + } + + @Override public UnaryCallable listSchemasPagedCallable() { return listSchemasPagedCallable; } - public UnaryCallable listSchemasCallable() { - return listSchemasCallable; + @Override + public UnaryCallable + listSchemaRevisionsCallable() { + return listSchemaRevisionsCallable; + } + + @Override + public UnaryCallable + listSchemaRevisionsPagedCallable() { + return listSchemaRevisionsPagedCallable; + } + + @Override + public UnaryCallable commitSchemaCallable() { + return commitSchemaCallable; + } + + @Override + public UnaryCallable rollbackSchemaCallable() { + return rollbackSchemaCallable; + } + + @Override + public UnaryCallable deleteSchemaRevisionCallable() { + return deleteSchemaRevisionCallable; } + @Override public UnaryCallable deleteSchemaCallable() { return deleteSchemaCallable; } + @Override public UnaryCallable validateSchemaCallable() { return validateSchemaCallable; } + @Override public UnaryCallable validateMessageCallable() { return validateMessageCallable; } + @Override + public UnaryCallable setIamPolicyCallable() { + return setIamPolicyCallable; + } + + @Override + public UnaryCallable getIamPolicyCallable() { + return getIamPolicyCallable; + } + + @Override + public UnaryCallable + testIamPermissionsCallable() { + return testIamPermissionsCallable; + } + @Override public final void close() { - shutdown(); + try { + backgroundResources.close(); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new IllegalStateException("Failed to close resource", e); + } } @Override diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/GrpcSubscriberCallableFactory.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/GrpcSubscriberCallableFactory.java index 8656445c4..8249a7219 100644 --- a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/GrpcSubscriberCallableFactory.java +++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/GrpcSubscriberCallableFactory.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 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 + * 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, @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.pubsub.v1.stub; -import com.google.api.core.BetaApi; import com.google.api.gax.grpc.GrpcCallSettings; import com.google.api.gax.grpc.GrpcCallableFactory; import com.google.api.gax.grpc.GrpcStubCallableFactory; @@ -31,18 +31,19 @@ import com.google.api.gax.rpc.StreamingCallSettings; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; import com.google.longrunning.stub.OperationsStub; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC callable factory implementation for Cloud Pub/Sub API. + * gRPC callable factory implementation for the Subscriber service API. * *

This class is for advanced usage. */ -@Generated("by gapic-generator") -@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +@Generated("by gapic-generator-java") public class GrpcSubscriberCallableFactory implements GrpcStubCallableFactory { + @Override public UnaryCallable createUnaryCallable( GrpcCallSettings grpcCallSettings, @@ -55,61 +56,58 @@ public UnaryCallable createUnaryCalla public UnaryCallable createPagedCallable( GrpcCallSettings grpcCallSettings, - PagedCallSettings pagedCallSettings, + PagedCallSettings callSettings, ClientContext clientContext) { - return GrpcCallableFactory.createPagedCallable( - grpcCallSettings, pagedCallSettings, clientContext); + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); } @Override public UnaryCallable createBatchingCallable( GrpcCallSettings grpcCallSettings, - BatchingCallSettings batchingCallSettings, + BatchingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBatchingCallable( - grpcCallSettings, batchingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") @Override public OperationCallable createOperationCallable( - GrpcCallSettings grpcCallSettings, - OperationCallSettings operationCallSettings, + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, ClientContext clientContext, OperationsStub operationsStub) { return GrpcCallableFactory.createOperationCallable( - grpcCallSettings, operationCallSettings, clientContext, operationsStub); + grpcCallSettings, callSettings, clientContext, operationsStub); } @Override public BidiStreamingCallable createBidiStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBidiStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ServerStreamingCallable createServerStreamingCallable( GrpcCallSettings grpcCallSettings, - ServerStreamingCallSettings streamingCallSettings, + ServerStreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createServerStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ClientStreamingCallable createClientStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createClientStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } } diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/GrpcSubscriberStub.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/GrpcSubscriberStub.java index 6d5ecda6e..6c51332e6 100644 --- a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/GrpcSubscriberStub.java +++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/GrpcSubscriberStub.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 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 + * 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, @@ -13,26 +13,26 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.pubsub.v1.stub; import static com.google.cloud.pubsub.v1.SubscriptionAdminClient.ListSnapshotsPagedResponse; import static com.google.cloud.pubsub.v1.SubscriptionAdminClient.ListSubscriptionsPagedResponse; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; import com.google.api.gax.grpc.GrpcCallSettings; import com.google.api.gax.grpc.GrpcStubCallableFactory; import com.google.api.gax.rpc.BidiStreamingCallable; import com.google.api.gax.rpc.ClientContext; -import com.google.api.gax.rpc.RequestParamsExtractor; +import com.google.api.gax.rpc.RequestParamsBuilder; import com.google.api.gax.rpc.UnaryCallable; -import com.google.common.collect.ImmutableMap; import com.google.iam.v1.GetIamPolicyRequest; import com.google.iam.v1.Policy; import com.google.iam.v1.SetIamPolicyRequest; import com.google.iam.v1.TestIamPermissionsRequest; import com.google.iam.v1.TestIamPermissionsResponse; +import com.google.longrunning.stub.GrpcOperationsStub; import com.google.protobuf.Empty; import com.google.pubsub.v1.AcknowledgeRequest; import com.google.pubsub.v1.CreateSnapshotRequest; @@ -59,20 +59,17 @@ import io.grpc.MethodDescriptor; import io.grpc.protobuf.ProtoUtils; import java.io.IOException; -import java.util.Map; import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC stub implementation for Cloud Pub/Sub API. + * gRPC stub implementation for the Subscriber service API. * *

This class is for advanced usage and reflects the underlying API directly. */ -@Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +@Generated("by gapic-generator-java") public class GrpcSubscriberStub extends SubscriberStub { - private static final MethodDescriptor createSubscriptionMethodDescriptor = MethodDescriptor.newBuilder() @@ -80,7 +77,9 @@ public class GrpcSubscriberStub extends SubscriberStub { .setFullMethodName("google.pubsub.v1.Subscriber/CreateSubscription") .setRequestMarshaller(ProtoUtils.marshaller(Subscription.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Subscription.getDefaultInstance())) + .setSampledToLocalTracing(true) .build(); + private static final MethodDescriptor getSubscriptionMethodDescriptor = MethodDescriptor.newBuilder() @@ -89,7 +88,9 @@ public class GrpcSubscriberStub extends SubscriberStub { .setRequestMarshaller( ProtoUtils.marshaller(GetSubscriptionRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Subscription.getDefaultInstance())) + .setSampledToLocalTracing(true) .build(); + private static final MethodDescriptor updateSubscriptionMethodDescriptor = MethodDescriptor.newBuilder() @@ -98,7 +99,9 @@ public class GrpcSubscriberStub extends SubscriberStub { .setRequestMarshaller( ProtoUtils.marshaller(UpdateSubscriptionRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Subscription.getDefaultInstance())) + .setSampledToLocalTracing(true) .build(); + private static final MethodDescriptor listSubscriptionsMethodDescriptor = MethodDescriptor.newBuilder() @@ -108,7 +111,9 @@ public class GrpcSubscriberStub extends SubscriberStub { ProtoUtils.marshaller(ListSubscriptionsRequest.getDefaultInstance())) .setResponseMarshaller( ProtoUtils.marshaller(ListSubscriptionsResponse.getDefaultInstance())) + .setSampledToLocalTracing(true) .build(); + private static final MethodDescriptor deleteSubscriptionMethodDescriptor = MethodDescriptor.newBuilder() @@ -117,14 +122,9 @@ public class GrpcSubscriberStub extends SubscriberStub { .setRequestMarshaller( ProtoUtils.marshaller(DeleteSubscriptionRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) + .setSampledToLocalTracing(true) .build(); - private static final MethodDescriptor getSnapshotMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName("google.pubsub.v1.Subscriber/GetSnapshot") - .setRequestMarshaller(ProtoUtils.marshaller(GetSnapshotRequest.getDefaultInstance())) - .setResponseMarshaller(ProtoUtils.marshaller(Snapshot.getDefaultInstance())) - .build(); + private static final MethodDescriptor modifyAckDeadlineMethodDescriptor = MethodDescriptor.newBuilder() @@ -133,21 +133,27 @@ public class GrpcSubscriberStub extends SubscriberStub { .setRequestMarshaller( ProtoUtils.marshaller(ModifyAckDeadlineRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) + .setSampledToLocalTracing(true) .build(); + private static final MethodDescriptor acknowledgeMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.pubsub.v1.Subscriber/Acknowledge") .setRequestMarshaller(ProtoUtils.marshaller(AcknowledgeRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) + .setSampledToLocalTracing(true) .build(); + private static final MethodDescriptor pullMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.pubsub.v1.Subscriber/Pull") .setRequestMarshaller(ProtoUtils.marshaller(PullRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(PullResponse.getDefaultInstance())) + .setSampledToLocalTracing(true) .build(); + private static final MethodDescriptor streamingPullMethodDescriptor = MethodDescriptor.newBuilder() @@ -157,7 +163,9 @@ public class GrpcSubscriberStub extends SubscriberStub { ProtoUtils.marshaller(StreamingPullRequest.getDefaultInstance())) .setResponseMarshaller( ProtoUtils.marshaller(StreamingPullResponse.getDefaultInstance())) + .setSampledToLocalTracing(true) .build(); + private static final MethodDescriptor modifyPushConfigMethodDescriptor = MethodDescriptor.newBuilder() @@ -166,7 +174,18 @@ public class GrpcSubscriberStub extends SubscriberStub { .setRequestMarshaller( ProtoUtils.marshaller(ModifyPushConfigRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) + .setSampledToLocalTracing(true) .build(); + + private static final MethodDescriptor getSnapshotMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.pubsub.v1.Subscriber/GetSnapshot") + .setRequestMarshaller(ProtoUtils.marshaller(GetSnapshotRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Snapshot.getDefaultInstance())) + .setSampledToLocalTracing(true) + .build(); + private static final MethodDescriptor listSnapshotsMethodDescriptor = MethodDescriptor.newBuilder() @@ -176,7 +195,9 @@ public class GrpcSubscriberStub extends SubscriberStub { ProtoUtils.marshaller(ListSnapshotsRequest.getDefaultInstance())) .setResponseMarshaller( ProtoUtils.marshaller(ListSnapshotsResponse.getDefaultInstance())) + .setSampledToLocalTracing(true) .build(); + private static final MethodDescriptor createSnapshotMethodDescriptor = MethodDescriptor.newBuilder() @@ -185,7 +206,9 @@ public class GrpcSubscriberStub extends SubscriberStub { .setRequestMarshaller( ProtoUtils.marshaller(CreateSnapshotRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Snapshot.getDefaultInstance())) + .setSampledToLocalTracing(true) .build(); + private static final MethodDescriptor updateSnapshotMethodDescriptor = MethodDescriptor.newBuilder() @@ -194,7 +217,9 @@ public class GrpcSubscriberStub extends SubscriberStub { .setRequestMarshaller( ProtoUtils.marshaller(UpdateSnapshotRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Snapshot.getDefaultInstance())) + .setSampledToLocalTracing(true) .build(); + private static final MethodDescriptor deleteSnapshotMethodDescriptor = MethodDescriptor.newBuilder() @@ -203,28 +228,36 @@ public class GrpcSubscriberStub extends SubscriberStub { .setRequestMarshaller( ProtoUtils.marshaller(DeleteSnapshotRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) + .setSampledToLocalTracing(true) .build(); + private static final MethodDescriptor seekMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.pubsub.v1.Subscriber/Seek") .setRequestMarshaller(ProtoUtils.marshaller(SeekRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(SeekResponse.getDefaultInstance())) + .setSampledToLocalTracing(true) .build(); + private static final MethodDescriptor setIamPolicyMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.iam.v1.IAMPolicy/SetIamPolicy") .setRequestMarshaller(ProtoUtils.marshaller(SetIamPolicyRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Policy.getDefaultInstance())) + .setSampledToLocalTracing(true) .build(); + private static final MethodDescriptor getIamPolicyMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.iam.v1.IAMPolicy/GetIamPolicy") .setRequestMarshaller(ProtoUtils.marshaller(GetIamPolicyRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Policy.getDefaultInstance())) + .setSampledToLocalTracing(true) .build(); + private static final MethodDescriptor testIamPermissionsMethodDescriptor = MethodDescriptor.newBuilder() @@ -234,10 +267,9 @@ public class GrpcSubscriberStub extends SubscriberStub { ProtoUtils.marshaller(TestIamPermissionsRequest.getDefaultInstance())) .setResponseMarshaller( ProtoUtils.marshaller(TestIamPermissionsResponse.getDefaultInstance())) + .setSampledToLocalTracing(true) .build(); - private final BackgroundResource backgroundResources; - private final UnaryCallable createSubscriptionCallable; private final UnaryCallable getSubscriptionCallable; private final UnaryCallable updateSubscriptionCallable; @@ -246,13 +278,13 @@ public class GrpcSubscriberStub extends SubscriberStub { private final UnaryCallable listSubscriptionsPagedCallable; private final UnaryCallable deleteSubscriptionCallable; - private final UnaryCallable getSnapshotCallable; private final UnaryCallable modifyAckDeadlineCallable; private final UnaryCallable acknowledgeCallable; private final UnaryCallable pullCallable; private final BidiStreamingCallable streamingPullCallable; private final UnaryCallable modifyPushConfigCallable; + private final UnaryCallable getSnapshotCallable; private final UnaryCallable listSnapshotsCallable; private final UnaryCallable listSnapshotsPagedCallable; @@ -265,6 +297,8 @@ public class GrpcSubscriberStub extends SubscriberStub { private final UnaryCallable testIamPermissionsCallable; + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; private final GrpcStubCallableFactory callableFactory; public static final GrpcSubscriberStub create(SubscriberStubSettings settings) @@ -303,45 +337,39 @@ protected GrpcSubscriberStub( GrpcStubCallableFactory callableFactory) throws IOException { this.callableFactory = callableFactory; + this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); GrpcCallSettings createSubscriptionTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(createSubscriptionMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(Subscription request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("name", String.valueOf(request.getName())); - return params.build(); - } + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("name", String.valueOf(request.getName())); + return builder.build(); }) + .setResourceNameExtractor(request -> request.getName()) .build(); GrpcCallSettings getSubscriptionTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(getSubscriptionMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(GetSubscriptionRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("subscription", String.valueOf(request.getSubscription())); - return params.build(); - } + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("subscription", String.valueOf(request.getSubscription())); + return builder.build(); }) + .setResourceNameExtractor(request -> request.getSubscription()) .build(); GrpcCallSettings updateSubscriptionTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(updateSubscriptionMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(UpdateSubscriptionRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put( - "subscription.name", String.valueOf(request.getSubscription().getName())); - return params.build(); - } + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add( + "subscription.name", String.valueOf(request.getSubscription().getName())); + return builder.build(); }) .build(); GrpcCallSettings @@ -349,201 +377,171 @@ public Map extract(UpdateSubscriptionRequest request) { GrpcCallSettings.newBuilder() .setMethodDescriptor(listSubscriptionsMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(ListSubscriptionsRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("project", String.valueOf(request.getProject())); - return params.build(); - } + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("project", String.valueOf(request.getProject())); + return builder.build(); }) + .setResourceNameExtractor(request -> request.getProject()) .build(); GrpcCallSettings deleteSubscriptionTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(deleteSubscriptionMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(DeleteSubscriptionRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("subscription", String.valueOf(request.getSubscription())); - return params.build(); - } - }) - .build(); - GrpcCallSettings getSnapshotTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(getSnapshotMethodDescriptor) - .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(GetSnapshotRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("snapshot", String.valueOf(request.getSnapshot())); - return params.build(); - } + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("subscription", String.valueOf(request.getSubscription())); + return builder.build(); }) + .setResourceNameExtractor(request -> request.getSubscription()) .build(); GrpcCallSettings modifyAckDeadlineTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(modifyAckDeadlineMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(ModifyAckDeadlineRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("subscription", String.valueOf(request.getSubscription())); - return params.build(); - } + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("subscription", String.valueOf(request.getSubscription())); + return builder.build(); }) + .setResourceNameExtractor(request -> request.getSubscription()) .build(); GrpcCallSettings acknowledgeTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(acknowledgeMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(AcknowledgeRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("subscription", String.valueOf(request.getSubscription())); - return params.build(); - } + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("subscription", String.valueOf(request.getSubscription())); + return builder.build(); }) + .setResourceNameExtractor(request -> request.getSubscription()) .build(); GrpcCallSettings pullTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(pullMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(PullRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("subscription", String.valueOf(request.getSubscription())); - return params.build(); - } + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("subscription", String.valueOf(request.getSubscription())); + return builder.build(); }) + .setResourceNameExtractor(request -> request.getSubscription()) .build(); GrpcCallSettings streamingPullTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(streamingPullMethodDescriptor) + .setResourceNameExtractor(request -> request.getSubscription()) .build(); GrpcCallSettings modifyPushConfigTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(modifyPushConfigMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(ModifyPushConfigRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("subscription", String.valueOf(request.getSubscription())); - return params.build(); - } + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("subscription", String.valueOf(request.getSubscription())); + return builder.build(); }) + .setResourceNameExtractor(request -> request.getSubscription()) + .build(); + GrpcCallSettings getSnapshotTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getSnapshotMethodDescriptor) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("snapshot", String.valueOf(request.getSnapshot())); + return builder.build(); + }) + .setResourceNameExtractor(request -> request.getSnapshot()) .build(); GrpcCallSettings listSnapshotsTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(listSnapshotsMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(ListSnapshotsRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("project", String.valueOf(request.getProject())); - return params.build(); - } + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("project", String.valueOf(request.getProject())); + return builder.build(); }) + .setResourceNameExtractor(request -> request.getProject()) .build(); GrpcCallSettings createSnapshotTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(createSnapshotMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(CreateSnapshotRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("name", String.valueOf(request.getName())); - return params.build(); - } + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("name", String.valueOf(request.getName())); + return builder.build(); }) + .setResourceNameExtractor(request -> request.getName()) .build(); GrpcCallSettings updateSnapshotTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(updateSnapshotMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(UpdateSnapshotRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("snapshot.name", String.valueOf(request.getSnapshot().getName())); - return params.build(); - } + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("snapshot.name", String.valueOf(request.getSnapshot().getName())); + return builder.build(); }) .build(); GrpcCallSettings deleteSnapshotTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(deleteSnapshotMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(DeleteSnapshotRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("snapshot", String.valueOf(request.getSnapshot())); - return params.build(); - } + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("snapshot", String.valueOf(request.getSnapshot())); + return builder.build(); }) + .setResourceNameExtractor(request -> request.getSnapshot()) .build(); GrpcCallSettings seekTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(seekMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(SeekRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("subscription", String.valueOf(request.getSubscription())); - return params.build(); - } + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("subscription", String.valueOf(request.getSubscription())); + return builder.build(); }) + .setResourceNameExtractor(request -> request.getSubscription()) .build(); GrpcCallSettings setIamPolicyTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(setIamPolicyMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(SetIamPolicyRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("resource", String.valueOf(request.getResource())); - return params.build(); - } + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("resource", String.valueOf(request.getResource())); + return builder.build(); }) + .setResourceNameExtractor(request -> request.getResource()) .build(); GrpcCallSettings getIamPolicyTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(getIamPolicyMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(GetIamPolicyRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("resource", String.valueOf(request.getResource())); - return params.build(); - } + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("resource", String.valueOf(request.getResource())); + return builder.build(); }) + .setResourceNameExtractor(request -> request.getResource()) .build(); GrpcCallSettings testIamPermissionsTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(testIamPermissionsMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(TestIamPermissionsRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("resource", String.valueOf(request.getResource())); - return params.build(); - } + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("resource", String.valueOf(request.getResource())); + return builder.build(); }) + .setResourceNameExtractor(request -> request.getResource()) .build(); this.createSubscriptionCallable = @@ -574,9 +572,6 @@ public Map extract(TestIamPermissionsRequest request) { deleteSubscriptionTransportSettings, settings.deleteSubscriptionSettings(), clientContext); - this.getSnapshotCallable = - callableFactory.createUnaryCallable( - getSnapshotTransportSettings, settings.getSnapshotSettings(), clientContext); this.modifyAckDeadlineCallable = callableFactory.createUnaryCallable( modifyAckDeadlineTransportSettings, @@ -594,6 +589,9 @@ public Map extract(TestIamPermissionsRequest request) { this.modifyPushConfigCallable = callableFactory.createUnaryCallable( modifyPushConfigTransportSettings, settings.modifyPushConfigSettings(), clientContext); + this.getSnapshotCallable = + callableFactory.createUnaryCallable( + getSnapshotTransportSettings, settings.getSnapshotSettings(), clientContext); this.listSnapshotsCallable = callableFactory.createUnaryCallable( listSnapshotsTransportSettings, settings.listSnapshotsSettings(), clientContext); @@ -624,93 +622,119 @@ public Map extract(TestIamPermissionsRequest request) { settings.testIamPermissionsSettings(), clientContext); - backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + public GrpcOperationsStub getOperationsStub() { + return operationsStub; } + @Override public UnaryCallable createSubscriptionCallable() { return createSubscriptionCallable; } + @Override public UnaryCallable getSubscriptionCallable() { return getSubscriptionCallable; } + @Override public UnaryCallable updateSubscriptionCallable() { return updateSubscriptionCallable; } - public UnaryCallable - listSubscriptionsPagedCallable() { - return listSubscriptionsPagedCallable; - } - + @Override public UnaryCallable listSubscriptionsCallable() { return listSubscriptionsCallable; } - public UnaryCallable deleteSubscriptionCallable() { - return deleteSubscriptionCallable; + @Override + public UnaryCallable + listSubscriptionsPagedCallable() { + return listSubscriptionsPagedCallable; } - public UnaryCallable getSnapshotCallable() { - return getSnapshotCallable; + @Override + public UnaryCallable deleteSubscriptionCallable() { + return deleteSubscriptionCallable; } + @Override public UnaryCallable modifyAckDeadlineCallable() { return modifyAckDeadlineCallable; } + @Override public UnaryCallable acknowledgeCallable() { return acknowledgeCallable; } + @Override public UnaryCallable pullCallable() { return pullCallable; } + @Override public BidiStreamingCallable streamingPullCallable() { return streamingPullCallable; } + @Override public UnaryCallable modifyPushConfigCallable() { return modifyPushConfigCallable; } - public UnaryCallable - listSnapshotsPagedCallable() { - return listSnapshotsPagedCallable; + @Override + public UnaryCallable getSnapshotCallable() { + return getSnapshotCallable; } + @Override public UnaryCallable listSnapshotsCallable() { return listSnapshotsCallable; } + @Override + public UnaryCallable + listSnapshotsPagedCallable() { + return listSnapshotsPagedCallable; + } + + @Override public UnaryCallable createSnapshotCallable() { return createSnapshotCallable; } + @Override public UnaryCallable updateSnapshotCallable() { return updateSnapshotCallable; } + @Override public UnaryCallable deleteSnapshotCallable() { return deleteSnapshotCallable; } + @Override public UnaryCallable seekCallable() { return seekCallable; } + @Override public UnaryCallable setIamPolicyCallable() { return setIamPolicyCallable; } + @Override public UnaryCallable getIamPolicyCallable() { return getIamPolicyCallable; } + @Override public UnaryCallable testIamPermissionsCallable() { return testIamPermissionsCallable; @@ -718,7 +742,13 @@ public UnaryCallable getIamPolicyCallable() { @Override public final void close() { - shutdown(); + try { + backgroundResources.close(); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new IllegalStateException("Failed to close resource", e); + } } @Override diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/HttpJsonPublisherCallableFactory.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/HttpJsonPublisherCallableFactory.java new file mode 100644 index 000000000..f9da3ee7f --- /dev/null +++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/HttpJsonPublisherCallableFactory.java @@ -0,0 +1,101 @@ +/* + * Copyright 2026 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.stub; + +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.longrunning.stub.OperationsStub; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST callable factory implementation for the Publisher service API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator-java") +public class HttpJsonPublisherCallableFactory + implements HttpJsonStubCallableFactory { + + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + OperationCallable createOperationCallable( + HttpJsonCallSettings httpJsonCallSettings, + OperationCallSettings callSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + UnaryCallable innerCallable = + HttpJsonCallableFactory.createBaseUnaryCallable( + httpJsonCallSettings, callSettings.getInitialCallSettings(), clientContext); + HttpJsonOperationSnapshotCallable initialCallable = + new HttpJsonOperationSnapshotCallable( + innerCallable, + httpJsonCallSettings.getMethodDescriptor().getOperationSnapshotFactory()); + return HttpJsonCallableFactory.createOperationCallable( + callSettings, clientContext, operationsStub.longRunningClient(), initialCallable); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + HttpJsonCallSettings httpJsonCallSettings, + ServerStreamingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createServerStreamingCallable( + httpJsonCallSettings, callSettings, clientContext); + } +} diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/HttpJsonPublisherStub.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/HttpJsonPublisherStub.java new file mode 100644 index 000000000..011a019de --- /dev/null +++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/HttpJsonPublisherStub.java @@ -0,0 +1,920 @@ +/* + * Copyright 2026 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.stub; + +import static com.google.cloud.pubsub.v1.TopicAdminClient.ListTopicSnapshotsPagedResponse; +import static com.google.cloud.pubsub.v1.TopicAdminClient.ListTopicSubscriptionsPagedResponse; +import static com.google.cloud.pubsub.v1.TopicAdminClient.ListTopicsPagedResponse; + +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.ProtoMessageRequestFormatter; +import com.google.api.gax.httpjson.ProtoMessageResponseParser; +import com.google.api.gax.httpjson.ProtoRestSerializer; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.RequestParamsBuilder; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import com.google.protobuf.Empty; +import com.google.protobuf.TypeRegistry; +import com.google.pubsub.v1.DeleteTopicRequest; +import com.google.pubsub.v1.DetachSubscriptionRequest; +import com.google.pubsub.v1.DetachSubscriptionResponse; +import com.google.pubsub.v1.GetTopicRequest; +import com.google.pubsub.v1.ListTopicSnapshotsRequest; +import com.google.pubsub.v1.ListTopicSnapshotsResponse; +import com.google.pubsub.v1.ListTopicSubscriptionsRequest; +import com.google.pubsub.v1.ListTopicSubscriptionsResponse; +import com.google.pubsub.v1.ListTopicsRequest; +import com.google.pubsub.v1.ListTopicsResponse; +import com.google.pubsub.v1.PublishRequest; +import com.google.pubsub.v1.PublishResponse; +import com.google.pubsub.v1.Topic; +import com.google.pubsub.v1.UpdateTopicRequest; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST stub implementation for the Publisher service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +public class HttpJsonPublisherStub extends PublisherStub { + private static final TypeRegistry typeRegistry = TypeRegistry.newBuilder().build(); + + private static final ApiMethodDescriptor createTopicMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.pubsub.v1.Publisher/CreateTopic") + .setHttpMethod("PUT") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/topics/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearName().build(), true)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Topic.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor updateTopicMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.pubsub.v1.Publisher/UpdateTopic") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{topic.name=projects/*/topics/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "topic.name", request.getTopic().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().build(), true)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Topic.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + publishMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.pubsub.v1.Publisher/Publish") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{topic=projects/*/topics/*}:publish", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "topic", request.getTopic()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearTopic().build(), true)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(PublishResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor getTopicMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.pubsub.v1.Publisher/GetTopic") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{topic=projects/*/topics/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "topic", request.getTopic()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Topic.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + listTopicsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.pubsub.v1.Publisher/ListTopics") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{project=projects/*}/topics", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "project", request.getProject()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListTopicsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + ListTopicSubscriptionsRequest, ListTopicSubscriptionsResponse> + listTopicSubscriptionsMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("google.pubsub.v1.Publisher/ListTopicSubscriptions") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{topic=projects/*/topics/*}/subscriptions", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "topic", request.getTopic()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListTopicSubscriptionsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + listTopicSnapshotsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.pubsub.v1.Publisher/ListTopicSnapshots") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{topic=projects/*/topics/*}/snapshots", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "topic", request.getTopic()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListTopicSnapshotsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor deleteTopicMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.pubsub.v1.Publisher/DeleteTopic") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{topic=projects/*/topics/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "topic", request.getTopic()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Empty.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + detachSubscriptionMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.pubsub.v1.Publisher/DetachSubscription") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{subscription=projects/*/subscriptions/*}:detach", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "subscription", request.getSubscription()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(DetachSubscriptionResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + setIamPolicyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.iam.v1.IAMPolicy/SetIamPolicy") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{resource=projects/*/topics/*}:setIamPolicy", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "resource", request.getResource()); + return fields; + }) + .setAdditionalPaths( + "/v1/{resource=projects/*/subscriptions/*}:setIamPolicy", + "/v1/{resource=projects/*/snapshots/*}:setIamPolicy", + "/v1/{resource=projects/*/schemas/*}:setIamPolicy") + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearResource().build(), true)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Policy.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getIamPolicyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.iam.v1.IAMPolicy/GetIamPolicy") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{resource=projects/*/topics/*}:getIamPolicy", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "resource", request.getResource()); + return fields; + }) + .setAdditionalPaths( + "/v1/{resource=projects/*/subscriptions/*}:getIamPolicy", + "/v1/{resource=projects/*/snapshots/*}:getIamPolicy", + "/v1/{resource=projects/*/schemas/*}:getIamPolicy") + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Policy.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + testIamPermissionsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.iam.v1.IAMPolicy/TestIamPermissions") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{resource=projects/*/subscriptions/*}:testIamPermissions", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "resource", request.getResource()); + return fields; + }) + .setAdditionalPaths( + "/v1/{resource=projects/*/topics/*}:testIamPermissions", + "/v1/{resource=projects/*/snapshots/*}:testIamPermissions", + "/v1/{resource=projects/*/schemas/*}:testIamPermissions") + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearResource().build(), true)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(TestIamPermissionsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private final UnaryCallable createTopicCallable; + private final UnaryCallable updateTopicCallable; + private final UnaryCallable publishCallable; + private final UnaryCallable getTopicCallable; + private final UnaryCallable listTopicsCallable; + private final UnaryCallable listTopicsPagedCallable; + private final UnaryCallable + listTopicSubscriptionsCallable; + private final UnaryCallable + listTopicSubscriptionsPagedCallable; + private final UnaryCallable + listTopicSnapshotsCallable; + private final UnaryCallable + listTopicSnapshotsPagedCallable; + private final UnaryCallable deleteTopicCallable; + private final UnaryCallable + detachSubscriptionCallable; + private final UnaryCallable setIamPolicyCallable; + private final UnaryCallable getIamPolicyCallable; + private final UnaryCallable + testIamPermissionsCallable; + + private final BackgroundResource backgroundResources; + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonPublisherStub create(PublisherStubSettings settings) + throws IOException { + return new HttpJsonPublisherStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonPublisherStub create(ClientContext clientContext) throws IOException { + return new HttpJsonPublisherStub( + PublisherStubSettings.newHttpJsonBuilder().build(), clientContext); + } + + public static final HttpJsonPublisherStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonPublisherStub( + PublisherStubSettings.newHttpJsonBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonPublisherStub, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonPublisherStub(PublisherStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new HttpJsonPublisherCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonPublisherStub, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonPublisherStub( + PublisherStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings createTopicTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createTopicMethodDescriptor) + .setTypeRegistry(typeRegistry) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("name", String.valueOf(request.getName())); + return builder.build(); + }) + .setResourceNameExtractor(request -> request.getName()) + .build(); + HttpJsonCallSettings updateTopicTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateTopicMethodDescriptor) + .setTypeRegistry(typeRegistry) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("topic.name", String.valueOf(request.getTopic().getName())); + return builder.build(); + }) + .build(); + HttpJsonCallSettings publishTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(publishMethodDescriptor) + .setTypeRegistry(typeRegistry) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("topic", String.valueOf(request.getTopic())); + return builder.build(); + }) + .setResourceNameExtractor(request -> request.getTopic()) + .build(); + HttpJsonCallSettings getTopicTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getTopicMethodDescriptor) + .setTypeRegistry(typeRegistry) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("topic", String.valueOf(request.getTopic())); + return builder.build(); + }) + .setResourceNameExtractor(request -> request.getTopic()) + .build(); + HttpJsonCallSettings listTopicsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listTopicsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("project", String.valueOf(request.getProject())); + return builder.build(); + }) + .setResourceNameExtractor(request -> request.getProject()) + .build(); + HttpJsonCallSettings + listTopicSubscriptionsTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(listTopicSubscriptionsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("topic", String.valueOf(request.getTopic())); + return builder.build(); + }) + .setResourceNameExtractor(request -> request.getTopic()) + .build(); + HttpJsonCallSettings + listTopicSnapshotsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listTopicSnapshotsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("topic", String.valueOf(request.getTopic())); + return builder.build(); + }) + .setResourceNameExtractor(request -> request.getTopic()) + .build(); + HttpJsonCallSettings deleteTopicTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteTopicMethodDescriptor) + .setTypeRegistry(typeRegistry) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("topic", String.valueOf(request.getTopic())); + return builder.build(); + }) + .setResourceNameExtractor(request -> request.getTopic()) + .build(); + HttpJsonCallSettings + detachSubscriptionTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(detachSubscriptionMethodDescriptor) + .setTypeRegistry(typeRegistry) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("subscription", String.valueOf(request.getSubscription())); + return builder.build(); + }) + .setResourceNameExtractor(request -> request.getSubscription()) + .build(); + HttpJsonCallSettings setIamPolicyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(setIamPolicyMethodDescriptor) + .setTypeRegistry(typeRegistry) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("resource", String.valueOf(request.getResource())); + return builder.build(); + }) + .setResourceNameExtractor(request -> request.getResource()) + .build(); + HttpJsonCallSettings getIamPolicyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getIamPolicyMethodDescriptor) + .setTypeRegistry(typeRegistry) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("resource", String.valueOf(request.getResource())); + return builder.build(); + }) + .setResourceNameExtractor(request -> request.getResource()) + .build(); + HttpJsonCallSettings + testIamPermissionsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(testIamPermissionsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("resource", String.valueOf(request.getResource())); + return builder.build(); + }) + .setResourceNameExtractor(request -> request.getResource()) + .build(); + + this.createTopicCallable = + callableFactory.createUnaryCallable( + createTopicTransportSettings, settings.createTopicSettings(), clientContext); + this.updateTopicCallable = + callableFactory.createUnaryCallable( + updateTopicTransportSettings, settings.updateTopicSettings(), clientContext); + this.publishCallable = + callableFactory.createBatchingCallable( + publishTransportSettings, settings.publishSettings(), clientContext); + this.getTopicCallable = + callableFactory.createUnaryCallable( + getTopicTransportSettings, settings.getTopicSettings(), clientContext); + this.listTopicsCallable = + callableFactory.createUnaryCallable( + listTopicsTransportSettings, settings.listTopicsSettings(), clientContext); + this.listTopicsPagedCallable = + callableFactory.createPagedCallable( + listTopicsTransportSettings, settings.listTopicsSettings(), clientContext); + this.listTopicSubscriptionsCallable = + callableFactory.createUnaryCallable( + listTopicSubscriptionsTransportSettings, + settings.listTopicSubscriptionsSettings(), + clientContext); + this.listTopicSubscriptionsPagedCallable = + callableFactory.createPagedCallable( + listTopicSubscriptionsTransportSettings, + settings.listTopicSubscriptionsSettings(), + clientContext); + this.listTopicSnapshotsCallable = + callableFactory.createUnaryCallable( + listTopicSnapshotsTransportSettings, + settings.listTopicSnapshotsSettings(), + clientContext); + this.listTopicSnapshotsPagedCallable = + callableFactory.createPagedCallable( + listTopicSnapshotsTransportSettings, + settings.listTopicSnapshotsSettings(), + clientContext); + this.deleteTopicCallable = + callableFactory.createUnaryCallable( + deleteTopicTransportSettings, settings.deleteTopicSettings(), clientContext); + this.detachSubscriptionCallable = + callableFactory.createUnaryCallable( + detachSubscriptionTransportSettings, + settings.detachSubscriptionSettings(), + clientContext); + this.setIamPolicyCallable = + callableFactory.createUnaryCallable( + setIamPolicyTransportSettings, settings.setIamPolicySettings(), clientContext); + this.getIamPolicyCallable = + callableFactory.createUnaryCallable( + getIamPolicyTransportSettings, settings.getIamPolicySettings(), clientContext); + this.testIamPermissionsCallable = + callableFactory.createUnaryCallable( + testIamPermissionsTransportSettings, + settings.testIamPermissionsSettings(), + clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @InternalApi + public static List getMethodDescriptors() { + List methodDescriptors = new ArrayList<>(); + methodDescriptors.add(createTopicMethodDescriptor); + methodDescriptors.add(updateTopicMethodDescriptor); + methodDescriptors.add(publishMethodDescriptor); + methodDescriptors.add(getTopicMethodDescriptor); + methodDescriptors.add(listTopicsMethodDescriptor); + methodDescriptors.add(listTopicSubscriptionsMethodDescriptor); + methodDescriptors.add(listTopicSnapshotsMethodDescriptor); + methodDescriptors.add(deleteTopicMethodDescriptor); + methodDescriptors.add(detachSubscriptionMethodDescriptor); + methodDescriptors.add(setIamPolicyMethodDescriptor); + methodDescriptors.add(getIamPolicyMethodDescriptor); + methodDescriptors.add(testIamPermissionsMethodDescriptor); + return methodDescriptors; + } + + @Override + public UnaryCallable createTopicCallable() { + return createTopicCallable; + } + + @Override + public UnaryCallable updateTopicCallable() { + return updateTopicCallable; + } + + @Override + public UnaryCallable publishCallable() { + return publishCallable; + } + + @Override + public UnaryCallable getTopicCallable() { + return getTopicCallable; + } + + @Override + public UnaryCallable listTopicsCallable() { + return listTopicsCallable; + } + + @Override + public UnaryCallable listTopicsPagedCallable() { + return listTopicsPagedCallable; + } + + @Override + public UnaryCallable + listTopicSubscriptionsCallable() { + return listTopicSubscriptionsCallable; + } + + @Override + public UnaryCallable + listTopicSubscriptionsPagedCallable() { + return listTopicSubscriptionsPagedCallable; + } + + @Override + public UnaryCallable + listTopicSnapshotsCallable() { + return listTopicSnapshotsCallable; + } + + @Override + public UnaryCallable + listTopicSnapshotsPagedCallable() { + return listTopicSnapshotsPagedCallable; + } + + @Override + public UnaryCallable deleteTopicCallable() { + return deleteTopicCallable; + } + + @Override + public UnaryCallable + detachSubscriptionCallable() { + return detachSubscriptionCallable; + } + + @Override + public UnaryCallable setIamPolicyCallable() { + return setIamPolicyCallable; + } + + @Override + public UnaryCallable getIamPolicyCallable() { + return getIamPolicyCallable; + } + + @Override + public UnaryCallable + testIamPermissionsCallable() { + return testIamPermissionsCallable; + } + + @Override + public final void close() { + try { + backgroundResources.close(); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new IllegalStateException("Failed to close resource", e); + } + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/HttpJsonSchemaServiceCallableFactory.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/HttpJsonSchemaServiceCallableFactory.java new file mode 100644 index 000000000..b725059aa --- /dev/null +++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/HttpJsonSchemaServiceCallableFactory.java @@ -0,0 +1,101 @@ +/* + * Copyright 2026 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.stub; + +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.longrunning.stub.OperationsStub; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST callable factory implementation for the SchemaService service API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator-java") +public class HttpJsonSchemaServiceCallableFactory + implements HttpJsonStubCallableFactory { + + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + OperationCallable createOperationCallable( + HttpJsonCallSettings httpJsonCallSettings, + OperationCallSettings callSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + UnaryCallable innerCallable = + HttpJsonCallableFactory.createBaseUnaryCallable( + httpJsonCallSettings, callSettings.getInitialCallSettings(), clientContext); + HttpJsonOperationSnapshotCallable initialCallable = + new HttpJsonOperationSnapshotCallable( + innerCallable, + httpJsonCallSettings.getMethodDescriptor().getOperationSnapshotFactory()); + return HttpJsonCallableFactory.createOperationCallable( + callSettings, clientContext, operationsStub.longRunningClient(), initialCallable); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + HttpJsonCallSettings httpJsonCallSettings, + ServerStreamingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createServerStreamingCallable( + httpJsonCallSettings, callSettings, clientContext); + } +} diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/HttpJsonSchemaServiceStub.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/HttpJsonSchemaServiceStub.java new file mode 100644 index 000000000..d8f726b6f --- /dev/null +++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/HttpJsonSchemaServiceStub.java @@ -0,0 +1,973 @@ +/* + * Copyright 2026 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.stub; + +import static com.google.cloud.pubsub.v1.SchemaServiceClient.ListSchemaRevisionsPagedResponse; +import static com.google.cloud.pubsub.v1.SchemaServiceClient.ListSchemasPagedResponse; + +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.ProtoMessageRequestFormatter; +import com.google.api.gax.httpjson.ProtoMessageResponseParser; +import com.google.api.gax.httpjson.ProtoRestSerializer; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.RequestParamsBuilder; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import com.google.protobuf.Empty; +import com.google.protobuf.TypeRegistry; +import com.google.pubsub.v1.CommitSchemaRequest; +import com.google.pubsub.v1.CreateSchemaRequest; +import com.google.pubsub.v1.DeleteSchemaRequest; +import com.google.pubsub.v1.DeleteSchemaRevisionRequest; +import com.google.pubsub.v1.GetSchemaRequest; +import com.google.pubsub.v1.ListSchemaRevisionsRequest; +import com.google.pubsub.v1.ListSchemaRevisionsResponse; +import com.google.pubsub.v1.ListSchemasRequest; +import com.google.pubsub.v1.ListSchemasResponse; +import com.google.pubsub.v1.RollbackSchemaRequest; +import com.google.pubsub.v1.Schema; +import com.google.pubsub.v1.ValidateMessageRequest; +import com.google.pubsub.v1.ValidateMessageResponse; +import com.google.pubsub.v1.ValidateSchemaRequest; +import com.google.pubsub.v1.ValidateSchemaResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST stub implementation for the SchemaService service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +public class HttpJsonSchemaServiceStub extends SchemaServiceStub { + private static final TypeRegistry typeRegistry = TypeRegistry.newBuilder().build(); + + private static final ApiMethodDescriptor + createSchemaMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.pubsub.v1.SchemaService/CreateSchema") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*}/schemas", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "schemaId", request.getSchemaId()); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("schema", request.getSchema(), true)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Schema.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor getSchemaMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.pubsub.v1.SchemaService/GetSchema") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/schemas/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "view", request.getViewValue()); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Schema.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + listSchemasMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.pubsub.v1.SchemaService/ListSchemas") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*}/schemas", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + serializer.putQueryParam(fields, "view", request.getViewValue()); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListSchemasResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + listSchemaRevisionsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.pubsub.v1.SchemaService/ListSchemaRevisions") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/schemas/*}:listRevisions", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + serializer.putQueryParam(fields, "view", request.getViewValue()); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListSchemaRevisionsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + commitSchemaMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.pubsub.v1.SchemaService/CommitSchema") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/schemas/*}:commit", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearName().build(), true)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Schema.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + rollbackSchemaMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.pubsub.v1.SchemaService/RollbackSchema") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/schemas/*}:rollback", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearName().build(), true)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Schema.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + deleteSchemaRevisionMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.pubsub.v1.SchemaService/DeleteSchemaRevision") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/schemas/*}:deleteRevision", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "revisionId", request.getRevisionId()); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Schema.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + deleteSchemaMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.pubsub.v1.SchemaService/DeleteSchema") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/schemas/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Empty.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + validateSchemaMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.pubsub.v1.SchemaService/ValidateSchema") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*}/schemas:validate", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearParent().build(), true)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ValidateSchemaResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + validateMessageMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.pubsub.v1.SchemaService/ValidateMessage") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*}/schemas:validateMessage", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearParent().build(), true)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ValidateMessageResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + setIamPolicyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.iam.v1.IAMPolicy/SetIamPolicy") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{resource=projects/*/topics/*}:setIamPolicy", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "resource", request.getResource()); + return fields; + }) + .setAdditionalPaths( + "/v1/{resource=projects/*/subscriptions/*}:setIamPolicy", + "/v1/{resource=projects/*/snapshots/*}:setIamPolicy", + "/v1/{resource=projects/*/schemas/*}:setIamPolicy") + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearResource().build(), true)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Policy.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getIamPolicyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.iam.v1.IAMPolicy/GetIamPolicy") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{resource=projects/*/topics/*}:getIamPolicy", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "resource", request.getResource()); + return fields; + }) + .setAdditionalPaths( + "/v1/{resource=projects/*/subscriptions/*}:getIamPolicy", + "/v1/{resource=projects/*/snapshots/*}:getIamPolicy", + "/v1/{resource=projects/*/schemas/*}:getIamPolicy") + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Policy.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + testIamPermissionsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.iam.v1.IAMPolicy/TestIamPermissions") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{resource=projects/*/subscriptions/*}:testIamPermissions", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "resource", request.getResource()); + return fields; + }) + .setAdditionalPaths( + "/v1/{resource=projects/*/topics/*}:testIamPermissions", + "/v1/{resource=projects/*/snapshots/*}:testIamPermissions", + "/v1/{resource=projects/*/schemas/*}:testIamPermissions") + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearResource().build(), true)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(TestIamPermissionsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private final UnaryCallable createSchemaCallable; + private final UnaryCallable getSchemaCallable; + private final UnaryCallable listSchemasCallable; + private final UnaryCallable + listSchemasPagedCallable; + private final UnaryCallable + listSchemaRevisionsCallable; + private final UnaryCallable + listSchemaRevisionsPagedCallable; + private final UnaryCallable commitSchemaCallable; + private final UnaryCallable rollbackSchemaCallable; + private final UnaryCallable deleteSchemaRevisionCallable; + private final UnaryCallable deleteSchemaCallable; + private final UnaryCallable validateSchemaCallable; + private final UnaryCallable + validateMessageCallable; + private final UnaryCallable setIamPolicyCallable; + private final UnaryCallable getIamPolicyCallable; + private final UnaryCallable + testIamPermissionsCallable; + + private final BackgroundResource backgroundResources; + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonSchemaServiceStub create(SchemaServiceStubSettings settings) + throws IOException { + return new HttpJsonSchemaServiceStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonSchemaServiceStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonSchemaServiceStub( + SchemaServiceStubSettings.newHttpJsonBuilder().build(), clientContext); + } + + public static final HttpJsonSchemaServiceStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonSchemaServiceStub( + SchemaServiceStubSettings.newHttpJsonBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonSchemaServiceStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonSchemaServiceStub( + SchemaServiceStubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new HttpJsonSchemaServiceCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonSchemaServiceStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonSchemaServiceStub( + SchemaServiceStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings createSchemaTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createSchemaMethodDescriptor) + .setTypeRegistry(typeRegistry) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("parent", String.valueOf(request.getParent())); + return builder.build(); + }) + .setResourceNameExtractor(request -> request.getParent()) + .build(); + HttpJsonCallSettings getSchemaTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getSchemaMethodDescriptor) + .setTypeRegistry(typeRegistry) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("name", String.valueOf(request.getName())); + return builder.build(); + }) + .setResourceNameExtractor(request -> request.getName()) + .build(); + HttpJsonCallSettings listSchemasTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listSchemasMethodDescriptor) + .setTypeRegistry(typeRegistry) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("parent", String.valueOf(request.getParent())); + return builder.build(); + }) + .setResourceNameExtractor(request -> request.getParent()) + .build(); + HttpJsonCallSettings + listSchemaRevisionsTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(listSchemaRevisionsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("name", String.valueOf(request.getName())); + return builder.build(); + }) + .setResourceNameExtractor(request -> request.getName()) + .build(); + HttpJsonCallSettings commitSchemaTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(commitSchemaMethodDescriptor) + .setTypeRegistry(typeRegistry) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("name", String.valueOf(request.getName())); + return builder.build(); + }) + .setResourceNameExtractor(request -> request.getName()) + .build(); + HttpJsonCallSettings rollbackSchemaTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(rollbackSchemaMethodDescriptor) + .setTypeRegistry(typeRegistry) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("name", String.valueOf(request.getName())); + return builder.build(); + }) + .setResourceNameExtractor(request -> request.getName()) + .build(); + HttpJsonCallSettings + deleteSchemaRevisionTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteSchemaRevisionMethodDescriptor) + .setTypeRegistry(typeRegistry) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("name", String.valueOf(request.getName())); + return builder.build(); + }) + .setResourceNameExtractor(request -> request.getName()) + .build(); + HttpJsonCallSettings deleteSchemaTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteSchemaMethodDescriptor) + .setTypeRegistry(typeRegistry) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("name", String.valueOf(request.getName())); + return builder.build(); + }) + .setResourceNameExtractor(request -> request.getName()) + .build(); + HttpJsonCallSettings + validateSchemaTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(validateSchemaMethodDescriptor) + .setTypeRegistry(typeRegistry) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("parent", String.valueOf(request.getParent())); + return builder.build(); + }) + .setResourceNameExtractor(request -> request.getParent()) + .build(); + HttpJsonCallSettings + validateMessageTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(validateMessageMethodDescriptor) + .setTypeRegistry(typeRegistry) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("parent", String.valueOf(request.getParent())); + return builder.build(); + }) + .setResourceNameExtractor(request -> request.getParent()) + .build(); + HttpJsonCallSettings setIamPolicyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(setIamPolicyMethodDescriptor) + .setTypeRegistry(typeRegistry) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("resource", String.valueOf(request.getResource())); + return builder.build(); + }) + .setResourceNameExtractor(request -> request.getResource()) + .build(); + HttpJsonCallSettings getIamPolicyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getIamPolicyMethodDescriptor) + .setTypeRegistry(typeRegistry) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("resource", String.valueOf(request.getResource())); + return builder.build(); + }) + .setResourceNameExtractor(request -> request.getResource()) + .build(); + HttpJsonCallSettings + testIamPermissionsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(testIamPermissionsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("resource", String.valueOf(request.getResource())); + return builder.build(); + }) + .setResourceNameExtractor(request -> request.getResource()) + .build(); + + this.createSchemaCallable = + callableFactory.createUnaryCallable( + createSchemaTransportSettings, settings.createSchemaSettings(), clientContext); + this.getSchemaCallable = + callableFactory.createUnaryCallable( + getSchemaTransportSettings, settings.getSchemaSettings(), clientContext); + this.listSchemasCallable = + callableFactory.createUnaryCallable( + listSchemasTransportSettings, settings.listSchemasSettings(), clientContext); + this.listSchemasPagedCallable = + callableFactory.createPagedCallable( + listSchemasTransportSettings, settings.listSchemasSettings(), clientContext); + this.listSchemaRevisionsCallable = + callableFactory.createUnaryCallable( + listSchemaRevisionsTransportSettings, + settings.listSchemaRevisionsSettings(), + clientContext); + this.listSchemaRevisionsPagedCallable = + callableFactory.createPagedCallable( + listSchemaRevisionsTransportSettings, + settings.listSchemaRevisionsSettings(), + clientContext); + this.commitSchemaCallable = + callableFactory.createUnaryCallable( + commitSchemaTransportSettings, settings.commitSchemaSettings(), clientContext); + this.rollbackSchemaCallable = + callableFactory.createUnaryCallable( + rollbackSchemaTransportSettings, settings.rollbackSchemaSettings(), clientContext); + this.deleteSchemaRevisionCallable = + callableFactory.createUnaryCallable( + deleteSchemaRevisionTransportSettings, + settings.deleteSchemaRevisionSettings(), + clientContext); + this.deleteSchemaCallable = + callableFactory.createUnaryCallable( + deleteSchemaTransportSettings, settings.deleteSchemaSettings(), clientContext); + this.validateSchemaCallable = + callableFactory.createUnaryCallable( + validateSchemaTransportSettings, settings.validateSchemaSettings(), clientContext); + this.validateMessageCallable = + callableFactory.createUnaryCallable( + validateMessageTransportSettings, settings.validateMessageSettings(), clientContext); + this.setIamPolicyCallable = + callableFactory.createUnaryCallable( + setIamPolicyTransportSettings, settings.setIamPolicySettings(), clientContext); + this.getIamPolicyCallable = + callableFactory.createUnaryCallable( + getIamPolicyTransportSettings, settings.getIamPolicySettings(), clientContext); + this.testIamPermissionsCallable = + callableFactory.createUnaryCallable( + testIamPermissionsTransportSettings, + settings.testIamPermissionsSettings(), + clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @InternalApi + public static List getMethodDescriptors() { + List methodDescriptors = new ArrayList<>(); + methodDescriptors.add(createSchemaMethodDescriptor); + methodDescriptors.add(getSchemaMethodDescriptor); + methodDescriptors.add(listSchemasMethodDescriptor); + methodDescriptors.add(listSchemaRevisionsMethodDescriptor); + methodDescriptors.add(commitSchemaMethodDescriptor); + methodDescriptors.add(rollbackSchemaMethodDescriptor); + methodDescriptors.add(deleteSchemaRevisionMethodDescriptor); + methodDescriptors.add(deleteSchemaMethodDescriptor); + methodDescriptors.add(validateSchemaMethodDescriptor); + methodDescriptors.add(validateMessageMethodDescriptor); + methodDescriptors.add(setIamPolicyMethodDescriptor); + methodDescriptors.add(getIamPolicyMethodDescriptor); + methodDescriptors.add(testIamPermissionsMethodDescriptor); + return methodDescriptors; + } + + @Override + public UnaryCallable createSchemaCallable() { + return createSchemaCallable; + } + + @Override + public UnaryCallable getSchemaCallable() { + return getSchemaCallable; + } + + @Override + public UnaryCallable listSchemasCallable() { + return listSchemasCallable; + } + + @Override + public UnaryCallable listSchemasPagedCallable() { + return listSchemasPagedCallable; + } + + @Override + public UnaryCallable + listSchemaRevisionsCallable() { + return listSchemaRevisionsCallable; + } + + @Override + public UnaryCallable + listSchemaRevisionsPagedCallable() { + return listSchemaRevisionsPagedCallable; + } + + @Override + public UnaryCallable commitSchemaCallable() { + return commitSchemaCallable; + } + + @Override + public UnaryCallable rollbackSchemaCallable() { + return rollbackSchemaCallable; + } + + @Override + public UnaryCallable deleteSchemaRevisionCallable() { + return deleteSchemaRevisionCallable; + } + + @Override + public UnaryCallable deleteSchemaCallable() { + return deleteSchemaCallable; + } + + @Override + public UnaryCallable validateSchemaCallable() { + return validateSchemaCallable; + } + + @Override + public UnaryCallable validateMessageCallable() { + return validateMessageCallable; + } + + @Override + public UnaryCallable setIamPolicyCallable() { + return setIamPolicyCallable; + } + + @Override + public UnaryCallable getIamPolicyCallable() { + return getIamPolicyCallable; + } + + @Override + public UnaryCallable + testIamPermissionsCallable() { + return testIamPermissionsCallable; + } + + @Override + public final void close() { + try { + backgroundResources.close(); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new IllegalStateException("Failed to close resource", e); + } + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/HttpJsonSubscriberCallableFactory.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/HttpJsonSubscriberCallableFactory.java new file mode 100644 index 000000000..a719f85ef --- /dev/null +++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/HttpJsonSubscriberCallableFactory.java @@ -0,0 +1,101 @@ +/* + * Copyright 2026 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.stub; + +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.longrunning.stub.OperationsStub; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST callable factory implementation for the Subscriber service API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator-java") +public class HttpJsonSubscriberCallableFactory + implements HttpJsonStubCallableFactory { + + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + OperationCallable createOperationCallable( + HttpJsonCallSettings httpJsonCallSettings, + OperationCallSettings callSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + UnaryCallable innerCallable = + HttpJsonCallableFactory.createBaseUnaryCallable( + httpJsonCallSettings, callSettings.getInitialCallSettings(), clientContext); + HttpJsonOperationSnapshotCallable initialCallable = + new HttpJsonOperationSnapshotCallable( + innerCallable, + httpJsonCallSettings.getMethodDescriptor().getOperationSnapshotFactory()); + return HttpJsonCallableFactory.createOperationCallable( + callSettings, clientContext, operationsStub.longRunningClient(), initialCallable); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + HttpJsonCallSettings httpJsonCallSettings, + ServerStreamingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createServerStreamingCallable( + httpJsonCallSettings, callSettings, clientContext); + } +} diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/HttpJsonSubscriberStub.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/HttpJsonSubscriberStub.java new file mode 100644 index 000000000..ce9647bd2 --- /dev/null +++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/HttpJsonSubscriberStub.java @@ -0,0 +1,1281 @@ +/* + * Copyright 2026 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.stub; + +import static com.google.cloud.pubsub.v1.SubscriptionAdminClient.ListSnapshotsPagedResponse; +import static com.google.cloud.pubsub.v1.SubscriptionAdminClient.ListSubscriptionsPagedResponse; + +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.ProtoMessageRequestFormatter; +import com.google.api.gax.httpjson.ProtoMessageResponseParser; +import com.google.api.gax.httpjson.ProtoRestSerializer; +import com.google.api.gax.rpc.BidiStreamingCallable; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.RequestParamsBuilder; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import com.google.protobuf.Empty; +import com.google.protobuf.TypeRegistry; +import com.google.pubsub.v1.AcknowledgeRequest; +import com.google.pubsub.v1.CreateSnapshotRequest; +import com.google.pubsub.v1.DeleteSnapshotRequest; +import com.google.pubsub.v1.DeleteSubscriptionRequest; +import com.google.pubsub.v1.GetSnapshotRequest; +import com.google.pubsub.v1.GetSubscriptionRequest; +import com.google.pubsub.v1.ListSnapshotsRequest; +import com.google.pubsub.v1.ListSnapshotsResponse; +import com.google.pubsub.v1.ListSubscriptionsRequest; +import com.google.pubsub.v1.ListSubscriptionsResponse; +import com.google.pubsub.v1.ModifyAckDeadlineRequest; +import com.google.pubsub.v1.ModifyPushConfigRequest; +import com.google.pubsub.v1.PullRequest; +import com.google.pubsub.v1.PullResponse; +import com.google.pubsub.v1.SeekRequest; +import com.google.pubsub.v1.SeekResponse; +import com.google.pubsub.v1.Snapshot; +import com.google.pubsub.v1.StreamingPullRequest; +import com.google.pubsub.v1.StreamingPullResponse; +import com.google.pubsub.v1.Subscription; +import com.google.pubsub.v1.UpdateSnapshotRequest; +import com.google.pubsub.v1.UpdateSubscriptionRequest; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST stub implementation for the Subscriber service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +public class HttpJsonSubscriberStub extends SubscriberStub { + private static final TypeRegistry typeRegistry = TypeRegistry.newBuilder().build(); + + private static final ApiMethodDescriptor + createSubscriptionMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.pubsub.v1.Subscriber/CreateSubscription") + .setHttpMethod("PUT") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/subscriptions/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearName().build(), true)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Subscription.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getSubscriptionMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.pubsub.v1.Subscriber/GetSubscription") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{subscription=projects/*/subscriptions/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "subscription", request.getSubscription()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Subscription.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + updateSubscriptionMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.pubsub.v1.Subscriber/UpdateSubscription") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{subscription.name=projects/*/subscriptions/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "subscription.name", request.getSubscription().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().build(), true)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Subscription.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + listSubscriptionsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.pubsub.v1.Subscriber/ListSubscriptions") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{project=projects/*}/subscriptions", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "project", request.getProject()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListSubscriptionsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + deleteSubscriptionMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.pubsub.v1.Subscriber/DeleteSubscription") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{subscription=projects/*/subscriptions/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "subscription", request.getSubscription()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Empty.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + modifyAckDeadlineMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.pubsub.v1.Subscriber/ModifyAckDeadline") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{subscription=projects/*/subscriptions/*}:modifyAckDeadline", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "subscription", request.getSubscription()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody( + "*", request.toBuilder().clearSubscription().build(), true)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Empty.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor acknowledgeMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.pubsub.v1.Subscriber/Acknowledge") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{subscription=projects/*/subscriptions/*}:acknowledge", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "subscription", request.getSubscription()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearSubscription().build(), true)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Empty.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor pullMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.pubsub.v1.Subscriber/Pull") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{subscription=projects/*/subscriptions/*}:pull", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = ProtoRestSerializer.create(); + serializer.putPathParam(fields, "subscription", request.getSubscription()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearSubscription().build(), true)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(PullResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + modifyPushConfigMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.pubsub.v1.Subscriber/ModifyPushConfig") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{subscription=projects/*/subscriptions/*}:modifyPushConfig", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "subscription", request.getSubscription()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody( + "*", request.toBuilder().clearSubscription().build(), true)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Empty.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getSnapshotMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.pubsub.v1.Subscriber/GetSnapshot") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{snapshot=projects/*/snapshots/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "snapshot", request.getSnapshot()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Snapshot.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + listSnapshotsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.pubsub.v1.Subscriber/ListSnapshots") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{project=projects/*}/snapshots", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "project", request.getProject()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListSnapshotsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + createSnapshotMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.pubsub.v1.Subscriber/CreateSnapshot") + .setHttpMethod("PUT") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/snapshots/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearName().build(), true)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Snapshot.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + updateSnapshotMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.pubsub.v1.Subscriber/UpdateSnapshot") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{snapshot.name=projects/*/snapshots/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "snapshot.name", request.getSnapshot().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().build(), true)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Snapshot.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + deleteSnapshotMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.pubsub.v1.Subscriber/DeleteSnapshot") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{snapshot=projects/*/snapshots/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "snapshot", request.getSnapshot()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Empty.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor seekMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.pubsub.v1.Subscriber/Seek") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{subscription=projects/*/subscriptions/*}:seek", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = ProtoRestSerializer.create(); + serializer.putPathParam(fields, "subscription", request.getSubscription()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearSubscription().build(), true)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(SeekResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + setIamPolicyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.iam.v1.IAMPolicy/SetIamPolicy") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{resource=projects/*/topics/*}:setIamPolicy", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "resource", request.getResource()); + return fields; + }) + .setAdditionalPaths( + "/v1/{resource=projects/*/subscriptions/*}:setIamPolicy", + "/v1/{resource=projects/*/snapshots/*}:setIamPolicy", + "/v1/{resource=projects/*/schemas/*}:setIamPolicy") + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearResource().build(), true)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Policy.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getIamPolicyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.iam.v1.IAMPolicy/GetIamPolicy") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{resource=projects/*/topics/*}:getIamPolicy", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "resource", request.getResource()); + return fields; + }) + .setAdditionalPaths( + "/v1/{resource=projects/*/subscriptions/*}:getIamPolicy", + "/v1/{resource=projects/*/snapshots/*}:getIamPolicy", + "/v1/{resource=projects/*/schemas/*}:getIamPolicy") + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Policy.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + testIamPermissionsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.iam.v1.IAMPolicy/TestIamPermissions") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{resource=projects/*/subscriptions/*}:testIamPermissions", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "resource", request.getResource()); + return fields; + }) + .setAdditionalPaths( + "/v1/{resource=projects/*/topics/*}:testIamPermissions", + "/v1/{resource=projects/*/snapshots/*}:testIamPermissions", + "/v1/{resource=projects/*/schemas/*}:testIamPermissions") + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearResource().build(), true)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(TestIamPermissionsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private final UnaryCallable createSubscriptionCallable; + private final UnaryCallable getSubscriptionCallable; + private final UnaryCallable updateSubscriptionCallable; + private final UnaryCallable + listSubscriptionsCallable; + private final UnaryCallable + listSubscriptionsPagedCallable; + private final UnaryCallable deleteSubscriptionCallable; + private final UnaryCallable modifyAckDeadlineCallable; + private final UnaryCallable acknowledgeCallable; + private final UnaryCallable pullCallable; + private final UnaryCallable modifyPushConfigCallable; + private final UnaryCallable getSnapshotCallable; + private final UnaryCallable listSnapshotsCallable; + private final UnaryCallable + listSnapshotsPagedCallable; + private final UnaryCallable createSnapshotCallable; + private final UnaryCallable updateSnapshotCallable; + private final UnaryCallable deleteSnapshotCallable; + private final UnaryCallable seekCallable; + private final UnaryCallable setIamPolicyCallable; + private final UnaryCallable getIamPolicyCallable; + private final UnaryCallable + testIamPermissionsCallable; + + private final BackgroundResource backgroundResources; + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonSubscriberStub create(SubscriberStubSettings settings) + throws IOException { + return new HttpJsonSubscriberStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonSubscriberStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonSubscriberStub( + SubscriberStubSettings.newHttpJsonBuilder().build(), clientContext); + } + + public static final HttpJsonSubscriberStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonSubscriberStub( + SubscriberStubSettings.newHttpJsonBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonSubscriberStub, using the given settings. This is protected + * so that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonSubscriberStub(SubscriberStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new HttpJsonSubscriberCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonSubscriberStub, using the given settings. This is protected + * so that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonSubscriberStub( + SubscriberStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings createSubscriptionTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createSubscriptionMethodDescriptor) + .setTypeRegistry(typeRegistry) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("name", String.valueOf(request.getName())); + return builder.build(); + }) + .setResourceNameExtractor(request -> request.getName()) + .build(); + HttpJsonCallSettings getSubscriptionTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getSubscriptionMethodDescriptor) + .setTypeRegistry(typeRegistry) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("subscription", String.valueOf(request.getSubscription())); + return builder.build(); + }) + .setResourceNameExtractor(request -> request.getSubscription()) + .build(); + HttpJsonCallSettings + updateSubscriptionTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateSubscriptionMethodDescriptor) + .setTypeRegistry(typeRegistry) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add( + "subscription.name", String.valueOf(request.getSubscription().getName())); + return builder.build(); + }) + .build(); + HttpJsonCallSettings + listSubscriptionsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listSubscriptionsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("project", String.valueOf(request.getProject())); + return builder.build(); + }) + .setResourceNameExtractor(request -> request.getProject()) + .build(); + HttpJsonCallSettings deleteSubscriptionTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteSubscriptionMethodDescriptor) + .setTypeRegistry(typeRegistry) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("subscription", String.valueOf(request.getSubscription())); + return builder.build(); + }) + .setResourceNameExtractor(request -> request.getSubscription()) + .build(); + HttpJsonCallSettings modifyAckDeadlineTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(modifyAckDeadlineMethodDescriptor) + .setTypeRegistry(typeRegistry) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("subscription", String.valueOf(request.getSubscription())); + return builder.build(); + }) + .setResourceNameExtractor(request -> request.getSubscription()) + .build(); + HttpJsonCallSettings acknowledgeTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(acknowledgeMethodDescriptor) + .setTypeRegistry(typeRegistry) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("subscription", String.valueOf(request.getSubscription())); + return builder.build(); + }) + .setResourceNameExtractor(request -> request.getSubscription()) + .build(); + HttpJsonCallSettings pullTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(pullMethodDescriptor) + .setTypeRegistry(typeRegistry) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("subscription", String.valueOf(request.getSubscription())); + return builder.build(); + }) + .setResourceNameExtractor(request -> request.getSubscription()) + .build(); + HttpJsonCallSettings modifyPushConfigTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(modifyPushConfigMethodDescriptor) + .setTypeRegistry(typeRegistry) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("subscription", String.valueOf(request.getSubscription())); + return builder.build(); + }) + .setResourceNameExtractor(request -> request.getSubscription()) + .build(); + HttpJsonCallSettings getSnapshotTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getSnapshotMethodDescriptor) + .setTypeRegistry(typeRegistry) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("snapshot", String.valueOf(request.getSnapshot())); + return builder.build(); + }) + .setResourceNameExtractor(request -> request.getSnapshot()) + .build(); + HttpJsonCallSettings + listSnapshotsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listSnapshotsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("project", String.valueOf(request.getProject())); + return builder.build(); + }) + .setResourceNameExtractor(request -> request.getProject()) + .build(); + HttpJsonCallSettings createSnapshotTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createSnapshotMethodDescriptor) + .setTypeRegistry(typeRegistry) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("name", String.valueOf(request.getName())); + return builder.build(); + }) + .setResourceNameExtractor(request -> request.getName()) + .build(); + HttpJsonCallSettings updateSnapshotTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateSnapshotMethodDescriptor) + .setTypeRegistry(typeRegistry) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("snapshot.name", String.valueOf(request.getSnapshot().getName())); + return builder.build(); + }) + .build(); + HttpJsonCallSettings deleteSnapshotTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteSnapshotMethodDescriptor) + .setTypeRegistry(typeRegistry) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("snapshot", String.valueOf(request.getSnapshot())); + return builder.build(); + }) + .setResourceNameExtractor(request -> request.getSnapshot()) + .build(); + HttpJsonCallSettings seekTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(seekMethodDescriptor) + .setTypeRegistry(typeRegistry) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("subscription", String.valueOf(request.getSubscription())); + return builder.build(); + }) + .setResourceNameExtractor(request -> request.getSubscription()) + .build(); + HttpJsonCallSettings setIamPolicyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(setIamPolicyMethodDescriptor) + .setTypeRegistry(typeRegistry) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("resource", String.valueOf(request.getResource())); + return builder.build(); + }) + .setResourceNameExtractor(request -> request.getResource()) + .build(); + HttpJsonCallSettings getIamPolicyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getIamPolicyMethodDescriptor) + .setTypeRegistry(typeRegistry) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("resource", String.valueOf(request.getResource())); + return builder.build(); + }) + .setResourceNameExtractor(request -> request.getResource()) + .build(); + HttpJsonCallSettings + testIamPermissionsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(testIamPermissionsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("resource", String.valueOf(request.getResource())); + return builder.build(); + }) + .setResourceNameExtractor(request -> request.getResource()) + .build(); + + this.createSubscriptionCallable = + callableFactory.createUnaryCallable( + createSubscriptionTransportSettings, + settings.createSubscriptionSettings(), + clientContext); + this.getSubscriptionCallable = + callableFactory.createUnaryCallable( + getSubscriptionTransportSettings, settings.getSubscriptionSettings(), clientContext); + this.updateSubscriptionCallable = + callableFactory.createUnaryCallable( + updateSubscriptionTransportSettings, + settings.updateSubscriptionSettings(), + clientContext); + this.listSubscriptionsCallable = + callableFactory.createUnaryCallable( + listSubscriptionsTransportSettings, + settings.listSubscriptionsSettings(), + clientContext); + this.listSubscriptionsPagedCallable = + callableFactory.createPagedCallable( + listSubscriptionsTransportSettings, + settings.listSubscriptionsSettings(), + clientContext); + this.deleteSubscriptionCallable = + callableFactory.createUnaryCallable( + deleteSubscriptionTransportSettings, + settings.deleteSubscriptionSettings(), + clientContext); + this.modifyAckDeadlineCallable = + callableFactory.createUnaryCallable( + modifyAckDeadlineTransportSettings, + settings.modifyAckDeadlineSettings(), + clientContext); + this.acknowledgeCallable = + callableFactory.createUnaryCallable( + acknowledgeTransportSettings, settings.acknowledgeSettings(), clientContext); + this.pullCallable = + callableFactory.createUnaryCallable( + pullTransportSettings, settings.pullSettings(), clientContext); + this.modifyPushConfigCallable = + callableFactory.createUnaryCallable( + modifyPushConfigTransportSettings, settings.modifyPushConfigSettings(), clientContext); + this.getSnapshotCallable = + callableFactory.createUnaryCallable( + getSnapshotTransportSettings, settings.getSnapshotSettings(), clientContext); + this.listSnapshotsCallable = + callableFactory.createUnaryCallable( + listSnapshotsTransportSettings, settings.listSnapshotsSettings(), clientContext); + this.listSnapshotsPagedCallable = + callableFactory.createPagedCallable( + listSnapshotsTransportSettings, settings.listSnapshotsSettings(), clientContext); + this.createSnapshotCallable = + callableFactory.createUnaryCallable( + createSnapshotTransportSettings, settings.createSnapshotSettings(), clientContext); + this.updateSnapshotCallable = + callableFactory.createUnaryCallable( + updateSnapshotTransportSettings, settings.updateSnapshotSettings(), clientContext); + this.deleteSnapshotCallable = + callableFactory.createUnaryCallable( + deleteSnapshotTransportSettings, settings.deleteSnapshotSettings(), clientContext); + this.seekCallable = + callableFactory.createUnaryCallable( + seekTransportSettings, settings.seekSettings(), clientContext); + this.setIamPolicyCallable = + callableFactory.createUnaryCallable( + setIamPolicyTransportSettings, settings.setIamPolicySettings(), clientContext); + this.getIamPolicyCallable = + callableFactory.createUnaryCallable( + getIamPolicyTransportSettings, settings.getIamPolicySettings(), clientContext); + this.testIamPermissionsCallable = + callableFactory.createUnaryCallable( + testIamPermissionsTransportSettings, + settings.testIamPermissionsSettings(), + clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @InternalApi + public static List getMethodDescriptors() { + List methodDescriptors = new ArrayList<>(); + methodDescriptors.add(createSubscriptionMethodDescriptor); + methodDescriptors.add(getSubscriptionMethodDescriptor); + methodDescriptors.add(updateSubscriptionMethodDescriptor); + methodDescriptors.add(listSubscriptionsMethodDescriptor); + methodDescriptors.add(deleteSubscriptionMethodDescriptor); + methodDescriptors.add(modifyAckDeadlineMethodDescriptor); + methodDescriptors.add(acknowledgeMethodDescriptor); + methodDescriptors.add(pullMethodDescriptor); + methodDescriptors.add(modifyPushConfigMethodDescriptor); + methodDescriptors.add(getSnapshotMethodDescriptor); + methodDescriptors.add(listSnapshotsMethodDescriptor); + methodDescriptors.add(createSnapshotMethodDescriptor); + methodDescriptors.add(updateSnapshotMethodDescriptor); + methodDescriptors.add(deleteSnapshotMethodDescriptor); + methodDescriptors.add(seekMethodDescriptor); + methodDescriptors.add(setIamPolicyMethodDescriptor); + methodDescriptors.add(getIamPolicyMethodDescriptor); + methodDescriptors.add(testIamPermissionsMethodDescriptor); + return methodDescriptors; + } + + @Override + public UnaryCallable createSubscriptionCallable() { + return createSubscriptionCallable; + } + + @Override + public UnaryCallable getSubscriptionCallable() { + return getSubscriptionCallable; + } + + @Override + public UnaryCallable updateSubscriptionCallable() { + return updateSubscriptionCallable; + } + + @Override + public UnaryCallable + listSubscriptionsCallable() { + return listSubscriptionsCallable; + } + + @Override + public UnaryCallable + listSubscriptionsPagedCallable() { + return listSubscriptionsPagedCallable; + } + + @Override + public UnaryCallable deleteSubscriptionCallable() { + return deleteSubscriptionCallable; + } + + @Override + public UnaryCallable modifyAckDeadlineCallable() { + return modifyAckDeadlineCallable; + } + + @Override + public UnaryCallable acknowledgeCallable() { + return acknowledgeCallable; + } + + @Override + public UnaryCallable pullCallable() { + return pullCallable; + } + + @Override + public UnaryCallable modifyPushConfigCallable() { + return modifyPushConfigCallable; + } + + @Override + public UnaryCallable getSnapshotCallable() { + return getSnapshotCallable; + } + + @Override + public UnaryCallable listSnapshotsCallable() { + return listSnapshotsCallable; + } + + @Override + public UnaryCallable + listSnapshotsPagedCallable() { + return listSnapshotsPagedCallable; + } + + @Override + public UnaryCallable createSnapshotCallable() { + return createSnapshotCallable; + } + + @Override + public UnaryCallable updateSnapshotCallable() { + return updateSnapshotCallable; + } + + @Override + public UnaryCallable deleteSnapshotCallable() { + return deleteSnapshotCallable; + } + + @Override + public UnaryCallable seekCallable() { + return seekCallable; + } + + @Override + public UnaryCallable setIamPolicyCallable() { + return setIamPolicyCallable; + } + + @Override + public UnaryCallable getIamPolicyCallable() { + return getIamPolicyCallable; + } + + @Override + public UnaryCallable + testIamPermissionsCallable() { + return testIamPermissionsCallable; + } + + @Override + public BidiStreamingCallable + streamingPullCallable() { + throw new UnsupportedOperationException( + "Not implemented: streamingPullCallable(). REST transport is not implemented for this" + + " method yet."); + } + + @Override + public final void close() { + try { + backgroundResources.close(); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new IllegalStateException("Failed to close resource", e); + } + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/PublisherStub.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/PublisherStub.java index 93cdf2f03..5c7f9d6a8 100644 --- a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/PublisherStub.java +++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/PublisherStub.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 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 + * 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, @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.pubsub.v1.stub; import static com.google.cloud.pubsub.v1.TopicAdminClient.ListTopicSnapshotsPagedResponse; import static com.google.cloud.pubsub.v1.TopicAdminClient.ListTopicSubscriptionsPagedResponse; import static com.google.cloud.pubsub.v1.TopicAdminClient.ListTopicsPagedResponse; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.rpc.UnaryCallable; import com.google.iam.v1.GetIamPolicyRequest; @@ -44,14 +44,13 @@ import com.google.pubsub.v1.UpdateTopicRequest; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * Base stub class for Cloud Pub/Sub API. + * Base stub class for the Publisher service API. * *

This class is for advanced usage and reflects the underlying API directly. */ -@Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +@Generated("by gapic-generator-java") public abstract class PublisherStub implements BackgroundResource { public UnaryCallable createTopicCallable() { @@ -103,6 +102,11 @@ public UnaryCallable deleteTopicCallable() { throw new UnsupportedOperationException("Not implemented: deleteTopicCallable()"); } + public UnaryCallable + detachSubscriptionCallable() { + throw new UnsupportedOperationException("Not implemented: detachSubscriptionCallable()"); + } + public UnaryCallable setIamPolicyCallable() { throw new UnsupportedOperationException("Not implemented: setIamPolicyCallable()"); } @@ -116,11 +120,6 @@ public UnaryCallable getIamPolicyCallable() { throw new UnsupportedOperationException("Not implemented: testIamPermissionsCallable()"); } - public UnaryCallable - detachSubscriptionCallable() { - throw new UnsupportedOperationException("Not implemented: detachSubscriptionCallable()"); - } - @Override public abstract void close(); } diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/PublisherStubSettings.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/PublisherStubSettings.java index 696671660..a0c47d70d 100644 --- a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/PublisherStubSettings.java +++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/PublisherStubSettings.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.pubsub.v1.stub; import static com.google.cloud.pubsub.v1.TopicAdminClient.ListTopicSnapshotsPagedResponse; @@ -22,9 +23,10 @@ import com.google.api.core.ApiFunction; import com.google.api.core.ApiFuture; import com.google.api.core.BetaApi; +import com.google.api.core.ObsoleteApi; import com.google.api.gax.batching.BatchingSettings; import com.google.api.gax.batching.FlowControlSettings; -import com.google.api.gax.batching.FlowController.LimitExceededBehavior; +import com.google.api.gax.batching.FlowController; import com.google.api.gax.batching.PartitionKey; import com.google.api.gax.batching.RequestBuilder; import com.google.api.gax.core.GaxProperties; @@ -33,6 +35,9 @@ import com.google.api.gax.grpc.GaxGrpcProperties; import com.google.api.gax.grpc.GrpcTransportChannel; import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; import com.google.api.gax.retrying.RetrySettings; import com.google.api.gax.rpc.ApiCallContext; import com.google.api.gax.rpc.ApiClientHeaderProvider; @@ -40,6 +45,7 @@ import com.google.api.gax.rpc.BatchingCallSettings; import com.google.api.gax.rpc.BatchingDescriptor; import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.LibraryMetadata; import com.google.api.gax.rpc.PageContext; import com.google.api.gax.rpc.PagedCallSettings; import com.google.api.gax.rpc.PagedListDescriptor; @@ -74,13 +80,13 @@ import com.google.pubsub.v1.Topic; import com.google.pubsub.v1.UpdateTopicRequest; import java.io.IOException; +import java.time.Duration; import java.util.ArrayList; import java.util.Collection; import java.util.List; import javax.annotation.Generated; -import org.threeten.bp.Duration; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link PublisherStub}. * @@ -95,23 +101,42 @@ *

The builder of this class is recursive, so contained classes are themselves builders. When * build() is called, the tree of builders is called to create the complete settings object. * - *

For example, to set the total timeout of createTopic to 30 seconds: + *

For example, to set the + * [RetrySettings](https://cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.retrying.RetrySettings) + * of createTopic: * - *

- * 
- * PublisherStubSettings.Builder topicAdminSettingsBuilder =
- *     PublisherStubSettings.newBuilder();
+ * 
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * PublisherStubSettings.Builder topicAdminSettingsBuilder = PublisherStubSettings.newBuilder();
  * topicAdminSettingsBuilder
  *     .createTopicSettings()
  *     .setRetrySettings(
- *         topicAdminSettingsBuilder.createTopicSettings().getRetrySettings().toBuilder()
- *             .setTotalTimeout(Duration.ofSeconds(30))
+ *         topicAdminSettingsBuilder
+ *             .createTopicSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
+ *             .setInitialRetryDelayDuration(Duration.ofSeconds(1))
+ *             .setInitialRpcTimeoutDuration(Duration.ofSeconds(5))
+ *             .setMaxAttempts(5)
+ *             .setMaxRetryDelayDuration(Duration.ofSeconds(30))
+ *             .setMaxRpcTimeoutDuration(Duration.ofSeconds(60))
+ *             .setRetryDelayMultiplier(1.3)
+ *             .setRpcTimeoutMultiplier(1.5)
+ *             .setTotalTimeoutDuration(Duration.ofSeconds(300))
  *             .build());
  * PublisherStubSettings topicAdminSettings = topicAdminSettingsBuilder.build();
- * 
- * 
+ * }
+ * + * Please refer to the [Client Side Retry + * Guide](https://docs.cloud.google.com/java/docs/client-retries) for additional support in setting + * retries. */ -@Generated("by gapic-generator") +@Generated("by gapic-generator-java") +@SuppressWarnings("CanonicalDuration") public class PublisherStubSettings extends StubSettings { /** The default scopes of the service. */ private static final ImmutableList DEFAULT_SERVICE_SCOPES = @@ -135,163 +160,12 @@ public class PublisherStubSettings extends StubSettings { ListTopicSnapshotsRequest, ListTopicSnapshotsResponse, ListTopicSnapshotsPagedResponse> listTopicSnapshotsSettings; private final UnaryCallSettings deleteTopicSettings; + private final UnaryCallSettings + detachSubscriptionSettings; private final UnaryCallSettings setIamPolicySettings; private final UnaryCallSettings getIamPolicySettings; private final UnaryCallSettings testIamPermissionsSettings; - private final UnaryCallSettings - detachSubscriptionSettings; - - /** Returns the object with the settings used for calls to createTopic. */ - public UnaryCallSettings createTopicSettings() { - return createTopicSettings; - } - - /** Returns the object with the settings used for calls to updateTopic. */ - public UnaryCallSettings updateTopicSettings() { - return updateTopicSettings; - } - - /** Returns the object with the settings used for calls to publish. */ - public BatchingCallSettings publishSettings() { - return publishSettings; - } - - /** Returns the object with the settings used for calls to getTopic. */ - public UnaryCallSettings getTopicSettings() { - return getTopicSettings; - } - - /** Returns the object with the settings used for calls to listTopics. */ - public PagedCallSettings - listTopicsSettings() { - return listTopicsSettings; - } - - /** Returns the object with the settings used for calls to listTopicSubscriptions. */ - public PagedCallSettings< - ListTopicSubscriptionsRequest, - ListTopicSubscriptionsResponse, - ListTopicSubscriptionsPagedResponse> - listTopicSubscriptionsSettings() { - return listTopicSubscriptionsSettings; - } - - /** Returns the object with the settings used for calls to listTopicSnapshots. */ - public PagedCallSettings< - ListTopicSnapshotsRequest, ListTopicSnapshotsResponse, ListTopicSnapshotsPagedResponse> - listTopicSnapshotsSettings() { - return listTopicSnapshotsSettings; - } - - /** Returns the object with the settings used for calls to deleteTopic. */ - public UnaryCallSettings deleteTopicSettings() { - return deleteTopicSettings; - } - - /** Returns the object with the settings used for calls to setIamPolicy. */ - public UnaryCallSettings setIamPolicySettings() { - return setIamPolicySettings; - } - - /** Returns the object with the settings used for calls to getIamPolicy. */ - public UnaryCallSettings getIamPolicySettings() { - return getIamPolicySettings; - } - - /** Returns the object with the settings used for calls to testIamPermissions. */ - public UnaryCallSettings - testIamPermissionsSettings() { - return testIamPermissionsSettings; - } - - /** Returns the object with the settings used for calls to detachSubscription. */ - public UnaryCallSettings - detachSubscriptionSettings() { - return detachSubscriptionSettings; - } - - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") - public PublisherStub createStub() throws IOException { - if (getTransportChannelProvider() - .getTransportName() - .equals(GrpcTransportChannel.getGrpcTransportName())) { - return GrpcPublisherStub.create(this); - } else { - throw new UnsupportedOperationException( - "Transport not supported: " + getTransportChannelProvider().getTransportName()); - } - } - - /** Returns a builder for the default ExecutorProvider for this service. */ - public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { - return InstantiatingExecutorProvider.newBuilder(); - } - - /** Returns the default service endpoint. */ - public static String getDefaultEndpoint() { - return "pubsub.googleapis.com:443"; - } - - /** Returns the default service scopes. */ - public static List getDefaultServiceScopes() { - return DEFAULT_SERVICE_SCOPES; - } - - /** Returns a builder for the default credentials for this service. */ - public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { - return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); - } - - /** Returns a builder for the default ChannelProvider for this service. */ - public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { - return InstantiatingGrpcChannelProvider.newBuilder() - .setMaxInboundMessageSize(Integer.MAX_VALUE); - } - - public static TransportChannelProvider defaultTransportChannelProvider() { - return defaultGrpcTransportProviderBuilder().build(); - } - - @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") - public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { - return ApiClientHeaderProvider.newBuilder() - .setGeneratedLibToken("gapic", GaxProperties.getLibraryVersion(PublisherStubSettings.class)) - .setTransportToken( - GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); - } - - /** Returns a new builder for this class. */ - public static Builder newBuilder() { - return Builder.createDefault(); - } - - /** Returns a new builder for this class. */ - public static Builder newBuilder(ClientContext clientContext) { - return new Builder(clientContext); - } - - /** Returns a builder containing all the values of this settings class. */ - public Builder toBuilder() { - return new Builder(this); - } - - protected PublisherStubSettings(Builder settingsBuilder) throws IOException { - super(settingsBuilder); - - createTopicSettings = settingsBuilder.createTopicSettings().build(); - updateTopicSettings = settingsBuilder.updateTopicSettings().build(); - publishSettings = settingsBuilder.publishSettings().build(); - getTopicSettings = settingsBuilder.getTopicSettings().build(); - listTopicsSettings = settingsBuilder.listTopicsSettings().build(); - listTopicSubscriptionsSettings = settingsBuilder.listTopicSubscriptionsSettings().build(); - listTopicSnapshotsSettings = settingsBuilder.listTopicSnapshotsSettings().build(); - deleteTopicSettings = settingsBuilder.deleteTopicSettings().build(); - setIamPolicySettings = settingsBuilder.setIamPolicySettings().build(); - getIamPolicySettings = settingsBuilder.getIamPolicySettings().build(); - testIamPermissionsSettings = settingsBuilder.testIamPermissionsSettings().build(); - detachSubscriptionSettings = settingsBuilder.detachSubscriptionSettings().build(); - } private static final PagedListDescriptor LIST_TOPICS_PAGE_STR_DESC = @@ -323,9 +197,7 @@ public String extractNextToken(ListTopicsResponse payload) { @Override public Iterable extractResources(ListTopicsResponse payload) { - return payload.getTopicsList() != null - ? payload.getTopicsList() - : ImmutableList.of(); + return payload.getTopicsList(); } }; @@ -365,9 +237,7 @@ public String extractNextToken(ListTopicSubscriptionsResponse payload) { @Override public Iterable extractResources(ListTopicSubscriptionsResponse payload) { - return payload.getSubscriptionsList() != null - ? payload.getSubscriptionsList() - : ImmutableList.of(); + return payload.getSubscriptionsList(); } }; @@ -404,9 +274,7 @@ public String extractNextToken(ListTopicSnapshotsResponse payload) { @Override public Iterable extractResources(ListTopicSnapshotsResponse payload) { - return payload.getSnapshotsList() != null - ? payload.getSnapshotsList() - : ImmutableList.of(); + return payload.getSnapshotsList(); } }; @@ -509,8 +377,7 @@ public void splitResponse( List subresponseElements = new ArrayList<>(); long subresponseCount = responder.getMessageCount(); for (int i = 0; i < subresponseCount; i++) { - subresponseElements.add(batchResponse.getMessageIds(batchMessageIndex)); - batchMessageIndex += 1; + subresponseElements.add(batchResponse.getMessageIds(batchMessageIndex++)); } PublishResponse response = PublishResponse.newBuilder().addAllMessageIds(subresponseElements).build(); @@ -538,10 +405,210 @@ public long countBytes(PublishRequest request) { } }; + /** Returns the object with the settings used for calls to createTopic. */ + public UnaryCallSettings createTopicSettings() { + return createTopicSettings; + } + + /** Returns the object with the settings used for calls to updateTopic. */ + public UnaryCallSettings updateTopicSettings() { + return updateTopicSettings; + } + + /** Returns the object with the settings used for calls to publish. */ + public BatchingCallSettings publishSettings() { + return publishSettings; + } + + /** Returns the object with the settings used for calls to getTopic. */ + public UnaryCallSettings getTopicSettings() { + return getTopicSettings; + } + + /** Returns the object with the settings used for calls to listTopics. */ + public PagedCallSettings + listTopicsSettings() { + return listTopicsSettings; + } + + /** Returns the object with the settings used for calls to listTopicSubscriptions. */ + public PagedCallSettings< + ListTopicSubscriptionsRequest, + ListTopicSubscriptionsResponse, + ListTopicSubscriptionsPagedResponse> + listTopicSubscriptionsSettings() { + return listTopicSubscriptionsSettings; + } + + /** Returns the object with the settings used for calls to listTopicSnapshots. */ + public PagedCallSettings< + ListTopicSnapshotsRequest, ListTopicSnapshotsResponse, ListTopicSnapshotsPagedResponse> + listTopicSnapshotsSettings() { + return listTopicSnapshotsSettings; + } + + /** Returns the object with the settings used for calls to deleteTopic. */ + public UnaryCallSettings deleteTopicSettings() { + return deleteTopicSettings; + } + + /** Returns the object with the settings used for calls to detachSubscription. */ + public UnaryCallSettings + detachSubscriptionSettings() { + return detachSubscriptionSettings; + } + + /** Returns the object with the settings used for calls to setIamPolicy. */ + public UnaryCallSettings setIamPolicySettings() { + return setIamPolicySettings; + } + + /** Returns the object with the settings used for calls to getIamPolicy. */ + public UnaryCallSettings getIamPolicySettings() { + return getIamPolicySettings; + } + + /** Returns the object with the settings used for calls to testIamPermissions. */ + public UnaryCallSettings + testIamPermissionsSettings() { + return testIamPermissionsSettings; + } + + public PublisherStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(GrpcTransportChannel.getGrpcTransportName())) { + return GrpcPublisherStub.create(this); + } + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonPublisherStub.create(this); + } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); + } + + /** Returns the default service name. */ + @Override + public String getServiceName() { + return "pubsub"; + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + @ObsoleteApi("Use getEndpoint() instead") + public static String getDefaultEndpoint() { + return "pubsub.googleapis.com:443"; + } + + /** Returns the default mTLS service endpoint. */ + public static String getDefaultMtlsEndpoint() { + return "pubsub.mtls.googleapis.com:443"; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder() + .setScopesToApply(DEFAULT_SERVICE_SCOPES) + .setUseJwtAccessWithScope(true); + } + + /** Returns a builder for the default gRPC ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return InstantiatingGrpcChannelProvider.newBuilder() + .setMaxInboundMessageSize(Integer.MAX_VALUE); + } + + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultGrpcTransportProviderBuilder().build(); + } + + public static ApiClientHeaderProvider.Builder defaultGrpcApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken("gapic", GaxProperties.getLibraryVersion(PublisherStubSettings.class)) + .setTransportToken( + GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); + } + + public static ApiClientHeaderProvider.Builder defaultHttpJsonApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken("gapic", GaxProperties.getLibraryVersion(PublisherStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return PublisherStubSettings.defaultGrpcApiClientHeaderProviderBuilder(); + } + + /** Returns a new gRPC builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new REST builder for this class. */ + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected PublisherStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + createTopicSettings = settingsBuilder.createTopicSettings().build(); + updateTopicSettings = settingsBuilder.updateTopicSettings().build(); + publishSettings = settingsBuilder.publishSettings().build(); + getTopicSettings = settingsBuilder.getTopicSettings().build(); + listTopicsSettings = settingsBuilder.listTopicsSettings().build(); + listTopicSubscriptionsSettings = settingsBuilder.listTopicSubscriptionsSettings().build(); + listTopicSnapshotsSettings = settingsBuilder.listTopicSnapshotsSettings().build(); + deleteTopicSettings = settingsBuilder.deleteTopicSettings().build(); + detachSubscriptionSettings = settingsBuilder.detachSubscriptionSettings().build(); + setIamPolicySettings = settingsBuilder.setIamPolicySettings().build(); + getIamPolicySettings = settingsBuilder.getIamPolicySettings().build(); + testIamPermissionsSettings = settingsBuilder.testIamPermissionsSettings().build(); + } + + @Override + protected LibraryMetadata getLibraryMetadata() { + return LibraryMetadata.newBuilder() + .setArtifactName("com.google.cloud:google-cloud-pubsub") + .setRepository("googleapis/java-pubsub") + .setVersion(Version.VERSION) + .build(); + } + /** Builder for PublisherStubSettings. */ public static class Builder extends StubSettings.Builder { private final ImmutableList> unaryMethodSettingsBuilders; - private final UnaryCallSettings.Builder createTopicSettings; private final UnaryCallSettings.Builder updateTopicSettings; private final BatchingCallSettings.Builder publishSettings; @@ -558,13 +625,12 @@ public static class Builder extends StubSettings.Builder listTopicSnapshotsSettings; private final UnaryCallSettings.Builder deleteTopicSettings; + private final UnaryCallSettings.Builder + detachSubscriptionSettings; private final UnaryCallSettings.Builder setIamPolicySettings; private final UnaryCallSettings.Builder getIamPolicySettings; private final UnaryCallSettings.Builder testIamPermissionsSettings; - private final UnaryCallSettings.Builder - detachSubscriptionSettings; - private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -572,16 +638,10 @@ public static class Builder extends StubSettings.Builder> definitions = ImmutableMap.builder(); definitions.put( - "retry_policy_1_codes", + "retry_policy_0_codes", ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); - definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); - definitions.put( - "retry_policy_3_codes", - ImmutableSet.copyOf( - Lists.newArrayList( - StatusCode.Code.UNKNOWN, StatusCode.Code.ABORTED, StatusCode.Code.UNAVAILABLE))); definitions.put( - "retry_policy_2_codes", + "retry_policy_1_codes", ImmutableSet.copyOf( Lists.newArrayList( StatusCode.Code.ABORTED, @@ -591,6 +651,11 @@ public static class Builder extends StubSettings.BuildernewArrayList( + StatusCode.Code.UNKNOWN, StatusCode.Code.ABORTED, StatusCode.Code.UNAVAILABLE))); RETRYABLE_CODE_DEFINITIONS = definitions.build(); } @@ -601,76 +666,63 @@ public static class Builder extends StubSettings.Builder>of( createTopicSettings, @@ -681,34 +733,79 @@ protected Builder(ClientContext clientContext) { listTopicSubscriptionsSettings, listTopicSnapshotsSettings, deleteTopicSettings, + detachSubscriptionSettings, setIamPolicySettings, getIamPolicySettings, - testIamPermissionsSettings, - detachSubscriptionSettings); - + testIamPermissionsSettings); initDefaults(this); } + protected Builder(PublisherStubSettings settings) { + super(settings); + + createTopicSettings = settings.createTopicSettings.toBuilder(); + updateTopicSettings = settings.updateTopicSettings.toBuilder(); + publishSettings = settings.publishSettings.toBuilder(); + getTopicSettings = settings.getTopicSettings.toBuilder(); + listTopicsSettings = settings.listTopicsSettings.toBuilder(); + listTopicSubscriptionsSettings = settings.listTopicSubscriptionsSettings.toBuilder(); + listTopicSnapshotsSettings = settings.listTopicSnapshotsSettings.toBuilder(); + deleteTopicSettings = settings.deleteTopicSettings.toBuilder(); + detachSubscriptionSettings = settings.detachSubscriptionSettings.toBuilder(); + setIamPolicySettings = settings.setIamPolicySettings.toBuilder(); + getIamPolicySettings = settings.getIamPolicySettings.toBuilder(); + testIamPermissionsSettings = settings.testIamPermissionsSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + createTopicSettings, + updateTopicSettings, + publishSettings, + getTopicSettings, + listTopicsSettings, + listTopicSubscriptionsSettings, + listTopicSnapshotsSettings, + deleteTopicSettings, + detachSubscriptionSettings, + setIamPolicySettings, + getIamPolicySettings, + testIamPermissionsSettings); + } + private static Builder createDefault() { - Builder builder = new Builder((ClientContext) null); + Builder builder = new Builder(((ClientContext) null)); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); - builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); + return initDefaults(builder); } - private static Builder initDefaults(Builder builder) { + private static Builder createHttpJsonDefault() { + Builder builder = new Builder(((ClientContext) null)); + + builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { builder .createTopicSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .updateTopicSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .publishSettings() @@ -716,105 +813,73 @@ private static Builder initDefaults(Builder builder) { BatchingSettings.newBuilder() .setElementCountThreshold(100L) .setRequestByteThreshold(1048576L) - .setDelayThreshold(Duration.ofMillis(10)) + .setDelayThresholdDuration(Duration.ofMillis(10L)) .setFlowControlSettings( FlowControlSettings.newBuilder() - .setLimitExceededBehavior(LimitExceededBehavior.Ignore) + .setLimitExceededBehavior(FlowController.LimitExceededBehavior.Ignore) .build()) .build()); + builder .publishSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_2_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_2_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); builder .getTopicSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_3_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_3_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_2_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_2_params")); builder .listTopicsSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_3_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_3_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_2_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_2_params")); builder .listTopicSubscriptionsSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_3_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_3_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_2_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_2_params")); builder .listTopicSnapshotsSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_3_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_3_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_2_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_2_params")); builder .deleteTopicSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .detachSubscriptionSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .setIamPolicySettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .getIamPolicySettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_3_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_3_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_2_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_2_params")); builder .testIamPermissionsSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); - - builder - .detachSubscriptionSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); return builder; } - protected Builder(PublisherStubSettings settings) { - super(settings); - - createTopicSettings = settings.createTopicSettings.toBuilder(); - updateTopicSettings = settings.updateTopicSettings.toBuilder(); - publishSettings = settings.publishSettings.toBuilder(); - getTopicSettings = settings.getTopicSettings.toBuilder(); - listTopicsSettings = settings.listTopicsSettings.toBuilder(); - listTopicSubscriptionsSettings = settings.listTopicSubscriptionsSettings.toBuilder(); - listTopicSnapshotsSettings = settings.listTopicSnapshotsSettings.toBuilder(); - deleteTopicSettings = settings.deleteTopicSettings.toBuilder(); - setIamPolicySettings = settings.setIamPolicySettings.toBuilder(); - getIamPolicySettings = settings.getIamPolicySettings.toBuilder(); - testIamPermissionsSettings = settings.testIamPermissionsSettings.toBuilder(); - detachSubscriptionSettings = settings.detachSubscriptionSettings.toBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of( - createTopicSettings, - updateTopicSettings, - publishSettings, - getTopicSettings, - listTopicsSettings, - listTopicSubscriptionsSettings, - listTopicSnapshotsSettings, - deleteTopicSettings, - setIamPolicySettings, - getIamPolicySettings, - testIamPermissionsSettings, - detachSubscriptionSettings); - } - - // NEXT_MAJOR_VER: remove 'throws Exception' /** * Applies the given settings updater function to all of the unary API methods in this service. * *

Note: This method does not support applying settings to streaming methods. */ public Builder applyToAllUnaryMethods( - ApiFunction, Void> settingsUpdater) throws Exception { + ApiFunction, Void> settingsUpdater) { super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); return this; } @@ -870,6 +935,12 @@ public UnaryCallSettings.Builder deleteTopicSettings( return deleteTopicSettings; } + /** Returns the builder for the settings used for calls to detachSubscription. */ + public UnaryCallSettings.Builder + detachSubscriptionSettings() { + return detachSubscriptionSettings; + } + /** Returns the builder for the settings used for calls to setIamPolicy. */ public UnaryCallSettings.Builder setIamPolicySettings() { return setIamPolicySettings; @@ -886,12 +957,6 @@ public UnaryCallSettings.Builder getIamPolicySettin return testIamPermissionsSettings; } - /** Returns the builder for the settings used for calls to detachSubscription. */ - public UnaryCallSettings.Builder - detachSubscriptionSettings() { - return detachSubscriptionSettings; - } - @Override public PublisherStubSettings build() throws IOException { return new PublisherStubSettings(this); diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/SchemaServiceStub.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/SchemaServiceStub.java index d153da5c1..a0335a4b1 100644 --- a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/SchemaServiceStub.java +++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/SchemaServiceStub.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 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 + * 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, @@ -13,19 +13,30 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.pubsub.v1.stub; +import static com.google.cloud.pubsub.v1.SchemaServiceClient.ListSchemaRevisionsPagedResponse; import static com.google.cloud.pubsub.v1.SchemaServiceClient.ListSchemasPagedResponse; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.rpc.UnaryCallable; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; import com.google.protobuf.Empty; +import com.google.pubsub.v1.CommitSchemaRequest; import com.google.pubsub.v1.CreateSchemaRequest; import com.google.pubsub.v1.DeleteSchemaRequest; +import com.google.pubsub.v1.DeleteSchemaRevisionRequest; import com.google.pubsub.v1.GetSchemaRequest; +import com.google.pubsub.v1.ListSchemaRevisionsRequest; +import com.google.pubsub.v1.ListSchemaRevisionsResponse; import com.google.pubsub.v1.ListSchemasRequest; import com.google.pubsub.v1.ListSchemasResponse; +import com.google.pubsub.v1.RollbackSchemaRequest; import com.google.pubsub.v1.Schema; import com.google.pubsub.v1.ValidateMessageRequest; import com.google.pubsub.v1.ValidateMessageResponse; @@ -33,14 +44,13 @@ import com.google.pubsub.v1.ValidateSchemaResponse; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * Base stub class for Cloud Pub/Sub API. + * Base stub class for the SchemaService service API. * *

This class is for advanced usage and reflects the underlying API directly. */ -@Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +@Generated("by gapic-generator-java") public abstract class SchemaServiceStub implements BackgroundResource { public UnaryCallable createSchemaCallable() { @@ -59,6 +69,28 @@ public UnaryCallable listSchemasCallabl throw new UnsupportedOperationException("Not implemented: listSchemasCallable()"); } + public UnaryCallable + listSchemaRevisionsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listSchemaRevisionsPagedCallable()"); + } + + public UnaryCallable + listSchemaRevisionsCallable() { + throw new UnsupportedOperationException("Not implemented: listSchemaRevisionsCallable()"); + } + + public UnaryCallable commitSchemaCallable() { + throw new UnsupportedOperationException("Not implemented: commitSchemaCallable()"); + } + + public UnaryCallable rollbackSchemaCallable() { + throw new UnsupportedOperationException("Not implemented: rollbackSchemaCallable()"); + } + + public UnaryCallable deleteSchemaRevisionCallable() { + throw new UnsupportedOperationException("Not implemented: deleteSchemaRevisionCallable()"); + } + public UnaryCallable deleteSchemaCallable() { throw new UnsupportedOperationException("Not implemented: deleteSchemaCallable()"); } @@ -71,6 +103,19 @@ public UnaryCallable validateMe throw new UnsupportedOperationException("Not implemented: validateMessageCallable()"); } + public UnaryCallable setIamPolicyCallable() { + throw new UnsupportedOperationException("Not implemented: setIamPolicyCallable()"); + } + + public UnaryCallable getIamPolicyCallable() { + throw new UnsupportedOperationException("Not implemented: getIamPolicyCallable()"); + } + + public UnaryCallable + testIamPermissionsCallable() { + throw new UnsupportedOperationException("Not implemented: testIamPermissionsCallable()"); + } + @Override public abstract void close(); } diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/SchemaServiceStubSettings.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/SchemaServiceStubSettings.java index c78c64fc2..2e879a074 100644 --- a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/SchemaServiceStubSettings.java +++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/SchemaServiceStubSettings.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 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 + * 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, @@ -13,23 +13,30 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.pubsub.v1.stub; +import static com.google.cloud.pubsub.v1.SchemaServiceClient.ListSchemaRevisionsPagedResponse; import static com.google.cloud.pubsub.v1.SchemaServiceClient.ListSchemasPagedResponse; import com.google.api.core.ApiFunction; import com.google.api.core.ApiFuture; import com.google.api.core.BetaApi; +import com.google.api.core.ObsoleteApi; import com.google.api.gax.core.GaxProperties; import com.google.api.gax.core.GoogleCredentialsProvider; import com.google.api.gax.core.InstantiatingExecutorProvider; import com.google.api.gax.grpc.GaxGrpcProperties; import com.google.api.gax.grpc.GrpcTransportChannel; import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; import com.google.api.gax.retrying.RetrySettings; import com.google.api.gax.rpc.ApiCallContext; import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.LibraryMetadata; import com.google.api.gax.rpc.PageContext; import com.google.api.gax.rpc.PagedCallSettings; import com.google.api.gax.rpc.PagedListDescriptor; @@ -43,23 +50,33 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Lists; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; import com.google.protobuf.Empty; +import com.google.pubsub.v1.CommitSchemaRequest; import com.google.pubsub.v1.CreateSchemaRequest; import com.google.pubsub.v1.DeleteSchemaRequest; +import com.google.pubsub.v1.DeleteSchemaRevisionRequest; import com.google.pubsub.v1.GetSchemaRequest; +import com.google.pubsub.v1.ListSchemaRevisionsRequest; +import com.google.pubsub.v1.ListSchemaRevisionsResponse; import com.google.pubsub.v1.ListSchemasRequest; import com.google.pubsub.v1.ListSchemasResponse; +import com.google.pubsub.v1.RollbackSchemaRequest; import com.google.pubsub.v1.Schema; import com.google.pubsub.v1.ValidateMessageRequest; import com.google.pubsub.v1.ValidateMessageResponse; import com.google.pubsub.v1.ValidateSchemaRequest; import com.google.pubsub.v1.ValidateSchemaResponse; import java.io.IOException; +import java.time.Duration; import java.util.List; import javax.annotation.Generated; -import org.threeten.bp.Duration; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link SchemaServiceStub}. * @@ -74,23 +91,43 @@ *

The builder of this class is recursive, so contained classes are themselves builders. When * build() is called, the tree of builders is called to create the complete settings object. * - *

For example, to set the total timeout of createSchema to 30 seconds: + *

For example, to set the + * [RetrySettings](https://cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.retrying.RetrySettings) + * of createSchema: * - *

- * 
+ * 
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
  * SchemaServiceStubSettings.Builder schemaServiceSettingsBuilder =
  *     SchemaServiceStubSettings.newBuilder();
  * schemaServiceSettingsBuilder
  *     .createSchemaSettings()
  *     .setRetrySettings(
- *         schemaServiceSettingsBuilder.createSchemaSettings().getRetrySettings().toBuilder()
- *             .setTotalTimeout(Duration.ofSeconds(30))
+ *         schemaServiceSettingsBuilder
+ *             .createSchemaSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
+ *             .setInitialRetryDelayDuration(Duration.ofSeconds(1))
+ *             .setInitialRpcTimeoutDuration(Duration.ofSeconds(5))
+ *             .setMaxAttempts(5)
+ *             .setMaxRetryDelayDuration(Duration.ofSeconds(30))
+ *             .setMaxRpcTimeoutDuration(Duration.ofSeconds(60))
+ *             .setRetryDelayMultiplier(1.3)
+ *             .setRpcTimeoutMultiplier(1.5)
+ *             .setTotalTimeoutDuration(Duration.ofSeconds(300))
  *             .build());
  * SchemaServiceStubSettings schemaServiceSettings = schemaServiceSettingsBuilder.build();
- * 
- * 
+ * }
+ * + * Please refer to the [Client Side Retry + * Guide](https://docs.cloud.google.com/java/docs/client-retries) for additional support in setting + * retries. */ -@Generated("by gapic-generator") +@Generated("by gapic-generator-java") +@SuppressWarnings("CanonicalDuration") public class SchemaServiceStubSettings extends StubSettings { /** The default scopes of the service. */ private static final ImmutableList DEFAULT_SERVICE_SCOPES = @@ -103,11 +140,131 @@ public class SchemaServiceStubSettings extends StubSettings getSchemaSettings; private final PagedCallSettings listSchemasSettings; + private final PagedCallSettings< + ListSchemaRevisionsRequest, ListSchemaRevisionsResponse, ListSchemaRevisionsPagedResponse> + listSchemaRevisionsSettings; + private final UnaryCallSettings commitSchemaSettings; + private final UnaryCallSettings rollbackSchemaSettings; + private final UnaryCallSettings deleteSchemaRevisionSettings; private final UnaryCallSettings deleteSchemaSettings; private final UnaryCallSettings validateSchemaSettings; private final UnaryCallSettings validateMessageSettings; + private final UnaryCallSettings setIamPolicySettings; + private final UnaryCallSettings getIamPolicySettings; + private final UnaryCallSettings + testIamPermissionsSettings; + + private static final PagedListDescriptor + LIST_SCHEMAS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListSchemasRequest injectToken(ListSchemasRequest payload, String token) { + return ListSchemasRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListSchemasRequest injectPageSize(ListSchemasRequest payload, int pageSize) { + return ListSchemasRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListSchemasRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListSchemasResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListSchemasResponse payload) { + return payload.getSchemasList(); + } + }; + + private static final PagedListDescriptor< + ListSchemaRevisionsRequest, ListSchemaRevisionsResponse, Schema> + LIST_SCHEMA_REVISIONS_PAGE_STR_DESC = + new PagedListDescriptor< + ListSchemaRevisionsRequest, ListSchemaRevisionsResponse, Schema>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListSchemaRevisionsRequest injectToken( + ListSchemaRevisionsRequest payload, String token) { + return ListSchemaRevisionsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListSchemaRevisionsRequest injectPageSize( + ListSchemaRevisionsRequest payload, int pageSize) { + return ListSchemaRevisionsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListSchemaRevisionsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListSchemaRevisionsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListSchemaRevisionsResponse payload) { + return payload.getSchemasList(); + } + }; + + private static final PagedListResponseFactory< + ListSchemasRequest, ListSchemasResponse, ListSchemasPagedResponse> + LIST_SCHEMAS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListSchemasRequest, ListSchemasResponse, ListSchemasPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListSchemasRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_SCHEMAS_PAGE_STR_DESC, request, context); + return ListSchemasPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + private static final PagedListResponseFactory< + ListSchemaRevisionsRequest, ListSchemaRevisionsResponse, ListSchemaRevisionsPagedResponse> + LIST_SCHEMA_REVISIONS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListSchemaRevisionsRequest, + ListSchemaRevisionsResponse, + ListSchemaRevisionsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListSchemaRevisionsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext + pageContext = + PageContext.create( + callable, LIST_SCHEMA_REVISIONS_PAGE_STR_DESC, request, context); + return ListSchemaRevisionsPagedResponse.createAsync(pageContext, futureResponse); + } + }; /** Returns the object with the settings used for calls to createSchema. */ public UnaryCallSettings createSchemaSettings() { @@ -125,6 +282,28 @@ public UnaryCallSettings getSchemaSettings() { return listSchemasSettings; } + /** Returns the object with the settings used for calls to listSchemaRevisions. */ + public PagedCallSettings< + ListSchemaRevisionsRequest, ListSchemaRevisionsResponse, ListSchemaRevisionsPagedResponse> + listSchemaRevisionsSettings() { + return listSchemaRevisionsSettings; + } + + /** Returns the object with the settings used for calls to commitSchema. */ + public UnaryCallSettings commitSchemaSettings() { + return commitSchemaSettings; + } + + /** Returns the object with the settings used for calls to rollbackSchema. */ + public UnaryCallSettings rollbackSchemaSettings() { + return rollbackSchemaSettings; + } + + /** Returns the object with the settings used for calls to deleteSchemaRevision. */ + public UnaryCallSettings deleteSchemaRevisionSettings() { + return deleteSchemaRevisionSettings; + } + /** Returns the object with the settings used for calls to deleteSchema. */ public UnaryCallSettings deleteSchemaSettings() { return deleteSchemaSettings; @@ -141,16 +320,42 @@ public UnaryCallSettings validate return validateMessageSettings; } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + /** Returns the object with the settings used for calls to setIamPolicy. */ + public UnaryCallSettings setIamPolicySettings() { + return setIamPolicySettings; + } + + /** Returns the object with the settings used for calls to getIamPolicy. */ + public UnaryCallSettings getIamPolicySettings() { + return getIamPolicySettings; + } + + /** Returns the object with the settings used for calls to testIamPermissions. */ + public UnaryCallSettings + testIamPermissionsSettings() { + return testIamPermissionsSettings; + } + public SchemaServiceStub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcSchemaServiceStub.create(this); - } else { - throw new UnsupportedOperationException( - "Transport not supported: " + getTransportChannelProvider().getTransportName()); } + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonSchemaServiceStub.create(this); + } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); + } + + /** Returns the default service name. */ + @Override + public String getServiceName() { + return "pubsub"; } /** Returns a builder for the default ExecutorProvider for this service. */ @@ -159,10 +364,16 @@ public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuild } /** Returns the default service endpoint. */ + @ObsoleteApi("Use getEndpoint() instead") public static String getDefaultEndpoint() { return "pubsub.googleapis.com:443"; } + /** Returns the default mTLS service endpoint. */ + public static String getDefaultMtlsEndpoint() { + return "pubsub.mtls.googleapis.com:443"; + } + /** Returns the default service scopes. */ public static List getDefaultServiceScopes() { return DEFAULT_SERVICE_SCOPES; @@ -170,21 +381,29 @@ public static List getDefaultServiceScopes() { /** Returns a builder for the default credentials for this service. */ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { - return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + return GoogleCredentialsProvider.newBuilder() + .setScopesToApply(DEFAULT_SERVICE_SCOPES) + .setUseJwtAccessWithScope(true); } - /** Returns a builder for the default ChannelProvider for this service. */ + /** Returns a builder for the default gRPC ChannelProvider for this service. */ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { return InstantiatingGrpcChannelProvider.newBuilder() .setMaxInboundMessageSize(Integer.MAX_VALUE); } + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + public static TransportChannelProvider defaultTransportChannelProvider() { return defaultGrpcTransportProviderBuilder().build(); } - @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") - public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + public static ApiClientHeaderProvider.Builder defaultGrpcApiClientHeaderProviderBuilder() { return ApiClientHeaderProvider.newBuilder() .setGeneratedLibToken( "gapic", GaxProperties.getLibraryVersion(SchemaServiceStubSettings.class)) @@ -192,11 +411,29 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); } - /** Returns a new builder for this class. */ + public static ApiClientHeaderProvider.Builder defaultHttpJsonApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(SchemaServiceStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return SchemaServiceStubSettings.defaultGrpcApiClientHeaderProviderBuilder(); + } + + /** Returns a new gRPC builder for this class. */ public static Builder newBuilder() { return Builder.createDefault(); } + /** Returns a new REST builder for this class. */ + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + /** Returns a new builder for this class. */ public static Builder newBuilder(ClientContext clientContext) { return new Builder(clientContext); @@ -213,79 +450,53 @@ protected SchemaServiceStubSettings(Builder settingsBuilder) throws IOException createSchemaSettings = settingsBuilder.createSchemaSettings().build(); getSchemaSettings = settingsBuilder.getSchemaSettings().build(); listSchemasSettings = settingsBuilder.listSchemasSettings().build(); + listSchemaRevisionsSettings = settingsBuilder.listSchemaRevisionsSettings().build(); + commitSchemaSettings = settingsBuilder.commitSchemaSettings().build(); + rollbackSchemaSettings = settingsBuilder.rollbackSchemaSettings().build(); + deleteSchemaRevisionSettings = settingsBuilder.deleteSchemaRevisionSettings().build(); deleteSchemaSettings = settingsBuilder.deleteSchemaSettings().build(); validateSchemaSettings = settingsBuilder.validateSchemaSettings().build(); validateMessageSettings = settingsBuilder.validateMessageSettings().build(); + setIamPolicySettings = settingsBuilder.setIamPolicySettings().build(); + getIamPolicySettings = settingsBuilder.getIamPolicySettings().build(); + testIamPermissionsSettings = settingsBuilder.testIamPermissionsSettings().build(); } - private static final PagedListDescriptor - LIST_SCHEMAS_PAGE_STR_DESC = - new PagedListDescriptor() { - @Override - public String emptyToken() { - return ""; - } - - @Override - public ListSchemasRequest injectToken(ListSchemasRequest payload, String token) { - return ListSchemasRequest.newBuilder(payload).setPageToken(token).build(); - } - - @Override - public ListSchemasRequest injectPageSize(ListSchemasRequest payload, int pageSize) { - return ListSchemasRequest.newBuilder(payload).setPageSize(pageSize).build(); - } - - @Override - public Integer extractPageSize(ListSchemasRequest payload) { - return payload.getPageSize(); - } - - @Override - public String extractNextToken(ListSchemasResponse payload) { - return payload.getNextPageToken(); - } - - @Override - public Iterable extractResources(ListSchemasResponse payload) { - return payload.getSchemasList() != null - ? payload.getSchemasList() - : ImmutableList.of(); - } - }; - - private static final PagedListResponseFactory< - ListSchemasRequest, ListSchemasResponse, ListSchemasPagedResponse> - LIST_SCHEMAS_PAGE_STR_FACT = - new PagedListResponseFactory< - ListSchemasRequest, ListSchemasResponse, ListSchemasPagedResponse>() { - @Override - public ApiFuture getFuturePagedResponse( - UnaryCallable callable, - ListSchemasRequest request, - ApiCallContext context, - ApiFuture futureResponse) { - PageContext pageContext = - PageContext.create(callable, LIST_SCHEMAS_PAGE_STR_DESC, request, context); - return ListSchemasPagedResponse.createAsync(pageContext, futureResponse); - } - }; + @Override + protected LibraryMetadata getLibraryMetadata() { + return LibraryMetadata.newBuilder() + .setArtifactName("com.google.cloud:google-cloud-pubsub") + .setRepository("googleapis/java-pubsub") + .setVersion(Version.VERSION) + .build(); + } /** Builder for SchemaServiceStubSettings. */ public static class Builder extends StubSettings.Builder { private final ImmutableList> unaryMethodSettingsBuilders; - private final UnaryCallSettings.Builder createSchemaSettings; private final UnaryCallSettings.Builder getSchemaSettings; private final PagedCallSettings.Builder< ListSchemasRequest, ListSchemasResponse, ListSchemasPagedResponse> listSchemasSettings; + private final PagedCallSettings.Builder< + ListSchemaRevisionsRequest, + ListSchemaRevisionsResponse, + ListSchemaRevisionsPagedResponse> + listSchemaRevisionsSettings; + private final UnaryCallSettings.Builder commitSchemaSettings; + private final UnaryCallSettings.Builder rollbackSchemaSettings; + private final UnaryCallSettings.Builder + deleteSchemaRevisionSettings; private final UnaryCallSettings.Builder deleteSchemaSettings; private final UnaryCallSettings.Builder validateSchemaSettings; private final UnaryCallSettings.Builder validateMessageSettings; - + private final UnaryCallSettings.Builder setIamPolicySettings; + private final UnaryCallSettings.Builder getIamPolicySettings; + private final UnaryCallSettings.Builder + testIamPermissionsSettings; private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -293,42 +504,9 @@ public static class Builder extends StubSettings.Builder> definitions = ImmutableMap.builder(); definitions.put( - "retry_policy_1_codes", - ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); - definitions.put( - "retry_policy_4_codes", - ImmutableSet.copyOf( - Lists.newArrayList( - StatusCode.Code.DEADLINE_EXCEEDED, - StatusCode.Code.RESOURCE_EXHAUSTED, - StatusCode.Code.ABORTED, - StatusCode.Code.INTERNAL, - StatusCode.Code.UNAVAILABLE))); - definitions.put( - "retry_policy_6_codes", + "retry_policy_7_codes", ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); - definitions.put( - "retry_policy_3_codes", - ImmutableSet.copyOf( - Lists.newArrayList( - StatusCode.Code.UNKNOWN, StatusCode.Code.ABORTED, StatusCode.Code.UNAVAILABLE))); - definitions.put( - "retry_policy_2_codes", - ImmutableSet.copyOf( - Lists.newArrayList( - StatusCode.Code.ABORTED, - StatusCode.Code.CANCELLED, - StatusCode.Code.INTERNAL, - StatusCode.Code.RESOURCE_EXHAUSTED, - StatusCode.Code.UNKNOWN, - StatusCode.Code.UNAVAILABLE, - StatusCode.Code.DEADLINE_EXCEEDED))); - definitions.put( - "retry_policy_5_codes", - ImmutableSet.copyOf( - Lists.newArrayList( - StatusCode.Code.UNKNOWN, StatusCode.Code.ABORTED, StatusCode.Code.UNAVAILABLE))); RETRYABLE_CODE_DEFINITIONS = definitions.build(); } @@ -339,178 +517,194 @@ public static class Builder extends StubSettings.Builder>of( createSchemaSettings, getSchemaSettings, listSchemasSettings, + listSchemaRevisionsSettings, + commitSchemaSettings, + rollbackSchemaSettings, + deleteSchemaRevisionSettings, deleteSchemaSettings, validateSchemaSettings, - validateMessageSettings); - + validateMessageSettings, + setIamPolicySettings, + getIamPolicySettings, + testIamPermissionsSettings); initDefaults(this); } + protected Builder(SchemaServiceStubSettings settings) { + super(settings); + + createSchemaSettings = settings.createSchemaSettings.toBuilder(); + getSchemaSettings = settings.getSchemaSettings.toBuilder(); + listSchemasSettings = settings.listSchemasSettings.toBuilder(); + listSchemaRevisionsSettings = settings.listSchemaRevisionsSettings.toBuilder(); + commitSchemaSettings = settings.commitSchemaSettings.toBuilder(); + rollbackSchemaSettings = settings.rollbackSchemaSettings.toBuilder(); + deleteSchemaRevisionSettings = settings.deleteSchemaRevisionSettings.toBuilder(); + deleteSchemaSettings = settings.deleteSchemaSettings.toBuilder(); + validateSchemaSettings = settings.validateSchemaSettings.toBuilder(); + validateMessageSettings = settings.validateMessageSettings.toBuilder(); + setIamPolicySettings = settings.setIamPolicySettings.toBuilder(); + getIamPolicySettings = settings.getIamPolicySettings.toBuilder(); + testIamPermissionsSettings = settings.testIamPermissionsSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + createSchemaSettings, + getSchemaSettings, + listSchemasSettings, + listSchemaRevisionsSettings, + commitSchemaSettings, + rollbackSchemaSettings, + deleteSchemaRevisionSettings, + deleteSchemaSettings, + validateSchemaSettings, + validateMessageSettings, + setIamPolicySettings, + getIamPolicySettings, + testIamPermissionsSettings); + } + private static Builder createDefault() { - Builder builder = new Builder((ClientContext) null); + Builder builder = new Builder(((ClientContext) null)); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); - builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); + return initDefaults(builder); } - private static Builder initDefaults(Builder builder) { + private static Builder createHttpJsonDefault() { + Builder builder = new Builder(((ClientContext) null)); + builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); + + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { builder .createSchemaSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_7_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_7_params")); builder .getSchemaSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_7_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_7_params")); builder .listSchemasSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_7_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_7_params")); + + builder + .listSchemaRevisionsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_7_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_7_params")); + + builder + .commitSchemaSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_7_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_7_params")); + + builder + .rollbackSchemaSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_7_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_7_params")); + + builder + .deleteSchemaRevisionSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_7_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_7_params")); builder .deleteSchemaSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_7_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_7_params")); + + builder + .validateSchemaSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_7_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_7_params")); + + builder + .validateMessageSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_7_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_7_params")); + + builder + .setIamPolicySettings() .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); builder - .validateSchemaSettings() + .getIamPolicySettings() .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); builder - .validateMessageSettings() + .testIamPermissionsSettings() .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); return builder; } - protected Builder(SchemaServiceStubSettings settings) { - super(settings); - - createSchemaSettings = settings.createSchemaSettings.toBuilder(); - getSchemaSettings = settings.getSchemaSettings.toBuilder(); - listSchemasSettings = settings.listSchemasSettings.toBuilder(); - deleteSchemaSettings = settings.deleteSchemaSettings.toBuilder(); - validateSchemaSettings = settings.validateSchemaSettings.toBuilder(); - validateMessageSettings = settings.validateMessageSettings.toBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of( - createSchemaSettings, - getSchemaSettings, - listSchemasSettings, - deleteSchemaSettings, - validateSchemaSettings, - validateMessageSettings); - } - - // NEXT_MAJOR_VER: remove 'throws Exception' /** * Applies the given settings updater function to all of the unary API methods in this service. * *

Note: This method does not support applying settings to streaming methods. */ public Builder applyToAllUnaryMethods( - ApiFunction, Void> settingsUpdater) throws Exception { + ApiFunction, Void> settingsUpdater) { super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); return this; } @@ -536,6 +730,31 @@ public UnaryCallSettings.Builder getSchemaSettings() { return listSchemasSettings; } + /** Returns the builder for the settings used for calls to listSchemaRevisions. */ + public PagedCallSettings.Builder< + ListSchemaRevisionsRequest, + ListSchemaRevisionsResponse, + ListSchemaRevisionsPagedResponse> + listSchemaRevisionsSettings() { + return listSchemaRevisionsSettings; + } + + /** Returns the builder for the settings used for calls to commitSchema. */ + public UnaryCallSettings.Builder commitSchemaSettings() { + return commitSchemaSettings; + } + + /** Returns the builder for the settings used for calls to rollbackSchema. */ + public UnaryCallSettings.Builder rollbackSchemaSettings() { + return rollbackSchemaSettings; + } + + /** Returns the builder for the settings used for calls to deleteSchemaRevision. */ + public UnaryCallSettings.Builder + deleteSchemaRevisionSettings() { + return deleteSchemaRevisionSettings; + } + /** Returns the builder for the settings used for calls to deleteSchema. */ public UnaryCallSettings.Builder deleteSchemaSettings() { return deleteSchemaSettings; @@ -553,6 +772,22 @@ public UnaryCallSettings.Builder deleteSchemaSetting return validateMessageSettings; } + /** Returns the builder for the settings used for calls to setIamPolicy. */ + public UnaryCallSettings.Builder setIamPolicySettings() { + return setIamPolicySettings; + } + + /** Returns the builder for the settings used for calls to getIamPolicy. */ + public UnaryCallSettings.Builder getIamPolicySettings() { + return getIamPolicySettings; + } + + /** Returns the builder for the settings used for calls to testIamPermissions. */ + public UnaryCallSettings.Builder + testIamPermissionsSettings() { + return testIamPermissionsSettings; + } + @Override public SchemaServiceStubSettings build() throws IOException { return new SchemaServiceStubSettings(this); diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/SubscriberStub.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/SubscriberStub.java index da19f2a6f..115a2f2c8 100644 --- a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/SubscriberStub.java +++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/SubscriberStub.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 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 + * 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, @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.pubsub.v1.stub; import static com.google.cloud.pubsub.v1.SubscriptionAdminClient.ListSnapshotsPagedResponse; import static com.google.cloud.pubsub.v1.SubscriptionAdminClient.ListSubscriptionsPagedResponse; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.rpc.BidiStreamingCallable; import com.google.api.gax.rpc.UnaryCallable; @@ -52,14 +52,13 @@ import com.google.pubsub.v1.UpdateSubscriptionRequest; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * Base stub class for Cloud Pub/Sub API. + * Base stub class for the Subscriber service API. * *

This class is for advanced usage and reflects the underlying API directly. */ -@Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +@Generated("by gapic-generator-java") public abstract class SubscriberStub implements BackgroundResource { public UnaryCallable createSubscriptionCallable() { @@ -88,10 +87,6 @@ public UnaryCallable deleteSubscriptionCallabl throw new UnsupportedOperationException("Not implemented: deleteSubscriptionCallable()"); } - public UnaryCallable getSnapshotCallable() { - throw new UnsupportedOperationException("Not implemented: getSnapshotCallable()"); - } - public UnaryCallable modifyAckDeadlineCallable() { throw new UnsupportedOperationException("Not implemented: modifyAckDeadlineCallable()"); } @@ -113,6 +108,10 @@ public UnaryCallable modifyPushConfigCallable() throw new UnsupportedOperationException("Not implemented: modifyPushConfigCallable()"); } + public UnaryCallable getSnapshotCallable() { + throw new UnsupportedOperationException("Not implemented: getSnapshotCallable()"); + } + public UnaryCallable listSnapshotsPagedCallable() { throw new UnsupportedOperationException("Not implemented: listSnapshotsPagedCallable()"); diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/SubscriberStubSettings.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/SubscriberStubSettings.java index d061959f1..5f03d7b03 100644 --- a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/SubscriberStubSettings.java +++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/SubscriberStubSettings.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.pubsub.v1.stub; import static com.google.cloud.pubsub.v1.SubscriptionAdminClient.ListSnapshotsPagedResponse; @@ -21,16 +22,21 @@ import com.google.api.core.ApiFunction; import com.google.api.core.ApiFuture; import com.google.api.core.BetaApi; +import com.google.api.core.ObsoleteApi; import com.google.api.gax.core.GaxProperties; import com.google.api.gax.core.GoogleCredentialsProvider; import com.google.api.gax.core.InstantiatingExecutorProvider; import com.google.api.gax.grpc.GaxGrpcProperties; import com.google.api.gax.grpc.GrpcTransportChannel; import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; import com.google.api.gax.retrying.RetrySettings; import com.google.api.gax.rpc.ApiCallContext; import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.LibraryMetadata; import com.google.api.gax.rpc.PageContext; import com.google.api.gax.rpc.PagedCallSettings; import com.google.api.gax.rpc.PagedListDescriptor; @@ -74,11 +80,11 @@ import com.google.pubsub.v1.UpdateSnapshotRequest; import com.google.pubsub.v1.UpdateSubscriptionRequest; import java.io.IOException; +import java.time.Duration; import java.util.List; import javax.annotation.Generated; -import org.threeten.bp.Duration; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link SubscriberStub}. * @@ -93,23 +99,43 @@ *

The builder of this class is recursive, so contained classes are themselves builders. When * build() is called, the tree of builders is called to create the complete settings object. * - *

For example, to set the total timeout of createSubscription to 30 seconds: + *

For example, to set the + * [RetrySettings](https://cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.retrying.RetrySettings) + * of createSubscription: * - *

- * 
+ * 
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
  * SubscriberStubSettings.Builder subscriptionAdminSettingsBuilder =
  *     SubscriberStubSettings.newBuilder();
  * subscriptionAdminSettingsBuilder
  *     .createSubscriptionSettings()
  *     .setRetrySettings(
- *         subscriptionAdminSettingsBuilder.createSubscriptionSettings().getRetrySettings().toBuilder()
- *             .setTotalTimeout(Duration.ofSeconds(30))
+ *         subscriptionAdminSettingsBuilder
+ *             .createSubscriptionSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
+ *             .setInitialRetryDelayDuration(Duration.ofSeconds(1))
+ *             .setInitialRpcTimeoutDuration(Duration.ofSeconds(5))
+ *             .setMaxAttempts(5)
+ *             .setMaxRetryDelayDuration(Duration.ofSeconds(30))
+ *             .setMaxRpcTimeoutDuration(Duration.ofSeconds(60))
+ *             .setRetryDelayMultiplier(1.3)
+ *             .setRpcTimeoutMultiplier(1.5)
+ *             .setTotalTimeoutDuration(Duration.ofSeconds(300))
  *             .build());
  * SubscriberStubSettings subscriptionAdminSettings = subscriptionAdminSettingsBuilder.build();
- * 
- * 
+ * }
+ * + * Please refer to the [Client Side Retry + * Guide](https://docs.cloud.google.com/java/docs/client-retries) for additional support in setting + * retries. */ -@Generated("by gapic-generator") +@Generated("by gapic-generator-java") +@SuppressWarnings("CanonicalDuration") public class SubscriberStubSettings extends StubSettings { /** The default scopes of the service. */ private static final ImmutableList DEFAULT_SERVICE_SCOPES = @@ -126,13 +152,13 @@ public class SubscriberStubSettings extends StubSettings ListSubscriptionsRequest, ListSubscriptionsResponse, ListSubscriptionsPagedResponse> listSubscriptionsSettings; private final UnaryCallSettings deleteSubscriptionSettings; - private final UnaryCallSettings getSnapshotSettings; private final UnaryCallSettings modifyAckDeadlineSettings; private final UnaryCallSettings acknowledgeSettings; private final UnaryCallSettings pullSettings; private final StreamingCallSettings streamingPullSettings; private final UnaryCallSettings modifyPushConfigSettings; + private final UnaryCallSettings getSnapshotSettings; private final PagedCallSettings< ListSnapshotsRequest, ListSnapshotsResponse, ListSnapshotsPagedResponse> listSnapshotsSettings; @@ -145,6 +171,116 @@ public class SubscriberStubSettings extends StubSettings private final UnaryCallSettings testIamPermissionsSettings; + private static final PagedListDescriptor< + ListSubscriptionsRequest, ListSubscriptionsResponse, Subscription> + LIST_SUBSCRIPTIONS_PAGE_STR_DESC = + new PagedListDescriptor< + ListSubscriptionsRequest, ListSubscriptionsResponse, Subscription>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListSubscriptionsRequest injectToken( + ListSubscriptionsRequest payload, String token) { + return ListSubscriptionsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListSubscriptionsRequest injectPageSize( + ListSubscriptionsRequest payload, int pageSize) { + return ListSubscriptionsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListSubscriptionsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListSubscriptionsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListSubscriptionsResponse payload) { + return payload.getSubscriptionsList(); + } + }; + + private static final PagedListDescriptor + LIST_SNAPSHOTS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListSnapshotsRequest injectToken(ListSnapshotsRequest payload, String token) { + return ListSnapshotsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListSnapshotsRequest injectPageSize(ListSnapshotsRequest payload, int pageSize) { + return ListSnapshotsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListSnapshotsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListSnapshotsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListSnapshotsResponse payload) { + return payload.getSnapshotsList(); + } + }; + + private static final PagedListResponseFactory< + ListSubscriptionsRequest, ListSubscriptionsResponse, ListSubscriptionsPagedResponse> + LIST_SUBSCRIPTIONS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListSubscriptionsRequest, + ListSubscriptionsResponse, + ListSubscriptionsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListSubscriptionsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext + pageContext = + PageContext.create( + callable, LIST_SUBSCRIPTIONS_PAGE_STR_DESC, request, context); + return ListSubscriptionsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + private static final PagedListResponseFactory< + ListSnapshotsRequest, ListSnapshotsResponse, ListSnapshotsPagedResponse> + LIST_SNAPSHOTS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListSnapshotsRequest, ListSnapshotsResponse, ListSnapshotsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListSnapshotsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_SNAPSHOTS_PAGE_STR_DESC, request, context); + return ListSnapshotsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + /** Returns the object with the settings used for calls to createSubscription. */ public UnaryCallSettings createSubscriptionSettings() { return createSubscriptionSettings; @@ -172,11 +308,6 @@ public UnaryCallSettings deleteSubscriptionSet return deleteSubscriptionSettings; } - /** Returns the object with the settings used for calls to getSnapshot. */ - public UnaryCallSettings getSnapshotSettings() { - return getSnapshotSettings; - } - /** Returns the object with the settings used for calls to modifyAckDeadline. */ public UnaryCallSettings modifyAckDeadlineSettings() { return modifyAckDeadlineSettings; @@ -203,6 +334,11 @@ public UnaryCallSettings modifyPushConfigSetting return modifyPushConfigSettings; } + /** Returns the object with the settings used for calls to getSnapshot. */ + public UnaryCallSettings getSnapshotSettings() { + return getSnapshotSettings; + } + /** Returns the object with the settings used for calls to listSnapshots. */ public PagedCallSettings listSnapshotsSettings() { @@ -245,16 +381,26 @@ public UnaryCallSettings getIamPolicySettings() { return testIamPermissionsSettings; } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public SubscriberStub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcSubscriberStub.create(this); - } else { - throw new UnsupportedOperationException( - "Transport not supported: " + getTransportChannelProvider().getTransportName()); } + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonSubscriberStub.create(this); + } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); + } + + /** Returns the default service name. */ + @Override + public String getServiceName() { + return "pubsub"; } /** Returns a builder for the default ExecutorProvider for this service. */ @@ -263,10 +409,16 @@ public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuild } /** Returns the default service endpoint. */ + @ObsoleteApi("Use getEndpoint() instead") public static String getDefaultEndpoint() { return "pubsub.googleapis.com:443"; } + /** Returns the default mTLS service endpoint. */ + public static String getDefaultMtlsEndpoint() { + return "pubsub.mtls.googleapis.com:443"; + } + /** Returns the default service scopes. */ public static List getDefaultServiceScopes() { return DEFAULT_SERVICE_SCOPES; @@ -274,20 +426,28 @@ public static List getDefaultServiceScopes() { /** Returns a builder for the default credentials for this service. */ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { - return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + return GoogleCredentialsProvider.newBuilder() + .setScopesToApply(DEFAULT_SERVICE_SCOPES) + .setUseJwtAccessWithScope(true); } - /** Returns a builder for the default ChannelProvider for this service. */ + /** Returns a builder for the default gRPC ChannelProvider for this service. */ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { return InstantiatingGrpcChannelProvider.newBuilder().setMaxInboundMessageSize(20 << 20); } + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + public static TransportChannelProvider defaultTransportChannelProvider() { return defaultGrpcTransportProviderBuilder().build(); } - @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") - public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + public static ApiClientHeaderProvider.Builder defaultGrpcApiClientHeaderProviderBuilder() { return ApiClientHeaderProvider.newBuilder() .setGeneratedLibToken( "gapic", GaxProperties.getLibraryVersion(SubscriberStubSettings.class)) @@ -295,11 +455,29 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); } - /** Returns a new builder for this class. */ + public static ApiClientHeaderProvider.Builder defaultHttpJsonApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(SubscriberStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return SubscriberStubSettings.defaultGrpcApiClientHeaderProviderBuilder(); + } + + /** Returns a new gRPC builder for this class. */ public static Builder newBuilder() { return Builder.createDefault(); } + /** Returns a new REST builder for this class. */ + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + /** Returns a new builder for this class. */ public static Builder newBuilder(ClientContext clientContext) { return new Builder(clientContext); @@ -318,12 +496,12 @@ protected SubscriberStubSettings(Builder settingsBuilder) throws IOException { updateSubscriptionSettings = settingsBuilder.updateSubscriptionSettings().build(); listSubscriptionsSettings = settingsBuilder.listSubscriptionsSettings().build(); deleteSubscriptionSettings = settingsBuilder.deleteSubscriptionSettings().build(); - getSnapshotSettings = settingsBuilder.getSnapshotSettings().build(); modifyAckDeadlineSettings = settingsBuilder.modifyAckDeadlineSettings().build(); acknowledgeSettings = settingsBuilder.acknowledgeSettings().build(); pullSettings = settingsBuilder.pullSettings().build(); streamingPullSettings = settingsBuilder.streamingPullSettings().build(); modifyPushConfigSettings = settingsBuilder.modifyPushConfigSettings().build(); + getSnapshotSettings = settingsBuilder.getSnapshotSettings().build(); listSnapshotsSettings = settingsBuilder.listSnapshotsSettings().build(); createSnapshotSettings = settingsBuilder.createSnapshotSettings().build(); updateSnapshotSettings = settingsBuilder.updateSnapshotSettings().build(); @@ -334,124 +512,18 @@ protected SubscriberStubSettings(Builder settingsBuilder) throws IOException { testIamPermissionsSettings = settingsBuilder.testIamPermissionsSettings().build(); } - private static final PagedListDescriptor< - ListSubscriptionsRequest, ListSubscriptionsResponse, Subscription> - LIST_SUBSCRIPTIONS_PAGE_STR_DESC = - new PagedListDescriptor< - ListSubscriptionsRequest, ListSubscriptionsResponse, Subscription>() { - @Override - public String emptyToken() { - return ""; - } - - @Override - public ListSubscriptionsRequest injectToken( - ListSubscriptionsRequest payload, String token) { - return ListSubscriptionsRequest.newBuilder(payload).setPageToken(token).build(); - } - - @Override - public ListSubscriptionsRequest injectPageSize( - ListSubscriptionsRequest payload, int pageSize) { - return ListSubscriptionsRequest.newBuilder(payload).setPageSize(pageSize).build(); - } - - @Override - public Integer extractPageSize(ListSubscriptionsRequest payload) { - return payload.getPageSize(); - } - - @Override - public String extractNextToken(ListSubscriptionsResponse payload) { - return payload.getNextPageToken(); - } - - @Override - public Iterable extractResources(ListSubscriptionsResponse payload) { - return payload.getSubscriptionsList() != null - ? payload.getSubscriptionsList() - : ImmutableList.of(); - } - }; - - private static final PagedListDescriptor - LIST_SNAPSHOTS_PAGE_STR_DESC = - new PagedListDescriptor() { - @Override - public String emptyToken() { - return ""; - } - - @Override - public ListSnapshotsRequest injectToken(ListSnapshotsRequest payload, String token) { - return ListSnapshotsRequest.newBuilder(payload).setPageToken(token).build(); - } - - @Override - public ListSnapshotsRequest injectPageSize(ListSnapshotsRequest payload, int pageSize) { - return ListSnapshotsRequest.newBuilder(payload).setPageSize(pageSize).build(); - } - - @Override - public Integer extractPageSize(ListSnapshotsRequest payload) { - return payload.getPageSize(); - } - - @Override - public String extractNextToken(ListSnapshotsResponse payload) { - return payload.getNextPageToken(); - } - - @Override - public Iterable extractResources(ListSnapshotsResponse payload) { - return payload.getSnapshotsList() != null - ? payload.getSnapshotsList() - : ImmutableList.of(); - } - }; - - private static final PagedListResponseFactory< - ListSubscriptionsRequest, ListSubscriptionsResponse, ListSubscriptionsPagedResponse> - LIST_SUBSCRIPTIONS_PAGE_STR_FACT = - new PagedListResponseFactory< - ListSubscriptionsRequest, - ListSubscriptionsResponse, - ListSubscriptionsPagedResponse>() { - @Override - public ApiFuture getFuturePagedResponse( - UnaryCallable callable, - ListSubscriptionsRequest request, - ApiCallContext context, - ApiFuture futureResponse) { - PageContext - pageContext = - PageContext.create( - callable, LIST_SUBSCRIPTIONS_PAGE_STR_DESC, request, context); - return ListSubscriptionsPagedResponse.createAsync(pageContext, futureResponse); - } - }; - - private static final PagedListResponseFactory< - ListSnapshotsRequest, ListSnapshotsResponse, ListSnapshotsPagedResponse> - LIST_SNAPSHOTS_PAGE_STR_FACT = - new PagedListResponseFactory< - ListSnapshotsRequest, ListSnapshotsResponse, ListSnapshotsPagedResponse>() { - @Override - public ApiFuture getFuturePagedResponse( - UnaryCallable callable, - ListSnapshotsRequest request, - ApiCallContext context, - ApiFuture futureResponse) { - PageContext pageContext = - PageContext.create(callable, LIST_SNAPSHOTS_PAGE_STR_DESC, request, context); - return ListSnapshotsPagedResponse.createAsync(pageContext, futureResponse); - } - }; + @Override + protected LibraryMetadata getLibraryMetadata() { + return LibraryMetadata.newBuilder() + .setArtifactName("com.google.cloud:google-cloud-pubsub") + .setRepository("googleapis/java-pubsub") + .setVersion(Version.VERSION) + .build(); + } /** Builder for SubscriberStubSettings. */ public static class Builder extends StubSettings.Builder { private final ImmutableList> unaryMethodSettingsBuilders; - private final UnaryCallSettings.Builder createSubscriptionSettings; private final UnaryCallSettings.Builder getSubscriptionSettings; @@ -462,7 +534,6 @@ public static class Builder extends StubSettings.Builder deleteSubscriptionSettings; - private final UnaryCallSettings.Builder getSnapshotSettings; private final UnaryCallSettings.Builder modifyAckDeadlineSettings; private final UnaryCallSettings.Builder acknowledgeSettings; @@ -471,6 +542,7 @@ public static class Builder extends StubSettings.Builder modifyPushConfigSettings; + private final UnaryCallSettings.Builder getSnapshotSettings; private final PagedCallSettings.Builder< ListSnapshotsRequest, ListSnapshotsResponse, ListSnapshotsPagedResponse> listSnapshotsSettings; @@ -482,7 +554,6 @@ public static class Builder extends StubSettings.Builder getIamPolicySettings; private final UnaryCallSettings.Builder testIamPermissionsSettings; - private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -490,23 +561,30 @@ public static class Builder extends StubSettings.Builder> definitions = ImmutableMap.builder(); definitions.put( - "retry_policy_4_codes", + "retry_policy_5_codes", ImmutableSet.copyOf( Lists.newArrayList( - StatusCode.Code.DEADLINE_EXCEEDED, - StatusCode.Code.RESOURCE_EXHAUSTED, - StatusCode.Code.ABORTED, - StatusCode.Code.INTERNAL, - StatusCode.Code.UNAVAILABLE))); + StatusCode.Code.UNKNOWN, StatusCode.Code.ABORTED, StatusCode.Code.UNAVAILABLE))); definitions.put( "retry_policy_6_codes", ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); - definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); definitions.put( - "retry_policy_5_codes", + "retry_policy_4_codes", ImmutableSet.copyOf( Lists.newArrayList( - StatusCode.Code.UNKNOWN, StatusCode.Code.ABORTED, StatusCode.Code.UNAVAILABLE))); + StatusCode.Code.UNKNOWN, + StatusCode.Code.ABORTED, + StatusCode.Code.UNAVAILABLE, + StatusCode.Code.INTERNAL))); + definitions.put( + "retry_policy_3_codes", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, + StatusCode.Code.RESOURCE_EXHAUSTED, + StatusCode.Code.ABORTED, + StatusCode.Code.INTERNAL, + StatusCode.Code.UNAVAILABLE))); RETRYABLE_CODE_DEFINITIONS = definitions.build(); } @@ -517,85 +595,76 @@ public static class Builder extends StubSettings.Builder>of( + createSubscriptionSettings, + getSubscriptionSettings, + updateSubscriptionSettings, + listSubscriptionsSettings, + deleteSubscriptionSettings, + modifyAckDeadlineSettings, + acknowledgeSettings, + pullSettings, + modifyPushConfigSettings, + getSnapshotSettings, + listSnapshotsSettings, + createSnapshotSettings, + updateSnapshotSettings, + deleteSnapshotSettings, + seekSettings, + setIamPolicySettings, + getIamPolicySettings, + testIamPermissionsSettings); + } + private static Builder createDefault() { - Builder builder = new Builder((ClientContext) null); + Builder builder = new Builder(((ClientContext) null)); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); - builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); + return initDefaults(builder); } - private static Builder initDefaults(Builder builder) { + private static Builder createHttpJsonDefault() { + Builder builder = new Builder(((ClientContext) null)); + builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); + + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { builder .createSubscriptionSettings() .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_5_codes")) @@ -658,11 +785,6 @@ private static Builder initDefaults(Builder builder) { .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_6_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_6_params")); - builder - .getSnapshotSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_5_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_5_params")); - builder .modifyAckDeadlineSettings() .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_6_codes")) @@ -675,14 +797,19 @@ private static Builder initDefaults(Builder builder) { builder .pullSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_5_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_5_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_4_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_4_params")); builder .modifyPushConfigSettings() .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_6_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_6_params")); + builder + .getSnapshotSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_5_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_5_params")); + builder .listSnapshotsSettings() .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_5_codes")) @@ -726,59 +853,13 @@ private static Builder initDefaults(Builder builder) { return builder; } - protected Builder(SubscriberStubSettings settings) { - super(settings); - - createSubscriptionSettings = settings.createSubscriptionSettings.toBuilder(); - getSubscriptionSettings = settings.getSubscriptionSettings.toBuilder(); - updateSubscriptionSettings = settings.updateSubscriptionSettings.toBuilder(); - listSubscriptionsSettings = settings.listSubscriptionsSettings.toBuilder(); - deleteSubscriptionSettings = settings.deleteSubscriptionSettings.toBuilder(); - getSnapshotSettings = settings.getSnapshotSettings.toBuilder(); - modifyAckDeadlineSettings = settings.modifyAckDeadlineSettings.toBuilder(); - acknowledgeSettings = settings.acknowledgeSettings.toBuilder(); - pullSettings = settings.pullSettings.toBuilder(); - streamingPullSettings = settings.streamingPullSettings.toBuilder(); - modifyPushConfigSettings = settings.modifyPushConfigSettings.toBuilder(); - listSnapshotsSettings = settings.listSnapshotsSettings.toBuilder(); - createSnapshotSettings = settings.createSnapshotSettings.toBuilder(); - updateSnapshotSettings = settings.updateSnapshotSettings.toBuilder(); - deleteSnapshotSettings = settings.deleteSnapshotSettings.toBuilder(); - seekSettings = settings.seekSettings.toBuilder(); - setIamPolicySettings = settings.setIamPolicySettings.toBuilder(); - getIamPolicySettings = settings.getIamPolicySettings.toBuilder(); - testIamPermissionsSettings = settings.testIamPermissionsSettings.toBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of( - createSubscriptionSettings, - getSubscriptionSettings, - updateSubscriptionSettings, - listSubscriptionsSettings, - deleteSubscriptionSettings, - getSnapshotSettings, - modifyAckDeadlineSettings, - acknowledgeSettings, - pullSettings, - modifyPushConfigSettings, - listSnapshotsSettings, - createSnapshotSettings, - updateSnapshotSettings, - deleteSnapshotSettings, - seekSettings, - setIamPolicySettings, - getIamPolicySettings, - testIamPermissionsSettings); - } - - // NEXT_MAJOR_VER: remove 'throws Exception' /** * Applies the given settings updater function to all of the unary API methods in this service. * *

Note: This method does not support applying settings to streaming methods. */ public Builder applyToAllUnaryMethods( - ApiFunction, Void> settingsUpdater) throws Exception { + ApiFunction, Void> settingsUpdater) { super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); return this; } @@ -817,11 +898,6 @@ public UnaryCallSettings.Builder createSubscriptionS return deleteSubscriptionSettings; } - /** Returns the builder for the settings used for calls to getSnapshot. */ - public UnaryCallSettings.Builder getSnapshotSettings() { - return getSnapshotSettings; - } - /** Returns the builder for the settings used for calls to modifyAckDeadline. */ public UnaryCallSettings.Builder modifyAckDeadlineSettings() { return modifyAckDeadlineSettings; @@ -848,6 +924,11 @@ public UnaryCallSettings.Builder modifyPushConfi return modifyPushConfigSettings; } + /** Returns the builder for the settings used for calls to getSnapshot. */ + public UnaryCallSettings.Builder getSnapshotSettings() { + return getSnapshotSettings; + } + /** Returns the builder for the settings used for calls to listSnapshots. */ public PagedCallSettings.Builder< ListSnapshotsRequest, ListSnapshotsResponse, ListSnapshotsPagedResponse> diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/Version.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/Version.java new file mode 100644 index 000000000..362fa0f69 --- /dev/null +++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/Version.java @@ -0,0 +1,27 @@ +/* + * Copyright 2026 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.stub; + +import com.google.api.core.InternalApi; + +@InternalApi("For internal use only") +final class Version { + // {x-version-update-start:google-cloud-pubsub:current} + static final String VERSION = "1.150.1"; + // {x-version-update-end} + +} diff --git a/google-cloud-pubsub/src/main/resources/META-INF/native-image/com.google.cloud.pubsub.v1/reflect-config.json b/google-cloud-pubsub/src/main/resources/META-INF/native-image/com.google.cloud.pubsub.v1/reflect-config.json new file mode 100644 index 000000000..6b9ffc328 --- /dev/null +++ b/google-cloud-pubsub/src/main/resources/META-INF/native-image/com.google.cloud.pubsub.v1/reflect-config.json @@ -0,0 +1,3503 @@ +[ + { + "name": "com.google.api.BatchingConfigProto", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.BatchingConfigProto$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.BatchingDescriptorProto", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.BatchingDescriptorProto$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.BatchingSettingsProto", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.BatchingSettingsProto$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.ClientLibraryDestination", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.ClientLibraryOrganization", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.ClientLibrarySettings", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.ClientLibrarySettings$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.CommonLanguageSettings", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.CommonLanguageSettings$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.CppSettings", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.CppSettings$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.CustomHttpPattern", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.CustomHttpPattern$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.DotnetSettings", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.DotnetSettings$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.FieldBehavior", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.FlowControlLimitExceededBehaviorProto", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.GoSettings", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.GoSettings$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.Http", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.Http$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.HttpRule", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.HttpRule$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.JavaSettings", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.JavaSettings$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.LaunchStage", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.MethodSettings", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.MethodSettings$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.MethodSettings$LongRunning", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.MethodSettings$LongRunning$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.NodeSettings", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.NodeSettings$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.PhpSettings", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.PhpSettings$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.Publishing", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.Publishing$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.PythonSettings", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.PythonSettings$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.PythonSettings$ExperimentalFeatures", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.PythonSettings$ExperimentalFeatures$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.ResourceDescriptor", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.ResourceDescriptor$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.ResourceDescriptor$History", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.ResourceDescriptor$Style", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.ResourceReference", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.ResourceReference$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.RubySettings", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.RubySettings$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.SelectiveGapicGeneration", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.SelectiveGapicGeneration$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.AuditConfig", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.AuditConfig$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.AuditConfigDelta", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.AuditConfigDelta$Action", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.AuditConfigDelta$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.AuditLogConfig", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.AuditLogConfig$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.AuditLogConfig$LogType", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.Binding", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.Binding$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.BindingDelta", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.BindingDelta$Action", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.BindingDelta$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.GetIamPolicyRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.GetIamPolicyRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.GetPolicyOptions", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.GetPolicyOptions$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.Policy", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.Policy$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.PolicyDelta", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.PolicyDelta$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.SetIamPolicyRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.SetIamPolicyRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.TestIamPermissionsRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.TestIamPermissionsRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.TestIamPermissionsResponse", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.TestIamPermissionsResponse$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$DescriptorProto", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$DescriptorProto$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$DescriptorProto$ExtensionRange", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$DescriptorProto$ExtensionRange$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$DescriptorProto$ReservedRange", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$DescriptorProto$ReservedRange$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$Edition", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$EnumDescriptorProto", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$EnumDescriptorProto$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$EnumDescriptorProto$EnumReservedRange", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$EnumDescriptorProto$EnumReservedRange$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$EnumOptions", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$EnumOptions$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$EnumValueDescriptorProto", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$EnumValueDescriptorProto$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$EnumValueOptions", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$EnumValueOptions$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$ExtensionRangeOptions", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$ExtensionRangeOptions$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$ExtensionRangeOptions$Declaration", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$ExtensionRangeOptions$Declaration$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$ExtensionRangeOptions$VerificationState", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$FeatureSet", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$FeatureSet$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$FeatureSet$EnforceNamingStyle", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$FeatureSet$EnumType", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$FeatureSet$FieldPresence", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$FeatureSet$JsonFormat", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$FeatureSet$MessageEncoding", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$FeatureSet$RepeatedFieldEncoding", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$FeatureSet$Utf8Validation", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$FeatureSet$VisibilityFeature", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$FeatureSet$VisibilityFeature$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$FeatureSet$VisibilityFeature$DefaultSymbolVisibility", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$FeatureSetDefaults", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$FeatureSetDefaults$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$FeatureSetDefaults$FeatureSetEditionDefault", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$FeatureSetDefaults$FeatureSetEditionDefault$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$FieldDescriptorProto", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$FieldDescriptorProto$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$FieldDescriptorProto$Label", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$FieldDescriptorProto$Type", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$FieldOptions", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$FieldOptions$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$FieldOptions$CType", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$FieldOptions$EditionDefault", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$FieldOptions$EditionDefault$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$FieldOptions$FeatureSupport", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$FieldOptions$FeatureSupport$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$FieldOptions$JSType", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$FieldOptions$OptionRetention", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$FieldOptions$OptionTargetType", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$FileDescriptorProto", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$FileDescriptorProto$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$FileDescriptorSet", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$FileDescriptorSet$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$FileOptions", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$FileOptions$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$FileOptions$OptimizeMode", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$GeneratedCodeInfo", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$GeneratedCodeInfo$Annotation", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$GeneratedCodeInfo$Annotation$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$GeneratedCodeInfo$Annotation$Semantic", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$GeneratedCodeInfo$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$MessageOptions", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$MessageOptions$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$MethodDescriptorProto", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$MethodDescriptorProto$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$MethodOptions", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$MethodOptions$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$MethodOptions$IdempotencyLevel", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$OneofDescriptorProto", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$OneofDescriptorProto$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$OneofOptions", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$OneofOptions$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$ServiceDescriptorProto", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$ServiceDescriptorProto$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$ServiceOptions", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$ServiceOptions$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$SourceCodeInfo", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$SourceCodeInfo$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$SourceCodeInfo$Location", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$SourceCodeInfo$Location$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$SymbolVisibility", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$UninterpretedOption", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$UninterpretedOption$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$UninterpretedOption$NamePart", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$UninterpretedOption$NamePart$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.Duration", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.Duration$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.Empty", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.Empty$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.FieldMask", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.FieldMask$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.ListValue", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.ListValue$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.NullValue", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.Struct", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.Struct$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.Timestamp", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.Timestamp$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.Value", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.Value$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.AIInference", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.AIInference$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.AIInference$UnstructuredInference", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.AIInference$UnstructuredInference$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.AcknowledgeRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.AcknowledgeRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.BigQueryConfig", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.BigQueryConfig$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.BigQueryConfig$State", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.BigtableConfig", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.BigtableConfig$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.BigtableConfig$State", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.CloudStorageConfig", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.CloudStorageConfig$AvroConfig", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.CloudStorageConfig$AvroConfig$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.CloudStorageConfig$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.CloudStorageConfig$State", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.CloudStorageConfig$TextConfig", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.CloudStorageConfig$TextConfig$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.CommitSchemaRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.CommitSchemaRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.CreateSchemaRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.CreateSchemaRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.CreateSnapshotRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.CreateSnapshotRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.DeadLetterPolicy", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.DeadLetterPolicy$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.DeleteSchemaRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.DeleteSchemaRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.DeleteSchemaRevisionRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.DeleteSchemaRevisionRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.DeleteSnapshotRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.DeleteSnapshotRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.DeleteSubscriptionRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.DeleteSubscriptionRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.DeleteTopicRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.DeleteTopicRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.DetachSubscriptionRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.DetachSubscriptionRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.DetachSubscriptionResponse", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.DetachSubscriptionResponse$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.Encoding", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.ExpirationPolicy", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.ExpirationPolicy$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.GetSchemaRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.GetSchemaRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.GetSnapshotRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.GetSnapshotRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.GetSubscriptionRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.GetSubscriptionRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.GetTopicRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.GetTopicRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.IngestionDataSourceSettings", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.IngestionDataSourceSettings$AwsKinesis", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.IngestionDataSourceSettings$AwsKinesis$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.IngestionDataSourceSettings$AwsKinesis$State", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.IngestionDataSourceSettings$AwsMsk", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.IngestionDataSourceSettings$AwsMsk$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.IngestionDataSourceSettings$AwsMsk$State", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.IngestionDataSourceSettings$AzureEventHubs", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.IngestionDataSourceSettings$AzureEventHubs$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.IngestionDataSourceSettings$AzureEventHubs$State", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.IngestionDataSourceSettings$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.IngestionDataSourceSettings$CloudStorage", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.IngestionDataSourceSettings$CloudStorage$AvroFormat", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.IngestionDataSourceSettings$CloudStorage$AvroFormat$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.IngestionDataSourceSettings$CloudStorage$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.IngestionDataSourceSettings$CloudStorage$PubSubAvroFormat", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.IngestionDataSourceSettings$CloudStorage$PubSubAvroFormat$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.IngestionDataSourceSettings$CloudStorage$State", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.IngestionDataSourceSettings$CloudStorage$TextFormat", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.IngestionDataSourceSettings$CloudStorage$TextFormat$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.IngestionDataSourceSettings$ConfluentCloud", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.IngestionDataSourceSettings$ConfluentCloud$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.IngestionDataSourceSettings$ConfluentCloud$State", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.IngestionFailureEvent", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.IngestionFailureEvent$ApiViolationReason", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.IngestionFailureEvent$ApiViolationReason$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.IngestionFailureEvent$AvroFailureReason", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.IngestionFailureEvent$AvroFailureReason$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.IngestionFailureEvent$AwsKinesisFailureReason", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.IngestionFailureEvent$AwsKinesisFailureReason$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.IngestionFailureEvent$AwsMskFailureReason", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.IngestionFailureEvent$AwsMskFailureReason$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.IngestionFailureEvent$AzureEventHubsFailureReason", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.IngestionFailureEvent$AzureEventHubsFailureReason$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.IngestionFailureEvent$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.IngestionFailureEvent$CloudStorageFailure", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.IngestionFailureEvent$CloudStorageFailure$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.IngestionFailureEvent$ConfluentCloudFailureReason", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.IngestionFailureEvent$ConfluentCloudFailureReason$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.IngestionFailureEvent$MessageTransformationFailureReason", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.IngestionFailureEvent$MessageTransformationFailureReason$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.IngestionFailureEvent$SchemaViolationReason", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.IngestionFailureEvent$SchemaViolationReason$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.JavaScriptUDF", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.JavaScriptUDF$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.ListSchemaRevisionsRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.ListSchemaRevisionsRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.ListSchemaRevisionsResponse", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.ListSchemaRevisionsResponse$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.ListSchemasRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.ListSchemasRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.ListSchemasResponse", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.ListSchemasResponse$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.ListSnapshotsRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.ListSnapshotsRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.ListSnapshotsResponse", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.ListSnapshotsResponse$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.ListSubscriptionsRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.ListSubscriptionsRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.ListSubscriptionsResponse", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.ListSubscriptionsResponse$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.ListTopicSnapshotsRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.ListTopicSnapshotsRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.ListTopicSnapshotsResponse", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.ListTopicSnapshotsResponse$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.ListTopicSubscriptionsRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.ListTopicSubscriptionsRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.ListTopicSubscriptionsResponse", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.ListTopicSubscriptionsResponse$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.ListTopicsRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.ListTopicsRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.ListTopicsResponse", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.ListTopicsResponse$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.MessageStoragePolicy", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.MessageStoragePolicy$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.MessageTransform", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.MessageTransform$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.ModifyAckDeadlineRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.ModifyAckDeadlineRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.ModifyPushConfigRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.ModifyPushConfigRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.PlatformLogsSettings", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.PlatformLogsSettings$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.PlatformLogsSettings$Severity", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.PublishRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.PublishRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.PublishResponse", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.PublishResponse$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.PubsubMessage", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.PubsubMessage$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.PullRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.PullRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.PullResponse", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.PullResponse$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.PushConfig", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.PushConfig$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.PushConfig$NoWrapper", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.PushConfig$NoWrapper$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.PushConfig$OidcToken", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.PushConfig$OidcToken$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.PushConfig$PubsubWrapper", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.PushConfig$PubsubWrapper$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.ReceivedMessage", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.ReceivedMessage$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.RetryPolicy", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.RetryPolicy$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.RollbackSchemaRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.RollbackSchemaRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.Schema", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.Schema$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.Schema$Type", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.SchemaSettings", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.SchemaSettings$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.SchemaView", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.SeekRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.SeekRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.SeekResponse", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.SeekResponse$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.Snapshot", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.Snapshot$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.StreamingPullRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.StreamingPullRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.StreamingPullResponse", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.StreamingPullResponse$AcknowledgeConfirmation", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.StreamingPullResponse$AcknowledgeConfirmation$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.StreamingPullResponse$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.StreamingPullResponse$ModifyAckDeadlineConfirmation", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.StreamingPullResponse$ModifyAckDeadlineConfirmation$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.StreamingPullResponse$SubscriptionProperties", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.StreamingPullResponse$SubscriptionProperties$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.Subscription", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.Subscription$AnalyticsHubSubscriptionInfo", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.Subscription$AnalyticsHubSubscriptionInfo$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.Subscription$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.Subscription$State", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.Topic", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.Topic$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.Topic$State", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.UpdateSnapshotRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.UpdateSnapshotRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.UpdateSubscriptionRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.UpdateSubscriptionRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.UpdateTopicRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.UpdateTopicRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.ValidateMessageRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.ValidateMessageRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.ValidateMessageResponse", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.ValidateMessageResponse$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.ValidateSchemaRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.ValidateSchemaRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.ValidateSchemaResponse", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.pubsub.v1.ValidateSchemaResponse$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.type.Expr", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.type.Expr$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + } +] \ No newline at end of file diff --git a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/it/ITPubSubTest.java b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/it/ITPubSubTest.java index 89900c0e4..290b9927d 100644 --- a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/it/ITPubSubTest.java +++ b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/it/ITPubSubTest.java @@ -17,17 +17,14 @@ package com.google.cloud.pubsub.it; import static com.google.common.truth.Truth.assertThat; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; import static org.junit.Assume.assumeTrue; import com.google.api.gax.rpc.PermissionDeniedException; import com.google.auto.value.AutoValue; import com.google.cloud.ServiceOptions; -import com.google.cloud.pubsub.v1.AckReplyConsumer; -import com.google.cloud.pubsub.v1.MessageReceiver; -import com.google.cloud.pubsub.v1.Publisher; -import com.google.cloud.pubsub.v1.Subscriber; -import com.google.cloud.pubsub.v1.SubscriptionAdminClient; -import com.google.cloud.pubsub.v1.TopicAdminClient; +import com.google.cloud.pubsub.v1.*; import com.google.common.util.concurrent.MoreExecutors; import com.google.iam.v1.Binding; import com.google.iam.v1.GetIamPolicyRequest; @@ -35,22 +32,15 @@ import com.google.iam.v1.SetIamPolicyRequest; import com.google.iam.v1.TestIamPermissionsRequest; import com.google.protobuf.ByteString; -import com.google.pubsub.v1.ProjectSubscriptionName; -import com.google.pubsub.v1.PubsubMessage; -import com.google.pubsub.v1.PushConfig; -import com.google.pubsub.v1.Subscription; -import com.google.pubsub.v1.TopicName; +import com.google.pubsub.v1.*; import java.util.Collections; import java.util.List; import java.util.UUID; import java.util.concurrent.BlockingQueue; +import java.util.concurrent.Future; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.TimeUnit; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Rule; -import org.junit.Test; +import org.junit.*; import org.junit.rules.Timeout; public class ITPubSubTest { @@ -63,6 +53,8 @@ public class ITPubSubTest { System.getenv("GOOGLE_CLOUD_TESTS_IN_VPCSC") != null && System.getenv("GOOGLE_CLOUD_TESTS_IN_VPCSC").equalsIgnoreCase("true"); + private static final int MAX_INBOUND_MESSAGE_SIZE = 20 * 1024 * 1024; + @Rule public Timeout globalTimeout = Timeout.seconds(300); @AutoValue @@ -76,6 +68,19 @@ static MessageAndConsumer create(PubsubMessage message, AckReplyConsumer consume } } + @AutoValue + abstract static class MessageAndConsumerWithResponse { + abstract PubsubMessage message(); + + abstract AckReplyConsumerWithResponse consumerWithResponse(); + + static MessageAndConsumerWithResponse create( + PubsubMessage message, AckReplyConsumerWithResponse consumerWithResponse) { + return new AutoValue_ITPubSubTest_MessageAndConsumerWithResponse( + message, consumerWithResponse); + } + } + @BeforeClass public static void setupClass() throws Exception { topicAdminClient = TopicAdminClient.create(); @@ -94,15 +99,17 @@ private String formatForTest(String resourceName) { } private Subscription getSubscription( - ProjectSubscriptionName subscriptionName, + SubscriptionName subscriptionName, TopicName topicName, PushConfig pushConfig, - int ackDeadline) { + int ackDeadline, + boolean enableExactlyOnceDelivery) { return Subscription.newBuilder() .setName(subscriptionName.toString()) .setTopic(topicName.toString()) .setPushConfig(pushConfig) .setAckDeadlineSeconds(ackDeadline) + .setEnableExactlyOnceDelivery(enableExactlyOnceDelivery) .build(); } @@ -151,9 +158,8 @@ public void testVPCPushSubscriber() { .setProject(projectId) .setTopic(formatForTest("testing-vpc-push-subscriber-topic")) .build(); - ProjectSubscriptionName subscriptionName = - ProjectSubscriptionName.of( - projectId, formatForTest("testing-vpc-push-subscriber-subscription")); + SubscriptionName subscriptionName = + SubscriptionName.of(projectId, formatForTest("testing-vpc-push-subscriber-subscription")); topicAdminClient.createTopic(topicName); try { @@ -162,7 +168,8 @@ public void testVPCPushSubscriber() { subscriptionName, topicName, PushConfig.newBuilder().setPushEndpoint("https://random_point").build(), - 10)); + 10, + false)); subscriptionAdminClient.deleteSubscription(subscriptionName); Assert.fail("No exception raised"); } catch (PermissionDeniedException e) { @@ -179,19 +186,18 @@ public void testPublishSubscribe() throws Exception { .setProject(projectId) .setTopic(formatForTest("testing-publish-subscribe-topic")) .build(); - ProjectSubscriptionName subscriptionName = - ProjectSubscriptionName.of( - projectId, formatForTest("testing-publish-subscribe-subscription")); + SubscriptionName subscriptionName = + SubscriptionName.of(projectId, formatForTest("testing-publish-subscribe-subscription")); topicAdminClient.createTopic(topicName); subscriptionAdminClient.createSubscription( - getSubscription(subscriptionName, topicName, PushConfig.newBuilder().build(), 10)); + getSubscription(subscriptionName, topicName, PushConfig.newBuilder().build(), 10, false)); final BlockingQueue receiveQueue = new LinkedBlockingQueue<>(); Subscriber subscriber = Subscriber.newBuilder( - subscriptionName, + subscriptionName.toString(), new MessageReceiver() { @Override public void receiveMessage( @@ -219,26 +225,265 @@ public void failed(Subscriber.State from, Throwable failure) { publisher.shutdown(); publisher.awaitTermination(1, TimeUnit.MINUTES); + MessageAndConsumer toAck = pollQueueMessageAndConsumer(receiveQueue); // Ack the first message. - MessageAndConsumer toAck = pollQueue(receiveQueue); toAck.consumer().ack(); - // Nack the other. - MessageAndConsumer toNack = pollQueue(receiveQueue); - assertThat(toNack.message().getData()).isNotEqualTo(toAck.message().getData()); + MessageAndConsumer toNack = pollQueueMessageAndConsumer(receiveQueue); + // Because we are not using ordering keys, we have to compare the received messages to each + // other + assertNotEquals(toNack.message().getData(), toAck.message().getData()); + // Nack toNack.consumer().nack(); // We should get the nacked message back. - MessageAndConsumer redelivered = pollQueue(receiveQueue); - assertThat(redelivered.message().getData()).isEqualTo(toNack.message().getData()); - redelivered.consumer().ack(); + MessageAndConsumer redeliveredToAck = pollQueueMessageAndConsumer(receiveQueue); + assertEquals(toNack.message().getData(), redeliveredToAck.message().getData()); + redeliveredToAck.consumer().ack(); subscriber.stopAsync().awaitTerminated(); subscriptionAdminClient.deleteSubscription(subscriptionName); topicAdminClient.deleteTopic(topicName); } - private MessageAndConsumer pollQueue(BlockingQueue queue) throws InterruptedException { + @Test + public void testPublishSubscribeMessageFutures() throws Exception { + TopicName topicName = + TopicName.newBuilder() + .setProject(projectId) + .setTopic(formatForTest("testing-publish-subscribe-message-futures")) + .build(); + SubscriptionName subscriptionName = + SubscriptionName.of(projectId, formatForTest("testing-publish-subscribe-message-futures")); + + topicAdminClient.createTopic(topicName); + subscriptionAdminClient.createSubscription( + getSubscription(subscriptionName, topicName, PushConfig.newBuilder().build(), 10, false)); + + final BlockingQueue receiveQueue = new LinkedBlockingQueue<>(); + Subscriber subscriber = + Subscriber.newBuilder( + subscriptionName.toString(), + new MessageReceiverWithAckResponse() { + @Override + public void receiveMessage( + final PubsubMessage message, + final AckReplyConsumerWithResponse consumerWithResponse) { + receiveQueue.offer( + MessageAndConsumerWithResponse.create(message, consumerWithResponse)); + } + }) + .setChannelProvider( + SubscriptionAdminSettings.defaultGrpcTransportProviderBuilder() + .setMaxInboundMessageSize(MAX_INBOUND_MESSAGE_SIZE) + .build()) + .build(); + subscriber.addListener( + new Subscriber.Listener() { + public void failed(Subscriber.State from, Throwable failure) { + receiveQueue.offer(failure); + } + }, + MoreExecutors.directExecutor()); + subscriber.startAsync(); + + Publisher publisher = Publisher.newBuilder(topicName).build(); + publisher + .publish(PubsubMessage.newBuilder().setData(ByteString.copyFromUtf8("msg1")).build()) + .get(); + publisher + .publish(PubsubMessage.newBuilder().setData(ByteString.copyFromUtf8("msg2")).build()) + .get(); + + publisher.shutdown(); + publisher.awaitTermination(1, TimeUnit.MINUTES); + + // Ack the first message. + MessageAndConsumerWithResponse toAck = pollQueueMessageAndConsumerWithResponse(receiveQueue); + Future ackResponseFuture = toAck.consumerWithResponse().ack(); + assertEquals(AckResponse.SUCCESSFUL, ackResponseFuture.get()); + + MessageAndConsumerWithResponse toNack = pollQueueMessageAndConsumerWithResponse(receiveQueue); + // Because we are not using ordering keys, we have to compare the received messages to each + // other + assertNotEquals(toNack.message().getData(), toAck.message().getData()); + Future nackResponseFuture = toNack.consumerWithResponse().nack(); + assertEquals(AckResponse.SUCCESSFUL, nackResponseFuture.get()); + + MessageAndConsumerWithResponse redeliveredToAck = + pollQueueMessageAndConsumerWithResponse(receiveQueue); + Future redeliveredToAckResponse = redeliveredToAck.consumerWithResponse().ack(); + + assertEquals(toNack.message().getData(), redeliveredToAck.message().getData()); + assertEquals(AckResponse.SUCCESSFUL, redeliveredToAckResponse.get()); + + subscriber.stopAsync().awaitTerminated(); + subscriptionAdminClient.deleteSubscription(subscriptionName); + topicAdminClient.deleteTopic(topicName); + } + + @Test + public void testPublishSubscribeExactlyOnce() throws Exception { + TopicName topicName = + TopicName.newBuilder() + .setProject(projectId) + .setTopic(formatForTest("testing-publish-subscribe-exactly-once-topic")) + .build(); + SubscriptionName subscriptionName = + SubscriptionName.of( + projectId, formatForTest("testing-publish-subscribe-exactly-once-subscription")); + + topicAdminClient.createTopic(topicName); + subscriptionAdminClient.createSubscription( + getSubscription(subscriptionName, topicName, PushConfig.newBuilder().build(), 60, true)); + + final BlockingQueue receiveQueue = new LinkedBlockingQueue<>(); + Subscriber subscriber = + Subscriber.newBuilder( + subscriptionName.toString(), + new MessageReceiverWithAckResponse() { + @Override + public void receiveMessage( + final PubsubMessage message, + final AckReplyConsumerWithResponse consumerWithResponse) { + receiveQueue.offer( + MessageAndConsumerWithResponse.create(message, consumerWithResponse)); + } + }) + .setChannelProvider( + SubscriptionAdminSettings.defaultGrpcTransportProviderBuilder() + .setMaxInboundMessageSize(MAX_INBOUND_MESSAGE_SIZE) + .build()) + .build(); + subscriber.addListener( + new Subscriber.Listener() { + public void failed(Subscriber.State from, Throwable failure) { + receiveQueue.offer(failure); + } + }, + MoreExecutors.directExecutor()); + subscriber.startAsync(); + + Publisher publisher = Publisher.newBuilder(topicName).build(); + publisher + .publish(PubsubMessage.newBuilder().setData(ByteString.copyFromUtf8("msg1")).build()) + .get(); + publisher + .publish(PubsubMessage.newBuilder().setData(ByteString.copyFromUtf8("msg2")).build()) + .get(); + + publisher.shutdown(); + publisher.awaitTermination(1, TimeUnit.MINUTES); + + // Ack the first message. + MessageAndConsumerWithResponse toAck = pollQueueMessageAndConsumerWithResponse(receiveQueue); + Future ackResponseFuture = toAck.consumerWithResponse().ack(); + assertEquals(AckResponse.SUCCESSFUL, ackResponseFuture.get()); + + MessageAndConsumerWithResponse toNack = pollQueueMessageAndConsumerWithResponse(receiveQueue); + // Because we are not using ordering keys, we have to compare the received messages to each + // other + assertNotEquals(toNack.message().getData(), toAck.message().getData()); + Future nackResponseFuture = toNack.consumerWithResponse().nack(); + assertEquals(AckResponse.SUCCESSFUL, nackResponseFuture.get()); + + MessageAndConsumerWithResponse redeliveredToAck = + pollQueueMessageAndConsumerWithResponse(receiveQueue); + Future redeliveredToAckResponse = redeliveredToAck.consumerWithResponse().ack(); + + assertEquals(toNack.message().getData(), redeliveredToAck.message().getData()); + assertEquals(AckResponse.SUCCESSFUL, redeliveredToAckResponse.get()); + + subscriber.stopAsync().awaitTerminated(); + subscriptionAdminClient.deleteSubscription(subscriptionName); + topicAdminClient.deleteTopic(topicName); + } + + @Test + public void testPublishSubscribeWithCompression() throws Exception { + TopicName topicName = + TopicName.newBuilder() + .setProject(projectId) + .setTopic(formatForTest("testing-compression-topic")) + .build(); + SubscriptionName subscriptionName = + SubscriptionName.of(projectId, formatForTest("testing-compression-subscription")); + + topicAdminClient.createTopic(topicName); + + subscriptionAdminClient.createSubscription( + getSubscription(subscriptionName, topicName, PushConfig.newBuilder().build(), 10, false)); + + final BlockingQueue receiveQueue = new LinkedBlockingQueue<>(); + Subscriber subscriber = + Subscriber.newBuilder( + subscriptionName.toString(), + new MessageReceiver() { + @Override + public void receiveMessage( + final PubsubMessage message, final AckReplyConsumer consumer) { + receiveQueue.offer(MessageAndConsumer.create(message, consumer)); + } + }) + .build(); + subscriber.addListener( + new Subscriber.Listener() { + public void failed(Subscriber.State from, Throwable failure) { + receiveQueue.offer(failure); + } + }, + MoreExecutors.directExecutor()); + subscriber.startAsync(); + + Publisher publisher = Publisher.newBuilder(topicName).setEnableCompression(true).build(); + + String msg1 = generateMessage("msg1", 1000); + String msg2 = generateMessage("msg2", 1500); + publisher + .publish(PubsubMessage.newBuilder().setData(ByteString.copyFromUtf8(msg1)).build()) + .get(); + publisher + .publish(PubsubMessage.newBuilder().setData(ByteString.copyFromUtf8(msg2)).build()) + .get(); + publisher.shutdown(); + publisher.awaitTermination(1, TimeUnit.MINUTES); + + // Ack the first message. + MessageAndConsumer toAck1 = pollQueueMessageAndConsumer(receiveQueue); + toAck1.consumer().ack(); + + // Ack the second message. + MessageAndConsumer toAck2 = pollQueueMessageAndConsumer(receiveQueue); + toAck2.consumer().ack(); + + assertNotEquals(toAck1.message().getData(), toAck2.message().getData()); + + subscriber.stopAsync().awaitTerminated(); + subscriptionAdminClient.deleteSubscription(subscriptionName); + topicAdminClient.deleteTopic(topicName); + } + + private MessageAndConsumer pollQueueMessageAndConsumer(BlockingQueue queue) + throws InterruptedException { + Object obj = pollQueue(queue); + if (obj instanceof MessageAndConsumer) { + return (MessageAndConsumer) obj; + } + throw new IllegalStateException( + "expected either MessageAndConsumer or Throwable, found: " + obj); + } + + private MessageAndConsumerWithResponse pollQueueMessageAndConsumerWithResponse( + BlockingQueue queue) throws InterruptedException { + Object obj = pollQueue(queue); + if (obj instanceof MessageAndConsumerWithResponse) { + return (MessageAndConsumerWithResponse) obj; + } + throw new IllegalStateException( + "expected either MessageAndConsumerWithResponse or Throwable, found: " + obj); + } + + private Object pollQueue(BlockingQueue queue) throws InterruptedException { Object obj = queue.poll(10, TimeUnit.MINUTES); if (obj == null) { return null; @@ -246,10 +491,17 @@ private MessageAndConsumer pollQueue(BlockingQueue queue) throws Interru if (obj instanceof Throwable) { throw new IllegalStateException("unexpected error", (Throwable) obj); } - if (obj instanceof MessageAndConsumer) { - return (MessageAndConsumer) obj; + + return obj; + } + + /** Generates message of given bytes by repeatedly concatenating a token. */ + private String generateMessage(String token, int bytes) { + String result = ""; + int tokenBytes = token.length(); + for (int i = 0; i < Math.floor(bytes / tokenBytes) + 1; i++) { + result = result.concat(token); } - throw new IllegalStateException( - "expected either MessageAndConsumer or Throwable, found: " + obj); + return result; } } diff --git a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/CustomArgumentMatchers.java b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/CustomArgumentMatchers.java new file mode 100644 index 000000000..a98e5c4e1 --- /dev/null +++ b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/CustomArgumentMatchers.java @@ -0,0 +1,208 @@ +/* + * Copyright 2022 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 com.google.pubsub.v1.AcknowledgeRequest; +import com.google.pubsub.v1.ModifyAckDeadlineRequest; +import java.util.*; +import org.mockito.ArgumentMatcher; + +/** Shared Custom Argument Matchers for Tests w/ Mock Futures */ +public class CustomArgumentMatchers { + public static class AcknowledgeRequestMatcher implements ArgumentMatcher { + private AcknowledgeRequest left; + + AcknowledgeRequestMatcher(AcknowledgeRequest acknowledgeRequest) { + this.left = acknowledgeRequest; + } + + @Override + public boolean matches(AcknowledgeRequest right) { + Set leftAckIdSet = new HashSet(this.left.getAckIdsList()); + Set rightAckIdSet = new HashSet(right.getAckIdsList()); + return this.left.getSubscription().equals(right.getSubscription()) + && leftAckIdSet.equals(rightAckIdSet); + } + } + + public static class ModifyAckDeadlineRequestMatcher + implements ArgumentMatcher { + private ModifyAckDeadlineRequest left; + + ModifyAckDeadlineRequestMatcher(ModifyAckDeadlineRequest modifyAckDeadlineRequest) { + this.left = modifyAckDeadlineRequest; + } + + @Override + public boolean matches(ModifyAckDeadlineRequest right) { + Set leftAckIdSet = new HashSet(this.left.getAckIdsList()); + Set rightAckIdSet = new HashSet(right.getAckIdsList()); + return this.left.getSubscription().equals(right.getSubscription()) + && this.left.getAckDeadlineSeconds() == right.getAckDeadlineSeconds() + && leftAckIdSet.equals(rightAckIdSet); + } + } + + public static class AckRequestDataMatcher implements ArgumentMatcher { + private AckRequestData left; + + private static Comparator comparator = + new Comparator() { + + @Override + public int compare(AckRequestData ackRequestData, AckRequestData t1) { + return ackRequestData.getAckId().compareTo(t1.getAckId()); + } + }; + + AckRequestDataMatcher(AckRequestData left) { + this.left = left; + } + + @Override + public boolean matches(AckRequestData right) { + return this.left.getAckId() == right.getAckId(); + } + } + + public static class AckRequestDataListMatcher implements ArgumentMatcher> { + private List left; + + AckRequestDataListMatcher(List ackRequestDataList) { + this.left = ackRequestDataList; + } + + @Override + public boolean matches(List right) { + // We only really care about the ackIds, the futures will be mocked + if (this.left.size() != right.size()) { + return false; + } + + // We just want to compare the ackIds not the futures and do not care about order (or + // duplicates) + this.left.sort(AckRequestDataMatcher.comparator); + right.sort(AckRequestDataMatcher.comparator); + + Iterator iteratorLeft = this.left.iterator(); + Iterator iteratorRight = right.iterator(); + + while (iteratorLeft.hasNext() && iteratorRight.hasNext()) { + if (iteratorLeft.next().getAckId() != iteratorRight.next().getAckId()) { + return false; + } + } + return true; + } + } + + public static class ModackRequestDataMatcher implements ArgumentMatcher { + private ModackRequestData left; + + private static Comparator comparator = + new Comparator() { + + @Override + public int compare(ModackRequestData left, ModackRequestData right) { + // Compare deadline extensions first + int deadlineExtensionDifference = + left.getDeadlineExtensionSeconds() - right.getDeadlineExtensionSeconds(); + if (deadlineExtensionDifference != 0) { + return deadlineExtensionDifference; + } + + // Then sort and compare ackIds + List ackRequestDataListLeft = left.getAckRequestData(); + List ackRequestDataListRight = right.getAckRequestData(); + + ackRequestDataListLeft.sort(AckRequestDataMatcher.comparator); + ackRequestDataListRight.sort(AckRequestDataMatcher.comparator); + + Iterator iteratorLeft = ackRequestDataListLeft.iterator(); + Iterator iteratorRight = ackRequestDataListRight.iterator(); + int compareAcks; + + while (iteratorLeft.hasNext() && iteratorRight.hasNext()) { + String ackIdLeft = iteratorLeft.next().getAckId(); + String ackIdRight = iteratorRight.next().getAckId(); + compareAcks = ackIdLeft.compareTo(ackIdRight); + + if (compareAcks != 0) { + return compareAcks; + } + } + + if (iteratorLeft.hasNext()) { + return 1; + } + if (iteratorRight.hasNext()) { + return -1; + } else { + return 0; + } + } + }; + + ModackRequestDataMatcher(ModackRequestData left) { + this.left = left; + } + + @Override + public boolean matches(ModackRequestData right) { + return ModackRequestDataMatcher.comparator.compare(this.left, right) == 0; + } + } + + public static class ModackRequestDataListMatcher + implements ArgumentMatcher> { + private List left; + + ModackRequestDataListMatcher(List modackRequestDataList) { + this.left = modackRequestDataList; + } + + @Override + public boolean matches(List right) { + // First check size + if (this.left.size() != right.size()) { + return false; + } + + // Sort first + this.left.sort(ModackRequestDataMatcher.comparator); + right.sort(ModackRequestDataMatcher.comparator); + + Iterator iteratorLeft = this.left.iterator(); + Iterator iteratorRight = right.iterator(); + + ModackRequestData modackRequestDataLeft; + ModackRequestData modackRequestDataRight; + + while (iteratorLeft.hasNext() && iteratorRight.hasNext()) { + + ModackRequestDataMatcher modackRequestDataMatcher = + new ModackRequestDataMatcher(iteratorLeft.next()); + + if (!modackRequestDataMatcher.matches(iteratorRight.next())) { + return false; + } + } + + return true; + } + } +} diff --git a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/FakePublisherServiceImpl.java b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/FakePublisherServiceImpl.java index 23817f558..9ab1dec73 100644 --- a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/FakePublisherServiceImpl.java +++ b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/FakePublisherServiceImpl.java @@ -21,13 +21,13 @@ import com.google.pubsub.v1.PublishResponse; import com.google.pubsub.v1.PublisherGrpc.PublisherImplBase; import io.grpc.stub.StreamObserver; +import java.time.Duration; import java.util.ArrayList; import java.util.List; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; -import org.threeten.bp.Duration; /** * A fake implementation of {@link PublisherImplBase}, that can be used to test clients of a Cloud diff --git a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/FakeScheduledExecutorService.java b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/FakeScheduledExecutorService.java index e63b68748..b17eaddb0 100644 --- a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/FakeScheduledExecutorService.java +++ b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/FakeScheduledExecutorService.java @@ -16,9 +16,10 @@ package com.google.cloud.pubsub.v1; -import com.google.api.core.ApiClock; import com.google.common.primitives.Ints; import com.google.common.util.concurrent.SettableFuture; +import java.time.Duration; +import java.time.Instant; import java.util.ArrayList; import java.util.Deque; import java.util.LinkedList; @@ -33,8 +34,6 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicBoolean; -import org.threeten.bp.Duration; -import org.threeten.bp.Instant; /** * Fake implementation of {@link ScheduledExecutorService} that allows tests control the reference @@ -48,7 +47,7 @@ public class FakeScheduledExecutorService extends AbstractExecutorService private final FakeClock clock = new FakeClock(); private final Deque expectedWorkQueue = new LinkedList<>(); - public ApiClock getClock() { + public FakeClock getClock() { return clock; } @@ -56,14 +55,14 @@ public ApiClock getClock() { public ScheduledFuture schedule(Runnable command, long delay, TimeUnit unit) { return schedulePendingCallable( new PendingCallable<>( - Duration.ofMillis(unit.toMillis(delay)), command, PendingCallableType.NORMAL)); + Duration.ofMillis(unit.toMillis(delay)), command, null, PendingCallableType.NORMAL)); } @Override public ScheduledFuture schedule(Callable callable, long delay, TimeUnit unit) { return schedulePendingCallable( new PendingCallable<>( - Duration.ofMillis(unit.toMillis(delay)), callable, PendingCallableType.NORMAL)); + Duration.ofMillis(unit.toMillis(delay)), callable, null, PendingCallableType.NORMAL)); } @Override @@ -73,6 +72,7 @@ public ScheduledFuture scheduleAtFixedRate( new PendingCallable<>( Duration.ofMillis(unit.toMillis(initialDelay)), command, + Duration.ofMillis(unit.toMillis(period)), PendingCallableType.FIXED_RATE)); } @@ -83,6 +83,7 @@ public ScheduledFuture scheduleWithFixedDelay( new PendingCallable<>( Duration.ofMillis(unit.toMillis(initialDelay)), command, + Duration.ofMillis(unit.toMillis(delay)), PendingCallableType.FIXED_DELAY)); } @@ -213,13 +214,15 @@ enum PendingCallableType { class PendingCallable implements Comparable> { Instant creationTime = Instant.ofEpochMilli(clock.millisTime()); Duration delay; + Duration period; Callable pendingCallable; SettableFuture future = SettableFuture.create(); AtomicBoolean cancelled = new AtomicBoolean(false); AtomicBoolean done = new AtomicBoolean(false); PendingCallableType type; - PendingCallable(Duration delay, final Runnable runnable, PendingCallableType type) { + PendingCallable( + Duration delay, final Runnable runnable, Duration period, PendingCallableType type) { pendingCallable = new Callable() { @Override @@ -230,12 +233,15 @@ public T call() { }; this.type = type; this.delay = delay; + this.period = period; } - PendingCallable(Duration delay, Callable callable, PendingCallableType type) { + PendingCallable( + Duration delay, Callable callable, Duration period, PendingCallableType type) { pendingCallable = callable; this.type = type; this.delay = delay; + this.period = period; } private Instant getScheduledTime() { @@ -259,6 +265,7 @@ public int compareTo(Delayed o) { @Override public boolean cancel(boolean mayInterruptIfRunning) { synchronized (this) { + future.cancel(mayInterruptIfRunning); cancelled.set(true); return !done.get(); } @@ -305,10 +312,12 @@ T call() { break; case FIXED_DELAY: this.creationTime = Instant.ofEpochMilli(clock.millisTime()); + this.delay = period; schedulePendingCallable(this); break; case FIXED_RATE: this.creationTime = this.creationTime.plus(delay); + this.delay = period; schedulePendingCallable(this); break; default: 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 260071b9b..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; @@ -49,7 +50,7 @@ class FakeSubscriberServiceImpl extends SubscriberImplBase { private final AtomicBoolean subscriptionInitialized = new AtomicBoolean(false); private String subscription = ""; private final AtomicInteger messageAckDeadline = - new AtomicInteger(Subscriber.MIN_ACK_DEADLINE_SECONDS); + new AtomicInteger(Math.toIntExact(Subscriber.STREAM_ACK_DEADLINE_DEFAULT.getSeconds())); private final AtomicInteger getSubscriptionCalled = new AtomicInteger(); private StreamingPullRequest lastSeenRequest; private final List openedStreams = new ArrayList<>(); @@ -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/MessageDataMatcher.java b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MessageDataMatcher.java new file mode 100644 index 000000000..745b18244 --- /dev/null +++ b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MessageDataMatcher.java @@ -0,0 +1,35 @@ +/* + * Copyright 2017 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 com.google.protobuf.ByteString; +import com.google.pubsub.v1.PubsubMessage; +import org.mockito.ArgumentMatcher; + +public class MessageDataMatcher implements ArgumentMatcher { + + private ByteString expectedData; + + public MessageDataMatcher(ByteString expectedData) { + this.expectedData = expectedData; + } + + @Override + public boolean matches(PubsubMessage message2) { + return (expectedData.equals(message2.getData())); + } +} 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 88a015f6e..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 @@ -17,74 +17,97 @@ package com.google.cloud.pubsub.v1; import static com.google.common.truth.Truth.assertThat; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +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.FlowControlSettings; import com.google.api.gax.batching.FlowController; import com.google.api.gax.core.Distribution; -import com.google.auto.value.AutoValue; import com.google.common.util.concurrent.MoreExecutors; import com.google.protobuf.ByteString; import com.google.pubsub.v1.PubsubMessage; import com.google.pubsub.v1.ReceivedMessage; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.concurrent.LinkedBlockingQueue; -import java.util.concurrent.ScheduledThreadPoolExecutor; -import java.util.concurrent.TimeUnit; +import java.time.Duration; +import java.util.*; +import java.util.concurrent.*; import org.junit.Before; import org.junit.Test; -import org.threeten.bp.Duration; +import org.mockito.invocation.InvocationOnMock; +import org.mockito.stubbing.Answer; public class MessageDispatcherTest { + private static final String MOCK_SUBSCRIPTION_NAME = + "projects/MOCK-PROJECT/subscriptions/MOCK-SUBSCRIPTION"; private static final ByteString MESSAGE_DATA = ByteString.copyFromUtf8("message-data"); private static final int DELIVERY_INFO_COUNT = 3; + private static final String ACK_ID = "ACK-ID"; + private static final String ORDERING_KEY = "KEY"; private static final ReceivedMessage TEST_MESSAGE = ReceivedMessage.newBuilder() - .setAckId("ackid") + .setAckId(ACK_ID) .setMessage(PubsubMessage.newBuilder().setData(MESSAGE_DATA).build()) .setDeliveryAttempt(DELIVERY_INFO_COUNT) .build(); - private static final Runnable NOOP_RUNNABLE = - new Runnable() { - @Override - public void run() { - // No-op; don't do anything. - } - }; + private static final ByteString ORDERED_MESSAGE_DATA_1 = ByteString.copyFromUtf8("message-data1"); + private static final ReceivedMessage ORDERED_TEST_MESSAGE_1 = + ReceivedMessage.newBuilder() + .setAckId("ACK-ID-1") + .setMessage( + PubsubMessage.newBuilder() + .setData(ORDERED_MESSAGE_DATA_1) + .setOrderingKey(ORDERING_KEY) + .build()) + .build(); + private static final ByteString ORDERED_MESSAGE_DATA_2 = ByteString.copyFromUtf8("message-data2"); + private static final ReceivedMessage ORDERED_TEST_MESSAGE_2 = + ReceivedMessage.newBuilder() + .setAckId("ACK-ID-2") + .setMessage( + PubsubMessage.newBuilder() + .setData(ORDERED_MESSAGE_DATA_2) + .setOrderingKey(ORDERING_KEY) + .build()) + .build(); private static final int MAX_SECONDS_PER_ACK_EXTENSION = 60; + private static final int MIN_ACK_DEADLINE_SECONDS = 10; + private static final Duration MAX_ACK_EXTENSION_PERIOD = Duration.ofMinutes(60); + private static final Duration ACK_EXPIRATION_PADDING_DEFAULT = + Subscriber.ACK_EXPIRATION_PADDING_DEFAULT; - private MessageDispatcher dispatcher; - private LinkedBlockingQueue consumers; - private List sentAcks; - private List sentModAcks; + private Distribution mockAckLatencyDistribution; + + private MessageDispatcher.AckProcessor mockAckProcessor; private FakeClock clock; - private FlowController flowController; private boolean messageContainsDeliveryAttempt; - @AutoValue - abstract static class ModAckItem { - abstract String ackId(); + private FakeScheduledExecutorService systemExecutor; - abstract int seconds(); + private static MessageReceiver messageReceiver; + private static MessageReceiverWithAckResponse messageReceiverWithAckResponse; - static ModAckItem of(String ackId, int seconds) { - return new AutoValue_MessageDispatcherTest_ModAckItem(ackId, seconds); - } - } + private LinkedBlockingQueue consumers; + private LinkedBlockingQueue consumersWithResponse; @Before public void setUp() { + systemExecutor = new FakeScheduledExecutorService(); + clock = new FakeClock(); + mockAckLatencyDistribution = mock(Distribution.class); + + mockAckProcessor = mock(MessageDispatcher.AckProcessor.class); + messageContainsDeliveryAttempt = true; + consumers = new LinkedBlockingQueue<>(); - sentAcks = new ArrayList<>(); - sentModAcks = new ArrayList<>(); + consumersWithResponse = new LinkedBlockingQueue<>(); - MessageReceiver receiver = + // We are instantiating "real" message receivers to easily ack/nack messages + messageReceiver = new MessageReceiver() { @Override - public void receiveMessage(final PubsubMessage message, final AckReplyConsumer consumer) { + public void receiveMessage( + final PubsubMessage message, final AckReplyConsumer ackReplyConsumer) { assertThat(message.getData()).isEqualTo(MESSAGE_DATA); if (messageContainsDeliveryAttempt) { assertTrue(message.containsAttributes("googclient_deliveryattempt")); @@ -93,159 +116,838 @@ public void receiveMessage(final PubsubMessage message, final AckReplyConsumer c } else { assertFalse(message.containsAttributes("googclient_deliveryattempt")); } - consumers.add(consumer); + consumers.add(ackReplyConsumer); } }; - MessageDispatcher.AckProcessor processor = - new MessageDispatcher.AckProcessor() { - public void sendAckOperations( - List acksToSend, - List ackDeadlineExtensions) { - sentAcks.addAll(acksToSend); - for (MessageDispatcher.PendingModifyAckDeadline modack : ackDeadlineExtensions) { - for (String ackId : modack.ackIds) { - sentModAcks.add(ModAckItem.of(ackId, modack.deadlineExtensionSeconds)); - } + + messageReceiverWithAckResponse = + new MessageReceiverWithAckResponse() { + @Override + public void receiveMessage( + PubsubMessage message, AckReplyConsumerWithResponse ackReplyConsumerWithResponse) { + assertThat(message.getData()).isEqualTo(MESSAGE_DATA); + if (messageContainsDeliveryAttempt) { + assertTrue(message.containsAttributes("googclient_deliveryattempt")); + assertThat(message.getAttributesOrThrow("googclient_deliveryattempt")) + .isEqualTo(Integer.toString(DELIVERY_INFO_COUNT)); + } else { + assertFalse(message.containsAttributes("googclient_deliveryattempt")); } + consumersWithResponse.add(ackReplyConsumerWithResponse); } }; + } - // This executor isn't used because we're not actually scheduling anything until we call - // dispatcher.start(), which we're not doing here. - ScheduledThreadPoolExecutor systemExecutor = new ScheduledThreadPoolExecutor(1); - systemExecutor.shutdownNow(); - - clock = new FakeClock(); - flowController = - new FlowController( - FlowControlSettings.newBuilder() - .setMaxOutstandingElementCount(1L) - .setLimitExceededBehavior(FlowController.LimitExceededBehavior.Block) - .build()); - - dispatcher = - new MessageDispatcher( - receiver, - processor, - Duration.ofSeconds(5), - Duration.ofMinutes(60), - Duration.ofSeconds(MAX_SECONDS_PER_ACK_EXTENSION), - new Distribution(Subscriber.MAX_ACK_DEADLINE_SECONDS + 1), - flowController, - MoreExecutors.directExecutor(), - systemExecutor, - clock); - dispatcher.setMessageDeadlineSeconds(Subscriber.MIN_ACK_DEADLINE_SECONDS); + @Test + public void testSetupAndTeardown() { + MessageDispatcher messageDispatcher = getMessageDispatcher(); - messageContainsDeliveryAttempt = true; + messageDispatcher.start(); + messageDispatcher.stop(); } @Test - public void testReceipt() { - dispatcher.processReceivedMessages(Collections.singletonList(TEST_MESSAGE)); - dispatcher.processOutstandingAckOperations(); - assertThat(sentModAcks) - .contains(ModAckItem.of(TEST_MESSAGE.getAckId(), Subscriber.MIN_ACK_DEADLINE_SECONDS)); + public void testReceiptMessageReceiver() { + MessageReceiver mockMessageReceiver = mock(MessageReceiver.class); + MessageDispatcher messageDispatcher = getMessageDispatcher(mockMessageReceiver); + messageDispatcher.processReceivedMessages(Collections.singletonList(TEST_MESSAGE)); + messageDispatcher.processOutstandingOperations(); + + // Assert expected behavior + List modackRequestDataList = new ArrayList(); + modackRequestDataList.add( + new ModackRequestData( + MIN_ACK_DEADLINE_SECONDS, AckRequestData.newBuilder(TEST_MESSAGE.getAckId()).build())); + + verify(mockAckProcessor, times(1)) + .sendModackOperations( + argThat( + new CustomArgumentMatchers.ModackRequestDataListMatcher(modackRequestDataList))); + verify(mockMessageReceiver, never()) + .receiveMessage(eq(TEST_MESSAGE.getMessage()), any(AckReplyConsumer.class)); } @Test - public void testReceiptNoDeliveryAttempt() { - messageContainsDeliveryAttempt = false; - ReceivedMessage messageNoDeliveryAttempt = + public void testReceiptModackWithOrderingForExactlyOnceDelivered() { + + MessageReceiverWithAckResponse mockMessageReceiverWithAckResponse = + mock(MessageReceiverWithAckResponse.class); + MessageDispatcher messageDispatcher = getMessageDispatcher(mockMessageReceiverWithAckResponse); + messageDispatcher.setExactlyOnceDeliveryEnabled(true); + + ReceivedMessage TEST_MESSAGE1 = + ReceivedMessage.newBuilder() + .setAckId("ACK_ID1") + .setMessage( + PubsubMessage.newBuilder() + .setData(ByteString.copyFromUtf8("message-data1")) + .build()) + .setDeliveryAttempt(DELIVERY_INFO_COUNT) + .build(); + ReceivedMessage TEST_MESSAGE2 = + ReceivedMessage.newBuilder() + .setAckId("ACK_ID2") + .setMessage( + PubsubMessage.newBuilder() + .setData(ByteString.copyFromUtf8("message-data2")) + .build()) + .setDeliveryAttempt(DELIVERY_INFO_COUNT) + .build(); + ReceivedMessage TEST_MESSAGE3 = ReceivedMessage.newBuilder() - .setAckId("ackid") - .setMessage(PubsubMessage.newBuilder().setData(MESSAGE_DATA).build()) + .setAckId("ACK_ID3") + .setMessage( + PubsubMessage.newBuilder() + .setData(ByteString.copyFromUtf8("message-data3")) + .build()) + .setDeliveryAttempt(DELIVERY_INFO_COUNT) .build(); - dispatcher.processReceivedMessages(Collections.singletonList(messageNoDeliveryAttempt)); - dispatcher.processOutstandingAckOperations(); - assertThat(sentModAcks) - .contains( - ModAckItem.of( - messageNoDeliveryAttempt.getAckId(), Subscriber.MIN_ACK_DEADLINE_SECONDS)); + + messageDispatcher.processReceivedMessages( + Arrays.asList(TEST_MESSAGE3, TEST_MESSAGE2, TEST_MESSAGE1)); + + messageDispatcher.processOutstandingOperations(); + verify(mockMessageReceiverWithAckResponse, never()) + .receiveMessage(eq(TEST_MESSAGE.getMessage()), any(AckReplyConsumerWithResponse.class)); + + AckRequestData ackRequestData1 = AckRequestData.newBuilder(TEST_MESSAGE1.getAckId()).build(); + AckRequestData ackRequestData2 = AckRequestData.newBuilder(TEST_MESSAGE2.getAckId()).build(); + AckRequestData ackRequestData3 = AckRequestData.newBuilder(TEST_MESSAGE3.getAckId()).build(); + messageDispatcher.notifyAckSuccess(ackRequestData2); + messageDispatcher.processOutstandingOperations(); + + messageDispatcher.notifyAckSuccess(ackRequestData1); + messageDispatcher.notifyAckSuccess(ackRequestData3); + messageDispatcher.processOutstandingOperations(); + + verify(mockMessageReceiverWithAckResponse, times(1)) + .receiveMessage( + argThat(new MessageDataMatcher(TEST_MESSAGE3.getMessage().getData())), + any(AckReplyConsumerWithResponse.class)); + verify(mockMessageReceiverWithAckResponse, times(1)) + .receiveMessage( + argThat(new MessageDataMatcher(TEST_MESSAGE2.getMessage().getData())), + any(AckReplyConsumerWithResponse.class)); + verify(mockMessageReceiverWithAckResponse, times(1)) + .receiveMessage( + argThat(new MessageDataMatcher(TEST_MESSAGE1.getMessage().getData())), + any(AckReplyConsumerWithResponse.class)); } @Test - public void testAck() throws Exception { - dispatcher.processReceivedMessages(Collections.singletonList(TEST_MESSAGE)); - consumers.take().ack(); - dispatcher.processOutstandingAckOperations(); - assertThat(sentAcks).contains(TEST_MESSAGE.getAckId()); + public void testReceiptModackForExactlyOnceDelivered() { + + MessageReceiverWithAckResponse mockMessageReceiverWithAckResponse = + mock(MessageReceiverWithAckResponse.class); + MessageDispatcher messageDispatcher = getMessageDispatcher(mockMessageReceiverWithAckResponse); + messageDispatcher.setExactlyOnceDeliveryEnabled(true); + + messageDispatcher.processReceivedMessages(Collections.singletonList(TEST_MESSAGE)); + + messageDispatcher.processOutstandingOperations(); + verify(mockMessageReceiverWithAckResponse, never()) + .receiveMessage(eq(TEST_MESSAGE.getMessage()), any(AckReplyConsumerWithResponse.class)); + + AckRequestData ackRequestData = AckRequestData.newBuilder(TEST_MESSAGE.getAckId()).build(); + messageDispatcher.notifyAckSuccess(ackRequestData); + messageDispatcher.processOutstandingOperations(); + + List modackRequestDataList = new ArrayList(); + modackRequestDataList.add(new ModackRequestData(MIN_ACK_DEADLINE_SECONDS, ackRequestData)); + + verify(mockMessageReceiverWithAckResponse, times(1)) + .receiveMessage( + argThat(new MessageDataMatcher(TEST_MESSAGE.getMessage().getData())), + any(AckReplyConsumerWithResponse.class)); } @Test - public void testNack() throws Exception { - dispatcher.processReceivedMessages(Collections.singletonList(TEST_MESSAGE)); - consumers.take().nack(); - dispatcher.processOutstandingAckOperations(); - assertThat(sentModAcks).contains(ModAckItem.of(TEST_MESSAGE.getAckId(), 0)); + public void testReceiptMessageReceiverWithAckResponse() { + MessageReceiverWithAckResponse mockMessageReceiverWithAckResponse = + mock(MessageReceiverWithAckResponse.class); + MessageDispatcher messageDispatcher = getMessageDispatcher(mockMessageReceiverWithAckResponse); + messageDispatcher.processReceivedMessages(Collections.singletonList(TEST_MESSAGE)); + messageDispatcher.processOutstandingOperations(); + + // Assert expected behavior + List modackRequestDataList = new ArrayList(); + modackRequestDataList.add( + new ModackRequestData( + MIN_ACK_DEADLINE_SECONDS, AckRequestData.newBuilder(TEST_MESSAGE.getAckId()).build())); + + verify(mockAckProcessor, times(1)) + .sendModackOperations( + argThat( + new CustomArgumentMatchers.ModackRequestDataListMatcher(modackRequestDataList))); + verify(mockMessageReceiverWithAckResponse, never()) + .receiveMessage(eq(TEST_MESSAGE.getMessage()), any(AckReplyConsumerWithResponse.class)); } @Test - public void testExtension() throws Exception { - dispatcher.processReceivedMessages(Collections.singletonList(TEST_MESSAGE)); - dispatcher.extendDeadlines(); - assertThat(sentModAcks) - .contains(ModAckItem.of(TEST_MESSAGE.getAckId(), Subscriber.MIN_ACK_DEADLINE_SECONDS)); + public void testConsumerAckMessageReceiver() { + MessageDispatcher messageDispatcher = getMessageDispatcher(messageReceiver); + messageDispatcher.processReceivedMessages(Collections.singletonList(TEST_MESSAGE)); - sentModAcks.clear(); - consumers.take().ack(); - dispatcher.extendDeadlines(); - assertThat(sentModAcks).isEmpty(); + try { + // Ack a message + consumers.take().ack(); + } catch (Throwable t) { + // In case our consumers fail + throw new AssertionError(); + } + + messageDispatcher.processOutstandingOperations(); + + // Assert expected behavior + List ackRequestDataList = new ArrayList(); + AckRequestData ackRequestData = AckRequestData.newBuilder(TEST_MESSAGE.getAckId()).build(); + ackRequestDataList.add(ackRequestData); + + List modackRequestDataList = new ArrayList(); + modackRequestDataList.add(new ModackRequestData(MIN_ACK_DEADLINE_SECONDS, ackRequestData)); + + verify(mockAckProcessor, times(1)) + .sendModackOperations( + argThat( + new CustomArgumentMatchers.ModackRequestDataListMatcher(modackRequestDataList))); + verify(mockAckProcessor, times(1)) + .sendAckOperations( + argThat(new CustomArgumentMatchers.AckRequestDataListMatcher(ackRequestDataList))); } @Test - public void testExtension_Close() { - dispatcher.processReceivedMessages(Collections.singletonList(TEST_MESSAGE)); - dispatcher.extendDeadlines(); - assertThat(sentModAcks) - .contains(ModAckItem.of(TEST_MESSAGE.getAckId(), Subscriber.MIN_ACK_DEADLINE_SECONDS)); - sentModAcks.clear(); + public void testConsumerAckMessageReceiverWithAckResponse() { + MessageDispatcher messageDispatcher = getMessageDispatcher(messageReceiverWithAckResponse); + messageDispatcher.processReceivedMessages(Collections.singletonList(TEST_MESSAGE)); + Future ackResponseFuture; - // Default total expiration is an hour (60*60 seconds). We normally would extend by 10s. - // However, only extend by 5s here, since there's only 5s left before total expiration. - clock.advance(60 * 60 - 5, TimeUnit.SECONDS); - dispatcher.extendDeadlines(); - assertThat(sentModAcks).contains(ModAckItem.of(TEST_MESSAGE.getAckId(), 5)); + try { + // Ack a message - at this point we do not care about the message future so just drop it + consumersWithResponse.take().ack(); + } catch (Throwable t) { + // In case our consumers fail + throw new AssertionError(); + } + + messageDispatcher.processOutstandingOperations(); + + // Assert expected behavior + List ackRequestDataList = new ArrayList(); + AckRequestData ackRequestData = AckRequestData.newBuilder(TEST_MESSAGE.getAckId()).build(); + ackRequestDataList.add(ackRequestData); + + List modackRequestDataList = new ArrayList(); + modackRequestDataList.add(new ModackRequestData(MIN_ACK_DEADLINE_SECONDS, ackRequestData)); + + verify(mockAckProcessor, times(1)) + .sendModackOperations( + argThat( + new CustomArgumentMatchers.ModackRequestDataListMatcher(modackRequestDataList))); + verify(mockAckProcessor, times(1)) + .sendAckOperations( + argThat(new CustomArgumentMatchers.AckRequestDataListMatcher(ackRequestDataList))); + } + + @Test + public void testConsumerNackMessageReceiver() { + MessageDispatcher messageDispatcher = getMessageDispatcher(messageReceiver); + messageDispatcher.processReceivedMessages(Collections.singletonList(TEST_MESSAGE)); + + try { + consumers.take().nack(); + } catch (Throwable t) { + // Just in case something went wrong with our consumers + throw new AssertionError(); + } + + messageDispatcher.processOutstandingOperations(); + + // Assert expected behavior + AckRequestData ackRequestData = AckRequestData.newBuilder(TEST_MESSAGE.getAckId()).build(); + List modackRequestDataList = new ArrayList(); + modackRequestDataList.add(new ModackRequestData(0, ackRequestData)); + modackRequestDataList.add(new ModackRequestData(MIN_ACK_DEADLINE_SECONDS, ackRequestData)); + + verify(mockAckProcessor, times(1)) + .sendModackOperations( + argThat( + new CustomArgumentMatchers.ModackRequestDataListMatcher(modackRequestDataList))); + } + + @Test + public void testConsumerNackMessageReceiverWithAckResponse() { + MessageDispatcher messageDispatcher = getMessageDispatcher(messageReceiverWithAckResponse); + messageDispatcher.processReceivedMessages(Collections.singletonList(TEST_MESSAGE)); + + try { + // Ack a message - at this point we do not care about the message future so just drop it + consumersWithResponse.take().nack(); + } catch (Throwable t) { + // Just in case something went wrong with our consumers + throw new AssertionError(); + } + + messageDispatcher.processOutstandingOperations(); + + // Assert expected behavior + AckRequestData ackRequestData = AckRequestData.newBuilder(TEST_MESSAGE.getAckId()).build(); + List modackRequestDataList = new ArrayList(); + modackRequestDataList.add(new ModackRequestData(0, ackRequestData)); + modackRequestDataList.add(new ModackRequestData(MIN_ACK_DEADLINE_SECONDS, ackRequestData)); + + verify(mockAckProcessor, times(1)) + .sendModackOperations( + argThat( + new CustomArgumentMatchers.ModackRequestDataListMatcher(modackRequestDataList))); + } + + @Test + public void testExtension() { + MessageDispatcher messageDispatcher = getMessageDispatcher(); + messageDispatcher.processReceivedMessages(Collections.singletonList(TEST_MESSAGE)); + messageDispatcher.extendDeadlines(); + + // Assert expected behavior + List ackRequestDataList = new ArrayList(); + + AckRequestData ackRequestData = AckRequestData.newBuilder(TEST_MESSAGE.getAckId()).build(); + ackRequestDataList.add(ackRequestData); + + List modackRequestDataList = new ArrayList(); + modackRequestDataList.add(new ModackRequestData(MIN_ACK_DEADLINE_SECONDS, ackRequestData)); + + verify(mockAckProcessor, times(1)) + .sendModackOperations( + argThat( + new CustomArgumentMatchers.ModackRequestDataListMatcher(modackRequestDataList))); + } + + @Test + public void testExtension_ExpirationExtension() { + MessageDispatcher messageDispatcher = getMessageDispatcher(); + messageDispatcher.processReceivedMessages(Collections.singletonList(TEST_MESSAGE)); + int secondsLeft = 5; + // Advance clock to have 5 seconds left in extension period + clock.advance(MAX_ACK_EXTENSION_PERIOD.getSeconds() - secondsLeft, TimeUnit.SECONDS); + messageDispatcher.extendDeadlines(); + + // Assert expected behavior + List ackRequestDataList = new ArrayList(); + AckRequestData ackRequestData = AckRequestData.newBuilder(TEST_MESSAGE.getAckId()).build(); + ackRequestDataList.add(ackRequestData); + List modackRequestDataList = new ArrayList(); + modackRequestDataList.add(new ModackRequestData(secondsLeft, ackRequestData)); + + verify(mockAckProcessor, times(1)) + .sendModackOperations( + argThat( + new CustomArgumentMatchers.ModackRequestDataListMatcher(modackRequestDataList))); } @Test public void testExtension_GiveUp() throws Exception { - dispatcher.processReceivedMessages(Collections.singletonList(TEST_MESSAGE)); - dispatcher.extendDeadlines(); - assertThat(sentModAcks) - .contains(ModAckItem.of(TEST_MESSAGE.getAckId(), Subscriber.MIN_ACK_DEADLINE_SECONDS)); - sentModAcks.clear(); + MessageDispatcher messageDispatcher = getMessageDispatcher(); + messageDispatcher.processReceivedMessages(Collections.singletonList(TEST_MESSAGE)); // If we run extendDeadlines after totalExpiration, we shouldn't send anything. - // In particular, don't send negative modacks. clock.advance(1, TimeUnit.DAYS); - dispatcher.extendDeadlines(); - assertThat(sentModAcks).isEmpty(); + messageDispatcher.extendDeadlines(); - // We should be able to reserve another item in the flow controller and not block. - flowController.reserve(1, 0); - dispatcher.stop(); + // Assert expected behavior + verify(mockAckProcessor, times(0)).sendAckOperations(eq(Collections.emptyList())); + verify(mockAckProcessor, times(0)).sendModackOperations(eq(Collections.emptyList())); + } + + @Test + public void testAckExtensionDefaultsExactlyOnceDeliveryDisabledThenEnabled() { + MessageDispatcher messageDispatcher = + MessageDispatcher.newBuilder(mock(MessageReceiver.class)) + .setAckLatencyDistribution(mockAckLatencyDistribution) + .setMinDurationPerAckExtension(Subscriber.DEFAULT_MIN_ACK_DEADLINE_EXTENSION) + .setMinDurationPerAckExtensionDefaultUsed(true) + .setMaxDurationPerAckExtension(Subscriber.DEFAULT_MAX_ACK_DEADLINE_EXTENSION) + .setMaxDurationPerAckExtensionDefaultUsed(true) + .setSubscriptionName(MOCK_SUBSCRIPTION_NAME) + .build(); + + // ExactlyOnceDeliveryEnabled is turned off by default + + // We should be using the Subscriber set hard deadlines + assertMinAndMaxAckDeadlines( + messageDispatcher, + Math.toIntExact(Subscriber.MIN_STREAM_ACK_DEADLINE.getSeconds()), + Math.toIntExact(Subscriber.MAX_STREAM_ACK_DEADLINE.getSeconds())); + + // This would normally be set from the streaming pull response in the + // StreamingSubscriberConnection + messageDispatcher.setExactlyOnceDeliveryEnabled(true); + + // Should only change min deadline + assertMinAndMaxAckDeadlines( + messageDispatcher, + Math.toIntExact( + Subscriber.DEFAULT_MIN_ACK_DEADLINE_EXTENSION_EXACTLY_ONCE_DELIVERY.getSeconds()), + Math.toIntExact(Subscriber.MAX_STREAM_ACK_DEADLINE.getSeconds())); + } + + @Test + public void testAckExtensionDefaultsExactlyOnceDeliveryEnabledThenDisabled() { + MessageDispatcher messageDispatcher = + MessageDispatcher.newBuilder(mock(MessageReceiver.class)) + .setAckLatencyDistribution(mockAckLatencyDistribution) + .setMinDurationPerAckExtension( + Subscriber.DEFAULT_MIN_ACK_DEADLINE_EXTENSION_EXACTLY_ONCE_DELIVERY) + .setMinDurationPerAckExtensionDefaultUsed(true) + .setMaxDurationPerAckExtension(Subscriber.DEFAULT_MIN_ACK_DEADLINE_EXTENSION) + .setMaxDurationPerAckExtensionDefaultUsed(true) + .setSubscriptionName(MOCK_SUBSCRIPTION_NAME) + .build(); + + // This would normally be set from the streaming pull response in the + // StreamingSubscriberConnection + messageDispatcher.setExactlyOnceDeliveryEnabled(true); + + assertMinAndMaxAckDeadlines( + messageDispatcher, + Math.toIntExact( + Subscriber.DEFAULT_MIN_ACK_DEADLINE_EXTENSION_EXACTLY_ONCE_DELIVERY.getSeconds()), + Math.toIntExact(Subscriber.MAX_STREAM_ACK_DEADLINE.getSeconds())); + + // This would normally be set from the streaming pull response in the + // StreamingSubscriberConnection + messageDispatcher.setExactlyOnceDeliveryEnabled(false); + + // Should change min deadline + assertMinAndMaxAckDeadlines( + messageDispatcher, + Math.toIntExact(Subscriber.MIN_STREAM_ACK_DEADLINE.getSeconds()), + Math.toIntExact(Subscriber.MAX_STREAM_ACK_DEADLINE.getSeconds())); + } + + @Test + public void testOrderedDeliveryOrderingDisabled() throws Exception { + MessageReceiver mockMessageReceiver = mock(MessageReceiver.class); + MessageDispatcher messageDispatcher = + getMessageDispatcher(mockMessageReceiver, Executors.newFixedThreadPool(5)); + + // This would normally be set from the streaming pull response in the + // StreamingSubscriberConnection + messageDispatcher.setMessageOrderingEnabled(false); + + CountDownLatch receiveCalls = new CountDownLatch(2); + + doAnswer( + new Answer() { + public Void answer(InvocationOnMock invocation) throws Exception { + Thread.sleep(1000); + receiveCalls.countDown(); + return null; + } + }) + .when(mockMessageReceiver) + .receiveMessage(eq(ORDERED_TEST_MESSAGE_1.getMessage()), any(AckReplyConsumer.class)); + doAnswer( + new Answer() { + public Void answer(InvocationOnMock invocation) { + // Ensure the previous method didn't finish and we could process in parallel. + assertEquals(2, receiveCalls.getCount()); + receiveCalls.countDown(); + return null; + } + }) + .when(mockMessageReceiver) + .receiveMessage(eq(ORDERED_TEST_MESSAGE_2.getMessage()), any(AckReplyConsumer.class)); + + messageDispatcher.processReceivedMessages( + Arrays.asList(ORDERED_TEST_MESSAGE_1, ORDERED_TEST_MESSAGE_2)); + receiveCalls.await(); + } + + @Test + public void testOrderedDeliveryOrderingEnabled() throws Exception { + MessageReceiver mockMessageReceiver = mock(MessageReceiver.class); + MessageDispatcher messageDispatcher = + getMessageDispatcher(mockMessageReceiver, Executors.newFixedThreadPool(5)); + + // This would normally be set from the streaming pull response in the + // StreamingSubscriberConnection + messageDispatcher.setMessageOrderingEnabled(true); + + CountDownLatch receiveCalls = new CountDownLatch(2); + + doAnswer( + new Answer() { + public Void answer(InvocationOnMock invocation) throws Exception { + Thread.sleep(1000); + receiveCalls.countDown(); + return null; + } + }) + .when(mockMessageReceiver) + .receiveMessage(eq(ORDERED_TEST_MESSAGE_1.getMessage()), any(AckReplyConsumer.class)); + doAnswer( + new Answer() { + public Void answer(InvocationOnMock invocation) { + // Ensure the previous method has finished completely. + assertEquals(1, receiveCalls.getCount()); + receiveCalls.countDown(); + return null; + } + }) + .when(mockMessageReceiver) + .receiveMessage(eq(ORDERED_TEST_MESSAGE_2.getMessage()), any(AckReplyConsumer.class)); + + messageDispatcher.processReceivedMessages( + Arrays.asList(ORDERED_TEST_MESSAGE_1, ORDERED_TEST_MESSAGE_2)); + receiveCalls.await(); + } + + @Test + public void testAckExtensionCustomMinExactlyOnceDeliveryDisabledThenEnabled() { + int customMinSeconds = 30; + MessageDispatcher messageDispatcher = + MessageDispatcher.newBuilder(mock(MessageReceiver.class)) + .setAckLatencyDistribution(mockAckLatencyDistribution) + .setMinDurationPerAckExtension(Duration.ofSeconds(customMinSeconds)) + .setMinDurationPerAckExtensionDefaultUsed(false) + .setMaxDurationPerAckExtension(Subscriber.DEFAULT_MIN_ACK_DEADLINE_EXTENSION) + .setMaxDurationPerAckExtensionDefaultUsed(true) + .setSubscriptionName(MOCK_SUBSCRIPTION_NAME) + .build(); + + // ExactlyOnceDeliveryEnabled is turned off by default + assertMinAndMaxAckDeadlines( + messageDispatcher, + customMinSeconds, + Math.toIntExact(Subscriber.MAX_STREAM_ACK_DEADLINE.getSeconds())); + + // This would normally be set from the streaming pull response in the + // StreamingSubscriberConnection + messageDispatcher.setExactlyOnceDeliveryEnabled(true); + + // no changes should occur + assertMinAndMaxAckDeadlines( + messageDispatcher, + customMinSeconds, + Math.toIntExact(Subscriber.MAX_STREAM_ACK_DEADLINE.getSeconds())); } @Test - public void testDeadlineAdjustment() throws Exception { - assertThat(dispatcher.computeDeadlineSeconds()).isEqualTo(10); + public void testAckExtensionCustomMaxExactlyOnceDeliveryDisabledThenEnabled() { + int customMaxSeconds = 30; + MessageDispatcher messageDispatcher = + MessageDispatcher.newBuilder(mock(MessageReceiver.class)) + .setAckLatencyDistribution(mockAckLatencyDistribution) + .setMinDurationPerAckExtension(Subscriber.DEFAULT_MIN_ACK_DEADLINE_EXTENSION) + .setMinDurationPerAckExtensionDefaultUsed(true) + .setMaxDurationPerAckExtension(Duration.ofSeconds(customMaxSeconds)) + .setMaxDurationPerAckExtensionDefaultUsed(false) + .setSubscriptionName(MOCK_SUBSCRIPTION_NAME) + .build(); + + // ExactlyOnceDeliveryEnabled is turned off by default + assertMinAndMaxAckDeadlines( + messageDispatcher, + Math.toIntExact(Subscriber.MIN_STREAM_ACK_DEADLINE.getSeconds()), + customMaxSeconds); + + // This would normally be set from the streaming pull response in the + // StreamingSubscriberConnection + messageDispatcher.setExactlyOnceDeliveryEnabled(true); + + // Because the customMaxSeconds is above the + // DEFAULT_MIN_ACK_DEADLINE_EXTENSION_EXACTLY_ONCE_DELIVERY, we should use the customMaxSeconds + // as the new min + assertMinAndMaxAckDeadlines(messageDispatcher, customMaxSeconds, customMaxSeconds); + } + + private void assertMinAndMaxAckDeadlines( + MessageDispatcher messageDispatcher, int minAckDeadline, int maxAckDeadline) { + // Helper function to assert if min and max deadlines are being respected + + // Set distribution to return a low value to assert min value + when(mockAckLatencyDistribution.getPercentile( + MessageDispatcher.PERCENTILE_FOR_ACK_DEADLINE_UPDATES)) + .thenReturn(0); + assertEquals(minAckDeadline, messageDispatcher.computeDeadlineSeconds()); + + // Set distribution to return a high value to assert max value + when(mockAckLatencyDistribution.getPercentile( + MessageDispatcher.PERCENTILE_FOR_ACK_DEADLINE_UPDATES)) + .thenReturn(60 * 60); + assertEquals(maxAckDeadline, messageDispatcher.computeDeadlineSeconds()); + } + + private MessageDispatcher getMessageDispatcher() { + return getMessageDispatcher(mock(MessageReceiver.class), MoreExecutors.directExecutor()); + } + + private MessageDispatcher getMessageDispatcher(MessageReceiver messageReceiver) { + return getMessageDispatcherFromBuilder( + MessageDispatcher.newBuilder(messageReceiver), MoreExecutors.directExecutor()); + } + + private MessageDispatcher getMessageDispatcher( + MessageReceiver messageReceiver, Executor executor) { + return getMessageDispatcherFromBuilder(MessageDispatcher.newBuilder(messageReceiver), executor); + } + + private MessageDispatcher getMessageDispatcher( + MessageReceiverWithAckResponse messageReceiverWithAckResponse) { + return getMessageDispatcherFromBuilder( + MessageDispatcher.newBuilder(messageReceiverWithAckResponse), + MoreExecutors.directExecutor()); + } + + private MessageDispatcher getMessageDispatcherFromBuilder( + MessageDispatcher.Builder builder, Executor executor) { + 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(executor) + .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)); - clock.advance(42, TimeUnit.SECONDS); + + 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(); - assertThat(dispatcher.computeDeadlineSeconds()).isEqualTo(42); + 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 testMaxDurationPerAckExtension() throws Exception { - assertThat(dispatcher.computeDeadlineSeconds()).isEqualTo(10); + 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)); - clock.advance(MAX_SECONDS_PER_ACK_EXTENSION + 5, TimeUnit.SECONDS); - consumers.take().ack(); - assertThat(dispatcher.computeDeadlineSeconds()).isEqualTo(MAX_SECONDS_PER_ACK_EXTENSION); + 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/MockIAMPolicy.java b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MockIAMPolicy.java index 09850727d..3c447fc4f 100644 --- a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MockIAMPolicy.java +++ b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MockIAMPolicy.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.pubsub.v1; import com.google.api.core.BetaApi; @@ -20,9 +21,10 @@ import com.google.protobuf.AbstractMessage; import io.grpc.ServerServiceDefinition; import java.util.List; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockIAMPolicy implements MockGrpcService { private final MockIAMPolicyImpl serviceImpl; diff --git a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MockIAMPolicyImpl.java b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MockIAMPolicyImpl.java index 4c32d64c9..9b3838e1f 100644 --- a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MockIAMPolicyImpl.java +++ b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MockIAMPolicyImpl.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.pubsub.v1; import com.google.api.core.BetaApi; @@ -28,9 +29,10 @@ import java.util.LinkedList; import java.util.List; import java.util.Queue; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockIAMPolicyImpl extends IAMPolicyImplBase { private List requests; private Queue responses; @@ -62,46 +64,64 @@ public void reset() { } @Override - public void setIamPolicy(SetIamPolicyRequest request, StreamObserver responseObserver) { - Object response = responses.remove(); - if (response instanceof Policy) { + public void testIamPermissions( + TestIamPermissionsRequest request, + StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof TestIamPermissionsResponse) { requests.add(request); - responseObserver.onNext((Policy) response); + responseObserver.onNext(((TestIamPermissionsResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { - responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method TestIamPermissions, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + TestIamPermissionsResponse.class.getName(), + Exception.class.getName()))); } } @Override - public void getIamPolicy(GetIamPolicyRequest request, StreamObserver responseObserver) { - Object response = responses.remove(); + public void setIamPolicy(SetIamPolicyRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); if (response instanceof Policy) { requests.add(request); - responseObserver.onNext((Policy) response); + responseObserver.onNext(((Policy) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { - responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method SetIamPolicy, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Policy.class.getName(), + Exception.class.getName()))); } } @Override - public void testIamPermissions( - TestIamPermissionsRequest request, - StreamObserver responseObserver) { - Object response = responses.remove(); - if (response instanceof TestIamPermissionsResponse) { + public void getIamPolicy(GetIamPolicyRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Policy) { requests.add(request); - responseObserver.onNext((TestIamPermissionsResponse) response); + responseObserver.onNext(((Policy) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { - responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method GetIamPolicy, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Policy.class.getName(), + Exception.class.getName()))); } } } diff --git a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MockPublisher.java b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MockPublisher.java index 21f3fb527..f992f4bba 100644 --- a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MockPublisher.java +++ b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MockPublisher.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.pubsub.v1; import com.google.api.core.BetaApi; @@ -20,9 +21,10 @@ import com.google.protobuf.AbstractMessage; import io.grpc.ServerServiceDefinition; import java.util.List; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockPublisher implements MockGrpcService { private final MockPublisherImpl serviceImpl; diff --git a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MockPublisherImpl.java b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MockPublisherImpl.java index 420a757ad..5e9ecad09 100644 --- a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MockPublisherImpl.java +++ b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MockPublisherImpl.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.pubsub.v1; import com.google.api.core.BetaApi; @@ -38,9 +39,10 @@ import java.util.LinkedList; import java.util.List; import java.util.Queue; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockPublisherImpl extends PublisherImplBase { private List requests; private Queue responses; @@ -73,72 +75,102 @@ public void reset() { @Override public void createTopic(Topic request, StreamObserver responseObserver) { - Object response = responses.remove(); + Object response = responses.poll(); if (response instanceof Topic) { requests.add(request); - responseObserver.onNext((Topic) response); + responseObserver.onNext(((Topic) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { - responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method CreateTopic, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Topic.class.getName(), + Exception.class.getName()))); } } @Override public void updateTopic(UpdateTopicRequest request, StreamObserver responseObserver) { - Object response = responses.remove(); + Object response = responses.poll(); if (response instanceof Topic) { requests.add(request); - responseObserver.onNext((Topic) response); + responseObserver.onNext(((Topic) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { - responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method UpdateTopic, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Topic.class.getName(), + Exception.class.getName()))); } } @Override public void publish(PublishRequest request, StreamObserver responseObserver) { - Object response = responses.remove(); + Object response = responses.poll(); if (response instanceof PublishResponse) { requests.add(request); - responseObserver.onNext((PublishResponse) response); + responseObserver.onNext(((PublishResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { - responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method Publish, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + PublishResponse.class.getName(), + Exception.class.getName()))); } } @Override public void getTopic(GetTopicRequest request, StreamObserver responseObserver) { - Object response = responses.remove(); + Object response = responses.poll(); if (response instanceof Topic) { requests.add(request); - responseObserver.onNext((Topic) response); + responseObserver.onNext(((Topic) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { - responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method GetTopic, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Topic.class.getName(), + Exception.class.getName()))); } } @Override public void listTopics( ListTopicsRequest request, StreamObserver responseObserver) { - Object response = responses.remove(); + Object response = responses.poll(); if (response instanceof ListTopicsResponse) { requests.add(request); - responseObserver.onNext((ListTopicsResponse) response); + responseObserver.onNext(((ListTopicsResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { - responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method ListTopics, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + ListTopicsResponse.class.getName(), + Exception.class.getName()))); } } @@ -146,15 +178,22 @@ public void listTopics( public void listTopicSubscriptions( ListTopicSubscriptionsRequest request, StreamObserver responseObserver) { - Object response = responses.remove(); + Object response = responses.poll(); if (response instanceof ListTopicSubscriptionsResponse) { requests.add(request); - responseObserver.onNext((ListTopicSubscriptionsResponse) response); + responseObserver.onNext(((ListTopicSubscriptionsResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { - responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method ListTopicSubscriptions, expected %s or" + + " %s", + response == null ? "null" : response.getClass().getName(), + ListTopicSubscriptionsResponse.class.getName(), + Exception.class.getName()))); } } @@ -162,29 +201,41 @@ public void listTopicSubscriptions( public void listTopicSnapshots( ListTopicSnapshotsRequest request, StreamObserver responseObserver) { - Object response = responses.remove(); + Object response = responses.poll(); if (response instanceof ListTopicSnapshotsResponse) { requests.add(request); - responseObserver.onNext((ListTopicSnapshotsResponse) response); + responseObserver.onNext(((ListTopicSnapshotsResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { - responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method ListTopicSnapshots, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + ListTopicSnapshotsResponse.class.getName(), + Exception.class.getName()))); } } @Override public void deleteTopic(DeleteTopicRequest request, StreamObserver responseObserver) { - Object response = responses.remove(); + Object response = responses.poll(); if (response instanceof Empty) { requests.add(request); - responseObserver.onNext((Empty) response); + responseObserver.onNext(((Empty) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { - responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method DeleteTopic, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Empty.class.getName(), + Exception.class.getName()))); } } @@ -192,15 +243,21 @@ public void deleteTopic(DeleteTopicRequest request, StreamObserver respon public void detachSubscription( DetachSubscriptionRequest request, StreamObserver responseObserver) { - Object response = responses.remove(); + Object response = responses.poll(); if (response instanceof DetachSubscriptionResponse) { requests.add(request); - responseObserver.onNext((DetachSubscriptionResponse) response); + responseObserver.onNext(((DetachSubscriptionResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { - responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method DetachSubscription, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + DetachSubscriptionResponse.class.getName(), + Exception.class.getName()))); } } } diff --git a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MockSchemaService.java b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MockSchemaService.java index e469a29f8..e986b7ed5 100644 --- a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MockSchemaService.java +++ b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MockSchemaService.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.pubsub.v1; import com.google.api.core.BetaApi; @@ -20,9 +21,10 @@ import com.google.protobuf.AbstractMessage; import io.grpc.ServerServiceDefinition; import java.util.List; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockSchemaService implements MockGrpcService { private final MockSchemaServiceImpl serviceImpl; diff --git a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MockSchemaServiceImpl.java b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MockSchemaServiceImpl.java index be26a2894..92c412f10 100644 --- a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MockSchemaServiceImpl.java +++ b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MockSchemaServiceImpl.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 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 + * 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, @@ -13,16 +13,22 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.pubsub.v1; import com.google.api.core.BetaApi; import com.google.protobuf.AbstractMessage; import com.google.protobuf.Empty; +import com.google.pubsub.v1.CommitSchemaRequest; import com.google.pubsub.v1.CreateSchemaRequest; import com.google.pubsub.v1.DeleteSchemaRequest; +import com.google.pubsub.v1.DeleteSchemaRevisionRequest; import com.google.pubsub.v1.GetSchemaRequest; +import com.google.pubsub.v1.ListSchemaRevisionsRequest; +import com.google.pubsub.v1.ListSchemaRevisionsResponse; import com.google.pubsub.v1.ListSchemasRequest; import com.google.pubsub.v1.ListSchemasResponse; +import com.google.pubsub.v1.RollbackSchemaRequest; import com.google.pubsub.v1.Schema; import com.google.pubsub.v1.SchemaServiceGrpc.SchemaServiceImplBase; import com.google.pubsub.v1.ValidateMessageRequest; @@ -34,9 +40,10 @@ import java.util.LinkedList; import java.util.List; import java.util.Queue; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockSchemaServiceImpl extends SchemaServiceImplBase { private List requests; private Queue responses; @@ -69,88 +76,209 @@ public void reset() { @Override public void createSchema(CreateSchemaRequest request, StreamObserver responseObserver) { - Object response = responses.remove(); + Object response = responses.poll(); if (response instanceof Schema) { requests.add(request); - responseObserver.onNext((Schema) response); + responseObserver.onNext(((Schema) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { - responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method CreateSchema, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Schema.class.getName(), + Exception.class.getName()))); } } @Override public void getSchema(GetSchemaRequest request, StreamObserver responseObserver) { - Object response = responses.remove(); + Object response = responses.poll(); if (response instanceof Schema) { requests.add(request); - responseObserver.onNext((Schema) response); + responseObserver.onNext(((Schema) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { - responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method GetSchema, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Schema.class.getName(), + Exception.class.getName()))); } } @Override public void listSchemas( ListSchemasRequest request, StreamObserver responseObserver) { - Object response = responses.remove(); + Object response = responses.poll(); if (response instanceof ListSchemasResponse) { requests.add(request); - responseObserver.onNext((ListSchemasResponse) response); + responseObserver.onNext(((ListSchemasResponse) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method ListSchemas, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + ListSchemasResponse.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void listSchemaRevisions( + ListSchemaRevisionsRequest request, + StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof ListSchemaRevisionsResponse) { + requests.add(request); + responseObserver.onNext(((ListSchemaRevisionsResponse) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method ListSchemaRevisions, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + ListSchemaRevisionsResponse.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void commitSchema(CommitSchemaRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Schema) { + requests.add(request); + responseObserver.onNext(((Schema) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method CommitSchema, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Schema.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void rollbackSchema( + RollbackSchemaRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Schema) { + requests.add(request); + responseObserver.onNext(((Schema) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method RollbackSchema, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Schema.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void deleteSchemaRevision( + DeleteSchemaRevisionRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Schema) { + requests.add(request); + responseObserver.onNext(((Schema) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { - responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method DeleteSchemaRevision, expected %s or" + + " %s", + response == null ? "null" : response.getClass().getName(), + Schema.class.getName(), + Exception.class.getName()))); } } @Override public void deleteSchema(DeleteSchemaRequest request, StreamObserver responseObserver) { - Object response = responses.remove(); + Object response = responses.poll(); if (response instanceof Empty) { requests.add(request); - responseObserver.onNext((Empty) response); + responseObserver.onNext(((Empty) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { - responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method DeleteSchema, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Empty.class.getName(), + Exception.class.getName()))); } } @Override public void validateSchema( ValidateSchemaRequest request, StreamObserver responseObserver) { - Object response = responses.remove(); + Object response = responses.poll(); if (response instanceof ValidateSchemaResponse) { requests.add(request); - responseObserver.onNext((ValidateSchemaResponse) response); + responseObserver.onNext(((ValidateSchemaResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { - responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method ValidateSchema, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + ValidateSchemaResponse.class.getName(), + Exception.class.getName()))); } } @Override public void validateMessage( ValidateMessageRequest request, StreamObserver responseObserver) { - Object response = responses.remove(); + Object response = responses.poll(); if (response instanceof ValidateMessageResponse) { requests.add(request); - responseObserver.onNext((ValidateMessageResponse) response); + responseObserver.onNext(((ValidateMessageResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { - responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method ValidateMessage, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + ValidateMessageResponse.class.getName(), + Exception.class.getName()))); } } } diff --git a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MockSubscriber.java b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MockSubscriber.java index 2f630508d..a0547f660 100644 --- a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MockSubscriber.java +++ b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MockSubscriber.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.pubsub.v1; import com.google.api.core.BetaApi; @@ -20,9 +21,10 @@ import com.google.protobuf.AbstractMessage; import io.grpc.ServerServiceDefinition; import java.util.List; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockSubscriber implements MockGrpcService { private final MockSubscriberImpl serviceImpl; diff --git a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MockSubscriberImpl.java b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MockSubscriberImpl.java index 3d3c2013d..81d0ddef2 100644 --- a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MockSubscriberImpl.java +++ b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MockSubscriberImpl.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.pubsub.v1; import com.google.api.core.BetaApi; @@ -46,9 +47,10 @@ import java.util.LinkedList; import java.util.List; import java.util.Queue; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockSubscriberImpl extends SubscriberImplBase { private List requests; private Queue responses; @@ -82,45 +84,63 @@ public void reset() { @Override public void createSubscription( Subscription request, StreamObserver responseObserver) { - Object response = responses.remove(); + Object response = responses.poll(); if (response instanceof Subscription) { requests.add(request); - responseObserver.onNext((Subscription) response); + responseObserver.onNext(((Subscription) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { - responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method CreateSubscription, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Subscription.class.getName(), + Exception.class.getName()))); } } @Override public void getSubscription( GetSubscriptionRequest request, StreamObserver responseObserver) { - Object response = responses.remove(); + Object response = responses.poll(); if (response instanceof Subscription) { requests.add(request); - responseObserver.onNext((Subscription) response); + responseObserver.onNext(((Subscription) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { - responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method GetSubscription, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Subscription.class.getName(), + Exception.class.getName()))); } } @Override public void updateSubscription( UpdateSubscriptionRequest request, StreamObserver responseObserver) { - Object response = responses.remove(); + Object response = responses.poll(); if (response instanceof Subscription) { requests.add(request); - responseObserver.onNext((Subscription) response); + responseObserver.onNext(((Subscription) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { - responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method UpdateSubscription, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Subscription.class.getName(), + Exception.class.getName()))); } } @@ -128,73 +148,103 @@ public void updateSubscription( public void listSubscriptions( ListSubscriptionsRequest request, StreamObserver responseObserver) { - Object response = responses.remove(); + Object response = responses.poll(); if (response instanceof ListSubscriptionsResponse) { requests.add(request); - responseObserver.onNext((ListSubscriptionsResponse) response); + responseObserver.onNext(((ListSubscriptionsResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { - responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method ListSubscriptions, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + ListSubscriptionsResponse.class.getName(), + Exception.class.getName()))); } } @Override public void deleteSubscription( DeleteSubscriptionRequest request, StreamObserver responseObserver) { - Object response = responses.remove(); + Object response = responses.poll(); if (response instanceof Empty) { requests.add(request); - responseObserver.onNext((Empty) response); + responseObserver.onNext(((Empty) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { - responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method DeleteSubscription, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Empty.class.getName(), + Exception.class.getName()))); } } @Override public void modifyAckDeadline( ModifyAckDeadlineRequest request, StreamObserver responseObserver) { - Object response = responses.remove(); + Object response = responses.poll(); if (response instanceof Empty) { requests.add(request); - responseObserver.onNext((Empty) response); + responseObserver.onNext(((Empty) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { - responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method ModifyAckDeadline, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Empty.class.getName(), + Exception.class.getName()))); } } @Override public void acknowledge(AcknowledgeRequest request, StreamObserver responseObserver) { - Object response = responses.remove(); + Object response = responses.poll(); if (response instanceof Empty) { requests.add(request); - responseObserver.onNext((Empty) response); + responseObserver.onNext(((Empty) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { - responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method Acknowledge, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Empty.class.getName(), + Exception.class.getName()))); } } @Override public void pull(PullRequest request, StreamObserver responseObserver) { - Object response = responses.remove(); + Object response = responses.poll(); if (response instanceof PullResponse) { requests.add(request); - responseObserver.onNext((PullResponse) response); + responseObserver.onNext(((PullResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { - responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method Pull, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + PullResponse.class.getName(), + Exception.class.getName()))); } } @@ -208,11 +258,18 @@ public void onNext(StreamingPullRequest value) { requests.add(value); final Object response = responses.remove(); if (response instanceof StreamingPullResponse) { - responseObserver.onNext((StreamingPullResponse) response); + responseObserver.onNext(((StreamingPullResponse) response)); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { - responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method StreamingPull, expected %s or" + + " %s", + response == null ? "null" : response.getClass().getName(), + StreamingPullResponse.class.getName(), + Exception.class.getName()))); } } @@ -232,103 +289,145 @@ public void onCompleted() { @Override public void modifyPushConfig( ModifyPushConfigRequest request, StreamObserver responseObserver) { - Object response = responses.remove(); + Object response = responses.poll(); if (response instanceof Empty) { requests.add(request); - responseObserver.onNext((Empty) response); + responseObserver.onNext(((Empty) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { - responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method ModifyPushConfig, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Empty.class.getName(), + Exception.class.getName()))); } } @Override public void getSnapshot(GetSnapshotRequest request, StreamObserver responseObserver) { - Object response = responses.remove(); + Object response = responses.poll(); if (response instanceof Snapshot) { requests.add(request); - responseObserver.onNext((Snapshot) response); + responseObserver.onNext(((Snapshot) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { - responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method GetSnapshot, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Snapshot.class.getName(), + Exception.class.getName()))); } } @Override public void listSnapshots( ListSnapshotsRequest request, StreamObserver responseObserver) { - Object response = responses.remove(); + Object response = responses.poll(); if (response instanceof ListSnapshotsResponse) { requests.add(request); - responseObserver.onNext((ListSnapshotsResponse) response); + responseObserver.onNext(((ListSnapshotsResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { - responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method ListSnapshots, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + ListSnapshotsResponse.class.getName(), + Exception.class.getName()))); } } @Override public void createSnapshot( CreateSnapshotRequest request, StreamObserver responseObserver) { - Object response = responses.remove(); + Object response = responses.poll(); if (response instanceof Snapshot) { requests.add(request); - responseObserver.onNext((Snapshot) response); + responseObserver.onNext(((Snapshot) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { - responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method CreateSnapshot, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Snapshot.class.getName(), + Exception.class.getName()))); } } @Override public void updateSnapshot( UpdateSnapshotRequest request, StreamObserver responseObserver) { - Object response = responses.remove(); + Object response = responses.poll(); if (response instanceof Snapshot) { requests.add(request); - responseObserver.onNext((Snapshot) response); + responseObserver.onNext(((Snapshot) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { - responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method UpdateSnapshot, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Snapshot.class.getName(), + Exception.class.getName()))); } } @Override public void deleteSnapshot( DeleteSnapshotRequest request, StreamObserver responseObserver) { - Object response = responses.remove(); + Object response = responses.poll(); if (response instanceof Empty) { requests.add(request); - responseObserver.onNext((Empty) response); + responseObserver.onNext(((Empty) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { - responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method DeleteSnapshot, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Empty.class.getName(), + Exception.class.getName()))); } } @Override public void seek(SeekRequest request, StreamObserver responseObserver) { - Object response = responses.remove(); + Object response = responses.poll(); if (response instanceof SeekResponse) { requests.add(request); - responseObserver.onNext((SeekResponse) response); + responseObserver.onNext(((SeekResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { - responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method Seek, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + SeekResponse.class.getName(), + Exception.class.getName()))); } } } diff --git a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/OpenTelemetryTest.java b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/OpenTelemetryTest.java new file mode 100644 index 000000000..52351ddef --- /dev/null +++ b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/OpenTelemetryTest.java @@ -0,0 +1,665 @@ +/* + * Copyright 2024 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.assertTrue; + +import com.google.protobuf.ByteString; +import com.google.pubsub.v1.PubsubMessage; +import com.google.pubsub.v1.SubscriptionName; +import com.google.pubsub.v1.TopicName; +import io.opentelemetry.api.trace.Span; +import io.opentelemetry.api.trace.SpanKind; +import io.opentelemetry.api.trace.StatusCode; +import io.opentelemetry.api.trace.Tracer; +import io.opentelemetry.sdk.testing.assertj.AttributesAssert; +import io.opentelemetry.sdk.testing.assertj.EventDataAssert; +import io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions; +import io.opentelemetry.sdk.testing.assertj.SpanDataAssert; +import io.opentelemetry.sdk.testing.junit4.OpenTelemetryRule; +import io.opentelemetry.sdk.trace.data.LinkData; +import io.opentelemetry.sdk.trace.data.SpanData; +import io.opentelemetry.sdk.trace.data.StatusData; +import java.util.Arrays; +import java.util.List; +import org.junit.Test; + +public class OpenTelemetryTest { + private static final TopicName FULL_TOPIC_NAME = + TopicName.parse("projects/test-project/topics/test-topic"); + private static final SubscriptionName FULL_SUBSCRIPTION_NAME = + SubscriptionName.parse("projects/test-project/subscriptions/test-sub"); + private static final String PROJECT_NAME = "test-project"; + private static final String ORDERING_KEY = "abc"; + private static final String MESSAGE_ID = "m0"; + private static final String ACK_ID = "def"; + private static final int DELIVERY_ATTEMPT = 1; + private static final int ACK_DEADLINE = 10; + private static final boolean EXACTLY_ONCE_ENABLED = true; + + private static final String PUBLISHER_SPAN_NAME = FULL_TOPIC_NAME.getTopic() + " create"; + private static final String PUBLISH_FLOW_CONTROL_SPAN_NAME = "publisher flow control"; + private static final String PUBLISH_BATCHING_SPAN_NAME = "publisher batching"; + private static final String PUBLISH_RPC_SPAN_NAME = FULL_TOPIC_NAME.getTopic() + " publish"; + private static final String PUBLISH_START_EVENT = "publish start"; + private static final String PUBLISH_END_EVENT = "publish end"; + + private static final String SUBSCRIBER_SPAN_NAME = + FULL_SUBSCRIPTION_NAME.getSubscription() + " subscribe"; + private static final String SUBSCRIBE_CONCURRENCY_CONTROL_SPAN_NAME = + "subscriber concurrency control"; + private static final String SUBSCRIBE_SCHEDULER_SPAN_NAME = "subscriber scheduler"; + private static final String SUBSCRIBE_PROCESS_SPAN_NAME = + FULL_SUBSCRIPTION_NAME.getSubscription() + " process"; + private static final String SUBSCRIBE_MODACK_RPC_SPAN_NAME = + FULL_SUBSCRIPTION_NAME.getSubscription() + " modack"; + private static final String SUBSCRIBE_ACK_RPC_SPAN_NAME = + FULL_SUBSCRIPTION_NAME.getSubscription() + " ack"; + private static final String SUBSCRIBE_NACK_RPC_SPAN_NAME = + FULL_SUBSCRIPTION_NAME.getSubscription() + " nack"; + + private static final String PROCESS_ACTION = "ack"; + private static final String MODACK_START_EVENT = "modack start"; + private static final String MODACK_END_EVENT = "modack end"; + private static final String NACK_START_EVENT = "nack start"; + private static final String NACK_END_EVENT = "nack end"; + private static final String ACK_START_EVENT = "ack start"; + private static final String ACK_END_EVENT = "ack end"; + + private static final String MESSAGING_SYSTEM_ATTR_KEY = "messaging.system"; + private static final String MESSAGING_DESTINATION_NAME_ATTR_KEY = "messaging.destination.name"; + private static final String CODE_FUNCTION_ATTR_KEY = "code.function"; + private static final String MESSAGING_OPERATION_ATTR_KEY = "messaging.operation"; + private static final String MESSAGING_BATCH_MESSAGE_COUNT_ATTR_KEY = + "messaging.batch.message_count"; + private static final String MESSAGING_MESSAGE_ID_ATTR_KEY = "messaging.message.id"; + private static final String MESSAGING_SYSTEM_VALUE = "gcp_pubsub"; + private static final String PROJECT_ATTR_KEY = "gcp.project_id"; + private static final String MESSAGE_SIZE_ATTR_KEY = "messaging.message.body.size"; + private static final String ORDERING_KEY_ATTR_KEY = "messaging.gcp_pubsub.message.ordering_key"; + private static final String ACK_DEADLINE_ATTR_KEY = "messaging.gcp_pubsub.message.ack_deadline"; + private static final String RECEIPT_MODACK_ATTR_KEY = "messaging.gcp_pubsub.is_receipt_modack"; + private static final String MESSAGE_ACK_ID_ATTR_KEY = "messaging.gcp_pubsub.message.ack_id"; + private static final String MESSAGE_EXACTLY_ONCE_ATTR_KEY = + "messaging.gcp_pubsub.message.exactly_once_delivery"; + private static final String MESSAGE_RESULT_ATTR_KEY = "messaging.gcp_pubsub.result"; + private static final String MESSAGE_DELIVERY_ATTEMPT_ATTR_KEY = + "messaging.gcp_pubsub.message.delivery_attempt"; + + private static final String TRACEPARENT_ATTRIBUTE = "googclient_traceparent"; + + private static final OpenTelemetryRule openTelemetryTesting = OpenTelemetryRule.create(); + + @Test + public void testPublishSpansSuccess() { + openTelemetryTesting.clearSpans(); + + PubsubMessageWrapper messageWrapper = + PubsubMessageWrapper.newBuilder(getPubsubMessage(), FULL_TOPIC_NAME).build(); + List messageWrappers = Arrays.asList(messageWrapper); + + long messageSize = messageWrapper.getPubsubMessage().getData().size(); + Tracer openTelemetryTracer = openTelemetryTesting.getOpenTelemetry().getTracer("test"); + OpenTelemetryPubsubTracer tracer = new OpenTelemetryPubsubTracer(openTelemetryTracer, true); + + // Call all span start/end methods in the expected order + tracer.startPublisherSpan(messageWrapper); + tracer.startPublishFlowControlSpan(messageWrapper); + tracer.endPublishFlowControlSpan(messageWrapper); + tracer.startPublishBatchingSpan(messageWrapper); + tracer.endPublishBatchingSpan(messageWrapper); + Span publishRpcSpan = tracer.startPublishRpcSpan(FULL_TOPIC_NAME, messageWrappers); + tracer.endPublishRpcSpan(publishRpcSpan); + tracer.setPublisherMessageIdSpanAttribute(messageWrapper, MESSAGE_ID); + tracer.endPublisherSpan(messageWrapper); + + List allSpans = openTelemetryTesting.getSpans(); + assertEquals(4, allSpans.size()); + SpanData flowControlSpanData = allSpans.get(0); + SpanData batchingSpanData = allSpans.get(1); + SpanData publishRpcSpanData = allSpans.get(2); + SpanData publisherSpanData = allSpans.get(3); + + SpanDataAssert flowControlSpanDataAssert = + OpenTelemetryAssertions.assertThat(flowControlSpanData); + flowControlSpanDataAssert + .hasName(PUBLISH_FLOW_CONTROL_SPAN_NAME) + .hasParent(publisherSpanData) + .hasEnded(); + + SpanDataAssert batchingSpanDataAssert = OpenTelemetryAssertions.assertThat(batchingSpanData); + batchingSpanDataAssert + .hasName(PUBLISH_BATCHING_SPAN_NAME) + .hasParent(publisherSpanData) + .hasEnded(); + + // Check span data, links, and attributes for the publish RPC span + SpanDataAssert publishRpcSpanDataAssert = + OpenTelemetryAssertions.assertThat(publishRpcSpanData); + publishRpcSpanDataAssert + .hasName(PUBLISH_RPC_SPAN_NAME) + .hasKind(SpanKind.CLIENT) + .hasNoParent() + .hasEnded(); + + List publishRpcLinks = publishRpcSpanData.getLinks(); + assertEquals(messageWrappers.size(), publishRpcLinks.size()); + assertEquals(publisherSpanData.getSpanContext(), publishRpcLinks.get(0).getSpanContext()); + + assertEquals(6, publishRpcSpanData.getAttributes().size()); + AttributesAssert publishRpcSpanAttributesAssert = + OpenTelemetryAssertions.assertThat(publishRpcSpanData.getAttributes()); + publishRpcSpanAttributesAssert + .containsEntry(MESSAGING_SYSTEM_ATTR_KEY, MESSAGING_SYSTEM_VALUE) + .containsEntry(MESSAGING_DESTINATION_NAME_ATTR_KEY, FULL_TOPIC_NAME.getTopic()) + .containsEntry(PROJECT_ATTR_KEY, FULL_TOPIC_NAME.getProject()) + .containsEntry(CODE_FUNCTION_ATTR_KEY, "publishCall") + .containsEntry(MESSAGING_OPERATION_ATTR_KEY, "publish") + .containsEntry(MESSAGING_BATCH_MESSAGE_COUNT_ATTR_KEY, messageWrappers.size()); + + // Check span data, events, links, and attributes for the publisher create span + SpanDataAssert publisherSpanDataAssert = OpenTelemetryAssertions.assertThat(publisherSpanData); + publisherSpanDataAssert + .hasName(PUBLISHER_SPAN_NAME) + .hasKind(SpanKind.PRODUCER) + .hasNoParent() + .hasEnded(); + + assertEquals(2, publisherSpanData.getEvents().size()); + EventDataAssert startEventAssert = + OpenTelemetryAssertions.assertThat(publisherSpanData.getEvents().get(0)); + startEventAssert.hasName(PUBLISH_START_EVENT); + EventDataAssert endEventAssert = + OpenTelemetryAssertions.assertThat(publisherSpanData.getEvents().get(1)); + endEventAssert.hasName(PUBLISH_END_EVENT); + + List publisherLinks = publisherSpanData.getLinks(); + assertEquals(1, publisherLinks.size()); + assertEquals(publishRpcSpanData.getSpanContext(), publisherLinks.get(0).getSpanContext()); + + assertEquals(8, publisherSpanData.getAttributes().size()); + AttributesAssert publisherSpanAttributesAssert = + OpenTelemetryAssertions.assertThat(publisherSpanData.getAttributes()); + publisherSpanAttributesAssert + .containsEntry(MESSAGING_SYSTEM_ATTR_KEY, MESSAGING_SYSTEM_VALUE) + .containsEntry(MESSAGING_DESTINATION_NAME_ATTR_KEY, FULL_TOPIC_NAME.getTopic()) + .containsEntry(PROJECT_ATTR_KEY, PROJECT_NAME) + .containsEntry(CODE_FUNCTION_ATTR_KEY, "publish") + .containsEntry(MESSAGING_OPERATION_ATTR_KEY, "create") + .containsEntry(ORDERING_KEY_ATTR_KEY, ORDERING_KEY) + .containsEntry(MESSAGE_SIZE_ATTR_KEY, messageSize) + .containsEntry(MESSAGING_MESSAGE_ID_ATTR_KEY, MESSAGE_ID); + + // Check that the message has the attribute containing the trace context. + PubsubMessage message = messageWrapper.getPubsubMessage(); + assertEquals(1, message.getAttributesMap().size()); + assertTrue(message.containsAttributes(TRACEPARENT_ATTRIBUTE)); + assertTrue( + message + .getAttributesOrDefault(TRACEPARENT_ATTRIBUTE, "") + .contains(publisherSpanData.getTraceId())); + assertTrue( + message + .getAttributesOrDefault(TRACEPARENT_ATTRIBUTE, "") + .contains(publisherSpanData.getSpanId())); + } + + @Test + public void testPublishFlowControlSpanFailure() { + openTelemetryTesting.clearSpans(); + + PubsubMessageWrapper messageWrapper = + PubsubMessageWrapper.newBuilder(getPubsubMessage(), FULL_TOPIC_NAME).build(); + + Tracer openTelemetryTracer = openTelemetryTesting.getOpenTelemetry().getTracer("test"); + OpenTelemetryPubsubTracer tracer = new OpenTelemetryPubsubTracer(openTelemetryTracer, true); + + tracer.startPublisherSpan(messageWrapper); + tracer.startPublishFlowControlSpan(messageWrapper); + + Exception e = new Exception("test-exception"); + tracer.setPublishFlowControlSpanException(messageWrapper, e); + + List allSpans = openTelemetryTesting.getSpans(); + assertEquals(2, allSpans.size()); + SpanData flowControlSpanData = allSpans.get(0); + SpanData publisherSpanData = allSpans.get(1); + + SpanDataAssert flowControlSpanDataAssert = + OpenTelemetryAssertions.assertThat(flowControlSpanData); + StatusData expectedStatus = + StatusData.create(StatusCode.ERROR, "Exception thrown during publish flow control."); + flowControlSpanDataAssert + .hasName(PUBLISH_FLOW_CONTROL_SPAN_NAME) + .hasParent(publisherSpanData) + .hasStatus(expectedStatus) + .hasException(e) + .hasEnded(); + + SpanDataAssert publisherSpanDataAssert = OpenTelemetryAssertions.assertThat(publisherSpanData); + publisherSpanDataAssert + .hasName(PUBLISHER_SPAN_NAME) + .hasKind(SpanKind.PRODUCER) + .hasNoParent() + .hasEnded(); + } + + @Test + public void testPublishRpcSpanFailure() { + openTelemetryTesting.clearSpans(); + + PubsubMessageWrapper messageWrapper = + PubsubMessageWrapper.newBuilder(getPubsubMessage(), FULL_TOPIC_NAME).build(); + + List messageWrappers = Arrays.asList(messageWrapper); + Tracer openTelemetryTracer = openTelemetryTesting.getOpenTelemetry().getTracer("test"); + OpenTelemetryPubsubTracer tracer = new OpenTelemetryPubsubTracer(openTelemetryTracer, true); + + tracer.startPublisherSpan(messageWrapper); + Span publishRpcSpan = tracer.startPublishRpcSpan(FULL_TOPIC_NAME, messageWrappers); + + Exception e = new Exception("test-exception"); + tracer.setPublishRpcSpanException(publishRpcSpan, e); + tracer.endPublisherSpan(messageWrapper); + + List allSpans = openTelemetryTesting.getSpans(); + assertEquals(2, allSpans.size()); + SpanData rpcSpanData = allSpans.get(0); + SpanData publisherSpanData = allSpans.get(1); + + SpanDataAssert rpcSpanDataAssert = OpenTelemetryAssertions.assertThat(rpcSpanData); + StatusData expectedStatus = + StatusData.create(StatusCode.ERROR, "Exception thrown on publish RPC."); + rpcSpanDataAssert + .hasName(PUBLISH_RPC_SPAN_NAME) + .hasKind(SpanKind.CLIENT) + .hasStatus(expectedStatus) + .hasException(e) + .hasEnded(); + + SpanDataAssert publisherSpanDataAssert = OpenTelemetryAssertions.assertThat(publisherSpanData); + publisherSpanDataAssert + .hasName(PUBLISHER_SPAN_NAME) + .hasKind(SpanKind.PRODUCER) + .hasNoParent() + .hasEnded(); + } + + @Test + public void testSubscribeSpansSuccess() { + openTelemetryTesting.clearSpans(); + + Tracer openTelemetryTracer = openTelemetryTesting.getOpenTelemetry().getTracer("test"); + OpenTelemetryPubsubTracer tracer = new OpenTelemetryPubsubTracer(openTelemetryTracer, true); + + PubsubMessageWrapper publishMessageWrapper = + PubsubMessageWrapper.newBuilder(getPubsubMessage(), FULL_TOPIC_NAME).build(); + // Initialize the Publisher span to inject the context in the message + tracer.startPublisherSpan(publishMessageWrapper); + tracer.endPublisherSpan(publishMessageWrapper); + + PubsubMessage publishedMessage = + publishMessageWrapper.getPubsubMessage().toBuilder().setMessageId(MESSAGE_ID).build(); + PubsubMessageWrapper subscribeMessageWrapper = + PubsubMessageWrapper.newBuilder(publishedMessage, FULL_SUBSCRIPTION_NAME, ACK_ID, 1) + .build(); + List subscribeMessageWrappers = Arrays.asList(subscribeMessageWrapper); + + long messageSize = subscribeMessageWrapper.getPubsubMessage().getData().size(); + + // Call all span start/end methods in the expected order + tracer.startSubscriberSpan(subscribeMessageWrapper, EXACTLY_ONCE_ENABLED); + tracer.startSubscribeConcurrencyControlSpan(subscribeMessageWrapper); + tracer.endSubscribeConcurrencyControlSpan(subscribeMessageWrapper); + tracer.startSubscribeSchedulerSpan(subscribeMessageWrapper); + tracer.endSubscribeSchedulerSpan(subscribeMessageWrapper); + tracer.startSubscribeProcessSpan(subscribeMessageWrapper); + tracer.endSubscribeProcessSpan(subscribeMessageWrapper, PROCESS_ACTION); + Span subscribeModackRpcSpan = + tracer.startSubscribeRpcSpan( + FULL_SUBSCRIPTION_NAME, "modack", subscribeMessageWrappers, ACK_DEADLINE, true); + tracer.endSubscribeRpcSpan(subscribeModackRpcSpan); + tracer.addEndRpcEvent(subscribeMessageWrapper, true, true, ACK_DEADLINE); + Span subscribeAckRpcSpan = + tracer.startSubscribeRpcSpan( + FULL_SUBSCRIPTION_NAME, "ack", subscribeMessageWrappers, 0, false); + tracer.endSubscribeRpcSpan(subscribeAckRpcSpan); + tracer.addEndRpcEvent(subscribeMessageWrapper, true, false, 0); + Span subscribeNackRpcSpan = + tracer.startSubscribeRpcSpan( + FULL_SUBSCRIPTION_NAME, "nack", subscribeMessageWrappers, 0, false); + tracer.endSubscribeRpcSpan(subscribeNackRpcSpan); + tracer.addEndRpcEvent(subscribeMessageWrapper, true, true, 0); + tracer.endSubscriberSpan(subscribeMessageWrapper); + + List allSpans = openTelemetryTesting.getSpans(); + assertEquals(8, allSpans.size()); + + SpanData publisherSpanData = allSpans.get(0); + SpanData concurrencyControlSpanData = allSpans.get(1); + SpanData schedulerSpanData = allSpans.get(2); + SpanData processSpanData = allSpans.get(3); + SpanData modackRpcSpanData = allSpans.get(4); + SpanData ackRpcSpanData = allSpans.get(5); + SpanData nackRpcSpanData = allSpans.get(6); + SpanData subscriberSpanData = allSpans.get(7); + + SpanDataAssert concurrencyControlSpanDataAssert = + OpenTelemetryAssertions.assertThat(concurrencyControlSpanData); + concurrencyControlSpanDataAssert + .hasName(SUBSCRIBE_CONCURRENCY_CONTROL_SPAN_NAME) + .hasParent(subscriberSpanData) + .hasEnded(); + + SpanDataAssert schedulerSpanDataAssert = OpenTelemetryAssertions.assertThat(schedulerSpanData); + schedulerSpanDataAssert + .hasName(SUBSCRIBE_SCHEDULER_SPAN_NAME) + .hasParent(subscriberSpanData) + .hasEnded(); + + SpanDataAssert processSpanDataAssert = OpenTelemetryAssertions.assertThat(processSpanData); + processSpanDataAssert + .hasName(SUBSCRIBE_PROCESS_SPAN_NAME) + .hasParent(subscriberSpanData) + .hasEnded(); + + assertEquals(1, processSpanData.getEvents().size()); + EventDataAssert actionCalledEventAssert = + OpenTelemetryAssertions.assertThat(processSpanData.getEvents().get(0)); + actionCalledEventAssert.hasName(PROCESS_ACTION + " called"); + + // Check span data, links, and attributes for the modack RPC span + SpanDataAssert modackRpcSpanDataAssert = OpenTelemetryAssertions.assertThat(modackRpcSpanData); + modackRpcSpanDataAssert + .hasName(SUBSCRIBE_MODACK_RPC_SPAN_NAME) + .hasKind(SpanKind.CLIENT) + .hasNoParent() + .hasEnded(); + + List modackRpcLinks = modackRpcSpanData.getLinks(); + assertEquals(subscribeMessageWrappers.size(), modackRpcLinks.size()); + assertEquals(subscriberSpanData.getSpanContext(), modackRpcLinks.get(0).getSpanContext()); + + assertEquals(8, modackRpcSpanData.getAttributes().size()); + AttributesAssert modackRpcSpanAttributesAssert = + OpenTelemetryAssertions.assertThat(modackRpcSpanData.getAttributes()); + modackRpcSpanAttributesAssert + .containsEntry(MESSAGING_SYSTEM_ATTR_KEY, MESSAGING_SYSTEM_VALUE) + .containsEntry( + MESSAGING_DESTINATION_NAME_ATTR_KEY, FULL_SUBSCRIPTION_NAME.getSubscription()) + .containsEntry(PROJECT_ATTR_KEY, FULL_TOPIC_NAME.getProject()) + .containsEntry(CODE_FUNCTION_ATTR_KEY, "sendModAckOperations") + .containsEntry(MESSAGING_OPERATION_ATTR_KEY, "modack") + .containsEntry(MESSAGING_BATCH_MESSAGE_COUNT_ATTR_KEY, subscribeMessageWrappers.size()) + .containsEntry(ACK_DEADLINE_ATTR_KEY, 10) + .containsEntry(RECEIPT_MODACK_ATTR_KEY, true); + + // Check span data, links, and attributes for the ack RPC span + SpanDataAssert ackRpcSpanDataAssert = OpenTelemetryAssertions.assertThat(ackRpcSpanData); + ackRpcSpanDataAssert + .hasName(SUBSCRIBE_ACK_RPC_SPAN_NAME) + .hasKind(SpanKind.CLIENT) + .hasNoParent() + .hasEnded(); + + List ackRpcLinks = ackRpcSpanData.getLinks(); + assertEquals(subscribeMessageWrappers.size(), ackRpcLinks.size()); + assertEquals(subscriberSpanData.getSpanContext(), ackRpcLinks.get(0).getSpanContext()); + + assertEquals(6, ackRpcSpanData.getAttributes().size()); + AttributesAssert ackRpcSpanAttributesAssert = + OpenTelemetryAssertions.assertThat(ackRpcSpanData.getAttributes()); + ackRpcSpanAttributesAssert + .containsEntry(MESSAGING_SYSTEM_ATTR_KEY, MESSAGING_SYSTEM_VALUE) + .containsEntry( + MESSAGING_DESTINATION_NAME_ATTR_KEY, FULL_SUBSCRIPTION_NAME.getSubscription()) + .containsEntry(PROJECT_ATTR_KEY, FULL_TOPIC_NAME.getProject()) + .containsEntry(CODE_FUNCTION_ATTR_KEY, "sendAckOperations") + .containsEntry(MESSAGING_OPERATION_ATTR_KEY, "ack") + .containsEntry(MESSAGING_BATCH_MESSAGE_COUNT_ATTR_KEY, subscribeMessageWrappers.size()); + + // Check span data, links, and attributes for the nack RPC span + SpanDataAssert nackRpcSpanDataAssert = OpenTelemetryAssertions.assertThat(nackRpcSpanData); + nackRpcSpanDataAssert + .hasName(SUBSCRIBE_NACK_RPC_SPAN_NAME) + .hasKind(SpanKind.CLIENT) + .hasNoParent() + .hasEnded(); + + List nackRpcLinks = nackRpcSpanData.getLinks(); + assertEquals(subscribeMessageWrappers.size(), nackRpcLinks.size()); + assertEquals(subscriberSpanData.getSpanContext(), nackRpcLinks.get(0).getSpanContext()); + + assertEquals(6, nackRpcSpanData.getAttributes().size()); + AttributesAssert nackRpcSpanAttributesAssert = + OpenTelemetryAssertions.assertThat(nackRpcSpanData.getAttributes()); + nackRpcSpanAttributesAssert + .containsEntry(MESSAGING_SYSTEM_ATTR_KEY, MESSAGING_SYSTEM_VALUE) + .containsEntry( + MESSAGING_DESTINATION_NAME_ATTR_KEY, FULL_SUBSCRIPTION_NAME.getSubscription()) + .containsEntry(PROJECT_ATTR_KEY, FULL_TOPIC_NAME.getProject()) + .containsEntry(CODE_FUNCTION_ATTR_KEY, "sendModAckOperations") + .containsEntry(MESSAGING_OPERATION_ATTR_KEY, "nack") + .containsEntry(MESSAGING_BATCH_MESSAGE_COUNT_ATTR_KEY, subscribeMessageWrappers.size()); + + // Check span data, events, links, and attributes for the publisher create span + SpanDataAssert subscriberSpanDataAssert = + OpenTelemetryAssertions.assertThat(subscriberSpanData); + subscriberSpanDataAssert + .hasName(SUBSCRIBER_SPAN_NAME) + .hasKind(SpanKind.CONSUMER) + .hasParent(publisherSpanData) + .hasEnded(); + + assertEquals(6, subscriberSpanData.getEvents().size()); + EventDataAssert startModackEventAssert = + OpenTelemetryAssertions.assertThat(subscriberSpanData.getEvents().get(0)); + startModackEventAssert.hasName(MODACK_START_EVENT); + EventDataAssert endModackEventAssert = + OpenTelemetryAssertions.assertThat(subscriberSpanData.getEvents().get(1)); + endModackEventAssert.hasName(MODACK_END_EVENT); + EventDataAssert startAckEventAssert = + OpenTelemetryAssertions.assertThat(subscriberSpanData.getEvents().get(2)); + startAckEventAssert.hasName(ACK_START_EVENT); + EventDataAssert endAckEventAssert = + OpenTelemetryAssertions.assertThat(subscriberSpanData.getEvents().get(3)); + endAckEventAssert.hasName(ACK_END_EVENT); + EventDataAssert startNackEventAssert = + OpenTelemetryAssertions.assertThat(subscriberSpanData.getEvents().get(4)); + startNackEventAssert.hasName(NACK_START_EVENT); + EventDataAssert endNackEventAssert = + OpenTelemetryAssertions.assertThat(subscriberSpanData.getEvents().get(5)); + endNackEventAssert.hasName(NACK_END_EVENT); + + List subscriberLinks = subscriberSpanData.getLinks(); + assertEquals(3, subscriberLinks.size()); + assertEquals(modackRpcSpanData.getSpanContext(), subscriberLinks.get(0).getSpanContext()); + assertEquals(ackRpcSpanData.getSpanContext(), subscriberLinks.get(1).getSpanContext()); + assertEquals(nackRpcSpanData.getSpanContext(), subscriberLinks.get(2).getSpanContext()); + + assertEquals(11, subscriberSpanData.getAttributes().size()); + AttributesAssert subscriberSpanAttributesAssert = + OpenTelemetryAssertions.assertThat(subscriberSpanData.getAttributes()); + subscriberSpanAttributesAssert + .containsEntry(MESSAGING_SYSTEM_ATTR_KEY, MESSAGING_SYSTEM_VALUE) + .containsEntry( + MESSAGING_DESTINATION_NAME_ATTR_KEY, FULL_SUBSCRIPTION_NAME.getSubscription()) + .containsEntry(PROJECT_ATTR_KEY, PROJECT_NAME) + .containsEntry(CODE_FUNCTION_ATTR_KEY, "onResponse") + .containsEntry(MESSAGE_SIZE_ATTR_KEY, messageSize) + .containsEntry(ORDERING_KEY_ATTR_KEY, ORDERING_KEY) + .containsEntry(MESSAGE_ACK_ID_ATTR_KEY, ACK_ID) + .containsEntry(MESSAGE_DELIVERY_ATTEMPT_ATTR_KEY, DELIVERY_ATTEMPT) + .containsEntry(MESSAGE_EXACTLY_ONCE_ATTR_KEY, EXACTLY_ONCE_ENABLED) + .containsEntry(MESSAGE_RESULT_ATTR_KEY, PROCESS_ACTION) + .containsEntry(MESSAGING_MESSAGE_ID_ATTR_KEY, MESSAGE_ID); + } + + @Test + public void testSubscribeConcurrencyControlSpanFailure() { + openTelemetryTesting.clearSpans(); + + PubsubMessageWrapper messageWrapper = + PubsubMessageWrapper.newBuilder( + getPubsubMessage(), FULL_SUBSCRIPTION_NAME, ACK_ID, DELIVERY_ATTEMPT) + .build(); + + Tracer openTelemetryTracer = openTelemetryTesting.getOpenTelemetry().getTracer("test"); + OpenTelemetryPubsubTracer tracer = new OpenTelemetryPubsubTracer(openTelemetryTracer, true); + + tracer.startSubscriberSpan(messageWrapper, EXACTLY_ONCE_ENABLED); + tracer.startSubscribeConcurrencyControlSpan(messageWrapper); + + Exception e = new Exception("test-exception"); + tracer.setSubscribeConcurrencyControlSpanException(messageWrapper, e); + + List allSpans = openTelemetryTesting.getSpans(); + assertEquals(2, allSpans.size()); + SpanData concurrencyControlSpanData = allSpans.get(0); + SpanData subscriberSpanData = allSpans.get(1); + + SpanDataAssert concurrencyControlSpanDataAssert = + OpenTelemetryAssertions.assertThat(concurrencyControlSpanData); + StatusData expectedStatus = + StatusData.create( + StatusCode.ERROR, "Exception thrown during subscribe concurrency control."); + concurrencyControlSpanDataAssert + .hasName(SUBSCRIBE_CONCURRENCY_CONTROL_SPAN_NAME) + .hasParent(subscriberSpanData) + .hasStatus(expectedStatus) + .hasException(e) + .hasEnded(); + + SpanDataAssert subscriberSpanDataAssert = + OpenTelemetryAssertions.assertThat(subscriberSpanData); + subscriberSpanDataAssert + .hasName(SUBSCRIBER_SPAN_NAME) + .hasKind(SpanKind.CONSUMER) + .hasNoParent() + .hasEnded(); + } + + @Test + public void testSubscriberSpanFailure() { + openTelemetryTesting.clearSpans(); + + PubsubMessageWrapper messageWrapper = + PubsubMessageWrapper.newBuilder( + getPubsubMessage(), FULL_SUBSCRIPTION_NAME, ACK_ID, DELIVERY_ATTEMPT) + .build(); + + Tracer openTelemetryTracer = openTelemetryTesting.getOpenTelemetry().getTracer("test"); + OpenTelemetryPubsubTracer tracer = new OpenTelemetryPubsubTracer(openTelemetryTracer, true); + + tracer.startSubscriberSpan(messageWrapper, EXACTLY_ONCE_ENABLED); + + Exception e = new Exception("test-exception"); + tracer.setSubscriberSpanException(messageWrapper, e, "Test exception"); + + List allSpans = openTelemetryTesting.getSpans(); + assertEquals(1, allSpans.size()); + SpanData subscriberSpanData = allSpans.get(0); + + StatusData expectedStatus = StatusData.create(StatusCode.ERROR, "Test exception"); + SpanDataAssert subscriberSpanDataAssert = + OpenTelemetryAssertions.assertThat(subscriberSpanData); + subscriberSpanDataAssert + .hasName(SUBSCRIBER_SPAN_NAME) + .hasKind(SpanKind.CONSUMER) + .hasNoParent() + .hasStatus(expectedStatus) + .hasException(e) + .hasEnded(); + } + + @Test + public void testSubscribeRpcSpanFailures() { + openTelemetryTesting.clearSpans(); + + PubsubMessageWrapper messageWrapper = + PubsubMessageWrapper.newBuilder( + getPubsubMessage(), FULL_SUBSCRIPTION_NAME, ACK_ID, DELIVERY_ATTEMPT) + .build(); + List messageWrappers = Arrays.asList(messageWrapper); + + Tracer openTelemetryTracer = openTelemetryTesting.getOpenTelemetry().getTracer("test"); + OpenTelemetryPubsubTracer tracer = new OpenTelemetryPubsubTracer(openTelemetryTracer, true); + + tracer.startSubscriberSpan(messageWrapper, EXACTLY_ONCE_ENABLED); + Span subscribeModackRpcSpan = + tracer.startSubscribeRpcSpan( + FULL_SUBSCRIPTION_NAME, "modack", messageWrappers, ACK_DEADLINE, true); + Span subscribeAckRpcSpan = + tracer.startSubscribeRpcSpan(FULL_SUBSCRIPTION_NAME, "ack", messageWrappers, 0, false); + Span subscribeNackRpcSpan = + tracer.startSubscribeRpcSpan(FULL_SUBSCRIPTION_NAME, "nack", messageWrappers, 0, false); + + Exception e = new Exception("test-exception"); + tracer.setSubscribeRpcSpanException(subscribeModackRpcSpan, true, ACK_DEADLINE, e); + tracer.setSubscribeRpcSpanException(subscribeAckRpcSpan, false, 0, e); + tracer.setSubscribeRpcSpanException(subscribeNackRpcSpan, true, 0, e); + tracer.endSubscriberSpan(messageWrapper); + + List allSpans = openTelemetryTesting.getSpans(); + assertEquals(4, allSpans.size()); + SpanData modackSpanData = allSpans.get(0); + SpanData ackSpanData = allSpans.get(1); + SpanData nackSpanData = allSpans.get(2); + SpanData subscriberSpanData = allSpans.get(3); + + StatusData expectedModackStatus = + StatusData.create(StatusCode.ERROR, "Exception thrown on modack RPC."); + SpanDataAssert modackSpanDataAssert = OpenTelemetryAssertions.assertThat(modackSpanData); + modackSpanDataAssert + .hasName(SUBSCRIBE_MODACK_RPC_SPAN_NAME) + .hasKind(SpanKind.CLIENT) + .hasNoParent() + .hasStatus(expectedModackStatus) + .hasException(e) + .hasEnded(); + + StatusData expectedAckStatus = + StatusData.create(StatusCode.ERROR, "Exception thrown on ack RPC."); + SpanDataAssert ackSpanDataAssert = OpenTelemetryAssertions.assertThat(ackSpanData); + ackSpanDataAssert + .hasName(SUBSCRIBE_ACK_RPC_SPAN_NAME) + .hasKind(SpanKind.CLIENT) + .hasNoParent() + .hasStatus(expectedAckStatus) + .hasException(e) + .hasEnded(); + + StatusData expectedNackStatus = + StatusData.create(StatusCode.ERROR, "Exception thrown on nack RPC."); + SpanDataAssert nackSpanDataAssert = OpenTelemetryAssertions.assertThat(nackSpanData); + nackSpanDataAssert + .hasName(SUBSCRIBE_NACK_RPC_SPAN_NAME) + .hasKind(SpanKind.CLIENT) + .hasNoParent() + .hasStatus(expectedNackStatus) + .hasException(e) + .hasEnded(); + } + + private PubsubMessage getPubsubMessage() { + return PubsubMessage.newBuilder() + .setData(ByteString.copyFromUtf8("test-data")) + .setOrderingKey(ORDERING_KEY) + .build(); + } +} diff --git a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/PublisherImplTest.java b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/PublisherImplTest.java index 3da657061..39155c848 100644 --- a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/PublisherImplTest.java +++ b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/PublisherImplTest.java @@ -48,6 +48,13 @@ import io.grpc.StatusException; import io.grpc.inprocess.InProcessChannelBuilder; import io.grpc.inprocess.InProcessServerBuilder; +import io.opentelemetry.api.OpenTelemetry; +import io.opentelemetry.api.trace.SpanKind; +import io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions; +import io.opentelemetry.sdk.testing.assertj.SpanDataAssert; +import io.opentelemetry.sdk.testing.junit4.OpenTelemetryRule; +import io.opentelemetry.sdk.trace.data.SpanData; +import java.time.Duration; import java.util.List; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutionException; @@ -56,12 +63,10 @@ import java.util.concurrent.TimeUnit; import org.easymock.EasyMock; import org.junit.After; -import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import org.threeten.bp.Duration; @RunWith(JUnit4.class) public class PublisherImplTest { @@ -75,6 +80,11 @@ public class PublisherImplTest { private static final TransportChannelProvider TEST_CHANNEL_PROVIDER = LocalChannelProvider.create("test-server"); + private static final String PUBLISHER_SPAN_NAME = TEST_TOPIC.getTopic() + " create"; + private static final String PUBLISH_FLOW_CONTROL_SPAN_NAME = "publisher flow control"; + private static final String PUBLISH_BATCHING_SPAN_NAME = "publisher batching"; + private static final String PUBLISH_RPC_SPAN_NAME = TEST_TOPIC.getTopic() + " publish"; + private FakeScheduledExecutorService fakeExecutor; private FakePublisherServiceImpl testPublisherServiceImpl; @@ -108,9 +118,8 @@ public void testPublishByDuration() throws Exception { getTestPublisherBuilder() // To demonstrate that reaching duration will trigger publish .setBatchingSettings( - Publisher.Builder.DEFAULT_BATCHING_SETTINGS - .toBuilder() - .setDelayThreshold(Duration.ofSeconds(5)) + Publisher.Builder.DEFAULT_BATCHING_SETTINGS.toBuilder() + .setDelayThresholdDuration(Duration.ofSeconds(5)) .setElementCountThreshold(10L) .build()) .build(); @@ -138,10 +147,9 @@ public void testPublishByNumBatchedMessages() throws Exception { Publisher publisher = getTestPublisherBuilder() .setBatchingSettings( - Publisher.Builder.DEFAULT_BATCHING_SETTINGS - .toBuilder() + Publisher.Builder.DEFAULT_BATCHING_SETTINGS.toBuilder() .setElementCountThreshold(2L) - .setDelayThreshold(Duration.ofSeconds(100)) + .setDelayThresholdDuration(Duration.ofSeconds(100)) .build()) .build(); @@ -177,10 +185,9 @@ public void testSinglePublishByNumBytes() throws Exception { Publisher publisher = getTestPublisherBuilder() .setBatchingSettings( - Publisher.Builder.DEFAULT_BATCHING_SETTINGS - .toBuilder() + Publisher.Builder.DEFAULT_BATCHING_SETTINGS.toBuilder() .setElementCountThreshold(2L) - .setDelayThreshold(Duration.ofSeconds(100)) + .setDelayThresholdDuration(Duration.ofSeconds(100)) .build()) .build(); @@ -213,9 +220,8 @@ public void testPublishByShutdown() throws Exception { Publisher publisher = getTestPublisherBuilder() .setBatchingSettings( - Publisher.Builder.DEFAULT_BATCHING_SETTINGS - .toBuilder() - .setDelayThreshold(Duration.ofSeconds(100)) + Publisher.Builder.DEFAULT_BATCHING_SETTINGS.toBuilder() + .setDelayThresholdDuration(Duration.ofSeconds(100)) .setElementCountThreshold(10L) .build()) .build(); @@ -246,10 +252,9 @@ public void testPublishMixedSizeAndDuration() throws Exception { getTestPublisherBuilder() // To demonstrate that reaching duration will trigger publish .setBatchingSettings( - Publisher.Builder.DEFAULT_BATCHING_SETTINGS - .toBuilder() + Publisher.Builder.DEFAULT_BATCHING_SETTINGS.toBuilder() .setElementCountThreshold(2L) - .setDelayThreshold(Duration.ofSeconds(5)) + .setDelayThresholdDuration(Duration.ofSeconds(5)) .build()) .build(); @@ -282,6 +287,30 @@ public void testPublishMixedSizeAndDuration() throws Exception { shutdownTestPublisher(publisher); } + @Test + public void testPublishWithCompression() throws Exception { + Publisher publisher = + getTestPublisherBuilder() + .setBatchingSettings( + Publisher.Builder.DEFAULT_BATCHING_SETTINGS.toBuilder() + .setElementCountThreshold(2L) + .setDelayThresholdDuration(Duration.ofSeconds(100)) + .build()) + .setEnableCompression(true) + .setCompressionBytesThreshold(100) + .build(); + + testPublisherServiceImpl.addPublishResponse( + PublishResponse.newBuilder().addMessageIds("1").addMessageIds("2")); + ApiFuture publishFuture1 = sendTestMessage(publisher, "A"); + ApiFuture publishFuture2 = sendTestMessage(publisher, "B"); + assertEquals("1", publishFuture1.get()); + assertEquals("2", publishFuture2.get()); + + fakeExecutor.advanceTime(Duration.ofSeconds(100)); + shutdownTestPublisher(publisher); + } + private ApiFuture sendTestMessage(Publisher publisher, String data) { return publisher.publish( PubsubMessage.newBuilder().setData(ByteString.copyFromUtf8(data)).build()); @@ -293,10 +322,9 @@ public void testBatchedMessagesWithOrderingKeyByNum() throws Exception { Publisher publisher = getTestPublisherBuilder() .setBatchingSettings( - Publisher.Builder.DEFAULT_BATCHING_SETTINGS - .toBuilder() + Publisher.Builder.DEFAULT_BATCHING_SETTINGS.toBuilder() .setElementCountThreshold(3L) - .setDelayThreshold(Duration.ofSeconds(100)) + .setDelayThresholdDuration(Duration.ofSeconds(100)) .build()) .setEnableMessageOrdering(true) .build(); @@ -346,10 +374,9 @@ public void testBatchedMessagesWithOrderingKeyByDuration() throws Exception { Publisher publisher = getTestPublisherBuilder() .setBatchingSettings( - Publisher.Builder.DEFAULT_BATCHING_SETTINGS - .toBuilder() + Publisher.Builder.DEFAULT_BATCHING_SETTINGS.toBuilder() .setElementCountThreshold(10L) - .setDelayThreshold(Duration.ofSeconds(100)) + .setDelayThresholdDuration(Duration.ofSeconds(100)) .build()) .setEnableMessageOrdering(true) .build(); @@ -409,11 +436,10 @@ public void testLargeMessagesDoNotReorderBatches() throws Exception { Publisher publisher = getTestPublisherBuilder() .setBatchingSettings( - Publisher.Builder.DEFAULT_BATCHING_SETTINGS - .toBuilder() + Publisher.Builder.DEFAULT_BATCHING_SETTINGS.toBuilder() .setElementCountThreshold(10L) - .setRequestByteThreshold(20L) - .setDelayThreshold(Duration.ofSeconds(100)) + .setRequestByteThreshold(64L) + .setDelayThresholdDuration(Duration.ofSeconds(100)) .build()) .setEnableMessageOrdering(true) .build(); @@ -453,9 +479,8 @@ public void testEnableMessageOrdering_overwritesMaxAttempts() throws Exception { getTestPublisherBuilder() .setExecutorProvider(SINGLE_THREAD_EXECUTOR) .setRetrySettings( - Publisher.Builder.DEFAULT_RETRY_SETTINGS - .toBuilder() - .setTotalTimeout(Duration.ofSeconds(10)) + Publisher.Builder.DEFAULT_RETRY_SETTINGS.toBuilder() + .setTotalTimeoutDuration(Duration.ofSeconds(10)) .setMaxAttempts(1) .build()) .setEnableMessageOrdering(true) @@ -476,7 +501,6 @@ public void testEnableMessageOrdering_overwritesMaxAttempts() throws Exception { assertTrue(publisher.awaitTermination(1, TimeUnit.MINUTES)); } - @Test /** * Make sure that resume publishing works as expected: * @@ -488,6 +512,10 @@ public void testEnableMessageOrdering_overwritesMaxAttempts() throws Exception { *
  • publish with key orderA, which should now succeed * */ + /* + Temporarily disabled due to https://github.com/googleapis/java-pubsub/issues/1861. + TODO(maitrimangal): Enable once resolved. + @Test public void testResumePublish() throws Exception { Publisher publisher = getTestPublisherBuilder() @@ -513,13 +541,13 @@ public void testResumePublish() throws Exception { try { future1.get(); - Assert.fail("This should fail."); + fail("This should fail."); } catch (ExecutionException e) { } try { future2.get(); - Assert.fail("This should fail."); + fail("This should fail."); } catch (ExecutionException e) { } @@ -529,14 +557,14 @@ public void testResumePublish() throws Exception { try { future3.get(); - Assert.fail("This should fail."); + fail("This should fail."); } catch (ExecutionException e) { assertEquals(SequentialExecutorService.CallbackExecutor.CANCELLATION_EXCEPTION, e.getCause()); } try { future4.get(); - Assert.fail("This should fail."); + fail("This should fail."); } catch (ExecutionException e) { assertEquals(SequentialExecutorService.CallbackExecutor.CANCELLATION_EXCEPTION, e.getCause()); } @@ -575,7 +603,7 @@ public void testPublishThrowExceptionForUnsubmittedOrderingKeyMessage() throws E Publisher.Builder.DEFAULT_BATCHING_SETTINGS .toBuilder() .setElementCountThreshold(2L) - .setDelayThreshold(Duration.ofSeconds(500)) + .setDelayThresholdDuration(Duration.ofSeconds(500)) .build()) .setEnableMessageOrdering(true) .build(); @@ -616,6 +644,7 @@ public void testPublishThrowExceptionForUnsubmittedOrderingKeyMessage() throws E assertEquals(SequentialExecutorService.CallbackExecutor.CANCELLATION_EXCEPTION, e.getCause()); } } + */ private ApiFuture sendTestMessageWithOrderingKey( Publisher publisher, String data, String orderingKey) { @@ -632,10 +661,9 @@ public void testErrorPropagation() throws Exception { getTestPublisherBuilder() .setExecutorProvider(SINGLE_THREAD_EXECUTOR) .setBatchingSettings( - Publisher.Builder.DEFAULT_BATCHING_SETTINGS - .toBuilder() + Publisher.Builder.DEFAULT_BATCHING_SETTINGS.toBuilder() .setElementCountThreshold(1L) - .setDelayThreshold(Duration.ofSeconds(5)) + .setDelayThresholdDuration(Duration.ofSeconds(5)) .build()) .build(); testPublisherServiceImpl.addPublishError(Status.DATA_LOSS.asException()); @@ -653,10 +681,9 @@ public void testPublishFailureRetries() throws Exception { getTestPublisherBuilder() .setExecutorProvider(SINGLE_THREAD_EXECUTOR) .setBatchingSettings( - Publisher.Builder.DEFAULT_BATCHING_SETTINGS - .toBuilder() + Publisher.Builder.DEFAULT_BATCHING_SETTINGS.toBuilder() .setElementCountThreshold(1L) - .setDelayThreshold(Duration.ofSeconds(5)) + .setDelayThresholdDuration(Duration.ofSeconds(5)) .build()) .build(); // To demonstrate that reaching duration will trigger publish @@ -677,9 +704,8 @@ public void testPublishFailureRetries_retriesDisabled() throws Exception { getTestPublisherBuilder() .setExecutorProvider(SINGLE_THREAD_EXECUTOR) .setRetrySettings( - Publisher.Builder.DEFAULT_RETRY_SETTINGS - .toBuilder() - .setTotalTimeout(Duration.ofSeconds(10)) + Publisher.Builder.DEFAULT_RETRY_SETTINGS.toBuilder() + .setTotalTimeoutDuration(Duration.ofSeconds(10)) .setMaxAttempts(1) .build()) .build(); @@ -702,9 +728,8 @@ public void testPublishFailureRetries_maxRetriesSetup() throws Exception { getTestPublisherBuilder() .setExecutorProvider(SINGLE_THREAD_EXECUTOR) .setRetrySettings( - Publisher.Builder.DEFAULT_RETRY_SETTINGS - .toBuilder() - .setTotalTimeout(Duration.ofSeconds(10)) + Publisher.Builder.DEFAULT_RETRY_SETTINGS.toBuilder() + .setTotalTimeoutDuration(Duration.ofSeconds(10)) .setMaxAttempts(3) .build()) .build(); @@ -727,9 +752,8 @@ public void testPublishFailureRetries_maxRetriesSetUnlimited() throws Exception getTestPublisherBuilder() .setExecutorProvider(SINGLE_THREAD_EXECUTOR) .setRetrySettings( - Publisher.Builder.DEFAULT_RETRY_SETTINGS - .toBuilder() - .setTotalTimeout(Duration.ofSeconds(10)) + Publisher.Builder.DEFAULT_RETRY_SETTINGS.toBuilder() + .setTotalTimeoutDuration(Duration.ofSeconds(10)) .setMaxAttempts(0) .build()) .build(); @@ -753,15 +777,13 @@ public void testPublishFailureRetries_nonRetryableFailsImmediately() throws Exce getTestPublisherBuilder() .setExecutorProvider(SINGLE_THREAD_EXECUTOR) .setRetrySettings( - Publisher.Builder.DEFAULT_RETRY_SETTINGS - .toBuilder() - .setTotalTimeout(Duration.ofSeconds(10)) + Publisher.Builder.DEFAULT_RETRY_SETTINGS.toBuilder() + .setTotalTimeoutDuration(Duration.ofSeconds(10)) .build()) .setBatchingSettings( - Publisher.Builder.DEFAULT_BATCHING_SETTINGS - .toBuilder() + Publisher.Builder.DEFAULT_BATCHING_SETTINGS.toBuilder() .setElementCountThreshold(1L) - .setDelayThreshold(Duration.ofSeconds(5)) + .setDelayThresholdDuration(Duration.ofSeconds(5)) .build()) .build(); // To demonstrate that reaching duration will trigger publish @@ -786,7 +808,7 @@ public void testPublisherGetters() throws Exception { builder.setBatchingSettings( BatchingSettings.newBuilder() .setRequestByteThreshold(10L) - .setDelayThreshold(Duration.ofMillis(11)) + .setDelayThresholdDuration(Duration.ofMillis(11)) .setElementCountThreshold(12L) .build()); builder.setCredentialsProvider(NoCredentialsProvider.create()); @@ -794,7 +816,8 @@ public void testPublisherGetters() throws Exception { assertEquals(TEST_TOPIC, publisher.getTopicName()); assertEquals(10, (long) publisher.getBatchingSettings().getRequestByteThreshold()); - assertEquals(Duration.ofMillis(11), publisher.getBatchingSettings().getDelayThreshold()); + assertEquals( + Duration.ofMillis(11), publisher.getBatchingSettings().getDelayThresholdDuration()); assertEquals(12, (long) publisher.getBatchingSettings().getElementCountThreshold()); publisher.shutdown(); assertTrue(publisher.awaitTermination(1, TimeUnit.MINUTES)); @@ -809,7 +832,8 @@ public void testBuilderParametersAndDefaults() { Publisher.Builder.DEFAULT_REQUEST_BYTES_THRESHOLD, builder.batchingSettings.getRequestByteThreshold().longValue()); assertEquals( - Publisher.Builder.DEFAULT_DELAY_THRESHOLD, builder.batchingSettings.getDelayThreshold()); + Publisher.Builder.DEFAULT_DELAY_THRESHOLD, + builder.batchingSettings.getDelayThresholdDuration()); assertEquals( Publisher.Builder.DEFAULT_ELEMENT_COUNT_THRESHOLD, builder.batchingSettings.getElementCountThreshold().longValue()); @@ -835,8 +859,7 @@ public void testBuilderInvalidArguments() { } try { builder.setBatchingSettings( - Publisher.Builder.DEFAULT_BATCHING_SETTINGS - .toBuilder() + Publisher.Builder.DEFAULT_BATCHING_SETTINGS.toBuilder() .setRequestByteThreshold(null) .build()); fail("Should have thrown an NullPointerException"); @@ -845,8 +868,7 @@ public void testBuilderInvalidArguments() { } try { builder.setBatchingSettings( - Publisher.Builder.DEFAULT_BATCHING_SETTINGS - .toBuilder() + Publisher.Builder.DEFAULT_BATCHING_SETTINGS.toBuilder() .setRequestByteThreshold(0L) .build()); fail("Should have thrown an IllegalArgumentException"); @@ -855,8 +877,7 @@ public void testBuilderInvalidArguments() { } try { builder.setBatchingSettings( - Publisher.Builder.DEFAULT_BATCHING_SETTINGS - .toBuilder() + Publisher.Builder.DEFAULT_BATCHING_SETTINGS.toBuilder() .setRequestByteThreshold(-1L) .build()); fail("Should have thrown an IllegalArgumentException"); @@ -865,9 +886,8 @@ public void testBuilderInvalidArguments() { } builder.setBatchingSettings( - Publisher.Builder.DEFAULT_BATCHING_SETTINGS - .toBuilder() - .setDelayThreshold(Duration.ofMillis(1)) + Publisher.Builder.DEFAULT_BATCHING_SETTINGS.toBuilder() + .setDelayThresholdDuration(Duration.ofMillis(1)) .build()); try { builder.setBatchingSettings( @@ -878,9 +898,8 @@ public void testBuilderInvalidArguments() { } try { builder.setBatchingSettings( - Publisher.Builder.DEFAULT_BATCHING_SETTINGS - .toBuilder() - .setDelayThreshold(Duration.ofMillis(-1)) + Publisher.Builder.DEFAULT_BATCHING_SETTINGS.toBuilder() + .setDelayThresholdDuration(Duration.ofMillis(-1)) .build()); fail("Should have thrown an IllegalArgumentException"); } catch (IllegalArgumentException expected) { @@ -888,14 +907,12 @@ public void testBuilderInvalidArguments() { } builder.setBatchingSettings( - Publisher.Builder.DEFAULT_BATCHING_SETTINGS - .toBuilder() + Publisher.Builder.DEFAULT_BATCHING_SETTINGS.toBuilder() .setElementCountThreshold(1L) .build()); try { builder.setBatchingSettings( - Publisher.Builder.DEFAULT_BATCHING_SETTINGS - .toBuilder() + Publisher.Builder.DEFAULT_BATCHING_SETTINGS.toBuilder() .setElementCountThreshold(null) .build()); fail("Should have thrown an NullPointerException"); @@ -904,8 +921,7 @@ public void testBuilderInvalidArguments() { } try { builder.setBatchingSettings( - Publisher.Builder.DEFAULT_BATCHING_SETTINGS - .toBuilder() + Publisher.Builder.DEFAULT_BATCHING_SETTINGS.toBuilder() .setElementCountThreshold(0L) .build()); fail("Should have thrown an IllegalArgumentException"); @@ -914,8 +930,7 @@ public void testBuilderInvalidArguments() { } try { builder.setBatchingSettings( - Publisher.Builder.DEFAULT_BATCHING_SETTINGS - .toBuilder() + Publisher.Builder.DEFAULT_BATCHING_SETTINGS.toBuilder() .setElementCountThreshold(-1L) .build()); fail("Should have thrown an IllegalArgumentException"); @@ -924,30 +939,26 @@ public void testBuilderInvalidArguments() { } builder.setRetrySettings( - Publisher.Builder.DEFAULT_RETRY_SETTINGS - .toBuilder() - .setInitialRpcTimeout(Publisher.Builder.MIN_RPC_TIMEOUT) + Publisher.Builder.DEFAULT_RETRY_SETTINGS.toBuilder() + .setInitialRpcTimeoutDuration(Publisher.Builder.MIN_RPC_TIMEOUT) .build()); try { builder.setRetrySettings( - Publisher.Builder.DEFAULT_RETRY_SETTINGS - .toBuilder() - .setInitialRpcTimeout(Publisher.Builder.MIN_RPC_TIMEOUT.minusMillis(1)) + Publisher.Builder.DEFAULT_RETRY_SETTINGS.toBuilder() + .setInitialRpcTimeoutDuration(Publisher.Builder.MIN_RPC_TIMEOUT.minusMillis(1)) .build()); fail("Should have thrown an IllegalArgumentException"); } catch (IllegalArgumentException expected) { // Expected } builder.setRetrySettings( - Publisher.Builder.DEFAULT_RETRY_SETTINGS - .toBuilder() - .setTotalTimeout(Publisher.Builder.MIN_TOTAL_TIMEOUT) + Publisher.Builder.DEFAULT_RETRY_SETTINGS.toBuilder() + .setTotalTimeoutDuration(Publisher.Builder.MIN_TOTAL_TIMEOUT) .build()); try { builder.setRetrySettings( - Publisher.Builder.DEFAULT_RETRY_SETTINGS - .toBuilder() - .setTotalTimeout(Publisher.Builder.MIN_TOTAL_TIMEOUT.minusMillis(1)) + Publisher.Builder.DEFAULT_RETRY_SETTINGS.toBuilder() + .setTotalTimeoutDuration(Publisher.Builder.MIN_TOTAL_TIMEOUT.minusMillis(1)) .build()); fail("Should have thrown an IllegalArgumentException"); } catch (IllegalArgumentException expected) { @@ -960,8 +971,7 @@ public void testPartialBatchingSettings() throws Exception { Publisher publisher = getTestPublisherBuilder() .setBatchingSettings( - Publisher.Builder.getDefaultBatchingSettings() - .toBuilder() + Publisher.Builder.getDefaultBatchingSettings().toBuilder() .setRequestByteThreshold(5000L) .build()) .build(); @@ -973,8 +983,7 @@ public void testPartialBatchingSettings() throws Exception { publisher = getTestPublisherBuilder() .setBatchingSettings( - Publisher.Builder.getDefaultBatchingSettings() - .toBuilder() + Publisher.Builder.getDefaultBatchingSettings().toBuilder() .setElementCountThreshold(500L) .build()) .build(); @@ -990,9 +999,8 @@ public void testAwaitTermination() throws Exception { getTestPublisherBuilder() .setExecutorProvider(SINGLE_THREAD_EXECUTOR) .setRetrySettings( - Publisher.Builder.DEFAULT_RETRY_SETTINGS - .toBuilder() - .setTotalTimeout(Duration.ofSeconds(10)) + Publisher.Builder.DEFAULT_RETRY_SETTINGS.toBuilder() + .setTotalTimeoutDuration(Duration.ofSeconds(10)) .setMaxAttempts(0) .build()) .build(); @@ -1019,42 +1027,106 @@ public void testShutDown() throws Exception { } @Test - public void testPublishFlowControl_throwException() throws Exception { + public void invalidFlowControlBytes_throwException() throws Exception { + try { + Publisher publisher = + getTestPublisherBuilder() + .setBatchingSettings( + Publisher.Builder.DEFAULT_BATCHING_SETTINGS.toBuilder() + .setElementCountThreshold(1L) + .setDelayThresholdDuration(Duration.ofSeconds(5)) + .setFlowControlSettings( + FlowControlSettings.newBuilder() + .setLimitExceededBehavior( + FlowController.LimitExceededBehavior.ThrowException) + .setMaxOutstandingElementCount(1L) + .setMaxOutstandingRequestBytes(0L) + .build()) + .build()) + .build(); + fail("Expected an IllegalArgumentException"); + } catch (Exception e) { + assertThat(e).isInstanceOf(IllegalArgumentException.class); + } + } + + @Test + public void invalidFlowControlElementCount_throwException() throws Exception { + try { + Publisher publisher = + getTestPublisherBuilder() + .setBatchingSettings( + Publisher.Builder.DEFAULT_BATCHING_SETTINGS.toBuilder() + .setElementCountThreshold(1L) + .setDelayThresholdDuration(Duration.ofSeconds(5)) + .setFlowControlSettings( + FlowControlSettings.newBuilder() + .setLimitExceededBehavior( + FlowController.LimitExceededBehavior.ThrowException) + .setMaxOutstandingElementCount(0L) + .setMaxOutstandingRequestBytes(1000L) + .build()) + .build()) + .build(); + fail("Expected an IllegalArgumentException"); + } catch (Exception e) { + assertThat(e).isInstanceOf(IllegalArgumentException.class); + } + } + + @Test + public void testMessageExceedsFlowControlLimits_throwException() throws Exception { Publisher publisher = getTestPublisherBuilder() .setExecutorProvider(SINGLE_THREAD_EXECUTOR) .setBatchingSettings( - Publisher.Builder.DEFAULT_BATCHING_SETTINGS - .toBuilder() + Publisher.Builder.DEFAULT_BATCHING_SETTINGS.toBuilder() .setElementCountThreshold(1L) - .setDelayThreshold(Duration.ofSeconds(5)) + .setDelayThresholdDuration(Duration.ofSeconds(5)) .setFlowControlSettings( FlowControlSettings.newBuilder() - .setLimitExceededBehavior( - FlowController.LimitExceededBehavior.ThrowException) + .setLimitExceededBehavior(FlowController.LimitExceededBehavior.Block) .setMaxOutstandingElementCount(1L) - .setMaxOutstandingRequestBytes(10L) + .setMaxOutstandingRequestBytes(1L) .build()) .build()) .build(); - // Sending a message that is too large results in an exception. - ApiFuture publishFuture1 = sendTestMessage(publisher, "AAAAAAAAAAA"); try { - publishFuture1.get(); - fail("Should have thrown an FlowController.MaxOutstandingRequestBytesReachedException"); + sendTestMessage(publisher, "AAAAAAAAAAAAAAAAAAAAA").get(); + fail("Should have thrown a FlowController.MaxOutstandingRequestBytesReachedException"); } catch (ExecutionException e) { assertThat(e.getCause()) .isInstanceOf(FlowController.MaxOutstandingRequestBytesReachedException.class); } + } + + @Test + public void testPublishFlowControl_throwException() throws Exception { + Publisher publisher = + getTestPublisherBuilder() + .setExecutorProvider(SINGLE_THREAD_EXECUTOR) + .setBatchingSettings( + Publisher.Builder.DEFAULT_BATCHING_SETTINGS.toBuilder() + .setElementCountThreshold(1L) + .setDelayThresholdDuration(Duration.ofSeconds(5)) + .setFlowControlSettings( + FlowControlSettings.newBuilder() + .setLimitExceededBehavior( + FlowController.LimitExceededBehavior.ThrowException) + .setMaxOutstandingElementCount(1L) + .setMaxOutstandingRequestBytes(13L) + .build()) + .build()) + .build(); - // Sending a second message succeeds. - ApiFuture publishFuture2 = sendTestMessage(publisher, "AAAA"); + // Sending a message less than the byte limit succeeds. + ApiFuture publishFuture1 = sendTestMessage(publisher, "AAAA"); - // Sending a third message fails because of the outstanding message. - ApiFuture publishFuture3 = sendTestMessage(publisher, "AA"); + // Sending another message fails because of the outstanding message. + ApiFuture publishFuture2 = sendTestMessage(publisher, "AA"); try { - publishFuture3.get(); + publishFuture2.get(); fail("Should have thrown an FlowController.MaxOutstandingElementCountReachedException"); } catch (ExecutionException e) { assertThat(e.getCause()) @@ -1062,7 +1134,7 @@ public void testPublishFlowControl_throwException() throws Exception { } testPublisherServiceImpl.addPublishResponse(PublishResponse.newBuilder().addMessageIds("1")); - assertEquals("1", publishFuture2.get()); + assertEquals("1", publishFuture1.get()); // Sending another message succeeds. ApiFuture publishFuture4 = sendTestMessage(publisher, "AAAA"); @@ -1076,37 +1148,41 @@ public void testPublishFlowControl_throwExceptionWithOrderingKey() throws Except getTestPublisherBuilder() .setExecutorProvider(SINGLE_THREAD_EXECUTOR) .setBatchingSettings( - Publisher.Builder.DEFAULT_BATCHING_SETTINGS - .toBuilder() + Publisher.Builder.DEFAULT_BATCHING_SETTINGS.toBuilder() .setElementCountThreshold(1L) - .setDelayThreshold(Duration.ofSeconds(5)) + .setDelayThresholdDuration(Duration.ofSeconds(5)) .setFlowControlSettings( FlowControlSettings.newBuilder() .setLimitExceededBehavior( FlowController.LimitExceededBehavior.ThrowException) .setMaxOutstandingElementCount(1L) - .setMaxOutstandingRequestBytes(10L) + .setMaxOutstandingRequestBytes(13L) .build()) .build()) .setEnableMessageOrdering(true) .build(); - // Sending a message that is too large results in an exception. - ApiFuture publishFuture1 = - sendTestMessageWithOrderingKey(publisher, "AAAAAAAAAAA", "a"); + // Sending a message less than the byte limit succeeds. + ApiFuture publishFuture1 = sendTestMessageWithOrderingKey(publisher, "AAAA", "a"); + + // Sending another message fails because of the outstanding message. + ApiFuture publishFuture2 = sendTestMessageWithOrderingKey(publisher, "AA", "a"); try { - publishFuture1.get(); - fail("Should have thrown an FlowController.MaxOutstandingRequestBytesReachedException"); + publishFuture2.get(); + fail("Should have thrown an FlowController.MaxOutstandingElementCountReachedException"); } catch (ExecutionException e) { assertThat(e.getCause()) - .isInstanceOf(FlowController.MaxOutstandingRequestBytesReachedException.class); + .isInstanceOf(FlowController.MaxOutstandingElementCountReachedException.class); } - // Sending a second message for the same ordering key fails because the first one failed. - ApiFuture publishFuture2 = sendTestMessageWithOrderingKey(publisher, "AAAA", "a"); + testPublisherServiceImpl.addPublishResponse(PublishResponse.newBuilder().addMessageIds("1")); + assertEquals("1", publishFuture1.get()); + + // Sending another message for the same ordering key fails because the one before failed. + ApiFuture publishFuture3 = sendTestMessageWithOrderingKey(publisher, "AAAA", "a"); try { - publishFuture2.get(); - Assert.fail("This should fail."); + publishFuture3.get(); + fail("This should fail."); } catch (ExecutionException e) { assertEquals(SequentialExecutorService.CallbackExecutor.CANCELLATION_EXCEPTION, e.getCause()); } @@ -1118,15 +1194,14 @@ public void testPublishFlowControl_block() throws Exception { getTestPublisherBuilder() .setExecutorProvider(SINGLE_THREAD_EXECUTOR) .setBatchingSettings( - Publisher.Builder.DEFAULT_BATCHING_SETTINGS - .toBuilder() + Publisher.Builder.DEFAULT_BATCHING_SETTINGS.toBuilder() .setElementCountThreshold(1L) - .setDelayThreshold(Duration.ofSeconds(5)) + .setDelayThresholdDuration(Duration.ofSeconds(5)) .setFlowControlSettings( FlowControlSettings.newBuilder() .setLimitExceededBehavior(FlowController.LimitExceededBehavior.Block) .setMaxOutstandingElementCount(2L) - .setMaxOutstandingRequestBytes(10L) + .setMaxOutstandingRequestBytes(13L) .build()) .build()) .build(); @@ -1203,6 +1278,70 @@ public void run() { publish4Completed.await(); } + @Test + public void testPublishOpenTelemetryTracing() throws Exception { + OpenTelemetryRule openTelemetryTesting = OpenTelemetryRule.create(); + OpenTelemetry openTelemetry = openTelemetryTesting.getOpenTelemetry(); + final Publisher publisher = + getTestPublisherBuilder() + .setBatchingSettings( + Publisher.Builder.DEFAULT_BATCHING_SETTINGS.toBuilder() + .setElementCountThreshold(1L) + .setDelayThresholdDuration(Duration.ofSeconds(5)) + .setFlowControlSettings( + FlowControlSettings.newBuilder() + .setLimitExceededBehavior(FlowController.LimitExceededBehavior.Block) + .setMaxOutstandingElementCount(2L) + .setMaxOutstandingRequestBytes(100L) + .build()) + .build()) + .setOpenTelemetry(openTelemetry) + .setEnableOpenTelemetryTracing(true) + .build(); + + testPublisherServiceImpl.addPublishResponse(PublishResponse.newBuilder().addMessageIds("1")); + ApiFuture publishFuture = sendTestMessage(publisher, "A"); + fakeExecutor.advanceTime(Duration.ofSeconds(5)); + assertEquals("1", publishFuture.get()); + fakeExecutor.advanceTime(Duration.ofSeconds(5)); + shutdownTestPublisher(publisher); + + List allSpans = openTelemetryTesting.getSpans(); + assertEquals(4, allSpans.size()); + SpanData flowControlSpanData = allSpans.get(0); + SpanData batchingSpanData = allSpans.get(1); + SpanData publishRpcSpanData = allSpans.get(2); + SpanData publisherSpanData = allSpans.get(3); + + SpanDataAssert flowControlSpanDataAssert = + OpenTelemetryAssertions.assertThat(flowControlSpanData); + flowControlSpanDataAssert + .hasName(PUBLISH_FLOW_CONTROL_SPAN_NAME) + .hasParent(publisherSpanData) + .hasEnded(); + + SpanDataAssert batchingSpanDataAssert = OpenTelemetryAssertions.assertThat(batchingSpanData); + batchingSpanDataAssert + .hasName(PUBLISH_BATCHING_SPAN_NAME) + .hasParent(publisherSpanData) + .hasEnded(); + + SpanDataAssert publishRpcSpanDataAssert = + OpenTelemetryAssertions.assertThat(publishRpcSpanData); + publishRpcSpanDataAssert + .hasName(PUBLISH_RPC_SPAN_NAME) + .hasKind(SpanKind.CLIENT) + .hasNoParent() + .hasEnded(); + + SpanDataAssert publishSpanDataAssert = OpenTelemetryAssertions.assertThat(publisherSpanData); + publishSpanDataAssert + .hasName(PUBLISHER_SPAN_NAME) + .hasKind(SpanKind.PRODUCER) + .hasNoParent() + .hasEnded(); + } + private Builder getTestPublisherBuilder() { return Publisher.newBuilder(TEST_TOPIC) .setExecutorProvider(FixedExecutorProvider.create(fakeExecutor)) diff --git a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/SchemaServiceClientHttpJsonTest.java b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/SchemaServiceClientHttpJsonTest.java new file mode 100644 index 000000000..1d15eafde --- /dev/null +++ b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/SchemaServiceClientHttpJsonTest.java @@ -0,0 +1,1169 @@ +/* + * Copyright 2026 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 static com.google.cloud.pubsub.v1.SchemaServiceClient.ListSchemaRevisionsPagedResponse; +import static com.google.cloud.pubsub.v1.SchemaServiceClient.ListSchemasPagedResponse; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.pubsub.v1.stub.HttpJsonSchemaServiceStub; +import com.google.common.collect.Lists; +import com.google.iam.v1.AuditConfig; +import com.google.iam.v1.Binding; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import com.google.protobuf.ByteString; +import com.google.protobuf.Empty; +import com.google.protobuf.FieldMask; +import com.google.protobuf.Timestamp; +import com.google.pubsub.v1.Encoding; +import com.google.pubsub.v1.ListSchemaRevisionsResponse; +import com.google.pubsub.v1.ListSchemasResponse; +import com.google.pubsub.v1.ProjectName; +import com.google.pubsub.v1.Schema; +import com.google.pubsub.v1.SchemaName; +import com.google.pubsub.v1.ValidateMessageRequest; +import com.google.pubsub.v1.ValidateMessageResponse; +import com.google.pubsub.v1.ValidateSchemaResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import javax.annotation.Generated; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@Generated("by gapic-generator-java") +public class SchemaServiceClientHttpJsonTest { + private static MockHttpService mockService; + private static SchemaServiceClient client; + + @BeforeClass + public static void startStaticServer() throws IOException { + mockService = + new MockHttpService( + HttpJsonSchemaServiceStub.getMethodDescriptors(), + SchemaServiceSettings.getDefaultEndpoint()); + SchemaServiceSettings settings = + SchemaServiceSettings.newHttpJsonBuilder() + .setTransportChannelProvider( + SchemaServiceSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = SchemaServiceClient.create(settings); + } + + @AfterClass + public static void stopServer() { + client.close(); + } + + @Before + public void setUp() {} + + @After + public void tearDown() throws Exception { + mockService.reset(); + } + + @Test + public void createSchemaTest() throws Exception { + Schema expectedResponse = + Schema.newBuilder() + .setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) + .setDefinition("definition-1014418093") + .setRevisionId("revisionId-1507445162") + .setRevisionCreateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName parent = ProjectName.of("[PROJECT]"); + Schema schema = Schema.newBuilder().build(); + String schemaId = "schemaId-697673060"; + + Schema actualResponse = client.createSchema(parent, schema, schemaId); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createSchemaExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName parent = ProjectName.of("[PROJECT]"); + Schema schema = Schema.newBuilder().build(); + String schemaId = "schemaId-697673060"; + client.createSchema(parent, schema, schemaId); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createSchemaTest2() throws Exception { + Schema expectedResponse = + Schema.newBuilder() + .setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) + .setDefinition("definition-1014418093") + .setRevisionId("revisionId-1507445162") + .setRevisionCreateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-2353"; + Schema schema = Schema.newBuilder().build(); + String schemaId = "schemaId-697673060"; + + Schema actualResponse = client.createSchema(parent, schema, schemaId); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createSchemaExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-2353"; + Schema schema = Schema.newBuilder().build(); + String schemaId = "schemaId-697673060"; + client.createSchema(parent, schema, schemaId); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getSchemaTest() throws Exception { + Schema expectedResponse = + Schema.newBuilder() + .setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) + .setDefinition("definition-1014418093") + .setRevisionId("revisionId-1507445162") + .setRevisionCreateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + SchemaName name = SchemaName.of("[PROJECT]", "[SCHEMA]"); + + Schema actualResponse = client.getSchema(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getSchemaExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + SchemaName name = SchemaName.of("[PROJECT]", "[SCHEMA]"); + client.getSchema(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getSchemaTest2() throws Exception { + Schema expectedResponse = + Schema.newBuilder() + .setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) + .setDefinition("definition-1014418093") + .setRevisionId("revisionId-1507445162") + .setRevisionCreateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-5662/schemas/schema-5662"; + + Schema actualResponse = client.getSchema(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getSchemaExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-5662/schemas/schema-5662"; + client.getSchema(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listSchemasTest() throws Exception { + Schema responsesElement = Schema.newBuilder().build(); + ListSchemasResponse expectedResponse = + ListSchemasResponse.newBuilder() + .setNextPageToken("") + .addAllSchemas(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName parent = ProjectName.of("[PROJECT]"); + + ListSchemasPagedResponse pagedListResponse = client.listSchemas(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getSchemasList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listSchemasExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName parent = ProjectName.of("[PROJECT]"); + client.listSchemas(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listSchemasTest2() throws Exception { + Schema responsesElement = Schema.newBuilder().build(); + ListSchemasResponse expectedResponse = + ListSchemasResponse.newBuilder() + .setNextPageToken("") + .addAllSchemas(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-2353"; + + ListSchemasPagedResponse pagedListResponse = client.listSchemas(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getSchemasList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listSchemasExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-2353"; + client.listSchemas(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listSchemaRevisionsTest() throws Exception { + Schema responsesElement = Schema.newBuilder().build(); + ListSchemaRevisionsResponse expectedResponse = + ListSchemaRevisionsResponse.newBuilder() + .setNextPageToken("") + .addAllSchemas(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + SchemaName name = SchemaName.of("[PROJECT]", "[SCHEMA]"); + + ListSchemaRevisionsPagedResponse pagedListResponse = client.listSchemaRevisions(name); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getSchemasList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listSchemaRevisionsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + SchemaName name = SchemaName.of("[PROJECT]", "[SCHEMA]"); + client.listSchemaRevisions(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listSchemaRevisionsTest2() throws Exception { + Schema responsesElement = Schema.newBuilder().build(); + ListSchemaRevisionsResponse expectedResponse = + ListSchemaRevisionsResponse.newBuilder() + .setNextPageToken("") + .addAllSchemas(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-5662/schemas/schema-5662"; + + ListSchemaRevisionsPagedResponse pagedListResponse = client.listSchemaRevisions(name); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getSchemasList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listSchemaRevisionsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-5662/schemas/schema-5662"; + client.listSchemaRevisions(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void commitSchemaTest() throws Exception { + Schema expectedResponse = + Schema.newBuilder() + .setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) + .setDefinition("definition-1014418093") + .setRevisionId("revisionId-1507445162") + .setRevisionCreateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + SchemaName name = SchemaName.of("[PROJECT]", "[SCHEMA]"); + Schema schema = Schema.newBuilder().build(); + + Schema actualResponse = client.commitSchema(name, schema); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void commitSchemaExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + SchemaName name = SchemaName.of("[PROJECT]", "[SCHEMA]"); + Schema schema = Schema.newBuilder().build(); + client.commitSchema(name, schema); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void commitSchemaTest2() throws Exception { + Schema expectedResponse = + Schema.newBuilder() + .setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) + .setDefinition("definition-1014418093") + .setRevisionId("revisionId-1507445162") + .setRevisionCreateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-5662/schemas/schema-5662"; + Schema schema = Schema.newBuilder().build(); + + Schema actualResponse = client.commitSchema(name, schema); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void commitSchemaExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-5662/schemas/schema-5662"; + Schema schema = Schema.newBuilder().build(); + client.commitSchema(name, schema); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void rollbackSchemaTest() throws Exception { + Schema expectedResponse = + Schema.newBuilder() + .setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) + .setDefinition("definition-1014418093") + .setRevisionId("revisionId-1507445162") + .setRevisionCreateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + SchemaName name = SchemaName.of("[PROJECT]", "[SCHEMA]"); + String revisionId = "revisionId-1507445162"; + + Schema actualResponse = client.rollbackSchema(name, revisionId); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void rollbackSchemaExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + SchemaName name = SchemaName.of("[PROJECT]", "[SCHEMA]"); + String revisionId = "revisionId-1507445162"; + client.rollbackSchema(name, revisionId); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void rollbackSchemaTest2() throws Exception { + Schema expectedResponse = + Schema.newBuilder() + .setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) + .setDefinition("definition-1014418093") + .setRevisionId("revisionId-1507445162") + .setRevisionCreateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-5662/schemas/schema-5662"; + String revisionId = "revisionId-1507445162"; + + Schema actualResponse = client.rollbackSchema(name, revisionId); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void rollbackSchemaExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-5662/schemas/schema-5662"; + String revisionId = "revisionId-1507445162"; + client.rollbackSchema(name, revisionId); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteSchemaRevisionTest() throws Exception { + Schema expectedResponse = + Schema.newBuilder() + .setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) + .setDefinition("definition-1014418093") + .setRevisionId("revisionId-1507445162") + .setRevisionCreateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + SchemaName name = SchemaName.of("[PROJECT]", "[SCHEMA]"); + String revisionId = "revisionId-1507445162"; + + Schema actualResponse = client.deleteSchemaRevision(name, revisionId); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteSchemaRevisionExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + SchemaName name = SchemaName.of("[PROJECT]", "[SCHEMA]"); + String revisionId = "revisionId-1507445162"; + client.deleteSchemaRevision(name, revisionId); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteSchemaRevisionTest2() throws Exception { + Schema expectedResponse = + Schema.newBuilder() + .setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) + .setDefinition("definition-1014418093") + .setRevisionId("revisionId-1507445162") + .setRevisionCreateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-5662/schemas/schema-5662"; + String revisionId = "revisionId-1507445162"; + + Schema actualResponse = client.deleteSchemaRevision(name, revisionId); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteSchemaRevisionExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-5662/schemas/schema-5662"; + String revisionId = "revisionId-1507445162"; + client.deleteSchemaRevision(name, revisionId); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteSchemaTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + SchemaName name = SchemaName.of("[PROJECT]", "[SCHEMA]"); + + client.deleteSchema(name); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteSchemaExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + SchemaName name = SchemaName.of("[PROJECT]", "[SCHEMA]"); + client.deleteSchema(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteSchemaTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-5662/schemas/schema-5662"; + + client.deleteSchema(name); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteSchemaExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-5662/schemas/schema-5662"; + client.deleteSchema(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void validateSchemaTest() throws Exception { + ValidateSchemaResponse expectedResponse = ValidateSchemaResponse.newBuilder().build(); + mockService.addResponse(expectedResponse); + + ProjectName parent = ProjectName.of("[PROJECT]"); + Schema schema = Schema.newBuilder().build(); + + ValidateSchemaResponse actualResponse = client.validateSchema(parent, schema); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void validateSchemaExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName parent = ProjectName.of("[PROJECT]"); + Schema schema = Schema.newBuilder().build(); + client.validateSchema(parent, schema); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void validateSchemaTest2() throws Exception { + ValidateSchemaResponse expectedResponse = ValidateSchemaResponse.newBuilder().build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-2353"; + Schema schema = Schema.newBuilder().build(); + + ValidateSchemaResponse actualResponse = client.validateSchema(parent, schema); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void validateSchemaExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-2353"; + Schema schema = Schema.newBuilder().build(); + client.validateSchema(parent, schema); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void validateMessageTest() throws Exception { + ValidateMessageResponse expectedResponse = ValidateMessageResponse.newBuilder().build(); + mockService.addResponse(expectedResponse); + + ValidateMessageRequest request = + ValidateMessageRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setMessage(ByteString.EMPTY) + .setEncoding(Encoding.forNumber(0)) + .build(); + + ValidateMessageResponse actualResponse = client.validateMessage(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void validateMessageExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ValidateMessageRequest request = + ValidateMessageRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setMessage(ByteString.EMPTY) + .setEncoding(Encoding.forNumber(0)) + .build(); + client.validateMessage(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void setIamPolicyTest() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setVersion(351608024) + .addAllBindings(new ArrayList()) + .addAllAuditConfigs(new ArrayList()) + .setEtag(ByteString.EMPTY) + .build(); + mockService.addResponse(expectedResponse); + + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + + Policy actualResponse = client.setIamPolicy(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void setIamPolicyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + client.setIamPolicy(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getIamPolicyTest() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setVersion(351608024) + .addAllBindings(new ArrayList()) + .addAllAuditConfigs(new ArrayList()) + .setEtag(ByteString.EMPTY) + .build(); + mockService.addResponse(expectedResponse); + + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + + Policy actualResponse = client.getIamPolicy(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getIamPolicyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + client.getIamPolicy(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void testIamPermissionsTest() throws Exception { + TestIamPermissionsResponse expectedResponse = + TestIamPermissionsResponse.newBuilder().addAllPermissions(new ArrayList()).build(); + mockService.addResponse(expectedResponse); + + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) + .addAllPermissions(new ArrayList()) + .build(); + + TestIamPermissionsResponse actualResponse = client.testIamPermissions(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void testIamPermissionsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) + .addAllPermissions(new ArrayList()) + .build(); + client.testIamPermissions(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} diff --git a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/SchemaServiceClientTest.java b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/SchemaServiceClientTest.java index 286a1362b..f17ef1366 100644 --- a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/SchemaServiceClientTest.java +++ b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/SchemaServiceClientTest.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 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 + * 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, @@ -13,8 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.pubsub.v1; +import static com.google.cloud.pubsub.v1.SchemaServiceClient.ListSchemaRevisionsPagedResponse; import static com.google.cloud.pubsub.v1.SchemaServiceClient.ListSchemasPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; @@ -25,26 +27,44 @@ import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.InvalidArgumentException; import com.google.common.collect.Lists; +import com.google.iam.v1.AuditConfig; +import com.google.iam.v1.Binding; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; import com.google.protobuf.AbstractMessage; +import com.google.protobuf.ByteString; import com.google.protobuf.Empty; +import com.google.protobuf.FieldMask; +import com.google.protobuf.Timestamp; +import com.google.pubsub.v1.CommitSchemaRequest; import com.google.pubsub.v1.CreateSchemaRequest; import com.google.pubsub.v1.DeleteSchemaRequest; +import com.google.pubsub.v1.DeleteSchemaRevisionRequest; +import com.google.pubsub.v1.Encoding; import com.google.pubsub.v1.GetSchemaRequest; +import com.google.pubsub.v1.ListSchemaRevisionsRequest; +import com.google.pubsub.v1.ListSchemaRevisionsResponse; import com.google.pubsub.v1.ListSchemasRequest; import com.google.pubsub.v1.ListSchemasResponse; import com.google.pubsub.v1.ProjectName; +import com.google.pubsub.v1.RollbackSchemaRequest; import com.google.pubsub.v1.Schema; import com.google.pubsub.v1.SchemaName; import com.google.pubsub.v1.ValidateMessageRequest; import com.google.pubsub.v1.ValidateMessageResponse; import com.google.pubsub.v1.ValidateSchemaRequest; import com.google.pubsub.v1.ValidateSchemaResponse; -import io.grpc.Status; import io.grpc.StatusRuntimeException; import java.io.IOException; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.UUID; +import javax.annotation.Generated; import org.junit.After; import org.junit.AfterClass; import org.junit.Assert; @@ -52,39 +72,34 @@ import org.junit.BeforeClass; import org.junit.Test; -@javax.annotation.Generated("by GAPIC") +@Generated("by gapic-generator-java") public class SchemaServiceClientTest { - private static MockSchemaService mockSchemaService; - private static MockPublisher mockPublisher; private static MockIAMPolicy mockIAMPolicy; - private static MockSubscriber mockSubscriber; - private static MockServiceHelper serviceHelper; - private SchemaServiceClient client; + private static MockSchemaService mockSchemaService; + private static MockServiceHelper mockServiceHelper; private LocalChannelProvider channelProvider; + private SchemaServiceClient client; @BeforeClass public static void startStaticServer() { mockSchemaService = new MockSchemaService(); - mockPublisher = new MockPublisher(); mockIAMPolicy = new MockIAMPolicy(); - mockSubscriber = new MockSubscriber(); - serviceHelper = + mockServiceHelper = new MockServiceHelper( UUID.randomUUID().toString(), - Arrays.asList( - mockSchemaService, mockPublisher, mockIAMPolicy, mockSubscriber)); - serviceHelper.start(); + Arrays.asList(mockSchemaService, mockIAMPolicy)); + mockServiceHelper.start(); } @AfterClass public static void stopServer() { - serviceHelper.stop(); + mockServiceHelper.stop(); } @Before public void setUp() throws IOException { - serviceHelper.reset(); - channelProvider = serviceHelper.createChannelProvider(); + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); SchemaServiceSettings settings = SchemaServiceSettings.newBuilder() .setTransportChannelProvider(channelProvider) @@ -99,26 +114,28 @@ public void tearDown() throws Exception { } @Test - @SuppressWarnings("all") - public void createSchemaTest() { - SchemaName name = SchemaName.of("[PROJECT]", "[SCHEMA]"); - String definition = "definition-1014418093"; + public void createSchemaTest() throws Exception { Schema expectedResponse = - Schema.newBuilder().setName(name.toString()).setDefinition(definition).build(); + Schema.newBuilder() + .setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) + .setDefinition("definition-1014418093") + .setRevisionId("revisionId-1507445162") + .setRevisionCreateTime(Timestamp.newBuilder().build()) + .build(); mockSchemaService.addResponse(expectedResponse); ProjectName parent = ProjectName.of("[PROJECT]"); Schema schema = Schema.newBuilder().build(); - String schemaId = "schemaId-153006983"; + String schemaId = "schemaId-697673060"; Schema actualResponse = client.createSchema(parent, schema, schemaId); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockSchemaService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - CreateSchemaRequest actualRequest = (CreateSchemaRequest) actualRequests.get(0); + CreateSchemaRequest actualRequest = ((CreateSchemaRequest) actualRequests.get(0)); - Assert.assertEquals(parent, ProjectName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertEquals(schema, actualRequest.getSchema()); Assert.assertEquals(schemaId, actualRequest.getSchemaId()); Assert.assertTrue( @@ -128,30 +145,77 @@ public void createSchemaTest() { } @Test - @SuppressWarnings("all") public void createSchemaExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSchemaService.addException(exception); try { ProjectName parent = ProjectName.of("[PROJECT]"); Schema schema = Schema.newBuilder().build(); - String schemaId = "schemaId-153006983"; + String schemaId = "schemaId-697673060"; + client.createSchema(parent, schema, schemaId); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + @Test + public void createSchemaTest2() throws Exception { + Schema expectedResponse = + Schema.newBuilder() + .setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) + .setDefinition("definition-1014418093") + .setRevisionId("revisionId-1507445162") + .setRevisionCreateTime(Timestamp.newBuilder().build()) + .build(); + mockSchemaService.addResponse(expectedResponse); + + String parent = "parent-995424086"; + Schema schema = Schema.newBuilder().build(); + String schemaId = "schemaId-697673060"; + + Schema actualResponse = client.createSchema(parent, schema, schemaId); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSchemaService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateSchemaRequest actualRequest = ((CreateSchemaRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(schema, actualRequest.getSchema()); + Assert.assertEquals(schemaId, actualRequest.getSchemaId()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createSchemaExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSchemaService.addException(exception); + + try { + String parent = "parent-995424086"; + Schema schema = Schema.newBuilder().build(); + String schemaId = "schemaId-697673060"; client.createSchema(parent, schema, schemaId); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void getSchemaTest() { - SchemaName name2 = SchemaName.of("[PROJECT]", "[SCHEMA]"); - String definition = "definition-1014418093"; + public void getSchemaTest() throws Exception { Schema expectedResponse = - Schema.newBuilder().setName(name2.toString()).setDefinition(definition).build(); + Schema.newBuilder() + .setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) + .setDefinition("definition-1014418093") + .setRevisionId("revisionId-1507445162") + .setRevisionCreateTime(Timestamp.newBuilder().build()) + .build(); mockSchemaService.addResponse(expectedResponse); SchemaName name = SchemaName.of("[PROJECT]", "[SCHEMA]"); @@ -161,9 +225,9 @@ public void getSchemaTest() { List actualRequests = mockSchemaService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - GetSchemaRequest actualRequest = (GetSchemaRequest) actualRequests.get(0); + GetSchemaRequest actualRequest = ((GetSchemaRequest) actualRequests.get(0)); - Assert.assertEquals(name, SchemaName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -171,31 +235,67 @@ public void getSchemaTest() { } @Test - @SuppressWarnings("all") public void getSchemaExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSchemaService.addException(exception); try { SchemaName name = SchemaName.of("[PROJECT]", "[SCHEMA]"); + client.getSchema(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getSchemaTest2() throws Exception { + Schema expectedResponse = + Schema.newBuilder() + .setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) + .setDefinition("definition-1014418093") + .setRevisionId("revisionId-1507445162") + .setRevisionCreateTime(Timestamp.newBuilder().build()) + .build(); + mockSchemaService.addResponse(expectedResponse); + + String name = "name3373707"; + + Schema actualResponse = client.getSchema(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSchemaService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetSchemaRequest actualRequest = ((GetSchemaRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getSchemaExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSchemaService.addException(exception); + try { + String name = "name3373707"; client.getSchema(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void listSchemasTest() { - String nextPageToken = ""; - Schema schemasElement = Schema.newBuilder().build(); - List schemas = Arrays.asList(schemasElement); + public void listSchemasTest() throws Exception { + Schema responsesElement = Schema.newBuilder().build(); ListSchemasResponse expectedResponse = ListSchemasResponse.newBuilder() - .setNextPageToken(nextPageToken) - .addAllSchemas(schemas) + .setNextPageToken("") + .addAllSchemas(Arrays.asList(responsesElement)) .build(); mockSchemaService.addResponse(expectedResponse); @@ -204,14 +304,15 @@ public void listSchemasTest() { ListSchemasPagedResponse pagedListResponse = client.listSchemas(parent); List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); Assert.assertEquals(expectedResponse.getSchemasList().get(0), resources.get(0)); List actualRequests = mockSchemaService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - ListSchemasRequest actualRequest = (ListSchemasRequest) actualRequests.get(0); + ListSchemasRequest actualRequest = ((ListSchemasRequest) actualRequests.get(0)); - Assert.assertEquals(parent, ProjectName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -219,24 +320,419 @@ public void listSchemasTest() { } @Test - @SuppressWarnings("all") public void listSchemasExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSchemaService.addException(exception); try { ProjectName parent = ProjectName.of("[PROJECT]"); + client.listSchemas(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listSchemasTest2() throws Exception { + Schema responsesElement = Schema.newBuilder().build(); + ListSchemasResponse expectedResponse = + ListSchemasResponse.newBuilder() + .setNextPageToken("") + .addAllSchemas(Arrays.asList(responsesElement)) + .build(); + mockSchemaService.addResponse(expectedResponse); + + String parent = "parent-995424086"; + + ListSchemasPagedResponse pagedListResponse = client.listSchemas(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getSchemasList().get(0), resources.get(0)); + List actualRequests = mockSchemaService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListSchemasRequest actualRequest = ((ListSchemasRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listSchemasExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSchemaService.addException(exception); + + try { + String parent = "parent-995424086"; client.listSchemas(parent); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void deleteSchemaTest() { + public void listSchemaRevisionsTest() throws Exception { + Schema responsesElement = Schema.newBuilder().build(); + ListSchemaRevisionsResponse expectedResponse = + ListSchemaRevisionsResponse.newBuilder() + .setNextPageToken("") + .addAllSchemas(Arrays.asList(responsesElement)) + .build(); + mockSchemaService.addResponse(expectedResponse); + + SchemaName name = SchemaName.of("[PROJECT]", "[SCHEMA]"); + + ListSchemaRevisionsPagedResponse pagedListResponse = client.listSchemaRevisions(name); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getSchemasList().get(0), resources.get(0)); + + List actualRequests = mockSchemaService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListSchemaRevisionsRequest actualRequest = ((ListSchemaRevisionsRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listSchemaRevisionsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSchemaService.addException(exception); + + try { + SchemaName name = SchemaName.of("[PROJECT]", "[SCHEMA]"); + client.listSchemaRevisions(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listSchemaRevisionsTest2() throws Exception { + Schema responsesElement = Schema.newBuilder().build(); + ListSchemaRevisionsResponse expectedResponse = + ListSchemaRevisionsResponse.newBuilder() + .setNextPageToken("") + .addAllSchemas(Arrays.asList(responsesElement)) + .build(); + mockSchemaService.addResponse(expectedResponse); + + String name = "name3373707"; + + ListSchemaRevisionsPagedResponse pagedListResponse = client.listSchemaRevisions(name); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getSchemasList().get(0), resources.get(0)); + + List actualRequests = mockSchemaService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListSchemaRevisionsRequest actualRequest = ((ListSchemaRevisionsRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listSchemaRevisionsExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSchemaService.addException(exception); + + try { + String name = "name3373707"; + client.listSchemaRevisions(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void commitSchemaTest() throws Exception { + Schema expectedResponse = + Schema.newBuilder() + .setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) + .setDefinition("definition-1014418093") + .setRevisionId("revisionId-1507445162") + .setRevisionCreateTime(Timestamp.newBuilder().build()) + .build(); + mockSchemaService.addResponse(expectedResponse); + + SchemaName name = SchemaName.of("[PROJECT]", "[SCHEMA]"); + Schema schema = Schema.newBuilder().build(); + + Schema actualResponse = client.commitSchema(name, schema); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSchemaService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CommitSchemaRequest actualRequest = ((CommitSchemaRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertEquals(schema, actualRequest.getSchema()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void commitSchemaExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSchemaService.addException(exception); + + try { + SchemaName name = SchemaName.of("[PROJECT]", "[SCHEMA]"); + Schema schema = Schema.newBuilder().build(); + client.commitSchema(name, schema); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void commitSchemaTest2() throws Exception { + Schema expectedResponse = + Schema.newBuilder() + .setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) + .setDefinition("definition-1014418093") + .setRevisionId("revisionId-1507445162") + .setRevisionCreateTime(Timestamp.newBuilder().build()) + .build(); + mockSchemaService.addResponse(expectedResponse); + + String name = "name3373707"; + Schema schema = Schema.newBuilder().build(); + + Schema actualResponse = client.commitSchema(name, schema); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSchemaService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CommitSchemaRequest actualRequest = ((CommitSchemaRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertEquals(schema, actualRequest.getSchema()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void commitSchemaExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSchemaService.addException(exception); + + try { + String name = "name3373707"; + Schema schema = Schema.newBuilder().build(); + client.commitSchema(name, schema); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void rollbackSchemaTest() throws Exception { + Schema expectedResponse = + Schema.newBuilder() + .setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) + .setDefinition("definition-1014418093") + .setRevisionId("revisionId-1507445162") + .setRevisionCreateTime(Timestamp.newBuilder().build()) + .build(); + mockSchemaService.addResponse(expectedResponse); + + SchemaName name = SchemaName.of("[PROJECT]", "[SCHEMA]"); + String revisionId = "revisionId-1507445162"; + + Schema actualResponse = client.rollbackSchema(name, revisionId); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSchemaService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + RollbackSchemaRequest actualRequest = ((RollbackSchemaRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertEquals(revisionId, actualRequest.getRevisionId()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void rollbackSchemaExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSchemaService.addException(exception); + + try { + SchemaName name = SchemaName.of("[PROJECT]", "[SCHEMA]"); + String revisionId = "revisionId-1507445162"; + client.rollbackSchema(name, revisionId); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void rollbackSchemaTest2() throws Exception { + Schema expectedResponse = + Schema.newBuilder() + .setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) + .setDefinition("definition-1014418093") + .setRevisionId("revisionId-1507445162") + .setRevisionCreateTime(Timestamp.newBuilder().build()) + .build(); + mockSchemaService.addResponse(expectedResponse); + + String name = "name3373707"; + String revisionId = "revisionId-1507445162"; + + Schema actualResponse = client.rollbackSchema(name, revisionId); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSchemaService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + RollbackSchemaRequest actualRequest = ((RollbackSchemaRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertEquals(revisionId, actualRequest.getRevisionId()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void rollbackSchemaExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSchemaService.addException(exception); + + try { + String name = "name3373707"; + String revisionId = "revisionId-1507445162"; + client.rollbackSchema(name, revisionId); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteSchemaRevisionTest() throws Exception { + Schema expectedResponse = + Schema.newBuilder() + .setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) + .setDefinition("definition-1014418093") + .setRevisionId("revisionId-1507445162") + .setRevisionCreateTime(Timestamp.newBuilder().build()) + .build(); + mockSchemaService.addResponse(expectedResponse); + + SchemaName name = SchemaName.of("[PROJECT]", "[SCHEMA]"); + String revisionId = "revisionId-1507445162"; + + Schema actualResponse = client.deleteSchemaRevision(name, revisionId); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSchemaService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteSchemaRevisionRequest actualRequest = + ((DeleteSchemaRevisionRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertEquals(revisionId, actualRequest.getRevisionId()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteSchemaRevisionExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSchemaService.addException(exception); + + try { + SchemaName name = SchemaName.of("[PROJECT]", "[SCHEMA]"); + String revisionId = "revisionId-1507445162"; + client.deleteSchemaRevision(name, revisionId); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteSchemaRevisionTest2() throws Exception { + Schema expectedResponse = + Schema.newBuilder() + .setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) + .setDefinition("definition-1014418093") + .setRevisionId("revisionId-1507445162") + .setRevisionCreateTime(Timestamp.newBuilder().build()) + .build(); + mockSchemaService.addResponse(expectedResponse); + + String name = "name3373707"; + String revisionId = "revisionId-1507445162"; + + Schema actualResponse = client.deleteSchemaRevision(name, revisionId); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSchemaService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteSchemaRevisionRequest actualRequest = + ((DeleteSchemaRevisionRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertEquals(revisionId, actualRequest.getRevisionId()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteSchemaRevisionExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSchemaService.addException(exception); + + try { + String name = "name3373707"; + String revisionId = "revisionId-1507445162"; + client.deleteSchemaRevision(name, revisionId); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteSchemaTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockSchemaService.addResponse(expectedResponse); @@ -246,9 +742,9 @@ public void deleteSchemaTest() { List actualRequests = mockSchemaService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - DeleteSchemaRequest actualRequest = (DeleteSchemaRequest) actualRequests.get(0); + DeleteSchemaRequest actualRequest = ((DeleteSchemaRequest) actualRequests.get(0)); - Assert.assertEquals(name, SchemaName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -256,24 +752,55 @@ public void deleteSchemaTest() { } @Test - @SuppressWarnings("all") public void deleteSchemaExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSchemaService.addException(exception); try { SchemaName name = SchemaName.of("[PROJECT]", "[SCHEMA]"); + client.deleteSchema(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteSchemaTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockSchemaService.addResponse(expectedResponse); + + String name = "name3373707"; + + client.deleteSchema(name); + + List actualRequests = mockSchemaService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteSchemaRequest actualRequest = ((DeleteSchemaRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + @Test + public void deleteSchemaExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSchemaService.addException(exception); + + try { + String name = "name3373707"; client.deleteSchema(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void validateSchemaTest() { + public void validateSchemaTest() throws Exception { ValidateSchemaResponse expectedResponse = ValidateSchemaResponse.newBuilder().build(); mockSchemaService.addResponse(expectedResponse); @@ -285,9 +812,9 @@ public void validateSchemaTest() { List actualRequests = mockSchemaService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - ValidateSchemaRequest actualRequest = (ValidateSchemaRequest) actualRequests.get(0); + ValidateSchemaRequest actualRequest = ((ValidateSchemaRequest) actualRequests.get(0)); - Assert.assertEquals(parent, ProjectName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertEquals(schema, actualRequest.getSchema()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -296,40 +823,82 @@ public void validateSchemaTest() { } @Test - @SuppressWarnings("all") public void validateSchemaExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSchemaService.addException(exception); try { ProjectName parent = ProjectName.of("[PROJECT]"); Schema schema = Schema.newBuilder().build(); + client.validateSchema(parent, schema); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void validateSchemaTest2() throws Exception { + ValidateSchemaResponse expectedResponse = ValidateSchemaResponse.newBuilder().build(); + mockSchemaService.addResponse(expectedResponse); + + String parent = "parent-995424086"; + Schema schema = Schema.newBuilder().build(); + + ValidateSchemaResponse actualResponse = client.validateSchema(parent, schema); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSchemaService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ValidateSchemaRequest actualRequest = ((ValidateSchemaRequest) actualRequests.get(0)); + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(schema, actualRequest.getSchema()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void validateSchemaExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSchemaService.addException(exception); + + try { + String parent = "parent-995424086"; + Schema schema = Schema.newBuilder().build(); client.validateSchema(parent, schema); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void validateMessageTest() { + public void validateMessageTest() throws Exception { ValidateMessageResponse expectedResponse = ValidateMessageResponse.newBuilder().build(); mockSchemaService.addResponse(expectedResponse); - ProjectName parent = ProjectName.of("[PROJECT]"); ValidateMessageRequest request = - ValidateMessageRequest.newBuilder().setParent(parent.toString()).build(); + ValidateMessageRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setMessage(ByteString.EMPTY) + .setEncoding(Encoding.forNumber(0)) + .build(); ValidateMessageResponse actualResponse = client.validateMessage(request); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockSchemaService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - ValidateMessageRequest actualRequest = (ValidateMessageRequest) actualRequests.get(0); + ValidateMessageRequest actualRequest = ((ValidateMessageRequest) actualRequests.get(0)); - Assert.assertEquals(parent, ProjectName.parse(actualRequest.getParent())); + Assert.assertEquals(request.getParent(), actualRequest.getParent()); + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getSchema(), actualRequest.getSchema()); + Assert.assertEquals(request.getMessage(), actualRequest.getMessage()); + Assert.assertEquals(request.getEncoding(), actualRequest.getEncoding()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -337,20 +906,169 @@ public void validateMessageTest() { } @Test - @SuppressWarnings("all") public void validateMessageExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSchemaService.addException(exception); try { - ProjectName parent = ProjectName.of("[PROJECT]"); ValidateMessageRequest request = - ValidateMessageRequest.newBuilder().setParent(parent.toString()).build(); - + ValidateMessageRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setMessage(ByteString.EMPTY) + .setEncoding(Encoding.forNumber(0)) + .build(); client.validateMessage(request); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. + } + } + + @Test + public void setIamPolicyTest() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setVersion(351608024) + .addAllBindings(new ArrayList()) + .addAllAuditConfigs(new ArrayList()) + .setEtag(ByteString.EMPTY) + .build(); + mockIAMPolicy.addResponse(expectedResponse); + + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + + Policy actualResponse = client.setIamPolicy(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockIAMPolicy.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + SetIamPolicyRequest actualRequest = ((SetIamPolicyRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getResource(), actualRequest.getResource()); + Assert.assertEquals(request.getPolicy(), actualRequest.getPolicy()); + Assert.assertEquals(request.getUpdateMask(), actualRequest.getUpdateMask()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void setIamPolicyExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockIAMPolicy.addException(exception); + + try { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + client.setIamPolicy(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getIamPolicyTest() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setVersion(351608024) + .addAllBindings(new ArrayList()) + .addAllAuditConfigs(new ArrayList()) + .setEtag(ByteString.EMPTY) + .build(); + mockIAMPolicy.addResponse(expectedResponse); + + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + + Policy actualResponse = client.getIamPolicy(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockIAMPolicy.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetIamPolicyRequest actualRequest = ((GetIamPolicyRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getResource(), actualRequest.getResource()); + Assert.assertEquals(request.getOptions(), actualRequest.getOptions()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getIamPolicyExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockIAMPolicy.addException(exception); + + try { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + client.getIamPolicy(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void testIamPermissionsTest() throws Exception { + TestIamPermissionsResponse expectedResponse = + TestIamPermissionsResponse.newBuilder().addAllPermissions(new ArrayList()).build(); + mockIAMPolicy.addResponse(expectedResponse); + + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) + .addAllPermissions(new ArrayList()) + .build(); + + TestIamPermissionsResponse actualResponse = client.testIamPermissions(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockIAMPolicy.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + TestIamPermissionsRequest actualRequest = ((TestIamPermissionsRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getResource(), actualRequest.getResource()); + Assert.assertEquals(request.getPermissionsList(), actualRequest.getPermissionsList()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void testIamPermissionsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockIAMPolicy.addException(exception); + + try { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) + .addAllPermissions(new ArrayList()) + .build(); + client.testIamPermissions(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. } } } 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 new file mode 100644 index 000000000..6979963a5 --- /dev/null +++ b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/StreamingSubscriberConnectionTest.java @@ -0,0 +1,907 @@ +/* + * Copyright 2022 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.*; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.argThat; +import static org.mockito.Mockito.*; + +import com.google.api.core.ApiFutures; +import com.google.api.core.SettableApiFuture; +import com.google.api.gax.batching.FlowControlSettings; +import com.google.api.gax.batching.FlowController; +import com.google.api.gax.core.Distribution; +import com.google.api.gax.grpc.GrpcStatusCode; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.BidiStreamingCallable; +import com.google.api.gax.rpc.ClientStream; +import com.google.api.gax.rpc.ResponseObserver; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StreamController; +import com.google.cloud.pubsub.v1.stub.SubscriberStub; +import com.google.common.collect.Lists; +import com.google.protobuf.Any; +import com.google.pubsub.v1.AcknowledgeRequest; +import com.google.pubsub.v1.ModifyAckDeadlineRequest; +import com.google.pubsub.v1.StreamingPullRequest; +import com.google.pubsub.v1.StreamingPullResponse; +import com.google.rpc.ErrorInfo; +import com.google.rpc.Status; +import io.grpc.Status.Code; +import io.grpc.StatusException; +import io.grpc.protobuf.StatusProto; +import java.time.Duration; +import java.util.*; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; +import java.util.concurrent.atomic.AtomicInteger; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; +import org.mockito.ArgumentCaptor; + +/** Tests for {@link StreamingSubscriberConnection}. */ +public class StreamingSubscriberConnectionTest { + @Rule public TestName testName = new TestName(); + + private FakeScheduledExecutorService systemExecutor; + private FakeScheduledExecutorService executor; + private FakeClock clock; + private SubscriberStub mockSubscriberStub; + + private static final String MOCK_SUBSCRIPTION_NAME = + "projects/MOCK-PROJECT/subscriptions/MOCK-SUBSCRIPTION"; + private static final String MOCK_ACK_ID_SUCCESS = "MOCK-ACK-ID-SUCCESS"; + private static final String MOCK_ACK_ID_SUCCESS_2 = "MOCK-ACK-ID-SUCCESS-2"; + private static final String MOCK_ACK_ID_NACK_SUCCESS = "MOCK-ACK-ID-NACK-SUCCESS"; + // Successful modacks should not return a message + private static final String MOCK_ACK_ID_SUCCESS_NO_MESSAGE = "MOCK-ACK-ID-SUCCESS-NO-MESSAGE"; + private static final String MOCK_ACK_ID_TRANSIENT_FAILURE_UNORDERED_ACK_ID_THEN_SUCCESS = + "MOCK-ACK-ID-TRANSIENT-FAILURE-UNORDERED-ACK-ID-THEN-SUCCESS"; + private static final String MOCK_ACK_ID_TRANSIENT_FAILURE_SERVICE_UNAVAILABLE_THEN_SUCCESS = + "MOCK-ACK-ID-TRANSIENT-FAILURE-SERVICE-UNAVAILABLE-THEN-SUCCESS"; + private static final String MOCK_ACK_ID_INVALID = "MOCK-ACK-ID-INVALID"; + private static final String MOCK_ACK_ID_OTHER = "MOCK-ACK-ID-OTHER"; + private static final String MOCK_ACK_ID_NO_METADATA_MAP_INTERNAL_ERROR_THEN_PERMISSION_DENIED = + "MOCK-ACK-ID-NO-METADATA-MAP-INTERNAL-ERROR"; + + private static final String PERMANENT_FAILURE_INVALID_ACK_ID = "PERMANENT_FAILURE_INVALID_ACK_ID"; + private static final String TRANSIENT_FAILURE_UNORDERED_ACK_ID = + "TRANSIENT_FAILURE_UNORDERED_ACK_ID"; + private static final String TRANSIENT_FAILURE_SERVICE_UNAVAILABLE = + "TRANSIENT_FAILURE_SERVICE_UNAVAILABLE"; + private static final String PERMANENT_FAILURE_OTHER = "I_DO_NOT_MATCH_ANY_KNOWN_ERRORS"; + + private static int MOCK_ACK_EXTENSION_DEFAULT_SECONDS = 10; + private static Duration ACK_EXPIRATION_PADDING_DEFAULT_DURATION = Duration.ofSeconds(10); + private static int MAX_DURATION_PER_ACK_EXTENSION_DEFAULT_SECONDS = 10; + + private static final long KEEP_ALIVE_SUPPORT_VERSION = 1; + private static final Duration CLIENT_PING_INTERVAL = Duration.ofSeconds(30); + private static final Duration MAX_ACK_EXTENSION_PERIOD = Duration.ofMinutes(60); + + @Before + public void setUp() { + systemExecutor = new FakeScheduledExecutorService(); + clock = systemExecutor.getClock(); + mockSubscriberStub = mock(SubscriberStub.class, RETURNS_DEEP_STUBS); + } + + @After + public void tearDown() { + systemExecutor.shutdown(); + } + + @Test + public void testSetupAndTeardown() { + StreamingSubscriberConnection streamingSubscriberConnection = + getStreamingSubscriberConnection(false); + + streamingSubscriberConnection.startAsync(); + streamingSubscriberConnection.awaitRunning(); + streamingSubscriberConnection.stopAsync(); + 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 + List modackRequestDataList = new ArrayList(); + + ModackRequestData modackRequestDataSuccess = + new ModackRequestData( + MOCK_ACK_EXTENSION_DEFAULT_SECONDS, + AckRequestData.newBuilder(MOCK_ACK_ID_SUCCESS).build()); + modackRequestDataList.add(modackRequestDataSuccess); + + ModackRequestData modackRequestDataNack = + new ModackRequestData(0, AckRequestData.newBuilder(MOCK_ACK_ID_SUCCESS).build()); + modackRequestDataList.add(modackRequestDataNack); + + List ackRequestDataList = new ArrayList(); + AckRequestData ackRequestDataSuccess = AckRequestData.newBuilder(MOCK_ACK_ID_SUCCESS).build(); + ackRequestDataList.add(ackRequestDataSuccess); + + // Instantiate class and run operation(s) + StreamingSubscriberConnection streamingSubscriberConnection = + getStreamingSubscriberConnection(false); + streamingSubscriberConnection.sendAckOperations(ackRequestDataList); + streamingSubscriberConnection.sendModackOperations(modackRequestDataList); + + // Assert expected behavior + verify(mockSubscriberStub, times(2)).modifyAckDeadlineCallable(); + verify(mockSubscriberStub, times(1)).acknowledgeCallable(); + } + + @Test + public void testSendAckOperationsExactlyOnceEnabledMessageFuturesModacks() { + // Setup + + // The list(s) of ackIds allows us to mock the grpc response(s) + List ackIdsInitialRequest = new ArrayList<>(); + List ackIdsRetryRequest = new ArrayList<>(); + + Map errorInfoMetadataMapInitialRequest = new HashMap(); + List modackRequestDataList = new ArrayList(); + + ModackRequestData modackRequestDataDefault = + new ModackRequestData(MOCK_ACK_EXTENSION_DEFAULT_SECONDS); + + // Nack SUCCESS + SettableApiFuture messageFutureSuccessExpected = SettableApiFuture.create(); + ModackRequestData modackRequestDataSuccess = + new ModackRequestData( + 0, + AckRequestData.newBuilder(MOCK_ACK_ID_NACK_SUCCESS) + .setMessageFuture(messageFutureSuccessExpected) + .build()); + modackRequestDataList.add(modackRequestDataSuccess); + + // SUCCESS - no message + SettableApiFuture messageFutureNotDoneExpected = SettableApiFuture.create(); + modackRequestDataDefault.addAckRequestData( + AckRequestData.newBuilder(MOCK_ACK_ID_SUCCESS_NO_MESSAGE) + .setMessageFuture(messageFutureNotDoneExpected) + .build()); + ackIdsInitialRequest.add(MOCK_ACK_ID_SUCCESS_NO_MESSAGE); + + // INVALID + SettableApiFuture messageFutureInvalidExpected = SettableApiFuture.create(); + modackRequestDataDefault.addAckRequestData( + AckRequestData.newBuilder(MOCK_ACK_ID_INVALID) + .setMessageFuture(messageFutureInvalidExpected) + .build()); + errorInfoMetadataMapInitialRequest.put(MOCK_ACK_ID_INVALID, PERMANENT_FAILURE_INVALID_ACK_ID); + ackIdsInitialRequest.add(MOCK_ACK_ID_INVALID); + + // OTHER + SettableApiFuture messageFutureOtherExpected = SettableApiFuture.create(); + modackRequestDataDefault.addAckRequestData( + AckRequestData.newBuilder(MOCK_ACK_ID_OTHER) + .setMessageFuture(messageFutureOtherExpected) + .build()); + errorInfoMetadataMapInitialRequest.put(MOCK_ACK_ID_OTHER, PERMANENT_FAILURE_OTHER); + ackIdsInitialRequest.add(MOCK_ACK_ID_OTHER); + + // Initial) FAILURE - TRANSIENT SERVICE UNAVAILABLE + // Retry) SUCCESS - but no message future set + SettableApiFuture messageFutureTransientFailureServiceUnavailableThenSuccess = + SettableApiFuture.create(); + modackRequestDataDefault.addAckRequestData( + AckRequestData.newBuilder(MOCK_ACK_ID_TRANSIENT_FAILURE_SERVICE_UNAVAILABLE_THEN_SUCCESS) + .setMessageFuture(messageFutureTransientFailureServiceUnavailableThenSuccess) + .build()); + errorInfoMetadataMapInitialRequest.put( + MOCK_ACK_ID_TRANSIENT_FAILURE_SERVICE_UNAVAILABLE_THEN_SUCCESS, + TRANSIENT_FAILURE_SERVICE_UNAVAILABLE); + ackIdsInitialRequest.add(MOCK_ACK_ID_TRANSIENT_FAILURE_SERVICE_UNAVAILABLE_THEN_SUCCESS); + ackIdsRetryRequest.add(MOCK_ACK_ID_TRANSIENT_FAILURE_SERVICE_UNAVAILABLE_THEN_SUCCESS); + + // Initial) FAILURE - TRANSIENT - UNORDERED ACK ID + // Retry) SUCCESS - but no message future set + SettableApiFuture messageFutureTransientFailureUnorderedAckIdThenSuccess = + SettableApiFuture.create(); + modackRequestDataDefault.addAckRequestData( + AckRequestData.newBuilder(MOCK_ACK_ID_TRANSIENT_FAILURE_UNORDERED_ACK_ID_THEN_SUCCESS) + .setMessageFuture(messageFutureTransientFailureUnorderedAckIdThenSuccess) + .build()); + errorInfoMetadataMapInitialRequest.put( + MOCK_ACK_ID_TRANSIENT_FAILURE_UNORDERED_ACK_ID_THEN_SUCCESS, + TRANSIENT_FAILURE_UNORDERED_ACK_ID); + ackIdsInitialRequest.add(MOCK_ACK_ID_TRANSIENT_FAILURE_UNORDERED_ACK_ID_THEN_SUCCESS); + ackIdsRetryRequest.add(MOCK_ACK_ID_TRANSIENT_FAILURE_UNORDERED_ACK_ID_THEN_SUCCESS); + + modackRequestDataList.add(modackRequestDataDefault); + + // Build our requests so we can set our mock responses + ModifyAckDeadlineRequest modifyAckDeadlineRequestNack = + ModifyAckDeadlineRequest.newBuilder() + .setSubscription(MOCK_SUBSCRIPTION_NAME) + .addAckIds(MOCK_ACK_ID_NACK_SUCCESS) + .setAckDeadlineSeconds(0) + .build(); + + ModifyAckDeadlineRequest modifyAckDeadlineRequestInitial = + ModifyAckDeadlineRequest.newBuilder() + .setSubscription(MOCK_SUBSCRIPTION_NAME) + .addAllAckIds(ackIdsInitialRequest) + .setAckDeadlineSeconds(MOCK_ACK_EXTENSION_DEFAULT_SECONDS) + .build(); + + ModifyAckDeadlineRequest modifyAckDeadlineRequestRetry = + ModifyAckDeadlineRequest.newBuilder() + .setSubscription(MOCK_SUBSCRIPTION_NAME) + .addAllAckIds(ackIdsRetryRequest) + .setAckDeadlineSeconds(MOCK_ACK_EXTENSION_DEFAULT_SECONDS) + .build(); + + // Set mock grpc responses + when(mockSubscriberStub.modifyAckDeadlineCallable().futureCall(modifyAckDeadlineRequestNack)) + .thenReturn(ApiFutures.immediateFuture(null)); + when(mockSubscriberStub.modifyAckDeadlineCallable().futureCall(modifyAckDeadlineRequestInitial)) + .thenReturn( + ApiFutures.immediateFailedFuture( + getMockStatusException(errorInfoMetadataMapInitialRequest))); + when(mockSubscriberStub + .modifyAckDeadlineCallable() + .futureCall( + argThat( + new CustomArgumentMatchers.ModifyAckDeadlineRequestMatcher( + modifyAckDeadlineRequestRetry)))) + .thenReturn(ApiFutures.immediateFuture(null)); + + // Instantiate class and run operation(s) + StreamingSubscriberConnection streamingSubscriberConnection = + getStreamingSubscriberConnection(true); + + streamingSubscriberConnection.sendModackOperations(modackRequestDataList); + + // Backoff + systemExecutor.advanceTime(Duration.ofSeconds(200)); + + // Assert expected behavior + verify(mockSubscriberStub.modifyAckDeadlineCallable(), times(1)) + .futureCall(modifyAckDeadlineRequestNack); + verify(mockSubscriberStub.modifyAckDeadlineCallable(), times(1)) + .futureCall(modifyAckDeadlineRequestInitial); + verify(mockSubscriberStub.modifyAckDeadlineCallable(), times(1)) + .futureCall(modifyAckDeadlineRequestRetry); + verify(mockSubscriberStub, never()).acknowledgeCallable(); + + try { + assertEquals(AckResponse.SUCCESSFUL, messageFutureSuccessExpected.get()); + assertEquals(AckResponse.INVALID, messageFutureInvalidExpected.get()); + assertEquals(AckResponse.OTHER, messageFutureOtherExpected.get()); + assertFalse(messageFutureTransientFailureServiceUnavailableThenSuccess.isDone()); + assertFalse(messageFutureTransientFailureUnorderedAckIdThenSuccess.isDone()); + } catch (InterruptedException | ExecutionException e) { + // In case something goes wrong retrieving the futures + throw new AssertionError(); + } + } + + @Test + public void testSendAckOperationsExactlyOnceEnabledMessageFuturesAcks() { + // Setup + + // The list(s) of ackIds allows us to mock the grpc response(s) + List ackIdsInitialRequest = new ArrayList<>(); + List ackIdsRetryRequest = new ArrayList<>(); + + Map errorInfoMetadataMapInitialRequest = new HashMap(); + List ackRequestDataList = new ArrayList(); + + // SUCCESS + SettableApiFuture messageFutureSuccessExpected = SettableApiFuture.create(); + ackRequestDataList.add( + AckRequestData.newBuilder(MOCK_ACK_ID_SUCCESS) + .setMessageFuture(messageFutureSuccessExpected) + .build()); + ackIdsInitialRequest.add(MOCK_ACK_ID_SUCCESS); + + // INVALID + SettableApiFuture messageFutureInvalidExpected = SettableApiFuture.create(); + ackRequestDataList.add( + AckRequestData.newBuilder(MOCK_ACK_ID_INVALID) + .setMessageFuture(messageFutureInvalidExpected) + .build()); + errorInfoMetadataMapInitialRequest.put(MOCK_ACK_ID_INVALID, PERMANENT_FAILURE_INVALID_ACK_ID); + ackIdsInitialRequest.add(MOCK_ACK_ID_INVALID); + + // OTHER + SettableApiFuture messageFutureOtherExpected = SettableApiFuture.create(); + ackRequestDataList.add( + AckRequestData.newBuilder(MOCK_ACK_ID_OTHER) + .setMessageFuture(messageFutureOtherExpected) + .build()); + errorInfoMetadataMapInitialRequest.put(MOCK_ACK_ID_OTHER, PERMANENT_FAILURE_OTHER); + ackIdsInitialRequest.add(MOCK_ACK_ID_OTHER); + + // Initial) FAILURE - TRANSIENT SERVICE UNAVAILABLE + // Retry) SUCCESS + SettableApiFuture messageFutureTransientFailureServiceUnavailableThenSuccess = + SettableApiFuture.create(); + ackRequestDataList.add( + AckRequestData.newBuilder(MOCK_ACK_ID_TRANSIENT_FAILURE_SERVICE_UNAVAILABLE_THEN_SUCCESS) + .setMessageFuture(messageFutureTransientFailureServiceUnavailableThenSuccess) + .build()); + errorInfoMetadataMapInitialRequest.put( + MOCK_ACK_ID_TRANSIENT_FAILURE_SERVICE_UNAVAILABLE_THEN_SUCCESS, + TRANSIENT_FAILURE_SERVICE_UNAVAILABLE); + ackIdsInitialRequest.add(MOCK_ACK_ID_TRANSIENT_FAILURE_SERVICE_UNAVAILABLE_THEN_SUCCESS); + ackIdsRetryRequest.add(MOCK_ACK_ID_TRANSIENT_FAILURE_SERVICE_UNAVAILABLE_THEN_SUCCESS); + + // Initial) FAILURE - TRANSIENT - UNORDERED ACK ID + // Retry) SUCCESS + SettableApiFuture messageFutureTransientFailureUnorderedAckIdThenSuccess = + SettableApiFuture.create(); + ackRequestDataList.add( + AckRequestData.newBuilder(MOCK_ACK_ID_TRANSIENT_FAILURE_UNORDERED_ACK_ID_THEN_SUCCESS) + .setMessageFuture(messageFutureTransientFailureUnorderedAckIdThenSuccess) + .build()); + errorInfoMetadataMapInitialRequest.put( + MOCK_ACK_ID_TRANSIENT_FAILURE_UNORDERED_ACK_ID_THEN_SUCCESS, + TRANSIENT_FAILURE_UNORDERED_ACK_ID); + ackIdsInitialRequest.add(MOCK_ACK_ID_TRANSIENT_FAILURE_UNORDERED_ACK_ID_THEN_SUCCESS); + ackIdsRetryRequest.add(MOCK_ACK_ID_TRANSIENT_FAILURE_UNORDERED_ACK_ID_THEN_SUCCESS); + + // Build our requests so we can set our mock responses + AcknowledgeRequest acknowledgeRequestInitial = + AcknowledgeRequest.newBuilder() + .setSubscription(MOCK_SUBSCRIPTION_NAME) + .addAllAckIds(ackIdsInitialRequest) + .build(); + + AcknowledgeRequest acknowledgeRequestRetry = + AcknowledgeRequest.newBuilder() + .setSubscription(MOCK_SUBSCRIPTION_NAME) + .addAllAckIds(ackIdsRetryRequest) + .build(); + + // Set mock grpc responses + when(mockSubscriberStub.acknowledgeCallable().futureCall(acknowledgeRequestInitial)) + .thenReturn( + ApiFutures.immediateFailedFuture( + getMockStatusException(errorInfoMetadataMapInitialRequest))); + when(mockSubscriberStub + .acknowledgeCallable() + .futureCall( + argThat( + new CustomArgumentMatchers.AcknowledgeRequestMatcher(acknowledgeRequestRetry)))) + .thenReturn(ApiFutures.immediateFuture(null)); + + // Instantiate class and run operation(s) + StreamingSubscriberConnection streamingSubscriberConnection = + getStreamingSubscriberConnection(true); + + streamingSubscriberConnection.sendAckOperations(ackRequestDataList); + + // Backoff + systemExecutor.advanceTime(Duration.ofMillis(200)); + + // Assert expected behavior; + verify(mockSubscriberStub.acknowledgeCallable(), times(1)) + .futureCall(acknowledgeRequestInitial); + verify(mockSubscriberStub.acknowledgeCallable(), times(1)) + .futureCall( + argThat(new CustomArgumentMatchers.AcknowledgeRequestMatcher(acknowledgeRequestRetry))); + verify(mockSubscriberStub, never()).modifyAckDeadlineCallable(); + + try { + assertEquals(AckResponse.SUCCESSFUL, messageFutureSuccessExpected.get()); + assertEquals(AckResponse.INVALID, messageFutureInvalidExpected.get()); + assertEquals(AckResponse.OTHER, messageFutureOtherExpected.get()); + assertEquals( + AckResponse.SUCCESSFUL, messageFutureTransientFailureServiceUnavailableThenSuccess.get()); + assertEquals( + AckResponse.SUCCESSFUL, messageFutureTransientFailureUnorderedAckIdThenSuccess.get()); + } catch (InterruptedException | ExecutionException e) { + // In case something goes wrong retrieving the futures + throw new AssertionError(); + } + } + + @Test + public void testSendAckOperationsExactlyOnceEnabledErrorWithEmptyMetadataMap() { + // Setup + + // The list(s) of ackIds allows us to mock the grpc response(s) + List ackIdsRequest = new ArrayList<>(); + List ackRequestDataList = new ArrayList(); + + // Initial) INTERNAL error, retryable + // Retry) PERMISSION_DENIED, not retryable + SettableApiFuture messageInternalErrorThenPermissionDenied = + SettableApiFuture.create(); + ackRequestDataList.add( + AckRequestData.newBuilder(MOCK_ACK_ID_NO_METADATA_MAP_INTERNAL_ERROR_THEN_PERMISSION_DENIED) + .setMessageFuture(messageInternalErrorThenPermissionDenied) + .build()); + ackIdsRequest.add(MOCK_ACK_ID_NO_METADATA_MAP_INTERNAL_ERROR_THEN_PERMISSION_DENIED); + + // Build our request so we can set our mock responses + AcknowledgeRequest acknowledgeRequest = + AcknowledgeRequest.newBuilder() + .setSubscription(MOCK_SUBSCRIPTION_NAME) + .addAllAckIds(ackIdsRequest) + .build(); + + ApiException internalError = + new ApiException("internal", null, GrpcStatusCode.of(Code.INTERNAL), true); + ApiException permissionDeniedError = + new ApiException( + "permission_denied", null, GrpcStatusCode.of(Code.PERMISSION_DENIED), false); + // Set mock grpc responses + when(mockSubscriberStub.acknowledgeCallable().futureCall(acknowledgeRequest)) + .thenReturn(ApiFutures.immediateFailedFuture(internalError)) + .thenReturn(ApiFutures.immediateFailedFuture(permissionDeniedError)); + + // Instantiate class and run operation(s) + StreamingSubscriberConnection streamingSubscriberConnection = + getStreamingSubscriberConnection(true); + + streamingSubscriberConnection.sendAckOperations(ackRequestDataList); + + // Backoff + systemExecutor.advanceTime(Duration.ofMillis(200)); + + // Assert expected behavior; + verify(mockSubscriberStub.acknowledgeCallable(), times(2)).futureCall(acknowledgeRequest); + verify(mockSubscriberStub, never()).modifyAckDeadlineCallable(); + + try { + assertEquals(AckResponse.PERMISSION_DENIED, messageInternalErrorThenPermissionDenied.get()); + } catch (InterruptedException | ExecutionException e) { + // In case something goes wrong retrieving the futures + throw new AssertionError(); + } + } + + @Test + public void testSetFailureResponseOutstandingMessages() { + // Setup + + List ackRequestDataList = new ArrayList(); + List nackRequestDataList = new ArrayList(); + List> futureList = + new ArrayList>(); + + // Create some acks + for (int i = 0; i < 5; i++) { + SettableApiFuture future = SettableApiFuture.create(); + futureList.add(future); + ackRequestDataList.add( + AckRequestData.newBuilder("ACK-ID-" + i).setMessageFuture(future).build()); + } + + // Create some nacks + for (int i = 5; i < 10; i++) { + SettableApiFuture future = SettableApiFuture.create(); + futureList.add(future); + nackRequestDataList.add( + AckRequestData.newBuilder("ACK-ID-" + i).setMessageFuture(future).build()); + } + + ModackRequestData modackRequestData = new ModackRequestData(0, nackRequestDataList); + + StreamingSubscriberConnection streamingSubscriberConnection = + getStreamingSubscriberConnection(true); + + streamingSubscriberConnection.sendAckOperations(ackRequestDataList); + streamingSubscriberConnection.sendModackOperations( + Collections.singletonList(modackRequestData)); + + // Assert pending status + futureList.forEach( + ackResponseSettableApiFuture -> { + assertFalse(ackResponseSettableApiFuture.isDone()); + }); + + // Set + streamingSubscriberConnection.setResponseOutstandingMessages(AckResponse.PERMISSION_DENIED); + + // Assert futures + + futureList.forEach( + ackResponseSettableApiFuture -> { + try { + assertEquals(ackResponseSettableApiFuture.get(), AckResponse.PERMISSION_DENIED); + } catch (InterruptedException | ExecutionException e) { + // In case something goes wrong retrieving the futures + throw new AssertionError(); + } + }); + } + + @Test + public void testMaxPerRequestChanges() { + // Setup mocks + List modackRequestDataList = new ArrayList(); + List ackRequestDataList = new ArrayList(); + + int numAckIds = 3000; + int numMaxPerRequestChanges = 1000; + + List mockAckIds = new ArrayList(); + + for (int i = 0; i < numAckIds; i++) { + String mockAckId = "MOCK-ACK-ID-" + i; + mockAckIds.add(mockAckId); + ackRequestDataList.add(AckRequestData.newBuilder(mockAckId).build()); + } + + modackRequestDataList.add( + new ModackRequestData(MOCK_ACK_EXTENSION_DEFAULT_SECONDS, ackRequestDataList)); + + // Instantiate class and run operation(s) + StreamingSubscriberConnection streamingSubscriberConnection = + getStreamingSubscriberConnection(false); + streamingSubscriberConnection.sendAckOperations(ackRequestDataList); + streamingSubscriberConnection.sendModackOperations(modackRequestDataList); + + // Assert expected behavior + for (List mockAckIdsInRequest : Lists.partition(mockAckIds, numMaxPerRequestChanges)) { + AcknowledgeRequest expectedAcknowledgeRequest = + AcknowledgeRequest.newBuilder() + .setSubscription(MOCK_SUBSCRIPTION_NAME) + .addAllAckIds(mockAckIdsInRequest) + .build(); + verify(mockSubscriberStub.acknowledgeCallable(), times(1)) + .futureCall(expectedAcknowledgeRequest); + + ModifyAckDeadlineRequest expectedModifyAckDeadlineRequest = + ModifyAckDeadlineRequest.newBuilder() + .setSubscription(MOCK_SUBSCRIPTION_NAME) + .addAllAckIds(mockAckIdsInRequest) + .setAckDeadlineSeconds(MOCK_ACK_EXTENSION_DEFAULT_SECONDS) + .build(); + verify(mockSubscriberStub.modifyAckDeadlineCallable(), times(1)) + .futureCall(expectedModifyAckDeadlineRequest); + } + } + + @Test + public void testClientPinger_pingSent() { + BidiStreamingCallable mockStreamingCallable = + mock(BidiStreamingCallable.class); + ClientStream mockClientStream = mock(ClientStream.class); + when(mockSubscriberStub.streamingPullCallable()).thenReturn(mockStreamingCallable); + when(mockStreamingCallable.splitCall(any(ResponseObserver.class), any())) + .thenReturn(mockClientStream); + + StreamingSubscriberConnection streamingSubscriberConnection = + getKeepaliveStreamingSubscriberConnection(); + + streamingSubscriberConnection.startAsync(); + streamingSubscriberConnection.awaitRunning(); + + systemExecutor.advanceTime(CLIENT_PING_INTERVAL); + systemExecutor.advanceTime(CLIENT_PING_INTERVAL); + + ArgumentCaptor requestCaptor = + ArgumentCaptor.forClass(StreamingPullRequest.class); + // 1 initial request + 3 pings + verify(mockClientStream, times(4)).send(requestCaptor.capture()); + List requests = requestCaptor.getAllValues(); + + StreamingPullRequest initialRequest = requests.get(0); + assertEquals(MOCK_SUBSCRIPTION_NAME, initialRequest.getSubscription()); + assertEquals(KEEP_ALIVE_SUPPORT_VERSION, initialRequest.getProtocolVersion()); + assertEquals(0, initialRequest.getMaxOutstandingMessages()); + + StreamingPullRequest firstPing = requests.get(1); + assertEquals(StreamingPullRequest.getDefaultInstance(), firstPing); + + StreamingPullRequest secondPing = requests.get(2); + assertEquals(StreamingPullRequest.getDefaultInstance(), secondPing); + + streamingSubscriberConnection.stopAsync(); + streamingSubscriberConnection.awaitTerminated(); + + // No more pings + systemExecutor.advanceTime(CLIENT_PING_INTERVAL); + verify(mockClientStream, times(4)).send(any(StreamingPullRequest.class)); + } + + @Test + public void testClientPinger_pingsNotSentWhenDisabled() { + BidiStreamingCallable mockStreamingCallable = + mock(BidiStreamingCallable.class); + ClientStream mockClientStream = mock(ClientStream.class); + when(mockSubscriberStub.streamingPullCallable()).thenReturn(mockStreamingCallable); + when(mockStreamingCallable.splitCall(any(ResponseObserver.class), any())) + .thenReturn(mockClientStream); + + StreamingSubscriberConnection streamingSubscriberConnection = + getStreamingSubscriberConnection(false); // keepalive disabled + + streamingSubscriberConnection.startAsync(); + streamingSubscriberConnection.awaitRunning(); + + // Initial request. + verify(mockClientStream, times(1)).send(any(StreamingPullRequest.class)); + + // No pings + systemExecutor.advanceTime(CLIENT_PING_INTERVAL); + systemExecutor.advanceTime(CLIENT_PING_INTERVAL); + + verify(mockClientStream, times(1)).send(any(StreamingPullRequest.class)); + } + + @Test + public void testServerMonitor_timesOut() { + BidiStreamingCallable mockStreamingCallable = + mock(BidiStreamingCallable.class); + ClientStream mockClientStream = mock(ClientStream.class); + ArgumentCaptor> observerCaptor = + ArgumentCaptor.forClass(ResponseObserver.class); + when(mockSubscriberStub.streamingPullCallable()).thenReturn(mockStreamingCallable); + when(mockStreamingCallable.splitCall(observerCaptor.capture(), any())) + .thenReturn(mockClientStream); + + // fail pings after the first one to ensure timeout occurs + AtomicInteger pingCount = new AtomicInteger(0); + doAnswer( + (invocation) -> { + StreamingPullRequest req = invocation.getArgument(0); + // Pings are empty requests + if (req.getSubscription().isEmpty()) { + if (pingCount.incrementAndGet() > 2) { // allow first 2 pings + throw new RuntimeException("ping failed"); + } + } + return null; + }) + .when(mockClientStream) + .send(any(StreamingPullRequest.class)); + + StreamingSubscriberConnection streamingSubscriberConnection = + getKeepaliveStreamingSubscriberConnection(); + + streamingSubscriberConnection.startAsync(); + streamingSubscriberConnection.awaitRunning(); + + ResponseObserver observer = observerCaptor.getValue(); + StreamController mockController = mock(StreamController.class); + observer.onStart(mockController); + + systemExecutor.advanceTime(CLIENT_PING_INTERVAL); + verify(mockClientStream, never()).closeSendWithError(any(Exception.class)); + + systemExecutor.advanceTime(CLIENT_PING_INTERVAL); + ArgumentCaptor exceptionCaptor = ArgumentCaptor.forClass(Exception.class); + verify(mockClientStream, times(1)).closeSendWithError(exceptionCaptor.capture()); + StatusException exception = (StatusException) exceptionCaptor.getValue(); + assertEquals(Code.UNAVAILABLE, exception.getStatus().getCode()); + assertEquals("Keepalive timeout with server", exception.getStatus().getDescription()); + } + + @Test + public void testServerMonitor_doesNotTimeOutIfResponseReceived() { + BidiStreamingCallable mockStreamingCallable = + mock(BidiStreamingCallable.class); + ClientStream mockClientStream = mock(ClientStream.class); + ArgumentCaptor> observerCaptor = + ArgumentCaptor.forClass(ResponseObserver.class); + when(mockSubscriberStub.streamingPullCallable()).thenReturn(mockStreamingCallable); + when(mockStreamingCallable.splitCall(observerCaptor.capture(), any())) + .thenReturn(mockClientStream); + + StreamingSubscriberConnection streamingSubscriberConnection = + getKeepaliveStreamingSubscriberConnection(); + + streamingSubscriberConnection.startAsync(); + streamingSubscriberConnection.awaitRunning(); + + ResponseObserver observer = observerCaptor.getValue(); + StreamController mockController = mock(StreamController.class); + observer.onStart(mockController); + + // t=30s: ping sent. + // t=40s: response received. + // t=45s: monitor check. lastPing=30, lastResponse=40. lastPing>lastResponse is false -> no + // timeout. + systemExecutor.advanceTime(Duration.ofSeconds(40)); + observer.onResponse(StreamingPullResponse.getDefaultInstance()); + systemExecutor.advanceTime(Duration.ofSeconds(20)); // to t=60s + observer.onResponse(StreamingPullResponse.getDefaultInstance()); + + verify(mockClientStream, never()).closeSendWithError(any(Exception.class)); + } + + private StreamingSubscriberConnection getStreamingSubscriberConnection( + boolean exactlyOnceDeliveryEnabled) { + StreamingSubscriberConnection streamingSubscriberConnection = + getStreamingSubscriberConnectionFromBuilder( + StreamingSubscriberConnection.newBuilder(mock(MessageReceiverWithAckResponse.class))); + + // This would normally be set from the streaming pull response + streamingSubscriberConnection.setExactlyOnceDeliveryEnabled(exactlyOnceDeliveryEnabled); + + return streamingSubscriberConnection; + } + + private StreamingSubscriberConnection getKeepaliveStreamingSubscriberConnection() { + StreamingSubscriberConnection streamingSubscriberConnection = + getStreamingSubscriberConnectionFromBuilder( + StreamingSubscriberConnection.newBuilder(mock(MessageReceiverWithAckResponse.class)) + .setProtocolVersion(KEEP_ALIVE_SUPPORT_VERSION)); + + return streamingSubscriberConnection; + } + + private StreamingSubscriberConnection getStreamingSubscriberConnectionFromBuilder( + StreamingSubscriberConnection.Builder builder) { + return builder + .setSubscription(MOCK_SUBSCRIPTION_NAME) + .setAckExpirationPadding(ACK_EXPIRATION_PADDING_DEFAULT_DURATION) + .setMaxAckExtensionPeriod(MAX_ACK_EXTENSION_PERIOD) + .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(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(); + } + + private StatusException getMockStatusException(Map metadata) { + ErrorInfo errorInfo = ErrorInfo.newBuilder().putAllMetadata(metadata).build(); + Status status = + Status.newBuilder() + .setCode(StatusCode.Code.OK.ordinal()) + .addDetails(Any.pack(errorInfo)) + .build(); + return StatusProto.toStatusException(status); + } +} 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 4491b6ef9..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 @@ -16,12 +16,7 @@ package com.google.cloud.pubsub.v1; -import static com.google.cloud.pubsub.v1.StreamingSubscriberConnection.DEFAULT_STREAM_ACK_DEADLINE; -import static com.google.cloud.pubsub.v1.StreamingSubscriberConnection.MAX_STREAM_ACK_DEADLINE; -import static com.google.cloud.pubsub.v1.StreamingSubscriberConnection.MIN_STREAM_ACK_DEADLINE; -import static com.google.cloud.pubsub.v1.Subscriber.DEFAULT_MAX_DURATION_PER_ACK_EXTENSION; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.*; import com.google.api.gax.batching.FlowControlSettings; import com.google.api.gax.core.ExecutorProvider; @@ -30,9 +25,7 @@ import com.google.api.gax.core.NoCredentialsProvider; import com.google.api.gax.grpc.GrpcStatusCode; import com.google.api.gax.grpc.GrpcTransportChannel; -import com.google.api.gax.rpc.ApiException; -import com.google.api.gax.rpc.FixedTransportChannelProvider; -import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.*; import com.google.cloud.pubsub.v1.Subscriber.Builder; import com.google.pubsub.v1.ProjectSubscriptionName; import com.google.pubsub.v1.PubsubMessage; @@ -42,15 +35,13 @@ import io.grpc.StatusException; import io.grpc.inprocess.InProcessChannelBuilder; import io.grpc.inprocess.InProcessServerBuilder; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; +import java.time.Duration; +import java.util.concurrent.*; import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TestName; -import org.threeten.bp.Duration; /** Tests for {@link Subscriber}. */ public class SubscriberTest { @@ -62,6 +53,8 @@ public class SubscriberTest { private FakeScheduledExecutorService fakeExecutor; private FakeSubscriberServiceImpl fakeSubscriberServiceImpl; private Server testServer; + private LinkedBlockingQueue consumersWithResponse; + private MessageReceiverWithAckResponse messageReceiverWithAckResponse; private final MessageReceiver testReceiver = new MessageReceiver() { @@ -75,6 +68,7 @@ public void receiveMessage(PubsubMessage message, AckReplyConsumer consumer) { @Before public void setUp() throws Exception { + consumersWithResponse = new LinkedBlockingQueue<>(); InProcessServerBuilder serverBuilder = InProcessServerBuilder.forName(testName.getMethodName()); fakeSubscriberServiceImpl = new FakeSubscriberServiceImpl(); fakeExecutor = new FakeScheduledExecutorService(); @@ -82,6 +76,16 @@ public void setUp() throws Exception { serverBuilder.addService(fakeSubscriberServiceImpl); testServer = serverBuilder.build(); testServer.start(); + + messageReceiverWithAckResponse = + new MessageReceiverWithAckResponse() { + @Override + public void receiveMessage( + final PubsubMessage message, + final AckReplyConsumerWithResponse consumerWithResponse) { + consumersWithResponse.add(consumerWithResponse); + } + }; } @After @@ -237,11 +241,12 @@ public void testStreamAckDeadlineIsSetCorrectly() throws Exception { Subscriber subscriber = startSubscriber( getTestSubscriberBuilder(testReceiver) - .setMaxDurationPerAckExtension(Duration.ofSeconds(maxDurationPerAckExtension))); + .setMaxDurationPerAckExtensionDuration( + Duration.ofSeconds(maxDurationPerAckExtension))); assertEquals( expectedChannelCount, fakeSubscriberServiceImpl.waitForOpenedStreams(expectedChannelCount)); assertEquals( - MIN_STREAM_ACK_DEADLINE.getSeconds(), + Math.toIntExact(Subscriber.MIN_STREAM_ACK_DEADLINE.getSeconds()), fakeSubscriberServiceImpl.getLastSeenRequest().getStreamAckDeadlineSeconds()); subscriber.stopAsync().awaitTerminated(); @@ -251,11 +256,12 @@ public void testStreamAckDeadlineIsSetCorrectly() throws Exception { subscriber = startSubscriber( getTestSubscriberBuilder(testReceiver) - .setMaxDurationPerAckExtension(Duration.ofSeconds(maxDurationPerAckExtension))); + .setMaxDurationPerAckExtensionDuration( + Duration.ofSeconds(maxDurationPerAckExtension))); assertEquals( expectedChannelCount, fakeSubscriberServiceImpl.waitForOpenedStreams(expectedChannelCount)); assertEquals( - MAX_STREAM_ACK_DEADLINE.getSeconds(), + Math.toIntExact(Subscriber.MAX_STREAM_ACK_DEADLINE.getSeconds()), fakeSubscriberServiceImpl.getLastSeenRequest().getStreamAckDeadlineSeconds()); subscriber.stopAsync().awaitTerminated(); @@ -265,7 +271,8 @@ public void testStreamAckDeadlineIsSetCorrectly() throws Exception { subscriber = startSubscriber( getTestSubscriberBuilder(testReceiver) - .setMaxDurationPerAckExtension(Duration.ofSeconds(maxDurationPerAckExtension))); + .setMaxDurationPerAckExtensionDuration( + Duration.ofSeconds(maxDurationPerAckExtension))); assertEquals( expectedChannelCount, fakeSubscriberServiceImpl.waitForOpenedStreams(expectedChannelCount)); assertEquals( @@ -275,15 +282,11 @@ public void testStreamAckDeadlineIsSetCorrectly() throws Exception { subscriber.stopAsync().awaitTerminated(); // maxDurationPerAckExtension is unset. - maxDurationPerAckExtension = (int) DEFAULT_MAX_DURATION_PER_ACK_EXTENSION.getSeconds(); - subscriber = - startSubscriber( - getTestSubscriberBuilder(testReceiver) - .setMaxDurationPerAckExtension(Duration.ofSeconds(maxDurationPerAckExtension))); + subscriber = startSubscriber(getTestSubscriberBuilder(testReceiver)); assertEquals( expectedChannelCount, fakeSubscriberServiceImpl.waitForOpenedStreams(expectedChannelCount)); assertEquals( - DEFAULT_STREAM_ACK_DEADLINE.getSeconds(), + Math.toIntExact(Subscriber.STREAM_ACK_DEADLINE_DEFAULT.getSeconds()), fakeSubscriberServiceImpl.getLastSeenRequest().getStreamAckDeadlineSeconds()); subscriber.stopAsync().awaitTerminated(); @@ -294,8 +297,7 @@ public void testPartialFlowControlSettings() throws Exception { Subscriber subscriber = getTestSubscriberBuilder(testReceiver) .setFlowControlSettings( - Subscriber.Builder.DEFAULT_FLOW_CONTROL_SETTINGS - .toBuilder() + Subscriber.Builder.DEFAULT_FLOW_CONTROL_SETTINGS.toBuilder() .setMaxOutstandingElementCount(500L) .build()) .build(); @@ -307,8 +309,7 @@ public void testPartialFlowControlSettings() throws Exception { subscriber = getTestSubscriberBuilder(testReceiver) .setFlowControlSettings( - Subscriber.Builder.DEFAULT_FLOW_CONTROL_SETTINGS - .toBuilder() + Subscriber.Builder.DEFAULT_FLOW_CONTROL_SETTINGS.toBuilder() .setMaxOutstandingRequestBytes(5_000_000_000L) .build()) .build(); @@ -319,14 +320,126 @@ 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(); return subscriber; } - private Builder getTestSubscriberBuilder(MessageReceiver receiver) { - return Subscriber.newBuilder(TEST_SUBSCRIPTION, receiver) + private Builder getTestSubscriberBuilder(MessageReceiver messageReceiver) { + return Subscriber.newBuilder(TEST_SUBSCRIPTION, messageReceiver) + .setExecutorProvider(FixedExecutorProvider.create(fakeExecutor)) + .setSystemExecutorProvider(FixedExecutorProvider.create(fakeExecutor)) + .setChannelProvider( + FixedTransportChannelProvider.create(GrpcTransportChannel.create(testChannel))) + .setCredentialsProvider(NoCredentialsProvider.create()) + .setClock(fakeExecutor.getClock()) + .setParallelPullCount(1) + .setFlowControlSettings( + FlowControlSettings.newBuilder().setMaxOutstandingElementCount(1000L).build()); + } + + private Builder getTestSubscriberBuilder( + MessageReceiverWithAckResponse messageReceiverWithAckResponse) { + return Subscriber.newBuilder(TEST_SUBSCRIPTION, messageReceiverWithAckResponse) .setExecutorProvider(FixedExecutorProvider.create(fakeExecutor)) .setSystemExecutorProvider(FixedExecutorProvider.create(fakeExecutor)) .setChannelProvider( @@ -334,7 +447,6 @@ private Builder getTestSubscriberBuilder(MessageReceiver receiver) { .setCredentialsProvider(NoCredentialsProvider.create()) .setClock(fakeExecutor.getClock()) .setParallelPullCount(1) - .setMaxDurationPerAckExtension(Duration.ofSeconds(5)) .setFlowControlSettings( FlowControlSettings.newBuilder().setMaxOutstandingElementCount(1000L).build()); } 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 new file mode 100644 index 000000000..8ec2cdfab --- /dev/null +++ b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/SubscriptionAdminClientHttpJsonTest.java @@ -0,0 +1,2009 @@ +/* + * Copyright 2026 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 static com.google.cloud.pubsub.v1.SubscriptionAdminClient.ListSnapshotsPagedResponse; +import static com.google.cloud.pubsub.v1.SubscriptionAdminClient.ListSubscriptionsPagedResponse; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.pubsub.v1.stub.HttpJsonSubscriberStub; +import com.google.common.collect.Lists; +import com.google.iam.v1.AuditConfig; +import com.google.iam.v1.Binding; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import com.google.protobuf.ByteString; +import com.google.protobuf.Duration; +import com.google.protobuf.Empty; +import com.google.protobuf.FieldMask; +import com.google.protobuf.Timestamp; +import com.google.pubsub.v1.BigQueryConfig; +import com.google.pubsub.v1.BigtableConfig; +import com.google.pubsub.v1.CloudStorageConfig; +import com.google.pubsub.v1.DeadLetterPolicy; +import com.google.pubsub.v1.ExpirationPolicy; +import com.google.pubsub.v1.ListSnapshotsResponse; +import com.google.pubsub.v1.ListSubscriptionsResponse; +import com.google.pubsub.v1.MessageTransform; +import com.google.pubsub.v1.ProjectName; +import com.google.pubsub.v1.PullResponse; +import com.google.pubsub.v1.PushConfig; +import com.google.pubsub.v1.ReceivedMessage; +import com.google.pubsub.v1.RetryPolicy; +import com.google.pubsub.v1.SchemaName; +import com.google.pubsub.v1.SeekRequest; +import com.google.pubsub.v1.SeekResponse; +import com.google.pubsub.v1.Snapshot; +import com.google.pubsub.v1.SnapshotName; +import com.google.pubsub.v1.Subscription; +import com.google.pubsub.v1.SubscriptionName; +import com.google.pubsub.v1.TopicName; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import javax.annotation.Generated; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@Generated("by gapic-generator-java") +public class SubscriptionAdminClientHttpJsonTest { + private static MockHttpService mockService; + private static SubscriptionAdminClient client; + + @BeforeClass + public static void startStaticServer() throws IOException { + mockService = + new MockHttpService( + HttpJsonSubscriberStub.getMethodDescriptors(), + SubscriptionAdminSettings.getDefaultEndpoint()); + SubscriptionAdminSettings settings = + SubscriptionAdminSettings.newHttpJsonBuilder() + .setTransportChannelProvider( + SubscriptionAdminSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = SubscriptionAdminClient.create(settings); + } + + @AfterClass + public static void stopServer() { + client.close(); + } + + @Before + public void setUp() {} + + @After + public void tearDown() throws Exception { + mockService.reset(); + } + + @Test + public void createSubscriptionTest() throws Exception { + Subscription expectedResponse = + Subscription.newBuilder() + .setName(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString()) + .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) + .setPushConfig(PushConfig.newBuilder().build()) + .setBigqueryConfig(BigQueryConfig.newBuilder().build()) + .setCloudStorageConfig(CloudStorageConfig.newBuilder().build()) + .setBigtableConfig(BigtableConfig.newBuilder().build()) + .setAckDeadlineSeconds(2135351438) + .setRetainAckedMessages(true) + .setMessageRetentionDuration(Duration.newBuilder().build()) + .putAllLabels(new HashMap()) + .setEnableMessageOrdering(true) + .setExpirationPolicy(ExpirationPolicy.newBuilder().build()) + .setFilter("filter-1274492040") + .setDeadLetterPolicy(DeadLetterPolicy.newBuilder().build()) + .setRetryPolicy(RetryPolicy.newBuilder().build()) + .setDetached(true) + .setEnableExactlyOnceDelivery(true) + .setTopicMessageRetentionDuration(Duration.newBuilder().build()) + .setAnalyticsHubSubscriptionInfo( + Subscription.AnalyticsHubSubscriptionInfo.newBuilder().build()) + .addAllMessageTransforms(new ArrayList()) + .putAllTags(new HashMap()) + .build(); + mockService.addResponse(expectedResponse); + + SubscriptionName name = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); + TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]"); + PushConfig pushConfig = PushConfig.newBuilder().build(); + int ackDeadlineSeconds = 2135351438; + + Subscription actualResponse = + client.createSubscription(name, topic, pushConfig, ackDeadlineSeconds); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createSubscriptionExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + SubscriptionName name = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); + TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]"); + PushConfig pushConfig = PushConfig.newBuilder().build(); + int ackDeadlineSeconds = 2135351438; + client.createSubscription(name, topic, pushConfig, ackDeadlineSeconds); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createSubscriptionTest2() throws Exception { + Subscription expectedResponse = + Subscription.newBuilder() + .setName(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString()) + .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) + .setPushConfig(PushConfig.newBuilder().build()) + .setBigqueryConfig(BigQueryConfig.newBuilder().build()) + .setCloudStorageConfig(CloudStorageConfig.newBuilder().build()) + .setBigtableConfig(BigtableConfig.newBuilder().build()) + .setAckDeadlineSeconds(2135351438) + .setRetainAckedMessages(true) + .setMessageRetentionDuration(Duration.newBuilder().build()) + .putAllLabels(new HashMap()) + .setEnableMessageOrdering(true) + .setExpirationPolicy(ExpirationPolicy.newBuilder().build()) + .setFilter("filter-1274492040") + .setDeadLetterPolicy(DeadLetterPolicy.newBuilder().build()) + .setRetryPolicy(RetryPolicy.newBuilder().build()) + .setDetached(true) + .setEnableExactlyOnceDelivery(true) + .setTopicMessageRetentionDuration(Duration.newBuilder().build()) + .setAnalyticsHubSubscriptionInfo( + Subscription.AnalyticsHubSubscriptionInfo.newBuilder().build()) + .addAllMessageTransforms(new ArrayList()) + .putAllTags(new HashMap()) + .build(); + mockService.addResponse(expectedResponse); + + SubscriptionName name = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); + String topic = "topic110546223"; + PushConfig pushConfig = PushConfig.newBuilder().build(); + int ackDeadlineSeconds = 2135351438; + + Subscription actualResponse = + client.createSubscription(name, topic, pushConfig, ackDeadlineSeconds); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createSubscriptionExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + SubscriptionName name = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); + String topic = "topic110546223"; + PushConfig pushConfig = PushConfig.newBuilder().build(); + int ackDeadlineSeconds = 2135351438; + client.createSubscription(name, topic, pushConfig, ackDeadlineSeconds); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createSubscriptionTest3() throws Exception { + Subscription expectedResponse = + Subscription.newBuilder() + .setName(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString()) + .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) + .setPushConfig(PushConfig.newBuilder().build()) + .setBigqueryConfig(BigQueryConfig.newBuilder().build()) + .setCloudStorageConfig(CloudStorageConfig.newBuilder().build()) + .setBigtableConfig(BigtableConfig.newBuilder().build()) + .setAckDeadlineSeconds(2135351438) + .setRetainAckedMessages(true) + .setMessageRetentionDuration(Duration.newBuilder().build()) + .putAllLabels(new HashMap()) + .setEnableMessageOrdering(true) + .setExpirationPolicy(ExpirationPolicy.newBuilder().build()) + .setFilter("filter-1274492040") + .setDeadLetterPolicy(DeadLetterPolicy.newBuilder().build()) + .setRetryPolicy(RetryPolicy.newBuilder().build()) + .setDetached(true) + .setEnableExactlyOnceDelivery(true) + .setTopicMessageRetentionDuration(Duration.newBuilder().build()) + .setAnalyticsHubSubscriptionInfo( + Subscription.AnalyticsHubSubscriptionInfo.newBuilder().build()) + .addAllMessageTransforms(new ArrayList()) + .putAllTags(new HashMap()) + .build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-7298/subscriptions/subscription-7298"; + TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]"); + PushConfig pushConfig = PushConfig.newBuilder().build(); + int ackDeadlineSeconds = 2135351438; + + Subscription actualResponse = + client.createSubscription(name, topic, pushConfig, ackDeadlineSeconds); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createSubscriptionExceptionTest3() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-7298/subscriptions/subscription-7298"; + TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]"); + PushConfig pushConfig = PushConfig.newBuilder().build(); + int ackDeadlineSeconds = 2135351438; + client.createSubscription(name, topic, pushConfig, ackDeadlineSeconds); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createSubscriptionTest4() throws Exception { + Subscription expectedResponse = + Subscription.newBuilder() + .setName(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString()) + .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) + .setPushConfig(PushConfig.newBuilder().build()) + .setBigqueryConfig(BigQueryConfig.newBuilder().build()) + .setCloudStorageConfig(CloudStorageConfig.newBuilder().build()) + .setBigtableConfig(BigtableConfig.newBuilder().build()) + .setAckDeadlineSeconds(2135351438) + .setRetainAckedMessages(true) + .setMessageRetentionDuration(Duration.newBuilder().build()) + .putAllLabels(new HashMap()) + .setEnableMessageOrdering(true) + .setExpirationPolicy(ExpirationPolicy.newBuilder().build()) + .setFilter("filter-1274492040") + .setDeadLetterPolicy(DeadLetterPolicy.newBuilder().build()) + .setRetryPolicy(RetryPolicy.newBuilder().build()) + .setDetached(true) + .setEnableExactlyOnceDelivery(true) + .setTopicMessageRetentionDuration(Duration.newBuilder().build()) + .setAnalyticsHubSubscriptionInfo( + Subscription.AnalyticsHubSubscriptionInfo.newBuilder().build()) + .addAllMessageTransforms(new ArrayList()) + .putAllTags(new HashMap()) + .build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-7298/subscriptions/subscription-7298"; + String topic = "topic110546223"; + PushConfig pushConfig = PushConfig.newBuilder().build(); + int ackDeadlineSeconds = 2135351438; + + Subscription actualResponse = + client.createSubscription(name, topic, pushConfig, ackDeadlineSeconds); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createSubscriptionExceptionTest4() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-7298/subscriptions/subscription-7298"; + String topic = "topic110546223"; + PushConfig pushConfig = PushConfig.newBuilder().build(); + int ackDeadlineSeconds = 2135351438; + client.createSubscription(name, topic, pushConfig, ackDeadlineSeconds); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getSubscriptionTest() throws Exception { + Subscription expectedResponse = + Subscription.newBuilder() + .setName(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString()) + .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) + .setPushConfig(PushConfig.newBuilder().build()) + .setBigqueryConfig(BigQueryConfig.newBuilder().build()) + .setCloudStorageConfig(CloudStorageConfig.newBuilder().build()) + .setBigtableConfig(BigtableConfig.newBuilder().build()) + .setAckDeadlineSeconds(2135351438) + .setRetainAckedMessages(true) + .setMessageRetentionDuration(Duration.newBuilder().build()) + .putAllLabels(new HashMap()) + .setEnableMessageOrdering(true) + .setExpirationPolicy(ExpirationPolicy.newBuilder().build()) + .setFilter("filter-1274492040") + .setDeadLetterPolicy(DeadLetterPolicy.newBuilder().build()) + .setRetryPolicy(RetryPolicy.newBuilder().build()) + .setDetached(true) + .setEnableExactlyOnceDelivery(true) + .setTopicMessageRetentionDuration(Duration.newBuilder().build()) + .setAnalyticsHubSubscriptionInfo( + Subscription.AnalyticsHubSubscriptionInfo.newBuilder().build()) + .addAllMessageTransforms(new ArrayList()) + .putAllTags(new HashMap()) + .build(); + mockService.addResponse(expectedResponse); + + SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); + + Subscription actualResponse = client.getSubscription(subscription); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getSubscriptionExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); + client.getSubscription(subscription); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getSubscriptionTest2() throws Exception { + Subscription expectedResponse = + Subscription.newBuilder() + .setName(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString()) + .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) + .setPushConfig(PushConfig.newBuilder().build()) + .setBigqueryConfig(BigQueryConfig.newBuilder().build()) + .setCloudStorageConfig(CloudStorageConfig.newBuilder().build()) + .setBigtableConfig(BigtableConfig.newBuilder().build()) + .setAckDeadlineSeconds(2135351438) + .setRetainAckedMessages(true) + .setMessageRetentionDuration(Duration.newBuilder().build()) + .putAllLabels(new HashMap()) + .setEnableMessageOrdering(true) + .setExpirationPolicy(ExpirationPolicy.newBuilder().build()) + .setFilter("filter-1274492040") + .setDeadLetterPolicy(DeadLetterPolicy.newBuilder().build()) + .setRetryPolicy(RetryPolicy.newBuilder().build()) + .setDetached(true) + .setEnableExactlyOnceDelivery(true) + .setTopicMessageRetentionDuration(Duration.newBuilder().build()) + .setAnalyticsHubSubscriptionInfo( + Subscription.AnalyticsHubSubscriptionInfo.newBuilder().build()) + .addAllMessageTransforms(new ArrayList()) + .putAllTags(new HashMap()) + .build(); + mockService.addResponse(expectedResponse); + + String subscription = "projects/project-1980/subscriptions/subscription-1980"; + + Subscription actualResponse = client.getSubscription(subscription); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getSubscriptionExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String subscription = "projects/project-1980/subscriptions/subscription-1980"; + client.getSubscription(subscription); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateSubscriptionTest() throws Exception { + Subscription expectedResponse = + Subscription.newBuilder() + .setName(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString()) + .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) + .setPushConfig(PushConfig.newBuilder().build()) + .setBigqueryConfig(BigQueryConfig.newBuilder().build()) + .setCloudStorageConfig(CloudStorageConfig.newBuilder().build()) + .setBigtableConfig(BigtableConfig.newBuilder().build()) + .setAckDeadlineSeconds(2135351438) + .setRetainAckedMessages(true) + .setMessageRetentionDuration(Duration.newBuilder().build()) + .putAllLabels(new HashMap()) + .setEnableMessageOrdering(true) + .setExpirationPolicy(ExpirationPolicy.newBuilder().build()) + .setFilter("filter-1274492040") + .setDeadLetterPolicy(DeadLetterPolicy.newBuilder().build()) + .setRetryPolicy(RetryPolicy.newBuilder().build()) + .setDetached(true) + .setEnableExactlyOnceDelivery(true) + .setTopicMessageRetentionDuration(Duration.newBuilder().build()) + .setAnalyticsHubSubscriptionInfo( + Subscription.AnalyticsHubSubscriptionInfo.newBuilder().build()) + .addAllMessageTransforms(new ArrayList()) + .putAllTags(new HashMap()) + .build(); + mockService.addResponse(expectedResponse); + + Subscription subscription = + Subscription.newBuilder() + .setName(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString()) + .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) + .setPushConfig(PushConfig.newBuilder().build()) + .setBigqueryConfig(BigQueryConfig.newBuilder().build()) + .setCloudStorageConfig(CloudStorageConfig.newBuilder().build()) + .setBigtableConfig(BigtableConfig.newBuilder().build()) + .setAckDeadlineSeconds(2135351438) + .setRetainAckedMessages(true) + .setMessageRetentionDuration(Duration.newBuilder().build()) + .putAllLabels(new HashMap()) + .setEnableMessageOrdering(true) + .setExpirationPolicy(ExpirationPolicy.newBuilder().build()) + .setFilter("filter-1274492040") + .setDeadLetterPolicy(DeadLetterPolicy.newBuilder().build()) + .setRetryPolicy(RetryPolicy.newBuilder().build()) + .setDetached(true) + .setEnableExactlyOnceDelivery(true) + .setTopicMessageRetentionDuration(Duration.newBuilder().build()) + .setAnalyticsHubSubscriptionInfo( + Subscription.AnalyticsHubSubscriptionInfo.newBuilder().build()) + .addAllMessageTransforms(new ArrayList()) + .putAllTags(new HashMap()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Subscription actualResponse = client.updateSubscription(subscription, updateMask); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void updateSubscriptionExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + Subscription subscription = + Subscription.newBuilder() + .setName(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString()) + .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) + .setPushConfig(PushConfig.newBuilder().build()) + .setBigqueryConfig(BigQueryConfig.newBuilder().build()) + .setCloudStorageConfig(CloudStorageConfig.newBuilder().build()) + .setBigtableConfig(BigtableConfig.newBuilder().build()) + .setAckDeadlineSeconds(2135351438) + .setRetainAckedMessages(true) + .setMessageRetentionDuration(Duration.newBuilder().build()) + .putAllLabels(new HashMap()) + .setEnableMessageOrdering(true) + .setExpirationPolicy(ExpirationPolicy.newBuilder().build()) + .setFilter("filter-1274492040") + .setDeadLetterPolicy(DeadLetterPolicy.newBuilder().build()) + .setRetryPolicy(RetryPolicy.newBuilder().build()) + .setDetached(true) + .setEnableExactlyOnceDelivery(true) + .setTopicMessageRetentionDuration(Duration.newBuilder().build()) + .setAnalyticsHubSubscriptionInfo( + Subscription.AnalyticsHubSubscriptionInfo.newBuilder().build()) + .addAllMessageTransforms(new ArrayList()) + .putAllTags(new HashMap()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateSubscription(subscription, updateMask); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listSubscriptionsTest() throws Exception { + Subscription responsesElement = Subscription.newBuilder().build(); + ListSubscriptionsResponse expectedResponse = + ListSubscriptionsResponse.newBuilder() + .setNextPageToken("") + .addAllSubscriptions(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + + ListSubscriptionsPagedResponse pagedListResponse = client.listSubscriptions(project); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getSubscriptionsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listSubscriptionsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + client.listSubscriptions(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listSubscriptionsTest2() throws Exception { + Subscription responsesElement = Subscription.newBuilder().build(); + ListSubscriptionsResponse expectedResponse = + ListSubscriptionsResponse.newBuilder() + .setNextPageToken("") + .addAllSubscriptions(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String project = "projects/project-7934"; + + ListSubscriptionsPagedResponse pagedListResponse = client.listSubscriptions(project); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getSubscriptionsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listSubscriptionsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String project = "projects/project-7934"; + client.listSubscriptions(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteSubscriptionTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); + + client.deleteSubscription(subscription); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteSubscriptionExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); + client.deleteSubscription(subscription); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteSubscriptionTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + String subscription = "projects/project-1980/subscriptions/subscription-1980"; + + client.deleteSubscription(subscription); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteSubscriptionExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String subscription = "projects/project-1980/subscriptions/subscription-1980"; + client.deleteSubscription(subscription); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void modifyAckDeadlineTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); + List ackIds = new ArrayList<>(); + int ackDeadlineSeconds = 2135351438; + + client.modifyAckDeadline(subscription, ackIds, ackDeadlineSeconds); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void modifyAckDeadlineExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); + List ackIds = new ArrayList<>(); + int ackDeadlineSeconds = 2135351438; + client.modifyAckDeadline(subscription, ackIds, ackDeadlineSeconds); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void modifyAckDeadlineTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + String subscription = "projects/project-1980/subscriptions/subscription-1980"; + List ackIds = new ArrayList<>(); + int ackDeadlineSeconds = 2135351438; + + client.modifyAckDeadline(subscription, ackIds, ackDeadlineSeconds); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void modifyAckDeadlineExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String subscription = "projects/project-1980/subscriptions/subscription-1980"; + List ackIds = new ArrayList<>(); + int ackDeadlineSeconds = 2135351438; + client.modifyAckDeadline(subscription, ackIds, ackDeadlineSeconds); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void acknowledgeTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); + List ackIds = new ArrayList<>(); + + client.acknowledge(subscription, ackIds); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void acknowledgeExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); + List ackIds = new ArrayList<>(); + client.acknowledge(subscription, ackIds); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void acknowledgeTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + String subscription = "projects/project-1980/subscriptions/subscription-1980"; + List ackIds = new ArrayList<>(); + + client.acknowledge(subscription, ackIds); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void acknowledgeExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String subscription = "projects/project-1980/subscriptions/subscription-1980"; + List ackIds = new ArrayList<>(); + client.acknowledge(subscription, ackIds); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void pullTest() throws Exception { + PullResponse expectedResponse = + PullResponse.newBuilder().addAllReceivedMessages(new ArrayList()).build(); + mockService.addResponse(expectedResponse); + + SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); + int maxMessages = 496131527; + + PullResponse actualResponse = client.pull(subscription, maxMessages); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void pullExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); + int maxMessages = 496131527; + client.pull(subscription, maxMessages); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void pullTest2() throws Exception { + PullResponse expectedResponse = + PullResponse.newBuilder().addAllReceivedMessages(new ArrayList()).build(); + mockService.addResponse(expectedResponse); + + String subscription = "projects/project-1980/subscriptions/subscription-1980"; + int maxMessages = 496131527; + + PullResponse actualResponse = client.pull(subscription, maxMessages); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void pullExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String subscription = "projects/project-1980/subscriptions/subscription-1980"; + int maxMessages = 496131527; + client.pull(subscription, maxMessages); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void pullTest3() throws Exception { + PullResponse expectedResponse = + PullResponse.newBuilder().addAllReceivedMessages(new ArrayList()).build(); + mockService.addResponse(expectedResponse); + + SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); + boolean returnImmediately = true; + int maxMessages = 496131527; + + PullResponse actualResponse = client.pull(subscription, returnImmediately, maxMessages); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void pullExceptionTest3() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); + boolean returnImmediately = true; + int maxMessages = 496131527; + client.pull(subscription, returnImmediately, maxMessages); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void pullTest4() throws Exception { + PullResponse expectedResponse = + PullResponse.newBuilder().addAllReceivedMessages(new ArrayList()).build(); + mockService.addResponse(expectedResponse); + + String subscription = "projects/project-1980/subscriptions/subscription-1980"; + boolean returnImmediately = true; + int maxMessages = 496131527; + + PullResponse actualResponse = client.pull(subscription, returnImmediately, maxMessages); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void pullExceptionTest4() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String subscription = "projects/project-1980/subscriptions/subscription-1980"; + boolean returnImmediately = true; + int maxMessages = 496131527; + client.pull(subscription, returnImmediately, maxMessages); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void streamingPullUnsupportedMethodTest() throws Exception { + // The streamingPull() method is not supported in REST transport. + // This empty test is generated for technical reasons. + } + + @Test + public void modifyPushConfigTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); + PushConfig pushConfig = PushConfig.newBuilder().build(); + + client.modifyPushConfig(subscription, pushConfig); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void modifyPushConfigExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); + PushConfig pushConfig = PushConfig.newBuilder().build(); + client.modifyPushConfig(subscription, pushConfig); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void modifyPushConfigTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + String subscription = "projects/project-1980/subscriptions/subscription-1980"; + PushConfig pushConfig = PushConfig.newBuilder().build(); + + client.modifyPushConfig(subscription, pushConfig); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void modifyPushConfigExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String subscription = "projects/project-1980/subscriptions/subscription-1980"; + PushConfig pushConfig = PushConfig.newBuilder().build(); + client.modifyPushConfig(subscription, pushConfig); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getSnapshotTest() throws Exception { + Snapshot expectedResponse = + Snapshot.newBuilder() + .setName(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString()) + .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + mockService.addResponse(expectedResponse); + + SnapshotName snapshot = SnapshotName.of("[PROJECT]", "[SNAPSHOT]"); + + Snapshot actualResponse = client.getSnapshot(snapshot); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getSnapshotExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + SnapshotName snapshot = SnapshotName.of("[PROJECT]", "[SNAPSHOT]"); + client.getSnapshot(snapshot); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getSnapshotTest2() throws Exception { + Snapshot expectedResponse = + Snapshot.newBuilder() + .setName(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString()) + .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + mockService.addResponse(expectedResponse); + + String snapshot = "projects/project-2020/snapshots/snapshot-2020"; + + Snapshot actualResponse = client.getSnapshot(snapshot); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getSnapshotExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String snapshot = "projects/project-2020/snapshots/snapshot-2020"; + client.getSnapshot(snapshot); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listSnapshotsTest() throws Exception { + Snapshot responsesElement = Snapshot.newBuilder().build(); + ListSnapshotsResponse expectedResponse = + ListSnapshotsResponse.newBuilder() + .setNextPageToken("") + .addAllSnapshots(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + + ListSnapshotsPagedResponse pagedListResponse = client.listSnapshots(project); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getSnapshotsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listSnapshotsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + client.listSnapshots(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listSnapshotsTest2() throws Exception { + Snapshot responsesElement = Snapshot.newBuilder().build(); + ListSnapshotsResponse expectedResponse = + ListSnapshotsResponse.newBuilder() + .setNextPageToken("") + .addAllSnapshots(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String project = "projects/project-7934"; + + ListSnapshotsPagedResponse pagedListResponse = client.listSnapshots(project); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getSnapshotsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listSnapshotsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String project = "projects/project-7934"; + client.listSnapshots(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createSnapshotTest() throws Exception { + Snapshot expectedResponse = + Snapshot.newBuilder() + .setName(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString()) + .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + mockService.addResponse(expectedResponse); + + SnapshotName name = SnapshotName.of("[PROJECT]", "[SNAPSHOT]"); + SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); + + Snapshot actualResponse = client.createSnapshot(name, subscription); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createSnapshotExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + SnapshotName name = SnapshotName.of("[PROJECT]", "[SNAPSHOT]"); + SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); + client.createSnapshot(name, subscription); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createSnapshotTest2() throws Exception { + Snapshot expectedResponse = + Snapshot.newBuilder() + .setName(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString()) + .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + mockService.addResponse(expectedResponse); + + SnapshotName name = SnapshotName.of("[PROJECT]", "[SNAPSHOT]"); + String subscription = "subscription341203229"; + + Snapshot actualResponse = client.createSnapshot(name, subscription); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createSnapshotExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + SnapshotName name = SnapshotName.of("[PROJECT]", "[SNAPSHOT]"); + String subscription = "subscription341203229"; + client.createSnapshot(name, subscription); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createSnapshotTest3() throws Exception { + Snapshot expectedResponse = + Snapshot.newBuilder() + .setName(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString()) + .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-4389/snapshots/snapshot-4389"; + SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); + + Snapshot actualResponse = client.createSnapshot(name, subscription); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createSnapshotExceptionTest3() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-4389/snapshots/snapshot-4389"; + SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); + client.createSnapshot(name, subscription); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createSnapshotTest4() throws Exception { + Snapshot expectedResponse = + Snapshot.newBuilder() + .setName(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString()) + .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-4389/snapshots/snapshot-4389"; + String subscription = "subscription341203229"; + + Snapshot actualResponse = client.createSnapshot(name, subscription); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createSnapshotExceptionTest4() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-4389/snapshots/snapshot-4389"; + String subscription = "subscription341203229"; + client.createSnapshot(name, subscription); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateSnapshotTest() throws Exception { + Snapshot expectedResponse = + Snapshot.newBuilder() + .setName(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString()) + .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + mockService.addResponse(expectedResponse); + + Snapshot snapshot = + Snapshot.newBuilder() + .setName(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString()) + .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Snapshot actualResponse = client.updateSnapshot(snapshot, updateMask); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void updateSnapshotExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + Snapshot snapshot = + Snapshot.newBuilder() + .setName(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString()) + .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateSnapshot(snapshot, updateMask); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteSnapshotTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + SnapshotName snapshot = SnapshotName.of("[PROJECT]", "[SNAPSHOT]"); + + client.deleteSnapshot(snapshot); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteSnapshotExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + SnapshotName snapshot = SnapshotName.of("[PROJECT]", "[SNAPSHOT]"); + client.deleteSnapshot(snapshot); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteSnapshotTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + String snapshot = "projects/project-2020/snapshots/snapshot-2020"; + + client.deleteSnapshot(snapshot); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteSnapshotExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String snapshot = "projects/project-2020/snapshots/snapshot-2020"; + client.deleteSnapshot(snapshot); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void seekTest() throws Exception { + SeekResponse expectedResponse = SeekResponse.newBuilder().build(); + mockService.addResponse(expectedResponse); + + SeekRequest request = + SeekRequest.newBuilder() + .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString()) + .build(); + + SeekResponse actualResponse = client.seek(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void seekExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + SeekRequest request = + SeekRequest.newBuilder() + .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString()) + .build(); + client.seek(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void setIamPolicyTest() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setVersion(351608024) + .addAllBindings(new ArrayList()) + .addAllAuditConfigs(new ArrayList()) + .setEtag(ByteString.EMPTY) + .build(); + mockService.addResponse(expectedResponse); + + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + + Policy actualResponse = client.setIamPolicy(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void setIamPolicyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + client.setIamPolicy(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getIamPolicyTest() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setVersion(351608024) + .addAllBindings(new ArrayList()) + .addAllAuditConfigs(new ArrayList()) + .setEtag(ByteString.EMPTY) + .build(); + mockService.addResponse(expectedResponse); + + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + + Policy actualResponse = client.getIamPolicy(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getIamPolicyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + client.getIamPolicy(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void testIamPermissionsTest() throws Exception { + TestIamPermissionsResponse expectedResponse = + TestIamPermissionsResponse.newBuilder().addAllPermissions(new ArrayList()).build(); + mockService.addResponse(expectedResponse); + + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) + .addAllPermissions(new ArrayList()) + .build(); + + TestIamPermissionsResponse actualResponse = client.testIamPermissions(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void testIamPermissionsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) + .addAllPermissions(new ArrayList()) + .build(); + client.testIamPermissions(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} 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 16cf9889b..7df554b6d 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 @@ -1,11 +1,11 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.pubsub.v1; import static com.google.cloud.pubsub.v1.SubscriptionAdminClient.ListSnapshotsPagedResponse; @@ -29,54 +30,66 @@ import com.google.api.gax.rpc.BidiStreamingCallable; import com.google.api.gax.rpc.InvalidArgumentException; import com.google.api.gax.rpc.StatusCode; -import com.google.api.resourcenames.ResourceName; import com.google.common.collect.Lists; +import com.google.iam.v1.AuditConfig; +import com.google.iam.v1.Binding; import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; import com.google.iam.v1.Policy; import com.google.iam.v1.SetIamPolicyRequest; import com.google.iam.v1.TestIamPermissionsRequest; import com.google.iam.v1.TestIamPermissionsResponse; import com.google.protobuf.AbstractMessage; import com.google.protobuf.ByteString; +import com.google.protobuf.Duration; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; import com.google.protobuf.Timestamp; import com.google.pubsub.v1.AcknowledgeRequest; +import com.google.pubsub.v1.BigQueryConfig; +import com.google.pubsub.v1.BigtableConfig; +import com.google.pubsub.v1.CloudStorageConfig; import com.google.pubsub.v1.CreateSnapshotRequest; +import com.google.pubsub.v1.DeadLetterPolicy; import com.google.pubsub.v1.DeleteSnapshotRequest; import com.google.pubsub.v1.DeleteSubscriptionRequest; +import com.google.pubsub.v1.ExpirationPolicy; import com.google.pubsub.v1.GetSnapshotRequest; import com.google.pubsub.v1.GetSubscriptionRequest; import com.google.pubsub.v1.ListSnapshotsRequest; import com.google.pubsub.v1.ListSnapshotsResponse; import com.google.pubsub.v1.ListSubscriptionsRequest; import com.google.pubsub.v1.ListSubscriptionsResponse; +import com.google.pubsub.v1.MessageTransform; import com.google.pubsub.v1.ModifyAckDeadlineRequest; import com.google.pubsub.v1.ModifyPushConfigRequest; import com.google.pubsub.v1.ProjectName; -import com.google.pubsub.v1.ProjectSnapshotName; -import com.google.pubsub.v1.ProjectSubscriptionName; import com.google.pubsub.v1.PullRequest; import com.google.pubsub.v1.PullResponse; import com.google.pubsub.v1.PushConfig; +import com.google.pubsub.v1.ReceivedMessage; +import com.google.pubsub.v1.RetryPolicy; +import com.google.pubsub.v1.SchemaName; import com.google.pubsub.v1.SeekRequest; import com.google.pubsub.v1.SeekResponse; import com.google.pubsub.v1.Snapshot; +import com.google.pubsub.v1.SnapshotName; import com.google.pubsub.v1.StreamingPullRequest; import com.google.pubsub.v1.StreamingPullResponse; import com.google.pubsub.v1.Subscription; +import com.google.pubsub.v1.SubscriptionName; import com.google.pubsub.v1.TopicName; import com.google.pubsub.v1.UpdateSnapshotRequest; import com.google.pubsub.v1.UpdateSubscriptionRequest; -import io.grpc.Status; import io.grpc.StatusRuntimeException; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; import java.util.List; -import java.util.Objects; import java.util.UUID; import java.util.concurrent.ExecutionException; +import javax.annotation.Generated; import org.junit.After; import org.junit.AfterClass; import org.junit.Assert; @@ -84,39 +97,34 @@ import org.junit.BeforeClass; import org.junit.Test; -@javax.annotation.Generated("by GAPIC") +@Generated("by gapic-generator-java") public class SubscriptionAdminClientTest { - private static MockSchemaService mockSchemaService; - private static MockPublisher mockPublisher; private static MockIAMPolicy mockIAMPolicy; + private static MockServiceHelper mockServiceHelper; private static MockSubscriber mockSubscriber; - private static MockServiceHelper serviceHelper; - private SubscriptionAdminClient client; private LocalChannelProvider channelProvider; + private SubscriptionAdminClient client; @BeforeClass public static void startStaticServer() { - mockSchemaService = new MockSchemaService(); - mockPublisher = new MockPublisher(); - mockIAMPolicy = new MockIAMPolicy(); mockSubscriber = new MockSubscriber(); - serviceHelper = + mockIAMPolicy = new MockIAMPolicy(); + mockServiceHelper = new MockServiceHelper( UUID.randomUUID().toString(), - Arrays.asList( - mockSchemaService, mockPublisher, mockIAMPolicy, mockSubscriber)); - serviceHelper.start(); + Arrays.asList(mockSubscriber, mockIAMPolicy)); + mockServiceHelper.start(); } @AfterClass public static void stopServer() { - serviceHelper.stop(); + mockServiceHelper.stop(); } @Before public void setUp() throws IOException { - serviceHelper.reset(); - channelProvider = serviceHelper.createChannelProvider(); + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); SubscriptionAdminSettings settings = SubscriptionAdminSettings.newBuilder() .setTransportChannelProvider(channelProvider) @@ -131,28 +139,35 @@ public void tearDown() throws Exception { } @Test - @SuppressWarnings("all") - public void createSubscriptionTest() { - ProjectSubscriptionName name2 = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); - TopicName topic2 = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]"); - int ackDeadlineSeconds2 = 921632575; - boolean retainAckedMessages = false; - boolean enableMessageOrdering = true; - String filter = "filter-1274492040"; - boolean detached = true; + public void createSubscriptionTest() throws Exception { Subscription expectedResponse = Subscription.newBuilder() - .setName(name2.toString()) - .setTopic(topic2.toString()) - .setAckDeadlineSeconds(ackDeadlineSeconds2) - .setRetainAckedMessages(retainAckedMessages) - .setEnableMessageOrdering(enableMessageOrdering) - .setFilter(filter) - .setDetached(detached) + .setName(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString()) + .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) + .setPushConfig(PushConfig.newBuilder().build()) + .setBigqueryConfig(BigQueryConfig.newBuilder().build()) + .setCloudStorageConfig(CloudStorageConfig.newBuilder().build()) + .setBigtableConfig(BigtableConfig.newBuilder().build()) + .setAckDeadlineSeconds(2135351438) + .setRetainAckedMessages(true) + .setMessageRetentionDuration(Duration.newBuilder().build()) + .putAllLabels(new HashMap()) + .setEnableMessageOrdering(true) + .setExpirationPolicy(ExpirationPolicy.newBuilder().build()) + .setFilter("filter-1274492040") + .setDeadLetterPolicy(DeadLetterPolicy.newBuilder().build()) + .setRetryPolicy(RetryPolicy.newBuilder().build()) + .setDetached(true) + .setEnableExactlyOnceDelivery(true) + .setTopicMessageRetentionDuration(Duration.newBuilder().build()) + .setAnalyticsHubSubscriptionInfo( + Subscription.AnalyticsHubSubscriptionInfo.newBuilder().build()) + .addAllMessageTransforms(new ArrayList()) + .putAllTags(new HashMap()) .build(); mockSubscriber.addResponse(expectedResponse); - ProjectSubscriptionName name = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); + SubscriptionName name = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]"); PushConfig pushConfig = PushConfig.newBuilder().build(); int ackDeadlineSeconds = 2135351438; @@ -163,10 +178,10 @@ public void createSubscriptionTest() { List actualRequests = mockSubscriber.getRequests(); Assert.assertEquals(1, actualRequests.size()); - Subscription actualRequest = (Subscription) actualRequests.get(0); + Subscription actualRequest = ((Subscription) actualRequests.get(0)); - Assert.assertEquals(name, ProjectSubscriptionName.parse(actualRequest.getName())); - Assert.assertEquals(topic, TopicName.parse(actualRequest.getTopic())); + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertEquals(topic.toString(), actualRequest.getTopic()); Assert.assertEquals(pushConfig, actualRequest.getPushConfig()); Assert.assertEquals(ackDeadlineSeconds, actualRequest.getAckDeadlineSeconds()); Assert.assertTrue( @@ -176,58 +191,68 @@ public void createSubscriptionTest() { } @Test - @SuppressWarnings("all") public void createSubscriptionExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSubscriber.addException(exception); try { - ProjectSubscriptionName name = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); + SubscriptionName name = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]"); PushConfig pushConfig = PushConfig.newBuilder().build(); int ackDeadlineSeconds = 2135351438; - client.createSubscription(name, topic, pushConfig, ackDeadlineSeconds); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void getSubscriptionTest() { - ProjectSubscriptionName name = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); - TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]"); - int ackDeadlineSeconds = 2135351438; - boolean retainAckedMessages = false; - boolean enableMessageOrdering = true; - String filter = "filter-1274492040"; - boolean detached = true; + public void createSubscriptionTest2() throws Exception { Subscription expectedResponse = Subscription.newBuilder() - .setName(name.toString()) - .setTopic(topic.toString()) - .setAckDeadlineSeconds(ackDeadlineSeconds) - .setRetainAckedMessages(retainAckedMessages) - .setEnableMessageOrdering(enableMessageOrdering) - .setFilter(filter) - .setDetached(detached) + .setName(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString()) + .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) + .setPushConfig(PushConfig.newBuilder().build()) + .setBigqueryConfig(BigQueryConfig.newBuilder().build()) + .setCloudStorageConfig(CloudStorageConfig.newBuilder().build()) + .setBigtableConfig(BigtableConfig.newBuilder().build()) + .setAckDeadlineSeconds(2135351438) + .setRetainAckedMessages(true) + .setMessageRetentionDuration(Duration.newBuilder().build()) + .putAllLabels(new HashMap()) + .setEnableMessageOrdering(true) + .setExpirationPolicy(ExpirationPolicy.newBuilder().build()) + .setFilter("filter-1274492040") + .setDeadLetterPolicy(DeadLetterPolicy.newBuilder().build()) + .setRetryPolicy(RetryPolicy.newBuilder().build()) + .setDetached(true) + .setEnableExactlyOnceDelivery(true) + .setTopicMessageRetentionDuration(Duration.newBuilder().build()) + .setAnalyticsHubSubscriptionInfo( + Subscription.AnalyticsHubSubscriptionInfo.newBuilder().build()) + .addAllMessageTransforms(new ArrayList()) + .putAllTags(new HashMap()) .build(); mockSubscriber.addResponse(expectedResponse); - ProjectSubscriptionName subscription = - ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); + SubscriptionName name = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); + String topic = "topic110546223"; + PushConfig pushConfig = PushConfig.newBuilder().build(); + int ackDeadlineSeconds = 2135351438; - Subscription actualResponse = client.getSubscription(subscription); + Subscription actualResponse = + client.createSubscription(name, topic, pushConfig, ackDeadlineSeconds); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockSubscriber.getRequests(); Assert.assertEquals(1, actualRequests.size()); - GetSubscriptionRequest actualRequest = (GetSubscriptionRequest) actualRequests.get(0); + Subscription actualRequest = ((Subscription) actualRequests.get(0)); - Assert.assertEquals( - subscription, ProjectSubscriptionName.parse(actualRequest.getSubscription())); + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertEquals(topic, actualRequest.getTopic()); + Assert.assertEquals(pushConfig, actualRequest.getPushConfig()); + Assert.assertEquals(ackDeadlineSeconds, actualRequest.getAckDeadlineSeconds()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -235,65 +260,68 @@ public void getSubscriptionTest() { } @Test - @SuppressWarnings("all") - public void getSubscriptionExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void createSubscriptionExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSubscriber.addException(exception); try { - ProjectSubscriptionName subscription = - ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); - - client.getSubscription(subscription); + SubscriptionName name = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); + String topic = "topic110546223"; + PushConfig pushConfig = PushConfig.newBuilder().build(); + int ackDeadlineSeconds = 2135351438; + client.createSubscription(name, topic, pushConfig, ackDeadlineSeconds); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void updateSubscriptionTest() { - ProjectSubscriptionName name = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); - TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]"); - int ackDeadlineSeconds2 = 921632575; - boolean retainAckedMessages = false; - boolean enableMessageOrdering = true; - String filter = "filter-1274492040"; - boolean detached = true; + public void createSubscriptionTest3() throws Exception { Subscription expectedResponse = Subscription.newBuilder() - .setName(name.toString()) - .setTopic(topic.toString()) - .setAckDeadlineSeconds(ackDeadlineSeconds2) - .setRetainAckedMessages(retainAckedMessages) - .setEnableMessageOrdering(enableMessageOrdering) - .setFilter(filter) - .setDetached(detached) + .setName(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString()) + .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) + .setPushConfig(PushConfig.newBuilder().build()) + .setBigqueryConfig(BigQueryConfig.newBuilder().build()) + .setCloudStorageConfig(CloudStorageConfig.newBuilder().build()) + .setBigtableConfig(BigtableConfig.newBuilder().build()) + .setAckDeadlineSeconds(2135351438) + .setRetainAckedMessages(true) + .setMessageRetentionDuration(Duration.newBuilder().build()) + .putAllLabels(new HashMap()) + .setEnableMessageOrdering(true) + .setExpirationPolicy(ExpirationPolicy.newBuilder().build()) + .setFilter("filter-1274492040") + .setDeadLetterPolicy(DeadLetterPolicy.newBuilder().build()) + .setRetryPolicy(RetryPolicy.newBuilder().build()) + .setDetached(true) + .setEnableExactlyOnceDelivery(true) + .setTopicMessageRetentionDuration(Duration.newBuilder().build()) + .setAnalyticsHubSubscriptionInfo( + Subscription.AnalyticsHubSubscriptionInfo.newBuilder().build()) + .addAllMessageTransforms(new ArrayList()) + .putAllTags(new HashMap()) .build(); mockSubscriber.addResponse(expectedResponse); - int ackDeadlineSeconds = 42; - Subscription subscription = - Subscription.newBuilder().setAckDeadlineSeconds(ackDeadlineSeconds).build(); - String pathsElement = "ack_deadline_seconds"; - List paths = Arrays.asList(pathsElement); - FieldMask updateMask = FieldMask.newBuilder().addAllPaths(paths).build(); - UpdateSubscriptionRequest request = - UpdateSubscriptionRequest.newBuilder() - .setSubscription(subscription) - .setUpdateMask(updateMask) - .build(); + String name = "name3373707"; + TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]"); + PushConfig pushConfig = PushConfig.newBuilder().build(); + int ackDeadlineSeconds = 2135351438; - Subscription actualResponse = client.updateSubscription(request); + Subscription actualResponse = + client.createSubscription(name, topic, pushConfig, ackDeadlineSeconds); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockSubscriber.getRequests(); Assert.assertEquals(1, actualRequests.size()); - UpdateSubscriptionRequest actualRequest = (UpdateSubscriptionRequest) actualRequests.get(0); + Subscription actualRequest = ((Subscription) actualRequests.get(0)); - Assert.assertEquals(subscription, actualRequest.getSubscription()); - Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertEquals(topic.toString(), actualRequest.getTopic()); + Assert.assertEquals(pushConfig, actualRequest.getPushConfig()); + Assert.assertEquals(ackDeadlineSeconds, actualRequest.getAckDeadlineSeconds()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -301,57 +329,68 @@ public void updateSubscriptionTest() { } @Test - @SuppressWarnings("all") - public void updateSubscriptionExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void createSubscriptionExceptionTest3() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSubscriber.addException(exception); try { - int ackDeadlineSeconds = 42; - Subscription subscription = - Subscription.newBuilder().setAckDeadlineSeconds(ackDeadlineSeconds).build(); - String pathsElement = "ack_deadline_seconds"; - List paths = Arrays.asList(pathsElement); - FieldMask updateMask = FieldMask.newBuilder().addAllPaths(paths).build(); - UpdateSubscriptionRequest request = - UpdateSubscriptionRequest.newBuilder() - .setSubscription(subscription) - .setUpdateMask(updateMask) - .build(); - - client.updateSubscription(request); + String name = "name3373707"; + TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]"); + PushConfig pushConfig = PushConfig.newBuilder().build(); + int ackDeadlineSeconds = 2135351438; + client.createSubscription(name, topic, pushConfig, ackDeadlineSeconds); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void listSubscriptionsTest() { - String nextPageToken = ""; - Subscription subscriptionsElement = Subscription.newBuilder().build(); - List subscriptions = Arrays.asList(subscriptionsElement); - ListSubscriptionsResponse expectedResponse = - ListSubscriptionsResponse.newBuilder() - .setNextPageToken(nextPageToken) - .addAllSubscriptions(subscriptions) + public void createSubscriptionTest4() throws Exception { + Subscription expectedResponse = + Subscription.newBuilder() + .setName(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString()) + .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) + .setPushConfig(PushConfig.newBuilder().build()) + .setBigqueryConfig(BigQueryConfig.newBuilder().build()) + .setCloudStorageConfig(CloudStorageConfig.newBuilder().build()) + .setBigtableConfig(BigtableConfig.newBuilder().build()) + .setAckDeadlineSeconds(2135351438) + .setRetainAckedMessages(true) + .setMessageRetentionDuration(Duration.newBuilder().build()) + .putAllLabels(new HashMap()) + .setEnableMessageOrdering(true) + .setExpirationPolicy(ExpirationPolicy.newBuilder().build()) + .setFilter("filter-1274492040") + .setDeadLetterPolicy(DeadLetterPolicy.newBuilder().build()) + .setRetryPolicy(RetryPolicy.newBuilder().build()) + .setDetached(true) + .setEnableExactlyOnceDelivery(true) + .setTopicMessageRetentionDuration(Duration.newBuilder().build()) + .setAnalyticsHubSubscriptionInfo( + Subscription.AnalyticsHubSubscriptionInfo.newBuilder().build()) + .addAllMessageTransforms(new ArrayList()) + .putAllTags(new HashMap()) .build(); mockSubscriber.addResponse(expectedResponse); - ProjectName project = ProjectName.of("[PROJECT]"); - - ListSubscriptionsPagedResponse pagedListResponse = client.listSubscriptions(project); + String name = "name3373707"; + String topic = "topic110546223"; + PushConfig pushConfig = PushConfig.newBuilder().build(); + int ackDeadlineSeconds = 2135351438; - List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assert.assertEquals(1, resources.size()); - Assert.assertEquals(expectedResponse.getSubscriptionsList().get(0), resources.get(0)); + Subscription actualResponse = + client.createSubscription(name, topic, pushConfig, ackDeadlineSeconds); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockSubscriber.getRequests(); Assert.assertEquals(1, actualRequests.size()); - ListSubscriptionsRequest actualRequest = (ListSubscriptionsRequest) actualRequests.get(0); + Subscription actualRequest = ((Subscription) actualRequests.get(0)); - Assert.assertEquals(project, ProjectName.parse(actualRequest.getProject())); + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertEquals(topic, actualRequest.getTopic()); + Assert.assertEquals(pushConfig, actualRequest.getPushConfig()); + Assert.assertEquals(ackDeadlineSeconds, actualRequest.getAckDeadlineSeconds()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -359,38 +398,61 @@ public void listSubscriptionsTest() { } @Test - @SuppressWarnings("all") - public void listSubscriptionsExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void createSubscriptionExceptionTest4() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSubscriber.addException(exception); try { - ProjectName project = ProjectName.of("[PROJECT]"); - - client.listSubscriptions(project); + String name = "name3373707"; + String topic = "topic110546223"; + PushConfig pushConfig = PushConfig.newBuilder().build(); + int ackDeadlineSeconds = 2135351438; + client.createSubscription(name, topic, pushConfig, ackDeadlineSeconds); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void deleteSubscriptionTest() { - Empty expectedResponse = Empty.newBuilder().build(); + public void getSubscriptionTest() throws Exception { + Subscription expectedResponse = + Subscription.newBuilder() + .setName(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString()) + .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) + .setPushConfig(PushConfig.newBuilder().build()) + .setBigqueryConfig(BigQueryConfig.newBuilder().build()) + .setCloudStorageConfig(CloudStorageConfig.newBuilder().build()) + .setBigtableConfig(BigtableConfig.newBuilder().build()) + .setAckDeadlineSeconds(2135351438) + .setRetainAckedMessages(true) + .setMessageRetentionDuration(Duration.newBuilder().build()) + .putAllLabels(new HashMap()) + .setEnableMessageOrdering(true) + .setExpirationPolicy(ExpirationPolicy.newBuilder().build()) + .setFilter("filter-1274492040") + .setDeadLetterPolicy(DeadLetterPolicy.newBuilder().build()) + .setRetryPolicy(RetryPolicy.newBuilder().build()) + .setDetached(true) + .setEnableExactlyOnceDelivery(true) + .setTopicMessageRetentionDuration(Duration.newBuilder().build()) + .setAnalyticsHubSubscriptionInfo( + Subscription.AnalyticsHubSubscriptionInfo.newBuilder().build()) + .addAllMessageTransforms(new ArrayList()) + .putAllTags(new HashMap()) + .build(); mockSubscriber.addResponse(expectedResponse); - ProjectSubscriptionName subscription = - ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); + SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); - client.deleteSubscription(subscription); + Subscription actualResponse = client.getSubscription(subscription); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockSubscriber.getRequests(); Assert.assertEquals(1, actualRequests.size()); - DeleteSubscriptionRequest actualRequest = (DeleteSubscriptionRequest) actualRequests.get(0); + GetSubscriptionRequest actualRequest = ((GetSubscriptionRequest) actualRequests.get(0)); - Assert.assertEquals( - subscription, ProjectSubscriptionName.parse(actualRequest.getSubscription())); + Assert.assertEquals(subscription.toString(), actualRequest.getSubscription()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -398,41 +460,58 @@ public void deleteSubscriptionTest() { } @Test - @SuppressWarnings("all") - public void deleteSubscriptionExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void getSubscriptionExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSubscriber.addException(exception); try { - ProjectSubscriptionName subscription = - ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); - - client.deleteSubscription(subscription); + SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); + client.getSubscription(subscription); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void getSnapshotTest() { - ProjectSnapshotName name = ProjectSnapshotName.of("[PROJECT]", "[SNAPSHOT]"); - TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]"); - Snapshot expectedResponse = - Snapshot.newBuilder().setName(name.toString()).setTopic(topic.toString()).build(); + public void getSubscriptionTest2() throws Exception { + Subscription expectedResponse = + Subscription.newBuilder() + .setName(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString()) + .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) + .setPushConfig(PushConfig.newBuilder().build()) + .setBigqueryConfig(BigQueryConfig.newBuilder().build()) + .setCloudStorageConfig(CloudStorageConfig.newBuilder().build()) + .setBigtableConfig(BigtableConfig.newBuilder().build()) + .setAckDeadlineSeconds(2135351438) + .setRetainAckedMessages(true) + .setMessageRetentionDuration(Duration.newBuilder().build()) + .putAllLabels(new HashMap()) + .setEnableMessageOrdering(true) + .setExpirationPolicy(ExpirationPolicy.newBuilder().build()) + .setFilter("filter-1274492040") + .setDeadLetterPolicy(DeadLetterPolicy.newBuilder().build()) + .setRetryPolicy(RetryPolicy.newBuilder().build()) + .setDetached(true) + .setEnableExactlyOnceDelivery(true) + .setTopicMessageRetentionDuration(Duration.newBuilder().build()) + .setAnalyticsHubSubscriptionInfo( + Subscription.AnalyticsHubSubscriptionInfo.newBuilder().build()) + .addAllMessageTransforms(new ArrayList()) + .putAllTags(new HashMap()) + .build(); mockSubscriber.addResponse(expectedResponse); - ProjectSnapshotName snapshot = ProjectSnapshotName.of("[PROJECT]", "[SNAPSHOT]"); + String subscription = "subscription341203229"; - Snapshot actualResponse = client.getSnapshot(snapshot); + Subscription actualResponse = client.getSubscription(subscription); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockSubscriber.getRequests(); Assert.assertEquals(1, actualRequests.size()); - GetSnapshotRequest actualRequest = (GetSnapshotRequest) actualRequests.get(0); + GetSubscriptionRequest actualRequest = ((GetSubscriptionRequest) actualRequests.get(0)); - Assert.assertEquals(snapshot, ProjectSnapshotName.parse(actualRequest.getSnapshot())); + Assert.assertEquals(subscription, actualRequest.getSubscription()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -440,42 +519,60 @@ public void getSnapshotTest() { } @Test - @SuppressWarnings("all") - public void getSnapshotExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void getSubscriptionExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSubscriber.addException(exception); try { - ProjectSnapshotName snapshot = ProjectSnapshotName.of("[PROJECT]", "[SNAPSHOT]"); - - client.getSnapshot(snapshot); + String subscription = "subscription341203229"; + client.getSubscription(subscription); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void modifyAckDeadlineTest() { - Empty expectedResponse = Empty.newBuilder().build(); + public void updateSubscriptionTest() throws Exception { + Subscription expectedResponse = + Subscription.newBuilder() + .setName(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString()) + .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) + .setPushConfig(PushConfig.newBuilder().build()) + .setBigqueryConfig(BigQueryConfig.newBuilder().build()) + .setCloudStorageConfig(CloudStorageConfig.newBuilder().build()) + .setBigtableConfig(BigtableConfig.newBuilder().build()) + .setAckDeadlineSeconds(2135351438) + .setRetainAckedMessages(true) + .setMessageRetentionDuration(Duration.newBuilder().build()) + .putAllLabels(new HashMap()) + .setEnableMessageOrdering(true) + .setExpirationPolicy(ExpirationPolicy.newBuilder().build()) + .setFilter("filter-1274492040") + .setDeadLetterPolicy(DeadLetterPolicy.newBuilder().build()) + .setRetryPolicy(RetryPolicy.newBuilder().build()) + .setDetached(true) + .setEnableExactlyOnceDelivery(true) + .setTopicMessageRetentionDuration(Duration.newBuilder().build()) + .setAnalyticsHubSubscriptionInfo( + Subscription.AnalyticsHubSubscriptionInfo.newBuilder().build()) + .addAllMessageTransforms(new ArrayList()) + .putAllTags(new HashMap()) + .build(); mockSubscriber.addResponse(expectedResponse); - ProjectSubscriptionName subscription = - ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); - List ackIds = new ArrayList<>(); - int ackDeadlineSeconds = 2135351438; + Subscription subscription = Subscription.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); - client.modifyAckDeadline(subscription, ackIds, ackDeadlineSeconds); + Subscription actualResponse = client.updateSubscription(subscription, updateMask); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockSubscriber.getRequests(); Assert.assertEquals(1, actualRequests.size()); - ModifyAckDeadlineRequest actualRequest = (ModifyAckDeadlineRequest) actualRequests.get(0); + UpdateSubscriptionRequest actualRequest = ((UpdateSubscriptionRequest) actualRequests.get(0)); - Assert.assertEquals( - subscription, ProjectSubscriptionName.parse(actualRequest.getSubscription())); - Assert.assertEquals(ackIds, actualRequest.getAckIdsList()); - Assert.assertEquals(ackDeadlineSeconds, actualRequest.getAckDeadlineSeconds()); + Assert.assertEquals(subscription, actualRequest.getSubscription()); + Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -483,43 +580,44 @@ public void modifyAckDeadlineTest() { } @Test - @SuppressWarnings("all") - public void modifyAckDeadlineExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void updateSubscriptionExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSubscriber.addException(exception); try { - ProjectSubscriptionName subscription = - ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); - List ackIds = new ArrayList<>(); - int ackDeadlineSeconds = 2135351438; - - client.modifyAckDeadline(subscription, ackIds, ackDeadlineSeconds); + Subscription subscription = Subscription.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateSubscription(subscription, updateMask); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void acknowledgeTest() { - Empty expectedResponse = Empty.newBuilder().build(); + public void listSubscriptionsTest() throws Exception { + Subscription responsesElement = Subscription.newBuilder().build(); + ListSubscriptionsResponse expectedResponse = + ListSubscriptionsResponse.newBuilder() + .setNextPageToken("") + .addAllSubscriptions(Arrays.asList(responsesElement)) + .build(); mockSubscriber.addResponse(expectedResponse); - ProjectSubscriptionName subscription = - ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); - List ackIds = new ArrayList<>(); + ProjectName project = ProjectName.of("[PROJECT]"); - client.acknowledge(subscription, ackIds); + ListSubscriptionsPagedResponse pagedListResponse = client.listSubscriptions(project); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getSubscriptionsList().get(0), resources.get(0)); List actualRequests = mockSubscriber.getRequests(); Assert.assertEquals(1, actualRequests.size()); - AcknowledgeRequest actualRequest = (AcknowledgeRequest) actualRequests.get(0); + ListSubscriptionsRequest actualRequest = ((ListSubscriptionsRequest) actualRequests.get(0)); - Assert.assertEquals( - subscription, ProjectSubscriptionName.parse(actualRequest.getSubscription())); - Assert.assertEquals(ackIds, actualRequest.getAckIdsList()); + Assert.assertEquals(project.toString(), actualRequest.getProject()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -527,45 +625,43 @@ public void acknowledgeTest() { } @Test - @SuppressWarnings("all") - public void acknowledgeExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void listSubscriptionsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSubscriber.addException(exception); try { - ProjectSubscriptionName subscription = - ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); - List ackIds = new ArrayList<>(); - - client.acknowledge(subscription, ackIds); + ProjectName project = ProjectName.of("[PROJECT]"); + client.listSubscriptions(project); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void pullTest() { - PullResponse expectedResponse = PullResponse.newBuilder().build(); + public void listSubscriptionsTest2() throws Exception { + Subscription responsesElement = Subscription.newBuilder().build(); + ListSubscriptionsResponse expectedResponse = + ListSubscriptionsResponse.newBuilder() + .setNextPageToken("") + .addAllSubscriptions(Arrays.asList(responsesElement)) + .build(); mockSubscriber.addResponse(expectedResponse); - ProjectSubscriptionName subscription = - ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); - boolean returnImmediately = false; - int maxMessages = 496131527; + String project = "project-309310695"; - PullResponse actualResponse = client.pull(subscription, returnImmediately, maxMessages); - Assert.assertEquals(expectedResponse, actualResponse); + ListSubscriptionsPagedResponse pagedListResponse = client.listSubscriptions(project); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getSubscriptionsList().get(0), resources.get(0)); List actualRequests = mockSubscriber.getRequests(); Assert.assertEquals(1, actualRequests.size()); - PullRequest actualRequest = (PullRequest) actualRequests.get(0); + ListSubscriptionsRequest actualRequest = ((ListSubscriptionsRequest) actualRequests.get(0)); - Assert.assertEquals( - subscription, ProjectSubscriptionName.parse(actualRequest.getSubscription())); - Assert.assertEquals(returnImmediately, actualRequest.getReturnImmediately()); - Assert.assertEquals(maxMessages, actualRequest.getMaxMessages()); + Assert.assertEquals(project, actualRequest.getProject()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -573,105 +669,67 @@ public void pullTest() { } @Test - @SuppressWarnings("all") - public void pullExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void listSubscriptionsExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSubscriber.addException(exception); try { - ProjectSubscriptionName subscription = - ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); - boolean returnImmediately = false; - int maxMessages = 496131527; - - client.pull(subscription, returnImmediately, maxMessages); + String project = "project-309310695"; + client.listSubscriptions(project); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void streamingPullTest() throws Exception { - StreamingPullResponse expectedResponse = StreamingPullResponse.newBuilder().build(); + public void deleteSubscriptionTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); mockSubscriber.addResponse(expectedResponse); - ProjectSubscriptionName subscription = - ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); - int streamAckDeadlineSeconds = 1875467245; - StreamingPullRequest request = - StreamingPullRequest.newBuilder() - .setSubscription(subscription.toString()) - .setStreamAckDeadlineSeconds(streamAckDeadlineSeconds) - .build(); - MockStreamObserver responseObserver = new MockStreamObserver<>(); + SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); - BidiStreamingCallable callable = - client.streamingPullCallable(); - ApiStreamObserver requestObserver = - callable.bidiStreamingCall(responseObserver); + client.deleteSubscription(subscription); - requestObserver.onNext(request); - requestObserver.onCompleted(); + List actualRequests = mockSubscriber.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteSubscriptionRequest actualRequest = ((DeleteSubscriptionRequest) actualRequests.get(0)); - List actualResponses = responseObserver.future().get(); - Assert.assertEquals(1, actualResponses.size()); - Assert.assertEquals(expectedResponse, actualResponses.get(0)); + Assert.assertEquals(subscription.toString(), actualRequest.getSubscription()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - @SuppressWarnings("all") - public void streamingPullExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void deleteSubscriptionExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSubscriber.addException(exception); - ProjectSubscriptionName subscription = - ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); - int streamAckDeadlineSeconds = 1875467245; - StreamingPullRequest request = - StreamingPullRequest.newBuilder() - .setSubscription(subscription.toString()) - .setStreamAckDeadlineSeconds(streamAckDeadlineSeconds) - .build(); - - MockStreamObserver responseObserver = new MockStreamObserver<>(); - - BidiStreamingCallable callable = - client.streamingPullCallable(); - ApiStreamObserver requestObserver = - callable.bidiStreamingCall(responseObserver); - - requestObserver.onNext(request); try { - List actualResponses = responseObserver.future().get(); - Assert.fail("No exception thrown"); - } catch (ExecutionException e) { - Assert.assertTrue(e.getCause() instanceof InvalidArgumentException); - InvalidArgumentException apiException = (InvalidArgumentException) e.getCause(); - Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); + client.deleteSubscription(subscription); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. } } @Test - @SuppressWarnings("all") - public void modifyPushConfigTest() { + public void deleteSubscriptionTest2() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockSubscriber.addResponse(expectedResponse); - ProjectSubscriptionName subscription = - ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); - PushConfig pushConfig = PushConfig.newBuilder().build(); + String subscription = "subscription341203229"; - client.modifyPushConfig(subscription, pushConfig); + client.deleteSubscription(subscription); List actualRequests = mockSubscriber.getRequests(); Assert.assertEquals(1, actualRequests.size()); - ModifyPushConfigRequest actualRequest = (ModifyPushConfigRequest) actualRequests.get(0); + DeleteSubscriptionRequest actualRequest = ((DeleteSubscriptionRequest) actualRequests.get(0)); - Assert.assertEquals( - subscription, ProjectSubscriptionName.parse(actualRequest.getSubscription())); - Assert.assertEquals(pushConfig, actualRequest.getPushConfig()); + Assert.assertEquals(subscription, actualRequest.getSubscription()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -679,49 +737,37 @@ public void modifyPushConfigTest() { } @Test - @SuppressWarnings("all") - public void modifyPushConfigExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void deleteSubscriptionExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSubscriber.addException(exception); try { - ProjectSubscriptionName subscription = - ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); - PushConfig pushConfig = PushConfig.newBuilder().build(); - - client.modifyPushConfig(subscription, pushConfig); + String subscription = "subscription341203229"; + client.deleteSubscription(subscription); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void listSnapshotsTest() { - String nextPageToken = ""; - Snapshot snapshotsElement = Snapshot.newBuilder().build(); - List snapshots = Arrays.asList(snapshotsElement); - ListSnapshotsResponse expectedResponse = - ListSnapshotsResponse.newBuilder() - .setNextPageToken(nextPageToken) - .addAllSnapshots(snapshots) - .build(); + public void modifyAckDeadlineTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); mockSubscriber.addResponse(expectedResponse); - ProjectName project = ProjectName.of("[PROJECT]"); - - ListSnapshotsPagedResponse pagedListResponse = client.listSnapshots(project); + SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); + List ackIds = new ArrayList<>(); + int ackDeadlineSeconds = 2135351438; - List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assert.assertEquals(1, resources.size()); - Assert.assertEquals(expectedResponse.getSnapshotsList().get(0), resources.get(0)); + client.modifyAckDeadline(subscription, ackIds, ackDeadlineSeconds); List actualRequests = mockSubscriber.getRequests(); Assert.assertEquals(1, actualRequests.size()); - ListSnapshotsRequest actualRequest = (ListSnapshotsRequest) actualRequests.get(0); + ModifyAckDeadlineRequest actualRequest = ((ModifyAckDeadlineRequest) actualRequests.get(0)); - Assert.assertEquals(project, ProjectName.parse(actualRequest.getProject())); + Assert.assertEquals(subscription.toString(), actualRequest.getSubscription()); + Assert.assertEquals(ackIds, actualRequest.getAckIdsList()); + Assert.assertEquals(ackDeadlineSeconds, actualRequest.getAckDeadlineSeconds()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -729,44 +775,39 @@ public void listSnapshotsTest() { } @Test - @SuppressWarnings("all") - public void listSnapshotsExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void modifyAckDeadlineExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSubscriber.addException(exception); try { - ProjectName project = ProjectName.of("[PROJECT]"); - - client.listSnapshots(project); + SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); + List ackIds = new ArrayList<>(); + int ackDeadlineSeconds = 2135351438; + client.modifyAckDeadline(subscription, ackIds, ackDeadlineSeconds); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void createSnapshotTest() { - ProjectSnapshotName name2 = ProjectSnapshotName.of("[PROJECT]", "[SNAPSHOT]"); - TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]"); - Snapshot expectedResponse = - Snapshot.newBuilder().setName(name2.toString()).setTopic(topic.toString()).build(); + public void modifyAckDeadlineTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); mockSubscriber.addResponse(expectedResponse); - ProjectSnapshotName name = ProjectSnapshotName.of("[PROJECT]", "[SNAPSHOT]"); - ProjectSubscriptionName subscription = - ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); + String subscription = "subscription341203229"; + List ackIds = new ArrayList<>(); + int ackDeadlineSeconds = 2135351438; - Snapshot actualResponse = client.createSnapshot(name, subscription); - Assert.assertEquals(expectedResponse, actualResponse); + client.modifyAckDeadline(subscription, ackIds, ackDeadlineSeconds); List actualRequests = mockSubscriber.getRequests(); Assert.assertEquals(1, actualRequests.size()); - CreateSnapshotRequest actualRequest = (CreateSnapshotRequest) actualRequests.get(0); + ModifyAckDeadlineRequest actualRequest = ((ModifyAckDeadlineRequest) actualRequests.get(0)); - Assert.assertEquals(name, ProjectSnapshotName.parse(actualRequest.getName())); - Assert.assertEquals( - subscription, ProjectSubscriptionName.parse(actualRequest.getSubscription())); + Assert.assertEquals(subscription, actualRequest.getSubscription()); + Assert.assertEquals(ackIds, actualRequest.getAckIdsList()); + Assert.assertEquals(ackDeadlineSeconds, actualRequest.getAckDeadlineSeconds()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -774,50 +815,37 @@ public void createSnapshotTest() { } @Test - @SuppressWarnings("all") - public void createSnapshotExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void modifyAckDeadlineExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSubscriber.addException(exception); try { - ProjectSnapshotName name = ProjectSnapshotName.of("[PROJECT]", "[SNAPSHOT]"); - ProjectSubscriptionName subscription = - ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); - - client.createSnapshot(name, subscription); + String subscription = "subscription341203229"; + List ackIds = new ArrayList<>(); + int ackDeadlineSeconds = 2135351438; + client.modifyAckDeadline(subscription, ackIds, ackDeadlineSeconds); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void updateSnapshotTest() { - ProjectSnapshotName name = ProjectSnapshotName.of("[PROJECT]", "[SNAPSHOT]"); - TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]"); - Snapshot expectedResponse = - Snapshot.newBuilder().setName(name.toString()).setTopic(topic.toString()).build(); + public void acknowledgeTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); mockSubscriber.addResponse(expectedResponse); - long seconds = 123456L; - Timestamp expireTime = Timestamp.newBuilder().setSeconds(seconds).build(); - Snapshot snapshot = Snapshot.newBuilder().setExpireTime(expireTime).build(); - String pathsElement = "expire_time"; - List paths = Arrays.asList(pathsElement); - FieldMask updateMask = FieldMask.newBuilder().addAllPaths(paths).build(); - UpdateSnapshotRequest request = - UpdateSnapshotRequest.newBuilder().setSnapshot(snapshot).setUpdateMask(updateMask).build(); + SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); + List ackIds = new ArrayList<>(); - Snapshot actualResponse = client.updateSnapshot(request); - Assert.assertEquals(expectedResponse, actualResponse); + client.acknowledge(subscription, ackIds); List actualRequests = mockSubscriber.getRequests(); Assert.assertEquals(1, actualRequests.size()); - UpdateSnapshotRequest actualRequest = (UpdateSnapshotRequest) actualRequests.get(0); + AcknowledgeRequest actualRequest = ((AcknowledgeRequest) actualRequests.get(0)); - Assert.assertEquals(snapshot, actualRequest.getSnapshot()); - Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); + Assert.assertEquals(subscription.toString(), actualRequest.getSubscription()); + Assert.assertEquals(ackIds, actualRequest.getAckIdsList()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -825,46 +853,774 @@ public void updateSnapshotTest() { } @Test - @SuppressWarnings("all") - public void updateSnapshotExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void acknowledgeExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSubscriber.addException(exception); try { - long seconds = 123456L; - Timestamp expireTime = Timestamp.newBuilder().setSeconds(seconds).build(); - Snapshot snapshot = Snapshot.newBuilder().setExpireTime(expireTime).build(); - String pathsElement = "expire_time"; - List paths = Arrays.asList(pathsElement); - FieldMask updateMask = FieldMask.newBuilder().addAllPaths(paths).build(); - UpdateSnapshotRequest request = - UpdateSnapshotRequest.newBuilder() - .setSnapshot(snapshot) - .setUpdateMask(updateMask) - .build(); - - client.updateSnapshot(request); + SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); + List ackIds = new ArrayList<>(); + client.acknowledge(subscription, ackIds); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void deleteSnapshotTest() { + public void acknowledgeTest2() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockSubscriber.addResponse(expectedResponse); - ProjectSnapshotName snapshot = ProjectSnapshotName.of("[PROJECT]", "[SNAPSHOT]"); + String subscription = "subscription341203229"; + List ackIds = new ArrayList<>(); - client.deleteSnapshot(snapshot); + client.acknowledge(subscription, ackIds); + + List actualRequests = mockSubscriber.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + AcknowledgeRequest actualRequest = ((AcknowledgeRequest) actualRequests.get(0)); + + Assert.assertEquals(subscription, actualRequest.getSubscription()); + Assert.assertEquals(ackIds, actualRequest.getAckIdsList()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void acknowledgeExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSubscriber.addException(exception); + + try { + String subscription = "subscription341203229"; + List ackIds = new ArrayList<>(); + client.acknowledge(subscription, ackIds); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void pullTest() throws Exception { + PullResponse expectedResponse = + PullResponse.newBuilder().addAllReceivedMessages(new ArrayList()).build(); + mockSubscriber.addResponse(expectedResponse); + + SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); + int maxMessages = 496131527; + + PullResponse actualResponse = client.pull(subscription, maxMessages); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSubscriber.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + PullRequest actualRequest = ((PullRequest) actualRequests.get(0)); + + Assert.assertEquals(subscription.toString(), actualRequest.getSubscription()); + Assert.assertEquals(maxMessages, actualRequest.getMaxMessages()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void pullExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSubscriber.addException(exception); + + try { + SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); + int maxMessages = 496131527; + client.pull(subscription, maxMessages); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void pullTest2() throws Exception { + PullResponse expectedResponse = + PullResponse.newBuilder().addAllReceivedMessages(new ArrayList()).build(); + mockSubscriber.addResponse(expectedResponse); + + String subscription = "subscription341203229"; + int maxMessages = 496131527; + + PullResponse actualResponse = client.pull(subscription, maxMessages); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSubscriber.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + PullRequest actualRequest = ((PullRequest) actualRequests.get(0)); + + Assert.assertEquals(subscription, actualRequest.getSubscription()); + Assert.assertEquals(maxMessages, actualRequest.getMaxMessages()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void pullExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSubscriber.addException(exception); + + try { + String subscription = "subscription341203229"; + int maxMessages = 496131527; + client.pull(subscription, maxMessages); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void pullTest3() throws Exception { + PullResponse expectedResponse = + PullResponse.newBuilder().addAllReceivedMessages(new ArrayList()).build(); + mockSubscriber.addResponse(expectedResponse); + + SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); + boolean returnImmediately = true; + int maxMessages = 496131527; + + PullResponse actualResponse = client.pull(subscription, returnImmediately, maxMessages); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSubscriber.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + PullRequest actualRequest = ((PullRequest) actualRequests.get(0)); + + Assert.assertEquals(subscription.toString(), actualRequest.getSubscription()); + Assert.assertEquals(returnImmediately, actualRequest.getReturnImmediately()); + Assert.assertEquals(maxMessages, actualRequest.getMaxMessages()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void pullExceptionTest3() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSubscriber.addException(exception); + + try { + SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); + boolean returnImmediately = true; + int maxMessages = 496131527; + client.pull(subscription, returnImmediately, maxMessages); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void pullTest4() throws Exception { + PullResponse expectedResponse = + PullResponse.newBuilder().addAllReceivedMessages(new ArrayList()).build(); + mockSubscriber.addResponse(expectedResponse); + + String subscription = "subscription341203229"; + boolean returnImmediately = true; + int maxMessages = 496131527; + + PullResponse actualResponse = client.pull(subscription, returnImmediately, maxMessages); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSubscriber.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + PullRequest actualRequest = ((PullRequest) actualRequests.get(0)); + + Assert.assertEquals(subscription, actualRequest.getSubscription()); + Assert.assertEquals(returnImmediately, actualRequest.getReturnImmediately()); + Assert.assertEquals(maxMessages, actualRequest.getMaxMessages()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void pullExceptionTest4() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSubscriber.addException(exception); + + try { + String subscription = "subscription341203229"; + boolean returnImmediately = true; + int maxMessages = 496131527; + client.pull(subscription, returnImmediately, maxMessages); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void streamingPullTest() throws Exception { + StreamingPullResponse expectedResponse = + StreamingPullResponse.newBuilder() + .addAllReceivedMessages(new ArrayList()) + .setAcknowledgeConfirmation( + StreamingPullResponse.AcknowledgeConfirmation.newBuilder().build()) + .setModifyAckDeadlineConfirmation( + StreamingPullResponse.ModifyAckDeadlineConfirmation.newBuilder().build()) + .setSubscriptionProperties( + StreamingPullResponse.SubscriptionProperties.newBuilder().build()) + .build(); + mockSubscriber.addResponse(expectedResponse); + StreamingPullRequest request = + StreamingPullRequest.newBuilder() + .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString()) + .addAllAckIds(new ArrayList()) + .addAllModifyDeadlineSeconds(new ArrayList()) + .addAllModifyDeadlineAckIds(new ArrayList()) + .setStreamAckDeadlineSeconds(1875467245) + .setClientId("clientId908408390") + .setMaxOutstandingMessages(-1315266996) + .setMaxOutstandingBytes(-2103098517) + .setProtocolVersion(-1161610703) + .build(); + + MockStreamObserver responseObserver = new MockStreamObserver<>(); + + BidiStreamingCallable callable = + client.streamingPullCallable(); + ApiStreamObserver requestObserver = + callable.bidiStreamingCall(responseObserver); + + requestObserver.onNext(request); + requestObserver.onCompleted(); + + List actualResponses = responseObserver.future().get(); + Assert.assertEquals(1, actualResponses.size()); + Assert.assertEquals(expectedResponse, actualResponses.get(0)); + } + + @Test + public void streamingPullExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSubscriber.addException(exception); + StreamingPullRequest request = + StreamingPullRequest.newBuilder() + .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString()) + .addAllAckIds(new ArrayList()) + .addAllModifyDeadlineSeconds(new ArrayList()) + .addAllModifyDeadlineAckIds(new ArrayList()) + .setStreamAckDeadlineSeconds(1875467245) + .setClientId("clientId908408390") + .setMaxOutstandingMessages(-1315266996) + .setMaxOutstandingBytes(-2103098517) + .setProtocolVersion(-1161610703) + .build(); + + MockStreamObserver responseObserver = new MockStreamObserver<>(); + + BidiStreamingCallable callable = + client.streamingPullCallable(); + ApiStreamObserver requestObserver = + callable.bidiStreamingCall(responseObserver); + + requestObserver.onNext(request); + + try { + List actualResponses = responseObserver.future().get(); + Assert.fail("No exception thrown"); + } catch (ExecutionException e) { + Assert.assertTrue(e.getCause() instanceof InvalidArgumentException); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void modifyPushConfigTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockSubscriber.addResponse(expectedResponse); + + SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); + PushConfig pushConfig = PushConfig.newBuilder().build(); + + client.modifyPushConfig(subscription, pushConfig); + + List actualRequests = mockSubscriber.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ModifyPushConfigRequest actualRequest = ((ModifyPushConfigRequest) actualRequests.get(0)); + + Assert.assertEquals(subscription.toString(), actualRequest.getSubscription()); + Assert.assertEquals(pushConfig, actualRequest.getPushConfig()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void modifyPushConfigExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSubscriber.addException(exception); + + try { + SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); + PushConfig pushConfig = PushConfig.newBuilder().build(); + client.modifyPushConfig(subscription, pushConfig); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void modifyPushConfigTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockSubscriber.addResponse(expectedResponse); + + String subscription = "subscription341203229"; + PushConfig pushConfig = PushConfig.newBuilder().build(); + + client.modifyPushConfig(subscription, pushConfig); + + List actualRequests = mockSubscriber.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ModifyPushConfigRequest actualRequest = ((ModifyPushConfigRequest) actualRequests.get(0)); + + Assert.assertEquals(subscription, actualRequest.getSubscription()); + Assert.assertEquals(pushConfig, actualRequest.getPushConfig()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void modifyPushConfigExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSubscriber.addException(exception); + + try { + String subscription = "subscription341203229"; + PushConfig pushConfig = PushConfig.newBuilder().build(); + client.modifyPushConfig(subscription, pushConfig); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getSnapshotTest() throws Exception { + Snapshot expectedResponse = + Snapshot.newBuilder() + .setName(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString()) + .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + mockSubscriber.addResponse(expectedResponse); + + SnapshotName snapshot = SnapshotName.of("[PROJECT]", "[SNAPSHOT]"); + + Snapshot actualResponse = client.getSnapshot(snapshot); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSubscriber.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetSnapshotRequest actualRequest = ((GetSnapshotRequest) actualRequests.get(0)); + + Assert.assertEquals(snapshot.toString(), actualRequest.getSnapshot()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getSnapshotExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSubscriber.addException(exception); + + try { + SnapshotName snapshot = SnapshotName.of("[PROJECT]", "[SNAPSHOT]"); + client.getSnapshot(snapshot); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getSnapshotTest2() throws Exception { + Snapshot expectedResponse = + Snapshot.newBuilder() + .setName(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString()) + .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + mockSubscriber.addResponse(expectedResponse); + + String snapshot = "snapshot284874180"; + + Snapshot actualResponse = client.getSnapshot(snapshot); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSubscriber.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetSnapshotRequest actualRequest = ((GetSnapshotRequest) actualRequests.get(0)); + + Assert.assertEquals(snapshot, actualRequest.getSnapshot()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getSnapshotExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSubscriber.addException(exception); + + try { + String snapshot = "snapshot284874180"; + client.getSnapshot(snapshot); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listSnapshotsTest() throws Exception { + Snapshot responsesElement = Snapshot.newBuilder().build(); + ListSnapshotsResponse expectedResponse = + ListSnapshotsResponse.newBuilder() + .setNextPageToken("") + .addAllSnapshots(Arrays.asList(responsesElement)) + .build(); + mockSubscriber.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + + ListSnapshotsPagedResponse pagedListResponse = client.listSnapshots(project); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getSnapshotsList().get(0), resources.get(0)); + + List actualRequests = mockSubscriber.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListSnapshotsRequest actualRequest = ((ListSnapshotsRequest) actualRequests.get(0)); + + Assert.assertEquals(project.toString(), actualRequest.getProject()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listSnapshotsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSubscriber.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + client.listSnapshots(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listSnapshotsTest2() throws Exception { + Snapshot responsesElement = Snapshot.newBuilder().build(); + ListSnapshotsResponse expectedResponse = + ListSnapshotsResponse.newBuilder() + .setNextPageToken("") + .addAllSnapshots(Arrays.asList(responsesElement)) + .build(); + mockSubscriber.addResponse(expectedResponse); + + String project = "project-309310695"; + + ListSnapshotsPagedResponse pagedListResponse = client.listSnapshots(project); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getSnapshotsList().get(0), resources.get(0)); + + List actualRequests = mockSubscriber.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListSnapshotsRequest actualRequest = ((ListSnapshotsRequest) actualRequests.get(0)); + + Assert.assertEquals(project, actualRequest.getProject()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listSnapshotsExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSubscriber.addException(exception); + + try { + String project = "project-309310695"; + client.listSnapshots(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createSnapshotTest() throws Exception { + Snapshot expectedResponse = + Snapshot.newBuilder() + .setName(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString()) + .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + mockSubscriber.addResponse(expectedResponse); + + SnapshotName name = SnapshotName.of("[PROJECT]", "[SNAPSHOT]"); + SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); + + Snapshot actualResponse = client.createSnapshot(name, subscription); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSubscriber.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateSnapshotRequest actualRequest = ((CreateSnapshotRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertEquals(subscription.toString(), actualRequest.getSubscription()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createSnapshotExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSubscriber.addException(exception); + + try { + SnapshotName name = SnapshotName.of("[PROJECT]", "[SNAPSHOT]"); + SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); + client.createSnapshot(name, subscription); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createSnapshotTest2() throws Exception { + Snapshot expectedResponse = + Snapshot.newBuilder() + .setName(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString()) + .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + mockSubscriber.addResponse(expectedResponse); + + SnapshotName name = SnapshotName.of("[PROJECT]", "[SNAPSHOT]"); + String subscription = "subscription341203229"; + + Snapshot actualResponse = client.createSnapshot(name, subscription); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSubscriber.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateSnapshotRequest actualRequest = ((CreateSnapshotRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertEquals(subscription, actualRequest.getSubscription()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createSnapshotExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSubscriber.addException(exception); + + try { + SnapshotName name = SnapshotName.of("[PROJECT]", "[SNAPSHOT]"); + String subscription = "subscription341203229"; + client.createSnapshot(name, subscription); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createSnapshotTest3() throws Exception { + Snapshot expectedResponse = + Snapshot.newBuilder() + .setName(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString()) + .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + mockSubscriber.addResponse(expectedResponse); + + String name = "name3373707"; + SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); + + Snapshot actualResponse = client.createSnapshot(name, subscription); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSubscriber.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateSnapshotRequest actualRequest = ((CreateSnapshotRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertEquals(subscription.toString(), actualRequest.getSubscription()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createSnapshotExceptionTest3() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSubscriber.addException(exception); + + try { + String name = "name3373707"; + SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); + client.createSnapshot(name, subscription); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createSnapshotTest4() throws Exception { + Snapshot expectedResponse = + Snapshot.newBuilder() + .setName(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString()) + .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + mockSubscriber.addResponse(expectedResponse); + + String name = "name3373707"; + String subscription = "subscription341203229"; + + Snapshot actualResponse = client.createSnapshot(name, subscription); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSubscriber.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateSnapshotRequest actualRequest = ((CreateSnapshotRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertEquals(subscription, actualRequest.getSubscription()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createSnapshotExceptionTest4() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSubscriber.addException(exception); + + try { + String name = "name3373707"; + String subscription = "subscription341203229"; + client.createSnapshot(name, subscription); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateSnapshotTest() throws Exception { + Snapshot expectedResponse = + Snapshot.newBuilder() + .setName(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString()) + .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + mockSubscriber.addResponse(expectedResponse); + + Snapshot snapshot = Snapshot.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Snapshot actualResponse = client.updateSnapshot(snapshot, updateMask); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSubscriber.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + UpdateSnapshotRequest actualRequest = ((UpdateSnapshotRequest) actualRequests.get(0)); + + Assert.assertEquals(snapshot, actualRequest.getSnapshot()); + Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void updateSnapshotExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSubscriber.addException(exception); + + try { + Snapshot snapshot = Snapshot.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateSnapshot(snapshot, updateMask); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteSnapshotTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockSubscriber.addResponse(expectedResponse); + + SnapshotName snapshot = SnapshotName.of("[PROJECT]", "[SNAPSHOT]"); + + client.deleteSnapshot(snapshot); List actualRequests = mockSubscriber.getRequests(); Assert.assertEquals(1, actualRequests.size()); - DeleteSnapshotRequest actualRequest = (DeleteSnapshotRequest) actualRequests.get(0); + DeleteSnapshotRequest actualRequest = ((DeleteSnapshotRequest) actualRequests.get(0)); - Assert.assertEquals(snapshot, ProjectSnapshotName.parse(actualRequest.getSnapshot())); + Assert.assertEquals(snapshot.toString(), actualRequest.getSnapshot()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -872,40 +1628,73 @@ public void deleteSnapshotTest() { } @Test - @SuppressWarnings("all") public void deleteSnapshotExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSubscriber.addException(exception); try { - ProjectSnapshotName snapshot = ProjectSnapshotName.of("[PROJECT]", "[SNAPSHOT]"); + SnapshotName snapshot = SnapshotName.of("[PROJECT]", "[SNAPSHOT]"); + client.deleteSnapshot(snapshot); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + @Test + public void deleteSnapshotTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockSubscriber.addResponse(expectedResponse); + + String snapshot = "snapshot284874180"; + + client.deleteSnapshot(snapshot); + + List actualRequests = mockSubscriber.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteSnapshotRequest actualRequest = ((DeleteSnapshotRequest) actualRequests.get(0)); + + Assert.assertEquals(snapshot, actualRequest.getSnapshot()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteSnapshotExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSubscriber.addException(exception); + + try { + String snapshot = "snapshot284874180"; client.deleteSnapshot(snapshot); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void seekTest() { + public void seekTest() throws Exception { SeekResponse expectedResponse = SeekResponse.newBuilder().build(); mockSubscriber.addResponse(expectedResponse); - ProjectSubscriptionName subscription = - ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); - SeekRequest request = SeekRequest.newBuilder().setSubscription(subscription.toString()).build(); + SeekRequest request = + SeekRequest.newBuilder() + .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString()) + .build(); SeekResponse actualResponse = client.seek(request); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockSubscriber.getRequests(); Assert.assertEquals(1, actualRequests.size()); - SeekRequest actualRequest = (SeekRequest) actualRequests.get(0); + SeekRequest actualRequest = ((SeekRequest) actualRequests.get(0)); - Assert.assertEquals( - subscription, ProjectSubscriptionName.parse(actualRequest.getSubscription())); + Assert.assertEquals(request.getSubscription(), actualRequest.getSubscription()); + Assert.assertEquals(request.getTime(), actualRequest.getTime()); + Assert.assertEquals(request.getSnapshot(), actualRequest.getSnapshot()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -913,46 +1702,50 @@ public void seekTest() { } @Test - @SuppressWarnings("all") public void seekExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSubscriber.addException(exception); try { - ProjectSubscriptionName subscription = - ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); SeekRequest request = - SeekRequest.newBuilder().setSubscription(subscription.toString()).build(); - + SeekRequest.newBuilder() + .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString()) + .build(); client.seek(request); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void setIamPolicyTest() { - int version = 351608024; - ByteString etag = ByteString.copyFromUtf8("21"); - Policy expectedResponse = Policy.newBuilder().setVersion(version).setEtag(etag).build(); + public void setIamPolicyTest() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setVersion(351608024) + .addAllBindings(new ArrayList()) + .addAllAuditConfigs(new ArrayList()) + .setEtag(ByteString.EMPTY) + .build(); mockIAMPolicy.addResponse(expectedResponse); - ResourceName resource = ProjectName.of("[PROJECT]"); - Policy policy = Policy.newBuilder().build(); SetIamPolicyRequest request = - SetIamPolicyRequest.newBuilder().setResource(resource.toString()).setPolicy(policy).build(); + SetIamPolicyRequest.newBuilder() + .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); Policy actualResponse = client.setIamPolicy(request); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockIAMPolicy.getRequests(); Assert.assertEquals(1, actualRequests.size()); - SetIamPolicyRequest actualRequest = (SetIamPolicyRequest) actualRequests.get(0); + SetIamPolicyRequest actualRequest = ((SetIamPolicyRequest) actualRequests.get(0)); - Assert.assertEquals(Objects.toString(resource), Objects.toString(actualRequest.getResource())); - Assert.assertEquals(policy, actualRequest.getPolicy()); + Assert.assertEquals(request.getResource(), actualRequest.getResource()); + Assert.assertEquals(request.getPolicy(), actualRequest.getPolicy()); + Assert.assertEquals(request.getUpdateMask(), actualRequest.getUpdateMask()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -960,47 +1753,50 @@ public void setIamPolicyTest() { } @Test - @SuppressWarnings("all") public void setIamPolicyExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIAMPolicy.addException(exception); try { - ResourceName resource = ProjectName.of("[PROJECT]"); - Policy policy = Policy.newBuilder().build(); SetIamPolicyRequest request = SetIamPolicyRequest.newBuilder() - .setResource(resource.toString()) - .setPolicy(policy) + .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) .build(); - client.setIamPolicy(request); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void getIamPolicyTest() { - int version = 351608024; - ByteString etag = ByteString.copyFromUtf8("21"); - Policy expectedResponse = Policy.newBuilder().setVersion(version).setEtag(etag).build(); + public void getIamPolicyTest() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setVersion(351608024) + .addAllBindings(new ArrayList()) + .addAllAuditConfigs(new ArrayList()) + .setEtag(ByteString.EMPTY) + .build(); mockIAMPolicy.addResponse(expectedResponse); - ResourceName resource = ProjectName.of("[PROJECT]"); GetIamPolicyRequest request = - GetIamPolicyRequest.newBuilder().setResource(resource.toString()).build(); + GetIamPolicyRequest.newBuilder() + .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); Policy actualResponse = client.getIamPolicy(request); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockIAMPolicy.getRequests(); Assert.assertEquals(1, actualRequests.size()); - GetIamPolicyRequest actualRequest = (GetIamPolicyRequest) actualRequests.get(0); + GetIamPolicyRequest actualRequest = ((GetIamPolicyRequest) actualRequests.get(0)); - Assert.assertEquals(Objects.toString(resource), Objects.toString(actualRequest.getResource())); + Assert.assertEquals(request.getResource(), actualRequest.getResource()); + Assert.assertEquals(request.getOptions(), actualRequest.getOptions()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -1008,35 +1804,33 @@ public void getIamPolicyTest() { } @Test - @SuppressWarnings("all") public void getIamPolicyExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIAMPolicy.addException(exception); try { - ResourceName resource = ProjectName.of("[PROJECT]"); GetIamPolicyRequest request = - GetIamPolicyRequest.newBuilder().setResource(resource.toString()).build(); - + GetIamPolicyRequest.newBuilder() + .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); client.getIamPolicy(request); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void testIamPermissionsTest() { - TestIamPermissionsResponse expectedResponse = TestIamPermissionsResponse.newBuilder().build(); + public void testIamPermissionsTest() throws Exception { + TestIamPermissionsResponse expectedResponse = + TestIamPermissionsResponse.newBuilder().addAllPermissions(new ArrayList()).build(); mockIAMPolicy.addResponse(expectedResponse); - ResourceName resource = ProjectName.of("[PROJECT]"); - List permissions = new ArrayList<>(); TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder() - .setResource(resource.toString()) - .addAllPermissions(permissions) + .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) + .addAllPermissions(new ArrayList()) .build(); TestIamPermissionsResponse actualResponse = client.testIamPermissions(request); @@ -1044,10 +1838,10 @@ public void testIamPermissionsTest() { List actualRequests = mockIAMPolicy.getRequests(); Assert.assertEquals(1, actualRequests.size()); - TestIamPermissionsRequest actualRequest = (TestIamPermissionsRequest) actualRequests.get(0); + TestIamPermissionsRequest actualRequest = ((TestIamPermissionsRequest) actualRequests.get(0)); - Assert.assertEquals(Objects.toString(resource), Objects.toString(actualRequest.getResource())); - Assert.assertEquals(permissions, actualRequest.getPermissionsList()); + Assert.assertEquals(request.getResource(), actualRequest.getResource()); + Assert.assertEquals(request.getPermissionsList(), actualRequest.getPermissionsList()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -1055,24 +1849,20 @@ public void testIamPermissionsTest() { } @Test - @SuppressWarnings("all") public void testIamPermissionsExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIAMPolicy.addException(exception); try { - ResourceName resource = ProjectName.of("[PROJECT]"); - List permissions = new ArrayList<>(); TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder() - .setResource(resource.toString()) - .addAllPermissions(permissions) + .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) + .addAllPermissions(new ArrayList()) .build(); - client.testIamPermissions(request); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } } 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 new file mode 100644 index 000000000..70165e3a2 --- /dev/null +++ b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/TopicAdminClientHttpJsonTest.java @@ -0,0 +1,1091 @@ +/* + * Copyright 2026 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 static com.google.cloud.pubsub.v1.TopicAdminClient.ListTopicSnapshotsPagedResponse; +import static com.google.cloud.pubsub.v1.TopicAdminClient.ListTopicSubscriptionsPagedResponse; +import static com.google.cloud.pubsub.v1.TopicAdminClient.ListTopicsPagedResponse; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.pubsub.v1.stub.HttpJsonPublisherStub; +import com.google.common.collect.Lists; +import com.google.iam.v1.AuditConfig; +import com.google.iam.v1.Binding; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import com.google.protobuf.ByteString; +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; +import com.google.pubsub.v1.ListTopicSnapshotsResponse; +import com.google.pubsub.v1.ListTopicSubscriptionsResponse; +import com.google.pubsub.v1.ListTopicsResponse; +import com.google.pubsub.v1.MessageStoragePolicy; +import com.google.pubsub.v1.MessageTransform; +import com.google.pubsub.v1.ProjectName; +import com.google.pubsub.v1.PublishResponse; +import com.google.pubsub.v1.PubsubMessage; +import com.google.pubsub.v1.SchemaName; +import com.google.pubsub.v1.SchemaSettings; +import com.google.pubsub.v1.SubscriptionName; +import com.google.pubsub.v1.Topic; +import com.google.pubsub.v1.TopicName; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import javax.annotation.Generated; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@Generated("by gapic-generator-java") +public class TopicAdminClientHttpJsonTest { + private static MockHttpService mockService; + private static TopicAdminClient client; + + @BeforeClass + public static void startStaticServer() throws IOException { + mockService = + new MockHttpService( + HttpJsonPublisherStub.getMethodDescriptors(), TopicAdminSettings.getDefaultEndpoint()); + TopicAdminSettings settings = + TopicAdminSettings.newHttpJsonBuilder() + .setTransportChannelProvider( + TopicAdminSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = TopicAdminClient.create(settings); + } + + @AfterClass + public static void stopServer() { + client.close(); + } + + @Before + public void setUp() {} + + @After + public void tearDown() throws Exception { + mockService.reset(); + } + + @Test + public void createTopicTest() throws Exception { + Topic expectedResponse = + Topic.newBuilder() + .setName(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) + .putAllLabels(new HashMap()) + .setMessageStoragePolicy(MessageStoragePolicy.newBuilder().build()) + .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); + + TopicName name = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]"); + + Topic actualResponse = client.createTopic(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createTopicExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + TopicName name = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]"); + client.createTopic(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createTopicTest2() throws Exception { + Topic expectedResponse = + Topic.newBuilder() + .setName(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) + .putAllLabels(new HashMap()) + .setMessageStoragePolicy(MessageStoragePolicy.newBuilder().build()) + .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); + + String name = "projects/project-7550/topics/topic-7550"; + + Topic actualResponse = client.createTopic(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createTopicExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-7550/topics/topic-7550"; + client.createTopic(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateTopicTest() throws Exception { + Topic expectedResponse = + Topic.newBuilder() + .setName(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) + .putAllLabels(new HashMap()) + .setMessageStoragePolicy(MessageStoragePolicy.newBuilder().build()) + .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); + + Topic topic = + Topic.newBuilder() + .setName(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) + .putAllLabels(new HashMap()) + .setMessageStoragePolicy(MessageStoragePolicy.newBuilder().build()) + .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(); + + Topic actualResponse = client.updateTopic(topic, updateMask); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void updateTopicExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + Topic topic = + Topic.newBuilder() + .setName(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) + .putAllLabels(new HashMap()) + .setMessageStoragePolicy(MessageStoragePolicy.newBuilder().build()) + .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); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void publishTest() throws Exception { + PublishResponse expectedResponse = + PublishResponse.newBuilder().addAllMessageIds(new ArrayList()).build(); + mockService.addResponse(expectedResponse); + + TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]"); + List messages = new ArrayList<>(); + + PublishResponse actualResponse = client.publish(topic, messages); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void publishExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]"); + List messages = new ArrayList<>(); + client.publish(topic, messages); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void publishTest2() throws Exception { + PublishResponse expectedResponse = + PublishResponse.newBuilder().addAllMessageIds(new ArrayList()).build(); + mockService.addResponse(expectedResponse); + + String topic = "projects/project-2486/topics/topic-2486"; + List messages = new ArrayList<>(); + + PublishResponse actualResponse = client.publish(topic, messages); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void publishExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String topic = "projects/project-2486/topics/topic-2486"; + List messages = new ArrayList<>(); + client.publish(topic, messages); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getTopicTest() throws Exception { + Topic expectedResponse = + Topic.newBuilder() + .setName(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) + .putAllLabels(new HashMap()) + .setMessageStoragePolicy(MessageStoragePolicy.newBuilder().build()) + .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); + + TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]"); + + Topic actualResponse = client.getTopic(topic); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getTopicExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]"); + client.getTopic(topic); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getTopicTest2() throws Exception { + Topic expectedResponse = + Topic.newBuilder() + .setName(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) + .putAllLabels(new HashMap()) + .setMessageStoragePolicy(MessageStoragePolicy.newBuilder().build()) + .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); + + String topic = "projects/project-2486/topics/topic-2486"; + + Topic actualResponse = client.getTopic(topic); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getTopicExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String topic = "projects/project-2486/topics/topic-2486"; + client.getTopic(topic); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listTopicsTest() throws Exception { + Topic responsesElement = Topic.newBuilder().build(); + ListTopicsResponse expectedResponse = + ListTopicsResponse.newBuilder() + .setNextPageToken("") + .addAllTopics(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ProjectName project = ProjectName.of("[PROJECT]"); + + ListTopicsPagedResponse pagedListResponse = client.listTopics(project); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getTopicsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listTopicsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProjectName project = ProjectName.of("[PROJECT]"); + client.listTopics(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listTopicsTest2() throws Exception { + Topic responsesElement = Topic.newBuilder().build(); + ListTopicsResponse expectedResponse = + ListTopicsResponse.newBuilder() + .setNextPageToken("") + .addAllTopics(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String project = "projects/project-7934"; + + ListTopicsPagedResponse pagedListResponse = client.listTopics(project); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getTopicsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listTopicsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String project = "projects/project-7934"; + client.listTopics(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listTopicSubscriptionsTest() throws Exception { + String responsesElement = "responsesElement-318365110"; + ListTopicSubscriptionsResponse expectedResponse = + ListTopicSubscriptionsResponse.newBuilder() + .setNextPageToken("") + .addAllSubscriptions(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]"); + + ListTopicSubscriptionsPagedResponse pagedListResponse = client.listTopicSubscriptions(topic); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getSubscriptionsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listTopicSubscriptionsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]"); + client.listTopicSubscriptions(topic); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listTopicSubscriptionsTest2() throws Exception { + String responsesElement = "responsesElement-318365110"; + ListTopicSubscriptionsResponse expectedResponse = + ListTopicSubscriptionsResponse.newBuilder() + .setNextPageToken("") + .addAllSubscriptions(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String topic = "projects/project-2486/topics/topic-2486"; + + ListTopicSubscriptionsPagedResponse pagedListResponse = client.listTopicSubscriptions(topic); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getSubscriptionsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listTopicSubscriptionsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String topic = "projects/project-2486/topics/topic-2486"; + client.listTopicSubscriptions(topic); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listTopicSnapshotsTest() throws Exception { + String responsesElement = "responsesElement-318365110"; + ListTopicSnapshotsResponse expectedResponse = + ListTopicSnapshotsResponse.newBuilder() + .setNextPageToken("") + .addAllSnapshots(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]"); + + ListTopicSnapshotsPagedResponse pagedListResponse = client.listTopicSnapshots(topic); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getSnapshotsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listTopicSnapshotsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]"); + client.listTopicSnapshots(topic); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listTopicSnapshotsTest2() throws Exception { + String responsesElement = "responsesElement-318365110"; + ListTopicSnapshotsResponse expectedResponse = + ListTopicSnapshotsResponse.newBuilder() + .setNextPageToken("") + .addAllSnapshots(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String topic = "projects/project-2486/topics/topic-2486"; + + ListTopicSnapshotsPagedResponse pagedListResponse = client.listTopicSnapshots(topic); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getSnapshotsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listTopicSnapshotsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String topic = "projects/project-2486/topics/topic-2486"; + client.listTopicSnapshots(topic); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteTopicTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]"); + + client.deleteTopic(topic); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteTopicExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]"); + client.deleteTopic(topic); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteTopicTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + String topic = "projects/project-2486/topics/topic-2486"; + + client.deleteTopic(topic); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteTopicExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String topic = "projects/project-2486/topics/topic-2486"; + client.deleteTopic(topic); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void detachSubscriptionTest() throws Exception { + DetachSubscriptionResponse expectedResponse = DetachSubscriptionResponse.newBuilder().build(); + mockService.addResponse(expectedResponse); + + DetachSubscriptionRequest request = + DetachSubscriptionRequest.newBuilder() + .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString()) + .build(); + + DetachSubscriptionResponse actualResponse = client.detachSubscription(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void detachSubscriptionExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + DetachSubscriptionRequest request = + DetachSubscriptionRequest.newBuilder() + .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString()) + .build(); + client.detachSubscription(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void setIamPolicyTest() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setVersion(351608024) + .addAllBindings(new ArrayList()) + .addAllAuditConfigs(new ArrayList()) + .setEtag(ByteString.EMPTY) + .build(); + mockService.addResponse(expectedResponse); + + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + + Policy actualResponse = client.setIamPolicy(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void setIamPolicyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + client.setIamPolicy(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getIamPolicyTest() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setVersion(351608024) + .addAllBindings(new ArrayList()) + .addAllAuditConfigs(new ArrayList()) + .setEtag(ByteString.EMPTY) + .build(); + mockService.addResponse(expectedResponse); + + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + + Policy actualResponse = client.getIamPolicy(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getIamPolicyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + client.getIamPolicy(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void testIamPermissionsTest() throws Exception { + TestIamPermissionsResponse expectedResponse = + TestIamPermissionsResponse.newBuilder().addAllPermissions(new ArrayList()).build(); + mockService.addResponse(expectedResponse); + + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) + .addAllPermissions(new ArrayList()) + .build(); + + TestIamPermissionsResponse actualResponse = client.testIamPermissions(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void testIamPermissionsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) + .addAllPermissions(new ArrayList()) + .build(); + client.testIamPermissions(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} 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 f6c1607db..5774110a4 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 @@ -1,11 +1,11 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 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 + * 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, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.pubsub.v1; import static com.google.cloud.pubsub.v1.TopicAdminClient.ListTopicSnapshotsPagedResponse; @@ -26,43 +27,52 @@ import com.google.api.gax.grpc.testing.MockServiceHelper; import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.InvalidArgumentException; -import com.google.api.resourcenames.ResourceName; import com.google.common.collect.Lists; +import com.google.iam.v1.AuditConfig; +import com.google.iam.v1.Binding; import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; import com.google.iam.v1.Policy; import com.google.iam.v1.SetIamPolicyRequest; import com.google.iam.v1.TestIamPermissionsRequest; import com.google.iam.v1.TestIamPermissionsResponse; import com.google.protobuf.AbstractMessage; import com.google.protobuf.ByteString; +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; import com.google.pubsub.v1.GetTopicRequest; +import com.google.pubsub.v1.IngestionDataSourceSettings; import com.google.pubsub.v1.ListTopicSnapshotsRequest; import com.google.pubsub.v1.ListTopicSnapshotsResponse; import com.google.pubsub.v1.ListTopicSubscriptionsRequest; import com.google.pubsub.v1.ListTopicSubscriptionsResponse; import com.google.pubsub.v1.ListTopicsRequest; import com.google.pubsub.v1.ListTopicsResponse; +import com.google.pubsub.v1.MessageStoragePolicy; +import com.google.pubsub.v1.MessageTransform; import com.google.pubsub.v1.ProjectName; -import com.google.pubsub.v1.ProjectSubscriptionName; import com.google.pubsub.v1.PublishRequest; import com.google.pubsub.v1.PublishResponse; import com.google.pubsub.v1.PubsubMessage; +import com.google.pubsub.v1.SchemaName; +import com.google.pubsub.v1.SchemaSettings; +import com.google.pubsub.v1.SubscriptionName; import com.google.pubsub.v1.Topic; import com.google.pubsub.v1.TopicName; import com.google.pubsub.v1.UpdateTopicRequest; -import io.grpc.Status; import io.grpc.StatusRuntimeException; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; import java.util.List; -import java.util.Objects; import java.util.UUID; +import javax.annotation.Generated; import org.junit.After; import org.junit.AfterClass; import org.junit.Assert; @@ -70,39 +80,34 @@ import org.junit.BeforeClass; import org.junit.Test; -@javax.annotation.Generated("by GAPIC") +@Generated("by gapic-generator-java") public class TopicAdminClientTest { - private static MockSchemaService mockSchemaService; - private static MockPublisher mockPublisher; private static MockIAMPolicy mockIAMPolicy; - private static MockSubscriber mockSubscriber; - private static MockServiceHelper serviceHelper; - private TopicAdminClient client; + private static MockPublisher mockPublisher; + private static MockServiceHelper mockServiceHelper; private LocalChannelProvider channelProvider; + private TopicAdminClient client; @BeforeClass public static void startStaticServer() { - mockSchemaService = new MockSchemaService(); mockPublisher = new MockPublisher(); mockIAMPolicy = new MockIAMPolicy(); - mockSubscriber = new MockSubscriber(); - serviceHelper = + mockServiceHelper = new MockServiceHelper( UUID.randomUUID().toString(), - Arrays.asList( - mockSchemaService, mockPublisher, mockIAMPolicy, mockSubscriber)); - serviceHelper.start(); + Arrays.asList(mockPublisher, mockIAMPolicy)); + mockServiceHelper.start(); } @AfterClass public static void stopServer() { - serviceHelper.stop(); + mockServiceHelper.stop(); } @Before public void setUp() throws IOException { - serviceHelper.reset(); - channelProvider = serviceHelper.createChannelProvider(); + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); TopicAdminSettings settings = TopicAdminSettings.newBuilder() .setTransportChannelProvider(channelProvider) @@ -117,16 +122,21 @@ public void tearDown() throws Exception { } @Test - @SuppressWarnings("all") - public void createTopicTest() { - TopicName name2 = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]"); - String kmsKeyName = "kmsKeyName2094986649"; - boolean satisfiesPzs = false; + public void createTopicTest() throws Exception { Topic expectedResponse = Topic.newBuilder() - .setName(name2.toString()) - .setKmsKeyName(kmsKeyName) - .setSatisfiesPzs(satisfiesPzs) + .setName(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) + .putAllLabels(new HashMap()) + .setMessageStoragePolicy(MessageStoragePolicy.newBuilder().build()) + .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); @@ -137,9 +147,9 @@ public void createTopicTest() { List actualRequests = mockPublisher.getRequests(); Assert.assertEquals(1, actualRequests.size()); - Topic actualRequest = (Topic) actualRequests.get(0); + Topic actualRequest = ((Topic) actualRequests.get(0)); - Assert.assertEquals(name, TopicName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -147,46 +157,96 @@ public void createTopicTest() { } @Test - @SuppressWarnings("all") public void createTopicExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockPublisher.addException(exception); try { TopicName name = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]"); + client.createTopic(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + @Test + public void createTopicTest2() throws Exception { + Topic expectedResponse = + Topic.newBuilder() + .setName(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) + .putAllLabels(new HashMap()) + .setMessageStoragePolicy(MessageStoragePolicy.newBuilder().build()) + .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); + + String name = "name3373707"; + + Topic actualResponse = client.createTopic(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockPublisher.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + Topic actualRequest = ((Topic) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createTopicExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockPublisher.addException(exception); + + try { + String name = "name3373707"; client.createTopic(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void updateTopicTest() { - TopicName name = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]"); - String kmsKeyName = "kmsKeyName2094986649"; - boolean satisfiesPzs = false; + public void updateTopicTest() throws Exception { Topic expectedResponse = Topic.newBuilder() - .setName(name.toString()) - .setKmsKeyName(kmsKeyName) - .setSatisfiesPzs(satisfiesPzs) + .setName(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) + .putAllLabels(new HashMap()) + .setMessageStoragePolicy(MessageStoragePolicy.newBuilder().build()) + .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); Topic topic = Topic.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); - UpdateTopicRequest request = - UpdateTopicRequest.newBuilder().setTopic(topic).setUpdateMask(updateMask).build(); - Topic actualResponse = client.updateTopic(request); + Topic actualResponse = client.updateTopic(topic, updateMask); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockPublisher.getRequests(); Assert.assertEquals(1, actualRequests.size()); - UpdateTopicRequest actualRequest = (UpdateTopicRequest) actualRequests.get(0); + UpdateTopicRequest actualRequest = ((UpdateTopicRequest) actualRequests.get(0)); Assert.assertEquals(topic, actualRequest.getTopic()); Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); @@ -197,46 +257,37 @@ public void updateTopicTest() { } @Test - @SuppressWarnings("all") public void updateTopicExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockPublisher.addException(exception); try { Topic topic = Topic.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); - UpdateTopicRequest request = - UpdateTopicRequest.newBuilder().setTopic(topic).setUpdateMask(updateMask).build(); - - client.updateTopic(request); + client.updateTopic(topic, updateMask); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void publishTest() { - String messageIdsElement = "messageIdsElement-744837059"; - List messageIds = Arrays.asList(messageIdsElement); + public void publishTest() throws Exception { PublishResponse expectedResponse = - PublishResponse.newBuilder().addAllMessageIds(messageIds).build(); + PublishResponse.newBuilder().addAllMessageIds(new ArrayList()).build(); mockPublisher.addResponse(expectedResponse); TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]"); - ByteString data = ByteString.copyFromUtf8("-86"); - PubsubMessage messagesElement = PubsubMessage.newBuilder().setData(data).build(); - List messages = Arrays.asList(messagesElement); + List messages = new ArrayList<>(); PublishResponse actualResponse = client.publish(topic, messages); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockPublisher.getRequests(); Assert.assertEquals(1, actualRequests.size()); - PublishRequest actualRequest = (PublishRequest) actualRequests.get(0); + PublishRequest actualRequest = ((PublishRequest) actualRequests.get(0)); - Assert.assertEquals(topic, TopicName.parse(actualRequest.getTopic())); + Assert.assertEquals(topic.toString(), actualRequest.getTopic()); Assert.assertEquals(messages, actualRequest.getMessagesList()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -245,35 +296,75 @@ public void publishTest() { } @Test - @SuppressWarnings("all") public void publishExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockPublisher.addException(exception); try { TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]"); - ByteString data = ByteString.copyFromUtf8("-86"); - PubsubMessage messagesElement = PubsubMessage.newBuilder().setData(data).build(); - List messages = Arrays.asList(messagesElement); + List messages = new ArrayList<>(); + client.publish(topic, messages); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void publishTest2() throws Exception { + PublishResponse expectedResponse = + PublishResponse.newBuilder().addAllMessageIds(new ArrayList()).build(); + mockPublisher.addResponse(expectedResponse); + + String topic = "topic110546223"; + List messages = new ArrayList<>(); + + PublishResponse actualResponse = client.publish(topic, messages); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockPublisher.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + PublishRequest actualRequest = ((PublishRequest) actualRequests.get(0)); + + Assert.assertEquals(topic, actualRequest.getTopic()); + Assert.assertEquals(messages, actualRequest.getMessagesList()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + @Test + public void publishExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockPublisher.addException(exception); + + try { + String topic = "topic110546223"; + List messages = new ArrayList<>(); client.publish(topic, messages); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void getTopicTest() { - TopicName name = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]"); - String kmsKeyName = "kmsKeyName2094986649"; - boolean satisfiesPzs = false; + public void getTopicTest() throws Exception { Topic expectedResponse = Topic.newBuilder() - .setName(name.toString()) - .setKmsKeyName(kmsKeyName) - .setSatisfiesPzs(satisfiesPzs) + .setName(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) + .putAllLabels(new HashMap()) + .setMessageStoragePolicy(MessageStoragePolicy.newBuilder().build()) + .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); @@ -284,9 +375,9 @@ public void getTopicTest() { List actualRequests = mockPublisher.getRequests(); Assert.assertEquals(1, actualRequests.size()); - GetTopicRequest actualRequest = (GetTopicRequest) actualRequests.get(0); + GetTopicRequest actualRequest = ((GetTopicRequest) actualRequests.get(0)); - Assert.assertEquals(topic, TopicName.parse(actualRequest.getTopic())); + Assert.assertEquals(topic.toString(), actualRequest.getTopic()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -294,31 +385,75 @@ public void getTopicTest() { } @Test - @SuppressWarnings("all") public void getTopicExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockPublisher.addException(exception); try { TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]"); + client.getTopic(topic); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getTopicTest2() throws Exception { + Topic expectedResponse = + Topic.newBuilder() + .setName(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) + .putAllLabels(new HashMap()) + .setMessageStoragePolicy(MessageStoragePolicy.newBuilder().build()) + .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); + + String topic = "topic110546223"; + + Topic actualResponse = client.getTopic(topic); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockPublisher.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetTopicRequest actualRequest = ((GetTopicRequest) actualRequests.get(0)); + + Assert.assertEquals(topic, actualRequest.getTopic()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getTopicExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockPublisher.addException(exception); + try { + String topic = "topic110546223"; client.getTopic(topic); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void listTopicsTest() { - String nextPageToken = ""; - Topic topicsElement = Topic.newBuilder().build(); - List topics = Arrays.asList(topicsElement); + public void listTopicsTest() throws Exception { + Topic responsesElement = Topic.newBuilder().build(); ListTopicsResponse expectedResponse = ListTopicsResponse.newBuilder() - .setNextPageToken(nextPageToken) - .addAllTopics(topics) + .setNextPageToken("") + .addAllTopics(Arrays.asList(responsesElement)) .build(); mockPublisher.addResponse(expectedResponse); @@ -327,14 +462,15 @@ public void listTopicsTest() { ListTopicsPagedResponse pagedListResponse = client.listTopics(project); List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); Assert.assertEquals(expectedResponse.getTopicsList().get(0), resources.get(0)); List actualRequests = mockPublisher.getRequests(); Assert.assertEquals(1, actualRequests.size()); - ListTopicsRequest actualRequest = (ListTopicsRequest) actualRequests.get(0); + ListTopicsRequest actualRequest = ((ListTopicsRequest) actualRequests.get(0)); - Assert.assertEquals(project, ProjectName.parse(actualRequest.getProject())); + Assert.assertEquals(project.toString(), actualRequest.getProject()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -342,32 +478,70 @@ public void listTopicsTest() { } @Test - @SuppressWarnings("all") public void listTopicsExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockPublisher.addException(exception); try { ProjectName project = ProjectName.of("[PROJECT]"); + client.listTopics(project); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listTopicsTest2() throws Exception { + Topic responsesElement = Topic.newBuilder().build(); + ListTopicsResponse expectedResponse = + ListTopicsResponse.newBuilder() + .setNextPageToken("") + .addAllTopics(Arrays.asList(responsesElement)) + .build(); + mockPublisher.addResponse(expectedResponse); + + String project = "project-309310695"; + + ListTopicsPagedResponse pagedListResponse = client.listTopics(project); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getTopicsList().get(0), resources.get(0)); + + List actualRequests = mockPublisher.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListTopicsRequest actualRequest = ((ListTopicsRequest) actualRequests.get(0)); + + Assert.assertEquals(project, actualRequest.getProject()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listTopicsExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockPublisher.addException(exception); + + try { + String project = "project-309310695"; client.listTopics(project); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void listTopicSubscriptionsTest() { - String nextPageToken = ""; - ProjectSubscriptionName subscriptionsElement = - ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); - List subscriptions = Arrays.asList(subscriptionsElement); + public void listTopicSubscriptionsTest() throws Exception { + String responsesElement = "responsesElement-318365110"; ListTopicSubscriptionsResponse expectedResponse = ListTopicSubscriptionsResponse.newBuilder() - .setNextPageToken(nextPageToken) - .addAllSubscriptions(ProjectSubscriptionName.toStringList(subscriptions)) + .setNextPageToken("") + .addAllSubscriptions(Arrays.asList(responsesElement)) .build(); mockPublisher.addResponse(expectedResponse); @@ -376,21 +550,16 @@ public void listTopicSubscriptionsTest() { ListTopicSubscriptionsPagedResponse pagedListResponse = client.listTopicSubscriptions(topic); List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); Assert.assertEquals(expectedResponse.getSubscriptionsList().get(0), resources.get(0)); - List resourceNames = - Lists.newArrayList(pagedListResponse.iterateAllAsProjectSubscriptionName()); - Assert.assertEquals(1, resourceNames.size()); - Assert.assertEquals( - ProjectSubscriptionName.parse(expectedResponse.getSubscriptionsList().get(0)), - resourceNames.get(0)); List actualRequests = mockPublisher.getRequests(); Assert.assertEquals(1, actualRequests.size()); ListTopicSubscriptionsRequest actualRequest = - (ListTopicSubscriptionsRequest) actualRequests.get(0); + ((ListTopicSubscriptionsRequest) actualRequests.get(0)); - Assert.assertEquals(topic, TopicName.parse(actualRequest.getTopic())); + Assert.assertEquals(topic.toString(), actualRequest.getTopic()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -398,31 +567,71 @@ public void listTopicSubscriptionsTest() { } @Test - @SuppressWarnings("all") public void listTopicSubscriptionsExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockPublisher.addException(exception); try { TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]"); + client.listTopicSubscriptions(topic); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listTopicSubscriptionsTest2() throws Exception { + String responsesElement = "responsesElement-318365110"; + ListTopicSubscriptionsResponse expectedResponse = + ListTopicSubscriptionsResponse.newBuilder() + .setNextPageToken("") + .addAllSubscriptions(Arrays.asList(responsesElement)) + .build(); + mockPublisher.addResponse(expectedResponse); + + String topic = "topic110546223"; + + ListTopicSubscriptionsPagedResponse pagedListResponse = client.listTopicSubscriptions(topic); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getSubscriptionsList().get(0), resources.get(0)); + List actualRequests = mockPublisher.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListTopicSubscriptionsRequest actualRequest = + ((ListTopicSubscriptionsRequest) actualRequests.get(0)); + + Assert.assertEquals(topic, actualRequest.getTopic()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listTopicSubscriptionsExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockPublisher.addException(exception); + + try { + String topic = "topic110546223"; client.listTopicSubscriptions(topic); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void listTopicSnapshotsTest() { - String nextPageToken = ""; - String snapshotsElement = "snapshotsElement1339034092"; - List snapshots = Arrays.asList(snapshotsElement); + public void listTopicSnapshotsTest() throws Exception { + String responsesElement = "responsesElement-318365110"; ListTopicSnapshotsResponse expectedResponse = ListTopicSnapshotsResponse.newBuilder() - .setNextPageToken(nextPageToken) - .addAllSnapshots(snapshots) + .setNextPageToken("") + .addAllSnapshots(Arrays.asList(responsesElement)) .build(); mockPublisher.addResponse(expectedResponse); @@ -431,14 +640,15 @@ public void listTopicSnapshotsTest() { ListTopicSnapshotsPagedResponse pagedListResponse = client.listTopicSnapshots(topic); List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); Assert.assertEquals(expectedResponse.getSnapshotsList().get(0), resources.get(0)); List actualRequests = mockPublisher.getRequests(); Assert.assertEquals(1, actualRequests.size()); - ListTopicSnapshotsRequest actualRequest = (ListTopicSnapshotsRequest) actualRequests.get(0); + ListTopicSnapshotsRequest actualRequest = ((ListTopicSnapshotsRequest) actualRequests.get(0)); - Assert.assertEquals(topic, TopicName.parse(actualRequest.getTopic())); + Assert.assertEquals(topic.toString(), actualRequest.getTopic()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -446,24 +656,65 @@ public void listTopicSnapshotsTest() { } @Test - @SuppressWarnings("all") public void listTopicSnapshotsExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockPublisher.addException(exception); try { TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]"); + client.listTopicSnapshots(topic); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listTopicSnapshotsTest2() throws Exception { + String responsesElement = "responsesElement-318365110"; + ListTopicSnapshotsResponse expectedResponse = + ListTopicSnapshotsResponse.newBuilder() + .setNextPageToken("") + .addAllSnapshots(Arrays.asList(responsesElement)) + .build(); + mockPublisher.addResponse(expectedResponse); + + String topic = "topic110546223"; + ListTopicSnapshotsPagedResponse pagedListResponse = client.listTopicSnapshots(topic); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getSnapshotsList().get(0), resources.get(0)); + + List actualRequests = mockPublisher.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListTopicSnapshotsRequest actualRequest = ((ListTopicSnapshotsRequest) actualRequests.get(0)); + + Assert.assertEquals(topic, actualRequest.getTopic()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listTopicSnapshotsExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockPublisher.addException(exception); + + try { + String topic = "topic110546223"; client.listTopicSnapshots(topic); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void deleteTopicTest() { + public void deleteTopicTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockPublisher.addResponse(expectedResponse); @@ -473,9 +724,9 @@ public void deleteTopicTest() { List actualRequests = mockPublisher.getRequests(); Assert.assertEquals(1, actualRequests.size()); - DeleteTopicRequest actualRequest = (DeleteTopicRequest) actualRequests.get(0); + DeleteTopicRequest actualRequest = ((DeleteTopicRequest) actualRequests.get(0)); - Assert.assertEquals(topic, TopicName.parse(actualRequest.getTopic())); + Assert.assertEquals(topic.toString(), actualRequest.getTopic()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -483,43 +734,71 @@ public void deleteTopicTest() { } @Test - @SuppressWarnings("all") public void deleteTopicExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockPublisher.addException(exception); try { TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]"); + client.deleteTopic(topic); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteTopicTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockPublisher.addResponse(expectedResponse); + + String topic = "topic110546223"; + + client.deleteTopic(topic); + + List actualRequests = mockPublisher.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteTopicRequest actualRequest = ((DeleteTopicRequest) actualRequests.get(0)); + + Assert.assertEquals(topic, actualRequest.getTopic()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteTopicExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockPublisher.addException(exception); + try { + String topic = "topic110546223"; client.deleteTopic(topic); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void setIamPolicyTest() { - int version = 351608024; - ByteString etag = ByteString.copyFromUtf8("21"); - Policy expectedResponse = Policy.newBuilder().setVersion(version).setEtag(etag).build(); - mockIAMPolicy.addResponse(expectedResponse); + public void detachSubscriptionTest() throws Exception { + DetachSubscriptionResponse expectedResponse = DetachSubscriptionResponse.newBuilder().build(); + mockPublisher.addResponse(expectedResponse); - ResourceName resource = ProjectName.of("[PROJECT]"); - Policy policy = Policy.newBuilder().build(); - SetIamPolicyRequest request = - SetIamPolicyRequest.newBuilder().setResource(resource.toString()).setPolicy(policy).build(); + DetachSubscriptionRequest request = + DetachSubscriptionRequest.newBuilder() + .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString()) + .build(); - Policy actualResponse = client.setIamPolicy(request); + DetachSubscriptionResponse actualResponse = client.detachSubscription(request); Assert.assertEquals(expectedResponse, actualResponse); - List actualRequests = mockIAMPolicy.getRequests(); + List actualRequests = mockPublisher.getRequests(); Assert.assertEquals(1, actualRequests.size()); - SetIamPolicyRequest actualRequest = (SetIamPolicyRequest) actualRequests.get(0); + DetachSubscriptionRequest actualRequest = ((DetachSubscriptionRequest) actualRequests.get(0)); - Assert.assertEquals(Objects.toString(resource), Objects.toString(actualRequest.getResource())); - Assert.assertEquals(policy, actualRequest.getPolicy()); + Assert.assertEquals(request.getSubscription(), actualRequest.getSubscription()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -527,47 +806,50 @@ public void setIamPolicyTest() { } @Test - @SuppressWarnings("all") - public void setIamPolicyExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); - mockIAMPolicy.addException(exception); + public void detachSubscriptionExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockPublisher.addException(exception); try { - ResourceName resource = ProjectName.of("[PROJECT]"); - Policy policy = Policy.newBuilder().build(); - SetIamPolicyRequest request = - SetIamPolicyRequest.newBuilder() - .setResource(resource.toString()) - .setPolicy(policy) + DetachSubscriptionRequest request = + DetachSubscriptionRequest.newBuilder() + .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString()) .build(); - - client.setIamPolicy(request); + client.detachSubscription(request); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void getIamPolicyTest() { - int version = 351608024; - ByteString etag = ByteString.copyFromUtf8("21"); - Policy expectedResponse = Policy.newBuilder().setVersion(version).setEtag(etag).build(); + public void setIamPolicyTest() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setVersion(351608024) + .addAllBindings(new ArrayList()) + .addAllAuditConfigs(new ArrayList()) + .setEtag(ByteString.EMPTY) + .build(); mockIAMPolicy.addResponse(expectedResponse); - ResourceName resource = ProjectName.of("[PROJECT]"); - GetIamPolicyRequest request = - GetIamPolicyRequest.newBuilder().setResource(resource.toString()).build(); + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); - Policy actualResponse = client.getIamPolicy(request); + Policy actualResponse = client.setIamPolicy(request); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockIAMPolicy.getRequests(); Assert.assertEquals(1, actualRequests.size()); - GetIamPolicyRequest actualRequest = (GetIamPolicyRequest) actualRequests.get(0); + SetIamPolicyRequest actualRequest = ((SetIamPolicyRequest) actualRequests.get(0)); - Assert.assertEquals(Objects.toString(resource), Objects.toString(actualRequest.getResource())); + Assert.assertEquals(request.getResource(), actualRequest.getResource()); + Assert.assertEquals(request.getPolicy(), actualRequest.getPolicy()); + Assert.assertEquals(request.getUpdateMask(), actualRequest.getUpdateMask()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -575,46 +857,50 @@ public void getIamPolicyTest() { } @Test - @SuppressWarnings("all") - public void getIamPolicyExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void setIamPolicyExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIAMPolicy.addException(exception); try { - ResourceName resource = ProjectName.of("[PROJECT]"); - GetIamPolicyRequest request = - GetIamPolicyRequest.newBuilder().setResource(resource.toString()).build(); - - client.getIamPolicy(request); + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + client.setIamPolicy(request); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void testIamPermissionsTest() { - TestIamPermissionsResponse expectedResponse = TestIamPermissionsResponse.newBuilder().build(); + public void getIamPolicyTest() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setVersion(351608024) + .addAllBindings(new ArrayList()) + .addAllAuditConfigs(new ArrayList()) + .setEtag(ByteString.EMPTY) + .build(); mockIAMPolicy.addResponse(expectedResponse); - ResourceName resource = ProjectName.of("[PROJECT]"); - List permissions = new ArrayList<>(); - TestIamPermissionsRequest request = - TestIamPermissionsRequest.newBuilder() - .setResource(resource.toString()) - .addAllPermissions(permissions) + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) .build(); - TestIamPermissionsResponse actualResponse = client.testIamPermissions(request); + Policy actualResponse = client.getIamPolicy(request); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockIAMPolicy.getRequests(); Assert.assertEquals(1, actualRequests.size()); - TestIamPermissionsRequest actualRequest = (TestIamPermissionsRequest) actualRequests.get(0); + GetIamPolicyRequest actualRequest = ((GetIamPolicyRequest) actualRequests.get(0)); - Assert.assertEquals(Objects.toString(resource), Objects.toString(actualRequest.getResource())); - Assert.assertEquals(permissions, actualRequest.getPermissionsList()); + Assert.assertEquals(request.getResource(), actualRequest.getResource()); + Assert.assertEquals(request.getOptions(), actualRequest.getOptions()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -622,47 +908,44 @@ public void testIamPermissionsTest() { } @Test - @SuppressWarnings("all") - public void testIamPermissionsExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void getIamPolicyExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIAMPolicy.addException(exception); try { - ResourceName resource = ProjectName.of("[PROJECT]"); - List permissions = new ArrayList<>(); - TestIamPermissionsRequest request = - TestIamPermissionsRequest.newBuilder() - .setResource(resource.toString()) - .addAllPermissions(permissions) + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) .build(); - - client.testIamPermissions(request); + client.getIamPolicy(request); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void detachSubscriptionTest() { - DetachSubscriptionResponse expectedResponse = DetachSubscriptionResponse.newBuilder().build(); - mockPublisher.addResponse(expectedResponse); + public void testIamPermissionsTest() throws Exception { + TestIamPermissionsResponse expectedResponse = + TestIamPermissionsResponse.newBuilder().addAllPermissions(new ArrayList()).build(); + mockIAMPolicy.addResponse(expectedResponse); - ProjectSubscriptionName subscription = - ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); - DetachSubscriptionRequest request = - DetachSubscriptionRequest.newBuilder().setSubscription(subscription.toString()).build(); + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) + .addAllPermissions(new ArrayList()) + .build(); - DetachSubscriptionResponse actualResponse = client.detachSubscription(request); + TestIamPermissionsResponse actualResponse = client.testIamPermissions(request); Assert.assertEquals(expectedResponse, actualResponse); - List actualRequests = mockPublisher.getRequests(); + List actualRequests = mockIAMPolicy.getRequests(); Assert.assertEquals(1, actualRequests.size()); - DetachSubscriptionRequest actualRequest = (DetachSubscriptionRequest) actualRequests.get(0); + TestIamPermissionsRequest actualRequest = ((TestIamPermissionsRequest) actualRequests.get(0)); - Assert.assertEquals( - subscription, ProjectSubscriptionName.parse(actualRequest.getSubscription())); + Assert.assertEquals(request.getResource(), actualRequest.getResource()); + Assert.assertEquals(request.getPermissionsList(), actualRequest.getPermissionsList()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -670,21 +953,20 @@ public void detachSubscriptionTest() { } @Test - @SuppressWarnings("all") - public void detachSubscriptionExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); - mockPublisher.addException(exception); + public void testIamPermissionsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockIAMPolicy.addException(exception); try { - ProjectSubscriptionName subscription = - ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); - DetachSubscriptionRequest request = - DetachSubscriptionRequest.newBuilder().setSubscription(subscription.toString()).build(); - - client.detachSubscription(request); + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) + .addAllPermissions(new ArrayList()) + .build(); + client.testIamPermissions(request); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } } 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..aaa396690 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,69 @@ public void run() { assertEquals(0, waiter.pendingCount()); } + + @Test + public void testTryWait_Completes() throws Exception { + final Waiter waiter = new Waiter(); + waiter.incrementPendingCount(1); + final FakeClock clock = new FakeClock(); + + final Thread mainThread = Thread.currentThread(); + Thread t = + new Thread( + new Runnable() { + @Override + public void run() { + while (mainThread.getState() == Thread.State.NEW) { + Thread.yield(); + } + waiter.incrementPendingCount(-1); + } + }); + t.start(); + + assertTrue(waiter.tryWait(500, clock)); + t.join(); + + assertEquals(0, waiter.pendingCount()); + } + + @Test + public void testTryWait_TimesOut() throws Exception { + final Waiter waiter = new Waiter(); + waiter.incrementPendingCount(1); + final FakeClock clock = new FakeClock(); + + final Thread mainThread = Thread.currentThread(); + Thread t = + new Thread( + new Runnable() { + @Override + public void run() { + while (mainThread.getState() == Thread.State.NEW) { + Thread.yield(); + } + try { + // Waits some additional time to ensure that the waiter is actually waiting. + Thread.sleep(100); + clock.advance(200, TimeUnit.MILLISECONDS); + } catch (InterruptedException e) { + // Ignored. + } + } + }); + t.start(); + + assertFalse(waiter.tryWait(100, clock)); + t.join(); + + assertEquals(1, waiter.pendingCount()); + } + + @Test + public void testTryWait_NoPending() { + final Waiter waiter = new Waiter(); + final FakeClock clock = new FakeClock(); + assertTrue(waiter.tryWait(100, clock)); + } } diff --git a/google-cloud-pubsub/src/test/resources/META-INF/native-image/com.google.cloud/google-cloud-pubsub/native-image.properties b/google-cloud-pubsub/src/test/resources/META-INF/native-image/com.google.cloud/google-cloud-pubsub/native-image.properties new file mode 100644 index 000000000..b77dd433a --- /dev/null +++ b/google-cloud-pubsub/src/test/resources/META-INF/native-image/com.google.cloud/google-cloud-pubsub/native-image.properties @@ -0,0 +1 @@ +Args=--initialize-at-build-time=org.junit.runners.model.FrameworkField \ No newline at end of file diff --git a/grpc-google-cloud-pubsub-v1/clirr-ignored-differences.xml b/grpc-google-cloud-pubsub-v1/clirr-ignored-differences.xml deleted file mode 100644 index bf6eda2ee..000000000 --- a/grpc-google-cloud-pubsub-v1/clirr-ignored-differences.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - 6001 - com/google/pubsub/v1/*Grpc - METHOD_* - - \ No newline at end of file diff --git a/grpc-google-cloud-pubsub-v1/pom.xml b/grpc-google-cloud-pubsub-v1/pom.xml index 0d7d46f19..d84a02a07 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.93.5-SNAPSHOT + 1.132.3-SNAPSHOT grpc-google-cloud-pubsub-v1 GRPC library for grpc-google-cloud-pubsub-v1 com.google.cloud google-cloud-pubsub-parent - 1.111.5-SNAPSHOT + 1.150.3-SNAPSHOT diff --git a/grpc-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PublisherGrpc.java b/grpc-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PublisherGrpc.java index 9e0404ebc..16c28e9cc 100644 --- a/grpc-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PublisherGrpc.java +++ b/grpc-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PublisherGrpc.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,11 +16,6 @@ package com.google.pubsub.v1; import static io.grpc.MethodDescriptor.generateFullMethodName; -import static io.grpc.stub.ClientCalls.asyncUnaryCall; -import static io.grpc.stub.ClientCalls.blockingUnaryCall; -import static io.grpc.stub.ClientCalls.futureUnaryCall; -import static io.grpc.stub.ServerCalls.asyncUnaryCall; -import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall; /** * @@ -30,14 +25,12 @@ * messages to a topic. * */ -@javax.annotation.Generated( - value = "by gRPC proto compiler", - comments = "Source: google/pubsub/v1/pubsub.proto") +@io.grpc.stub.annotations.GrpcGenerated public final class PublisherGrpc { private PublisherGrpc() {} - public static final String SERVICE_NAME = "google.pubsub.v1.Publisher"; + public static final java.lang.String SERVICE_NAME = "google.pubsub.v1.Publisher"; // Static method descriptors that strictly reflect the proto. private static volatile io.grpc.MethodDescriptor< @@ -426,6 +419,19 @@ public PublisherStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOp return PublisherStub.newStub(factory, channel); } + /** Creates a new blocking-style stub that supports all types of calls on the service */ + public static PublisherBlockingV2Stub newBlockingV2Stub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public PublisherBlockingV2Stub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new PublisherBlockingV2Stub(channel, callOptions); + } + }; + return PublisherBlockingV2Stub.newStub(factory, channel); + } + /** * Creates a new blocking-style stub that supports unary and streaming output calls on the service */ @@ -462,34 +468,36 @@ public PublisherFutureStub newStub( * messages to a topic. * */ - public abstract static class PublisherImplBase implements io.grpc.BindableService { + public interface AsyncService { /** * * *
          * Creates the given topic with the given name. See the [resource name rules]
    -     * (https://cloud.google.com/pubsub/docs/admin#resource_names).
    +     * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names).
          * 
    */ - public void createTopic( + default void createTopic( com.google.pubsub.v1.Topic request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnimplementedUnaryCall(getCreateTopicMethod(), responseObserver); + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getCreateTopicMethod(), responseObserver); } /** * * *
    -     * Updates an existing topic. Note that certain properties of a
    -     * topic are not modifiable.
    +     * Updates an existing topic by updating the fields specified in the update
    +     * mask. Note that certain properties of a topic are not modifiable.
          * 
    */ - public void updateTopic( + default void updateTopic( com.google.pubsub.v1.UpdateTopicRequest request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnimplementedUnaryCall(getUpdateTopicMethod(), responseObserver); + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getUpdateTopicMethod(), responseObserver); } /** @@ -500,10 +508,10 @@ public void updateTopic( * does not exist. * */ - public void publish( + default void publish( com.google.pubsub.v1.PublishRequest request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnimplementedUnaryCall(getPublishMethod(), responseObserver); + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getPublishMethod(), responseObserver); } /** @@ -513,10 +521,10 @@ public void publish( * Gets the configuration of a topic. * */ - public void getTopic( + default void getTopic( com.google.pubsub.v1.GetTopicRequest request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnimplementedUnaryCall(getGetTopicMethod(), responseObserver); + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetTopicMethod(), responseObserver); } /** @@ -526,10 +534,10 @@ public void getTopic( * Lists matching topics. * */ - public void listTopics( + default void listTopics( com.google.pubsub.v1.ListTopicsRequest request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnimplementedUnaryCall(getListTopicsMethod(), responseObserver); + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getListTopicsMethod(), responseObserver); } /** @@ -539,11 +547,12 @@ public void listTopics( * Lists the names of the attached subscriptions on this topic. * */ - public void listTopicSubscriptions( + default void listTopicSubscriptions( com.google.pubsub.v1.ListTopicSubscriptionsRequest request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnimplementedUnaryCall(getListTopicSubscriptionsMethod(), responseObserver); + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getListTopicSubscriptionsMethod(), responseObserver); } /** @@ -557,11 +566,12 @@ public void listTopicSubscriptions( * state captured by a snapshot. * */ - public void listTopicSnapshots( + default void listTopicSnapshots( com.google.pubsub.v1.ListTopicSnapshotsRequest request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnimplementedUnaryCall(getListTopicSnapshotsMethod(), responseObserver); + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getListTopicSnapshotsMethod(), responseObserver); } /** @@ -575,10 +585,11 @@ public void listTopicSnapshots( * not deleted, but their `topic` field is set to `_deleted-topic_`. * */ - public void deleteTopic( + default void deleteTopic( com.google.pubsub.v1.DeleteTopicRequest request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnimplementedUnaryCall(getDeleteTopicMethod(), responseObserver); + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getDeleteTopicMethod(), responseObserver); } /** @@ -591,78 +602,33 @@ public void deleteTopic( * subscription, pushes to the endpoint will stop. * */ - public void detachSubscription( + default void detachSubscription( com.google.pubsub.v1.DetachSubscriptionRequest request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnimplementedUnaryCall(getDetachSubscriptionMethod(), responseObserver); + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getDetachSubscriptionMethod(), responseObserver); } + } + + /** + * Base class for the server implementation of the service Publisher. + * + *
    +   * The service that an application uses to manipulate topics, and to send
    +   * messages to a topic.
    +   * 
    + */ + public abstract static class PublisherImplBase implements io.grpc.BindableService, AsyncService { @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() { - return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) - .addMethod( - getCreateTopicMethod(), - asyncUnaryCall( - new MethodHandlers( - this, METHODID_CREATE_TOPIC))) - .addMethod( - getUpdateTopicMethod(), - asyncUnaryCall( - new MethodHandlers< - com.google.pubsub.v1.UpdateTopicRequest, com.google.pubsub.v1.Topic>( - this, METHODID_UPDATE_TOPIC))) - .addMethod( - getPublishMethod(), - asyncUnaryCall( - new MethodHandlers< - com.google.pubsub.v1.PublishRequest, com.google.pubsub.v1.PublishResponse>( - this, METHODID_PUBLISH))) - .addMethod( - getGetTopicMethod(), - asyncUnaryCall( - new MethodHandlers< - com.google.pubsub.v1.GetTopicRequest, com.google.pubsub.v1.Topic>( - this, METHODID_GET_TOPIC))) - .addMethod( - getListTopicsMethod(), - asyncUnaryCall( - new MethodHandlers< - com.google.pubsub.v1.ListTopicsRequest, - com.google.pubsub.v1.ListTopicsResponse>(this, METHODID_LIST_TOPICS))) - .addMethod( - getListTopicSubscriptionsMethod(), - asyncUnaryCall( - new MethodHandlers< - com.google.pubsub.v1.ListTopicSubscriptionsRequest, - com.google.pubsub.v1.ListTopicSubscriptionsResponse>( - this, METHODID_LIST_TOPIC_SUBSCRIPTIONS))) - .addMethod( - getListTopicSnapshotsMethod(), - asyncUnaryCall( - new MethodHandlers< - com.google.pubsub.v1.ListTopicSnapshotsRequest, - com.google.pubsub.v1.ListTopicSnapshotsResponse>( - this, METHODID_LIST_TOPIC_SNAPSHOTS))) - .addMethod( - getDeleteTopicMethod(), - asyncUnaryCall( - new MethodHandlers< - com.google.pubsub.v1.DeleteTopicRequest, com.google.protobuf.Empty>( - this, METHODID_DELETE_TOPIC))) - .addMethod( - getDetachSubscriptionMethod(), - asyncUnaryCall( - new MethodHandlers< - com.google.pubsub.v1.DetachSubscriptionRequest, - com.google.pubsub.v1.DetachSubscriptionResponse>( - this, METHODID_DETACH_SUBSCRIPTION))) - .build(); + return PublisherGrpc.bindService(this); } } /** - * + * A stub to allow clients to do asynchronous rpc calls to service Publisher. * *
        * The service that an application uses to manipulate topics, and to send
    @@ -684,13 +650,13 @@ protected PublisherStub build(io.grpc.Channel channel, io.grpc.CallOptions callO
          *
          * 
          * Creates the given topic with the given name. See the [resource name rules]
    -     * (https://cloud.google.com/pubsub/docs/admin#resource_names).
    +     * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names).
          * 
    */ public void createTopic( com.google.pubsub.v1.Topic request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnaryCall( + io.grpc.stub.ClientCalls.asyncUnaryCall( getChannel().newCall(getCreateTopicMethod(), getCallOptions()), request, responseObserver); @@ -700,14 +666,14 @@ public void createTopic( * * *
    -     * Updates an existing topic. Note that certain properties of a
    -     * topic are not modifiable.
    +     * Updates an existing topic by updating the fields specified in the update
    +     * mask. Note that certain properties of a topic are not modifiable.
          * 
    */ public void updateTopic( com.google.pubsub.v1.UpdateTopicRequest request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnaryCall( + io.grpc.stub.ClientCalls.asyncUnaryCall( getChannel().newCall(getUpdateTopicMethod(), getCallOptions()), request, responseObserver); @@ -724,7 +690,7 @@ public void updateTopic( public void publish( com.google.pubsub.v1.PublishRequest request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnaryCall( + io.grpc.stub.ClientCalls.asyncUnaryCall( getChannel().newCall(getPublishMethod(), getCallOptions()), request, responseObserver); } @@ -738,7 +704,7 @@ public void publish( public void getTopic( com.google.pubsub.v1.GetTopicRequest request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnaryCall( + io.grpc.stub.ClientCalls.asyncUnaryCall( getChannel().newCall(getGetTopicMethod(), getCallOptions()), request, responseObserver); } @@ -752,7 +718,7 @@ public void getTopic( public void listTopics( com.google.pubsub.v1.ListTopicsRequest request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnaryCall( + io.grpc.stub.ClientCalls.asyncUnaryCall( getChannel().newCall(getListTopicsMethod(), getCallOptions()), request, responseObserver); } @@ -767,7 +733,7 @@ public void listTopicSubscriptions( com.google.pubsub.v1.ListTopicSubscriptionsRequest request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnaryCall( + io.grpc.stub.ClientCalls.asyncUnaryCall( getChannel().newCall(getListTopicSubscriptionsMethod(), getCallOptions()), request, responseObserver); @@ -788,7 +754,7 @@ public void listTopicSnapshots( com.google.pubsub.v1.ListTopicSnapshotsRequest request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnaryCall( + io.grpc.stub.ClientCalls.asyncUnaryCall( getChannel().newCall(getListTopicSnapshotsMethod(), getCallOptions()), request, responseObserver); @@ -808,7 +774,7 @@ public void listTopicSnapshots( public void deleteTopic( com.google.pubsub.v1.DeleteTopicRequest request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnaryCall( + io.grpc.stub.ClientCalls.asyncUnaryCall( getChannel().newCall(getDeleteTopicMethod(), getCallOptions()), request, responseObserver); @@ -828,7 +794,7 @@ public void detachSubscription( com.google.pubsub.v1.DetachSubscriptionRequest request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnaryCall( + io.grpc.stub.ClientCalls.asyncUnaryCall( getChannel().newCall(getDetachSubscriptionMethod(), getCallOptions()), request, responseObserver); @@ -836,7 +802,159 @@ public void detachSubscription( } /** + * A stub to allow clients to do synchronous rpc calls to service Publisher. * + *
    +   * The service that an application uses to manipulate topics, and to send
    +   * messages to a topic.
    +   * 
    + */ + public static final class PublisherBlockingV2Stub + extends io.grpc.stub.AbstractBlockingStub { + private PublisherBlockingV2Stub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected PublisherBlockingV2Stub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new PublisherBlockingV2Stub(channel, callOptions); + } + + /** + * + * + *
    +     * Creates the given topic with the given name. See the [resource name rules]
    +     * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names).
    +     * 
    + */ + public com.google.pubsub.v1.Topic createTopic(com.google.pubsub.v1.Topic request) + throws io.grpc.StatusException { + return io.grpc.stub.ClientCalls.blockingV2UnaryCall( + getChannel(), getCreateTopicMethod(), getCallOptions(), request); + } + + /** + * + * + *
    +     * Updates an existing topic by updating the fields specified in the update
    +     * mask. Note that certain properties of a topic are not modifiable.
    +     * 
    + */ + public com.google.pubsub.v1.Topic updateTopic(com.google.pubsub.v1.UpdateTopicRequest request) + throws io.grpc.StatusException { + return io.grpc.stub.ClientCalls.blockingV2UnaryCall( + getChannel(), getUpdateTopicMethod(), getCallOptions(), request); + } + + /** + * + * + *
    +     * Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic
    +     * does not exist.
    +     * 
    + */ + public com.google.pubsub.v1.PublishResponse publish(com.google.pubsub.v1.PublishRequest request) + throws io.grpc.StatusException { + return io.grpc.stub.ClientCalls.blockingV2UnaryCall( + getChannel(), getPublishMethod(), getCallOptions(), request); + } + + /** + * + * + *
    +     * Gets the configuration of a topic.
    +     * 
    + */ + public com.google.pubsub.v1.Topic getTopic(com.google.pubsub.v1.GetTopicRequest request) + throws io.grpc.StatusException { + return io.grpc.stub.ClientCalls.blockingV2UnaryCall( + getChannel(), getGetTopicMethod(), getCallOptions(), request); + } + + /** + * + * + *
    +     * Lists matching topics.
    +     * 
    + */ + public com.google.pubsub.v1.ListTopicsResponse listTopics( + com.google.pubsub.v1.ListTopicsRequest request) throws io.grpc.StatusException { + return io.grpc.stub.ClientCalls.blockingV2UnaryCall( + getChannel(), getListTopicsMethod(), getCallOptions(), request); + } + + /** + * + * + *
    +     * Lists the names of the attached subscriptions on this topic.
    +     * 
    + */ + public com.google.pubsub.v1.ListTopicSubscriptionsResponse listTopicSubscriptions( + com.google.pubsub.v1.ListTopicSubscriptionsRequest request) throws io.grpc.StatusException { + return io.grpc.stub.ClientCalls.blockingV2UnaryCall( + getChannel(), getListTopicSubscriptionsMethod(), getCallOptions(), request); + } + + /** + * + * + *
    +     * Lists the names of the snapshots on this topic. Snapshots are used in
    +     * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations,
    +     * which allow you to manage message acknowledgments in bulk. That is, you can
    +     * set the acknowledgment state of messages in an existing subscription to the
    +     * state captured by a snapshot.
    +     * 
    + */ + public com.google.pubsub.v1.ListTopicSnapshotsResponse listTopicSnapshots( + com.google.pubsub.v1.ListTopicSnapshotsRequest request) throws io.grpc.StatusException { + return io.grpc.stub.ClientCalls.blockingV2UnaryCall( + getChannel(), getListTopicSnapshotsMethod(), getCallOptions(), request); + } + + /** + * + * + *
    +     * Deletes the topic with the given name. Returns `NOT_FOUND` if the topic
    +     * does not exist. After a topic is deleted, a new topic may be created with
    +     * the same name; this is an entirely new topic with none of the old
    +     * configuration or subscriptions. Existing subscriptions to this topic are
    +     * not deleted, but their `topic` field is set to `_deleted-topic_`.
    +     * 
    + */ + public com.google.protobuf.Empty deleteTopic(com.google.pubsub.v1.DeleteTopicRequest request) + throws io.grpc.StatusException { + return io.grpc.stub.ClientCalls.blockingV2UnaryCall( + getChannel(), getDeleteTopicMethod(), getCallOptions(), request); + } + + /** + * + * + *
    +     * Detaches a subscription from this topic. All messages retained in the
    +     * subscription are dropped. Subsequent `Pull` and `StreamingPull` requests
    +     * will return FAILED_PRECONDITION. If the subscription is a push
    +     * subscription, pushes to the endpoint will stop.
    +     * 
    + */ + public com.google.pubsub.v1.DetachSubscriptionResponse detachSubscription( + com.google.pubsub.v1.DetachSubscriptionRequest request) throws io.grpc.StatusException { + return io.grpc.stub.ClientCalls.blockingV2UnaryCall( + getChannel(), getDetachSubscriptionMethod(), getCallOptions(), request); + } + } + + /** + * A stub to allow clients to do limited synchronous rpc calls to service Publisher. * *
        * The service that an application uses to manipulate topics, and to send
    @@ -860,23 +978,25 @@ protected PublisherBlockingStub build(
          *
          * 
          * Creates the given topic with the given name. See the [resource name rules]
    -     * (https://cloud.google.com/pubsub/docs/admin#resource_names).
    +     * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names).
          * 
    */ public com.google.pubsub.v1.Topic createTopic(com.google.pubsub.v1.Topic request) { - return blockingUnaryCall(getChannel(), getCreateTopicMethod(), getCallOptions(), request); + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getCreateTopicMethod(), getCallOptions(), request); } /** * * *
    -     * Updates an existing topic. Note that certain properties of a
    -     * topic are not modifiable.
    +     * Updates an existing topic by updating the fields specified in the update
    +     * mask. Note that certain properties of a topic are not modifiable.
          * 
    */ public com.google.pubsub.v1.Topic updateTopic(com.google.pubsub.v1.UpdateTopicRequest request) { - return blockingUnaryCall(getChannel(), getUpdateTopicMethod(), getCallOptions(), request); + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getUpdateTopicMethod(), getCallOptions(), request); } /** @@ -889,7 +1009,8 @@ public com.google.pubsub.v1.Topic updateTopic(com.google.pubsub.v1.UpdateTopicRe */ public com.google.pubsub.v1.PublishResponse publish( com.google.pubsub.v1.PublishRequest request) { - return blockingUnaryCall(getChannel(), getPublishMethod(), getCallOptions(), request); + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getPublishMethod(), getCallOptions(), request); } /** @@ -900,7 +1021,8 @@ public com.google.pubsub.v1.PublishResponse publish( *
    */ public com.google.pubsub.v1.Topic getTopic(com.google.pubsub.v1.GetTopicRequest request) { - return blockingUnaryCall(getChannel(), getGetTopicMethod(), getCallOptions(), request); + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetTopicMethod(), getCallOptions(), request); } /** @@ -912,7 +1034,8 @@ public com.google.pubsub.v1.Topic getTopic(com.google.pubsub.v1.GetTopicRequest */ public com.google.pubsub.v1.ListTopicsResponse listTopics( com.google.pubsub.v1.ListTopicsRequest request) { - return blockingUnaryCall(getChannel(), getListTopicsMethod(), getCallOptions(), request); + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getListTopicsMethod(), getCallOptions(), request); } /** @@ -924,7 +1047,7 @@ public com.google.pubsub.v1.ListTopicsResponse listTopics( */ public com.google.pubsub.v1.ListTopicSubscriptionsResponse listTopicSubscriptions( com.google.pubsub.v1.ListTopicSubscriptionsRequest request) { - return blockingUnaryCall( + return io.grpc.stub.ClientCalls.blockingUnaryCall( getChannel(), getListTopicSubscriptionsMethod(), getCallOptions(), request); } @@ -941,7 +1064,7 @@ public com.google.pubsub.v1.ListTopicSubscriptionsResponse listTopicSubscription */ public com.google.pubsub.v1.ListTopicSnapshotsResponse listTopicSnapshots( com.google.pubsub.v1.ListTopicSnapshotsRequest request) { - return blockingUnaryCall( + return io.grpc.stub.ClientCalls.blockingUnaryCall( getChannel(), getListTopicSnapshotsMethod(), getCallOptions(), request); } @@ -957,7 +1080,8 @@ public com.google.pubsub.v1.ListTopicSnapshotsResponse listTopicSnapshots( *
    */ public com.google.protobuf.Empty deleteTopic(com.google.pubsub.v1.DeleteTopicRequest request) { - return blockingUnaryCall(getChannel(), getDeleteTopicMethod(), getCallOptions(), request); + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getDeleteTopicMethod(), getCallOptions(), request); } /** @@ -972,13 +1096,13 @@ public com.google.protobuf.Empty deleteTopic(com.google.pubsub.v1.DeleteTopicReq */ public com.google.pubsub.v1.DetachSubscriptionResponse detachSubscription( com.google.pubsub.v1.DetachSubscriptionRequest request) { - return blockingUnaryCall( + return io.grpc.stub.ClientCalls.blockingUnaryCall( getChannel(), getDetachSubscriptionMethod(), getCallOptions(), request); } } /** - * + * A stub to allow clients to do ListenableFuture-style rpc calls to service Publisher. * *
        * The service that an application uses to manipulate topics, and to send
    @@ -1001,12 +1125,12 @@ protected PublisherFutureStub build(io.grpc.Channel channel, io.grpc.CallOptions
          *
          * 
          * Creates the given topic with the given name. See the [resource name rules]
    -     * (https://cloud.google.com/pubsub/docs/admin#resource_names).
    +     * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names).
          * 
    */ public com.google.common.util.concurrent.ListenableFuture createTopic(com.google.pubsub.v1.Topic request) { - return futureUnaryCall( + return io.grpc.stub.ClientCalls.futureUnaryCall( getChannel().newCall(getCreateTopicMethod(), getCallOptions()), request); } @@ -1014,13 +1138,13 @@ protected PublisherFutureStub build(io.grpc.Channel channel, io.grpc.CallOptions * * *
    -     * Updates an existing topic. Note that certain properties of a
    -     * topic are not modifiable.
    +     * Updates an existing topic by updating the fields specified in the update
    +     * mask. Note that certain properties of a topic are not modifiable.
          * 
    */ public com.google.common.util.concurrent.ListenableFuture updateTopic(com.google.pubsub.v1.UpdateTopicRequest request) { - return futureUnaryCall( + return io.grpc.stub.ClientCalls.futureUnaryCall( getChannel().newCall(getUpdateTopicMethod(), getCallOptions()), request); } @@ -1034,7 +1158,8 @@ protected PublisherFutureStub build(io.grpc.Channel channel, io.grpc.CallOptions */ public com.google.common.util.concurrent.ListenableFuture publish(com.google.pubsub.v1.PublishRequest request) { - return futureUnaryCall(getChannel().newCall(getPublishMethod(), getCallOptions()), request); + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getPublishMethod(), getCallOptions()), request); } /** @@ -1046,7 +1171,8 @@ protected PublisherFutureStub build(io.grpc.Channel channel, io.grpc.CallOptions */ public com.google.common.util.concurrent.ListenableFuture getTopic( com.google.pubsub.v1.GetTopicRequest request) { - return futureUnaryCall(getChannel().newCall(getGetTopicMethod(), getCallOptions()), request); + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getGetTopicMethod(), getCallOptions()), request); } /** @@ -1059,7 +1185,7 @@ public com.google.common.util.concurrent.ListenableFuture listTopics(com.google.pubsub.v1.ListTopicsRequest request) { - return futureUnaryCall( + return io.grpc.stub.ClientCalls.futureUnaryCall( getChannel().newCall(getListTopicsMethod(), getCallOptions()), request); } @@ -1073,7 +1199,7 @@ public com.google.common.util.concurrent.ListenableFuture listTopicSubscriptions(com.google.pubsub.v1.ListTopicSubscriptionsRequest request) { - return futureUnaryCall( + return io.grpc.stub.ClientCalls.futureUnaryCall( getChannel().newCall(getListTopicSubscriptionsMethod(), getCallOptions()), request); } @@ -1091,7 +1217,7 @@ public com.google.common.util.concurrent.ListenableFuture listTopicSnapshots(com.google.pubsub.v1.ListTopicSnapshotsRequest request) { - return futureUnaryCall( + return io.grpc.stub.ClientCalls.futureUnaryCall( getChannel().newCall(getListTopicSnapshotsMethod(), getCallOptions()), request); } @@ -1108,7 +1234,7 @@ public com.google.common.util.concurrent.ListenableFuture deleteTopic(com.google.pubsub.v1.DeleteTopicRequest request) { - return futureUnaryCall( + return io.grpc.stub.ClientCalls.futureUnaryCall( getChannel().newCall(getDeleteTopicMethod(), getCallOptions()), request); } @@ -1125,7 +1251,7 @@ public com.google.common.util.concurrent.ListenableFuture detachSubscription(com.google.pubsub.v1.DetachSubscriptionRequest request) { - return futureUnaryCall( + return io.grpc.stub.ClientCalls.futureUnaryCall( getChannel().newCall(getDetachSubscriptionMethod(), getCallOptions()), request); } } @@ -1145,10 +1271,10 @@ private static final class MethodHandlers io.grpc.stub.ServerCalls.ServerStreamingMethod, io.grpc.stub.ServerCalls.ClientStreamingMethod, io.grpc.stub.ServerCalls.BidiStreamingMethod { - private final PublisherImplBase serviceImpl; + private final AsyncService serviceImpl; private final int methodId; - MethodHandlers(PublisherImplBase serviceImpl, int methodId) { + MethodHandlers(AsyncService serviceImpl, int methodId) { this.serviceImpl = serviceImpl; this.methodId = methodId; } @@ -1222,6 +1348,67 @@ public io.grpc.stub.StreamObserver invoke( } } + public static final io.grpc.ServerServiceDefinition bindService(AsyncService service) { + return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) + .addMethod( + getCreateTopicMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers( + service, METHODID_CREATE_TOPIC))) + .addMethod( + getUpdateTopicMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.pubsub.v1.UpdateTopicRequest, com.google.pubsub.v1.Topic>( + service, METHODID_UPDATE_TOPIC))) + .addMethod( + getPublishMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.pubsub.v1.PublishRequest, com.google.pubsub.v1.PublishResponse>( + service, METHODID_PUBLISH))) + .addMethod( + getGetTopicMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.pubsub.v1.GetTopicRequest, com.google.pubsub.v1.Topic>( + service, METHODID_GET_TOPIC))) + .addMethod( + getListTopicsMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.pubsub.v1.ListTopicsRequest, + com.google.pubsub.v1.ListTopicsResponse>(service, METHODID_LIST_TOPICS))) + .addMethod( + getListTopicSubscriptionsMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.pubsub.v1.ListTopicSubscriptionsRequest, + com.google.pubsub.v1.ListTopicSubscriptionsResponse>( + service, METHODID_LIST_TOPIC_SUBSCRIPTIONS))) + .addMethod( + getListTopicSnapshotsMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.pubsub.v1.ListTopicSnapshotsRequest, + com.google.pubsub.v1.ListTopicSnapshotsResponse>( + service, METHODID_LIST_TOPIC_SNAPSHOTS))) + .addMethod( + getDeleteTopicMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.pubsub.v1.DeleteTopicRequest, com.google.protobuf.Empty>( + service, METHODID_DELETE_TOPIC))) + .addMethod( + getDetachSubscriptionMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.pubsub.v1.DetachSubscriptionRequest, + com.google.pubsub.v1.DetachSubscriptionResponse>( + service, METHODID_DETACH_SUBSCRIPTION))) + .build(); + } + private abstract static class PublisherBaseDescriptorSupplier implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier { @@ -1246,9 +1433,9 @@ private static final class PublisherFileDescriptorSupplier private static final class PublisherMethodDescriptorSupplier extends PublisherBaseDescriptorSupplier implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { - private final String methodName; + private final java.lang.String methodName; - PublisherMethodDescriptorSupplier(String methodName) { + PublisherMethodDescriptorSupplier(java.lang.String methodName) { this.methodName = methodName; } diff --git a/grpc-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SchemaServiceGrpc.java b/grpc-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SchemaServiceGrpc.java index d68736ce2..d08c72904 100644 --- a/grpc-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SchemaServiceGrpc.java +++ b/grpc-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SchemaServiceGrpc.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,21 +16,20 @@ package com.google.pubsub.v1; import static io.grpc.MethodDescriptor.generateFullMethodName; -import static io.grpc.stub.ClientCalls.asyncUnaryCall; -import static io.grpc.stub.ClientCalls.blockingUnaryCall; -import static io.grpc.stub.ClientCalls.futureUnaryCall; -import static io.grpc.stub.ServerCalls.asyncUnaryCall; -import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall; - -/** */ -@javax.annotation.Generated( - value = "by gRPC proto compiler", - comments = "Source: google/pubsub/v1/schema.proto") + +/** + * + * + *
    + * Service for doing schema-related operations.
    + * 
    + */ +@io.grpc.stub.annotations.GrpcGenerated public final class SchemaServiceGrpc { private SchemaServiceGrpc() {} - public static final String SERVICE_NAME = "google.pubsub.v1.SchemaService"; + public static final java.lang.String SERVICE_NAME = "google.pubsub.v1.SchemaService"; // Static method descriptors that strictly reflect the proto. private static volatile io.grpc.MethodDescriptor< @@ -153,6 +152,180 @@ private SchemaServiceGrpc() {} return getListSchemasMethod; } + private static volatile io.grpc.MethodDescriptor< + com.google.pubsub.v1.ListSchemaRevisionsRequest, + com.google.pubsub.v1.ListSchemaRevisionsResponse> + getListSchemaRevisionsMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "ListSchemaRevisions", + requestType = com.google.pubsub.v1.ListSchemaRevisionsRequest.class, + responseType = com.google.pubsub.v1.ListSchemaRevisionsResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.pubsub.v1.ListSchemaRevisionsRequest, + com.google.pubsub.v1.ListSchemaRevisionsResponse> + getListSchemaRevisionsMethod() { + io.grpc.MethodDescriptor< + com.google.pubsub.v1.ListSchemaRevisionsRequest, + com.google.pubsub.v1.ListSchemaRevisionsResponse> + getListSchemaRevisionsMethod; + if ((getListSchemaRevisionsMethod = SchemaServiceGrpc.getListSchemaRevisionsMethod) == null) { + synchronized (SchemaServiceGrpc.class) { + if ((getListSchemaRevisionsMethod = SchemaServiceGrpc.getListSchemaRevisionsMethod) + == null) { + SchemaServiceGrpc.getListSchemaRevisionsMethod = + getListSchemaRevisionsMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName(SERVICE_NAME, "ListSchemaRevisions")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.pubsub.v1.ListSchemaRevisionsRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.pubsub.v1.ListSchemaRevisionsResponse + .getDefaultInstance())) + .setSchemaDescriptor( + new SchemaServiceMethodDescriptorSupplier("ListSchemaRevisions")) + .build(); + } + } + } + return getListSchemaRevisionsMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.pubsub.v1.CommitSchemaRequest, com.google.pubsub.v1.Schema> + getCommitSchemaMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "CommitSchema", + requestType = com.google.pubsub.v1.CommitSchemaRequest.class, + responseType = com.google.pubsub.v1.Schema.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.pubsub.v1.CommitSchemaRequest, com.google.pubsub.v1.Schema> + getCommitSchemaMethod() { + io.grpc.MethodDescriptor + getCommitSchemaMethod; + if ((getCommitSchemaMethod = SchemaServiceGrpc.getCommitSchemaMethod) == null) { + synchronized (SchemaServiceGrpc.class) { + if ((getCommitSchemaMethod = SchemaServiceGrpc.getCommitSchemaMethod) == null) { + SchemaServiceGrpc.getCommitSchemaMethod = + getCommitSchemaMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "CommitSchema")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.pubsub.v1.CommitSchemaRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.pubsub.v1.Schema.getDefaultInstance())) + .setSchemaDescriptor( + new SchemaServiceMethodDescriptorSupplier("CommitSchema")) + .build(); + } + } + } + return getCommitSchemaMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.pubsub.v1.RollbackSchemaRequest, com.google.pubsub.v1.Schema> + getRollbackSchemaMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "RollbackSchema", + requestType = com.google.pubsub.v1.RollbackSchemaRequest.class, + responseType = com.google.pubsub.v1.Schema.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.pubsub.v1.RollbackSchemaRequest, com.google.pubsub.v1.Schema> + getRollbackSchemaMethod() { + io.grpc.MethodDescriptor< + com.google.pubsub.v1.RollbackSchemaRequest, com.google.pubsub.v1.Schema> + getRollbackSchemaMethod; + if ((getRollbackSchemaMethod = SchemaServiceGrpc.getRollbackSchemaMethod) == null) { + synchronized (SchemaServiceGrpc.class) { + if ((getRollbackSchemaMethod = SchemaServiceGrpc.getRollbackSchemaMethod) == null) { + SchemaServiceGrpc.getRollbackSchemaMethod = + getRollbackSchemaMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "RollbackSchema")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.pubsub.v1.RollbackSchemaRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.pubsub.v1.Schema.getDefaultInstance())) + .setSchemaDescriptor( + new SchemaServiceMethodDescriptorSupplier("RollbackSchema")) + .build(); + } + } + } + return getRollbackSchemaMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.pubsub.v1.DeleteSchemaRevisionRequest, com.google.pubsub.v1.Schema> + getDeleteSchemaRevisionMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "DeleteSchemaRevision", + requestType = com.google.pubsub.v1.DeleteSchemaRevisionRequest.class, + responseType = com.google.pubsub.v1.Schema.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.pubsub.v1.DeleteSchemaRevisionRequest, com.google.pubsub.v1.Schema> + getDeleteSchemaRevisionMethod() { + io.grpc.MethodDescriptor< + com.google.pubsub.v1.DeleteSchemaRevisionRequest, com.google.pubsub.v1.Schema> + getDeleteSchemaRevisionMethod; + if ((getDeleteSchemaRevisionMethod = SchemaServiceGrpc.getDeleteSchemaRevisionMethod) == null) { + synchronized (SchemaServiceGrpc.class) { + if ((getDeleteSchemaRevisionMethod = SchemaServiceGrpc.getDeleteSchemaRevisionMethod) + == null) { + SchemaServiceGrpc.getDeleteSchemaRevisionMethod = + getDeleteSchemaRevisionMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName(SERVICE_NAME, "DeleteSchemaRevision")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.pubsub.v1.DeleteSchemaRevisionRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.pubsub.v1.Schema.getDefaultInstance())) + .setSchemaDescriptor( + new SchemaServiceMethodDescriptorSupplier("DeleteSchemaRevision")) + .build(); + } + } + } + return getDeleteSchemaRevisionMethod; + } + private static volatile io.grpc.MethodDescriptor< com.google.pubsub.v1.DeleteSchemaRequest, com.google.protobuf.Empty> getDeleteSchemaMethod; @@ -291,6 +464,19 @@ public SchemaServiceStub newStub( return SchemaServiceStub.newStub(factory, channel); } + /** Creates a new blocking-style stub that supports all types of calls on the service */ + public static SchemaServiceBlockingV2Stub newBlockingV2Stub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public SchemaServiceBlockingV2Stub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new SchemaServiceBlockingV2Stub(channel, callOptions); + } + }; + return SchemaServiceBlockingV2Stub.newStub(factory, channel); + } + /** * Creates a new blocking-style stub that supports unary and streaming output calls on the service */ @@ -319,8 +505,14 @@ public SchemaServiceFutureStub newStub( return SchemaServiceFutureStub.newStub(factory, channel); } - /** */ - public abstract static class SchemaServiceImplBase implements io.grpc.BindableService { + /** + * + * + *
    +   * Service for doing schema-related operations.
    +   * 
    + */ + public interface AsyncService { /** * @@ -329,10 +521,11 @@ public abstract static class SchemaServiceImplBase implements io.grpc.BindableSe * Creates a schema. *
    */ - public void createSchema( + default void createSchema( com.google.pubsub.v1.CreateSchemaRequest request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnimplementedUnaryCall(getCreateSchemaMethod(), responseObserver); + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getCreateSchemaMethod(), responseObserver); } /** @@ -342,10 +535,10 @@ public void createSchema( * Gets a schema. * */ - public void getSchema( + default void getSchema( com.google.pubsub.v1.GetSchemaRequest request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnimplementedUnaryCall(getGetSchemaMethod(), responseObserver); + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetSchemaMethod(), responseObserver); } /** @@ -355,10 +548,68 @@ public void getSchema( * Lists schemas in a project. * */ - public void listSchemas( + default void listSchemas( com.google.pubsub.v1.ListSchemasRequest request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnimplementedUnaryCall(getListSchemasMethod(), responseObserver); + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getListSchemasMethod(), responseObserver); + } + + /** + * + * + *
    +     * Lists all schema revisions for the named schema.
    +     * 
    + */ + default void listSchemaRevisions( + com.google.pubsub.v1.ListSchemaRevisionsRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getListSchemaRevisionsMethod(), responseObserver); + } + + /** + * + * + *
    +     * Commits a new schema revision to an existing schema.
    +     * 
    + */ + default void commitSchema( + com.google.pubsub.v1.CommitSchemaRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getCommitSchemaMethod(), responseObserver); + } + + /** + * + * + *
    +     * Creates a new schema revision that is a copy of the provided revision_id.
    +     * 
    + */ + default void rollbackSchema( + com.google.pubsub.v1.RollbackSchemaRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getRollbackSchemaMethod(), responseObserver); + } + + /** + * + * + *
    +     * Deletes a specific schema revision.
    +     * 
    + */ + default void deleteSchemaRevision( + com.google.pubsub.v1.DeleteSchemaRevisionRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getDeleteSchemaRevisionMethod(), responseObserver); } /** @@ -368,10 +619,11 @@ public void listSchemas( * Deletes a schema. * */ - public void deleteSchema( + default void deleteSchema( com.google.pubsub.v1.DeleteSchemaRequest request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnimplementedUnaryCall(getDeleteSchemaMethod(), responseObserver); + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getDeleteSchemaMethod(), responseObserver); } /** @@ -381,10 +633,11 @@ public void deleteSchema( * Validates a schema. * */ - public void validateSchema( + default void validateSchema( com.google.pubsub.v1.ValidateSchemaRequest request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnimplementedUnaryCall(getValidateSchemaMethod(), responseObserver); + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getValidateSchemaMethod(), responseObserver); } /** @@ -394,58 +647,38 @@ public void validateSchema( * Validates a message against a schema. * */ - public void validateMessage( + default void validateMessage( com.google.pubsub.v1.ValidateMessageRequest request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnimplementedUnaryCall(getValidateMessageMethod(), responseObserver); + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getValidateMessageMethod(), responseObserver); } + } + + /** + * Base class for the server implementation of the service SchemaService. + * + *
    +   * Service for doing schema-related operations.
    +   * 
    + */ + public abstract static class SchemaServiceImplBase + implements io.grpc.BindableService, AsyncService { @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() { - return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) - .addMethod( - getCreateSchemaMethod(), - asyncUnaryCall( - new MethodHandlers< - com.google.pubsub.v1.CreateSchemaRequest, com.google.pubsub.v1.Schema>( - this, METHODID_CREATE_SCHEMA))) - .addMethod( - getGetSchemaMethod(), - asyncUnaryCall( - new MethodHandlers< - com.google.pubsub.v1.GetSchemaRequest, com.google.pubsub.v1.Schema>( - this, METHODID_GET_SCHEMA))) - .addMethod( - getListSchemasMethod(), - asyncUnaryCall( - new MethodHandlers< - com.google.pubsub.v1.ListSchemasRequest, - com.google.pubsub.v1.ListSchemasResponse>(this, METHODID_LIST_SCHEMAS))) - .addMethod( - getDeleteSchemaMethod(), - asyncUnaryCall( - new MethodHandlers< - com.google.pubsub.v1.DeleteSchemaRequest, com.google.protobuf.Empty>( - this, METHODID_DELETE_SCHEMA))) - .addMethod( - getValidateSchemaMethod(), - asyncUnaryCall( - new MethodHandlers< - com.google.pubsub.v1.ValidateSchemaRequest, - com.google.pubsub.v1.ValidateSchemaResponse>(this, METHODID_VALIDATE_SCHEMA))) - .addMethod( - getValidateMessageMethod(), - asyncUnaryCall( - new MethodHandlers< - com.google.pubsub.v1.ValidateMessageRequest, - com.google.pubsub.v1.ValidateMessageResponse>( - this, METHODID_VALIDATE_MESSAGE))) - .build(); + return SchemaServiceGrpc.bindService(this); } } - /** */ + /** + * A stub to allow clients to do asynchronous rpc calls to service SchemaService. + * + *
    +   * Service for doing schema-related operations.
    +   * 
    + */ public static final class SchemaServiceStub extends io.grpc.stub.AbstractAsyncStub { private SchemaServiceStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { @@ -467,7 +700,7 @@ protected SchemaServiceStub build(io.grpc.Channel channel, io.grpc.CallOptions c public void createSchema( com.google.pubsub.v1.CreateSchemaRequest request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnaryCall( + io.grpc.stub.ClientCalls.asyncUnaryCall( getChannel().newCall(getCreateSchemaMethod(), getCallOptions()), request, responseObserver); @@ -483,7 +716,7 @@ public void createSchema( public void getSchema( com.google.pubsub.v1.GetSchemaRequest request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnaryCall( + io.grpc.stub.ClientCalls.asyncUnaryCall( getChannel().newCall(getGetSchemaMethod(), getCallOptions()), request, responseObserver); } @@ -497,12 +730,77 @@ public void getSchema( public void listSchemas( com.google.pubsub.v1.ListSchemasRequest request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnaryCall( + io.grpc.stub.ClientCalls.asyncUnaryCall( getChannel().newCall(getListSchemasMethod(), getCallOptions()), request, responseObserver); } + /** + * + * + *
    +     * Lists all schema revisions for the named schema.
    +     * 
    + */ + public void listSchemaRevisions( + com.google.pubsub.v1.ListSchemaRevisionsRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getListSchemaRevisionsMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
    +     * Commits a new schema revision to an existing schema.
    +     * 
    + */ + public void commitSchema( + com.google.pubsub.v1.CommitSchemaRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getCommitSchemaMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
    +     * Creates a new schema revision that is a copy of the provided revision_id.
    +     * 
    + */ + public void rollbackSchema( + com.google.pubsub.v1.RollbackSchemaRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getRollbackSchemaMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
    +     * Deletes a specific schema revision.
    +     * 
    + */ + public void deleteSchemaRevision( + com.google.pubsub.v1.DeleteSchemaRevisionRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getDeleteSchemaRevisionMethod(), getCallOptions()), + request, + responseObserver); + } + /** * * @@ -513,7 +811,7 @@ public void listSchemas( public void deleteSchema( com.google.pubsub.v1.DeleteSchemaRequest request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnaryCall( + io.grpc.stub.ClientCalls.asyncUnaryCall( getChannel().newCall(getDeleteSchemaMethod(), getCallOptions()), request, responseObserver); @@ -529,7 +827,7 @@ public void deleteSchema( public void validateSchema( com.google.pubsub.v1.ValidateSchemaRequest request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnaryCall( + io.grpc.stub.ClientCalls.asyncUnaryCall( getChannel().newCall(getValidateSchemaMethod(), getCallOptions()), request, responseObserver); @@ -546,14 +844,170 @@ public void validateMessage( com.google.pubsub.v1.ValidateMessageRequest request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnaryCall( + io.grpc.stub.ClientCalls.asyncUnaryCall( getChannel().newCall(getValidateMessageMethod(), getCallOptions()), request, responseObserver); } } - /** */ + /** + * A stub to allow clients to do synchronous rpc calls to service SchemaService. + * + *
    +   * Service for doing schema-related operations.
    +   * 
    + */ + public static final class SchemaServiceBlockingV2Stub + extends io.grpc.stub.AbstractBlockingStub { + private SchemaServiceBlockingV2Stub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected SchemaServiceBlockingV2Stub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new SchemaServiceBlockingV2Stub(channel, callOptions); + } + + /** + * + * + *
    +     * Creates a schema.
    +     * 
    + */ + public com.google.pubsub.v1.Schema createSchema( + com.google.pubsub.v1.CreateSchemaRequest request) throws io.grpc.StatusException { + return io.grpc.stub.ClientCalls.blockingV2UnaryCall( + getChannel(), getCreateSchemaMethod(), getCallOptions(), request); + } + + /** + * + * + *
    +     * Gets a schema.
    +     * 
    + */ + public com.google.pubsub.v1.Schema getSchema(com.google.pubsub.v1.GetSchemaRequest request) + throws io.grpc.StatusException { + return io.grpc.stub.ClientCalls.blockingV2UnaryCall( + getChannel(), getGetSchemaMethod(), getCallOptions(), request); + } + + /** + * + * + *
    +     * Lists schemas in a project.
    +     * 
    + */ + public com.google.pubsub.v1.ListSchemasResponse listSchemas( + com.google.pubsub.v1.ListSchemasRequest request) throws io.grpc.StatusException { + return io.grpc.stub.ClientCalls.blockingV2UnaryCall( + getChannel(), getListSchemasMethod(), getCallOptions(), request); + } + + /** + * + * + *
    +     * Lists all schema revisions for the named schema.
    +     * 
    + */ + public com.google.pubsub.v1.ListSchemaRevisionsResponse listSchemaRevisions( + com.google.pubsub.v1.ListSchemaRevisionsRequest request) throws io.grpc.StatusException { + return io.grpc.stub.ClientCalls.blockingV2UnaryCall( + getChannel(), getListSchemaRevisionsMethod(), getCallOptions(), request); + } + + /** + * + * + *
    +     * Commits a new schema revision to an existing schema.
    +     * 
    + */ + public com.google.pubsub.v1.Schema commitSchema( + com.google.pubsub.v1.CommitSchemaRequest request) throws io.grpc.StatusException { + return io.grpc.stub.ClientCalls.blockingV2UnaryCall( + getChannel(), getCommitSchemaMethod(), getCallOptions(), request); + } + + /** + * + * + *
    +     * Creates a new schema revision that is a copy of the provided revision_id.
    +     * 
    + */ + public com.google.pubsub.v1.Schema rollbackSchema( + com.google.pubsub.v1.RollbackSchemaRequest request) throws io.grpc.StatusException { + return io.grpc.stub.ClientCalls.blockingV2UnaryCall( + getChannel(), getRollbackSchemaMethod(), getCallOptions(), request); + } + + /** + * + * + *
    +     * Deletes a specific schema revision.
    +     * 
    + */ + public com.google.pubsub.v1.Schema deleteSchemaRevision( + com.google.pubsub.v1.DeleteSchemaRevisionRequest request) throws io.grpc.StatusException { + return io.grpc.stub.ClientCalls.blockingV2UnaryCall( + getChannel(), getDeleteSchemaRevisionMethod(), getCallOptions(), request); + } + + /** + * + * + *
    +     * Deletes a schema.
    +     * 
    + */ + public com.google.protobuf.Empty deleteSchema(com.google.pubsub.v1.DeleteSchemaRequest request) + throws io.grpc.StatusException { + return io.grpc.stub.ClientCalls.blockingV2UnaryCall( + getChannel(), getDeleteSchemaMethod(), getCallOptions(), request); + } + + /** + * + * + *
    +     * Validates a schema.
    +     * 
    + */ + public com.google.pubsub.v1.ValidateSchemaResponse validateSchema( + com.google.pubsub.v1.ValidateSchemaRequest request) throws io.grpc.StatusException { + return io.grpc.stub.ClientCalls.blockingV2UnaryCall( + getChannel(), getValidateSchemaMethod(), getCallOptions(), request); + } + + /** + * + * + *
    +     * Validates a message against a schema.
    +     * 
    + */ + public com.google.pubsub.v1.ValidateMessageResponse validateMessage( + com.google.pubsub.v1.ValidateMessageRequest request) throws io.grpc.StatusException { + return io.grpc.stub.ClientCalls.blockingV2UnaryCall( + getChannel(), getValidateMessageMethod(), getCallOptions(), request); + } + } + + /** + * A stub to allow clients to do limited synchronous rpc calls to service SchemaService. + * + *
    +   * Service for doing schema-related operations.
    +   * 
    + */ public static final class SchemaServiceBlockingStub extends io.grpc.stub.AbstractBlockingStub { private SchemaServiceBlockingStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { @@ -575,7 +1029,8 @@ protected SchemaServiceBlockingStub build( */ public com.google.pubsub.v1.Schema createSchema( com.google.pubsub.v1.CreateSchemaRequest request) { - return blockingUnaryCall(getChannel(), getCreateSchemaMethod(), getCallOptions(), request); + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getCreateSchemaMethod(), getCallOptions(), request); } /** @@ -586,7 +1041,8 @@ public com.google.pubsub.v1.Schema createSchema( * */ public com.google.pubsub.v1.Schema getSchema(com.google.pubsub.v1.GetSchemaRequest request) { - return blockingUnaryCall(getChannel(), getGetSchemaMethod(), getCallOptions(), request); + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetSchemaMethod(), getCallOptions(), request); } /** @@ -598,7 +1054,60 @@ public com.google.pubsub.v1.Schema getSchema(com.google.pubsub.v1.GetSchemaReque */ public com.google.pubsub.v1.ListSchemasResponse listSchemas( com.google.pubsub.v1.ListSchemasRequest request) { - return blockingUnaryCall(getChannel(), getListSchemasMethod(), getCallOptions(), request); + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getListSchemasMethod(), getCallOptions(), request); + } + + /** + * + * + *
    +     * Lists all schema revisions for the named schema.
    +     * 
    + */ + public com.google.pubsub.v1.ListSchemaRevisionsResponse listSchemaRevisions( + com.google.pubsub.v1.ListSchemaRevisionsRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getListSchemaRevisionsMethod(), getCallOptions(), request); + } + + /** + * + * + *
    +     * Commits a new schema revision to an existing schema.
    +     * 
    + */ + public com.google.pubsub.v1.Schema commitSchema( + com.google.pubsub.v1.CommitSchemaRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getCommitSchemaMethod(), getCallOptions(), request); + } + + /** + * + * + *
    +     * Creates a new schema revision that is a copy of the provided revision_id.
    +     * 
    + */ + public com.google.pubsub.v1.Schema rollbackSchema( + com.google.pubsub.v1.RollbackSchemaRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getRollbackSchemaMethod(), getCallOptions(), request); + } + + /** + * + * + *
    +     * Deletes a specific schema revision.
    +     * 
    + */ + public com.google.pubsub.v1.Schema deleteSchemaRevision( + com.google.pubsub.v1.DeleteSchemaRevisionRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getDeleteSchemaRevisionMethod(), getCallOptions(), request); } /** @@ -610,7 +1119,8 @@ public com.google.pubsub.v1.ListSchemasResponse listSchemas( */ public com.google.protobuf.Empty deleteSchema( com.google.pubsub.v1.DeleteSchemaRequest request) { - return blockingUnaryCall(getChannel(), getDeleteSchemaMethod(), getCallOptions(), request); + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getDeleteSchemaMethod(), getCallOptions(), request); } /** @@ -622,7 +1132,8 @@ public com.google.protobuf.Empty deleteSchema( */ public com.google.pubsub.v1.ValidateSchemaResponse validateSchema( com.google.pubsub.v1.ValidateSchemaRequest request) { - return blockingUnaryCall(getChannel(), getValidateSchemaMethod(), getCallOptions(), request); + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getValidateSchemaMethod(), getCallOptions(), request); } /** @@ -634,11 +1145,18 @@ public com.google.pubsub.v1.ValidateSchemaResponse validateSchema( */ public com.google.pubsub.v1.ValidateMessageResponse validateMessage( com.google.pubsub.v1.ValidateMessageRequest request) { - return blockingUnaryCall(getChannel(), getValidateMessageMethod(), getCallOptions(), request); + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getValidateMessageMethod(), getCallOptions(), request); } } - /** */ + /** + * A stub to allow clients to do ListenableFuture-style rpc calls to service SchemaService. + * + *
    +   * Service for doing schema-related operations.
    +   * 
    + */ public static final class SchemaServiceFutureStub extends io.grpc.stub.AbstractFutureStub { private SchemaServiceFutureStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { @@ -660,7 +1178,7 @@ protected SchemaServiceFutureStub build( */ public com.google.common.util.concurrent.ListenableFuture createSchema(com.google.pubsub.v1.CreateSchemaRequest request) { - return futureUnaryCall( + return io.grpc.stub.ClientCalls.futureUnaryCall( getChannel().newCall(getCreateSchemaMethod(), getCallOptions()), request); } @@ -673,7 +1191,8 @@ protected SchemaServiceFutureStub build( */ public com.google.common.util.concurrent.ListenableFuture getSchema(com.google.pubsub.v1.GetSchemaRequest request) { - return futureUnaryCall(getChannel().newCall(getGetSchemaMethod(), getCallOptions()), request); + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getGetSchemaMethod(), getCallOptions()), request); } /** @@ -686,10 +1205,63 @@ protected SchemaServiceFutureStub build( public com.google.common.util.concurrent.ListenableFuture< com.google.pubsub.v1.ListSchemasResponse> listSchemas(com.google.pubsub.v1.ListSchemasRequest request) { - return futureUnaryCall( + return io.grpc.stub.ClientCalls.futureUnaryCall( getChannel().newCall(getListSchemasMethod(), getCallOptions()), request); } + /** + * + * + *
    +     * Lists all schema revisions for the named schema.
    +     * 
    + */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.pubsub.v1.ListSchemaRevisionsResponse> + listSchemaRevisions(com.google.pubsub.v1.ListSchemaRevisionsRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getListSchemaRevisionsMethod(), getCallOptions()), request); + } + + /** + * + * + *
    +     * Commits a new schema revision to an existing schema.
    +     * 
    + */ + public com.google.common.util.concurrent.ListenableFuture + commitSchema(com.google.pubsub.v1.CommitSchemaRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getCommitSchemaMethod(), getCallOptions()), request); + } + + /** + * + * + *
    +     * Creates a new schema revision that is a copy of the provided revision_id.
    +     * 
    + */ + public com.google.common.util.concurrent.ListenableFuture + rollbackSchema(com.google.pubsub.v1.RollbackSchemaRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getRollbackSchemaMethod(), getCallOptions()), request); + } + + /** + * + * + *
    +     * Deletes a specific schema revision.
    +     * 
    + */ + public com.google.common.util.concurrent.ListenableFuture + deleteSchemaRevision(com.google.pubsub.v1.DeleteSchemaRevisionRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getDeleteSchemaRevisionMethod(), getCallOptions()), request); + } + /** * * @@ -699,7 +1271,7 @@ protected SchemaServiceFutureStub build( */ public com.google.common.util.concurrent.ListenableFuture deleteSchema(com.google.pubsub.v1.DeleteSchemaRequest request) { - return futureUnaryCall( + return io.grpc.stub.ClientCalls.futureUnaryCall( getChannel().newCall(getDeleteSchemaMethod(), getCallOptions()), request); } @@ -713,7 +1285,7 @@ protected SchemaServiceFutureStub build( public com.google.common.util.concurrent.ListenableFuture< com.google.pubsub.v1.ValidateSchemaResponse> validateSchema(com.google.pubsub.v1.ValidateSchemaRequest request) { - return futureUnaryCall( + return io.grpc.stub.ClientCalls.futureUnaryCall( getChannel().newCall(getValidateSchemaMethod(), getCallOptions()), request); } @@ -727,7 +1299,7 @@ protected SchemaServiceFutureStub build( public com.google.common.util.concurrent.ListenableFuture< com.google.pubsub.v1.ValidateMessageResponse> validateMessage(com.google.pubsub.v1.ValidateMessageRequest request) { - return futureUnaryCall( + return io.grpc.stub.ClientCalls.futureUnaryCall( getChannel().newCall(getValidateMessageMethod(), getCallOptions()), request); } } @@ -735,19 +1307,23 @@ protected SchemaServiceFutureStub build( private static final int METHODID_CREATE_SCHEMA = 0; private static final int METHODID_GET_SCHEMA = 1; private static final int METHODID_LIST_SCHEMAS = 2; - private static final int METHODID_DELETE_SCHEMA = 3; - private static final int METHODID_VALIDATE_SCHEMA = 4; - private static final int METHODID_VALIDATE_MESSAGE = 5; + private static final int METHODID_LIST_SCHEMA_REVISIONS = 3; + private static final int METHODID_COMMIT_SCHEMA = 4; + private static final int METHODID_ROLLBACK_SCHEMA = 5; + private static final int METHODID_DELETE_SCHEMA_REVISION = 6; + private static final int METHODID_DELETE_SCHEMA = 7; + private static final int METHODID_VALIDATE_SCHEMA = 8; + private static final int METHODID_VALIDATE_MESSAGE = 9; private static final class MethodHandlers implements io.grpc.stub.ServerCalls.UnaryMethod, io.grpc.stub.ServerCalls.ServerStreamingMethod, io.grpc.stub.ServerCalls.ClientStreamingMethod, io.grpc.stub.ServerCalls.BidiStreamingMethod { - private final SchemaServiceImplBase serviceImpl; + private final AsyncService serviceImpl; private final int methodId; - MethodHandlers(SchemaServiceImplBase serviceImpl, int methodId) { + MethodHandlers(AsyncService serviceImpl, int methodId) { this.serviceImpl = serviceImpl; this.methodId = methodId; } @@ -772,6 +1348,27 @@ public void invoke(Req request, io.grpc.stub.StreamObserver responseObserv (io.grpc.stub.StreamObserver) responseObserver); break; + case METHODID_LIST_SCHEMA_REVISIONS: + serviceImpl.listSchemaRevisions( + (com.google.pubsub.v1.ListSchemaRevisionsRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_COMMIT_SCHEMA: + serviceImpl.commitSchema( + (com.google.pubsub.v1.CommitSchemaRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_ROLLBACK_SCHEMA: + serviceImpl.rollbackSchema( + (com.google.pubsub.v1.RollbackSchemaRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_DELETE_SCHEMA_REVISION: + serviceImpl.deleteSchemaRevision( + (com.google.pubsub.v1.DeleteSchemaRevisionRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; case METHODID_DELETE_SCHEMA: serviceImpl.deleteSchema( (com.google.pubsub.v1.DeleteSchemaRequest) request, @@ -805,6 +1402,74 @@ public io.grpc.stub.StreamObserver invoke( } } + public static final io.grpc.ServerServiceDefinition bindService(AsyncService service) { + return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) + .addMethod( + getCreateSchemaMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.pubsub.v1.CreateSchemaRequest, com.google.pubsub.v1.Schema>( + service, METHODID_CREATE_SCHEMA))) + .addMethod( + getGetSchemaMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.pubsub.v1.GetSchemaRequest, com.google.pubsub.v1.Schema>( + service, METHODID_GET_SCHEMA))) + .addMethod( + getListSchemasMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.pubsub.v1.ListSchemasRequest, + com.google.pubsub.v1.ListSchemasResponse>(service, METHODID_LIST_SCHEMAS))) + .addMethod( + getListSchemaRevisionsMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.pubsub.v1.ListSchemaRevisionsRequest, + com.google.pubsub.v1.ListSchemaRevisionsResponse>( + service, METHODID_LIST_SCHEMA_REVISIONS))) + .addMethod( + getCommitSchemaMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.pubsub.v1.CommitSchemaRequest, com.google.pubsub.v1.Schema>( + service, METHODID_COMMIT_SCHEMA))) + .addMethod( + getRollbackSchemaMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.pubsub.v1.RollbackSchemaRequest, com.google.pubsub.v1.Schema>( + service, METHODID_ROLLBACK_SCHEMA))) + .addMethod( + getDeleteSchemaRevisionMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.pubsub.v1.DeleteSchemaRevisionRequest, com.google.pubsub.v1.Schema>( + service, METHODID_DELETE_SCHEMA_REVISION))) + .addMethod( + getDeleteSchemaMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.pubsub.v1.DeleteSchemaRequest, com.google.protobuf.Empty>( + service, METHODID_DELETE_SCHEMA))) + .addMethod( + getValidateSchemaMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.pubsub.v1.ValidateSchemaRequest, + com.google.pubsub.v1.ValidateSchemaResponse>( + service, METHODID_VALIDATE_SCHEMA))) + .addMethod( + getValidateMessageMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.pubsub.v1.ValidateMessageRequest, + com.google.pubsub.v1.ValidateMessageResponse>( + service, METHODID_VALIDATE_MESSAGE))) + .build(); + } + private abstract static class SchemaServiceBaseDescriptorSupplier implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier { @@ -829,9 +1494,9 @@ private static final class SchemaServiceFileDescriptorSupplier private static final class SchemaServiceMethodDescriptorSupplier extends SchemaServiceBaseDescriptorSupplier implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { - private final String methodName; + private final java.lang.String methodName; - SchemaServiceMethodDescriptorSupplier(String methodName) { + SchemaServiceMethodDescriptorSupplier(java.lang.String methodName) { this.methodName = methodName; } @@ -856,6 +1521,10 @@ public static io.grpc.ServiceDescriptor getServiceDescriptor() { .addMethod(getCreateSchemaMethod()) .addMethod(getGetSchemaMethod()) .addMethod(getListSchemasMethod()) + .addMethod(getListSchemaRevisionsMethod()) + .addMethod(getCommitSchemaMethod()) + .addMethod(getRollbackSchemaMethod()) + .addMethod(getDeleteSchemaRevisionMethod()) .addMethod(getDeleteSchemaMethod()) .addMethod(getValidateSchemaMethod()) .addMethod(getValidateMessageMethod()) diff --git a/grpc-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SubscriberGrpc.java b/grpc-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SubscriberGrpc.java index 411cc9243..8e3a8dc13 100644 --- a/grpc-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SubscriberGrpc.java +++ b/grpc-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SubscriberGrpc.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,14 +16,6 @@ package com.google.pubsub.v1; import static io.grpc.MethodDescriptor.generateFullMethodName; -import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall; -import static io.grpc.stub.ClientCalls.asyncUnaryCall; -import static io.grpc.stub.ClientCalls.blockingUnaryCall; -import static io.grpc.stub.ClientCalls.futureUnaryCall; -import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall; -import static io.grpc.stub.ServerCalls.asyncUnaryCall; -import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall; -import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall; /** * @@ -34,14 +26,12 @@ * establishing a bi-directional stream using the `StreamingPull` method. * */ -@javax.annotation.Generated( - value = "by gRPC proto compiler", - comments = "Source: google/pubsub/v1/pubsub.proto") +@io.grpc.stub.annotations.GrpcGenerated public final class SubscriberGrpc { private SubscriberGrpc() {} - public static final String SERVICE_NAME = "google.pubsub.v1.Subscriber"; + public static final java.lang.String SERVICE_NAME = "google.pubsub.v1.Subscriber"; // Static method descriptors that strictly reflect the proto. private static volatile io.grpc.MethodDescriptor< @@ -705,6 +695,19 @@ public SubscriberStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callO return SubscriberStub.newStub(factory, channel); } + /** Creates a new blocking-style stub that supports all types of calls on the service */ + public static SubscriberBlockingV2Stub newBlockingV2Stub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public SubscriberBlockingV2Stub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new SubscriberBlockingV2Stub(channel, callOptions); + } + }; + return SubscriberBlockingV2Stub.newStub(factory, channel); + } + /** * Creates a new blocking-style stub that supports unary and streaming output calls on the service */ @@ -742,28 +745,29 @@ public SubscriberFutureStub newStub( * establishing a bi-directional stream using the `StreamingPull` method. * */ - public abstract static class SubscriberImplBase implements io.grpc.BindableService { + public interface AsyncService { /** * * *
          * Creates a subscription to a given topic. See the [resource name rules]
    -     * (https://cloud.google.com/pubsub/docs/admin#resource_names).
    +     * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names).
          * If the subscription already exists, returns `ALREADY_EXISTS`.
          * If the corresponding topic doesn't exist, returns `NOT_FOUND`.
          * If the name is not provided in the request, the server will assign a random
          * name for this subscription on the same project as the topic, conforming
          * to the [resource name format]
    -     * (https://cloud.google.com/pubsub/docs/admin#resource_names). The generated
    -     * name is populated in the returned Subscription object. Note that for REST
    -     * API requests, you must specify a name in the request.
    +     * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). The
    +     * generated name is populated in the returned Subscription object. Note that
    +     * for REST API requests, you must specify a name in the request.
          * 
    */ - public void createSubscription( + default void createSubscription( com.google.pubsub.v1.Subscription request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnimplementedUnaryCall(getCreateSubscriptionMethod(), responseObserver); + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getCreateSubscriptionMethod(), responseObserver); } /** @@ -773,24 +777,27 @@ public void createSubscription( * Gets the configuration details of a subscription. * */ - public void getSubscription( + default void getSubscription( com.google.pubsub.v1.GetSubscriptionRequest request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnimplementedUnaryCall(getGetSubscriptionMethod(), responseObserver); + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getGetSubscriptionMethod(), responseObserver); } /** * * *
    -     * Updates an existing subscription. Note that certain properties of a
    -     * subscription, such as its topic, are not modifiable.
    +     * Updates an existing subscription by updating the fields specified in the
    +     * update mask. Note that certain properties of a subscription, such as its
    +     * topic, are not modifiable.
          * 
    */ - public void updateSubscription( + default void updateSubscription( com.google.pubsub.v1.UpdateSubscriptionRequest request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnimplementedUnaryCall(getUpdateSubscriptionMethod(), responseObserver); + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getUpdateSubscriptionMethod(), responseObserver); } /** @@ -800,11 +807,12 @@ public void updateSubscription( * Lists matching subscriptions. * */ - public void listSubscriptions( + default void listSubscriptions( com.google.pubsub.v1.ListSubscriptionsRequest request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnimplementedUnaryCall(getListSubscriptionsMethod(), responseObserver); + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getListSubscriptionsMethod(), responseObserver); } /** @@ -818,10 +826,11 @@ public void listSubscriptions( * subscription or its topic unless the same topic is specified. * */ - public void deleteSubscription( + default void deleteSubscription( com.google.pubsub.v1.DeleteSubscriptionRequest request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnimplementedUnaryCall(getDeleteSubscriptionMethod(), responseObserver); + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getDeleteSubscriptionMethod(), responseObserver); } /** @@ -835,10 +844,11 @@ public void deleteSubscription( * subscription-level `ackDeadlineSeconds` used for subsequent messages. * */ - public void modifyAckDeadline( + default void modifyAckDeadline( com.google.pubsub.v1.ModifyAckDeadlineRequest request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnimplementedUnaryCall(getModifyAckDeadlineMethod(), responseObserver); + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getModifyAckDeadlineMethod(), responseObserver); } /** @@ -853,25 +863,24 @@ public void modifyAckDeadline( * than once will not result in an error. * */ - public void acknowledge( + default void acknowledge( com.google.pubsub.v1.AcknowledgeRequest request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnimplementedUnaryCall(getAcknowledgeMethod(), responseObserver); + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getAcknowledgeMethod(), responseObserver); } /** * * *
    -     * Pulls messages from the server. The server may return `UNAVAILABLE` if
    -     * there are too many concurrent pull requests pending for the given
    -     * subscription.
    +     * Pulls messages from the server.
          * 
    */ - public void pull( + default void pull( com.google.pubsub.v1.PullRequest request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnimplementedUnaryCall(getPullMethod(), responseObserver); + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getPullMethod(), responseObserver); } /** @@ -879,7 +888,7 @@ public void pull( * *
          * Establishes a stream with the server, which sends messages down to the
    -     * client. The client streams acknowledgements and ack deadline modifications
    +     * client. The client streams acknowledgments and ack deadline modifications
          * back to the server. The server will close the stream and return the status
          * on any error. The server may close the stream with status `UNAVAILABLE` to
          * reassign server-side resources, in which case, the client should
    @@ -887,9 +896,10 @@ public void pull(
          * underlying RPC channel.
          * 
    */ - public io.grpc.stub.StreamObserver streamingPull( + default io.grpc.stub.StreamObserver streamingPull( io.grpc.stub.StreamObserver responseObserver) { - return asyncUnimplementedStreamingCall(getStreamingPullMethod(), responseObserver); + return io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall( + getStreamingPullMethod(), responseObserver); } /** @@ -903,10 +913,11 @@ public io.grpc.stub.StreamObserver st * continuously through the call regardless of changes to the `PushConfig`. * */ - public void modifyPushConfig( + default void modifyPushConfig( com.google.pubsub.v1.ModifyPushConfigRequest request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnimplementedUnaryCall(getModifyPushConfigMethod(), responseObserver); + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getModifyPushConfigMethod(), responseObserver); } /** @@ -914,16 +925,17 @@ public void modifyPushConfig( * *
          * Gets the configuration details of a snapshot. Snapshots are used in
    -     * <a href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a>
    -     * operations, which allow you to manage message acknowledgments in bulk. That
    -     * is, you can set the acknowledgment state of messages in an existing
    -     * subscription to the state captured by a snapshot.
    +     * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations,
    +     * which allow you to manage message acknowledgments in bulk. That is, you can
    +     * set the acknowledgment state of messages in an existing subscription to the
    +     * state captured by a snapshot.
          * 
    */ - public void getSnapshot( + default void getSnapshot( com.google.pubsub.v1.GetSnapshotRequest request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnimplementedUnaryCall(getGetSnapshotMethod(), responseObserver); + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getGetSnapshotMethod(), responseObserver); } /** @@ -937,10 +949,11 @@ public void getSnapshot( * state captured by a snapshot. * */ - public void listSnapshots( + default void listSnapshots( com.google.pubsub.v1.ListSnapshotsRequest request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnimplementedUnaryCall(getListSnapshotsMethod(), responseObserver); + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getListSnapshotsMethod(), responseObserver); } /** @@ -960,33 +973,35 @@ public void listSnapshots( * the request, the server will assign a random * name for this snapshot on the same project as the subscription, conforming * to the [resource name format] - * (https://cloud.google.com/pubsub/docs/admin#resource_names). The + * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). The * generated name is populated in the returned Snapshot object. Note that for * REST API requests, you must specify a name in the request. * */ - public void createSnapshot( + default void createSnapshot( com.google.pubsub.v1.CreateSnapshotRequest request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnimplementedUnaryCall(getCreateSnapshotMethod(), responseObserver); + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getCreateSnapshotMethod(), responseObserver); } /** * * *
    -     * Updates an existing snapshot. Snapshots are used in
    -     * <a href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a>
    -     * operations, which allow
    -     * you to manage message acknowledgments in bulk. That is, you can set the
    -     * acknowledgment state of messages in an existing subscription to the state
    -     * captured by a snapshot.
    +     * Updates an existing snapshot by updating the fields specified in the update
    +     * mask. Snapshots are used in
    +     * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations,
    +     * which allow you to manage message acknowledgments in bulk. That is, you can
    +     * set the acknowledgment state of messages in an existing subscription to the
    +     * state captured by a snapshot.
          * 
    */ - public void updateSnapshot( + default void updateSnapshot( com.google.pubsub.v1.UpdateSnapshotRequest request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnimplementedUnaryCall(getUpdateSnapshotMethod(), responseObserver); + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getUpdateSnapshotMethod(), responseObserver); } /** @@ -1004,10 +1019,11 @@ public void updateSnapshot( * snapshot or its subscription, unless the same subscription is specified. * */ - public void deleteSnapshot( + default void deleteSnapshot( com.google.pubsub.v1.DeleteSnapshotRequest request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnimplementedUnaryCall(getDeleteSnapshotMethod(), responseObserver); + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getDeleteSnapshotMethod(), responseObserver); } /** @@ -1023,118 +1039,32 @@ public void deleteSnapshot( * snapshot must be on the same topic. * */ - public void seek( + default void seek( com.google.pubsub.v1.SeekRequest request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnimplementedUnaryCall(getSeekMethod(), responseObserver); + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getSeekMethod(), responseObserver); } + } + + /** + * Base class for the server implementation of the service Subscriber. + * + *
    +   * The service that an application uses to manipulate subscriptions and to
    +   * consume messages from a subscription via the `Pull` method or by
    +   * establishing a bi-directional stream using the `StreamingPull` method.
    +   * 
    + */ + public abstract static class SubscriberImplBase implements io.grpc.BindableService, AsyncService { @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() { - return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) - .addMethod( - getCreateSubscriptionMethod(), - asyncUnaryCall( - new MethodHandlers< - com.google.pubsub.v1.Subscription, com.google.pubsub.v1.Subscription>( - this, METHODID_CREATE_SUBSCRIPTION))) - .addMethod( - getGetSubscriptionMethod(), - asyncUnaryCall( - new MethodHandlers< - com.google.pubsub.v1.GetSubscriptionRequest, - com.google.pubsub.v1.Subscription>(this, METHODID_GET_SUBSCRIPTION))) - .addMethod( - getUpdateSubscriptionMethod(), - asyncUnaryCall( - new MethodHandlers< - com.google.pubsub.v1.UpdateSubscriptionRequest, - com.google.pubsub.v1.Subscription>(this, METHODID_UPDATE_SUBSCRIPTION))) - .addMethod( - getListSubscriptionsMethod(), - asyncUnaryCall( - new MethodHandlers< - com.google.pubsub.v1.ListSubscriptionsRequest, - com.google.pubsub.v1.ListSubscriptionsResponse>( - this, METHODID_LIST_SUBSCRIPTIONS))) - .addMethod( - getDeleteSubscriptionMethod(), - asyncUnaryCall( - new MethodHandlers< - com.google.pubsub.v1.DeleteSubscriptionRequest, com.google.protobuf.Empty>( - this, METHODID_DELETE_SUBSCRIPTION))) - .addMethod( - getModifyAckDeadlineMethod(), - asyncUnaryCall( - new MethodHandlers< - com.google.pubsub.v1.ModifyAckDeadlineRequest, com.google.protobuf.Empty>( - this, METHODID_MODIFY_ACK_DEADLINE))) - .addMethod( - getAcknowledgeMethod(), - asyncUnaryCall( - new MethodHandlers< - com.google.pubsub.v1.AcknowledgeRequest, com.google.protobuf.Empty>( - this, METHODID_ACKNOWLEDGE))) - .addMethod( - getPullMethod(), - asyncUnaryCall( - new MethodHandlers< - com.google.pubsub.v1.PullRequest, com.google.pubsub.v1.PullResponse>( - this, METHODID_PULL))) - .addMethod( - getStreamingPullMethod(), - asyncBidiStreamingCall( - new MethodHandlers< - com.google.pubsub.v1.StreamingPullRequest, - com.google.pubsub.v1.StreamingPullResponse>(this, METHODID_STREAMING_PULL))) - .addMethod( - getModifyPushConfigMethod(), - asyncUnaryCall( - new MethodHandlers< - com.google.pubsub.v1.ModifyPushConfigRequest, com.google.protobuf.Empty>( - this, METHODID_MODIFY_PUSH_CONFIG))) - .addMethod( - getGetSnapshotMethod(), - asyncUnaryCall( - new MethodHandlers< - com.google.pubsub.v1.GetSnapshotRequest, com.google.pubsub.v1.Snapshot>( - this, METHODID_GET_SNAPSHOT))) - .addMethod( - getListSnapshotsMethod(), - asyncUnaryCall( - new MethodHandlers< - com.google.pubsub.v1.ListSnapshotsRequest, - com.google.pubsub.v1.ListSnapshotsResponse>(this, METHODID_LIST_SNAPSHOTS))) - .addMethod( - getCreateSnapshotMethod(), - asyncUnaryCall( - new MethodHandlers< - com.google.pubsub.v1.CreateSnapshotRequest, com.google.pubsub.v1.Snapshot>( - this, METHODID_CREATE_SNAPSHOT))) - .addMethod( - getUpdateSnapshotMethod(), - asyncUnaryCall( - new MethodHandlers< - com.google.pubsub.v1.UpdateSnapshotRequest, com.google.pubsub.v1.Snapshot>( - this, METHODID_UPDATE_SNAPSHOT))) - .addMethod( - getDeleteSnapshotMethod(), - asyncUnaryCall( - new MethodHandlers< - com.google.pubsub.v1.DeleteSnapshotRequest, com.google.protobuf.Empty>( - this, METHODID_DELETE_SNAPSHOT))) - .addMethod( - getSeekMethod(), - asyncUnaryCall( - new MethodHandlers< - com.google.pubsub.v1.SeekRequest, com.google.pubsub.v1.SeekResponse>( - this, METHODID_SEEK))) - .build(); + return SubscriberGrpc.bindService(this); } } /** - * + * A stub to allow clients to do asynchronous rpc calls to service Subscriber. * *
        * The service that an application uses to manipulate subscriptions and to
    @@ -1157,21 +1087,21 @@ protected SubscriberStub build(io.grpc.Channel channel, io.grpc.CallOptions call
          *
          * 
          * Creates a subscription to a given topic. See the [resource name rules]
    -     * (https://cloud.google.com/pubsub/docs/admin#resource_names).
    +     * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names).
          * If the subscription already exists, returns `ALREADY_EXISTS`.
          * If the corresponding topic doesn't exist, returns `NOT_FOUND`.
          * If the name is not provided in the request, the server will assign a random
          * name for this subscription on the same project as the topic, conforming
          * to the [resource name format]
    -     * (https://cloud.google.com/pubsub/docs/admin#resource_names). The generated
    -     * name is populated in the returned Subscription object. Note that for REST
    -     * API requests, you must specify a name in the request.
    +     * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). The
    +     * generated name is populated in the returned Subscription object. Note that
    +     * for REST API requests, you must specify a name in the request.
          * 
    */ public void createSubscription( com.google.pubsub.v1.Subscription request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnaryCall( + io.grpc.stub.ClientCalls.asyncUnaryCall( getChannel().newCall(getCreateSubscriptionMethod(), getCallOptions()), request, responseObserver); @@ -1187,7 +1117,7 @@ public void createSubscription( public void getSubscription( com.google.pubsub.v1.GetSubscriptionRequest request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnaryCall( + io.grpc.stub.ClientCalls.asyncUnaryCall( getChannel().newCall(getGetSubscriptionMethod(), getCallOptions()), request, responseObserver); @@ -1197,14 +1127,15 @@ public void getSubscription( * * *
    -     * Updates an existing subscription. Note that certain properties of a
    -     * subscription, such as its topic, are not modifiable.
    +     * Updates an existing subscription by updating the fields specified in the
    +     * update mask. Note that certain properties of a subscription, such as its
    +     * topic, are not modifiable.
          * 
    */ public void updateSubscription( com.google.pubsub.v1.UpdateSubscriptionRequest request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnaryCall( + io.grpc.stub.ClientCalls.asyncUnaryCall( getChannel().newCall(getUpdateSubscriptionMethod(), getCallOptions()), request, responseObserver); @@ -1221,7 +1152,7 @@ public void listSubscriptions( com.google.pubsub.v1.ListSubscriptionsRequest request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnaryCall( + io.grpc.stub.ClientCalls.asyncUnaryCall( getChannel().newCall(getListSubscriptionsMethod(), getCallOptions()), request, responseObserver); @@ -1241,7 +1172,7 @@ public void listSubscriptions( public void deleteSubscription( com.google.pubsub.v1.DeleteSubscriptionRequest request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnaryCall( + io.grpc.stub.ClientCalls.asyncUnaryCall( getChannel().newCall(getDeleteSubscriptionMethod(), getCallOptions()), request, responseObserver); @@ -1261,7 +1192,7 @@ public void deleteSubscription( public void modifyAckDeadline( com.google.pubsub.v1.ModifyAckDeadlineRequest request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnaryCall( + io.grpc.stub.ClientCalls.asyncUnaryCall( getChannel().newCall(getModifyAckDeadlineMethod(), getCallOptions()), request, responseObserver); @@ -1282,7 +1213,7 @@ public void modifyAckDeadline( public void acknowledge( com.google.pubsub.v1.AcknowledgeRequest request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnaryCall( + io.grpc.stub.ClientCalls.asyncUnaryCall( getChannel().newCall(getAcknowledgeMethod(), getCallOptions()), request, responseObserver); @@ -1292,15 +1223,13 @@ public void acknowledge( * * *
    -     * Pulls messages from the server. The server may return `UNAVAILABLE` if
    -     * there are too many concurrent pull requests pending for the given
    -     * subscription.
    +     * Pulls messages from the server.
          * 
    */ public void pull( com.google.pubsub.v1.PullRequest request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnaryCall( + io.grpc.stub.ClientCalls.asyncUnaryCall( getChannel().newCall(getPullMethod(), getCallOptions()), request, responseObserver); } @@ -1309,7 +1238,7 @@ public void pull( * *
          * Establishes a stream with the server, which sends messages down to the
    -     * client. The client streams acknowledgements and ack deadline modifications
    +     * client. The client streams acknowledgments and ack deadline modifications
          * back to the server. The server will close the stream and return the status
          * on any error. The server may close the stream with status `UNAVAILABLE` to
          * reassign server-side resources, in which case, the client should
    @@ -1319,7 +1248,7 @@ public void pull(
          */
         public io.grpc.stub.StreamObserver streamingPull(
             io.grpc.stub.StreamObserver responseObserver) {
    -      return asyncBidiStreamingCall(
    +      return io.grpc.stub.ClientCalls.asyncBidiStreamingCall(
               getChannel().newCall(getStreamingPullMethod(), getCallOptions()), responseObserver);
         }
     
    @@ -1337,7 +1266,7 @@ public io.grpc.stub.StreamObserver st
         public void modifyPushConfig(
             com.google.pubsub.v1.ModifyPushConfigRequest request,
             io.grpc.stub.StreamObserver responseObserver) {
    -      asyncUnaryCall(
    +      io.grpc.stub.ClientCalls.asyncUnaryCall(
               getChannel().newCall(getModifyPushConfigMethod(), getCallOptions()),
               request,
               responseObserver);
    @@ -1348,16 +1277,16 @@ public void modifyPushConfig(
          *
          * 
          * Gets the configuration details of a snapshot. Snapshots are used in
    -     * <a href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a>
    -     * operations, which allow you to manage message acknowledgments in bulk. That
    -     * is, you can set the acknowledgment state of messages in an existing
    -     * subscription to the state captured by a snapshot.
    +     * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations,
    +     * which allow you to manage message acknowledgments in bulk. That is, you can
    +     * set the acknowledgment state of messages in an existing subscription to the
    +     * state captured by a snapshot.
          * 
    */ public void getSnapshot( com.google.pubsub.v1.GetSnapshotRequest request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnaryCall( + io.grpc.stub.ClientCalls.asyncUnaryCall( getChannel().newCall(getGetSnapshotMethod(), getCallOptions()), request, responseObserver); @@ -1377,7 +1306,7 @@ public void getSnapshot( public void listSnapshots( com.google.pubsub.v1.ListSnapshotsRequest request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnaryCall( + io.grpc.stub.ClientCalls.asyncUnaryCall( getChannel().newCall(getListSnapshotsMethod(), getCallOptions()), request, responseObserver); @@ -1400,7 +1329,7 @@ public void listSnapshots( * the request, the server will assign a random * name for this snapshot on the same project as the subscription, conforming * to the [resource name format] - * (https://cloud.google.com/pubsub/docs/admin#resource_names). The + * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). The * generated name is populated in the returned Snapshot object. Note that for * REST API requests, you must specify a name in the request. *
    @@ -1408,7 +1337,7 @@ public void listSnapshots( public void createSnapshot( com.google.pubsub.v1.CreateSnapshotRequest request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnaryCall( + io.grpc.stub.ClientCalls.asyncUnaryCall( getChannel().newCall(getCreateSnapshotMethod(), getCallOptions()), request, responseObserver); @@ -1418,18 +1347,18 @@ public void createSnapshot( * * *
    -     * Updates an existing snapshot. Snapshots are used in
    -     * <a href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a>
    -     * operations, which allow
    -     * you to manage message acknowledgments in bulk. That is, you can set the
    -     * acknowledgment state of messages in an existing subscription to the state
    -     * captured by a snapshot.
    +     * Updates an existing snapshot by updating the fields specified in the update
    +     * mask. Snapshots are used in
    +     * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations,
    +     * which allow you to manage message acknowledgments in bulk. That is, you can
    +     * set the acknowledgment state of messages in an existing subscription to the
    +     * state captured by a snapshot.
          * 
    */ public void updateSnapshot( com.google.pubsub.v1.UpdateSnapshotRequest request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnaryCall( + io.grpc.stub.ClientCalls.asyncUnaryCall( getChannel().newCall(getUpdateSnapshotMethod(), getCallOptions()), request, responseObserver); @@ -1453,7 +1382,7 @@ public void updateSnapshot( public void deleteSnapshot( com.google.pubsub.v1.DeleteSnapshotRequest request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnaryCall( + io.grpc.stub.ClientCalls.asyncUnaryCall( getChannel().newCall(getDeleteSnapshotMethod(), getCallOptions()), request, responseObserver); @@ -1475,13 +1404,321 @@ public void deleteSnapshot( public void seek( com.google.pubsub.v1.SeekRequest request, io.grpc.stub.StreamObserver responseObserver) { - asyncUnaryCall( + io.grpc.stub.ClientCalls.asyncUnaryCall( getChannel().newCall(getSeekMethod(), getCallOptions()), request, responseObserver); } } /** + * A stub to allow clients to do synchronous rpc calls to service Subscriber. * + *
    +   * The service that an application uses to manipulate subscriptions and to
    +   * consume messages from a subscription via the `Pull` method or by
    +   * establishing a bi-directional stream using the `StreamingPull` method.
    +   * 
    + */ + public static final class SubscriberBlockingV2Stub + extends io.grpc.stub.AbstractBlockingStub { + private SubscriberBlockingV2Stub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected SubscriberBlockingV2Stub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new SubscriberBlockingV2Stub(channel, callOptions); + } + + /** + * + * + *
    +     * Creates a subscription to a given topic. See the [resource name rules]
    +     * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names).
    +     * If the subscription already exists, returns `ALREADY_EXISTS`.
    +     * If the corresponding topic doesn't exist, returns `NOT_FOUND`.
    +     * If the name is not provided in the request, the server will assign a random
    +     * name for this subscription on the same project as the topic, conforming
    +     * to the [resource name format]
    +     * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). The
    +     * generated name is populated in the returned Subscription object. Note that
    +     * for REST API requests, you must specify a name in the request.
    +     * 
    + */ + public com.google.pubsub.v1.Subscription createSubscription( + com.google.pubsub.v1.Subscription request) throws io.grpc.StatusException { + return io.grpc.stub.ClientCalls.blockingV2UnaryCall( + getChannel(), getCreateSubscriptionMethod(), getCallOptions(), request); + } + + /** + * + * + *
    +     * Gets the configuration details of a subscription.
    +     * 
    + */ + public com.google.pubsub.v1.Subscription getSubscription( + com.google.pubsub.v1.GetSubscriptionRequest request) throws io.grpc.StatusException { + return io.grpc.stub.ClientCalls.blockingV2UnaryCall( + getChannel(), getGetSubscriptionMethod(), getCallOptions(), request); + } + + /** + * + * + *
    +     * Updates an existing subscription by updating the fields specified in the
    +     * update mask. Note that certain properties of a subscription, such as its
    +     * topic, are not modifiable.
    +     * 
    + */ + public com.google.pubsub.v1.Subscription updateSubscription( + com.google.pubsub.v1.UpdateSubscriptionRequest request) throws io.grpc.StatusException { + return io.grpc.stub.ClientCalls.blockingV2UnaryCall( + getChannel(), getUpdateSubscriptionMethod(), getCallOptions(), request); + } + + /** + * + * + *
    +     * Lists matching subscriptions.
    +     * 
    + */ + public com.google.pubsub.v1.ListSubscriptionsResponse listSubscriptions( + com.google.pubsub.v1.ListSubscriptionsRequest request) throws io.grpc.StatusException { + return io.grpc.stub.ClientCalls.blockingV2UnaryCall( + getChannel(), getListSubscriptionsMethod(), getCallOptions(), request); + } + + /** + * + * + *
    +     * Deletes an existing subscription. All messages retained in the subscription
    +     * are immediately dropped. Calls to `Pull` after deletion will return
    +     * `NOT_FOUND`. After a subscription is deleted, a new one may be created with
    +     * the same name, but the new one has no association with the old
    +     * subscription or its topic unless the same topic is specified.
    +     * 
    + */ + public com.google.protobuf.Empty deleteSubscription( + com.google.pubsub.v1.DeleteSubscriptionRequest request) throws io.grpc.StatusException { + return io.grpc.stub.ClientCalls.blockingV2UnaryCall( + getChannel(), getDeleteSubscriptionMethod(), getCallOptions(), request); + } + + /** + * + * + *
    +     * Modifies the ack deadline for a specific message. This method is useful
    +     * to indicate that more time is needed to process a message by the
    +     * subscriber, or to make the message available for redelivery if the
    +     * processing was interrupted. Note that this does not modify the
    +     * subscription-level `ackDeadlineSeconds` used for subsequent messages.
    +     * 
    + */ + public com.google.protobuf.Empty modifyAckDeadline( + com.google.pubsub.v1.ModifyAckDeadlineRequest request) throws io.grpc.StatusException { + return io.grpc.stub.ClientCalls.blockingV2UnaryCall( + getChannel(), getModifyAckDeadlineMethod(), getCallOptions(), request); + } + + /** + * + * + *
    +     * Acknowledges the messages associated with the `ack_ids` in the
    +     * `AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages
    +     * from the subscription.
    +     * Acknowledging a message whose ack deadline has expired may succeed,
    +     * but such a message may be redelivered later. Acknowledging a message more
    +     * than once will not result in an error.
    +     * 
    + */ + public com.google.protobuf.Empty acknowledge(com.google.pubsub.v1.AcknowledgeRequest request) + throws io.grpc.StatusException { + return io.grpc.stub.ClientCalls.blockingV2UnaryCall( + getChannel(), getAcknowledgeMethod(), getCallOptions(), request); + } + + /** + * + * + *
    +     * Pulls messages from the server.
    +     * 
    + */ + public com.google.pubsub.v1.PullResponse pull(com.google.pubsub.v1.PullRequest request) + throws io.grpc.StatusException { + return io.grpc.stub.ClientCalls.blockingV2UnaryCall( + getChannel(), getPullMethod(), getCallOptions(), request); + } + + /** + * + * + *
    +     * Establishes a stream with the server, which sends messages down to the
    +     * client. The client streams acknowledgments and ack deadline modifications
    +     * back to the server. The server will close the stream and return the status
    +     * on any error. The server may close the stream with status `UNAVAILABLE` to
    +     * reassign server-side resources, in which case, the client should
    +     * re-establish the stream. Flow control can be achieved by configuring the
    +     * underlying RPC channel.
    +     * 
    + */ + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918") + public io.grpc.stub.BlockingClientCall< + com.google.pubsub.v1.StreamingPullRequest, com.google.pubsub.v1.StreamingPullResponse> + streamingPull() { + return io.grpc.stub.ClientCalls.blockingBidiStreamingCall( + getChannel(), getStreamingPullMethod(), getCallOptions()); + } + + /** + * + * + *
    +     * Modifies the `PushConfig` for a specified subscription.
    +     * This may be used to change a push subscription to a pull one (signified by
    +     * an empty `PushConfig`) or vice versa, or change the endpoint URL and other
    +     * attributes of a push subscription. Messages will accumulate for delivery
    +     * continuously through the call regardless of changes to the `PushConfig`.
    +     * 
    + */ + public com.google.protobuf.Empty modifyPushConfig( + com.google.pubsub.v1.ModifyPushConfigRequest request) throws io.grpc.StatusException { + return io.grpc.stub.ClientCalls.blockingV2UnaryCall( + getChannel(), getModifyPushConfigMethod(), getCallOptions(), request); + } + + /** + * + * + *
    +     * Gets the configuration details of a snapshot. Snapshots are used in
    +     * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations,
    +     * which allow you to manage message acknowledgments in bulk. That is, you can
    +     * set the acknowledgment state of messages in an existing subscription to the
    +     * state captured by a snapshot.
    +     * 
    + */ + public com.google.pubsub.v1.Snapshot getSnapshot( + com.google.pubsub.v1.GetSnapshotRequest request) throws io.grpc.StatusException { + return io.grpc.stub.ClientCalls.blockingV2UnaryCall( + getChannel(), getGetSnapshotMethod(), getCallOptions(), request); + } + + /** + * + * + *
    +     * Lists the existing snapshots. Snapshots are used in [Seek](
    +     * https://cloud.google.com/pubsub/docs/replay-overview) operations, which
    +     * allow you to manage message acknowledgments in bulk. That is, you can set
    +     * the acknowledgment state of messages in an existing subscription to the
    +     * state captured by a snapshot.
    +     * 
    + */ + public com.google.pubsub.v1.ListSnapshotsResponse listSnapshots( + com.google.pubsub.v1.ListSnapshotsRequest request) throws io.grpc.StatusException { + return io.grpc.stub.ClientCalls.blockingV2UnaryCall( + getChannel(), getListSnapshotsMethod(), getCallOptions(), request); + } + + /** + * + * + *
    +     * Creates a snapshot from the requested subscription. Snapshots are used in
    +     * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations,
    +     * which allow you to manage message acknowledgments in bulk. That is, you can
    +     * set the acknowledgment state of messages in an existing subscription to the
    +     * state captured by a snapshot.
    +     * If the snapshot already exists, returns `ALREADY_EXISTS`.
    +     * If the requested subscription doesn't exist, returns `NOT_FOUND`.
    +     * If the backlog in the subscription is too old -- and the resulting snapshot
    +     * would expire in less than 1 hour -- then `FAILED_PRECONDITION` is returned.
    +     * See also the `Snapshot.expire_time` field. If the name is not provided in
    +     * the request, the server will assign a random
    +     * name for this snapshot on the same project as the subscription, conforming
    +     * to the [resource name format]
    +     * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). The
    +     * generated name is populated in the returned Snapshot object. Note that for
    +     * REST API requests, you must specify a name in the request.
    +     * 
    + */ + public com.google.pubsub.v1.Snapshot createSnapshot( + com.google.pubsub.v1.CreateSnapshotRequest request) throws io.grpc.StatusException { + return io.grpc.stub.ClientCalls.blockingV2UnaryCall( + getChannel(), getCreateSnapshotMethod(), getCallOptions(), request); + } + + /** + * + * + *
    +     * Updates an existing snapshot by updating the fields specified in the update
    +     * mask. Snapshots are used in
    +     * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations,
    +     * which allow you to manage message acknowledgments in bulk. That is, you can
    +     * set the acknowledgment state of messages in an existing subscription to the
    +     * state captured by a snapshot.
    +     * 
    + */ + public com.google.pubsub.v1.Snapshot updateSnapshot( + com.google.pubsub.v1.UpdateSnapshotRequest request) throws io.grpc.StatusException { + return io.grpc.stub.ClientCalls.blockingV2UnaryCall( + getChannel(), getUpdateSnapshotMethod(), getCallOptions(), request); + } + + /** + * + * + *
    +     * Removes an existing snapshot. Snapshots are used in [Seek]
    +     * (https://cloud.google.com/pubsub/docs/replay-overview) operations, which
    +     * allow you to manage message acknowledgments in bulk. That is, you can set
    +     * the acknowledgment state of messages in an existing subscription to the
    +     * state captured by a snapshot.
    +     * When the snapshot is deleted, all messages retained in the snapshot
    +     * are immediately dropped. After a snapshot is deleted, a new one may be
    +     * created with the same name, but the new one has no association with the old
    +     * snapshot or its subscription, unless the same subscription is specified.
    +     * 
    + */ + public com.google.protobuf.Empty deleteSnapshot( + com.google.pubsub.v1.DeleteSnapshotRequest request) throws io.grpc.StatusException { + return io.grpc.stub.ClientCalls.blockingV2UnaryCall( + getChannel(), getDeleteSnapshotMethod(), getCallOptions(), request); + } + + /** + * + * + *
    +     * Seeks an existing subscription to a point in time or to a given snapshot,
    +     * whichever is provided in the request. Snapshots are used in [Seek]
    +     * (https://cloud.google.com/pubsub/docs/replay-overview) operations, which
    +     * allow you to manage message acknowledgments in bulk. That is, you can set
    +     * the acknowledgment state of messages in an existing subscription to the
    +     * state captured by a snapshot. Note that both the subscription and the
    +     * snapshot must be on the same topic.
    +     * 
    + */ + public com.google.pubsub.v1.SeekResponse seek(com.google.pubsub.v1.SeekRequest request) + throws io.grpc.StatusException { + return io.grpc.stub.ClientCalls.blockingV2UnaryCall( + getChannel(), getSeekMethod(), getCallOptions(), request); + } + } + + /** + * A stub to allow clients to do limited synchronous rpc calls to service Subscriber. * *
        * The service that an application uses to manipulate subscriptions and to
    @@ -1506,20 +1743,20 @@ protected SubscriberBlockingStub build(
          *
          * 
          * Creates a subscription to a given topic. See the [resource name rules]
    -     * (https://cloud.google.com/pubsub/docs/admin#resource_names).
    +     * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names).
          * If the subscription already exists, returns `ALREADY_EXISTS`.
          * If the corresponding topic doesn't exist, returns `NOT_FOUND`.
          * If the name is not provided in the request, the server will assign a random
          * name for this subscription on the same project as the topic, conforming
          * to the [resource name format]
    -     * (https://cloud.google.com/pubsub/docs/admin#resource_names). The generated
    -     * name is populated in the returned Subscription object. Note that for REST
    -     * API requests, you must specify a name in the request.
    +     * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). The
    +     * generated name is populated in the returned Subscription object. Note that
    +     * for REST API requests, you must specify a name in the request.
          * 
    */ public com.google.pubsub.v1.Subscription createSubscription( com.google.pubsub.v1.Subscription request) { - return blockingUnaryCall( + return io.grpc.stub.ClientCalls.blockingUnaryCall( getChannel(), getCreateSubscriptionMethod(), getCallOptions(), request); } @@ -1532,20 +1769,22 @@ public com.google.pubsub.v1.Subscription createSubscription( */ public com.google.pubsub.v1.Subscription getSubscription( com.google.pubsub.v1.GetSubscriptionRequest request) { - return blockingUnaryCall(getChannel(), getGetSubscriptionMethod(), getCallOptions(), request); + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetSubscriptionMethod(), getCallOptions(), request); } /** * * *
    -     * Updates an existing subscription. Note that certain properties of a
    -     * subscription, such as its topic, are not modifiable.
    +     * Updates an existing subscription by updating the fields specified in the
    +     * update mask. Note that certain properties of a subscription, such as its
    +     * topic, are not modifiable.
          * 
    */ public com.google.pubsub.v1.Subscription updateSubscription( com.google.pubsub.v1.UpdateSubscriptionRequest request) { - return blockingUnaryCall( + return io.grpc.stub.ClientCalls.blockingUnaryCall( getChannel(), getUpdateSubscriptionMethod(), getCallOptions(), request); } @@ -1558,7 +1797,7 @@ public com.google.pubsub.v1.Subscription updateSubscription( */ public com.google.pubsub.v1.ListSubscriptionsResponse listSubscriptions( com.google.pubsub.v1.ListSubscriptionsRequest request) { - return blockingUnaryCall( + return io.grpc.stub.ClientCalls.blockingUnaryCall( getChannel(), getListSubscriptionsMethod(), getCallOptions(), request); } @@ -1575,7 +1814,7 @@ public com.google.pubsub.v1.ListSubscriptionsResponse listSubscriptions( */ public com.google.protobuf.Empty deleteSubscription( com.google.pubsub.v1.DeleteSubscriptionRequest request) { - return blockingUnaryCall( + return io.grpc.stub.ClientCalls.blockingUnaryCall( getChannel(), getDeleteSubscriptionMethod(), getCallOptions(), request); } @@ -1592,7 +1831,7 @@ public com.google.protobuf.Empty deleteSubscription( */ public com.google.protobuf.Empty modifyAckDeadline( com.google.pubsub.v1.ModifyAckDeadlineRequest request) { - return blockingUnaryCall( + return io.grpc.stub.ClientCalls.blockingUnaryCall( getChannel(), getModifyAckDeadlineMethod(), getCallOptions(), request); } @@ -1609,20 +1848,20 @@ public com.google.protobuf.Empty modifyAckDeadline( *
    */ public com.google.protobuf.Empty acknowledge(com.google.pubsub.v1.AcknowledgeRequest request) { - return blockingUnaryCall(getChannel(), getAcknowledgeMethod(), getCallOptions(), request); + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getAcknowledgeMethod(), getCallOptions(), request); } /** * * *
    -     * Pulls messages from the server. The server may return `UNAVAILABLE` if
    -     * there are too many concurrent pull requests pending for the given
    -     * subscription.
    +     * Pulls messages from the server.
          * 
    */ public com.google.pubsub.v1.PullResponse pull(com.google.pubsub.v1.PullRequest request) { - return blockingUnaryCall(getChannel(), getPullMethod(), getCallOptions(), request); + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getPullMethod(), getCallOptions(), request); } /** @@ -1638,7 +1877,7 @@ public com.google.pubsub.v1.PullResponse pull(com.google.pubsub.v1.PullRequest r */ public com.google.protobuf.Empty modifyPushConfig( com.google.pubsub.v1.ModifyPushConfigRequest request) { - return blockingUnaryCall( + return io.grpc.stub.ClientCalls.blockingUnaryCall( getChannel(), getModifyPushConfigMethod(), getCallOptions(), request); } @@ -1647,15 +1886,16 @@ public com.google.protobuf.Empty modifyPushConfig( * *
          * Gets the configuration details of a snapshot. Snapshots are used in
    -     * <a href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a>
    -     * operations, which allow you to manage message acknowledgments in bulk. That
    -     * is, you can set the acknowledgment state of messages in an existing
    -     * subscription to the state captured by a snapshot.
    +     * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations,
    +     * which allow you to manage message acknowledgments in bulk. That is, you can
    +     * set the acknowledgment state of messages in an existing subscription to the
    +     * state captured by a snapshot.
          * 
    */ public com.google.pubsub.v1.Snapshot getSnapshot( com.google.pubsub.v1.GetSnapshotRequest request) { - return blockingUnaryCall(getChannel(), getGetSnapshotMethod(), getCallOptions(), request); + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetSnapshotMethod(), getCallOptions(), request); } /** @@ -1671,7 +1911,8 @@ public com.google.pubsub.v1.Snapshot getSnapshot( */ public com.google.pubsub.v1.ListSnapshotsResponse listSnapshots( com.google.pubsub.v1.ListSnapshotsRequest request) { - return blockingUnaryCall(getChannel(), getListSnapshotsMethod(), getCallOptions(), request); + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getListSnapshotsMethod(), getCallOptions(), request); } /** @@ -1691,31 +1932,33 @@ public com.google.pubsub.v1.ListSnapshotsResponse listSnapshots( * the request, the server will assign a random * name for this snapshot on the same project as the subscription, conforming * to the [resource name format] - * (https://cloud.google.com/pubsub/docs/admin#resource_names). The + * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). The * generated name is populated in the returned Snapshot object. Note that for * REST API requests, you must specify a name in the request. *
    */ public com.google.pubsub.v1.Snapshot createSnapshot( com.google.pubsub.v1.CreateSnapshotRequest request) { - return blockingUnaryCall(getChannel(), getCreateSnapshotMethod(), getCallOptions(), request); + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getCreateSnapshotMethod(), getCallOptions(), request); } /** * * *
    -     * Updates an existing snapshot. Snapshots are used in
    -     * <a href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a>
    -     * operations, which allow
    -     * you to manage message acknowledgments in bulk. That is, you can set the
    -     * acknowledgment state of messages in an existing subscription to the state
    -     * captured by a snapshot.
    +     * Updates an existing snapshot by updating the fields specified in the update
    +     * mask. Snapshots are used in
    +     * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations,
    +     * which allow you to manage message acknowledgments in bulk. That is, you can
    +     * set the acknowledgment state of messages in an existing subscription to the
    +     * state captured by a snapshot.
          * 
    */ public com.google.pubsub.v1.Snapshot updateSnapshot( com.google.pubsub.v1.UpdateSnapshotRequest request) { - return blockingUnaryCall(getChannel(), getUpdateSnapshotMethod(), getCallOptions(), request); + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getUpdateSnapshotMethod(), getCallOptions(), request); } /** @@ -1735,7 +1978,8 @@ public com.google.pubsub.v1.Snapshot updateSnapshot( */ public com.google.protobuf.Empty deleteSnapshot( com.google.pubsub.v1.DeleteSnapshotRequest request) { - return blockingUnaryCall(getChannel(), getDeleteSnapshotMethod(), getCallOptions(), request); + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getDeleteSnapshotMethod(), getCallOptions(), request); } /** @@ -1752,12 +1996,13 @@ public com.google.protobuf.Empty deleteSnapshot( * */ public com.google.pubsub.v1.SeekResponse seek(com.google.pubsub.v1.SeekRequest request) { - return blockingUnaryCall(getChannel(), getSeekMethod(), getCallOptions(), request); + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getSeekMethod(), getCallOptions(), request); } } /** - * + * A stub to allow clients to do ListenableFuture-style rpc calls to service Subscriber. * *
        * The service that an application uses to manipulate subscriptions and to
    @@ -1781,20 +2026,20 @@ protected SubscriberFutureStub build(io.grpc.Channel channel, io.grpc.CallOption
          *
          * 
          * Creates a subscription to a given topic. See the [resource name rules]
    -     * (https://cloud.google.com/pubsub/docs/admin#resource_names).
    +     * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names).
          * If the subscription already exists, returns `ALREADY_EXISTS`.
          * If the corresponding topic doesn't exist, returns `NOT_FOUND`.
          * If the name is not provided in the request, the server will assign a random
          * name for this subscription on the same project as the topic, conforming
          * to the [resource name format]
    -     * (https://cloud.google.com/pubsub/docs/admin#resource_names). The generated
    -     * name is populated in the returned Subscription object. Note that for REST
    -     * API requests, you must specify a name in the request.
    +     * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). The
    +     * generated name is populated in the returned Subscription object. Note that
    +     * for REST API requests, you must specify a name in the request.
          * 
    */ public com.google.common.util.concurrent.ListenableFuture createSubscription(com.google.pubsub.v1.Subscription request) { - return futureUnaryCall( + return io.grpc.stub.ClientCalls.futureUnaryCall( getChannel().newCall(getCreateSubscriptionMethod(), getCallOptions()), request); } @@ -1807,7 +2052,7 @@ protected SubscriberFutureStub build(io.grpc.Channel channel, io.grpc.CallOption */ public com.google.common.util.concurrent.ListenableFuture getSubscription(com.google.pubsub.v1.GetSubscriptionRequest request) { - return futureUnaryCall( + return io.grpc.stub.ClientCalls.futureUnaryCall( getChannel().newCall(getGetSubscriptionMethod(), getCallOptions()), request); } @@ -1815,13 +2060,14 @@ protected SubscriberFutureStub build(io.grpc.Channel channel, io.grpc.CallOption * * *
    -     * Updates an existing subscription. Note that certain properties of a
    -     * subscription, such as its topic, are not modifiable.
    +     * Updates an existing subscription by updating the fields specified in the
    +     * update mask. Note that certain properties of a subscription, such as its
    +     * topic, are not modifiable.
          * 
    */ public com.google.common.util.concurrent.ListenableFuture updateSubscription(com.google.pubsub.v1.UpdateSubscriptionRequest request) { - return futureUnaryCall( + return io.grpc.stub.ClientCalls.futureUnaryCall( getChannel().newCall(getUpdateSubscriptionMethod(), getCallOptions()), request); } @@ -1835,7 +2081,7 @@ protected SubscriberFutureStub build(io.grpc.Channel channel, io.grpc.CallOption public com.google.common.util.concurrent.ListenableFuture< com.google.pubsub.v1.ListSubscriptionsResponse> listSubscriptions(com.google.pubsub.v1.ListSubscriptionsRequest request) { - return futureUnaryCall( + return io.grpc.stub.ClientCalls.futureUnaryCall( getChannel().newCall(getListSubscriptionsMethod(), getCallOptions()), request); } @@ -1852,7 +2098,7 @@ protected SubscriberFutureStub build(io.grpc.Channel channel, io.grpc.CallOption */ public com.google.common.util.concurrent.ListenableFuture deleteSubscription(com.google.pubsub.v1.DeleteSubscriptionRequest request) { - return futureUnaryCall( + return io.grpc.stub.ClientCalls.futureUnaryCall( getChannel().newCall(getDeleteSubscriptionMethod(), getCallOptions()), request); } @@ -1869,7 +2115,7 @@ protected SubscriberFutureStub build(io.grpc.Channel channel, io.grpc.CallOption */ public com.google.common.util.concurrent.ListenableFuture modifyAckDeadline(com.google.pubsub.v1.ModifyAckDeadlineRequest request) { - return futureUnaryCall( + return io.grpc.stub.ClientCalls.futureUnaryCall( getChannel().newCall(getModifyAckDeadlineMethod(), getCallOptions()), request); } @@ -1887,7 +2133,7 @@ protected SubscriberFutureStub build(io.grpc.Channel channel, io.grpc.CallOption */ public com.google.common.util.concurrent.ListenableFuture acknowledge(com.google.pubsub.v1.AcknowledgeRequest request) { - return futureUnaryCall( + return io.grpc.stub.ClientCalls.futureUnaryCall( getChannel().newCall(getAcknowledgeMethod(), getCallOptions()), request); } @@ -1895,14 +2141,13 @@ protected SubscriberFutureStub build(io.grpc.Channel channel, io.grpc.CallOption * * *
    -     * Pulls messages from the server. The server may return `UNAVAILABLE` if
    -     * there are too many concurrent pull requests pending for the given
    -     * subscription.
    +     * Pulls messages from the server.
          * 
    */ public com.google.common.util.concurrent.ListenableFuture pull(com.google.pubsub.v1.PullRequest request) { - return futureUnaryCall(getChannel().newCall(getPullMethod(), getCallOptions()), request); + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getPullMethod(), getCallOptions()), request); } /** @@ -1918,7 +2163,7 @@ protected SubscriberFutureStub build(io.grpc.Channel channel, io.grpc.CallOption */ public com.google.common.util.concurrent.ListenableFuture modifyPushConfig(com.google.pubsub.v1.ModifyPushConfigRequest request) { - return futureUnaryCall( + return io.grpc.stub.ClientCalls.futureUnaryCall( getChannel().newCall(getModifyPushConfigMethod(), getCallOptions()), request); } @@ -1927,15 +2172,15 @@ protected SubscriberFutureStub build(io.grpc.Channel channel, io.grpc.CallOption * *
          * Gets the configuration details of a snapshot. Snapshots are used in
    -     * <a href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a>
    -     * operations, which allow you to manage message acknowledgments in bulk. That
    -     * is, you can set the acknowledgment state of messages in an existing
    -     * subscription to the state captured by a snapshot.
    +     * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations,
    +     * which allow you to manage message acknowledgments in bulk. That is, you can
    +     * set the acknowledgment state of messages in an existing subscription to the
    +     * state captured by a snapshot.
          * 
    */ public com.google.common.util.concurrent.ListenableFuture getSnapshot(com.google.pubsub.v1.GetSnapshotRequest request) { - return futureUnaryCall( + return io.grpc.stub.ClientCalls.futureUnaryCall( getChannel().newCall(getGetSnapshotMethod(), getCallOptions()), request); } @@ -1953,7 +2198,7 @@ protected SubscriberFutureStub build(io.grpc.Channel channel, io.grpc.CallOption public com.google.common.util.concurrent.ListenableFuture< com.google.pubsub.v1.ListSnapshotsResponse> listSnapshots(com.google.pubsub.v1.ListSnapshotsRequest request) { - return futureUnaryCall( + return io.grpc.stub.ClientCalls.futureUnaryCall( getChannel().newCall(getListSnapshotsMethod(), getCallOptions()), request); } @@ -1974,14 +2219,14 @@ protected SubscriberFutureStub build(io.grpc.Channel channel, io.grpc.CallOption * the request, the server will assign a random * name for this snapshot on the same project as the subscription, conforming * to the [resource name format] - * (https://cloud.google.com/pubsub/docs/admin#resource_names). The + * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). The * generated name is populated in the returned Snapshot object. Note that for * REST API requests, you must specify a name in the request. *
    */ public com.google.common.util.concurrent.ListenableFuture createSnapshot(com.google.pubsub.v1.CreateSnapshotRequest request) { - return futureUnaryCall( + return io.grpc.stub.ClientCalls.futureUnaryCall( getChannel().newCall(getCreateSnapshotMethod(), getCallOptions()), request); } @@ -1989,17 +2234,17 @@ protected SubscriberFutureStub build(io.grpc.Channel channel, io.grpc.CallOption * * *
    -     * Updates an existing snapshot. Snapshots are used in
    -     * <a href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a>
    -     * operations, which allow
    -     * you to manage message acknowledgments in bulk. That is, you can set the
    -     * acknowledgment state of messages in an existing subscription to the state
    -     * captured by a snapshot.
    +     * Updates an existing snapshot by updating the fields specified in the update
    +     * mask. Snapshots are used in
    +     * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations,
    +     * which allow you to manage message acknowledgments in bulk. That is, you can
    +     * set the acknowledgment state of messages in an existing subscription to the
    +     * state captured by a snapshot.
          * 
    */ public com.google.common.util.concurrent.ListenableFuture updateSnapshot(com.google.pubsub.v1.UpdateSnapshotRequest request) { - return futureUnaryCall( + return io.grpc.stub.ClientCalls.futureUnaryCall( getChannel().newCall(getUpdateSnapshotMethod(), getCallOptions()), request); } @@ -2020,7 +2265,7 @@ protected SubscriberFutureStub build(io.grpc.Channel channel, io.grpc.CallOption */ public com.google.common.util.concurrent.ListenableFuture deleteSnapshot(com.google.pubsub.v1.DeleteSnapshotRequest request) { - return futureUnaryCall( + return io.grpc.stub.ClientCalls.futureUnaryCall( getChannel().newCall(getDeleteSnapshotMethod(), getCallOptions()), request); } @@ -2039,7 +2284,8 @@ protected SubscriberFutureStub build(io.grpc.Channel channel, io.grpc.CallOption */ public com.google.common.util.concurrent.ListenableFuture seek(com.google.pubsub.v1.SeekRequest request) { - return futureUnaryCall(getChannel().newCall(getSeekMethod(), getCallOptions()), request); + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getSeekMethod(), getCallOptions()), request); } } @@ -2065,10 +2311,10 @@ private static final class MethodHandlers io.grpc.stub.ServerCalls.ServerStreamingMethod, io.grpc.stub.ServerCalls.ClientStreamingMethod, io.grpc.stub.ServerCalls.BidiStreamingMethod { - private final SubscriberImplBase serviceImpl; + private final AsyncService serviceImpl; private final int methodId; - MethodHandlers(SubscriberImplBase serviceImpl, int methodId) { + MethodHandlers(AsyncService serviceImpl, int methodId) { this.serviceImpl = serviceImpl; this.methodId = methodId; } @@ -2175,6 +2421,108 @@ public io.grpc.stub.StreamObserver invoke( } } + public static final io.grpc.ServerServiceDefinition bindService(AsyncService service) { + return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) + .addMethod( + getCreateSubscriptionMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.pubsub.v1.Subscription, com.google.pubsub.v1.Subscription>( + service, METHODID_CREATE_SUBSCRIPTION))) + .addMethod( + getGetSubscriptionMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.pubsub.v1.GetSubscriptionRequest, com.google.pubsub.v1.Subscription>( + service, METHODID_GET_SUBSCRIPTION))) + .addMethod( + getUpdateSubscriptionMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.pubsub.v1.UpdateSubscriptionRequest, + com.google.pubsub.v1.Subscription>(service, METHODID_UPDATE_SUBSCRIPTION))) + .addMethod( + getListSubscriptionsMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.pubsub.v1.ListSubscriptionsRequest, + com.google.pubsub.v1.ListSubscriptionsResponse>( + service, METHODID_LIST_SUBSCRIPTIONS))) + .addMethod( + getDeleteSubscriptionMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.pubsub.v1.DeleteSubscriptionRequest, com.google.protobuf.Empty>( + service, METHODID_DELETE_SUBSCRIPTION))) + .addMethod( + getModifyAckDeadlineMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.pubsub.v1.ModifyAckDeadlineRequest, com.google.protobuf.Empty>( + service, METHODID_MODIFY_ACK_DEADLINE))) + .addMethod( + getAcknowledgeMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.pubsub.v1.AcknowledgeRequest, com.google.protobuf.Empty>( + service, METHODID_ACKNOWLEDGE))) + .addMethod( + getPullMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.pubsub.v1.PullRequest, com.google.pubsub.v1.PullResponse>( + service, METHODID_PULL))) + .addMethod( + getStreamingPullMethod(), + io.grpc.stub.ServerCalls.asyncBidiStreamingCall( + new MethodHandlers< + com.google.pubsub.v1.StreamingPullRequest, + com.google.pubsub.v1.StreamingPullResponse>(service, METHODID_STREAMING_PULL))) + .addMethod( + getModifyPushConfigMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.pubsub.v1.ModifyPushConfigRequest, com.google.protobuf.Empty>( + service, METHODID_MODIFY_PUSH_CONFIG))) + .addMethod( + getGetSnapshotMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.pubsub.v1.GetSnapshotRequest, com.google.pubsub.v1.Snapshot>( + service, METHODID_GET_SNAPSHOT))) + .addMethod( + getListSnapshotsMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.pubsub.v1.ListSnapshotsRequest, + com.google.pubsub.v1.ListSnapshotsResponse>(service, METHODID_LIST_SNAPSHOTS))) + .addMethod( + getCreateSnapshotMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.pubsub.v1.CreateSnapshotRequest, com.google.pubsub.v1.Snapshot>( + service, METHODID_CREATE_SNAPSHOT))) + .addMethod( + getUpdateSnapshotMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.pubsub.v1.UpdateSnapshotRequest, com.google.pubsub.v1.Snapshot>( + service, METHODID_UPDATE_SNAPSHOT))) + .addMethod( + getDeleteSnapshotMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.pubsub.v1.DeleteSnapshotRequest, com.google.protobuf.Empty>( + service, METHODID_DELETE_SNAPSHOT))) + .addMethod( + getSeekMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.pubsub.v1.SeekRequest, com.google.pubsub.v1.SeekResponse>( + service, METHODID_SEEK))) + .build(); + } + private abstract static class SubscriberBaseDescriptorSupplier implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier { @@ -2199,9 +2547,9 @@ private static final class SubscriberFileDescriptorSupplier private static final class SubscriberMethodDescriptorSupplier extends SubscriberBaseDescriptorSupplier implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { - private final String methodName; + private final java.lang.String methodName; - SubscriberMethodDescriptorSupplier(String methodName) { + SubscriberMethodDescriptorSupplier(java.lang.String methodName) { this.methodName = methodName; } diff --git a/java.header b/java.header index 3a9b503aa..d0970ba7d 100644 --- a/java.header +++ b/java.header @@ -1,5 +1,5 @@ ^/\*$ -^ \* Copyright \d\d\d\d,? Google (Inc\.|LLC)( All [rR]ights [rR]eserved\.)?$ +^ \* Copyright \d\d\d\d,? Google (Inc\.|LLC)$ ^ \*$ ^ \* Licensed under the Apache License, Version 2\.0 \(the "License"\);$ ^ \* you may not use this file except in compliance with the License\.$ diff --git a/owlbot.py b/owlbot.py new file mode 100644 index 000000000..cf50f5e65 --- /dev/null +++ b/owlbot.py @@ -0,0 +1,1213 @@ +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# 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. + +import synthtool as s +from synthtool.languages import java + + +service = 'pubsub' +version = 'v1' + +GET_IAM_POLICY_TOPIC = """ + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets the access control policy for a resource. Returns an empty policy if the resource exists + * and does not have a policy set. + * + *

    Sample code: + * + *

    
    +   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    +   *   String formattedResource = ProjectTopicName.format("[PROJECT]", "[TOPIC]");
    +   *   Policy response = topicAdminClient.getIamPolicy(formattedResource);
    +   * }
    +   * 
    + * + * @param resource REQUIRED: The resource for which the policy is being requested. See the + * operation documentation for the appropriate value for this field. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + * @deprecated Use {@link #getIamPolicy(GetIamPolicyRequest)} instead. + */ + @Deprecated + public final Policy getIamPolicy(String resource) { + GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder().setResource(resource).build(); + return getIamPolicy(request); + } +""" +GET_IAM_POLICY_SUBSCRIPTION = """ + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets the access control policy for a resource. Returns an empty policy if the resource exists + * and does not have a policy set. + * + *

    Sample code: + * + *

    
    +   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    +   *   String formattedResource = ProjectTopicName.format("[PROJECT]", "[TOPIC]");
    +   *   Policy response = subscriptionAdminClient.getIamPolicy(formattedResource);
    +   * }
    +   * 
    + * + * @param resource REQUIRED: The resource for which the policy is being requested. See the + * operation documentation for the appropriate value for this field. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + * @deprecated Use {@link #getIamPolicy(GetIamPolicyRequest)} instead. + */ + @Deprecated + public final Policy getIamPolicy(String resource) { + GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder().setResource(resource).build(); + return getIamPolicy(request); + } +""" + +GET_IAM_POLICY_PREVIOUS = r'(\s+public final Policy getIamPolicy\(GetIamPolicyRequest request\) {\n\s+return .*\n\s+})' + +SET_IAM_POLICY_TOPIC = """ + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the access control policy on the specified resource. Replaces any existing policy. + * + *

    Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED + * + *

    Sample code: + * + *

    
    +   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    +   *   String formattedResource = ProjectTopicName.format("[PROJECT]", "[TOPIC]");
    +   *   Policy policy = Policy.newBuilder().build();
    +   *   Policy response = topicAdminClient.setIamPolicy(formattedResource, policy);
    +   * }
    +   * 
    + * + * @param resource REQUIRED: The resource for which the policy is being specified. See the + * operation documentation for the appropriate value for this field. + * @param policy REQUIRED: The complete policy to be applied to the `resource`. The size of the + * policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud + * Platform services (such as Projects) might reject them. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + * @deprecated Use {@link #setIamPolicy(SetIamPolicyRequest)} instead. + */ + @Deprecated + public final Policy setIamPolicy(String resource, Policy policy) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder().setResource(resource).setPolicy(policy).build(); + return setIamPolicy(request); + } +""" +SET_IAM_POLICY_SUBSCRIPTION = """ + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the access control policy on the specified resource. Replaces any existing policy. + * + *

    Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED + * + *

    Sample code: + * + *

    
    +   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    +   *   String formattedResource = ProjectTopicName.format("[PROJECT]", "[TOPIC]");
    +   *   Policy policy = Policy.newBuilder().build();
    +   *   Policy response = subscriptionAdminClient.setIamPolicy(formattedResource, policy);
    +   * }
    +   * 
    + * + * @param resource REQUIRED: The resource for which the policy is being specified. See the + * operation documentation for the appropriate value for this field. + * @param policy REQUIRED: The complete policy to be applied to the `resource`. The size of the + * policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud + * Platform services (such as Projects) might reject them. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + * @deprecated Use {@link #setIamPolicy(SetIamPolicyRequest)} instead. + */ + @Deprecated + public final Policy setIamPolicy(String resource, Policy policy) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder().setResource(resource).setPolicy(policy).build(); + return setIamPolicy(request); + } +""" +SET_IAM_POLICY_PREVIOUS = r'(\s+public final Policy setIamPolicy\(SetIamPolicyRequest request\) {\n\s+return .*\n\s+})' + +TEST_IAM_PERMISSIONS_TOPIC = """ + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns permissions that a caller has on the specified resource. If the resource does not + * exist, this will return an empty set of permissions, not a NOT_FOUND error. + * + *

    Note: This operation is designed to be used for building permission-aware UIs and + * command-line tools, not for authorization checking. This operation may "fail open" without + * warning. + * + *

    Sample code: + * + *

    
    +   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    +   *   String formattedResource = ProjectTopicName.format("[PROJECT]", "[TOPIC]");
    +   *   List<String> permissions = new ArrayList<>();
    +   *   TestIamPermissionsResponse response = topicAdminClient.testIamPermissions(formattedResource, permissions);
    +   * }
    +   * 
    + * + * @param resource REQUIRED: The resource for which the policy detail is being requested. See the + * operation documentation for the appropriate value for this field. + * @param permissions The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + * @deprecated Use {@link #testIamPermissions(TestIamPermissionsRequest)} instead. + */ + @Deprecated + public final TestIamPermissionsResponse testIamPermissions( + String resource, List permissions) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource(resource) + .addAllPermissions(permissions) + .build(); + return testIamPermissions(request); + } +""" +TEST_IAM_PERMISSIONS_SUBSCRIPTION = """ + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns permissions that a caller has on the specified resource. If the resource does not + * exist, this will return an empty set of permissions, not a NOT_FOUND error. + * + *

    Note: This operation is designed to be used for building permission-aware UIs and + * command-line tools, not for authorization checking. This operation may "fail open" without + * warning. + * + *

    Sample code: + * + *

    
    +   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    +   *   String formattedResource = ProjectTopicName.format("[PROJECT]", "[TOPIC]");
    +   *   List<String> permissions = new ArrayList<>();
    +   *   TestIamPermissionsResponse response = subscriptionAdminClient.testIamPermissions(formattedResource, permissions);
    +   * }
    +   * 
    + * + * @param resource REQUIRED: The resource for which the policy detail is being requested. See the + * operation documentation for the appropriate value for this field. + * @param permissions The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + * @deprecated Use {@link #testIamPermissions(TestIamPermissionsRequest)} instead. + */ + @Deprecated + public final TestIamPermissionsResponse testIamPermissions( + String resource, List permissions) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource(resource) + .addAllPermissions(permissions) + .build(); + return testIamPermissions(request); + } +""" +TEST_IAM_PERMISSIONS_PREVIOUS = r'(\s+public final TestIamPermissionsResponse testIamPermissions\(TestIamPermissionsRequest request\) {\n\s+return .*\n\s+})' + +CREATE_TOPIC = """ + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates the given topic with the given name. See the <a + * href="https://cloud.google.com/pubsub/docs/admin#resource_names"> resource name + * rules</a>. + * + *

    Sample code: + * + *

    
    +   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    +   *   ProjectTopicName name = ProjectTopicName.of("[PROJECT]", "[TOPIC]");
    +   *   Topic response = topicAdminClient.createTopic(name);
    +   * }
    +   * 
    + * + * @param name Required. The name of the topic. It must have the format + * `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter, and contain only + * letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), + * tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters in + * length, and it must not start with `"goog"`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + * @deprecated Use {@link #createTopic(TopicName)} instead. + */ + @Deprecated + public final Topic createTopic(ProjectTopicName name) { + Topic request = Topic.newBuilder().setName(name == null ? null : name.toString()).build(); + return createTopic(request); + } +""" + +CREATE_TOPIC_PREVIOUS = r'(\s+public final Topic createTopic\(String name\) {\n\s+.*\n\s+return.*\n\s+})' + +DELETE_TOPIC = """ + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the topic with the given name. Returns `NOT_FOUND` if the topic does not exist. After a + * topic is deleted, a new topic may be created with the same name; this is an entirely new topic + * with none of the old configuration or subscriptions. Existing subscriptions to this topic are + * not deleted, but their `topic` field is set to `_deleted-topic_`. + * + *

    Sample code: + * + *

    
    +   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    +   *   ProjectTopicName topic = ProjectTopicName.of("[PROJECT]", "[TOPIC]");
    +   *   topicAdminClient.deleteTopic(topic);
    +   * }
    +   * 
    + * + * @param topic Required. Name of the topic to delete. Format is + * `projects/{project}/topics/{topic}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + * @deprecated Use {@link #deleteTopic(TopicName)} instead. + */ + @Deprecated + public final void deleteTopic(ProjectTopicName topic) { + DeleteTopicRequest request = + DeleteTopicRequest.newBuilder().setTopic(topic == null ? null : topic.toString()).build(); + deleteTopic(request); + } +""" + +GET_TOPIC_PREVIOUS = r'(\s+public final Topic getTopic\(String topic\) {\n\s+.*\n\s+return.*\n\s+})' + +GET_TOPIC = """ + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets the configuration of a topic. + * + *

    Sample code: + * + *

    
    +   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    +   *   ProjectTopicName topic = ProjectTopicName.of("[PROJECT]", "[TOPIC]");
    +   *   Topic response = topicAdminClient.getTopic(topic);
    +   * }
    +   * 
    + * + * @param topic Required. The name of the topic to get. Format is + * `projects/{project}/topics/{topic}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + * @deprecated Use {@link #getTopic(TopicName)} instead. + */ + @Deprecated + public final Topic getTopic(ProjectTopicName topic) { + GetTopicRequest request = + GetTopicRequest.newBuilder().setTopic(topic == null ? null : topic.toString()).build(); + return getTopic(request); + } +""" + +DELETE_TOPIC_PREVIOUS = r'(\s+public final void deleteTopic\(String topic\) {\n\s+.*\n\s+deleteTopic.*\n\s+})' + +LIST_TOPIC_SUBSCRIPTIONS = """ + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists the names of the subscriptions on this topic. + * + *

    Sample code: + * + *

    
    +   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    +   *   ProjectTopicName topic = ProjectTopicName.of("[PROJECT]", "[TOPIC]");
    +   *   for (ProjectSubscriptionName element : topicAdminClient.listTopicSubscriptions(topic).iterateAllAsProjectSubscriptionName()) {
    +   *     // doThingsWith(element);
    +   *   }
    +   * }
    +   * 
    + * + * @param topic Required. The name of the topic that subscriptions are attached to. Format is + * `projects/{project}/topics/{topic}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + * @deprecated Use {@link #listTopicSubscriptions(TopicName)} instead. + */ + @Deprecated + public final ListTopicSubscriptionsPagedResponse listTopicSubscriptions(ProjectTopicName topic) { + ListTopicSubscriptionsRequest request = + ListTopicSubscriptionsRequest.newBuilder() + .setTopic(topic == null ? null : topic.toString()) + .build(); + return listTopicSubscriptions(request); + } +""" + +LIST_TOPIC_SUBSCRIPTIONS_PREVIOUS = r'(\s+public final ListTopicSubscriptionsPagedResponse listTopicSubscriptions\(String topic\) {\n\s+.*\n\s+.*\n\s+return.*\n\s+})' + +CREATE_SUBSCRIPTION_PREVIOUS = r'(\s+public final Subscription createSubscription\(Subscription request\) {\n\s+return.*\n\s+})' + +CREATE_SUBSCRIPTION = """ + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a subscription to a given topic. See the <a + * href="https://cloud.google.com/pubsub/docs/admin#resource_names"> resource name + * rules</a>. If the subscription already exists, returns `ALREADY_EXISTS`. If the + * corresponding topic doesn't exist, returns `NOT_FOUND`. + * + *

    If the name is not provided in the request, the server will assign a random name for this + * subscription on the same project as the topic, conforming to the [resource name + * format](https://cloud.google.com/pubsub/docs/admin#resource_names). The generated name is + * populated in the returned Subscription object. Note that for REST API requests, you must + * specify a name in the request. + * + *

    Sample code: + * + *

    
    +   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    +   *   ProjectSubscriptionName name = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
    +   *   ProjectTopicName topic = ProjectTopicName.of("[PROJECT]", "[TOPIC]");
    +   *   PushConfig pushConfig = PushConfig.newBuilder().build();
    +   *   int ackDeadlineSeconds = 0;
    +   *   Subscription response = subscriptionAdminClient.createSubscription(name, topic, pushConfig, ackDeadlineSeconds);
    +   * }
    +   * 
    + * + * @param name Required. The name of the subscription. It must have the format + * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must start with a + * letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores + * (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 + * and 255 characters in length, and it must not start with `"goog"`. + * @param topic Required. The name of the topic from which this subscription is receiving + * messages. Format is `projects/{project}/topics/{topic}`. The value of this field will be + * `_deleted-topic_` if the topic has been deleted. + * @param pushConfig If push delivery is used with this subscription, this field is used to + * configure it. An empty `pushConfig` signifies that the subscriber will pull and ack + * messages using API methods. + * @param ackDeadlineSeconds The approximate amount of time (on a best-effort basis) Pub/Sub waits + * for the subscriber to acknowledge receipt before resending the message. In the interval + * after the message is delivered and before it is acknowledged, it is considered to be + * <i>outstanding</i>. During that time period, the message will not be + * redelivered (on a best-effort basis). + *

    For pull subscriptions, this value is used as the initial value for the ack deadline. To + * override this value for a given message, call `ModifyAckDeadline` with the corresponding + * `ack_id` if using non-streaming pull or send the `ack_id` in a + * `StreamingModifyAckDeadlineRequest` if using streaming pull. The minimum custom deadline + * you can specify is 10 seconds. The maximum custom deadline you can specify is 600 seconds + * (10 minutes). If this parameter is 0, a default value of 10 seconds is used. + *

    For push delivery, this value is also used to set the request timeout for the call to + * the push endpoint. + *

    If the subscriber never acknowledges the message, the Pub/Sub system will eventually + * redeliver the message. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + * @deprecated Use {@link #createSubscription(SubscriptionName, TopicName, PushConfig, int)} instead. + */ + @Deprecated + public final Subscription createSubscription( + ProjectSubscriptionName name, + ProjectTopicName topic, + PushConfig pushConfig, + int ackDeadlineSeconds) { + Subscription request = + Subscription.newBuilder() + .setName(name == null ? null : name.toString()) + .setTopic(topic == null ? null : topic.toString()) + .setPushConfig(pushConfig) + .setAckDeadlineSeconds(ackDeadlineSeconds) + .build(); + return createSubscription(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a subscription to a given topic. See the [resource name rules] + * (https://cloud.google.com/pubsub/docs/admin#resource_names). If the subscription already + * exists, returns `ALREADY_EXISTS`. If the corresponding topic doesn't exist, returns + * `NOT_FOUND`. + * + *

    If the name is not provided in the request, the server will assign a random name for this + * subscription on the same project as the topic, conforming to the [resource name format] + * (https://cloud.google.com/pubsub/docs/admin#resource_names). The generated name is populated in + * the returned Subscription object. Note that for REST API requests, you must specify a name in + * the request. + * + *

    Sample code: + * + *

    {@code
    +   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    +   *   ProjectSubscriptionName name = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
    +   *   String topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString();
    +   *   PushConfig pushConfig = PushConfig.newBuilder().build();
    +   *   int ackDeadlineSeconds = 2135351438;
    +   *   Subscription response =
    +   *       subscriptionAdminClient.createSubscription(name, topic, pushConfig, ackDeadlineSeconds);
    +   * }
    +   * }
    + * + * @param name Required. The name of the subscription. It must have the format + * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must start with a + * letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores + * (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 + * and 255 characters in length, and it must not start with `"goog"`. + * @param topic Required. The name of the topic from which this subscription is receiving + * messages. Format is `projects/{project}/topics/{topic}`. The value of this field will be + * `_deleted-topic_` if the topic has been deleted. + * @param pushConfig If push delivery is used with this subscription, this field is used to + * configure it. An empty `pushConfig` signifies that the subscriber will pull and ack + * messages using API methods. + * @param ackDeadlineSeconds The approximate amount of time (on a best-effort basis) Pub/Sub waits + * for the subscriber to acknowledge receipt before resending the message. In the interval + * after the message is delivered and before it is acknowledged, it is considered to be + * <i>outstanding</i>. During that time period, the message will not be + * redelivered (on a best-effort basis). + *

    For pull subscriptions, this value is used as the initial value for the ack deadline. To + * override this value for a given message, call `ModifyAckDeadline` with the corresponding + * `ack_id` if using non-streaming pull or send the `ack_id` in a + * `StreamingModifyAckDeadlineRequest` if using streaming pull. The minimum custom deadline + * you can specify is 10 seconds. The maximum custom deadline you can specify is 600 seconds + * (10 minutes). If this parameter is 0, a default value of 10 seconds is used. + *

    For push delivery, this value is also used to set the request timeout for the call to + * the push endpoint. + *

    If the subscriber never acknowledges the message, the Pub/Sub system will eventually + * redeliver the message. + * @deprecated Use {@link #createSubscription(SubscriptionName, String, PushConfig, int)} instead. + */ + @Deprecated + public final Subscription createSubscription( + ProjectSubscriptionName name, String topic, PushConfig pushConfig, int ackDeadlineSeconds) { + Subscription request = + Subscription.newBuilder() + .setName(name == null ? null : name.toString()) + .setTopic(topic) + .setPushConfig(pushConfig) + .setAckDeadlineSeconds(ackDeadlineSeconds) + .build(); + return createSubscription(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a subscription to a given topic. See the [resource name rules] + * (https://cloud.google.com/pubsub/docs/admin#resource_names). If the subscription already + * exists, returns `ALREADY_EXISTS`. If the corresponding topic doesn't exist, returns + * `NOT_FOUND`. + * + *

    If the name is not provided in the request, the server will assign a random name for this + * subscription on the same project as the topic, conforming to the [resource name format] + * (https://cloud.google.com/pubsub/docs/admin#resource_names). The generated name is populated in + * the returned Subscription object. Note that for REST API requests, you must specify a name in + * the request. + * + *

    Sample code: + * + *

    {@code
    +   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    +   *   ProjectSubscriptionName name = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
    +   *   TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
    +   *   PushConfig pushConfig = PushConfig.newBuilder().build();
    +   *   int ackDeadlineSeconds = 2135351438;
    +   *   Subscription response =
    +   *       subscriptionAdminClient.createSubscription(name, topic, pushConfig, ackDeadlineSeconds);
    +   * }
    +   * }
    + * + * @param name Required. The name of the subscription. It must have the format + * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must start with a + * letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores + * (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 + * and 255 characters in length, and it must not start with `"goog"`. + * @param topic Required. The name of the topic from which this subscription is receiving + * messages. Format is `projects/{project}/topics/{topic}`. The value of this field will be + * `_deleted-topic_` if the topic has been deleted. + * @param pushConfig If push delivery is used with this subscription, this field is used to + * configure it. An empty `pushConfig` signifies that the subscriber will pull and ack + * messages using API methods. + * @param ackDeadlineSeconds The approximate amount of time (on a best-effort basis) Pub/Sub waits + * for the subscriber to acknowledge receipt before resending the message. In the interval + * after the message is delivered and before it is acknowledged, it is considered to be + * <i>outstanding</i>. During that time period, the message will not be + * redelivered (on a best-effort basis). + *

    For pull subscriptions, this value is used as the initial value for the ack deadline. To + * override this value for a given message, call `ModifyAckDeadline` with the corresponding + * `ack_id` if using non-streaming pull or send the `ack_id` in a + * `StreamingModifyAckDeadlineRequest` if using streaming pull. The minimum custom deadline + * you can specify is 10 seconds. The maximum custom deadline you can specify is 600 seconds + * (10 minutes). If this parameter is 0, a default value of 10 seconds is used. + *

    For push delivery, this value is also used to set the request timeout for the call to + * the push endpoint. + *

    If the subscriber never acknowledges the message, the Pub/Sub system will eventually + * redeliver the message. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + * @deprecated Use {@link #createSubscription(SubscriptionName, TopicName, PushConfig, int)} instead. + */ + @Deprecated + public final Subscription createSubscription( + ProjectSubscriptionName name, + TopicName topic, + PushConfig pushConfig, + int ackDeadlineSeconds) { + Subscription request = + Subscription.newBuilder() + .setName(name == null ? null : name.toString()) + .setTopic(topic == null ? null : topic.toString()) + .setPushConfig(pushConfig) + .setAckDeadlineSeconds(ackDeadlineSeconds) + .build(); + return createSubscription(request); + } +""" + +GET_SUBSCRIPTION_PREVIOUS = r'(\s+public final Subscription getSubscription\(GetSubscriptionRequest request\) {\n\s+return.*\n\s+})' + +GET_SUBSCRIPTION = """ + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets the configuration details of a subscription. + * + *

    Sample code: + * + *

    {@code
    +   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    +   *   ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
    +   *   Subscription response = subscriptionAdminClient.getSubscription(subscription);
    +   * }
    +   * }
    + * + * @param subscription Required. The name of the subscription to get. Format is + * `projects/{project}/subscriptions/{sub}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + * @deprecated Use {@link #getSubscription(SubscriptionName)} instead. + */ + @Deprecated + public final Subscription getSubscription(ProjectSubscriptionName subscription) { + GetSubscriptionRequest request = + GetSubscriptionRequest.newBuilder() + .setSubscription(subscription == null ? null : subscription.toString()) + .build(); + return getSubscription(request); + } +""" + +DELETE_SUBSCRIPTION_PREVIOUS = r'(\s+public final void deleteSubscription\(DeleteSubscriptionRequest request\) {\n\s+deleteSubscription.*\n\s+})' + +DELETE_SUBSCRIPTION = """ + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes an existing subscription. All messages retained in the subscription are immediately + * dropped. Calls to `Pull` after deletion will return `NOT_FOUND`. After a subscription is + * deleted, a new one may be created with the same name, but the new one has no association with + * the old subscription or its topic unless the same topic is specified. + * + *

    Sample code: + * + *

    {@code
    +   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    +   *   ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
    +   *   subscriptionAdminClient.deleteSubscription(subscription);
    +   * }
    +   * }
    + * + * @param subscription Required. The subscription to delete. Format is + * `projects/{project}/subscriptions/{sub}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + * @deprecated Use {@link #deleteSubscription(SubscriptionName)} instead. + */ + @Deprecated + public final void deleteSubscription(ProjectSubscriptionName subscription) { + DeleteSubscriptionRequest request = + DeleteSubscriptionRequest.newBuilder() + .setSubscription(subscription == null ? null : subscription.toString()) + .build(); + deleteSubscription(request); + } +""" + +MODIFY_ACK_DEADLINE_PREVIOUS = r'(\s+public final void modifyAckDeadline\(ModifyAckDeadlineRequest request\) {\n\s+modifyAckDeadline.*\n\s+})' + +MODIFY_ACK_DEADLINE = """ + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Modifies the ack deadline for a specific message. This method is useful to indicate that more + * time is needed to process a message by the subscriber, or to make the message available for + * redelivery if the processing was interrupted. Note that this does not modify the + * subscription-level `ackDeadlineSeconds` used for subsequent messages. + * + *

    Sample code: + * + *

    {@code
    +   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    +   *   ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
    +   *   List ackIds = new ArrayList<>();
    +   *   int ackDeadlineSeconds = 2135351438;
    +   *   subscriptionAdminClient.modifyAckDeadline(subscription, ackIds, ackDeadlineSeconds);
    +   * }
    +   * }
    + * + * @param subscription Required. The name of the subscription. Format is + * `projects/{project}/subscriptions/{sub}`. + * @param ackIds Required. List of acknowledgment IDs. + * @param ackDeadlineSeconds Required. The new ack deadline with respect to the time this request + * was sent to the Pub/Sub system. For example, if the value is 10, the new ack deadline will + * expire 10 seconds after the `ModifyAckDeadline` call was made. Specifying zero might + * immediately make the message available for delivery to another subscriber client. This + * typically results in an increase in the rate of message redeliveries (that is, duplicates). + * The minimum deadline you can specify is 0 seconds. The maximum deadline you can specify is + * 600 seconds (10 minutes). + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + * @deprecated Use {@link #modifyAckDeadline(SubscriptionName, List, int)} instead. + */ + @Deprecated + final void modifyAckDeadline( + ProjectSubscriptionName subscription, List ackIds, int ackDeadlineSeconds) { + ModifyAckDeadlineRequest request = + ModifyAckDeadlineRequest.newBuilder() + .setSubscription(subscription == null ? null : subscription.toString()) + .addAllAckIds(ackIds) + .setAckDeadlineSeconds(ackDeadlineSeconds) + .build(); + modifyAckDeadline(request); + } +""" + +ACKNOWLEDGE_PREVIOUS = r'(\s+public final void acknowledge\(AcknowledgeRequest request\) {\n\s+acknowledge.*\n\s+})' + +ACKNOWLEDGE = """ + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Acknowledges the messages associated with the `ack_ids` in the `AcknowledgeRequest`. The + * Pub/Sub system can remove the relevant messages from the subscription. + * + *

    Acknowledging a message whose ack deadline has expired may succeed, but such a message may + * be redelivered later. Acknowledging a message more than once will not result in an error. + * + *

    Sample code: + * + *

    {@code
    +   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    +   *   ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
    +   *   List ackIds = new ArrayList<>();
    +   *   subscriptionAdminClient.acknowledge(subscription, ackIds);
    +   * }
    +   * }
    + * + * @param subscription Required. The subscription whose message is being acknowledged. Format is + * `projects/{project}/subscriptions/{sub}`. + * @param ackIds Required. The acknowledgment ID for the messages being acknowledged that was + * returned by the Pub/Sub system in the `Pull` response. Must not be empty. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + * @deprecated Use {@link #acknowledge(SubscriptionName, List)} instead. + */ + @Deprecated + public final void acknowledge(ProjectSubscriptionName subscription, List ackIds) { + AcknowledgeRequest request = + AcknowledgeRequest.newBuilder() + .setSubscription(subscription == null ? null : subscription.toString()) + .addAllAckIds(ackIds) + .build(); + acknowledge(request); + } +""" + +PULL_PREVIOUS = r'(\s+public final PullResponse pull\(PullRequest request\) {\n\s+return.*\n\s+})' + +PULL = """ + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Pulls messages from the server. The server may return `UNAVAILABLE` if there are too many + * concurrent pull requests pending for the given subscription. + * + *

    Sample code: + * + *

    {@code
    +   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    +   *   ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
    +   *   int maxMessages = 496131527;
    +   *   PullResponse response = subscriptionAdminClient.pull(subscription, maxMessages);
    +   * }
    +   * }
    + * + * @param subscription Required. The subscription from which messages should be pulled. Format is + * `projects/{project}/subscriptions/{sub}`. + * @param maxMessages Required. The maximum number of messages to return for this request. Must be + * a positive integer. The Pub/Sub system may return fewer than the number specified. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + * @deprecated Use {@link #pull(SubscriptionName, int)} instead. + */ + @Deprecated + public final PullResponse pull(ProjectSubscriptionName subscription, int maxMessages) { + PullRequest request = + PullRequest.newBuilder() + .setSubscription(subscription == null ? null : subscription.toString()) + .setMaxMessages(maxMessages) + .build(); + return pull(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Pulls messages from the server. The server may return `UNAVAILABLE` if there are too many + * concurrent pull requests pending for the given subscription. + * + *

    Sample code: + * + *

    {@code
    +   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    +   *   ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
    +   *   boolean returnImmediately = true;
    +   *   int maxMessages = 496131527;
    +   *   PullResponse response =
    +   *       subscriptionAdminClient.pull(subscription, returnImmediately, maxMessages);
    +   * }
    +   * }
    + * + * @param subscription Required. The subscription from which messages should be pulled. Format is + * `projects/{project}/subscriptions/{sub}`. + * @param returnImmediately Optional. If this field set to true, the system will respond + * immediately even if it there are no messages available to return in the `Pull` response. + * Otherwise, the system may wait (for a bounded amount of time) until at least one message is + * available, rather than returning no messages. Warning: setting this field to `true` is + * discouraged because it adversely impacts the performance of `Pull` operations. We recommend + * that users do not set this field. + * @param maxMessages Required. The maximum number of messages to return for this request. Must be + * a positive integer. The Pub/Sub system may return fewer than the number specified. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + * @deprecated Use {@link #pull(SubscriptionName, boolean, int)} instead. + */ + @Deprecated + final PullResponse pull( + ProjectSubscriptionName subscription, boolean returnImmediately, int maxMessages) { + PullRequest request = + PullRequest.newBuilder() + .setSubscription(subscription == null ? null : subscription.toString()) + .setReturnImmediately(returnImmediately) + .setMaxMessages(maxMessages) + .build(); + return pull(request); + } +""" + +MODIFY_PUSH_CONFIG_PREVIOUS = r'(\s+public final void modifyPushConfig\(ModifyPushConfigRequest request\) {\n\s+modifyPushConfig.*\n\s+})' + +MODIFY_PUSH_CONFIG = """ + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Modifies the `PushConfig` for a specified subscription. + * + *

    This may be used to change a push subscription to a pull one (signified by an empty + * `PushConfig`) or vice versa, or change the endpoint URL and other attributes of a push + * subscription. Messages will accumulate for delivery continuously through the call regardless of + * changes to the `PushConfig`. + * + *

    Sample code: + * + *

    {@code
    +   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    +   *   ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
    +   *   PushConfig pushConfig = PushConfig.newBuilder().build();
    +   *   subscriptionAdminClient.modifyPushConfig(subscription, pushConfig);
    +   * }
    +   * }
    + * + * @param subscription Required. The name of the subscription. Format is + * `projects/{project}/subscriptions/{sub}`. + * @param pushConfig Required. The push configuration for future deliveries. + *

    An empty `pushConfig` indicates that the Pub/Sub system should stop pushing messages + * from the given subscription and allow messages to be pulled and acknowledged - effectively + * pausing the subscription if `Pull` or `StreamingPull` is not called. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + * @deprecated Use {@link #modifyPushConfig(SubscriptionName, PushConfig)} instead. + */ + @Deprecated + public final void modifyPushConfig(ProjectSubscriptionName subscription, PushConfig pushConfig) { + ModifyPushConfigRequest request = + ModifyPushConfigRequest.newBuilder() + .setSubscription(subscription == null ? null : subscription.toString()) + .setPushConfig(pushConfig) + .build(); + modifyPushConfig(request); + } +""" + +CREATE_SNAPSHOT_PREVIOUS = r'(\s+public final Snapshot createSnapshot\(CreateSnapshotRequest request\) {\n\s+return.*\n\s+})' + +CREATE_SNAPSHOT = """ + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a snapshot from the requested subscription. Snapshots are used in + * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to + * manage message acknowledgments in bulk. That is, you can set the acknowledgment state of + * messages in an existing subscription to the state captured by a snapshot. If the snapshot + * already exists, returns `ALREADY_EXISTS`. If the requested subscription doesn't exist, returns + * `NOT_FOUND`. If the backlog in the subscription is too old -- and the resulting snapshot would + * expire in less than 1 hour -- then `FAILED_PRECONDITION` is returned. See also the + * `Snapshot.expire_time` field. If the name is not provided in the request, the server will + * assign a random name for this snapshot on the same project as the subscription, conforming to + * the [resource name format] (https://cloud.google.com/pubsub/docs/admin#resource_names). The + * generated name is populated in the returned Snapshot object. Note that for REST API requests, + * you must specify a name in the request. + * + *

    Sample code: + * + *

    {@code
    +   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    +   *   ProjectSnapshotName name = ProjectSnapshotName.of("[PROJECT]", "[SNAPSHOT]");
    +   *   ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
    +   *   Snapshot response = subscriptionAdminClient.createSnapshot(name, subscription);
    +   * }
    +   * }
    + * + * @param name Required. User-provided name for this snapshot. If the name is not provided in the + * request, the server will assign a random name for this snapshot on the same project as the + * subscription. Note that for REST API requests, you must specify a name. See the <a + * href="https://cloud.google.com/pubsub/docs/admin#resource_names"> resource name + * rules</a>. Format is `projects/{project}/snapshots/{snap}`. + * @param subscription Required. The subscription whose backlog the snapshot retains. + * Specifically, the created snapshot is guaranteed to retain: (a) The existing backlog on the + * subscription. More precisely, this is defined as the messages in the subscription's backlog + * that are unacknowledged upon the successful completion of the `CreateSnapshot` request; as + * well as: (b) Any messages published to the subscription's topic following the successful + * completion of the CreateSnapshot request. Format is + * `projects/{project}/subscriptions/{sub}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + * @deprecated Use Use {@link #createSnapshot(SnapshotName, SubscriptionName)} instead. + */ + @Deprecated + public final Snapshot createSnapshot( + ProjectSnapshotName name, ProjectSubscriptionName subscription) { + CreateSnapshotRequest request = + CreateSnapshotRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .setSubscription(subscription == null ? null : subscription.toString()) + .build(); + return createSnapshot(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a snapshot from the requested subscription. Snapshots are used in + * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to + * manage message acknowledgments in bulk. That is, you can set the acknowledgment state of + * messages in an existing subscription to the state captured by a snapshot. If the snapshot + * already exists, returns `ALREADY_EXISTS`. If the requested subscription doesn't exist, returns + * `NOT_FOUND`. If the backlog in the subscription is too old -- and the resulting snapshot would + * expire in less than 1 hour -- then `FAILED_PRECONDITION` is returned. See also the + * `Snapshot.expire_time` field. If the name is not provided in the request, the server will + * assign a random name for this snapshot on the same project as the subscription, conforming to + * the [resource name format] (https://cloud.google.com/pubsub/docs/admin#resource_names). The + * generated name is populated in the returned Snapshot object. Note that for REST API requests, + * you must specify a name in the request. + * + *

    Sample code: + * + *

    {@code
    +   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    +   *   String name = ProjectSnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString();
    +   *   ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
    +   *   Snapshot response = subscriptionAdminClient.createSnapshot(name, subscription);
    +   * }
    +   * }
    + * + * @param name Required. User-provided name for this snapshot. If the name is not provided in the + * request, the server will assign a random name for this snapshot on the same project as the + * subscription. Note that for REST API requests, you must specify a name. See the <a + * href="https://cloud.google.com/pubsub/docs/admin#resource_names"> resource name + * rules</a>. Format is `projects/{project}/snapshots/{snap}`. + * @param subscription Required. The subscription whose backlog the snapshot retains. + * Specifically, the created snapshot is guaranteed to retain: (a) The existing backlog on the + * subscription. More precisely, this is defined as the messages in the subscription's backlog + * that are unacknowledged upon the successful completion of the `CreateSnapshot` request; as + * well as: (b) Any messages published to the subscription's topic following the successful + * completion of the CreateSnapshot request. Format is + * `projects/{project}/subscriptions/{sub}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + * @deprecated Use Use {@link #createSnapshot(String, SubscriptionName)} instead. + */ + @Deprecated + public final Snapshot createSnapshot(String name, ProjectSubscriptionName subscription) { + CreateSnapshotRequest request = + CreateSnapshotRequest.newBuilder() + .setName(name) + .setSubscription(subscription == null ? null : subscription.toString()) + .build(); + return createSnapshot(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a snapshot from the requested subscription. Snapshots are used in + * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to + * manage message acknowledgments in bulk. That is, you can set the acknowledgment state of + * messages in an existing subscription to the state captured by a snapshot. If the snapshot + * already exists, returns `ALREADY_EXISTS`. If the requested subscription doesn't exist, returns + * `NOT_FOUND`. If the backlog in the subscription is too old -- and the resulting snapshot would + * expire in less than 1 hour -- then `FAILED_PRECONDITION` is returned. See also the + * `Snapshot.expire_time` field. If the name is not provided in the request, the server will + * assign a random name for this snapshot on the same project as the subscription, conforming to + * the [resource name format] (https://cloud.google.com/pubsub/docs/admin#resource_names). The + * generated name is populated in the returned Snapshot object. Note that for REST API requests, + * you must specify a name in the request. + * + *

    Sample code: + * + *

    {@code
    +   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    +   *   ProjectSnapshotName name = ProjectSnapshotName.of("[PROJECT]", "[SNAPSHOT]");
    +   *   String subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
    +   *   Snapshot response = subscriptionAdminClient.createSnapshot(name, subscription);
    +   * }
    +   * }
    + * + * @param name Required. User-provided name for this snapshot. If the name is not provided in the + * request, the server will assign a random name for this snapshot on the same project as the + * subscription. Note that for REST API requests, you must specify a name. See the <a + * href="https://cloud.google.com/pubsub/docs/admin#resource_names"> resource name + * rules</a>. Format is `projects/{project}/snapshots/{snap}`. + * @param subscription Required. The subscription whose backlog the snapshot retains. + * Specifically, the created snapshot is guaranteed to retain: (a) The existing backlog on the + * subscription. More precisely, this is defined as the messages in the subscription's backlog + * that are unacknowledged upon the successful completion of the `CreateSnapshot` request; as + * well as: (b) Any messages published to the subscription's topic following the successful + * completion of the CreateSnapshot request. Format is + * `projects/{project}/subscriptions/{sub}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + * @deprecated Use Use {@link #createSnapshot(SnapshotName, String)} instead. + */ + @Deprecated + public final Snapshot createSnapshot(ProjectSnapshotName name, String subscription) { + CreateSnapshotRequest request = + CreateSnapshotRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .setSubscription(subscription) + .build(); + return createSnapshot(request); + } +""" + +DELETE_SNAPSHOT_PREVIOUS = r'(\s+public final void deleteSnapshot\(DeleteSnapshotRequest request\) {\n\s+deleteSnapshot.*\n\s+})' + +DELETE_SNAPSHOT = """ + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Removes an existing snapshot. Snapshots are used in [Seek] + * (https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage + * message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in + * an existing subscription to the state captured by a snapshot. When the snapshot is deleted, all + * messages retained in the snapshot are immediately dropped. After a snapshot is deleted, a new + * one may be created with the same name, but the new one has no association with the old snapshot + * or its subscription, unless the same subscription is specified. + * + *

    Sample code: + * + *

    {@code
    +   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    +   *   ProjectSnapshotName snapshot = ProjectSnapshotName.of("[PROJECT]", "[SNAPSHOT]");
    +   *   subscriptionAdminClient.deleteSnapshot(snapshot);
    +   * }
    +   * }
    + * + * @param snapshot Required. The name of the snapshot to delete. Format is + * `projects/{project}/snapshots/{snap}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + * @deprecated Use Use {@link #deleteSnapshot(SnapshotName)} instead. + */ + @Deprecated + public final void deleteSnapshot(ProjectSnapshotName snapshot) { + DeleteSnapshotRequest request = + DeleteSnapshotRequest.newBuilder() + .setSnapshot(snapshot == null ? null : snapshot.toString()) + .build(); + deleteSnapshot(request); + } +""" + +GET_SNAPSHOT_PREVIOUS = r'(\s+public final Snapshot getSnapshot\(GetSnapshotRequest request\) {\n\s+return.*\n\s+})' + +GET_SNAPSHOT = """ + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets the configuration details of a snapshot. Snapshots are used in <a + * href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a> operations, which + * allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment + * state of messages in an existing subscription to the state captured by a snapshot. + * + *

    Sample code: + * + *

    {@code
    +   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    +   *   ProjectSnapshotName snapshot = ProjectSnapshotName.of("[PROJECT]", "[SNAPSHOT]");
    +   *   Snapshot response = subscriptionAdminClient.getSnapshot(snapshot);
    +   * }
    +   * }
    + * + * @param snapshot Required. The name of the snapshot to get. Format is + * `projects/{project}/snapshots/{snap}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + * @deprecated Use Use {@link #getSnapshot(SnapshotName)} instead. + */ + @Deprecated + public final Snapshot getSnapshot(ProjectSnapshotName snapshot) { + GetSnapshotRequest request = + GetSnapshotRequest.newBuilder() + .setSnapshot(snapshot == null ? null : snapshot.toString()) + .build(); + return getSnapshot(request); + } +""" + +PACKAGE = 'package com.google.cloud.pubsub.v1;' + +IMPORT_PROJECT_TOPIC_NAME = 'import com.google.pubsub.v1.ProjectTopicName;' +IMPORT_PROJECT_SUBSCRIPTION_NAME = 'import com.google.pubsub.v1.ProjectSubscriptionName;' +IMPORT_PROJECT_SNAPSHOT_NAME = 'import com.google.pubsub.v1.ProjectSnapshotName;' + +for library in s.get_staging_dirs(): + # put any special-case replacements here + s.replace( + '**/stub/SubscriberStubSettings.java', + r'setMaxInboundMessageSize\(Integer.MAX_VALUE\)', + 'setMaxInboundMessageSize(20 << 20)' + ) + + s.replace( + '**/TopicAdminClient.java', + GET_IAM_POLICY_PREVIOUS, + "\g<1>\n\n" + GET_IAM_POLICY_TOPIC + ) + + s.replace( + '**/TopicAdminClient.java', + SET_IAM_POLICY_PREVIOUS, + "\g<1>\n\n" + SET_IAM_POLICY_TOPIC + ) + + s.replace( + '**/TopicAdminClient.java', + TEST_IAM_PERMISSIONS_PREVIOUS, + "\g<1>\n\n" + TEST_IAM_PERMISSIONS_TOPIC + ) + + s.replace( + '**/SubscriptionAdminClient.java', + GET_IAM_POLICY_PREVIOUS, + "\g<1>\n\n" + GET_IAM_POLICY_SUBSCRIPTION + ) + + s.replace( + '**/SubscriptionAdminClient.java', + SET_IAM_POLICY_PREVIOUS, + "\g<1>\n\n" + SET_IAM_POLICY_SUBSCRIPTION + ) + + s.replace( + '**/SubscriptionAdminClient.java', + TEST_IAM_PERMISSIONS_PREVIOUS, + "\g<1>\n\n" + TEST_IAM_PERMISSIONS_SUBSCRIPTION + ) + + s.replace( + '**/TopicAdminClient.java', + CREATE_TOPIC_PREVIOUS, + "\g<1>\n\n" + CREATE_TOPIC + ) + + s.replace( + '**/TopicAdminClient.java', + DELETE_TOPIC_PREVIOUS, + "\g<1>\n\n" + DELETE_TOPIC + ) + + s.replace( + '**/TopicAdminClient.java', + LIST_TOPIC_SUBSCRIPTIONS_PREVIOUS, + "\g<1>\n\n" + LIST_TOPIC_SUBSCRIPTIONS + ) + + s.replace( + '**/TopicAdminClient.java', + GET_TOPIC_PREVIOUS, + "\g<1>\n\n" + GET_TOPIC + ) + + s.replace( + '**/SubscriptionAdminClient.java', + CREATE_SUBSCRIPTION_PREVIOUS, + "\g<1>\n\n" + CREATE_SUBSCRIPTION + ) + + s.replace( + '**/SubscriptionAdminClient.java', + DELETE_SUBSCRIPTION_PREVIOUS, + "\g<1>\n\n" + DELETE_SUBSCRIPTION + ) + + s.replace( + '**/SubscriptionAdminClient.java', + GET_SUBSCRIPTION_PREVIOUS, + "\g<1>\n\n" + GET_SUBSCRIPTION + ) + + s.replace( + '**/SubscriptionAdminClient.java', + MODIFY_ACK_DEADLINE_PREVIOUS, + "\g<1>\n\n" + MODIFY_ACK_DEADLINE + ) + + s.replace( + '**/SubscriptionAdminClient.java', + ACKNOWLEDGE_PREVIOUS, + "\g<1>\n\n" + ACKNOWLEDGE + ) + + s.replace( + '**/SubscriptionAdminClient.java', + PULL_PREVIOUS, + "\g<1>\n\n" + PULL + ) + + s.replace( + '**/SubscriptionAdminClient.java', + MODIFY_PUSH_CONFIG_PREVIOUS, + "\g<1>\n\n" + MODIFY_PUSH_CONFIG + ) + + s.replace( + '**/SubscriptionAdminClient.java', + CREATE_SNAPSHOT_PREVIOUS, + "\g<1>\n\n" + CREATE_SNAPSHOT + ) + + s.replace( + '**/SubscriptionAdminClient.java', + GET_SNAPSHOT_PREVIOUS, + "\g<1>\n\n" + GET_SNAPSHOT + ) + + s.replace( + '**/SubscriptionAdminClient.java', + DELETE_SNAPSHOT_PREVIOUS, + "\g<1>\n\n" + DELETE_SNAPSHOT + ) + + s.replace( + '**/*AdminClient.java', + PACKAGE, + PACKAGE + '\n\n' + IMPORT_PROJECT_TOPIC_NAME + '\n' + IMPORT_PROJECT_SUBSCRIPTION_NAME + '\n' + IMPORT_PROJECT_SNAPSHOT_NAME + '\n' + ) + + s.move(library) + +s.remove_staging_dirs() +java.common_templates( + excludes=[ + ".github/workflows/samples.yaml", + ".kokoro/build.sh", + ".github/sync-repo-settings.yaml", + ".github/blunderbuss.yml", + '.kokoro/requirements.in', + '.kokoro/requirements.txt', + '.kokoro/presubmit/graalvm-native.cfg', + '.kokoro/presubmit/graalvm-native-17.cfg' + ] +) diff --git a/pom.xml b/pom.xml index 33d58e800..8d7ea2816 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-pubsub-parent pom - 1.111.5-SNAPSHOT + 1.150.3-SNAPSHOT Google Cloud Pub/Sub Parent https://github.com/googleapis/java-pubsub @@ -13,8 +13,8 @@ com.google.cloud - google-cloud-shared-config - 0.11.0 + sdk-platform-java-config + 3.62.0 @@ -41,16 +41,7 @@ https://github.com/googleapis/java-pubsub/issues GitHub Issues - - - sonatype-nexus-snapshots - https://oss.sonatype.org/content/repositories/snapshots - - - sonatype-nexus-staging - https://oss.sonatype.org/service/local/staging/deploy/maven2/ - - + Apache-2.0 @@ -70,7 +61,7 @@ com.google.cloud google-cloud-shared-dependencies - 0.20.1 + ${google-cloud-shared-dependencies.version} pom import @@ -78,26 +69,26 @@ com.google.api.grpc proto-google-cloud-pubsub-v1 - 1.93.5-SNAPSHOT + 1.132.3-SNAPSHOT com.google.api.grpc grpc-google-cloud-pubsub-v1 - 1.93.5-SNAPSHOT + 1.132.3-SNAPSHOT com.google.cloud google-cloud-pubsub - 1.111.5-SNAPSHOT + 1.150.3-SNAPSHOT + - com.google.errorprone - error_prone_annotations - 2.5.1 + org.mockito + mockito-core + 4.11.0 + test - - junit junit @@ -107,13 +98,25 @@ org.easymock easymock - 4.2 + 5.6.0 test com.google.truth truth - 1.1.2 + 1.4.5 + test + + + org.checkerframework + checker-qual + + + + + org.assertj + assertj-core + 3.27.7 test
    @@ -137,9 +140,9 @@ - proto-google-cloud-pubsub-v1 - grpc-google-cloud-pubsub-v1 google-cloud-pubsub + grpc-google-cloud-pubsub-v1 + proto-google-cloud-pubsub-v1 google-cloud-pubsub-bom @@ -148,7 +151,7 @@ org.apache.maven.plugins maven-project-info-reports-plugin - 3.1.1 + 3.9.0 @@ -175,7 +178,6 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.2.0 html @@ -212,4 +214,4 @@ - \ No newline at end of file + diff --git a/proto-google-cloud-pubsub-v1/clirr-ignored-differences.xml b/proto-google-cloud-pubsub-v1/clirr-ignored-differences.xml index da90cd601..75ea618ea 100644 --- a/proto-google-cloud-pubsub-v1/clirr-ignored-differences.xml +++ b/proto-google-cloud-pubsub-v1/clirr-ignored-differences.xml @@ -16,14 +16,66 @@ com/google/pubsub/v1/*OrBuilder boolean has*(*) + + - 7002 - com/google/pubsub/v1/TopicName - java.util.List toStrings(*) + 7006 + com/google/pubsub/v1/** + * getDefaultInstanceForType() + ** - 7002 - com/google/pubsub/v1/TopicName - java.util.List parse(*) + 7006 + com/google/pubsub/v1/** + * addRepeatedField(*) + ** + + + 7006 + com/google/pubsub/v1/** + * clear() + ** + + + 7006 + com/google/pubsub/v1/** + * clearField(*) + ** + + + 7006 + com/google/pubsub/v1/** + * clearOneof(*) + ** + + + 7006 + com/google/pubsub/v1/** + * clone() + ** + + + 7006 + com/google/pubsub/v1/** + * mergeUnknownFields(*) + ** + + + 7006 + com/google/pubsub/v1/** + * setField(*) + ** + + + 7006 + com/google/pubsub/v1/** + * setRepeatedField(*) + ** + + + 7006 + com/google/pubsub/v1/** + * setUnknownFields(*) + ** diff --git a/proto-google-cloud-pubsub-v1/pom.xml b/proto-google-cloud-pubsub-v1/pom.xml index 1a6ae53cc..3588ea34e 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.93.5-SNAPSHOT + 1.132.3-SNAPSHOT proto-google-cloud-pubsub-v1 PROTO library for proto-google-cloud-pubsub-v1 com.google.cloud google-cloud-pubsub-parent - 1.111.5-SNAPSHOT + 1.150.3-SNAPSHOT diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/AIInference.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/AIInference.java new file mode 100644 index 000000000..deb2dbafd --- /dev/null +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/AIInference.java @@ -0,0 +1,2019 @@ +/* + * Copyright 2026 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 + +package com.google.pubsub.v1; + +/** + * + * + *
    + * Configuration for making inference requests against Vertex AI models.
    + * 
    + * + * Protobuf type {@code google.pubsub.v1.AIInference} + */ +@com.google.protobuf.Generated +public final class AIInference extends com.google.protobuf.GeneratedMessage + implements + // @@protoc_insertion_point(message_implements:google.pubsub.v1.AIInference) + AIInferenceOrBuilder { + private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "AIInference"); + } + + // Use AIInference.newBuilder() to construct. + private AIInference(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + + private AIInference() { + endpoint_ = ""; + serviceAccountEmail_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto.internal_static_google_pubsub_v1_AIInference_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_AIInference_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.AIInference.class, com.google.pubsub.v1.AIInference.Builder.class); + } + + public interface UnstructuredInferenceOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.pubsub.v1.AIInference.UnstructuredInference) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
    +     * Optional. A parameters object to be included in each inference request.
    +     * The parameters object is combined with the data field of the Pub/Sub
    +     * message to form the inference request.
    +     * 
    + * + * .google.protobuf.Struct parameters = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the parameters field is set. + */ + boolean hasParameters(); + + /** + * + * + *
    +     * Optional. A parameters object to be included in each inference request.
    +     * The parameters object is combined with the data field of the Pub/Sub
    +     * message to form the inference request.
    +     * 
    + * + * .google.protobuf.Struct parameters = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The parameters. + */ + com.google.protobuf.Struct getParameters(); + + /** + * + * + *
    +     * Optional. A parameters object to be included in each inference request.
    +     * The parameters object is combined with the data field of the Pub/Sub
    +     * message to form the inference request.
    +     * 
    + * + * .google.protobuf.Struct parameters = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.protobuf.StructOrBuilder getParametersOrBuilder(); + } + + /** + * + * + *
    +   * Configuration for making inferences using arbitrary JSON payloads.
    +   * 
    + * + * Protobuf type {@code google.pubsub.v1.AIInference.UnstructuredInference} + */ + public static final class UnstructuredInference extends com.google.protobuf.GeneratedMessage + implements + // @@protoc_insertion_point(message_implements:google.pubsub.v1.AIInference.UnstructuredInference) + UnstructuredInferenceOrBuilder { + private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "UnstructuredInference"); + } + + // Use UnstructuredInference.newBuilder() to construct. + private UnstructuredInference(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + + private UnstructuredInference() {} + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_AIInference_UnstructuredInference_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_AIInference_UnstructuredInference_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.AIInference.UnstructuredInference.class, + com.google.pubsub.v1.AIInference.UnstructuredInference.Builder.class); + } + + private int bitField0_; + public static final int PARAMETERS_FIELD_NUMBER = 1; + private com.google.protobuf.Struct parameters_; + + /** + * + * + *
    +     * Optional. A parameters object to be included in each inference request.
    +     * The parameters object is combined with the data field of the Pub/Sub
    +     * message to form the inference request.
    +     * 
    + * + * .google.protobuf.Struct parameters = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the parameters field is set. + */ + @java.lang.Override + public boolean hasParameters() { + return ((bitField0_ & 0x00000001) != 0); + } + + /** + * + * + *
    +     * Optional. A parameters object to be included in each inference request.
    +     * The parameters object is combined with the data field of the Pub/Sub
    +     * message to form the inference request.
    +     * 
    + * + * .google.protobuf.Struct parameters = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The parameters. + */ + @java.lang.Override + public com.google.protobuf.Struct getParameters() { + return parameters_ == null ? com.google.protobuf.Struct.getDefaultInstance() : parameters_; + } + + /** + * + * + *
    +     * Optional. A parameters object to be included in each inference request.
    +     * The parameters object is combined with the data field of the Pub/Sub
    +     * message to form the inference request.
    +     * 
    + * + * .google.protobuf.Struct parameters = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.protobuf.StructOrBuilder getParametersOrBuilder() { + return parameters_ == null ? com.google.protobuf.Struct.getDefaultInstance() : parameters_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(1, getParameters()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getParameters()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.pubsub.v1.AIInference.UnstructuredInference)) { + return super.equals(obj); + } + com.google.pubsub.v1.AIInference.UnstructuredInference other = + (com.google.pubsub.v1.AIInference.UnstructuredInference) obj; + + if (hasParameters() != other.hasParameters()) return false; + if (hasParameters()) { + if (!getParameters().equals(other.getParameters())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasParameters()) { + hash = (37 * hash) + PARAMETERS_FIELD_NUMBER; + hash = (53 * hash) + getParameters().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.pubsub.v1.AIInference.UnstructuredInference parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.AIInference.UnstructuredInference parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.AIInference.UnstructuredInference parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.AIInference.UnstructuredInference parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.AIInference.UnstructuredInference parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.AIInference.UnstructuredInference parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.AIInference.UnstructuredInference parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.AIInference.UnstructuredInference parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.AIInference.UnstructuredInference parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.AIInference.UnstructuredInference parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.AIInference.UnstructuredInference parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.AIInference.UnstructuredInference parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.pubsub.v1.AIInference.UnstructuredInference prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + + /** + * + * + *
    +     * Configuration for making inferences using arbitrary JSON payloads.
    +     * 
    + * + * Protobuf type {@code google.pubsub.v1.AIInference.UnstructuredInference} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder + implements + // @@protoc_insertion_point(builder_implements:google.pubsub.v1.AIInference.UnstructuredInference) + com.google.pubsub.v1.AIInference.UnstructuredInferenceOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_AIInference_UnstructuredInference_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_AIInference_UnstructuredInference_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.AIInference.UnstructuredInference.class, + com.google.pubsub.v1.AIInference.UnstructuredInference.Builder.class); + } + + // Construct using com.google.pubsub.v1.AIInference.UnstructuredInference.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + internalGetParametersFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + parameters_ = null; + if (parametersBuilder_ != null) { + parametersBuilder_.dispose(); + parametersBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_AIInference_UnstructuredInference_descriptor; + } + + @java.lang.Override + public com.google.pubsub.v1.AIInference.UnstructuredInference getDefaultInstanceForType() { + return com.google.pubsub.v1.AIInference.UnstructuredInference.getDefaultInstance(); + } + + @java.lang.Override + public com.google.pubsub.v1.AIInference.UnstructuredInference build() { + com.google.pubsub.v1.AIInference.UnstructuredInference result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.pubsub.v1.AIInference.UnstructuredInference buildPartial() { + com.google.pubsub.v1.AIInference.UnstructuredInference result = + new com.google.pubsub.v1.AIInference.UnstructuredInference(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.pubsub.v1.AIInference.UnstructuredInference result) { + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.parameters_ = + parametersBuilder_ == null ? parameters_ : parametersBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.pubsub.v1.AIInference.UnstructuredInference) { + return mergeFrom((com.google.pubsub.v1.AIInference.UnstructuredInference) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.pubsub.v1.AIInference.UnstructuredInference other) { + if (other == com.google.pubsub.v1.AIInference.UnstructuredInference.getDefaultInstance()) + return this; + if (other.hasParameters()) { + mergeParameters(other.getParameters()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + input.readMessage( + internalGetParametersFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000001; + break; + } // case 10 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private com.google.protobuf.Struct parameters_; + private com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, + com.google.protobuf.Struct.Builder, + com.google.protobuf.StructOrBuilder> + parametersBuilder_; + + /** + * + * + *
    +       * Optional. A parameters object to be included in each inference request.
    +       * The parameters object is combined with the data field of the Pub/Sub
    +       * message to form the inference request.
    +       * 
    + * + * .google.protobuf.Struct parameters = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the parameters field is set. + */ + public boolean hasParameters() { + return ((bitField0_ & 0x00000001) != 0); + } + + /** + * + * + *
    +       * Optional. A parameters object to be included in each inference request.
    +       * The parameters object is combined with the data field of the Pub/Sub
    +       * message to form the inference request.
    +       * 
    + * + * .google.protobuf.Struct parameters = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The parameters. + */ + public com.google.protobuf.Struct getParameters() { + if (parametersBuilder_ == null) { + return parameters_ == null + ? com.google.protobuf.Struct.getDefaultInstance() + : parameters_; + } else { + return parametersBuilder_.getMessage(); + } + } + + /** + * + * + *
    +       * Optional. A parameters object to be included in each inference request.
    +       * The parameters object is combined with the data field of the Pub/Sub
    +       * message to form the inference request.
    +       * 
    + * + * .google.protobuf.Struct parameters = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setParameters(com.google.protobuf.Struct value) { + if (parametersBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + parameters_ = value; + } else { + parametersBuilder_.setMessage(value); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. A parameters object to be included in each inference request.
    +       * The parameters object is combined with the data field of the Pub/Sub
    +       * message to form the inference request.
    +       * 
    + * + * .google.protobuf.Struct parameters = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setParameters(com.google.protobuf.Struct.Builder builderForValue) { + if (parametersBuilder_ == null) { + parameters_ = builderForValue.build(); + } else { + parametersBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. A parameters object to be included in each inference request.
    +       * The parameters object is combined with the data field of the Pub/Sub
    +       * message to form the inference request.
    +       * 
    + * + * .google.protobuf.Struct parameters = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeParameters(com.google.protobuf.Struct value) { + if (parametersBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0) + && parameters_ != null + && parameters_ != com.google.protobuf.Struct.getDefaultInstance()) { + getParametersBuilder().mergeFrom(value); + } else { + parameters_ = value; + } + } else { + parametersBuilder_.mergeFrom(value); + } + if (parameters_ != null) { + bitField0_ |= 0x00000001; + onChanged(); + } + return this; + } + + /** + * + * + *
    +       * Optional. A parameters object to be included in each inference request.
    +       * The parameters object is combined with the data field of the Pub/Sub
    +       * message to form the inference request.
    +       * 
    + * + * .google.protobuf.Struct parameters = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearParameters() { + bitField0_ = (bitField0_ & ~0x00000001); + parameters_ = null; + if (parametersBuilder_ != null) { + parametersBuilder_.dispose(); + parametersBuilder_ = null; + } + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. A parameters object to be included in each inference request.
    +       * The parameters object is combined with the data field of the Pub/Sub
    +       * message to form the inference request.
    +       * 
    + * + * .google.protobuf.Struct parameters = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.protobuf.Struct.Builder getParametersBuilder() { + bitField0_ |= 0x00000001; + onChanged(); + return internalGetParametersFieldBuilder().getBuilder(); + } + + /** + * + * + *
    +       * Optional. A parameters object to be included in each inference request.
    +       * The parameters object is combined with the data field of the Pub/Sub
    +       * message to form the inference request.
    +       * 
    + * + * .google.protobuf.Struct parameters = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.protobuf.StructOrBuilder getParametersOrBuilder() { + if (parametersBuilder_ != null) { + return parametersBuilder_.getMessageOrBuilder(); + } else { + return parameters_ == null + ? com.google.protobuf.Struct.getDefaultInstance() + : parameters_; + } + } + + /** + * + * + *
    +       * Optional. A parameters object to be included in each inference request.
    +       * The parameters object is combined with the data field of the Pub/Sub
    +       * message to form the inference request.
    +       * 
    + * + * .google.protobuf.Struct parameters = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, + com.google.protobuf.Struct.Builder, + com.google.protobuf.StructOrBuilder> + internalGetParametersFieldBuilder() { + if (parametersBuilder_ == null) { + parametersBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, + com.google.protobuf.Struct.Builder, + com.google.protobuf.StructOrBuilder>( + getParameters(), getParentForChildren(), isClean()); + parameters_ = null; + } + return parametersBuilder_; + } + + // @@protoc_insertion_point(builder_scope:google.pubsub.v1.AIInference.UnstructuredInference) + } + + // @@protoc_insertion_point(class_scope:google.pubsub.v1.AIInference.UnstructuredInference) + private static final com.google.pubsub.v1.AIInference.UnstructuredInference DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.pubsub.v1.AIInference.UnstructuredInference(); + } + + public static com.google.pubsub.v1.AIInference.UnstructuredInference getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public UnstructuredInference parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException() + .setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.pubsub.v1.AIInference.UnstructuredInference getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + private int inferenceModeCase_ = 0; + + @SuppressWarnings("serial") + private java.lang.Object inferenceMode_; + + public enum InferenceModeCase + implements + com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + UNSTRUCTURED_INFERENCE(2), + INFERENCEMODE_NOT_SET(0); + private final int value; + + private InferenceModeCase(int value) { + this.value = value; + } + + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static InferenceModeCase valueOf(int value) { + return forNumber(value); + } + + public static InferenceModeCase forNumber(int value) { + switch (value) { + case 2: + return UNSTRUCTURED_INFERENCE; + case 0: + return INFERENCEMODE_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public InferenceModeCase getInferenceModeCase() { + return InferenceModeCase.forNumber(inferenceModeCase_); + } + + public static final int ENDPOINT_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object endpoint_ = ""; + + /** + * + * + *
    +   * Required. An endpoint to a Vertex AI model of the form
    +   * `projects/{project}/locations/{location}/endpoints/{endpoint}` or
    +   * `projects/{project}/locations/{location}/publishers/{publisher}/models/{model}`.
    +   * Vertex AI API requests will be sent to this endpoint.
    +   * 
    + * + * string endpoint = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The endpoint. + */ + @java.lang.Override + public java.lang.String getEndpoint() { + java.lang.Object ref = endpoint_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + endpoint_ = s; + return s; + } + } + + /** + * + * + *
    +   * Required. An endpoint to a Vertex AI model of the form
    +   * `projects/{project}/locations/{location}/endpoints/{endpoint}` or
    +   * `projects/{project}/locations/{location}/publishers/{publisher}/models/{model}`.
    +   * Vertex AI API requests will be sent to this endpoint.
    +   * 
    + * + * string endpoint = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for endpoint. + */ + @java.lang.Override + public com.google.protobuf.ByteString getEndpointBytes() { + java.lang.Object ref = endpoint_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + endpoint_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int UNSTRUCTURED_INFERENCE_FIELD_NUMBER = 2; + + /** + * + * + *
    +   * Optional. Requests and responses can be any arbitrary JSON object.
    +   * 
    + * + * + * .google.pubsub.v1.AIInference.UnstructuredInference unstructured_inference = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the unstructuredInference field is set. + */ + @java.lang.Override + public boolean hasUnstructuredInference() { + return inferenceModeCase_ == 2; + } + + /** + * + * + *
    +   * Optional. Requests and responses can be any arbitrary JSON object.
    +   * 
    + * + * + * .google.pubsub.v1.AIInference.UnstructuredInference unstructured_inference = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The unstructuredInference. + */ + @java.lang.Override + public com.google.pubsub.v1.AIInference.UnstructuredInference getUnstructuredInference() { + if (inferenceModeCase_ == 2) { + return (com.google.pubsub.v1.AIInference.UnstructuredInference) inferenceMode_; + } + return com.google.pubsub.v1.AIInference.UnstructuredInference.getDefaultInstance(); + } + + /** + * + * + *
    +   * Optional. Requests and responses can be any arbitrary JSON object.
    +   * 
    + * + * + * .google.pubsub.v1.AIInference.UnstructuredInference unstructured_inference = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.AIInference.UnstructuredInferenceOrBuilder + getUnstructuredInferenceOrBuilder() { + if (inferenceModeCase_ == 2) { + return (com.google.pubsub.v1.AIInference.UnstructuredInference) inferenceMode_; + } + return com.google.pubsub.v1.AIInference.UnstructuredInference.getDefaultInstance(); + } + + public static final int SERVICE_ACCOUNT_EMAIL_FIELD_NUMBER = 3; + + @SuppressWarnings("serial") + private volatile java.lang.Object serviceAccountEmail_ = ""; + + /** + * + * + *
    +   * Optional. The service account to use to make prediction requests against
    +   * endpoints. The resource creator or updater that specifies this field must
    +   * have `iam.serviceAccounts.actAs` permission on the service account. If not
    +   * specified, the Pub/Sub [service
    +   * agent](https://cloud.google.com/iam/docs/service-agents),
    +   * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.
    +   * 
    + * + * string service_account_email = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The serviceAccountEmail. + */ + @java.lang.Override + public java.lang.String getServiceAccountEmail() { + java.lang.Object ref = serviceAccountEmail_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + serviceAccountEmail_ = s; + return s; + } + } + + /** + * + * + *
    +   * Optional. The service account to use to make prediction requests against
    +   * endpoints. The resource creator or updater that specifies this field must
    +   * have `iam.serviceAccounts.actAs` permission on the service account. If not
    +   * specified, the Pub/Sub [service
    +   * agent](https://cloud.google.com/iam/docs/service-agents),
    +   * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.
    +   * 
    + * + * string service_account_email = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for serviceAccountEmail. + */ + @java.lang.Override + public com.google.protobuf.ByteString getServiceAccountEmailBytes() { + java.lang.Object ref = serviceAccountEmail_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + serviceAccountEmail_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(endpoint_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, endpoint_); + } + if (inferenceModeCase_ == 2) { + output.writeMessage( + 2, (com.google.pubsub.v1.AIInference.UnstructuredInference) inferenceMode_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(serviceAccountEmail_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 3, serviceAccountEmail_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(endpoint_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, endpoint_); + } + if (inferenceModeCase_ == 2) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 2, (com.google.pubsub.v1.AIInference.UnstructuredInference) inferenceMode_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(serviceAccountEmail_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(3, serviceAccountEmail_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.pubsub.v1.AIInference)) { + return super.equals(obj); + } + com.google.pubsub.v1.AIInference other = (com.google.pubsub.v1.AIInference) obj; + + if (!getEndpoint().equals(other.getEndpoint())) return false; + if (!getServiceAccountEmail().equals(other.getServiceAccountEmail())) return false; + if (!getInferenceModeCase().equals(other.getInferenceModeCase())) return false; + switch (inferenceModeCase_) { + case 2: + if (!getUnstructuredInference().equals(other.getUnstructuredInference())) return false; + break; + case 0: + default: + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + ENDPOINT_FIELD_NUMBER; + hash = (53 * hash) + getEndpoint().hashCode(); + hash = (37 * hash) + SERVICE_ACCOUNT_EMAIL_FIELD_NUMBER; + hash = (53 * hash) + getServiceAccountEmail().hashCode(); + switch (inferenceModeCase_) { + case 2: + hash = (37 * hash) + UNSTRUCTURED_INFERENCE_FIELD_NUMBER; + hash = (53 * hash) + getUnstructuredInference().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.pubsub.v1.AIInference parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.AIInference parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.AIInference parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.AIInference parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.AIInference parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.AIInference parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.AIInference parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.AIInference parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.AIInference parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.AIInference parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.AIInference parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.AIInference parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.pubsub.v1.AIInference prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + + /** + * + * + *
    +   * Configuration for making inference requests against Vertex AI models.
    +   * 
    + * + * Protobuf type {@code google.pubsub.v1.AIInference} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder + implements + // @@protoc_insertion_point(builder_implements:google.pubsub.v1.AIInference) + com.google.pubsub.v1.AIInferenceOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_AIInference_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_AIInference_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.AIInference.class, + com.google.pubsub.v1.AIInference.Builder.class); + } + + // Construct using com.google.pubsub.v1.AIInference.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + endpoint_ = ""; + if (unstructuredInferenceBuilder_ != null) { + unstructuredInferenceBuilder_.clear(); + } + serviceAccountEmail_ = ""; + inferenceModeCase_ = 0; + inferenceMode_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_AIInference_descriptor; + } + + @java.lang.Override + public com.google.pubsub.v1.AIInference getDefaultInstanceForType() { + return com.google.pubsub.v1.AIInference.getDefaultInstance(); + } + + @java.lang.Override + public com.google.pubsub.v1.AIInference build() { + com.google.pubsub.v1.AIInference result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.pubsub.v1.AIInference buildPartial() { + com.google.pubsub.v1.AIInference result = new com.google.pubsub.v1.AIInference(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + buildPartialOneofs(result); + onBuilt(); + return result; + } + + private void buildPartial0(com.google.pubsub.v1.AIInference result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.endpoint_ = endpoint_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.serviceAccountEmail_ = serviceAccountEmail_; + } + } + + private void buildPartialOneofs(com.google.pubsub.v1.AIInference result) { + result.inferenceModeCase_ = inferenceModeCase_; + result.inferenceMode_ = this.inferenceMode_; + if (inferenceModeCase_ == 2 && unstructuredInferenceBuilder_ != null) { + result.inferenceMode_ = unstructuredInferenceBuilder_.build(); + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.pubsub.v1.AIInference) { + return mergeFrom((com.google.pubsub.v1.AIInference) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.pubsub.v1.AIInference other) { + if (other == com.google.pubsub.v1.AIInference.getDefaultInstance()) return this; + if (!other.getEndpoint().isEmpty()) { + endpoint_ = other.endpoint_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getServiceAccountEmail().isEmpty()) { + serviceAccountEmail_ = other.serviceAccountEmail_; + bitField0_ |= 0x00000004; + onChanged(); + } + switch (other.getInferenceModeCase()) { + case UNSTRUCTURED_INFERENCE: + { + mergeUnstructuredInference(other.getUnstructuredInference()); + break; + } + case INFERENCEMODE_NOT_SET: + { + break; + } + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + endpoint_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + input.readMessage( + internalGetUnstructuredInferenceFieldBuilder().getBuilder(), extensionRegistry); + inferenceModeCase_ = 2; + break; + } // case 18 + case 26: + { + serviceAccountEmail_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000004; + break; + } // case 26 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int inferenceModeCase_ = 0; + private java.lang.Object inferenceMode_; + + public InferenceModeCase getInferenceModeCase() { + return InferenceModeCase.forNumber(inferenceModeCase_); + } + + public Builder clearInferenceMode() { + inferenceModeCase_ = 0; + inferenceMode_ = null; + onChanged(); + return this; + } + + private int bitField0_; + + private java.lang.Object endpoint_ = ""; + + /** + * + * + *
    +     * Required. An endpoint to a Vertex AI model of the form
    +     * `projects/{project}/locations/{location}/endpoints/{endpoint}` or
    +     * `projects/{project}/locations/{location}/publishers/{publisher}/models/{model}`.
    +     * Vertex AI API requests will be sent to this endpoint.
    +     * 
    + * + * string endpoint = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The endpoint. + */ + public java.lang.String getEndpoint() { + java.lang.Object ref = endpoint_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + endpoint_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +     * Required. An endpoint to a Vertex AI model of the form
    +     * `projects/{project}/locations/{location}/endpoints/{endpoint}` or
    +     * `projects/{project}/locations/{location}/publishers/{publisher}/models/{model}`.
    +     * Vertex AI API requests will be sent to this endpoint.
    +     * 
    + * + * string endpoint = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for endpoint. + */ + public com.google.protobuf.ByteString getEndpointBytes() { + java.lang.Object ref = endpoint_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + endpoint_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +     * Required. An endpoint to a Vertex AI model of the form
    +     * `projects/{project}/locations/{location}/endpoints/{endpoint}` or
    +     * `projects/{project}/locations/{location}/publishers/{publisher}/models/{model}`.
    +     * Vertex AI API requests will be sent to this endpoint.
    +     * 
    + * + * string endpoint = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The endpoint to set. + * @return This builder for chaining. + */ + public Builder setEndpoint(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + endpoint_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Required. An endpoint to a Vertex AI model of the form
    +     * `projects/{project}/locations/{location}/endpoints/{endpoint}` or
    +     * `projects/{project}/locations/{location}/publishers/{publisher}/models/{model}`.
    +     * Vertex AI API requests will be sent to this endpoint.
    +     * 
    + * + * string endpoint = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearEndpoint() { + endpoint_ = getDefaultInstance().getEndpoint(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + + /** + * + * + *
    +     * Required. An endpoint to a Vertex AI model of the form
    +     * `projects/{project}/locations/{location}/endpoints/{endpoint}` or
    +     * `projects/{project}/locations/{location}/publishers/{publisher}/models/{model}`.
    +     * Vertex AI API requests will be sent to this endpoint.
    +     * 
    + * + * string endpoint = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for endpoint to set. + * @return This builder for chaining. + */ + public Builder setEndpointBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + endpoint_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.AIInference.UnstructuredInference, + com.google.pubsub.v1.AIInference.UnstructuredInference.Builder, + com.google.pubsub.v1.AIInference.UnstructuredInferenceOrBuilder> + unstructuredInferenceBuilder_; + + /** + * + * + *
    +     * Optional. Requests and responses can be any arbitrary JSON object.
    +     * 
    + * + * + * .google.pubsub.v1.AIInference.UnstructuredInference unstructured_inference = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the unstructuredInference field is set. + */ + @java.lang.Override + public boolean hasUnstructuredInference() { + return inferenceModeCase_ == 2; + } + + /** + * + * + *
    +     * Optional. Requests and responses can be any arbitrary JSON object.
    +     * 
    + * + * + * .google.pubsub.v1.AIInference.UnstructuredInference unstructured_inference = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The unstructuredInference. + */ + @java.lang.Override + public com.google.pubsub.v1.AIInference.UnstructuredInference getUnstructuredInference() { + if (unstructuredInferenceBuilder_ == null) { + if (inferenceModeCase_ == 2) { + return (com.google.pubsub.v1.AIInference.UnstructuredInference) inferenceMode_; + } + return com.google.pubsub.v1.AIInference.UnstructuredInference.getDefaultInstance(); + } else { + if (inferenceModeCase_ == 2) { + return unstructuredInferenceBuilder_.getMessage(); + } + return com.google.pubsub.v1.AIInference.UnstructuredInference.getDefaultInstance(); + } + } + + /** + * + * + *
    +     * Optional. Requests and responses can be any arbitrary JSON object.
    +     * 
    + * + * + * .google.pubsub.v1.AIInference.UnstructuredInference unstructured_inference = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setUnstructuredInference( + com.google.pubsub.v1.AIInference.UnstructuredInference value) { + if (unstructuredInferenceBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + inferenceMode_ = value; + onChanged(); + } else { + unstructuredInferenceBuilder_.setMessage(value); + } + inferenceModeCase_ = 2; + return this; + } + + /** + * + * + *
    +     * Optional. Requests and responses can be any arbitrary JSON object.
    +     * 
    + * + * + * .google.pubsub.v1.AIInference.UnstructuredInference unstructured_inference = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setUnstructuredInference( + com.google.pubsub.v1.AIInference.UnstructuredInference.Builder builderForValue) { + if (unstructuredInferenceBuilder_ == null) { + inferenceMode_ = builderForValue.build(); + onChanged(); + } else { + unstructuredInferenceBuilder_.setMessage(builderForValue.build()); + } + inferenceModeCase_ = 2; + return this; + } + + /** + * + * + *
    +     * Optional. Requests and responses can be any arbitrary JSON object.
    +     * 
    + * + * + * .google.pubsub.v1.AIInference.UnstructuredInference unstructured_inference = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeUnstructuredInference( + com.google.pubsub.v1.AIInference.UnstructuredInference value) { + if (unstructuredInferenceBuilder_ == null) { + if (inferenceModeCase_ == 2 + && inferenceMode_ + != com.google.pubsub.v1.AIInference.UnstructuredInference.getDefaultInstance()) { + inferenceMode_ = + com.google.pubsub.v1.AIInference.UnstructuredInference.newBuilder( + (com.google.pubsub.v1.AIInference.UnstructuredInference) inferenceMode_) + .mergeFrom(value) + .buildPartial(); + } else { + inferenceMode_ = value; + } + onChanged(); + } else { + if (inferenceModeCase_ == 2) { + unstructuredInferenceBuilder_.mergeFrom(value); + } else { + unstructuredInferenceBuilder_.setMessage(value); + } + } + inferenceModeCase_ = 2; + return this; + } + + /** + * + * + *
    +     * Optional. Requests and responses can be any arbitrary JSON object.
    +     * 
    + * + * + * .google.pubsub.v1.AIInference.UnstructuredInference unstructured_inference = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearUnstructuredInference() { + if (unstructuredInferenceBuilder_ == null) { + if (inferenceModeCase_ == 2) { + inferenceModeCase_ = 0; + inferenceMode_ = null; + onChanged(); + } + } else { + if (inferenceModeCase_ == 2) { + inferenceModeCase_ = 0; + inferenceMode_ = null; + } + unstructuredInferenceBuilder_.clear(); + } + return this; + } + + /** + * + * + *
    +     * Optional. Requests and responses can be any arbitrary JSON object.
    +     * 
    + * + * + * .google.pubsub.v1.AIInference.UnstructuredInference unstructured_inference = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.AIInference.UnstructuredInference.Builder + getUnstructuredInferenceBuilder() { + return internalGetUnstructuredInferenceFieldBuilder().getBuilder(); + } + + /** + * + * + *
    +     * Optional. Requests and responses can be any arbitrary JSON object.
    +     * 
    + * + * + * .google.pubsub.v1.AIInference.UnstructuredInference unstructured_inference = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.AIInference.UnstructuredInferenceOrBuilder + getUnstructuredInferenceOrBuilder() { + if ((inferenceModeCase_ == 2) && (unstructuredInferenceBuilder_ != null)) { + return unstructuredInferenceBuilder_.getMessageOrBuilder(); + } else { + if (inferenceModeCase_ == 2) { + return (com.google.pubsub.v1.AIInference.UnstructuredInference) inferenceMode_; + } + return com.google.pubsub.v1.AIInference.UnstructuredInference.getDefaultInstance(); + } + } + + /** + * + * + *
    +     * Optional. Requests and responses can be any arbitrary JSON object.
    +     * 
    + * + * + * .google.pubsub.v1.AIInference.UnstructuredInference unstructured_inference = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.AIInference.UnstructuredInference, + com.google.pubsub.v1.AIInference.UnstructuredInference.Builder, + com.google.pubsub.v1.AIInference.UnstructuredInferenceOrBuilder> + internalGetUnstructuredInferenceFieldBuilder() { + if (unstructuredInferenceBuilder_ == null) { + if (!(inferenceModeCase_ == 2)) { + inferenceMode_ = + com.google.pubsub.v1.AIInference.UnstructuredInference.getDefaultInstance(); + } + unstructuredInferenceBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.AIInference.UnstructuredInference, + com.google.pubsub.v1.AIInference.UnstructuredInference.Builder, + com.google.pubsub.v1.AIInference.UnstructuredInferenceOrBuilder>( + (com.google.pubsub.v1.AIInference.UnstructuredInference) inferenceMode_, + getParentForChildren(), + isClean()); + inferenceMode_ = null; + } + inferenceModeCase_ = 2; + onChanged(); + return unstructuredInferenceBuilder_; + } + + private java.lang.Object serviceAccountEmail_ = ""; + + /** + * + * + *
    +     * Optional. The service account to use to make prediction requests against
    +     * endpoints. The resource creator or updater that specifies this field must
    +     * have `iam.serviceAccounts.actAs` permission on the service account. If not
    +     * specified, the Pub/Sub [service
    +     * agent](https://cloud.google.com/iam/docs/service-agents),
    +     * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.
    +     * 
    + * + * string service_account_email = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The serviceAccountEmail. + */ + public java.lang.String getServiceAccountEmail() { + java.lang.Object ref = serviceAccountEmail_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + serviceAccountEmail_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +     * Optional. The service account to use to make prediction requests against
    +     * endpoints. The resource creator or updater that specifies this field must
    +     * have `iam.serviceAccounts.actAs` permission on the service account. If not
    +     * specified, the Pub/Sub [service
    +     * agent](https://cloud.google.com/iam/docs/service-agents),
    +     * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.
    +     * 
    + * + * string service_account_email = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for serviceAccountEmail. + */ + public com.google.protobuf.ByteString getServiceAccountEmailBytes() { + java.lang.Object ref = serviceAccountEmail_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + serviceAccountEmail_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +     * Optional. The service account to use to make prediction requests against
    +     * endpoints. The resource creator or updater that specifies this field must
    +     * have `iam.serviceAccounts.actAs` permission on the service account. If not
    +     * specified, the Pub/Sub [service
    +     * agent](https://cloud.google.com/iam/docs/service-agents),
    +     * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.
    +     * 
    + * + * string service_account_email = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The serviceAccountEmail to set. + * @return This builder for chaining. + */ + public Builder setServiceAccountEmail(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + serviceAccountEmail_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Optional. The service account to use to make prediction requests against
    +     * endpoints. The resource creator or updater that specifies this field must
    +     * have `iam.serviceAccounts.actAs` permission on the service account. If not
    +     * specified, the Pub/Sub [service
    +     * agent](https://cloud.google.com/iam/docs/service-agents),
    +     * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.
    +     * 
    + * + * string service_account_email = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearServiceAccountEmail() { + serviceAccountEmail_ = getDefaultInstance().getServiceAccountEmail(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + + /** + * + * + *
    +     * Optional. The service account to use to make prediction requests against
    +     * endpoints. The resource creator or updater that specifies this field must
    +     * have `iam.serviceAccounts.actAs` permission on the service account. If not
    +     * specified, the Pub/Sub [service
    +     * agent](https://cloud.google.com/iam/docs/service-agents),
    +     * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.
    +     * 
    + * + * string service_account_email = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for serviceAccountEmail to set. + * @return This builder for chaining. + */ + public Builder setServiceAccountEmailBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + serviceAccountEmail_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:google.pubsub.v1.AIInference) + } + + // @@protoc_insertion_point(class_scope:google.pubsub.v1.AIInference) + private static final com.google.pubsub.v1.AIInference DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.pubsub.v1.AIInference(); + } + + public static com.google.pubsub.v1.AIInference getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AIInference parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.pubsub.v1.AIInference getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/AIInferenceOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/AIInferenceOrBuilder.java new file mode 100644 index 000000000..07aa76e61 --- /dev/null +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/AIInferenceOrBuilder.java @@ -0,0 +1,142 @@ +/* + * Copyright 2026 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 + +package com.google.pubsub.v1; + +@com.google.protobuf.Generated +public interface AIInferenceOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.pubsub.v1.AIInference) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
    +   * Required. An endpoint to a Vertex AI model of the form
    +   * `projects/{project}/locations/{location}/endpoints/{endpoint}` or
    +   * `projects/{project}/locations/{location}/publishers/{publisher}/models/{model}`.
    +   * Vertex AI API requests will be sent to this endpoint.
    +   * 
    + * + * string endpoint = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The endpoint. + */ + java.lang.String getEndpoint(); + + /** + * + * + *
    +   * Required. An endpoint to a Vertex AI model of the form
    +   * `projects/{project}/locations/{location}/endpoints/{endpoint}` or
    +   * `projects/{project}/locations/{location}/publishers/{publisher}/models/{model}`.
    +   * Vertex AI API requests will be sent to this endpoint.
    +   * 
    + * + * string endpoint = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for endpoint. + */ + com.google.protobuf.ByteString getEndpointBytes(); + + /** + * + * + *
    +   * Optional. Requests and responses can be any arbitrary JSON object.
    +   * 
    + * + * + * .google.pubsub.v1.AIInference.UnstructuredInference unstructured_inference = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the unstructuredInference field is set. + */ + boolean hasUnstructuredInference(); + + /** + * + * + *
    +   * Optional. Requests and responses can be any arbitrary JSON object.
    +   * 
    + * + * + * .google.pubsub.v1.AIInference.UnstructuredInference unstructured_inference = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The unstructuredInference. + */ + com.google.pubsub.v1.AIInference.UnstructuredInference getUnstructuredInference(); + + /** + * + * + *
    +   * Optional. Requests and responses can be any arbitrary JSON object.
    +   * 
    + * + * + * .google.pubsub.v1.AIInference.UnstructuredInference unstructured_inference = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.pubsub.v1.AIInference.UnstructuredInferenceOrBuilder + getUnstructuredInferenceOrBuilder(); + + /** + * + * + *
    +   * Optional. The service account to use to make prediction requests against
    +   * endpoints. The resource creator or updater that specifies this field must
    +   * have `iam.serviceAccounts.actAs` permission on the service account. If not
    +   * specified, the Pub/Sub [service
    +   * agent](https://cloud.google.com/iam/docs/service-agents),
    +   * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.
    +   * 
    + * + * string service_account_email = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The serviceAccountEmail. + */ + java.lang.String getServiceAccountEmail(); + + /** + * + * + *
    +   * Optional. The service account to use to make prediction requests against
    +   * endpoints. The resource creator or updater that specifies this field must
    +   * have `iam.serviceAccounts.actAs` permission on the service account. If not
    +   * specified, the Pub/Sub [service
    +   * agent](https://cloud.google.com/iam/docs/service-agents),
    +   * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.
    +   * 
    + * + * string service_account_email = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for serviceAccountEmail. + */ + com.google.protobuf.ByteString getServiceAccountEmailBytes(); + + com.google.pubsub.v1.AIInference.InferenceModeCase getInferenceModeCase(); +} diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/AcknowledgeRequest.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/AcknowledgeRequest.java index 009081161..392f45dc6 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/AcknowledgeRequest.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/AcknowledgeRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; @@ -27,88 +29,31 @@ * * Protobuf type {@code google.pubsub.v1.AcknowledgeRequest} */ -public final class AcknowledgeRequest extends com.google.protobuf.GeneratedMessageV3 +@com.google.protobuf.Generated +public final class AcknowledgeRequest extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:google.pubsub.v1.AcknowledgeRequest) AcknowledgeRequestOrBuilder { private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "AcknowledgeRequest"); + } + // Use AcknowledgeRequest.newBuilder() to construct. - private AcknowledgeRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + private AcknowledgeRequest(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); } private AcknowledgeRequest() { subscription_ = ""; - ackIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new AcknowledgeRequest(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - private AcknowledgeRequest( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - java.lang.String s = input.readStringRequireUtf8(); - - subscription_ = s; - break; - } - case 18: - { - java.lang.String s = input.readStringRequireUtf8(); - if (!((mutable_bitField0_ & 0x00000001) != 0)) { - ackIds_ = new com.google.protobuf.LazyStringArrayList(); - mutable_bitField0_ |= 0x00000001; - } - ackIds_.add(s); - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000001) != 0)) { - ackIds_ = ackIds_.getUnmodifiableView(); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } + ackIds_ = com.google.protobuf.LazyStringArrayList.emptyList(); } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { @@ -117,7 +62,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_AcknowledgeRequest_fieldAccessorTable @@ -127,7 +72,10 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } public static final int SUBSCRIPTION_FIELD_NUMBER = 1; - private volatile java.lang.Object subscription_; + + @SuppressWarnings("serial") + private volatile java.lang.Object subscription_ = ""; + /** * * @@ -154,6 +102,7 @@ public java.lang.String getSubscription() { return s; } } + /** * * @@ -182,7 +131,11 @@ public com.google.protobuf.ByteString getSubscriptionBytes() { } public static final int ACK_IDS_FIELD_NUMBER = 2; - private com.google.protobuf.LazyStringList ackIds_; + + @SuppressWarnings("serial") + private com.google.protobuf.LazyStringArrayList ackIds_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + /** * * @@ -199,6 +152,7 @@ public com.google.protobuf.ByteString getSubscriptionBytes() { public com.google.protobuf.ProtocolStringList getAckIdsList() { return ackIds_; } + /** * * @@ -215,6 +169,7 @@ public com.google.protobuf.ProtocolStringList getAckIdsList() { public int getAckIdsCount() { return ackIds_.size(); } + /** * * @@ -232,6 +187,7 @@ public int getAckIdsCount() { public java.lang.String getAckIds(int index) { return ackIds_.get(index); } + /** * * @@ -264,13 +220,13 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!getSubscriptionBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, subscription_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(subscription_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, subscription_); } for (int i = 0; i < ackIds_.size(); i++) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 2, ackIds_.getRaw(i)); + com.google.protobuf.GeneratedMessage.writeString(output, 2, ackIds_.getRaw(i)); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -279,8 +235,8 @@ public int getSerializedSize() { if (size != -1) return size; size = 0; - if (!getSubscriptionBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, subscription_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(subscription_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, subscription_); } { int dataSize = 0; @@ -290,7 +246,7 @@ public int getSerializedSize() { size += dataSize; size += 1 * getAckIdsList().size(); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -307,7 +263,7 @@ public boolean equals(final java.lang.Object obj) { if (!getSubscription().equals(other.getSubscription())) return false; if (!getAckIdsList().equals(other.getAckIdsList())) return false; - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -324,7 +280,7 @@ public int hashCode() { hash = (37 * hash) + ACK_IDS_FIELD_NUMBER; hash = (53 * hash) + getAckIdsList().hashCode(); } - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -366,38 +322,38 @@ public static com.google.pubsub.v1.AcknowledgeRequest parseFrom( public static com.google.pubsub.v1.AcknowledgeRequest parseFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.AcknowledgeRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.AcknowledgeRequest parseDelimitedFrom( java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); } public static com.google.pubsub.v1.AcknowledgeRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.AcknowledgeRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.AcknowledgeRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } @@ -420,10 +376,11 @@ public Builder toBuilder() { } @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** * * @@ -433,7 +390,7 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build * * Protobuf type {@code google.pubsub.v1.AcknowledgeRequest} */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements // @@protoc_insertion_point(builder_implements:google.pubsub.v1.AcknowledgeRequest) com.google.pubsub.v1.AcknowledgeRequestOrBuilder { @@ -443,7 +400,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_AcknowledgeRequest_fieldAccessorTable @@ -453,26 +410,18 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } // Construct using com.google.pubsub.v1.AcknowledgeRequest.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } + private Builder() {} - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} } @java.lang.Override public Builder clear() { super.clear(); + bitField0_ = 0; subscription_ = ""; - - ackIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; - bitField0_ = (bitField0_ & ~0x00000001); + ackIds_ = com.google.protobuf.LazyStringArrayList.emptyList(); return this; } @@ -500,48 +449,22 @@ public com.google.pubsub.v1.AcknowledgeRequest build() { public com.google.pubsub.v1.AcknowledgeRequest buildPartial() { com.google.pubsub.v1.AcknowledgeRequest result = new com.google.pubsub.v1.AcknowledgeRequest(this); - int from_bitField0_ = bitField0_; - result.subscription_ = subscription_; - if (((bitField0_ & 0x00000001) != 0)) { - ackIds_ = ackIds_.getUnmodifiableView(); - bitField0_ = (bitField0_ & ~0x00000001); + if (bitField0_ != 0) { + buildPartial0(result); } - result.ackIds_ = ackIds_; onBuilt(); return result; } - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); + private void buildPartial0(com.google.pubsub.v1.AcknowledgeRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.subscription_ = subscription_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + ackIds_.makeImmutable(); + result.ackIds_ = ackIds_; + } } @java.lang.Override @@ -558,19 +481,20 @@ public Builder mergeFrom(com.google.pubsub.v1.AcknowledgeRequest other) { if (other == com.google.pubsub.v1.AcknowledgeRequest.getDefaultInstance()) return this; if (!other.getSubscription().isEmpty()) { subscription_ = other.subscription_; + bitField0_ |= 0x00000001; onChanged(); } if (!other.ackIds_.isEmpty()) { if (ackIds_.isEmpty()) { ackIds_ = other.ackIds_; - bitField0_ = (bitField0_ & ~0x00000001); + bitField0_ |= 0x00000002; } else { ensureAckIdsIsMutable(); ackIds_.addAll(other.ackIds_); } onChanged(); } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -585,23 +509,51 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.pubsub.v1.AcknowledgeRequest parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + subscription_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + ensureAckIdsIsMutable(); + ackIds_.add(s); + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.google.pubsub.v1.AcknowledgeRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } private int bitField0_; private java.lang.Object subscription_ = ""; + /** * * @@ -627,6 +579,7 @@ public java.lang.String getSubscription() { return (java.lang.String) ref; } } + /** * * @@ -652,6 +605,7 @@ public com.google.protobuf.ByteString getSubscriptionBytes() { return (com.google.protobuf.ByteString) ref; } } + /** * * @@ -671,11 +625,12 @@ public Builder setSubscription(java.lang.String value) { if (value == null) { throw new NullPointerException(); } - subscription_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } + /** * * @@ -691,11 +646,12 @@ public Builder setSubscription(java.lang.String value) { * @return This builder for chaining. */ public Builder clearSubscription() { - subscription_ = getDefaultInstance().getSubscription(); + bitField0_ = (bitField0_ & ~0x00000001); onChanged(); return this; } + /** * * @@ -716,21 +672,22 @@ public Builder setSubscriptionBytes(com.google.protobuf.ByteString value) { throw new NullPointerException(); } checkByteStringIsUtf8(value); - subscription_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } - private com.google.protobuf.LazyStringList ackIds_ = - com.google.protobuf.LazyStringArrayList.EMPTY; + private com.google.protobuf.LazyStringArrayList ackIds_ = + com.google.protobuf.LazyStringArrayList.emptyList(); private void ensureAckIdsIsMutable() { - if (!((bitField0_ & 0x00000001) != 0)) { + if (!ackIds_.isModifiable()) { ackIds_ = new com.google.protobuf.LazyStringArrayList(ackIds_); - bitField0_ |= 0x00000001; } + bitField0_ |= 0x00000002; } + /** * * @@ -745,8 +702,10 @@ private void ensureAckIdsIsMutable() { * @return A list containing the ackIds. */ public com.google.protobuf.ProtocolStringList getAckIdsList() { - return ackIds_.getUnmodifiableView(); + ackIds_.makeImmutable(); + return ackIds_; } + /** * * @@ -763,6 +722,7 @@ public com.google.protobuf.ProtocolStringList getAckIdsList() { public int getAckIdsCount() { return ackIds_.size(); } + /** * * @@ -780,6 +740,7 @@ public int getAckIdsCount() { public java.lang.String getAckIds(int index) { return ackIds_.get(index); } + /** * * @@ -797,6 +758,7 @@ public java.lang.String getAckIds(int index) { public com.google.protobuf.ByteString getAckIdsBytes(int index) { return ackIds_.getByteString(index); } + /** * * @@ -818,9 +780,11 @@ public Builder setAckIds(int index, java.lang.String value) { } ensureAckIdsIsMutable(); ackIds_.set(index, value); + bitField0_ |= 0x00000002; onChanged(); return this; } + /** * * @@ -841,9 +805,11 @@ public Builder addAckIds(java.lang.String value) { } ensureAckIdsIsMutable(); ackIds_.add(value); + bitField0_ |= 0x00000002; onChanged(); return this; } + /** * * @@ -861,9 +827,11 @@ public Builder addAckIds(java.lang.String value) { public Builder addAllAckIds(java.lang.Iterable values) { ensureAckIdsIsMutable(); com.google.protobuf.AbstractMessageLite.Builder.addAll(values, ackIds_); + bitField0_ |= 0x00000002; onChanged(); return this; } + /** * * @@ -878,11 +846,13 @@ public Builder addAllAckIds(java.lang.Iterable values) { * @return This builder for chaining. */ public Builder clearAckIds() { - ackIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; - bitField0_ = (bitField0_ & ~0x00000001); + ackIds_ = com.google.protobuf.LazyStringArrayList.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + ; onChanged(); return this; } + /** * * @@ -904,21 +874,11 @@ public Builder addAckIdsBytes(com.google.protobuf.ByteString value) { checkByteStringIsUtf8(value); ensureAckIdsIsMutable(); ackIds_.add(value); + bitField0_ |= 0x00000002; onChanged(); return this; } - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - // @@protoc_insertion_point(builder_scope:google.pubsub.v1.AcknowledgeRequest) } @@ -940,7 +900,18 @@ public AcknowledgeRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new AcknowledgeRequest(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/AcknowledgeRequestOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/AcknowledgeRequestOrBuilder.java index 4951b0bb1..f74ab5d14 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/AcknowledgeRequestOrBuilder.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/AcknowledgeRequestOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; +@com.google.protobuf.Generated public interface AcknowledgeRequestOrBuilder extends // @@protoc_insertion_point(interface_extends:google.pubsub.v1.AcknowledgeRequest) @@ -38,6 +41,7 @@ public interface AcknowledgeRequestOrBuilder * @return The subscription. */ java.lang.String getSubscription(); + /** * * @@ -68,6 +72,7 @@ public interface AcknowledgeRequestOrBuilder * @return A list containing the ackIds. */ java.util.List getAckIdsList(); + /** * * @@ -82,6 +87,7 @@ public interface AcknowledgeRequestOrBuilder * @return The count of ackIds. */ int getAckIdsCount(); + /** * * @@ -97,6 +103,7 @@ public interface AcknowledgeRequestOrBuilder * @return The ackIds at the given index. */ java.lang.String getAckIds(int index); + /** * * diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/BigQueryConfig.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/BigQueryConfig.java new file mode 100644 index 000000000..6dc42b7be --- /dev/null +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/BigQueryConfig.java @@ -0,0 +1,1712 @@ +/* + * Copyright 2026 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 + +package com.google.pubsub.v1; + +/** + * + * + *
    + * Configuration for a BigQuery subscription.
    + * 
    + * + * Protobuf type {@code google.pubsub.v1.BigQueryConfig} + */ +@com.google.protobuf.Generated +public final class BigQueryConfig extends com.google.protobuf.GeneratedMessage + implements + // @@protoc_insertion_point(message_implements:google.pubsub.v1.BigQueryConfig) + BigQueryConfigOrBuilder { + private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "BigQueryConfig"); + } + + // Use BigQueryConfig.newBuilder() to construct. + private BigQueryConfig(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + + private BigQueryConfig() { + table_ = ""; + state_ = 0; + serviceAccountEmail_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_BigQueryConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_BigQueryConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.BigQueryConfig.class, + com.google.pubsub.v1.BigQueryConfig.Builder.class); + } + + /** + * + * + *
    +   * Possible states for a BigQuery subscription.
    +   * 
    + * + * Protobuf enum {@code google.pubsub.v1.BigQueryConfig.State} + */ + public enum State implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
    +     * Default value. This value is unused.
    +     * 
    + * + * STATE_UNSPECIFIED = 0; + */ + STATE_UNSPECIFIED(0), + /** + * + * + *
    +     * The subscription can actively send messages to BigQuery
    +     * 
    + * + * ACTIVE = 1; + */ + ACTIVE(1), + /** + * + * + *
    +     * Cannot write to the BigQuery table because of permission denied errors.
    +     * This can happen if
    +     * - Pub/Sub SA has not been granted the [appropriate BigQuery IAM
    +     * permissions](https://cloud.google.com/pubsub/docs/create-subscription#assign_bigquery_service_account)
    +     * - bigquery.googleapis.com API is not enabled for the project
    +     * ([instructions](https://cloud.google.com/service-usage/docs/enable-disable))
    +     * 
    + * + * PERMISSION_DENIED = 2; + */ + PERMISSION_DENIED(2), + /** + * + * + *
    +     * Cannot write to the BigQuery table because it does not exist.
    +     * 
    + * + * NOT_FOUND = 3; + */ + NOT_FOUND(3), + /** + * + * + *
    +     * Cannot write to the BigQuery table due to a schema mismatch.
    +     * 
    + * + * SCHEMA_MISMATCH = 4; + */ + SCHEMA_MISMATCH(4), + /** + * + * + *
    +     * Cannot write to the destination because enforce_in_transit is set to true
    +     * and the destination locations are not in the allowed regions.
    +     * 
    + * + * IN_TRANSIT_LOCATION_RESTRICTION = 5; + */ + IN_TRANSIT_LOCATION_RESTRICTION(5), + /** + * + * + *
    +     * Cannot write to the BigQuery table because the table is not in the same
    +     * location as where Vertex AI models used in `message_transform`s are
    +     * deployed.
    +     * 
    + * + * VERTEX_AI_LOCATION_RESTRICTION = 6; + */ + VERTEX_AI_LOCATION_RESTRICTION(6), + UNRECOGNIZED(-1), + ; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "State"); + } + + /** + * + * + *
    +     * Default value. This value is unused.
    +     * 
    + * + * STATE_UNSPECIFIED = 0; + */ + public static final int STATE_UNSPECIFIED_VALUE = 0; + + /** + * + * + *
    +     * The subscription can actively send messages to BigQuery
    +     * 
    + * + * ACTIVE = 1; + */ + public static final int ACTIVE_VALUE = 1; + + /** + * + * + *
    +     * Cannot write to the BigQuery table because of permission denied errors.
    +     * This can happen if
    +     * - Pub/Sub SA has not been granted the [appropriate BigQuery IAM
    +     * permissions](https://cloud.google.com/pubsub/docs/create-subscription#assign_bigquery_service_account)
    +     * - bigquery.googleapis.com API is not enabled for the project
    +     * ([instructions](https://cloud.google.com/service-usage/docs/enable-disable))
    +     * 
    + * + * PERMISSION_DENIED = 2; + */ + public static final int PERMISSION_DENIED_VALUE = 2; + + /** + * + * + *
    +     * Cannot write to the BigQuery table because it does not exist.
    +     * 
    + * + * NOT_FOUND = 3; + */ + public static final int NOT_FOUND_VALUE = 3; + + /** + * + * + *
    +     * Cannot write to the BigQuery table due to a schema mismatch.
    +     * 
    + * + * SCHEMA_MISMATCH = 4; + */ + public static final int SCHEMA_MISMATCH_VALUE = 4; + + /** + * + * + *
    +     * Cannot write to the destination because enforce_in_transit is set to true
    +     * and the destination locations are not in the allowed regions.
    +     * 
    + * + * IN_TRANSIT_LOCATION_RESTRICTION = 5; + */ + public static final int IN_TRANSIT_LOCATION_RESTRICTION_VALUE = 5; + + /** + * + * + *
    +     * Cannot write to the BigQuery table because the table is not in the same
    +     * location as where Vertex AI models used in `message_transform`s are
    +     * deployed.
    +     * 
    + * + * VERTEX_AI_LOCATION_RESTRICTION = 6; + */ + public static final int VERTEX_AI_LOCATION_RESTRICTION_VALUE = 6; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static State valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static State forNumber(int value) { + switch (value) { + case 0: + return STATE_UNSPECIFIED; + case 1: + return ACTIVE; + case 2: + return PERMISSION_DENIED; + case 3: + return NOT_FOUND; + case 4: + return SCHEMA_MISMATCH; + case 5: + return IN_TRANSIT_LOCATION_RESTRICTION; + case 6: + return VERTEX_AI_LOCATION_RESTRICTION; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public State findValueByNumber(int number) { + return State.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.pubsub.v1.BigQueryConfig.getDescriptor().getEnumTypes().get(0); + } + + private static final State[] VALUES = values(); + + public static State valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private State(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.pubsub.v1.BigQueryConfig.State) + } + + public static final int TABLE_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object table_ = ""; + + /** + * + * + *
    +   * Optional. The name of the table to which to write data, of the form
    +   * {projectId}.{datasetId}.{tableId}
    +   * 
    + * + * string table = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The table. + */ + @java.lang.Override + public java.lang.String getTable() { + java.lang.Object ref = table_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + table_ = s; + return s; + } + } + + /** + * + * + *
    +   * Optional. The name of the table to which to write data, of the form
    +   * {projectId}.{datasetId}.{tableId}
    +   * 
    + * + * string table = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for table. + */ + @java.lang.Override + public com.google.protobuf.ByteString getTableBytes() { + java.lang.Object ref = table_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + table_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int USE_TOPIC_SCHEMA_FIELD_NUMBER = 2; + private boolean useTopicSchema_ = false; + + /** + * + * + *
    +   * Optional. When true, use the topic's schema as the columns to write to in
    +   * BigQuery, if it exists. `use_topic_schema` and `use_table_schema` cannot be
    +   * enabled at the same time.
    +   * 
    + * + * bool use_topic_schema = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The useTopicSchema. + */ + @java.lang.Override + public boolean getUseTopicSchema() { + return useTopicSchema_; + } + + public static final int WRITE_METADATA_FIELD_NUMBER = 3; + private boolean writeMetadata_ = false; + + /** + * + * + *
    +   * Optional. When true, write the subscription name, message_id, publish_time,
    +   * attributes, and ordering_key to additional columns in the table. The
    +   * subscription name, message_id, and publish_time fields are put in their own
    +   * columns while all other message properties (other than data) are written to
    +   * a JSON object in the attributes column.
    +   * 
    + * + * bool write_metadata = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The writeMetadata. + */ + @java.lang.Override + public boolean getWriteMetadata() { + return writeMetadata_; + } + + public static final int DROP_UNKNOWN_FIELDS_FIELD_NUMBER = 4; + private boolean dropUnknownFields_ = false; + + /** + * + * + *
    +   * Optional. When true and use_topic_schema is true, any fields that are a
    +   * part of the topic schema that are not part of the BigQuery table schema are
    +   * dropped when writing to BigQuery. Otherwise, the schemas must be kept in
    +   * sync and any messages with extra fields are not written and remain in the
    +   * subscription's backlog.
    +   * 
    + * + * bool drop_unknown_fields = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The dropUnknownFields. + */ + @java.lang.Override + public boolean getDropUnknownFields() { + return dropUnknownFields_; + } + + public static final int STATE_FIELD_NUMBER = 5; + private int state_ = 0; + + /** + * + * + *
    +   * Output only. An output-only field that indicates whether or not the
    +   * subscription can receive messages.
    +   * 
    + * + * + * .google.pubsub.v1.BigQueryConfig.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for state. + */ + @java.lang.Override + public int getStateValue() { + return state_; + } + + /** + * + * + *
    +   * Output only. An output-only field that indicates whether or not the
    +   * subscription can receive messages.
    +   * 
    + * + * + * .google.pubsub.v1.BigQueryConfig.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The state. + */ + @java.lang.Override + public com.google.pubsub.v1.BigQueryConfig.State getState() { + com.google.pubsub.v1.BigQueryConfig.State result = + com.google.pubsub.v1.BigQueryConfig.State.forNumber(state_); + return result == null ? com.google.pubsub.v1.BigQueryConfig.State.UNRECOGNIZED : result; + } + + public static final int USE_TABLE_SCHEMA_FIELD_NUMBER = 6; + private boolean useTableSchema_ = false; + + /** + * + * + *
    +   * Optional. When true, use the BigQuery table's schema as the columns to
    +   * write to in BigQuery. `use_table_schema` and `use_topic_schema` cannot be
    +   * enabled at the same time.
    +   * 
    + * + * bool use_table_schema = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The useTableSchema. + */ + @java.lang.Override + public boolean getUseTableSchema() { + return useTableSchema_; + } + + public static final int SERVICE_ACCOUNT_EMAIL_FIELD_NUMBER = 7; + + @SuppressWarnings("serial") + private volatile java.lang.Object serviceAccountEmail_ = ""; + + /** + * + * + *
    +   * Optional. The service account to use to write to BigQuery. The subscription
    +   * creator or updater that specifies this field must have
    +   * `iam.serviceAccounts.actAs` permission on the service account. If not
    +   * specified, the Pub/Sub [service
    +   * agent](https://cloud.google.com/iam/docs/service-agents),
    +   * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.
    +   * 
    + * + * string service_account_email = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The serviceAccountEmail. + */ + @java.lang.Override + public java.lang.String getServiceAccountEmail() { + java.lang.Object ref = serviceAccountEmail_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + serviceAccountEmail_ = s; + return s; + } + } + + /** + * + * + *
    +   * Optional. The service account to use to write to BigQuery. The subscription
    +   * creator or updater that specifies this field must have
    +   * `iam.serviceAccounts.actAs` permission on the service account. If not
    +   * specified, the Pub/Sub [service
    +   * agent](https://cloud.google.com/iam/docs/service-agents),
    +   * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.
    +   * 
    + * + * string service_account_email = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for serviceAccountEmail. + */ + @java.lang.Override + public com.google.protobuf.ByteString getServiceAccountEmailBytes() { + java.lang.Object ref = serviceAccountEmail_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + serviceAccountEmail_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(table_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, table_); + } + if (useTopicSchema_ != false) { + output.writeBool(2, useTopicSchema_); + } + if (writeMetadata_ != false) { + output.writeBool(3, writeMetadata_); + } + if (dropUnknownFields_ != false) { + output.writeBool(4, dropUnknownFields_); + } + if (state_ != com.google.pubsub.v1.BigQueryConfig.State.STATE_UNSPECIFIED.getNumber()) { + output.writeEnum(5, state_); + } + if (useTableSchema_ != false) { + output.writeBool(6, useTableSchema_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(serviceAccountEmail_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 7, serviceAccountEmail_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(table_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, table_); + } + if (useTopicSchema_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(2, useTopicSchema_); + } + if (writeMetadata_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(3, writeMetadata_); + } + if (dropUnknownFields_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(4, dropUnknownFields_); + } + if (state_ != com.google.pubsub.v1.BigQueryConfig.State.STATE_UNSPECIFIED.getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(5, state_); + } + if (useTableSchema_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(6, useTableSchema_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(serviceAccountEmail_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(7, serviceAccountEmail_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.pubsub.v1.BigQueryConfig)) { + return super.equals(obj); + } + com.google.pubsub.v1.BigQueryConfig other = (com.google.pubsub.v1.BigQueryConfig) obj; + + if (!getTable().equals(other.getTable())) return false; + if (getUseTopicSchema() != other.getUseTopicSchema()) return false; + if (getWriteMetadata() != other.getWriteMetadata()) return false; + if (getDropUnknownFields() != other.getDropUnknownFields()) return false; + if (state_ != other.state_) return false; + if (getUseTableSchema() != other.getUseTableSchema()) return false; + if (!getServiceAccountEmail().equals(other.getServiceAccountEmail())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + TABLE_FIELD_NUMBER; + hash = (53 * hash) + getTable().hashCode(); + hash = (37 * hash) + USE_TOPIC_SCHEMA_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getUseTopicSchema()); + hash = (37 * hash) + WRITE_METADATA_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getWriteMetadata()); + hash = (37 * hash) + DROP_UNKNOWN_FIELDS_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getDropUnknownFields()); + hash = (37 * hash) + STATE_FIELD_NUMBER; + hash = (53 * hash) + state_; + hash = (37 * hash) + USE_TABLE_SCHEMA_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getUseTableSchema()); + hash = (37 * hash) + SERVICE_ACCOUNT_EMAIL_FIELD_NUMBER; + hash = (53 * hash) + getServiceAccountEmail().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.pubsub.v1.BigQueryConfig parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.BigQueryConfig parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.BigQueryConfig parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.BigQueryConfig parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.BigQueryConfig parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.BigQueryConfig parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.BigQueryConfig parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.BigQueryConfig parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.BigQueryConfig parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.BigQueryConfig parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.BigQueryConfig parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.BigQueryConfig parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.pubsub.v1.BigQueryConfig prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + + /** + * + * + *
    +   * Configuration for a BigQuery subscription.
    +   * 
    + * + * Protobuf type {@code google.pubsub.v1.BigQueryConfig} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder + implements + // @@protoc_insertion_point(builder_implements:google.pubsub.v1.BigQueryConfig) + com.google.pubsub.v1.BigQueryConfigOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_BigQueryConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_BigQueryConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.BigQueryConfig.class, + com.google.pubsub.v1.BigQueryConfig.Builder.class); + } + + // Construct using com.google.pubsub.v1.BigQueryConfig.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + table_ = ""; + useTopicSchema_ = false; + writeMetadata_ = false; + dropUnknownFields_ = false; + state_ = 0; + useTableSchema_ = false; + serviceAccountEmail_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_BigQueryConfig_descriptor; + } + + @java.lang.Override + public com.google.pubsub.v1.BigQueryConfig getDefaultInstanceForType() { + return com.google.pubsub.v1.BigQueryConfig.getDefaultInstance(); + } + + @java.lang.Override + public com.google.pubsub.v1.BigQueryConfig build() { + com.google.pubsub.v1.BigQueryConfig result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.pubsub.v1.BigQueryConfig buildPartial() { + com.google.pubsub.v1.BigQueryConfig result = new com.google.pubsub.v1.BigQueryConfig(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.pubsub.v1.BigQueryConfig result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.table_ = table_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.useTopicSchema_ = useTopicSchema_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.writeMetadata_ = writeMetadata_; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.dropUnknownFields_ = dropUnknownFields_; + } + if (((from_bitField0_ & 0x00000010) != 0)) { + result.state_ = state_; + } + if (((from_bitField0_ & 0x00000020) != 0)) { + result.useTableSchema_ = useTableSchema_; + } + if (((from_bitField0_ & 0x00000040) != 0)) { + result.serviceAccountEmail_ = serviceAccountEmail_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.pubsub.v1.BigQueryConfig) { + return mergeFrom((com.google.pubsub.v1.BigQueryConfig) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.pubsub.v1.BigQueryConfig other) { + if (other == com.google.pubsub.v1.BigQueryConfig.getDefaultInstance()) return this; + if (!other.getTable().isEmpty()) { + table_ = other.table_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (other.getUseTopicSchema() != false) { + setUseTopicSchema(other.getUseTopicSchema()); + } + if (other.getWriteMetadata() != false) { + setWriteMetadata(other.getWriteMetadata()); + } + if (other.getDropUnknownFields() != false) { + setDropUnknownFields(other.getDropUnknownFields()); + } + if (other.state_ != 0) { + setStateValue(other.getStateValue()); + } + if (other.getUseTableSchema() != false) { + setUseTableSchema(other.getUseTableSchema()); + } + if (!other.getServiceAccountEmail().isEmpty()) { + serviceAccountEmail_ = other.serviceAccountEmail_; + bitField0_ |= 0x00000040; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + table_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 16: + { + useTopicSchema_ = input.readBool(); + bitField0_ |= 0x00000002; + break; + } // case 16 + case 24: + { + writeMetadata_ = input.readBool(); + bitField0_ |= 0x00000004; + break; + } // case 24 + case 32: + { + dropUnknownFields_ = input.readBool(); + bitField0_ |= 0x00000008; + break; + } // case 32 + case 40: + { + state_ = input.readEnum(); + bitField0_ |= 0x00000010; + break; + } // case 40 + case 48: + { + useTableSchema_ = input.readBool(); + bitField0_ |= 0x00000020; + break; + } // case 48 + case 58: + { + serviceAccountEmail_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000040; + break; + } // case 58 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.lang.Object table_ = ""; + + /** + * + * + *
    +     * Optional. The name of the table to which to write data, of the form
    +     * {projectId}.{datasetId}.{tableId}
    +     * 
    + * + * string table = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The table. + */ + public java.lang.String getTable() { + java.lang.Object ref = table_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + table_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +     * Optional. The name of the table to which to write data, of the form
    +     * {projectId}.{datasetId}.{tableId}
    +     * 
    + * + * string table = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for table. + */ + public com.google.protobuf.ByteString getTableBytes() { + java.lang.Object ref = table_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + table_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +     * Optional. The name of the table to which to write data, of the form
    +     * {projectId}.{datasetId}.{tableId}
    +     * 
    + * + * string table = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The table to set. + * @return This builder for chaining. + */ + public Builder setTable(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + table_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Optional. The name of the table to which to write data, of the form
    +     * {projectId}.{datasetId}.{tableId}
    +     * 
    + * + * string table = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearTable() { + table_ = getDefaultInstance().getTable(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + + /** + * + * + *
    +     * Optional. The name of the table to which to write data, of the form
    +     * {projectId}.{datasetId}.{tableId}
    +     * 
    + * + * string table = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for table to set. + * @return This builder for chaining. + */ + public Builder setTableBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + table_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private boolean useTopicSchema_; + + /** + * + * + *
    +     * Optional. When true, use the topic's schema as the columns to write to in
    +     * BigQuery, if it exists. `use_topic_schema` and `use_table_schema` cannot be
    +     * enabled at the same time.
    +     * 
    + * + * bool use_topic_schema = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The useTopicSchema. + */ + @java.lang.Override + public boolean getUseTopicSchema() { + return useTopicSchema_; + } + + /** + * + * + *
    +     * Optional. When true, use the topic's schema as the columns to write to in
    +     * BigQuery, if it exists. `use_topic_schema` and `use_table_schema` cannot be
    +     * enabled at the same time.
    +     * 
    + * + * bool use_topic_schema = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The useTopicSchema to set. + * @return This builder for chaining. + */ + public Builder setUseTopicSchema(boolean value) { + + useTopicSchema_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Optional. When true, use the topic's schema as the columns to write to in
    +     * BigQuery, if it exists. `use_topic_schema` and `use_table_schema` cannot be
    +     * enabled at the same time.
    +     * 
    + * + * bool use_topic_schema = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearUseTopicSchema() { + bitField0_ = (bitField0_ & ~0x00000002); + useTopicSchema_ = false; + onChanged(); + return this; + } + + private boolean writeMetadata_; + + /** + * + * + *
    +     * Optional. When true, write the subscription name, message_id, publish_time,
    +     * attributes, and ordering_key to additional columns in the table. The
    +     * subscription name, message_id, and publish_time fields are put in their own
    +     * columns while all other message properties (other than data) are written to
    +     * a JSON object in the attributes column.
    +     * 
    + * + * bool write_metadata = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The writeMetadata. + */ + @java.lang.Override + public boolean getWriteMetadata() { + return writeMetadata_; + } + + /** + * + * + *
    +     * Optional. When true, write the subscription name, message_id, publish_time,
    +     * attributes, and ordering_key to additional columns in the table. The
    +     * subscription name, message_id, and publish_time fields are put in their own
    +     * columns while all other message properties (other than data) are written to
    +     * a JSON object in the attributes column.
    +     * 
    + * + * bool write_metadata = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The writeMetadata to set. + * @return This builder for chaining. + */ + public Builder setWriteMetadata(boolean value) { + + writeMetadata_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Optional. When true, write the subscription name, message_id, publish_time,
    +     * attributes, and ordering_key to additional columns in the table. The
    +     * subscription name, message_id, and publish_time fields are put in their own
    +     * columns while all other message properties (other than data) are written to
    +     * a JSON object in the attributes column.
    +     * 
    + * + * bool write_metadata = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearWriteMetadata() { + bitField0_ = (bitField0_ & ~0x00000004); + writeMetadata_ = false; + onChanged(); + return this; + } + + private boolean dropUnknownFields_; + + /** + * + * + *
    +     * Optional. When true and use_topic_schema is true, any fields that are a
    +     * part of the topic schema that are not part of the BigQuery table schema are
    +     * dropped when writing to BigQuery. Otherwise, the schemas must be kept in
    +     * sync and any messages with extra fields are not written and remain in the
    +     * subscription's backlog.
    +     * 
    + * + * bool drop_unknown_fields = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The dropUnknownFields. + */ + @java.lang.Override + public boolean getDropUnknownFields() { + return dropUnknownFields_; + } + + /** + * + * + *
    +     * Optional. When true and use_topic_schema is true, any fields that are a
    +     * part of the topic schema that are not part of the BigQuery table schema are
    +     * dropped when writing to BigQuery. Otherwise, the schemas must be kept in
    +     * sync and any messages with extra fields are not written and remain in the
    +     * subscription's backlog.
    +     * 
    + * + * bool drop_unknown_fields = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The dropUnknownFields to set. + * @return This builder for chaining. + */ + public Builder setDropUnknownFields(boolean value) { + + dropUnknownFields_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Optional. When true and use_topic_schema is true, any fields that are a
    +     * part of the topic schema that are not part of the BigQuery table schema are
    +     * dropped when writing to BigQuery. Otherwise, the schemas must be kept in
    +     * sync and any messages with extra fields are not written and remain in the
    +     * subscription's backlog.
    +     * 
    + * + * bool drop_unknown_fields = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearDropUnknownFields() { + bitField0_ = (bitField0_ & ~0x00000008); + dropUnknownFields_ = false; + onChanged(); + return this; + } + + private int state_ = 0; + + /** + * + * + *
    +     * Output only. An output-only field that indicates whether or not the
    +     * subscription can receive messages.
    +     * 
    + * + * + * .google.pubsub.v1.BigQueryConfig.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for state. + */ + @java.lang.Override + public int getStateValue() { + return state_; + } + + /** + * + * + *
    +     * Output only. An output-only field that indicates whether or not the
    +     * subscription can receive messages.
    +     * 
    + * + * + * .google.pubsub.v1.BigQueryConfig.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The enum numeric value on the wire for state to set. + * @return This builder for chaining. + */ + public Builder setStateValue(int value) { + state_ = value; + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Output only. An output-only field that indicates whether or not the
    +     * subscription can receive messages.
    +     * 
    + * + * + * .google.pubsub.v1.BigQueryConfig.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The state. + */ + @java.lang.Override + public com.google.pubsub.v1.BigQueryConfig.State getState() { + com.google.pubsub.v1.BigQueryConfig.State result = + com.google.pubsub.v1.BigQueryConfig.State.forNumber(state_); + return result == null ? com.google.pubsub.v1.BigQueryConfig.State.UNRECOGNIZED : result; + } + + /** + * + * + *
    +     * Output only. An output-only field that indicates whether or not the
    +     * subscription can receive messages.
    +     * 
    + * + * + * .google.pubsub.v1.BigQueryConfig.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The state to set. + * @return This builder for chaining. + */ + public Builder setState(com.google.pubsub.v1.BigQueryConfig.State value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000010; + state_ = value.getNumber(); + onChanged(); + return this; + } + + /** + * + * + *
    +     * Output only. An output-only field that indicates whether or not the
    +     * subscription can receive messages.
    +     * 
    + * + * + * .google.pubsub.v1.BigQueryConfig.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return This builder for chaining. + */ + public Builder clearState() { + bitField0_ = (bitField0_ & ~0x00000010); + state_ = 0; + onChanged(); + return this; + } + + private boolean useTableSchema_; + + /** + * + * + *
    +     * Optional. When true, use the BigQuery table's schema as the columns to
    +     * write to in BigQuery. `use_table_schema` and `use_topic_schema` cannot be
    +     * enabled at the same time.
    +     * 
    + * + * bool use_table_schema = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The useTableSchema. + */ + @java.lang.Override + public boolean getUseTableSchema() { + return useTableSchema_; + } + + /** + * + * + *
    +     * Optional. When true, use the BigQuery table's schema as the columns to
    +     * write to in BigQuery. `use_table_schema` and `use_topic_schema` cannot be
    +     * enabled at the same time.
    +     * 
    + * + * bool use_table_schema = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The useTableSchema to set. + * @return This builder for chaining. + */ + public Builder setUseTableSchema(boolean value) { + + useTableSchema_ = value; + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Optional. When true, use the BigQuery table's schema as the columns to
    +     * write to in BigQuery. `use_table_schema` and `use_topic_schema` cannot be
    +     * enabled at the same time.
    +     * 
    + * + * bool use_table_schema = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearUseTableSchema() { + bitField0_ = (bitField0_ & ~0x00000020); + useTableSchema_ = false; + onChanged(); + return this; + } + + private java.lang.Object serviceAccountEmail_ = ""; + + /** + * + * + *
    +     * Optional. The service account to use to write to BigQuery. The subscription
    +     * creator or updater that specifies this field must have
    +     * `iam.serviceAccounts.actAs` permission on the service account. If not
    +     * specified, the Pub/Sub [service
    +     * agent](https://cloud.google.com/iam/docs/service-agents),
    +     * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.
    +     * 
    + * + * string service_account_email = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The serviceAccountEmail. + */ + public java.lang.String getServiceAccountEmail() { + java.lang.Object ref = serviceAccountEmail_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + serviceAccountEmail_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +     * Optional. The service account to use to write to BigQuery. The subscription
    +     * creator or updater that specifies this field must have
    +     * `iam.serviceAccounts.actAs` permission on the service account. If not
    +     * specified, the Pub/Sub [service
    +     * agent](https://cloud.google.com/iam/docs/service-agents),
    +     * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.
    +     * 
    + * + * string service_account_email = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for serviceAccountEmail. + */ + public com.google.protobuf.ByteString getServiceAccountEmailBytes() { + java.lang.Object ref = serviceAccountEmail_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + serviceAccountEmail_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +     * Optional. The service account to use to write to BigQuery. The subscription
    +     * creator or updater that specifies this field must have
    +     * `iam.serviceAccounts.actAs` permission on the service account. If not
    +     * specified, the Pub/Sub [service
    +     * agent](https://cloud.google.com/iam/docs/service-agents),
    +     * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.
    +     * 
    + * + * string service_account_email = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The serviceAccountEmail to set. + * @return This builder for chaining. + */ + public Builder setServiceAccountEmail(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + serviceAccountEmail_ = value; + bitField0_ |= 0x00000040; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Optional. The service account to use to write to BigQuery. The subscription
    +     * creator or updater that specifies this field must have
    +     * `iam.serviceAccounts.actAs` permission on the service account. If not
    +     * specified, the Pub/Sub [service
    +     * agent](https://cloud.google.com/iam/docs/service-agents),
    +     * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.
    +     * 
    + * + * string service_account_email = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearServiceAccountEmail() { + serviceAccountEmail_ = getDefaultInstance().getServiceAccountEmail(); + bitField0_ = (bitField0_ & ~0x00000040); + onChanged(); + return this; + } + + /** + * + * + *
    +     * Optional. The service account to use to write to BigQuery. The subscription
    +     * creator or updater that specifies this field must have
    +     * `iam.serviceAccounts.actAs` permission on the service account. If not
    +     * specified, the Pub/Sub [service
    +     * agent](https://cloud.google.com/iam/docs/service-agents),
    +     * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.
    +     * 
    + * + * string service_account_email = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for serviceAccountEmail to set. + * @return This builder for chaining. + */ + public Builder setServiceAccountEmailBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + serviceAccountEmail_ = value; + bitField0_ |= 0x00000040; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:google.pubsub.v1.BigQueryConfig) + } + + // @@protoc_insertion_point(class_scope:google.pubsub.v1.BigQueryConfig) + private static final com.google.pubsub.v1.BigQueryConfig DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.pubsub.v1.BigQueryConfig(); + } + + public static com.google.pubsub.v1.BigQueryConfig getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public BigQueryConfig parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.pubsub.v1.BigQueryConfig getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/BigQueryConfigOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/BigQueryConfigOrBuilder.java new file mode 100644 index 000000000..250b87a57 --- /dev/null +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/BigQueryConfigOrBuilder.java @@ -0,0 +1,188 @@ +/* + * Copyright 2026 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 + +package com.google.pubsub.v1; + +@com.google.protobuf.Generated +public interface BigQueryConfigOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.pubsub.v1.BigQueryConfig) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
    +   * Optional. The name of the table to which to write data, of the form
    +   * {projectId}.{datasetId}.{tableId}
    +   * 
    + * + * string table = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The table. + */ + java.lang.String getTable(); + + /** + * + * + *
    +   * Optional. The name of the table to which to write data, of the form
    +   * {projectId}.{datasetId}.{tableId}
    +   * 
    + * + * string table = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for table. + */ + com.google.protobuf.ByteString getTableBytes(); + + /** + * + * + *
    +   * Optional. When true, use the topic's schema as the columns to write to in
    +   * BigQuery, if it exists. `use_topic_schema` and `use_table_schema` cannot be
    +   * enabled at the same time.
    +   * 
    + * + * bool use_topic_schema = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The useTopicSchema. + */ + boolean getUseTopicSchema(); + + /** + * + * + *
    +   * Optional. When true, write the subscription name, message_id, publish_time,
    +   * attributes, and ordering_key to additional columns in the table. The
    +   * subscription name, message_id, and publish_time fields are put in their own
    +   * columns while all other message properties (other than data) are written to
    +   * a JSON object in the attributes column.
    +   * 
    + * + * bool write_metadata = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The writeMetadata. + */ + boolean getWriteMetadata(); + + /** + * + * + *
    +   * Optional. When true and use_topic_schema is true, any fields that are a
    +   * part of the topic schema that are not part of the BigQuery table schema are
    +   * dropped when writing to BigQuery. Otherwise, the schemas must be kept in
    +   * sync and any messages with extra fields are not written and remain in the
    +   * subscription's backlog.
    +   * 
    + * + * bool drop_unknown_fields = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The dropUnknownFields. + */ + boolean getDropUnknownFields(); + + /** + * + * + *
    +   * Output only. An output-only field that indicates whether or not the
    +   * subscription can receive messages.
    +   * 
    + * + * + * .google.pubsub.v1.BigQueryConfig.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for state. + */ + int getStateValue(); + + /** + * + * + *
    +   * Output only. An output-only field that indicates whether or not the
    +   * subscription can receive messages.
    +   * 
    + * + * + * .google.pubsub.v1.BigQueryConfig.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The state. + */ + com.google.pubsub.v1.BigQueryConfig.State getState(); + + /** + * + * + *
    +   * Optional. When true, use the BigQuery table's schema as the columns to
    +   * write to in BigQuery. `use_table_schema` and `use_topic_schema` cannot be
    +   * enabled at the same time.
    +   * 
    + * + * bool use_table_schema = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The useTableSchema. + */ + boolean getUseTableSchema(); + + /** + * + * + *
    +   * Optional. The service account to use to write to BigQuery. The subscription
    +   * creator or updater that specifies this field must have
    +   * `iam.serviceAccounts.actAs` permission on the service account. If not
    +   * specified, the Pub/Sub [service
    +   * agent](https://cloud.google.com/iam/docs/service-agents),
    +   * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.
    +   * 
    + * + * string service_account_email = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The serviceAccountEmail. + */ + java.lang.String getServiceAccountEmail(); + + /** + * + * + *
    +   * Optional. The service account to use to write to BigQuery. The subscription
    +   * creator or updater that specifies this field must have
    +   * `iam.serviceAccounts.actAs` permission on the service account. If not
    +   * specified, the Pub/Sub [service
    +   * agent](https://cloud.google.com/iam/docs/service-agents),
    +   * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.
    +   * 
    + * + * string service_account_email = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for serviceAccountEmail. + */ + com.google.protobuf.ByteString getServiceAccountEmailBytes(); +} diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/BigtableConfig.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/BigtableConfig.java new file mode 100644 index 000000000..38cafb2e0 --- /dev/null +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/BigtableConfig.java @@ -0,0 +1,1650 @@ +/* + * Copyright 2026 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 + +package com.google.pubsub.v1; + +/** + * + * + *
    + * Configuration for a Bigtable subscription. The Pub/Sub message will be
    + * written to a Bigtable row as follows:
    + * - row key: subscription name and message ID delimited by #.
    + * - columns: message bytes written to a single column family "data" with an
    + * empty-string column qualifier.
    + * - cell timestamp: the message publish timestamp.
    + * 
    + * + * Protobuf type {@code google.pubsub.v1.BigtableConfig} + */ +@com.google.protobuf.Generated +public final class BigtableConfig extends com.google.protobuf.GeneratedMessage + implements + // @@protoc_insertion_point(message_implements:google.pubsub.v1.BigtableConfig) + BigtableConfigOrBuilder { + private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "BigtableConfig"); + } + + // Use BigtableConfig.newBuilder() to construct. + private BigtableConfig(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + + private BigtableConfig() { + table_ = ""; + appProfileId_ = ""; + serviceAccountEmail_ = ""; + state_ = 0; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_BigtableConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_BigtableConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.BigtableConfig.class, + com.google.pubsub.v1.BigtableConfig.Builder.class); + } + + /** + * + * + *
    +   * Possible states for a Bigtable subscription.
    +   * Note: more states could be added in the future. Please code accordingly.
    +   * 
    + * + * Protobuf enum {@code google.pubsub.v1.BigtableConfig.State} + */ + public enum State implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
    +     * Default value. This value is unused.
    +     * 
    + * + * STATE_UNSPECIFIED = 0; + */ + STATE_UNSPECIFIED(0), + /** + * + * + *
    +     * The subscription can actively send messages to Bigtable.
    +     * 
    + * + * ACTIVE = 1; + */ + ACTIVE(1), + /** + * + * + *
    +     * Cannot write to Bigtable because the instance, table, or app profile
    +     * does not exist.
    +     * 
    + * + * NOT_FOUND = 2; + */ + NOT_FOUND(2), + /** + * + * + *
    +     * Cannot write to Bigtable because the app profile is not configured for
    +     * single-cluster routing.
    +     * 
    + * + * APP_PROFILE_MISCONFIGURED = 3; + */ + APP_PROFILE_MISCONFIGURED(3), + /** + * + * + *
    +     * Cannot write to Bigtable because of permission denied errors.
    +     * This can happen if:
    +     * - The Pub/Sub service agent has not been granted the
    +     * [appropriate Bigtable IAM permission
    +     * bigtable.tables.mutateRows]({$universe.dns_names.final_documentation_domain}/bigtable/docs/access-control#permissions)
    +     * - The bigtable.googleapis.com API is not enabled for the project
    +     * ([instructions]({$universe.dns_names.final_documentation_domain}/service-usage/docs/enable-disable))
    +     * 
    + * + * PERMISSION_DENIED = 4; + */ + PERMISSION_DENIED(4), + /** + * + * + *
    +     * Cannot write to Bigtable because of a missing column family ("data") or
    +     * if there is no structured row key for the subscription name + message ID.
    +     * 
    + * + * SCHEMA_MISMATCH = 5; + */ + SCHEMA_MISMATCH(5), + /** + * + * + *
    +     * Cannot write to the destination because enforce_in_transit is set to true
    +     * and the destination locations are not in the allowed regions.
    +     * 
    + * + * IN_TRANSIT_LOCATION_RESTRICTION = 6; + */ + IN_TRANSIT_LOCATION_RESTRICTION(6), + /** + * + * + *
    +     * Cannot write to Bigtable because the table is not in the same location as
    +     * where Vertex AI models used in `message_transform`s are deployed.
    +     * 
    + * + * VERTEX_AI_LOCATION_RESTRICTION = 7; + */ + VERTEX_AI_LOCATION_RESTRICTION(7), + UNRECOGNIZED(-1), + ; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "State"); + } + + /** + * + * + *
    +     * Default value. This value is unused.
    +     * 
    + * + * STATE_UNSPECIFIED = 0; + */ + public static final int STATE_UNSPECIFIED_VALUE = 0; + + /** + * + * + *
    +     * The subscription can actively send messages to Bigtable.
    +     * 
    + * + * ACTIVE = 1; + */ + public static final int ACTIVE_VALUE = 1; + + /** + * + * + *
    +     * Cannot write to Bigtable because the instance, table, or app profile
    +     * does not exist.
    +     * 
    + * + * NOT_FOUND = 2; + */ + public static final int NOT_FOUND_VALUE = 2; + + /** + * + * + *
    +     * Cannot write to Bigtable because the app profile is not configured for
    +     * single-cluster routing.
    +     * 
    + * + * APP_PROFILE_MISCONFIGURED = 3; + */ + public static final int APP_PROFILE_MISCONFIGURED_VALUE = 3; + + /** + * + * + *
    +     * Cannot write to Bigtable because of permission denied errors.
    +     * This can happen if:
    +     * - The Pub/Sub service agent has not been granted the
    +     * [appropriate Bigtable IAM permission
    +     * bigtable.tables.mutateRows]({$universe.dns_names.final_documentation_domain}/bigtable/docs/access-control#permissions)
    +     * - The bigtable.googleapis.com API is not enabled for the project
    +     * ([instructions]({$universe.dns_names.final_documentation_domain}/service-usage/docs/enable-disable))
    +     * 
    + * + * PERMISSION_DENIED = 4; + */ + public static final int PERMISSION_DENIED_VALUE = 4; + + /** + * + * + *
    +     * Cannot write to Bigtable because of a missing column family ("data") or
    +     * if there is no structured row key for the subscription name + message ID.
    +     * 
    + * + * SCHEMA_MISMATCH = 5; + */ + public static final int SCHEMA_MISMATCH_VALUE = 5; + + /** + * + * + *
    +     * Cannot write to the destination because enforce_in_transit is set to true
    +     * and the destination locations are not in the allowed regions.
    +     * 
    + * + * IN_TRANSIT_LOCATION_RESTRICTION = 6; + */ + public static final int IN_TRANSIT_LOCATION_RESTRICTION_VALUE = 6; + + /** + * + * + *
    +     * Cannot write to Bigtable because the table is not in the same location as
    +     * where Vertex AI models used in `message_transform`s are deployed.
    +     * 
    + * + * VERTEX_AI_LOCATION_RESTRICTION = 7; + */ + public static final int VERTEX_AI_LOCATION_RESTRICTION_VALUE = 7; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static State valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static State forNumber(int value) { + switch (value) { + case 0: + return STATE_UNSPECIFIED; + case 1: + return ACTIVE; + case 2: + return NOT_FOUND; + case 3: + return APP_PROFILE_MISCONFIGURED; + case 4: + return PERMISSION_DENIED; + case 5: + return SCHEMA_MISMATCH; + case 6: + return IN_TRANSIT_LOCATION_RESTRICTION; + case 7: + return VERTEX_AI_LOCATION_RESTRICTION; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public State findValueByNumber(int number) { + return State.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.pubsub.v1.BigtableConfig.getDescriptor().getEnumTypes().get(0); + } + + private static final State[] VALUES = values(); + + public static State valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private State(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.pubsub.v1.BigtableConfig.State) + } + + public static final int TABLE_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object table_ = ""; + + /** + * + * + *
    +   * Optional. The unique name of the table to write messages to.
    +   *
    +   * Values are of the form
    +   * `projects/<project>/instances/<instance>/tables/<table>`.
    +   * 
    + * + * string table = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The table. + */ + @java.lang.Override + public java.lang.String getTable() { + java.lang.Object ref = table_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + table_ = s; + return s; + } + } + + /** + * + * + *
    +   * Optional. The unique name of the table to write messages to.
    +   *
    +   * Values are of the form
    +   * `projects/<project>/instances/<instance>/tables/<table>`.
    +   * 
    + * + * string table = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for table. + */ + @java.lang.Override + public com.google.protobuf.ByteString getTableBytes() { + java.lang.Object ref = table_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + table_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int APP_PROFILE_ID_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private volatile java.lang.Object appProfileId_ = ""; + + /** + * + * + *
    +   * Optional. The app profile to use for the Bigtable writes. If not specified,
    +   * the "default" application profile will be used. The app profile must use
    +   * single-cluster routing.
    +   * 
    + * + * string app_profile_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The appProfileId. + */ + @java.lang.Override + public java.lang.String getAppProfileId() { + java.lang.Object ref = appProfileId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + appProfileId_ = s; + return s; + } + } + + /** + * + * + *
    +   * Optional. The app profile to use for the Bigtable writes. If not specified,
    +   * the "default" application profile will be used. The app profile must use
    +   * single-cluster routing.
    +   * 
    + * + * string app_profile_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for appProfileId. + */ + @java.lang.Override + public com.google.protobuf.ByteString getAppProfileIdBytes() { + java.lang.Object ref = appProfileId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + appProfileId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SERVICE_ACCOUNT_EMAIL_FIELD_NUMBER = 3; + + @SuppressWarnings("serial") + private volatile java.lang.Object serviceAccountEmail_ = ""; + + /** + * + * + *
    +   * Optional. The service account to use to write to Bigtable. The subscription
    +   * creator or updater that specifies this field must have
    +   * `iam.serviceAccounts.actAs` permission on the service account. If not
    +   * specified, the Pub/Sub [service
    +   * agent](https://cloud.google.com/iam/docs/service-agents),
    +   * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.
    +   * 
    + * + * string service_account_email = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The serviceAccountEmail. + */ + @java.lang.Override + public java.lang.String getServiceAccountEmail() { + java.lang.Object ref = serviceAccountEmail_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + serviceAccountEmail_ = s; + return s; + } + } + + /** + * + * + *
    +   * Optional. The service account to use to write to Bigtable. The subscription
    +   * creator or updater that specifies this field must have
    +   * `iam.serviceAccounts.actAs` permission on the service account. If not
    +   * specified, the Pub/Sub [service
    +   * agent](https://cloud.google.com/iam/docs/service-agents),
    +   * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.
    +   * 
    + * + * string service_account_email = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for serviceAccountEmail. + */ + @java.lang.Override + public com.google.protobuf.ByteString getServiceAccountEmailBytes() { + java.lang.Object ref = serviceAccountEmail_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + serviceAccountEmail_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int WRITE_METADATA_FIELD_NUMBER = 5; + private boolean writeMetadata_ = false; + + /** + * + * + *
    +   * Optional. When true, write the subscription name, message_id, publish_time,
    +   * attributes, and ordering_key to additional columns in the table under the
    +   * pubsub_metadata column family. The subscription name, message_id, and
    +   * publish_time fields are put in their own columns while all other message
    +   * properties (other than data) are written to a JSON object in the attributes
    +   * column.
    +   * 
    + * + * bool write_metadata = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The writeMetadata. + */ + @java.lang.Override + public boolean getWriteMetadata() { + return writeMetadata_; + } + + public static final int STATE_FIELD_NUMBER = 4; + private int state_ = 0; + + /** + * + * + *
    +   * Output only. An output-only field that indicates whether or not the
    +   * subscription can receive messages.
    +   * 
    + * + * + * .google.pubsub.v1.BigtableConfig.State state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for state. + */ + @java.lang.Override + public int getStateValue() { + return state_; + } + + /** + * + * + *
    +   * Output only. An output-only field that indicates whether or not the
    +   * subscription can receive messages.
    +   * 
    + * + * + * .google.pubsub.v1.BigtableConfig.State state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The state. + */ + @java.lang.Override + public com.google.pubsub.v1.BigtableConfig.State getState() { + com.google.pubsub.v1.BigtableConfig.State result = + com.google.pubsub.v1.BigtableConfig.State.forNumber(state_); + return result == null ? com.google.pubsub.v1.BigtableConfig.State.UNRECOGNIZED : result; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(table_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, table_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(appProfileId_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, appProfileId_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(serviceAccountEmail_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 3, serviceAccountEmail_); + } + if (state_ != com.google.pubsub.v1.BigtableConfig.State.STATE_UNSPECIFIED.getNumber()) { + output.writeEnum(4, state_); + } + if (writeMetadata_ != false) { + output.writeBool(5, writeMetadata_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(table_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, table_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(appProfileId_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, appProfileId_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(serviceAccountEmail_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(3, serviceAccountEmail_); + } + if (state_ != com.google.pubsub.v1.BigtableConfig.State.STATE_UNSPECIFIED.getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(4, state_); + } + if (writeMetadata_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(5, writeMetadata_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.pubsub.v1.BigtableConfig)) { + return super.equals(obj); + } + com.google.pubsub.v1.BigtableConfig other = (com.google.pubsub.v1.BigtableConfig) obj; + + if (!getTable().equals(other.getTable())) return false; + if (!getAppProfileId().equals(other.getAppProfileId())) return false; + if (!getServiceAccountEmail().equals(other.getServiceAccountEmail())) return false; + if (getWriteMetadata() != other.getWriteMetadata()) return false; + if (state_ != other.state_) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + TABLE_FIELD_NUMBER; + hash = (53 * hash) + getTable().hashCode(); + hash = (37 * hash) + APP_PROFILE_ID_FIELD_NUMBER; + hash = (53 * hash) + getAppProfileId().hashCode(); + hash = (37 * hash) + SERVICE_ACCOUNT_EMAIL_FIELD_NUMBER; + hash = (53 * hash) + getServiceAccountEmail().hashCode(); + hash = (37 * hash) + WRITE_METADATA_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getWriteMetadata()); + hash = (37 * hash) + STATE_FIELD_NUMBER; + hash = (53 * hash) + state_; + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.pubsub.v1.BigtableConfig parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.BigtableConfig parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.BigtableConfig parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.BigtableConfig parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.BigtableConfig parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.BigtableConfig parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.BigtableConfig parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.BigtableConfig parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.BigtableConfig parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.BigtableConfig parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.BigtableConfig parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.BigtableConfig parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.pubsub.v1.BigtableConfig prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + + /** + * + * + *
    +   * Configuration for a Bigtable subscription. The Pub/Sub message will be
    +   * written to a Bigtable row as follows:
    +   * - row key: subscription name and message ID delimited by #.
    +   * - columns: message bytes written to a single column family "data" with an
    +   * empty-string column qualifier.
    +   * - cell timestamp: the message publish timestamp.
    +   * 
    + * + * Protobuf type {@code google.pubsub.v1.BigtableConfig} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder + implements + // @@protoc_insertion_point(builder_implements:google.pubsub.v1.BigtableConfig) + com.google.pubsub.v1.BigtableConfigOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_BigtableConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_BigtableConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.BigtableConfig.class, + com.google.pubsub.v1.BigtableConfig.Builder.class); + } + + // Construct using com.google.pubsub.v1.BigtableConfig.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + table_ = ""; + appProfileId_ = ""; + serviceAccountEmail_ = ""; + writeMetadata_ = false; + state_ = 0; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_BigtableConfig_descriptor; + } + + @java.lang.Override + public com.google.pubsub.v1.BigtableConfig getDefaultInstanceForType() { + return com.google.pubsub.v1.BigtableConfig.getDefaultInstance(); + } + + @java.lang.Override + public com.google.pubsub.v1.BigtableConfig build() { + com.google.pubsub.v1.BigtableConfig result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.pubsub.v1.BigtableConfig buildPartial() { + com.google.pubsub.v1.BigtableConfig result = new com.google.pubsub.v1.BigtableConfig(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.pubsub.v1.BigtableConfig result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.table_ = table_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.appProfileId_ = appProfileId_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.serviceAccountEmail_ = serviceAccountEmail_; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.writeMetadata_ = writeMetadata_; + } + if (((from_bitField0_ & 0x00000010) != 0)) { + result.state_ = state_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.pubsub.v1.BigtableConfig) { + return mergeFrom((com.google.pubsub.v1.BigtableConfig) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.pubsub.v1.BigtableConfig other) { + if (other == com.google.pubsub.v1.BigtableConfig.getDefaultInstance()) return this; + if (!other.getTable().isEmpty()) { + table_ = other.table_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getAppProfileId().isEmpty()) { + appProfileId_ = other.appProfileId_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (!other.getServiceAccountEmail().isEmpty()) { + serviceAccountEmail_ = other.serviceAccountEmail_; + bitField0_ |= 0x00000004; + onChanged(); + } + if (other.getWriteMetadata() != false) { + setWriteMetadata(other.getWriteMetadata()); + } + if (other.state_ != 0) { + setStateValue(other.getStateValue()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + table_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + appProfileId_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: + { + serviceAccountEmail_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000004; + break; + } // case 26 + case 32: + { + state_ = input.readEnum(); + bitField0_ |= 0x00000010; + break; + } // case 32 + case 40: + { + writeMetadata_ = input.readBool(); + bitField0_ |= 0x00000008; + break; + } // case 40 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.lang.Object table_ = ""; + + /** + * + * + *
    +     * Optional. The unique name of the table to write messages to.
    +     *
    +     * Values are of the form
    +     * `projects/<project>/instances/<instance>/tables/<table>`.
    +     * 
    + * + * string table = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The table. + */ + public java.lang.String getTable() { + java.lang.Object ref = table_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + table_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +     * Optional. The unique name of the table to write messages to.
    +     *
    +     * Values are of the form
    +     * `projects/<project>/instances/<instance>/tables/<table>`.
    +     * 
    + * + * string table = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for table. + */ + public com.google.protobuf.ByteString getTableBytes() { + java.lang.Object ref = table_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + table_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +     * Optional. The unique name of the table to write messages to.
    +     *
    +     * Values are of the form
    +     * `projects/<project>/instances/<instance>/tables/<table>`.
    +     * 
    + * + * string table = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The table to set. + * @return This builder for chaining. + */ + public Builder setTable(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + table_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Optional. The unique name of the table to write messages to.
    +     *
    +     * Values are of the form
    +     * `projects/<project>/instances/<instance>/tables/<table>`.
    +     * 
    + * + * string table = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearTable() { + table_ = getDefaultInstance().getTable(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + + /** + * + * + *
    +     * Optional. The unique name of the table to write messages to.
    +     *
    +     * Values are of the form
    +     * `projects/<project>/instances/<instance>/tables/<table>`.
    +     * 
    + * + * string table = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for table to set. + * @return This builder for chaining. + */ + public Builder setTableBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + table_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object appProfileId_ = ""; + + /** + * + * + *
    +     * Optional. The app profile to use for the Bigtable writes. If not specified,
    +     * the "default" application profile will be used. The app profile must use
    +     * single-cluster routing.
    +     * 
    + * + * string app_profile_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The appProfileId. + */ + public java.lang.String getAppProfileId() { + java.lang.Object ref = appProfileId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + appProfileId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +     * Optional. The app profile to use for the Bigtable writes. If not specified,
    +     * the "default" application profile will be used. The app profile must use
    +     * single-cluster routing.
    +     * 
    + * + * string app_profile_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for appProfileId. + */ + public com.google.protobuf.ByteString getAppProfileIdBytes() { + java.lang.Object ref = appProfileId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + appProfileId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +     * Optional. The app profile to use for the Bigtable writes. If not specified,
    +     * the "default" application profile will be used. The app profile must use
    +     * single-cluster routing.
    +     * 
    + * + * string app_profile_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The appProfileId to set. + * @return This builder for chaining. + */ + public Builder setAppProfileId(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + appProfileId_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Optional. The app profile to use for the Bigtable writes. If not specified,
    +     * the "default" application profile will be used. The app profile must use
    +     * single-cluster routing.
    +     * 
    + * + * string app_profile_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearAppProfileId() { + appProfileId_ = getDefaultInstance().getAppProfileId(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + + /** + * + * + *
    +     * Optional. The app profile to use for the Bigtable writes. If not specified,
    +     * the "default" application profile will be used. The app profile must use
    +     * single-cluster routing.
    +     * 
    + * + * string app_profile_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for appProfileId to set. + * @return This builder for chaining. + */ + public Builder setAppProfileIdBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + appProfileId_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private java.lang.Object serviceAccountEmail_ = ""; + + /** + * + * + *
    +     * Optional. The service account to use to write to Bigtable. The subscription
    +     * creator or updater that specifies this field must have
    +     * `iam.serviceAccounts.actAs` permission on the service account. If not
    +     * specified, the Pub/Sub [service
    +     * agent](https://cloud.google.com/iam/docs/service-agents),
    +     * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.
    +     * 
    + * + * string service_account_email = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The serviceAccountEmail. + */ + public java.lang.String getServiceAccountEmail() { + java.lang.Object ref = serviceAccountEmail_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + serviceAccountEmail_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +     * Optional. The service account to use to write to Bigtable. The subscription
    +     * creator or updater that specifies this field must have
    +     * `iam.serviceAccounts.actAs` permission on the service account. If not
    +     * specified, the Pub/Sub [service
    +     * agent](https://cloud.google.com/iam/docs/service-agents),
    +     * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.
    +     * 
    + * + * string service_account_email = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for serviceAccountEmail. + */ + public com.google.protobuf.ByteString getServiceAccountEmailBytes() { + java.lang.Object ref = serviceAccountEmail_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + serviceAccountEmail_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +     * Optional. The service account to use to write to Bigtable. The subscription
    +     * creator or updater that specifies this field must have
    +     * `iam.serviceAccounts.actAs` permission on the service account. If not
    +     * specified, the Pub/Sub [service
    +     * agent](https://cloud.google.com/iam/docs/service-agents),
    +     * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.
    +     * 
    + * + * string service_account_email = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The serviceAccountEmail to set. + * @return This builder for chaining. + */ + public Builder setServiceAccountEmail(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + serviceAccountEmail_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Optional. The service account to use to write to Bigtable. The subscription
    +     * creator or updater that specifies this field must have
    +     * `iam.serviceAccounts.actAs` permission on the service account. If not
    +     * specified, the Pub/Sub [service
    +     * agent](https://cloud.google.com/iam/docs/service-agents),
    +     * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.
    +     * 
    + * + * string service_account_email = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearServiceAccountEmail() { + serviceAccountEmail_ = getDefaultInstance().getServiceAccountEmail(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + + /** + * + * + *
    +     * Optional. The service account to use to write to Bigtable. The subscription
    +     * creator or updater that specifies this field must have
    +     * `iam.serviceAccounts.actAs` permission on the service account. If not
    +     * specified, the Pub/Sub [service
    +     * agent](https://cloud.google.com/iam/docs/service-agents),
    +     * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.
    +     * 
    + * + * string service_account_email = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for serviceAccountEmail to set. + * @return This builder for chaining. + */ + public Builder setServiceAccountEmailBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + serviceAccountEmail_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + private boolean writeMetadata_; + + /** + * + * + *
    +     * Optional. When true, write the subscription name, message_id, publish_time,
    +     * attributes, and ordering_key to additional columns in the table under the
    +     * pubsub_metadata column family. The subscription name, message_id, and
    +     * publish_time fields are put in their own columns while all other message
    +     * properties (other than data) are written to a JSON object in the attributes
    +     * column.
    +     * 
    + * + * bool write_metadata = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The writeMetadata. + */ + @java.lang.Override + public boolean getWriteMetadata() { + return writeMetadata_; + } + + /** + * + * + *
    +     * Optional. When true, write the subscription name, message_id, publish_time,
    +     * attributes, and ordering_key to additional columns in the table under the
    +     * pubsub_metadata column family. The subscription name, message_id, and
    +     * publish_time fields are put in their own columns while all other message
    +     * properties (other than data) are written to a JSON object in the attributes
    +     * column.
    +     * 
    + * + * bool write_metadata = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The writeMetadata to set. + * @return This builder for chaining. + */ + public Builder setWriteMetadata(boolean value) { + + writeMetadata_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Optional. When true, write the subscription name, message_id, publish_time,
    +     * attributes, and ordering_key to additional columns in the table under the
    +     * pubsub_metadata column family. The subscription name, message_id, and
    +     * publish_time fields are put in their own columns while all other message
    +     * properties (other than data) are written to a JSON object in the attributes
    +     * column.
    +     * 
    + * + * bool write_metadata = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearWriteMetadata() { + bitField0_ = (bitField0_ & ~0x00000008); + writeMetadata_ = false; + onChanged(); + return this; + } + + private int state_ = 0; + + /** + * + * + *
    +     * Output only. An output-only field that indicates whether or not the
    +     * subscription can receive messages.
    +     * 
    + * + * + * .google.pubsub.v1.BigtableConfig.State state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for state. + */ + @java.lang.Override + public int getStateValue() { + return state_; + } + + /** + * + * + *
    +     * Output only. An output-only field that indicates whether or not the
    +     * subscription can receive messages.
    +     * 
    + * + * + * .google.pubsub.v1.BigtableConfig.State state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The enum numeric value on the wire for state to set. + * @return This builder for chaining. + */ + public Builder setStateValue(int value) { + state_ = value; + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Output only. An output-only field that indicates whether or not the
    +     * subscription can receive messages.
    +     * 
    + * + * + * .google.pubsub.v1.BigtableConfig.State state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The state. + */ + @java.lang.Override + public com.google.pubsub.v1.BigtableConfig.State getState() { + com.google.pubsub.v1.BigtableConfig.State result = + com.google.pubsub.v1.BigtableConfig.State.forNumber(state_); + return result == null ? com.google.pubsub.v1.BigtableConfig.State.UNRECOGNIZED : result; + } + + /** + * + * + *
    +     * Output only. An output-only field that indicates whether or not the
    +     * subscription can receive messages.
    +     * 
    + * + * + * .google.pubsub.v1.BigtableConfig.State state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The state to set. + * @return This builder for chaining. + */ + public Builder setState(com.google.pubsub.v1.BigtableConfig.State value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000010; + state_ = value.getNumber(); + onChanged(); + return this; + } + + /** + * + * + *
    +     * Output only. An output-only field that indicates whether or not the
    +     * subscription can receive messages.
    +     * 
    + * + * + * .google.pubsub.v1.BigtableConfig.State state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return This builder for chaining. + */ + public Builder clearState() { + bitField0_ = (bitField0_ & ~0x00000010); + state_ = 0; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:google.pubsub.v1.BigtableConfig) + } + + // @@protoc_insertion_point(class_scope:google.pubsub.v1.BigtableConfig) + private static final com.google.pubsub.v1.BigtableConfig DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.pubsub.v1.BigtableConfig(); + } + + public static com.google.pubsub.v1.BigtableConfig getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public BigtableConfig parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.pubsub.v1.BigtableConfig getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/BigtableConfigOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/BigtableConfigOrBuilder.java new file mode 100644 index 000000000..ef22565e2 --- /dev/null +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/BigtableConfigOrBuilder.java @@ -0,0 +1,176 @@ +/* + * Copyright 2026 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 + +package com.google.pubsub.v1; + +@com.google.protobuf.Generated +public interface BigtableConfigOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.pubsub.v1.BigtableConfig) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
    +   * Optional. The unique name of the table to write messages to.
    +   *
    +   * Values are of the form
    +   * `projects/<project>/instances/<instance>/tables/<table>`.
    +   * 
    + * + * string table = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The table. + */ + java.lang.String getTable(); + + /** + * + * + *
    +   * Optional. The unique name of the table to write messages to.
    +   *
    +   * Values are of the form
    +   * `projects/<project>/instances/<instance>/tables/<table>`.
    +   * 
    + * + * string table = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for table. + */ + com.google.protobuf.ByteString getTableBytes(); + + /** + * + * + *
    +   * Optional. The app profile to use for the Bigtable writes. If not specified,
    +   * the "default" application profile will be used. The app profile must use
    +   * single-cluster routing.
    +   * 
    + * + * string app_profile_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The appProfileId. + */ + java.lang.String getAppProfileId(); + + /** + * + * + *
    +   * Optional. The app profile to use for the Bigtable writes. If not specified,
    +   * the "default" application profile will be used. The app profile must use
    +   * single-cluster routing.
    +   * 
    + * + * string app_profile_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for appProfileId. + */ + com.google.protobuf.ByteString getAppProfileIdBytes(); + + /** + * + * + *
    +   * Optional. The service account to use to write to Bigtable. The subscription
    +   * creator or updater that specifies this field must have
    +   * `iam.serviceAccounts.actAs` permission on the service account. If not
    +   * specified, the Pub/Sub [service
    +   * agent](https://cloud.google.com/iam/docs/service-agents),
    +   * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.
    +   * 
    + * + * string service_account_email = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The serviceAccountEmail. + */ + java.lang.String getServiceAccountEmail(); + + /** + * + * + *
    +   * Optional. The service account to use to write to Bigtable. The subscription
    +   * creator or updater that specifies this field must have
    +   * `iam.serviceAccounts.actAs` permission on the service account. If not
    +   * specified, the Pub/Sub [service
    +   * agent](https://cloud.google.com/iam/docs/service-agents),
    +   * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.
    +   * 
    + * + * string service_account_email = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for serviceAccountEmail. + */ + com.google.protobuf.ByteString getServiceAccountEmailBytes(); + + /** + * + * + *
    +   * Optional. When true, write the subscription name, message_id, publish_time,
    +   * attributes, and ordering_key to additional columns in the table under the
    +   * pubsub_metadata column family. The subscription name, message_id, and
    +   * publish_time fields are put in their own columns while all other message
    +   * properties (other than data) are written to a JSON object in the attributes
    +   * column.
    +   * 
    + * + * bool write_metadata = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The writeMetadata. + */ + boolean getWriteMetadata(); + + /** + * + * + *
    +   * Output only. An output-only field that indicates whether or not the
    +   * subscription can receive messages.
    +   * 
    + * + * + * .google.pubsub.v1.BigtableConfig.State state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for state. + */ + int getStateValue(); + + /** + * + * + *
    +   * Output only. An output-only field that indicates whether or not the
    +   * subscription can receive messages.
    +   * 
    + * + * + * .google.pubsub.v1.BigtableConfig.State state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The state. + */ + com.google.pubsub.v1.BigtableConfig.State getState(); +} diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/CloudStorageConfig.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/CloudStorageConfig.java new file mode 100644 index 000000000..b30b59267 --- /dev/null +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/CloudStorageConfig.java @@ -0,0 +1,4217 @@ +/* + * Copyright 2026 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 + +package com.google.pubsub.v1; + +/** + * + * + *
    + * Configuration for a Cloud Storage subscription.
    + * 
    + * + * Protobuf type {@code google.pubsub.v1.CloudStorageConfig} + */ +@com.google.protobuf.Generated +public final class CloudStorageConfig extends com.google.protobuf.GeneratedMessage + implements + // @@protoc_insertion_point(message_implements:google.pubsub.v1.CloudStorageConfig) + CloudStorageConfigOrBuilder { + private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "CloudStorageConfig"); + } + + // Use CloudStorageConfig.newBuilder() to construct. + private CloudStorageConfig(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + + private CloudStorageConfig() { + bucket_ = ""; + filenamePrefix_ = ""; + filenameSuffix_ = ""; + filenameDatetimeFormat_ = ""; + state_ = 0; + serviceAccountEmail_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_CloudStorageConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_CloudStorageConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.CloudStorageConfig.class, + com.google.pubsub.v1.CloudStorageConfig.Builder.class); + } + + /** + * + * + *
    +   * Possible states for a Cloud Storage subscription.
    +   * 
    + * + * Protobuf enum {@code google.pubsub.v1.CloudStorageConfig.State} + */ + public enum State implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
    +     * Default value. This value is unused.
    +     * 
    + * + * STATE_UNSPECIFIED = 0; + */ + STATE_UNSPECIFIED(0), + /** + * + * + *
    +     * The subscription can actively send messages to Cloud Storage.
    +     * 
    + * + * ACTIVE = 1; + */ + ACTIVE(1), + /** + * + * + *
    +     * Cannot write to the Cloud Storage bucket because of permission denied
    +     * errors.
    +     * 
    + * + * PERMISSION_DENIED = 2; + */ + PERMISSION_DENIED(2), + /** + * + * + *
    +     * Cannot write to the Cloud Storage bucket because it does not exist.
    +     * 
    + * + * NOT_FOUND = 3; + */ + NOT_FOUND(3), + /** + * + * + *
    +     * Cannot write to the destination because enforce_in_transit is set to true
    +     * and the destination locations are not in the allowed regions.
    +     * 
    + * + * IN_TRANSIT_LOCATION_RESTRICTION = 4; + */ + IN_TRANSIT_LOCATION_RESTRICTION(4), + /** + * + * + *
    +     * Cannot write to the Cloud Storage bucket due to an incompatibility
    +     * between the topic schema and subscription settings.
    +     * 
    + * + * SCHEMA_MISMATCH = 5; + */ + SCHEMA_MISMATCH(5), + /** + * + * + *
    +     * Cannot write to the Cloud Storage bucket because the bucket is not in the
    +     * same location as where Vertex AI models used in `message_transform`s are
    +     * deployed.
    +     * 
    + * + * VERTEX_AI_LOCATION_RESTRICTION = 6; + */ + VERTEX_AI_LOCATION_RESTRICTION(6), + UNRECOGNIZED(-1), + ; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "State"); + } + + /** + * + * + *
    +     * Default value. This value is unused.
    +     * 
    + * + * STATE_UNSPECIFIED = 0; + */ + public static final int STATE_UNSPECIFIED_VALUE = 0; + + /** + * + * + *
    +     * The subscription can actively send messages to Cloud Storage.
    +     * 
    + * + * ACTIVE = 1; + */ + public static final int ACTIVE_VALUE = 1; + + /** + * + * + *
    +     * Cannot write to the Cloud Storage bucket because of permission denied
    +     * errors.
    +     * 
    + * + * PERMISSION_DENIED = 2; + */ + public static final int PERMISSION_DENIED_VALUE = 2; + + /** + * + * + *
    +     * Cannot write to the Cloud Storage bucket because it does not exist.
    +     * 
    + * + * NOT_FOUND = 3; + */ + public static final int NOT_FOUND_VALUE = 3; + + /** + * + * + *
    +     * Cannot write to the destination because enforce_in_transit is set to true
    +     * and the destination locations are not in the allowed regions.
    +     * 
    + * + * IN_TRANSIT_LOCATION_RESTRICTION = 4; + */ + public static final int IN_TRANSIT_LOCATION_RESTRICTION_VALUE = 4; + + /** + * + * + *
    +     * Cannot write to the Cloud Storage bucket due to an incompatibility
    +     * between the topic schema and subscription settings.
    +     * 
    + * + * SCHEMA_MISMATCH = 5; + */ + public static final int SCHEMA_MISMATCH_VALUE = 5; + + /** + * + * + *
    +     * Cannot write to the Cloud Storage bucket because the bucket is not in the
    +     * same location as where Vertex AI models used in `message_transform`s are
    +     * deployed.
    +     * 
    + * + * VERTEX_AI_LOCATION_RESTRICTION = 6; + */ + public static final int VERTEX_AI_LOCATION_RESTRICTION_VALUE = 6; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static State valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static State forNumber(int value) { + switch (value) { + case 0: + return STATE_UNSPECIFIED; + case 1: + return ACTIVE; + case 2: + return PERMISSION_DENIED; + case 3: + return NOT_FOUND; + case 4: + return IN_TRANSIT_LOCATION_RESTRICTION; + case 5: + return SCHEMA_MISMATCH; + case 6: + return VERTEX_AI_LOCATION_RESTRICTION; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public State findValueByNumber(int number) { + return State.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.pubsub.v1.CloudStorageConfig.getDescriptor().getEnumTypes().get(0); + } + + private static final State[] VALUES = values(); + + public static State valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private State(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.pubsub.v1.CloudStorageConfig.State) + } + + public interface TextConfigOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.pubsub.v1.CloudStorageConfig.TextConfig) + com.google.protobuf.MessageOrBuilder {} + + /** + * + * + *
    +   * Configuration for writing message data in text format.
    +   * Message payloads will be written to files as raw text, separated by a
    +   * newline.
    +   * 
    + * + * Protobuf type {@code google.pubsub.v1.CloudStorageConfig.TextConfig} + */ + public static final class TextConfig extends com.google.protobuf.GeneratedMessage + implements + // @@protoc_insertion_point(message_implements:google.pubsub.v1.CloudStorageConfig.TextConfig) + TextConfigOrBuilder { + private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "TextConfig"); + } + + // Use TextConfig.newBuilder() to construct. + private TextConfig(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + + private TextConfig() {} + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_CloudStorageConfig_TextConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_CloudStorageConfig_TextConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.CloudStorageConfig.TextConfig.class, + com.google.pubsub.v1.CloudStorageConfig.TextConfig.Builder.class); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.pubsub.v1.CloudStorageConfig.TextConfig)) { + return super.equals(obj); + } + com.google.pubsub.v1.CloudStorageConfig.TextConfig other = + (com.google.pubsub.v1.CloudStorageConfig.TextConfig) obj; + + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.pubsub.v1.CloudStorageConfig.TextConfig parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.CloudStorageConfig.TextConfig parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.CloudStorageConfig.TextConfig parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.CloudStorageConfig.TextConfig parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.CloudStorageConfig.TextConfig parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.CloudStorageConfig.TextConfig parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.CloudStorageConfig.TextConfig parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.CloudStorageConfig.TextConfig parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.CloudStorageConfig.TextConfig parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.CloudStorageConfig.TextConfig parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.CloudStorageConfig.TextConfig parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.CloudStorageConfig.TextConfig parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.pubsub.v1.CloudStorageConfig.TextConfig prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + + /** + * + * + *
    +     * Configuration for writing message data in text format.
    +     * Message payloads will be written to files as raw text, separated by a
    +     * newline.
    +     * 
    + * + * Protobuf type {@code google.pubsub.v1.CloudStorageConfig.TextConfig} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder + implements + // @@protoc_insertion_point(builder_implements:google.pubsub.v1.CloudStorageConfig.TextConfig) + com.google.pubsub.v1.CloudStorageConfig.TextConfigOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_CloudStorageConfig_TextConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_CloudStorageConfig_TextConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.CloudStorageConfig.TextConfig.class, + com.google.pubsub.v1.CloudStorageConfig.TextConfig.Builder.class); + } + + // Construct using com.google.pubsub.v1.CloudStorageConfig.TextConfig.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_CloudStorageConfig_TextConfig_descriptor; + } + + @java.lang.Override + public com.google.pubsub.v1.CloudStorageConfig.TextConfig getDefaultInstanceForType() { + return com.google.pubsub.v1.CloudStorageConfig.TextConfig.getDefaultInstance(); + } + + @java.lang.Override + public com.google.pubsub.v1.CloudStorageConfig.TextConfig build() { + com.google.pubsub.v1.CloudStorageConfig.TextConfig result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.pubsub.v1.CloudStorageConfig.TextConfig buildPartial() { + com.google.pubsub.v1.CloudStorageConfig.TextConfig result = + new com.google.pubsub.v1.CloudStorageConfig.TextConfig(this); + onBuilt(); + return result; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.pubsub.v1.CloudStorageConfig.TextConfig) { + return mergeFrom((com.google.pubsub.v1.CloudStorageConfig.TextConfig) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.pubsub.v1.CloudStorageConfig.TextConfig other) { + if (other == com.google.pubsub.v1.CloudStorageConfig.TextConfig.getDefaultInstance()) + return this; + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + // @@protoc_insertion_point(builder_scope:google.pubsub.v1.CloudStorageConfig.TextConfig) + } + + // @@protoc_insertion_point(class_scope:google.pubsub.v1.CloudStorageConfig.TextConfig) + private static final com.google.pubsub.v1.CloudStorageConfig.TextConfig DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.pubsub.v1.CloudStorageConfig.TextConfig(); + } + + public static com.google.pubsub.v1.CloudStorageConfig.TextConfig getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public TextConfig parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException() + .setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.pubsub.v1.CloudStorageConfig.TextConfig getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public interface AvroConfigOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.pubsub.v1.CloudStorageConfig.AvroConfig) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
    +     * Optional. When true, write the subscription name, message_id,
    +     * publish_time, attributes, and ordering_key as additional fields in the
    +     * output. The subscription name, message_id, and publish_time fields are
    +     * put in their own fields while all other message properties other than
    +     * data (for example, an ordering_key, if present) are added as entries in
    +     * the attributes map.
    +     * 
    + * + * bool write_metadata = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The writeMetadata. + */ + boolean getWriteMetadata(); + + /** + * + * + *
    +     * Optional. When true, the output Cloud Storage file will be serialized
    +     * using the topic schema, if it exists.
    +     * 
    + * + * bool use_topic_schema = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The useTopicSchema. + */ + boolean getUseTopicSchema(); + } + + /** + * + * + *
    +   * Configuration for writing message data in Avro format.
    +   * Message payloads and metadata will be written to files as an Avro binary.
    +   * 
    + * + * Protobuf type {@code google.pubsub.v1.CloudStorageConfig.AvroConfig} + */ + public static final class AvroConfig extends com.google.protobuf.GeneratedMessage + implements + // @@protoc_insertion_point(message_implements:google.pubsub.v1.CloudStorageConfig.AvroConfig) + AvroConfigOrBuilder { + private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "AvroConfig"); + } + + // Use AvroConfig.newBuilder() to construct. + private AvroConfig(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + + private AvroConfig() {} + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_CloudStorageConfig_AvroConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_CloudStorageConfig_AvroConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.CloudStorageConfig.AvroConfig.class, + com.google.pubsub.v1.CloudStorageConfig.AvroConfig.Builder.class); + } + + public static final int WRITE_METADATA_FIELD_NUMBER = 1; + private boolean writeMetadata_ = false; + + /** + * + * + *
    +     * Optional. When true, write the subscription name, message_id,
    +     * publish_time, attributes, and ordering_key as additional fields in the
    +     * output. The subscription name, message_id, and publish_time fields are
    +     * put in their own fields while all other message properties other than
    +     * data (for example, an ordering_key, if present) are added as entries in
    +     * the attributes map.
    +     * 
    + * + * bool write_metadata = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The writeMetadata. + */ + @java.lang.Override + public boolean getWriteMetadata() { + return writeMetadata_; + } + + public static final int USE_TOPIC_SCHEMA_FIELD_NUMBER = 2; + private boolean useTopicSchema_ = false; + + /** + * + * + *
    +     * Optional. When true, the output Cloud Storage file will be serialized
    +     * using the topic schema, if it exists.
    +     * 
    + * + * bool use_topic_schema = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The useTopicSchema. + */ + @java.lang.Override + public boolean getUseTopicSchema() { + return useTopicSchema_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (writeMetadata_ != false) { + output.writeBool(1, writeMetadata_); + } + if (useTopicSchema_ != false) { + output.writeBool(2, useTopicSchema_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (writeMetadata_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(1, writeMetadata_); + } + if (useTopicSchema_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(2, useTopicSchema_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.pubsub.v1.CloudStorageConfig.AvroConfig)) { + return super.equals(obj); + } + com.google.pubsub.v1.CloudStorageConfig.AvroConfig other = + (com.google.pubsub.v1.CloudStorageConfig.AvroConfig) obj; + + if (getWriteMetadata() != other.getWriteMetadata()) return false; + if (getUseTopicSchema() != other.getUseTopicSchema()) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + WRITE_METADATA_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getWriteMetadata()); + hash = (37 * hash) + USE_TOPIC_SCHEMA_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getUseTopicSchema()); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.pubsub.v1.CloudStorageConfig.AvroConfig parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.CloudStorageConfig.AvroConfig parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.CloudStorageConfig.AvroConfig parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.CloudStorageConfig.AvroConfig parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.CloudStorageConfig.AvroConfig parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.CloudStorageConfig.AvroConfig parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.CloudStorageConfig.AvroConfig parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.CloudStorageConfig.AvroConfig parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.CloudStorageConfig.AvroConfig parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.CloudStorageConfig.AvroConfig parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.CloudStorageConfig.AvroConfig parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.CloudStorageConfig.AvroConfig parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.pubsub.v1.CloudStorageConfig.AvroConfig prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + + /** + * + * + *
    +     * Configuration for writing message data in Avro format.
    +     * Message payloads and metadata will be written to files as an Avro binary.
    +     * 
    + * + * Protobuf type {@code google.pubsub.v1.CloudStorageConfig.AvroConfig} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder + implements + // @@protoc_insertion_point(builder_implements:google.pubsub.v1.CloudStorageConfig.AvroConfig) + com.google.pubsub.v1.CloudStorageConfig.AvroConfigOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_CloudStorageConfig_AvroConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_CloudStorageConfig_AvroConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.CloudStorageConfig.AvroConfig.class, + com.google.pubsub.v1.CloudStorageConfig.AvroConfig.Builder.class); + } + + // Construct using com.google.pubsub.v1.CloudStorageConfig.AvroConfig.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + writeMetadata_ = false; + useTopicSchema_ = false; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_CloudStorageConfig_AvroConfig_descriptor; + } + + @java.lang.Override + public com.google.pubsub.v1.CloudStorageConfig.AvroConfig getDefaultInstanceForType() { + return com.google.pubsub.v1.CloudStorageConfig.AvroConfig.getDefaultInstance(); + } + + @java.lang.Override + public com.google.pubsub.v1.CloudStorageConfig.AvroConfig build() { + com.google.pubsub.v1.CloudStorageConfig.AvroConfig result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.pubsub.v1.CloudStorageConfig.AvroConfig buildPartial() { + com.google.pubsub.v1.CloudStorageConfig.AvroConfig result = + new com.google.pubsub.v1.CloudStorageConfig.AvroConfig(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.pubsub.v1.CloudStorageConfig.AvroConfig result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.writeMetadata_ = writeMetadata_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.useTopicSchema_ = useTopicSchema_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.pubsub.v1.CloudStorageConfig.AvroConfig) { + return mergeFrom((com.google.pubsub.v1.CloudStorageConfig.AvroConfig) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.pubsub.v1.CloudStorageConfig.AvroConfig other) { + if (other == com.google.pubsub.v1.CloudStorageConfig.AvroConfig.getDefaultInstance()) + return this; + if (other.getWriteMetadata() != false) { + setWriteMetadata(other.getWriteMetadata()); + } + if (other.getUseTopicSchema() != false) { + setUseTopicSchema(other.getUseTopicSchema()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: + { + writeMetadata_ = input.readBool(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 16: + { + useTopicSchema_ = input.readBool(); + bitField0_ |= 0x00000002; + break; + } // case 16 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private boolean writeMetadata_; + + /** + * + * + *
    +       * Optional. When true, write the subscription name, message_id,
    +       * publish_time, attributes, and ordering_key as additional fields in the
    +       * output. The subscription name, message_id, and publish_time fields are
    +       * put in their own fields while all other message properties other than
    +       * data (for example, an ordering_key, if present) are added as entries in
    +       * the attributes map.
    +       * 
    + * + * bool write_metadata = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The writeMetadata. + */ + @java.lang.Override + public boolean getWriteMetadata() { + return writeMetadata_; + } + + /** + * + * + *
    +       * Optional. When true, write the subscription name, message_id,
    +       * publish_time, attributes, and ordering_key as additional fields in the
    +       * output. The subscription name, message_id, and publish_time fields are
    +       * put in their own fields while all other message properties other than
    +       * data (for example, an ordering_key, if present) are added as entries in
    +       * the attributes map.
    +       * 
    + * + * bool write_metadata = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The writeMetadata to set. + * @return This builder for chaining. + */ + public Builder setWriteMetadata(boolean value) { + + writeMetadata_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. When true, write the subscription name, message_id,
    +       * publish_time, attributes, and ordering_key as additional fields in the
    +       * output. The subscription name, message_id, and publish_time fields are
    +       * put in their own fields while all other message properties other than
    +       * data (for example, an ordering_key, if present) are added as entries in
    +       * the attributes map.
    +       * 
    + * + * bool write_metadata = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearWriteMetadata() { + bitField0_ = (bitField0_ & ~0x00000001); + writeMetadata_ = false; + onChanged(); + return this; + } + + private boolean useTopicSchema_; + + /** + * + * + *
    +       * Optional. When true, the output Cloud Storage file will be serialized
    +       * using the topic schema, if it exists.
    +       * 
    + * + * bool use_topic_schema = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The useTopicSchema. + */ + @java.lang.Override + public boolean getUseTopicSchema() { + return useTopicSchema_; + } + + /** + * + * + *
    +       * Optional. When true, the output Cloud Storage file will be serialized
    +       * using the topic schema, if it exists.
    +       * 
    + * + * bool use_topic_schema = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The useTopicSchema to set. + * @return This builder for chaining. + */ + public Builder setUseTopicSchema(boolean value) { + + useTopicSchema_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. When true, the output Cloud Storage file will be serialized
    +       * using the topic schema, if it exists.
    +       * 
    + * + * bool use_topic_schema = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearUseTopicSchema() { + bitField0_ = (bitField0_ & ~0x00000002); + useTopicSchema_ = false; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:google.pubsub.v1.CloudStorageConfig.AvroConfig) + } + + // @@protoc_insertion_point(class_scope:google.pubsub.v1.CloudStorageConfig.AvroConfig) + private static final com.google.pubsub.v1.CloudStorageConfig.AvroConfig DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.pubsub.v1.CloudStorageConfig.AvroConfig(); + } + + public static com.google.pubsub.v1.CloudStorageConfig.AvroConfig getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AvroConfig parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException() + .setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.pubsub.v1.CloudStorageConfig.AvroConfig getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + private int bitField0_; + private int outputFormatCase_ = 0; + + @SuppressWarnings("serial") + private java.lang.Object outputFormat_; + + public enum OutputFormatCase + implements + com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + TEXT_CONFIG(4), + AVRO_CONFIG(5), + OUTPUTFORMAT_NOT_SET(0); + private final int value; + + private OutputFormatCase(int value) { + this.value = value; + } + + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static OutputFormatCase valueOf(int value) { + return forNumber(value); + } + + public static OutputFormatCase forNumber(int value) { + switch (value) { + case 4: + return TEXT_CONFIG; + case 5: + return AVRO_CONFIG; + case 0: + return OUTPUTFORMAT_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public OutputFormatCase getOutputFormatCase() { + return OutputFormatCase.forNumber(outputFormatCase_); + } + + public static final int BUCKET_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object bucket_ = ""; + + /** + * + * + *
    +   * Required. User-provided name for the Cloud Storage bucket.
    +   * The bucket must be created by the user. The bucket name must be without
    +   * any prefix like "gs://". See the [bucket naming
    +   * requirements] (https://cloud.google.com/storage/docs/buckets#naming).
    +   * 
    + * + * string bucket = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bucket. + */ + @java.lang.Override + public java.lang.String getBucket() { + java.lang.Object ref = bucket_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + bucket_ = s; + return s; + } + } + + /** + * + * + *
    +   * Required. User-provided name for the Cloud Storage bucket.
    +   * The bucket must be created by the user. The bucket name must be without
    +   * any prefix like "gs://". See the [bucket naming
    +   * requirements] (https://cloud.google.com/storage/docs/buckets#naming).
    +   * 
    + * + * string bucket = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for bucket. + */ + @java.lang.Override + public com.google.protobuf.ByteString getBucketBytes() { + java.lang.Object ref = bucket_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + bucket_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int FILENAME_PREFIX_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private volatile java.lang.Object filenamePrefix_ = ""; + + /** + * + * + *
    +   * Optional. User-provided prefix for Cloud Storage filename. See the [object
    +   * naming requirements](https://cloud.google.com/storage/docs/objects#naming).
    +   * 
    + * + * string filename_prefix = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The filenamePrefix. + */ + @java.lang.Override + public java.lang.String getFilenamePrefix() { + java.lang.Object ref = filenamePrefix_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + filenamePrefix_ = s; + return s; + } + } + + /** + * + * + *
    +   * Optional. User-provided prefix for Cloud Storage filename. See the [object
    +   * naming requirements](https://cloud.google.com/storage/docs/objects#naming).
    +   * 
    + * + * string filename_prefix = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for filenamePrefix. + */ + @java.lang.Override + public com.google.protobuf.ByteString getFilenamePrefixBytes() { + java.lang.Object ref = filenamePrefix_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + filenamePrefix_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int FILENAME_SUFFIX_FIELD_NUMBER = 3; + + @SuppressWarnings("serial") + private volatile java.lang.Object filenameSuffix_ = ""; + + /** + * + * + *
    +   * Optional. User-provided suffix for Cloud Storage filename. See the [object
    +   * naming requirements](https://cloud.google.com/storage/docs/objects#naming).
    +   * Must not end in "/".
    +   * 
    + * + * string filename_suffix = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The filenameSuffix. + */ + @java.lang.Override + public java.lang.String getFilenameSuffix() { + java.lang.Object ref = filenameSuffix_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + filenameSuffix_ = s; + return s; + } + } + + /** + * + * + *
    +   * Optional. User-provided suffix for Cloud Storage filename. See the [object
    +   * naming requirements](https://cloud.google.com/storage/docs/objects#naming).
    +   * Must not end in "/".
    +   * 
    + * + * string filename_suffix = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for filenameSuffix. + */ + @java.lang.Override + public com.google.protobuf.ByteString getFilenameSuffixBytes() { + java.lang.Object ref = filenameSuffix_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + filenameSuffix_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int FILENAME_DATETIME_FORMAT_FIELD_NUMBER = 10; + + @SuppressWarnings("serial") + private volatile java.lang.Object filenameDatetimeFormat_ = ""; + + /** + * + * + *
    +   * Optional. User-provided format string specifying how to represent datetimes
    +   * in Cloud Storage filenames. See the [datetime format
    +   * guidance](https://cloud.google.com/pubsub/docs/create-cloudstorage-subscription#file_names).
    +   * 
    + * + * string filename_datetime_format = 10 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The filenameDatetimeFormat. + */ + @java.lang.Override + public java.lang.String getFilenameDatetimeFormat() { + java.lang.Object ref = filenameDatetimeFormat_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + filenameDatetimeFormat_ = s; + return s; + } + } + + /** + * + * + *
    +   * Optional. User-provided format string specifying how to represent datetimes
    +   * in Cloud Storage filenames. See the [datetime format
    +   * guidance](https://cloud.google.com/pubsub/docs/create-cloudstorage-subscription#file_names).
    +   * 
    + * + * string filename_datetime_format = 10 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for filenameDatetimeFormat. + */ + @java.lang.Override + public com.google.protobuf.ByteString getFilenameDatetimeFormatBytes() { + java.lang.Object ref = filenameDatetimeFormat_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + filenameDatetimeFormat_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int TEXT_CONFIG_FIELD_NUMBER = 4; + + /** + * + * + *
    +   * Optional. If set, message data will be written to Cloud Storage in text
    +   * format.
    +   * 
    + * + * + * .google.pubsub.v1.CloudStorageConfig.TextConfig text_config = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the textConfig field is set. + */ + @java.lang.Override + public boolean hasTextConfig() { + return outputFormatCase_ == 4; + } + + /** + * + * + *
    +   * Optional. If set, message data will be written to Cloud Storage in text
    +   * format.
    +   * 
    + * + * + * .google.pubsub.v1.CloudStorageConfig.TextConfig text_config = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The textConfig. + */ + @java.lang.Override + public com.google.pubsub.v1.CloudStorageConfig.TextConfig getTextConfig() { + if (outputFormatCase_ == 4) { + return (com.google.pubsub.v1.CloudStorageConfig.TextConfig) outputFormat_; + } + return com.google.pubsub.v1.CloudStorageConfig.TextConfig.getDefaultInstance(); + } + + /** + * + * + *
    +   * Optional. If set, message data will be written to Cloud Storage in text
    +   * format.
    +   * 
    + * + * + * .google.pubsub.v1.CloudStorageConfig.TextConfig text_config = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.CloudStorageConfig.TextConfigOrBuilder getTextConfigOrBuilder() { + if (outputFormatCase_ == 4) { + return (com.google.pubsub.v1.CloudStorageConfig.TextConfig) outputFormat_; + } + return com.google.pubsub.v1.CloudStorageConfig.TextConfig.getDefaultInstance(); + } + + public static final int AVRO_CONFIG_FIELD_NUMBER = 5; + + /** + * + * + *
    +   * Optional. If set, message data will be written to Cloud Storage in Avro
    +   * format.
    +   * 
    + * + * + * .google.pubsub.v1.CloudStorageConfig.AvroConfig avro_config = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the avroConfig field is set. + */ + @java.lang.Override + public boolean hasAvroConfig() { + return outputFormatCase_ == 5; + } + + /** + * + * + *
    +   * Optional. If set, message data will be written to Cloud Storage in Avro
    +   * format.
    +   * 
    + * + * + * .google.pubsub.v1.CloudStorageConfig.AvroConfig avro_config = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The avroConfig. + */ + @java.lang.Override + public com.google.pubsub.v1.CloudStorageConfig.AvroConfig getAvroConfig() { + if (outputFormatCase_ == 5) { + return (com.google.pubsub.v1.CloudStorageConfig.AvroConfig) outputFormat_; + } + return com.google.pubsub.v1.CloudStorageConfig.AvroConfig.getDefaultInstance(); + } + + /** + * + * + *
    +   * Optional. If set, message data will be written to Cloud Storage in Avro
    +   * format.
    +   * 
    + * + * + * .google.pubsub.v1.CloudStorageConfig.AvroConfig avro_config = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.CloudStorageConfig.AvroConfigOrBuilder getAvroConfigOrBuilder() { + if (outputFormatCase_ == 5) { + return (com.google.pubsub.v1.CloudStorageConfig.AvroConfig) outputFormat_; + } + return com.google.pubsub.v1.CloudStorageConfig.AvroConfig.getDefaultInstance(); + } + + public static final int MAX_DURATION_FIELD_NUMBER = 6; + private com.google.protobuf.Duration maxDuration_; + + /** + * + * + *
    +   * Optional. The maximum duration that can elapse before a new Cloud Storage
    +   * file is created. Min 1 minute, max 10 minutes, default 5 minutes. May not
    +   * exceed the subscription's acknowledgment deadline.
    +   * 
    + * + * .google.protobuf.Duration max_duration = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the maxDuration field is set. + */ + @java.lang.Override + public boolean hasMaxDuration() { + return ((bitField0_ & 0x00000001) != 0); + } + + /** + * + * + *
    +   * Optional. The maximum duration that can elapse before a new Cloud Storage
    +   * file is created. Min 1 minute, max 10 minutes, default 5 minutes. May not
    +   * exceed the subscription's acknowledgment deadline.
    +   * 
    + * + * .google.protobuf.Duration max_duration = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The maxDuration. + */ + @java.lang.Override + public com.google.protobuf.Duration getMaxDuration() { + return maxDuration_ == null ? com.google.protobuf.Duration.getDefaultInstance() : maxDuration_; + } + + /** + * + * + *
    +   * Optional. The maximum duration that can elapse before a new Cloud Storage
    +   * file is created. Min 1 minute, max 10 minutes, default 5 minutes. May not
    +   * exceed the subscription's acknowledgment deadline.
    +   * 
    + * + * .google.protobuf.Duration max_duration = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.protobuf.DurationOrBuilder getMaxDurationOrBuilder() { + return maxDuration_ == null ? com.google.protobuf.Duration.getDefaultInstance() : maxDuration_; + } + + public static final int MAX_BYTES_FIELD_NUMBER = 7; + private long maxBytes_ = 0L; + + /** + * + * + *
    +   * Optional. The maximum bytes that can be written to a Cloud Storage file
    +   * before a new file is created. Min 1 KB, max 10 GiB. The max_bytes limit may
    +   * be exceeded in cases where messages are larger than the limit.
    +   * 
    + * + * int64 max_bytes = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The maxBytes. + */ + @java.lang.Override + public long getMaxBytes() { + return maxBytes_; + } + + public static final int MAX_MESSAGES_FIELD_NUMBER = 8; + private long maxMessages_ = 0L; + + /** + * + * + *
    +   * Optional. The maximum number of messages that can be written to a Cloud
    +   * Storage file before a new file is created. Min 1000 messages.
    +   * 
    + * + * int64 max_messages = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The maxMessages. + */ + @java.lang.Override + public long getMaxMessages() { + return maxMessages_; + } + + public static final int STATE_FIELD_NUMBER = 9; + private int state_ = 0; + + /** + * + * + *
    +   * Output only. An output-only field that indicates whether or not the
    +   * subscription can receive messages.
    +   * 
    + * + * + * .google.pubsub.v1.CloudStorageConfig.State state = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for state. + */ + @java.lang.Override + public int getStateValue() { + return state_; + } + + /** + * + * + *
    +   * Output only. An output-only field that indicates whether or not the
    +   * subscription can receive messages.
    +   * 
    + * + * + * .google.pubsub.v1.CloudStorageConfig.State state = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The state. + */ + @java.lang.Override + public com.google.pubsub.v1.CloudStorageConfig.State getState() { + com.google.pubsub.v1.CloudStorageConfig.State result = + com.google.pubsub.v1.CloudStorageConfig.State.forNumber(state_); + return result == null ? com.google.pubsub.v1.CloudStorageConfig.State.UNRECOGNIZED : result; + } + + public static final int SERVICE_ACCOUNT_EMAIL_FIELD_NUMBER = 11; + + @SuppressWarnings("serial") + private volatile java.lang.Object serviceAccountEmail_ = ""; + + /** + * + * + *
    +   * Optional. The service account to use to write to Cloud Storage. The
    +   * subscription creator or updater that specifies this field must have
    +   * `iam.serviceAccounts.actAs` permission on the service account. If not
    +   * specified, the Pub/Sub
    +   * [service agent](https://cloud.google.com/iam/docs/service-agents),
    +   * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.
    +   * 
    + * + * string service_account_email = 11 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The serviceAccountEmail. + */ + @java.lang.Override + public java.lang.String getServiceAccountEmail() { + java.lang.Object ref = serviceAccountEmail_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + serviceAccountEmail_ = s; + return s; + } + } + + /** + * + * + *
    +   * Optional. The service account to use to write to Cloud Storage. The
    +   * subscription creator or updater that specifies this field must have
    +   * `iam.serviceAccounts.actAs` permission on the service account. If not
    +   * specified, the Pub/Sub
    +   * [service agent](https://cloud.google.com/iam/docs/service-agents),
    +   * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.
    +   * 
    + * + * string service_account_email = 11 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for serviceAccountEmail. + */ + @java.lang.Override + public com.google.protobuf.ByteString getServiceAccountEmailBytes() { + java.lang.Object ref = serviceAccountEmail_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + serviceAccountEmail_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(bucket_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, bucket_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(filenamePrefix_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, filenamePrefix_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(filenameSuffix_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 3, filenameSuffix_); + } + if (outputFormatCase_ == 4) { + output.writeMessage(4, (com.google.pubsub.v1.CloudStorageConfig.TextConfig) outputFormat_); + } + if (outputFormatCase_ == 5) { + output.writeMessage(5, (com.google.pubsub.v1.CloudStorageConfig.AvroConfig) outputFormat_); + } + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(6, getMaxDuration()); + } + if (maxBytes_ != 0L) { + output.writeInt64(7, maxBytes_); + } + if (maxMessages_ != 0L) { + output.writeInt64(8, maxMessages_); + } + if (state_ != com.google.pubsub.v1.CloudStorageConfig.State.STATE_UNSPECIFIED.getNumber()) { + output.writeEnum(9, state_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(filenameDatetimeFormat_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 10, filenameDatetimeFormat_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(serviceAccountEmail_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 11, serviceAccountEmail_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(bucket_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, bucket_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(filenamePrefix_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, filenamePrefix_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(filenameSuffix_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(3, filenameSuffix_); + } + if (outputFormatCase_ == 4) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 4, (com.google.pubsub.v1.CloudStorageConfig.TextConfig) outputFormat_); + } + if (outputFormatCase_ == 5) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 5, (com.google.pubsub.v1.CloudStorageConfig.AvroConfig) outputFormat_); + } + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(6, getMaxDuration()); + } + if (maxBytes_ != 0L) { + size += com.google.protobuf.CodedOutputStream.computeInt64Size(7, maxBytes_); + } + if (maxMessages_ != 0L) { + size += com.google.protobuf.CodedOutputStream.computeInt64Size(8, maxMessages_); + } + if (state_ != com.google.pubsub.v1.CloudStorageConfig.State.STATE_UNSPECIFIED.getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(9, state_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(filenameDatetimeFormat_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(10, filenameDatetimeFormat_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(serviceAccountEmail_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(11, serviceAccountEmail_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.pubsub.v1.CloudStorageConfig)) { + return super.equals(obj); + } + com.google.pubsub.v1.CloudStorageConfig other = (com.google.pubsub.v1.CloudStorageConfig) obj; + + if (!getBucket().equals(other.getBucket())) return false; + if (!getFilenamePrefix().equals(other.getFilenamePrefix())) return false; + if (!getFilenameSuffix().equals(other.getFilenameSuffix())) return false; + if (!getFilenameDatetimeFormat().equals(other.getFilenameDatetimeFormat())) return false; + if (hasMaxDuration() != other.hasMaxDuration()) return false; + if (hasMaxDuration()) { + if (!getMaxDuration().equals(other.getMaxDuration())) return false; + } + if (getMaxBytes() != other.getMaxBytes()) return false; + if (getMaxMessages() != other.getMaxMessages()) return false; + if (state_ != other.state_) return false; + if (!getServiceAccountEmail().equals(other.getServiceAccountEmail())) return false; + if (!getOutputFormatCase().equals(other.getOutputFormatCase())) return false; + switch (outputFormatCase_) { + case 4: + if (!getTextConfig().equals(other.getTextConfig())) return false; + break; + case 5: + if (!getAvroConfig().equals(other.getAvroConfig())) return false; + break; + case 0: + default: + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + BUCKET_FIELD_NUMBER; + hash = (53 * hash) + getBucket().hashCode(); + hash = (37 * hash) + FILENAME_PREFIX_FIELD_NUMBER; + hash = (53 * hash) + getFilenamePrefix().hashCode(); + hash = (37 * hash) + FILENAME_SUFFIX_FIELD_NUMBER; + hash = (53 * hash) + getFilenameSuffix().hashCode(); + hash = (37 * hash) + FILENAME_DATETIME_FORMAT_FIELD_NUMBER; + hash = (53 * hash) + getFilenameDatetimeFormat().hashCode(); + if (hasMaxDuration()) { + hash = (37 * hash) + MAX_DURATION_FIELD_NUMBER; + hash = (53 * hash) + getMaxDuration().hashCode(); + } + hash = (37 * hash) + MAX_BYTES_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getMaxBytes()); + hash = (37 * hash) + MAX_MESSAGES_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getMaxMessages()); + hash = (37 * hash) + STATE_FIELD_NUMBER; + hash = (53 * hash) + state_; + hash = (37 * hash) + SERVICE_ACCOUNT_EMAIL_FIELD_NUMBER; + hash = (53 * hash) + getServiceAccountEmail().hashCode(); + switch (outputFormatCase_) { + case 4: + hash = (37 * hash) + TEXT_CONFIG_FIELD_NUMBER; + hash = (53 * hash) + getTextConfig().hashCode(); + break; + case 5: + hash = (37 * hash) + AVRO_CONFIG_FIELD_NUMBER; + hash = (53 * hash) + getAvroConfig().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.pubsub.v1.CloudStorageConfig parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.CloudStorageConfig parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.CloudStorageConfig parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.CloudStorageConfig parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.CloudStorageConfig parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.CloudStorageConfig parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.CloudStorageConfig parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.CloudStorageConfig parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.CloudStorageConfig parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.CloudStorageConfig parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.CloudStorageConfig parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.CloudStorageConfig parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.pubsub.v1.CloudStorageConfig prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + + /** + * + * + *
    +   * Configuration for a Cloud Storage subscription.
    +   * 
    + * + * Protobuf type {@code google.pubsub.v1.CloudStorageConfig} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder + implements + // @@protoc_insertion_point(builder_implements:google.pubsub.v1.CloudStorageConfig) + com.google.pubsub.v1.CloudStorageConfigOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_CloudStorageConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_CloudStorageConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.CloudStorageConfig.class, + com.google.pubsub.v1.CloudStorageConfig.Builder.class); + } + + // Construct using com.google.pubsub.v1.CloudStorageConfig.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + internalGetMaxDurationFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + bucket_ = ""; + filenamePrefix_ = ""; + filenameSuffix_ = ""; + filenameDatetimeFormat_ = ""; + if (textConfigBuilder_ != null) { + textConfigBuilder_.clear(); + } + if (avroConfigBuilder_ != null) { + avroConfigBuilder_.clear(); + } + maxDuration_ = null; + if (maxDurationBuilder_ != null) { + maxDurationBuilder_.dispose(); + maxDurationBuilder_ = null; + } + maxBytes_ = 0L; + maxMessages_ = 0L; + state_ = 0; + serviceAccountEmail_ = ""; + outputFormatCase_ = 0; + outputFormat_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_CloudStorageConfig_descriptor; + } + + @java.lang.Override + public com.google.pubsub.v1.CloudStorageConfig getDefaultInstanceForType() { + return com.google.pubsub.v1.CloudStorageConfig.getDefaultInstance(); + } + + @java.lang.Override + public com.google.pubsub.v1.CloudStorageConfig build() { + com.google.pubsub.v1.CloudStorageConfig result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.pubsub.v1.CloudStorageConfig buildPartial() { + com.google.pubsub.v1.CloudStorageConfig result = + new com.google.pubsub.v1.CloudStorageConfig(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + buildPartialOneofs(result); + onBuilt(); + return result; + } + + private void buildPartial0(com.google.pubsub.v1.CloudStorageConfig result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.bucket_ = bucket_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.filenamePrefix_ = filenamePrefix_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.filenameSuffix_ = filenameSuffix_; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.filenameDatetimeFormat_ = filenameDatetimeFormat_; + } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000040) != 0)) { + result.maxDuration_ = + maxDurationBuilder_ == null ? maxDuration_ : maxDurationBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000080) != 0)) { + result.maxBytes_ = maxBytes_; + } + if (((from_bitField0_ & 0x00000100) != 0)) { + result.maxMessages_ = maxMessages_; + } + if (((from_bitField0_ & 0x00000200) != 0)) { + result.state_ = state_; + } + if (((from_bitField0_ & 0x00000400) != 0)) { + result.serviceAccountEmail_ = serviceAccountEmail_; + } + result.bitField0_ |= to_bitField0_; + } + + private void buildPartialOneofs(com.google.pubsub.v1.CloudStorageConfig result) { + result.outputFormatCase_ = outputFormatCase_; + result.outputFormat_ = this.outputFormat_; + if (outputFormatCase_ == 4 && textConfigBuilder_ != null) { + result.outputFormat_ = textConfigBuilder_.build(); + } + if (outputFormatCase_ == 5 && avroConfigBuilder_ != null) { + result.outputFormat_ = avroConfigBuilder_.build(); + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.pubsub.v1.CloudStorageConfig) { + return mergeFrom((com.google.pubsub.v1.CloudStorageConfig) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.pubsub.v1.CloudStorageConfig other) { + if (other == com.google.pubsub.v1.CloudStorageConfig.getDefaultInstance()) return this; + if (!other.getBucket().isEmpty()) { + bucket_ = other.bucket_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getFilenamePrefix().isEmpty()) { + filenamePrefix_ = other.filenamePrefix_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (!other.getFilenameSuffix().isEmpty()) { + filenameSuffix_ = other.filenameSuffix_; + bitField0_ |= 0x00000004; + onChanged(); + } + if (!other.getFilenameDatetimeFormat().isEmpty()) { + filenameDatetimeFormat_ = other.filenameDatetimeFormat_; + bitField0_ |= 0x00000008; + onChanged(); + } + if (other.hasMaxDuration()) { + mergeMaxDuration(other.getMaxDuration()); + } + if (other.getMaxBytes() != 0L) { + setMaxBytes(other.getMaxBytes()); + } + if (other.getMaxMessages() != 0L) { + setMaxMessages(other.getMaxMessages()); + } + if (other.state_ != 0) { + setStateValue(other.getStateValue()); + } + if (!other.getServiceAccountEmail().isEmpty()) { + serviceAccountEmail_ = other.serviceAccountEmail_; + bitField0_ |= 0x00000400; + onChanged(); + } + switch (other.getOutputFormatCase()) { + case TEXT_CONFIG: + { + mergeTextConfig(other.getTextConfig()); + break; + } + case AVRO_CONFIG: + { + mergeAvroConfig(other.getAvroConfig()); + break; + } + case OUTPUTFORMAT_NOT_SET: + { + break; + } + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + bucket_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + filenamePrefix_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: + { + filenameSuffix_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000004; + break; + } // case 26 + case 34: + { + input.readMessage( + internalGetTextConfigFieldBuilder().getBuilder(), extensionRegistry); + outputFormatCase_ = 4; + break; + } // case 34 + case 42: + { + input.readMessage( + internalGetAvroConfigFieldBuilder().getBuilder(), extensionRegistry); + outputFormatCase_ = 5; + break; + } // case 42 + case 50: + { + input.readMessage( + internalGetMaxDurationFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000040; + break; + } // case 50 + case 56: + { + maxBytes_ = input.readInt64(); + bitField0_ |= 0x00000080; + break; + } // case 56 + case 64: + { + maxMessages_ = input.readInt64(); + bitField0_ |= 0x00000100; + break; + } // case 64 + case 72: + { + state_ = input.readEnum(); + bitField0_ |= 0x00000200; + break; + } // case 72 + case 82: + { + filenameDatetimeFormat_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000008; + break; + } // case 82 + case 90: + { + serviceAccountEmail_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000400; + break; + } // case 90 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int outputFormatCase_ = 0; + private java.lang.Object outputFormat_; + + public OutputFormatCase getOutputFormatCase() { + return OutputFormatCase.forNumber(outputFormatCase_); + } + + public Builder clearOutputFormat() { + outputFormatCase_ = 0; + outputFormat_ = null; + onChanged(); + return this; + } + + private int bitField0_; + + private java.lang.Object bucket_ = ""; + + /** + * + * + *
    +     * Required. User-provided name for the Cloud Storage bucket.
    +     * The bucket must be created by the user. The bucket name must be without
    +     * any prefix like "gs://". See the [bucket naming
    +     * requirements] (https://cloud.google.com/storage/docs/buckets#naming).
    +     * 
    + * + * string bucket = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bucket. + */ + public java.lang.String getBucket() { + java.lang.Object ref = bucket_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + bucket_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +     * Required. User-provided name for the Cloud Storage bucket.
    +     * The bucket must be created by the user. The bucket name must be without
    +     * any prefix like "gs://". See the [bucket naming
    +     * requirements] (https://cloud.google.com/storage/docs/buckets#naming).
    +     * 
    + * + * string bucket = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for bucket. + */ + public com.google.protobuf.ByteString getBucketBytes() { + java.lang.Object ref = bucket_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + bucket_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +     * Required. User-provided name for the Cloud Storage bucket.
    +     * The bucket must be created by the user. The bucket name must be without
    +     * any prefix like "gs://". See the [bucket naming
    +     * requirements] (https://cloud.google.com/storage/docs/buckets#naming).
    +     * 
    + * + * string bucket = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bucket to set. + * @return This builder for chaining. + */ + public Builder setBucket(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + bucket_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Required. User-provided name for the Cloud Storage bucket.
    +     * The bucket must be created by the user. The bucket name must be without
    +     * any prefix like "gs://". See the [bucket naming
    +     * requirements] (https://cloud.google.com/storage/docs/buckets#naming).
    +     * 
    + * + * string bucket = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearBucket() { + bucket_ = getDefaultInstance().getBucket(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + + /** + * + * + *
    +     * Required. User-provided name for the Cloud Storage bucket.
    +     * The bucket must be created by the user. The bucket name must be without
    +     * any prefix like "gs://". See the [bucket naming
    +     * requirements] (https://cloud.google.com/storage/docs/buckets#naming).
    +     * 
    + * + * string bucket = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for bucket to set. + * @return This builder for chaining. + */ + public Builder setBucketBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + bucket_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object filenamePrefix_ = ""; + + /** + * + * + *
    +     * Optional. User-provided prefix for Cloud Storage filename. See the [object
    +     * naming requirements](https://cloud.google.com/storage/docs/objects#naming).
    +     * 
    + * + * string filename_prefix = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The filenamePrefix. + */ + public java.lang.String getFilenamePrefix() { + java.lang.Object ref = filenamePrefix_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + filenamePrefix_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +     * Optional. User-provided prefix for Cloud Storage filename. See the [object
    +     * naming requirements](https://cloud.google.com/storage/docs/objects#naming).
    +     * 
    + * + * string filename_prefix = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for filenamePrefix. + */ + public com.google.protobuf.ByteString getFilenamePrefixBytes() { + java.lang.Object ref = filenamePrefix_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + filenamePrefix_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +     * Optional. User-provided prefix for Cloud Storage filename. See the [object
    +     * naming requirements](https://cloud.google.com/storage/docs/objects#naming).
    +     * 
    + * + * string filename_prefix = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The filenamePrefix to set. + * @return This builder for chaining. + */ + public Builder setFilenamePrefix(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + filenamePrefix_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Optional. User-provided prefix for Cloud Storage filename. See the [object
    +     * naming requirements](https://cloud.google.com/storage/docs/objects#naming).
    +     * 
    + * + * string filename_prefix = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearFilenamePrefix() { + filenamePrefix_ = getDefaultInstance().getFilenamePrefix(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + + /** + * + * + *
    +     * Optional. User-provided prefix for Cloud Storage filename. See the [object
    +     * naming requirements](https://cloud.google.com/storage/docs/objects#naming).
    +     * 
    + * + * string filename_prefix = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for filenamePrefix to set. + * @return This builder for chaining. + */ + public Builder setFilenamePrefixBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + filenamePrefix_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private java.lang.Object filenameSuffix_ = ""; + + /** + * + * + *
    +     * Optional. User-provided suffix for Cloud Storage filename. See the [object
    +     * naming requirements](https://cloud.google.com/storage/docs/objects#naming).
    +     * Must not end in "/".
    +     * 
    + * + * string filename_suffix = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The filenameSuffix. + */ + public java.lang.String getFilenameSuffix() { + java.lang.Object ref = filenameSuffix_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + filenameSuffix_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +     * Optional. User-provided suffix for Cloud Storage filename. See the [object
    +     * naming requirements](https://cloud.google.com/storage/docs/objects#naming).
    +     * Must not end in "/".
    +     * 
    + * + * string filename_suffix = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for filenameSuffix. + */ + public com.google.protobuf.ByteString getFilenameSuffixBytes() { + java.lang.Object ref = filenameSuffix_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + filenameSuffix_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +     * Optional. User-provided suffix for Cloud Storage filename. See the [object
    +     * naming requirements](https://cloud.google.com/storage/docs/objects#naming).
    +     * Must not end in "/".
    +     * 
    + * + * string filename_suffix = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The filenameSuffix to set. + * @return This builder for chaining. + */ + public Builder setFilenameSuffix(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + filenameSuffix_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Optional. User-provided suffix for Cloud Storage filename. See the [object
    +     * naming requirements](https://cloud.google.com/storage/docs/objects#naming).
    +     * Must not end in "/".
    +     * 
    + * + * string filename_suffix = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearFilenameSuffix() { + filenameSuffix_ = getDefaultInstance().getFilenameSuffix(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + + /** + * + * + *
    +     * Optional. User-provided suffix for Cloud Storage filename. See the [object
    +     * naming requirements](https://cloud.google.com/storage/docs/objects#naming).
    +     * Must not end in "/".
    +     * 
    + * + * string filename_suffix = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for filenameSuffix to set. + * @return This builder for chaining. + */ + public Builder setFilenameSuffixBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + filenameSuffix_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + private java.lang.Object filenameDatetimeFormat_ = ""; + + /** + * + * + *
    +     * Optional. User-provided format string specifying how to represent datetimes
    +     * in Cloud Storage filenames. See the [datetime format
    +     * guidance](https://cloud.google.com/pubsub/docs/create-cloudstorage-subscription#file_names).
    +     * 
    + * + * string filename_datetime_format = 10 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The filenameDatetimeFormat. + */ + public java.lang.String getFilenameDatetimeFormat() { + java.lang.Object ref = filenameDatetimeFormat_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + filenameDatetimeFormat_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +     * Optional. User-provided format string specifying how to represent datetimes
    +     * in Cloud Storage filenames. See the [datetime format
    +     * guidance](https://cloud.google.com/pubsub/docs/create-cloudstorage-subscription#file_names).
    +     * 
    + * + * string filename_datetime_format = 10 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for filenameDatetimeFormat. + */ + public com.google.protobuf.ByteString getFilenameDatetimeFormatBytes() { + java.lang.Object ref = filenameDatetimeFormat_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + filenameDatetimeFormat_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +     * Optional. User-provided format string specifying how to represent datetimes
    +     * in Cloud Storage filenames. See the [datetime format
    +     * guidance](https://cloud.google.com/pubsub/docs/create-cloudstorage-subscription#file_names).
    +     * 
    + * + * string filename_datetime_format = 10 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The filenameDatetimeFormat to set. + * @return This builder for chaining. + */ + public Builder setFilenameDatetimeFormat(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + filenameDatetimeFormat_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Optional. User-provided format string specifying how to represent datetimes
    +     * in Cloud Storage filenames. See the [datetime format
    +     * guidance](https://cloud.google.com/pubsub/docs/create-cloudstorage-subscription#file_names).
    +     * 
    + * + * string filename_datetime_format = 10 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearFilenameDatetimeFormat() { + filenameDatetimeFormat_ = getDefaultInstance().getFilenameDatetimeFormat(); + bitField0_ = (bitField0_ & ~0x00000008); + onChanged(); + return this; + } + + /** + * + * + *
    +     * Optional. User-provided format string specifying how to represent datetimes
    +     * in Cloud Storage filenames. See the [datetime format
    +     * guidance](https://cloud.google.com/pubsub/docs/create-cloudstorage-subscription#file_names).
    +     * 
    + * + * string filename_datetime_format = 10 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for filenameDatetimeFormat to set. + * @return This builder for chaining. + */ + public Builder setFilenameDatetimeFormatBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + filenameDatetimeFormat_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.CloudStorageConfig.TextConfig, + com.google.pubsub.v1.CloudStorageConfig.TextConfig.Builder, + com.google.pubsub.v1.CloudStorageConfig.TextConfigOrBuilder> + textConfigBuilder_; + + /** + * + * + *
    +     * Optional. If set, message data will be written to Cloud Storage in text
    +     * format.
    +     * 
    + * + * + * .google.pubsub.v1.CloudStorageConfig.TextConfig text_config = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the textConfig field is set. + */ + @java.lang.Override + public boolean hasTextConfig() { + return outputFormatCase_ == 4; + } + + /** + * + * + *
    +     * Optional. If set, message data will be written to Cloud Storage in text
    +     * format.
    +     * 
    + * + * + * .google.pubsub.v1.CloudStorageConfig.TextConfig text_config = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The textConfig. + */ + @java.lang.Override + public com.google.pubsub.v1.CloudStorageConfig.TextConfig getTextConfig() { + if (textConfigBuilder_ == null) { + if (outputFormatCase_ == 4) { + return (com.google.pubsub.v1.CloudStorageConfig.TextConfig) outputFormat_; + } + return com.google.pubsub.v1.CloudStorageConfig.TextConfig.getDefaultInstance(); + } else { + if (outputFormatCase_ == 4) { + return textConfigBuilder_.getMessage(); + } + return com.google.pubsub.v1.CloudStorageConfig.TextConfig.getDefaultInstance(); + } + } + + /** + * + * + *
    +     * Optional. If set, message data will be written to Cloud Storage in text
    +     * format.
    +     * 
    + * + * + * .google.pubsub.v1.CloudStorageConfig.TextConfig text_config = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setTextConfig(com.google.pubsub.v1.CloudStorageConfig.TextConfig value) { + if (textConfigBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + outputFormat_ = value; + onChanged(); + } else { + textConfigBuilder_.setMessage(value); + } + outputFormatCase_ = 4; + return this; + } + + /** + * + * + *
    +     * Optional. If set, message data will be written to Cloud Storage in text
    +     * format.
    +     * 
    + * + * + * .google.pubsub.v1.CloudStorageConfig.TextConfig text_config = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setTextConfig( + com.google.pubsub.v1.CloudStorageConfig.TextConfig.Builder builderForValue) { + if (textConfigBuilder_ == null) { + outputFormat_ = builderForValue.build(); + onChanged(); + } else { + textConfigBuilder_.setMessage(builderForValue.build()); + } + outputFormatCase_ = 4; + return this; + } + + /** + * + * + *
    +     * Optional. If set, message data will be written to Cloud Storage in text
    +     * format.
    +     * 
    + * + * + * .google.pubsub.v1.CloudStorageConfig.TextConfig text_config = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeTextConfig(com.google.pubsub.v1.CloudStorageConfig.TextConfig value) { + if (textConfigBuilder_ == null) { + if (outputFormatCase_ == 4 + && outputFormat_ + != com.google.pubsub.v1.CloudStorageConfig.TextConfig.getDefaultInstance()) { + outputFormat_ = + com.google.pubsub.v1.CloudStorageConfig.TextConfig.newBuilder( + (com.google.pubsub.v1.CloudStorageConfig.TextConfig) outputFormat_) + .mergeFrom(value) + .buildPartial(); + } else { + outputFormat_ = value; + } + onChanged(); + } else { + if (outputFormatCase_ == 4) { + textConfigBuilder_.mergeFrom(value); + } else { + textConfigBuilder_.setMessage(value); + } + } + outputFormatCase_ = 4; + return this; + } + + /** + * + * + *
    +     * Optional. If set, message data will be written to Cloud Storage in text
    +     * format.
    +     * 
    + * + * + * .google.pubsub.v1.CloudStorageConfig.TextConfig text_config = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearTextConfig() { + if (textConfigBuilder_ == null) { + if (outputFormatCase_ == 4) { + outputFormatCase_ = 0; + outputFormat_ = null; + onChanged(); + } + } else { + if (outputFormatCase_ == 4) { + outputFormatCase_ = 0; + outputFormat_ = null; + } + textConfigBuilder_.clear(); + } + return this; + } + + /** + * + * + *
    +     * Optional. If set, message data will be written to Cloud Storage in text
    +     * format.
    +     * 
    + * + * + * .google.pubsub.v1.CloudStorageConfig.TextConfig text_config = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.CloudStorageConfig.TextConfig.Builder getTextConfigBuilder() { + return internalGetTextConfigFieldBuilder().getBuilder(); + } + + /** + * + * + *
    +     * Optional. If set, message data will be written to Cloud Storage in text
    +     * format.
    +     * 
    + * + * + * .google.pubsub.v1.CloudStorageConfig.TextConfig text_config = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.CloudStorageConfig.TextConfigOrBuilder getTextConfigOrBuilder() { + if ((outputFormatCase_ == 4) && (textConfigBuilder_ != null)) { + return textConfigBuilder_.getMessageOrBuilder(); + } else { + if (outputFormatCase_ == 4) { + return (com.google.pubsub.v1.CloudStorageConfig.TextConfig) outputFormat_; + } + return com.google.pubsub.v1.CloudStorageConfig.TextConfig.getDefaultInstance(); + } + } + + /** + * + * + *
    +     * Optional. If set, message data will be written to Cloud Storage in text
    +     * format.
    +     * 
    + * + * + * .google.pubsub.v1.CloudStorageConfig.TextConfig text_config = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.CloudStorageConfig.TextConfig, + com.google.pubsub.v1.CloudStorageConfig.TextConfig.Builder, + com.google.pubsub.v1.CloudStorageConfig.TextConfigOrBuilder> + internalGetTextConfigFieldBuilder() { + if (textConfigBuilder_ == null) { + if (!(outputFormatCase_ == 4)) { + outputFormat_ = com.google.pubsub.v1.CloudStorageConfig.TextConfig.getDefaultInstance(); + } + textConfigBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.CloudStorageConfig.TextConfig, + com.google.pubsub.v1.CloudStorageConfig.TextConfig.Builder, + com.google.pubsub.v1.CloudStorageConfig.TextConfigOrBuilder>( + (com.google.pubsub.v1.CloudStorageConfig.TextConfig) outputFormat_, + getParentForChildren(), + isClean()); + outputFormat_ = null; + } + outputFormatCase_ = 4; + onChanged(); + return textConfigBuilder_; + } + + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.CloudStorageConfig.AvroConfig, + com.google.pubsub.v1.CloudStorageConfig.AvroConfig.Builder, + com.google.pubsub.v1.CloudStorageConfig.AvroConfigOrBuilder> + avroConfigBuilder_; + + /** + * + * + *
    +     * Optional. If set, message data will be written to Cloud Storage in Avro
    +     * format.
    +     * 
    + * + * + * .google.pubsub.v1.CloudStorageConfig.AvroConfig avro_config = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the avroConfig field is set. + */ + @java.lang.Override + public boolean hasAvroConfig() { + return outputFormatCase_ == 5; + } + + /** + * + * + *
    +     * Optional. If set, message data will be written to Cloud Storage in Avro
    +     * format.
    +     * 
    + * + * + * .google.pubsub.v1.CloudStorageConfig.AvroConfig avro_config = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The avroConfig. + */ + @java.lang.Override + public com.google.pubsub.v1.CloudStorageConfig.AvroConfig getAvroConfig() { + if (avroConfigBuilder_ == null) { + if (outputFormatCase_ == 5) { + return (com.google.pubsub.v1.CloudStorageConfig.AvroConfig) outputFormat_; + } + return com.google.pubsub.v1.CloudStorageConfig.AvroConfig.getDefaultInstance(); + } else { + if (outputFormatCase_ == 5) { + return avroConfigBuilder_.getMessage(); + } + return com.google.pubsub.v1.CloudStorageConfig.AvroConfig.getDefaultInstance(); + } + } + + /** + * + * + *
    +     * Optional. If set, message data will be written to Cloud Storage in Avro
    +     * format.
    +     * 
    + * + * + * .google.pubsub.v1.CloudStorageConfig.AvroConfig avro_config = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setAvroConfig(com.google.pubsub.v1.CloudStorageConfig.AvroConfig value) { + if (avroConfigBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + outputFormat_ = value; + onChanged(); + } else { + avroConfigBuilder_.setMessage(value); + } + outputFormatCase_ = 5; + return this; + } + + /** + * + * + *
    +     * Optional. If set, message data will be written to Cloud Storage in Avro
    +     * format.
    +     * 
    + * + * + * .google.pubsub.v1.CloudStorageConfig.AvroConfig avro_config = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setAvroConfig( + com.google.pubsub.v1.CloudStorageConfig.AvroConfig.Builder builderForValue) { + if (avroConfigBuilder_ == null) { + outputFormat_ = builderForValue.build(); + onChanged(); + } else { + avroConfigBuilder_.setMessage(builderForValue.build()); + } + outputFormatCase_ = 5; + return this; + } + + /** + * + * + *
    +     * Optional. If set, message data will be written to Cloud Storage in Avro
    +     * format.
    +     * 
    + * + * + * .google.pubsub.v1.CloudStorageConfig.AvroConfig avro_config = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeAvroConfig(com.google.pubsub.v1.CloudStorageConfig.AvroConfig value) { + if (avroConfigBuilder_ == null) { + if (outputFormatCase_ == 5 + && outputFormat_ + != com.google.pubsub.v1.CloudStorageConfig.AvroConfig.getDefaultInstance()) { + outputFormat_ = + com.google.pubsub.v1.CloudStorageConfig.AvroConfig.newBuilder( + (com.google.pubsub.v1.CloudStorageConfig.AvroConfig) outputFormat_) + .mergeFrom(value) + .buildPartial(); + } else { + outputFormat_ = value; + } + onChanged(); + } else { + if (outputFormatCase_ == 5) { + avroConfigBuilder_.mergeFrom(value); + } else { + avroConfigBuilder_.setMessage(value); + } + } + outputFormatCase_ = 5; + return this; + } + + /** + * + * + *
    +     * Optional. If set, message data will be written to Cloud Storage in Avro
    +     * format.
    +     * 
    + * + * + * .google.pubsub.v1.CloudStorageConfig.AvroConfig avro_config = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearAvroConfig() { + if (avroConfigBuilder_ == null) { + if (outputFormatCase_ == 5) { + outputFormatCase_ = 0; + outputFormat_ = null; + onChanged(); + } + } else { + if (outputFormatCase_ == 5) { + outputFormatCase_ = 0; + outputFormat_ = null; + } + avroConfigBuilder_.clear(); + } + return this; + } + + /** + * + * + *
    +     * Optional. If set, message data will be written to Cloud Storage in Avro
    +     * format.
    +     * 
    + * + * + * .google.pubsub.v1.CloudStorageConfig.AvroConfig avro_config = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.CloudStorageConfig.AvroConfig.Builder getAvroConfigBuilder() { + return internalGetAvroConfigFieldBuilder().getBuilder(); + } + + /** + * + * + *
    +     * Optional. If set, message data will be written to Cloud Storage in Avro
    +     * format.
    +     * 
    + * + * + * .google.pubsub.v1.CloudStorageConfig.AvroConfig avro_config = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.CloudStorageConfig.AvroConfigOrBuilder getAvroConfigOrBuilder() { + if ((outputFormatCase_ == 5) && (avroConfigBuilder_ != null)) { + return avroConfigBuilder_.getMessageOrBuilder(); + } else { + if (outputFormatCase_ == 5) { + return (com.google.pubsub.v1.CloudStorageConfig.AvroConfig) outputFormat_; + } + return com.google.pubsub.v1.CloudStorageConfig.AvroConfig.getDefaultInstance(); + } + } + + /** + * + * + *
    +     * Optional. If set, message data will be written to Cloud Storage in Avro
    +     * format.
    +     * 
    + * + * + * .google.pubsub.v1.CloudStorageConfig.AvroConfig avro_config = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.CloudStorageConfig.AvroConfig, + com.google.pubsub.v1.CloudStorageConfig.AvroConfig.Builder, + com.google.pubsub.v1.CloudStorageConfig.AvroConfigOrBuilder> + internalGetAvroConfigFieldBuilder() { + if (avroConfigBuilder_ == null) { + if (!(outputFormatCase_ == 5)) { + outputFormat_ = com.google.pubsub.v1.CloudStorageConfig.AvroConfig.getDefaultInstance(); + } + avroConfigBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.CloudStorageConfig.AvroConfig, + com.google.pubsub.v1.CloudStorageConfig.AvroConfig.Builder, + com.google.pubsub.v1.CloudStorageConfig.AvroConfigOrBuilder>( + (com.google.pubsub.v1.CloudStorageConfig.AvroConfig) outputFormat_, + getParentForChildren(), + isClean()); + outputFormat_ = null; + } + outputFormatCase_ = 5; + onChanged(); + return avroConfigBuilder_; + } + + private com.google.protobuf.Duration maxDuration_; + private com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Duration, + com.google.protobuf.Duration.Builder, + com.google.protobuf.DurationOrBuilder> + maxDurationBuilder_; + + /** + * + * + *
    +     * Optional. The maximum duration that can elapse before a new Cloud Storage
    +     * file is created. Min 1 minute, max 10 minutes, default 5 minutes. May not
    +     * exceed the subscription's acknowledgment deadline.
    +     * 
    + * + * .google.protobuf.Duration max_duration = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the maxDuration field is set. + */ + public boolean hasMaxDuration() { + return ((bitField0_ & 0x00000040) != 0); + } + + /** + * + * + *
    +     * Optional. The maximum duration that can elapse before a new Cloud Storage
    +     * file is created. Min 1 minute, max 10 minutes, default 5 minutes. May not
    +     * exceed the subscription's acknowledgment deadline.
    +     * 
    + * + * .google.protobuf.Duration max_duration = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The maxDuration. + */ + public com.google.protobuf.Duration getMaxDuration() { + if (maxDurationBuilder_ == null) { + return maxDuration_ == null + ? com.google.protobuf.Duration.getDefaultInstance() + : maxDuration_; + } else { + return maxDurationBuilder_.getMessage(); + } + } + + /** + * + * + *
    +     * Optional. The maximum duration that can elapse before a new Cloud Storage
    +     * file is created. Min 1 minute, max 10 minutes, default 5 minutes. May not
    +     * exceed the subscription's acknowledgment deadline.
    +     * 
    + * + * .google.protobuf.Duration max_duration = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setMaxDuration(com.google.protobuf.Duration value) { + if (maxDurationBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + maxDuration_ = value; + } else { + maxDurationBuilder_.setMessage(value); + } + bitField0_ |= 0x00000040; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Optional. The maximum duration that can elapse before a new Cloud Storage
    +     * file is created. Min 1 minute, max 10 minutes, default 5 minutes. May not
    +     * exceed the subscription's acknowledgment deadline.
    +     * 
    + * + * .google.protobuf.Duration max_duration = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setMaxDuration(com.google.protobuf.Duration.Builder builderForValue) { + if (maxDurationBuilder_ == null) { + maxDuration_ = builderForValue.build(); + } else { + maxDurationBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000040; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Optional. The maximum duration that can elapse before a new Cloud Storage
    +     * file is created. Min 1 minute, max 10 minutes, default 5 minutes. May not
    +     * exceed the subscription's acknowledgment deadline.
    +     * 
    + * + * .google.protobuf.Duration max_duration = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeMaxDuration(com.google.protobuf.Duration value) { + if (maxDurationBuilder_ == null) { + if (((bitField0_ & 0x00000040) != 0) + && maxDuration_ != null + && maxDuration_ != com.google.protobuf.Duration.getDefaultInstance()) { + getMaxDurationBuilder().mergeFrom(value); + } else { + maxDuration_ = value; + } + } else { + maxDurationBuilder_.mergeFrom(value); + } + if (maxDuration_ != null) { + bitField0_ |= 0x00000040; + onChanged(); + } + return this; + } + + /** + * + * + *
    +     * Optional. The maximum duration that can elapse before a new Cloud Storage
    +     * file is created. Min 1 minute, max 10 minutes, default 5 minutes. May not
    +     * exceed the subscription's acknowledgment deadline.
    +     * 
    + * + * .google.protobuf.Duration max_duration = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearMaxDuration() { + bitField0_ = (bitField0_ & ~0x00000040); + maxDuration_ = null; + if (maxDurationBuilder_ != null) { + maxDurationBuilder_.dispose(); + maxDurationBuilder_ = null; + } + onChanged(); + return this; + } + + /** + * + * + *
    +     * Optional. The maximum duration that can elapse before a new Cloud Storage
    +     * file is created. Min 1 minute, max 10 minutes, default 5 minutes. May not
    +     * exceed the subscription's acknowledgment deadline.
    +     * 
    + * + * .google.protobuf.Duration max_duration = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.protobuf.Duration.Builder getMaxDurationBuilder() { + bitField0_ |= 0x00000040; + onChanged(); + return internalGetMaxDurationFieldBuilder().getBuilder(); + } + + /** + * + * + *
    +     * Optional. The maximum duration that can elapse before a new Cloud Storage
    +     * file is created. Min 1 minute, max 10 minutes, default 5 minutes. May not
    +     * exceed the subscription's acknowledgment deadline.
    +     * 
    + * + * .google.protobuf.Duration max_duration = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.protobuf.DurationOrBuilder getMaxDurationOrBuilder() { + if (maxDurationBuilder_ != null) { + return maxDurationBuilder_.getMessageOrBuilder(); + } else { + return maxDuration_ == null + ? com.google.protobuf.Duration.getDefaultInstance() + : maxDuration_; + } + } + + /** + * + * + *
    +     * Optional. The maximum duration that can elapse before a new Cloud Storage
    +     * file is created. Min 1 minute, max 10 minutes, default 5 minutes. May not
    +     * exceed the subscription's acknowledgment deadline.
    +     * 
    + * + * .google.protobuf.Duration max_duration = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Duration, + com.google.protobuf.Duration.Builder, + com.google.protobuf.DurationOrBuilder> + internalGetMaxDurationFieldBuilder() { + if (maxDurationBuilder_ == null) { + maxDurationBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Duration, + com.google.protobuf.Duration.Builder, + com.google.protobuf.DurationOrBuilder>( + getMaxDuration(), getParentForChildren(), isClean()); + maxDuration_ = null; + } + return maxDurationBuilder_; + } + + private long maxBytes_; + + /** + * + * + *
    +     * Optional. The maximum bytes that can be written to a Cloud Storage file
    +     * before a new file is created. Min 1 KB, max 10 GiB. The max_bytes limit may
    +     * be exceeded in cases where messages are larger than the limit.
    +     * 
    + * + * int64 max_bytes = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The maxBytes. + */ + @java.lang.Override + public long getMaxBytes() { + return maxBytes_; + } + + /** + * + * + *
    +     * Optional. The maximum bytes that can be written to a Cloud Storage file
    +     * before a new file is created. Min 1 KB, max 10 GiB. The max_bytes limit may
    +     * be exceeded in cases where messages are larger than the limit.
    +     * 
    + * + * int64 max_bytes = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The maxBytes to set. + * @return This builder for chaining. + */ + public Builder setMaxBytes(long value) { + + maxBytes_ = value; + bitField0_ |= 0x00000080; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Optional. The maximum bytes that can be written to a Cloud Storage file
    +     * before a new file is created. Min 1 KB, max 10 GiB. The max_bytes limit may
    +     * be exceeded in cases where messages are larger than the limit.
    +     * 
    + * + * int64 max_bytes = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearMaxBytes() { + bitField0_ = (bitField0_ & ~0x00000080); + maxBytes_ = 0L; + onChanged(); + return this; + } + + private long maxMessages_; + + /** + * + * + *
    +     * Optional. The maximum number of messages that can be written to a Cloud
    +     * Storage file before a new file is created. Min 1000 messages.
    +     * 
    + * + * int64 max_messages = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The maxMessages. + */ + @java.lang.Override + public long getMaxMessages() { + return maxMessages_; + } + + /** + * + * + *
    +     * Optional. The maximum number of messages that can be written to a Cloud
    +     * Storage file before a new file is created. Min 1000 messages.
    +     * 
    + * + * int64 max_messages = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The maxMessages to set. + * @return This builder for chaining. + */ + public Builder setMaxMessages(long value) { + + maxMessages_ = value; + bitField0_ |= 0x00000100; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Optional. The maximum number of messages that can be written to a Cloud
    +     * Storage file before a new file is created. Min 1000 messages.
    +     * 
    + * + * int64 max_messages = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearMaxMessages() { + bitField0_ = (bitField0_ & ~0x00000100); + maxMessages_ = 0L; + onChanged(); + return this; + } + + private int state_ = 0; + + /** + * + * + *
    +     * Output only. An output-only field that indicates whether or not the
    +     * subscription can receive messages.
    +     * 
    + * + * + * .google.pubsub.v1.CloudStorageConfig.State state = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for state. + */ + @java.lang.Override + public int getStateValue() { + return state_; + } + + /** + * + * + *
    +     * Output only. An output-only field that indicates whether or not the
    +     * subscription can receive messages.
    +     * 
    + * + * + * .google.pubsub.v1.CloudStorageConfig.State state = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The enum numeric value on the wire for state to set. + * @return This builder for chaining. + */ + public Builder setStateValue(int value) { + state_ = value; + bitField0_ |= 0x00000200; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Output only. An output-only field that indicates whether or not the
    +     * subscription can receive messages.
    +     * 
    + * + * + * .google.pubsub.v1.CloudStorageConfig.State state = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The state. + */ + @java.lang.Override + public com.google.pubsub.v1.CloudStorageConfig.State getState() { + com.google.pubsub.v1.CloudStorageConfig.State result = + com.google.pubsub.v1.CloudStorageConfig.State.forNumber(state_); + return result == null ? com.google.pubsub.v1.CloudStorageConfig.State.UNRECOGNIZED : result; + } + + /** + * + * + *
    +     * Output only. An output-only field that indicates whether or not the
    +     * subscription can receive messages.
    +     * 
    + * + * + * .google.pubsub.v1.CloudStorageConfig.State state = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The state to set. + * @return This builder for chaining. + */ + public Builder setState(com.google.pubsub.v1.CloudStorageConfig.State value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000200; + state_ = value.getNumber(); + onChanged(); + return this; + } + + /** + * + * + *
    +     * Output only. An output-only field that indicates whether or not the
    +     * subscription can receive messages.
    +     * 
    + * + * + * .google.pubsub.v1.CloudStorageConfig.State state = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return This builder for chaining. + */ + public Builder clearState() { + bitField0_ = (bitField0_ & ~0x00000200); + state_ = 0; + onChanged(); + return this; + } + + private java.lang.Object serviceAccountEmail_ = ""; + + /** + * + * + *
    +     * Optional. The service account to use to write to Cloud Storage. The
    +     * subscription creator or updater that specifies this field must have
    +     * `iam.serviceAccounts.actAs` permission on the service account. If not
    +     * specified, the Pub/Sub
    +     * [service agent](https://cloud.google.com/iam/docs/service-agents),
    +     * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.
    +     * 
    + * + * string service_account_email = 11 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The serviceAccountEmail. + */ + public java.lang.String getServiceAccountEmail() { + java.lang.Object ref = serviceAccountEmail_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + serviceAccountEmail_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +     * Optional. The service account to use to write to Cloud Storage. The
    +     * subscription creator or updater that specifies this field must have
    +     * `iam.serviceAccounts.actAs` permission on the service account. If not
    +     * specified, the Pub/Sub
    +     * [service agent](https://cloud.google.com/iam/docs/service-agents),
    +     * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.
    +     * 
    + * + * string service_account_email = 11 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for serviceAccountEmail. + */ + public com.google.protobuf.ByteString getServiceAccountEmailBytes() { + java.lang.Object ref = serviceAccountEmail_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + serviceAccountEmail_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +     * Optional. The service account to use to write to Cloud Storage. The
    +     * subscription creator or updater that specifies this field must have
    +     * `iam.serviceAccounts.actAs` permission on the service account. If not
    +     * specified, the Pub/Sub
    +     * [service agent](https://cloud.google.com/iam/docs/service-agents),
    +     * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.
    +     * 
    + * + * string service_account_email = 11 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The serviceAccountEmail to set. + * @return This builder for chaining. + */ + public Builder setServiceAccountEmail(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + serviceAccountEmail_ = value; + bitField0_ |= 0x00000400; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Optional. The service account to use to write to Cloud Storage. The
    +     * subscription creator or updater that specifies this field must have
    +     * `iam.serviceAccounts.actAs` permission on the service account. If not
    +     * specified, the Pub/Sub
    +     * [service agent](https://cloud.google.com/iam/docs/service-agents),
    +     * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.
    +     * 
    + * + * string service_account_email = 11 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearServiceAccountEmail() { + serviceAccountEmail_ = getDefaultInstance().getServiceAccountEmail(); + bitField0_ = (bitField0_ & ~0x00000400); + onChanged(); + return this; + } + + /** + * + * + *
    +     * Optional. The service account to use to write to Cloud Storage. The
    +     * subscription creator or updater that specifies this field must have
    +     * `iam.serviceAccounts.actAs` permission on the service account. If not
    +     * specified, the Pub/Sub
    +     * [service agent](https://cloud.google.com/iam/docs/service-agents),
    +     * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.
    +     * 
    + * + * string service_account_email = 11 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for serviceAccountEmail to set. + * @return This builder for chaining. + */ + public Builder setServiceAccountEmailBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + serviceAccountEmail_ = value; + bitField0_ |= 0x00000400; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:google.pubsub.v1.CloudStorageConfig) + } + + // @@protoc_insertion_point(class_scope:google.pubsub.v1.CloudStorageConfig) + private static final com.google.pubsub.v1.CloudStorageConfig DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.pubsub.v1.CloudStorageConfig(); + } + + public static com.google.pubsub.v1.CloudStorageConfig getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public CloudStorageConfig parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.pubsub.v1.CloudStorageConfig getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/CloudStorageConfigOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/CloudStorageConfigOrBuilder.java new file mode 100644 index 000000000..2c2bc260b --- /dev/null +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/CloudStorageConfigOrBuilder.java @@ -0,0 +1,385 @@ +/* + * Copyright 2026 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 + +package com.google.pubsub.v1; + +@com.google.protobuf.Generated +public interface CloudStorageConfigOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.pubsub.v1.CloudStorageConfig) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
    +   * Required. User-provided name for the Cloud Storage bucket.
    +   * The bucket must be created by the user. The bucket name must be without
    +   * any prefix like "gs://". See the [bucket naming
    +   * requirements] (https://cloud.google.com/storage/docs/buckets#naming).
    +   * 
    + * + * string bucket = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bucket. + */ + java.lang.String getBucket(); + + /** + * + * + *
    +   * Required. User-provided name for the Cloud Storage bucket.
    +   * The bucket must be created by the user. The bucket name must be without
    +   * any prefix like "gs://". See the [bucket naming
    +   * requirements] (https://cloud.google.com/storage/docs/buckets#naming).
    +   * 
    + * + * string bucket = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for bucket. + */ + com.google.protobuf.ByteString getBucketBytes(); + + /** + * + * + *
    +   * Optional. User-provided prefix for Cloud Storage filename. See the [object
    +   * naming requirements](https://cloud.google.com/storage/docs/objects#naming).
    +   * 
    + * + * string filename_prefix = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The filenamePrefix. + */ + java.lang.String getFilenamePrefix(); + + /** + * + * + *
    +   * Optional. User-provided prefix for Cloud Storage filename. See the [object
    +   * naming requirements](https://cloud.google.com/storage/docs/objects#naming).
    +   * 
    + * + * string filename_prefix = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for filenamePrefix. + */ + com.google.protobuf.ByteString getFilenamePrefixBytes(); + + /** + * + * + *
    +   * Optional. User-provided suffix for Cloud Storage filename. See the [object
    +   * naming requirements](https://cloud.google.com/storage/docs/objects#naming).
    +   * Must not end in "/".
    +   * 
    + * + * string filename_suffix = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The filenameSuffix. + */ + java.lang.String getFilenameSuffix(); + + /** + * + * + *
    +   * Optional. User-provided suffix for Cloud Storage filename. See the [object
    +   * naming requirements](https://cloud.google.com/storage/docs/objects#naming).
    +   * Must not end in "/".
    +   * 
    + * + * string filename_suffix = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for filenameSuffix. + */ + com.google.protobuf.ByteString getFilenameSuffixBytes(); + + /** + * + * + *
    +   * Optional. User-provided format string specifying how to represent datetimes
    +   * in Cloud Storage filenames. See the [datetime format
    +   * guidance](https://cloud.google.com/pubsub/docs/create-cloudstorage-subscription#file_names).
    +   * 
    + * + * string filename_datetime_format = 10 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The filenameDatetimeFormat. + */ + java.lang.String getFilenameDatetimeFormat(); + + /** + * + * + *
    +   * Optional. User-provided format string specifying how to represent datetimes
    +   * in Cloud Storage filenames. See the [datetime format
    +   * guidance](https://cloud.google.com/pubsub/docs/create-cloudstorage-subscription#file_names).
    +   * 
    + * + * string filename_datetime_format = 10 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for filenameDatetimeFormat. + */ + com.google.protobuf.ByteString getFilenameDatetimeFormatBytes(); + + /** + * + * + *
    +   * Optional. If set, message data will be written to Cloud Storage in text
    +   * format.
    +   * 
    + * + * + * .google.pubsub.v1.CloudStorageConfig.TextConfig text_config = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the textConfig field is set. + */ + boolean hasTextConfig(); + + /** + * + * + *
    +   * Optional. If set, message data will be written to Cloud Storage in text
    +   * format.
    +   * 
    + * + * + * .google.pubsub.v1.CloudStorageConfig.TextConfig text_config = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The textConfig. + */ + com.google.pubsub.v1.CloudStorageConfig.TextConfig getTextConfig(); + + /** + * + * + *
    +   * Optional. If set, message data will be written to Cloud Storage in text
    +   * format.
    +   * 
    + * + * + * .google.pubsub.v1.CloudStorageConfig.TextConfig text_config = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.pubsub.v1.CloudStorageConfig.TextConfigOrBuilder getTextConfigOrBuilder(); + + /** + * + * + *
    +   * Optional. If set, message data will be written to Cloud Storage in Avro
    +   * format.
    +   * 
    + * + * + * .google.pubsub.v1.CloudStorageConfig.AvroConfig avro_config = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the avroConfig field is set. + */ + boolean hasAvroConfig(); + + /** + * + * + *
    +   * Optional. If set, message data will be written to Cloud Storage in Avro
    +   * format.
    +   * 
    + * + * + * .google.pubsub.v1.CloudStorageConfig.AvroConfig avro_config = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The avroConfig. + */ + com.google.pubsub.v1.CloudStorageConfig.AvroConfig getAvroConfig(); + + /** + * + * + *
    +   * Optional. If set, message data will be written to Cloud Storage in Avro
    +   * format.
    +   * 
    + * + * + * .google.pubsub.v1.CloudStorageConfig.AvroConfig avro_config = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.pubsub.v1.CloudStorageConfig.AvroConfigOrBuilder getAvroConfigOrBuilder(); + + /** + * + * + *
    +   * Optional. The maximum duration that can elapse before a new Cloud Storage
    +   * file is created. Min 1 minute, max 10 minutes, default 5 minutes. May not
    +   * exceed the subscription's acknowledgment deadline.
    +   * 
    + * + * .google.protobuf.Duration max_duration = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the maxDuration field is set. + */ + boolean hasMaxDuration(); + + /** + * + * + *
    +   * Optional. The maximum duration that can elapse before a new Cloud Storage
    +   * file is created. Min 1 minute, max 10 minutes, default 5 minutes. May not
    +   * exceed the subscription's acknowledgment deadline.
    +   * 
    + * + * .google.protobuf.Duration max_duration = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The maxDuration. + */ + com.google.protobuf.Duration getMaxDuration(); + + /** + * + * + *
    +   * Optional. The maximum duration that can elapse before a new Cloud Storage
    +   * file is created. Min 1 minute, max 10 minutes, default 5 minutes. May not
    +   * exceed the subscription's acknowledgment deadline.
    +   * 
    + * + * .google.protobuf.Duration max_duration = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.protobuf.DurationOrBuilder getMaxDurationOrBuilder(); + + /** + * + * + *
    +   * Optional. The maximum bytes that can be written to a Cloud Storage file
    +   * before a new file is created. Min 1 KB, max 10 GiB. The max_bytes limit may
    +   * be exceeded in cases where messages are larger than the limit.
    +   * 
    + * + * int64 max_bytes = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The maxBytes. + */ + long getMaxBytes(); + + /** + * + * + *
    +   * Optional. The maximum number of messages that can be written to a Cloud
    +   * Storage file before a new file is created. Min 1000 messages.
    +   * 
    + * + * int64 max_messages = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The maxMessages. + */ + long getMaxMessages(); + + /** + * + * + *
    +   * Output only. An output-only field that indicates whether or not the
    +   * subscription can receive messages.
    +   * 
    + * + * + * .google.pubsub.v1.CloudStorageConfig.State state = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for state. + */ + int getStateValue(); + + /** + * + * + *
    +   * Output only. An output-only field that indicates whether or not the
    +   * subscription can receive messages.
    +   * 
    + * + * + * .google.pubsub.v1.CloudStorageConfig.State state = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The state. + */ + com.google.pubsub.v1.CloudStorageConfig.State getState(); + + /** + * + * + *
    +   * Optional. The service account to use to write to Cloud Storage. The
    +   * subscription creator or updater that specifies this field must have
    +   * `iam.serviceAccounts.actAs` permission on the service account. If not
    +   * specified, the Pub/Sub
    +   * [service agent](https://cloud.google.com/iam/docs/service-agents),
    +   * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.
    +   * 
    + * + * string service_account_email = 11 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The serviceAccountEmail. + */ + java.lang.String getServiceAccountEmail(); + + /** + * + * + *
    +   * Optional. The service account to use to write to Cloud Storage. The
    +   * subscription creator or updater that specifies this field must have
    +   * `iam.serviceAccounts.actAs` permission on the service account. If not
    +   * specified, the Pub/Sub
    +   * [service agent](https://cloud.google.com/iam/docs/service-agents),
    +   * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.
    +   * 
    + * + * string service_account_email = 11 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for serviceAccountEmail. + */ + com.google.protobuf.ByteString getServiceAccountEmailBytes(); + + com.google.pubsub.v1.CloudStorageConfig.OutputFormatCase getOutputFormatCase(); +} diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/CommitSchemaRequest.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/CommitSchemaRequest.java new file mode 100644 index 000000000..1f8cc26bc --- /dev/null +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/CommitSchemaRequest.java @@ -0,0 +1,898 @@ +/* + * Copyright 2026 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: google/pubsub/v1/schema.proto +// Protobuf Java Version: 4.33.2 + +package com.google.pubsub.v1; + +/** + * + * + *
    + * Request for CommitSchema method.
    + * 
    + * + * Protobuf type {@code google.pubsub.v1.CommitSchemaRequest} + */ +@com.google.protobuf.Generated +public final class CommitSchemaRequest extends com.google.protobuf.GeneratedMessage + implements + // @@protoc_insertion_point(message_implements:google.pubsub.v1.CommitSchemaRequest) + CommitSchemaRequestOrBuilder { + private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "CommitSchemaRequest"); + } + + // Use CommitSchemaRequest.newBuilder() to construct. + private CommitSchemaRequest(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + + private CommitSchemaRequest() { + name_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.SchemaProto + .internal_static_google_pubsub_v1_CommitSchemaRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.SchemaProto + .internal_static_google_pubsub_v1_CommitSchemaRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.CommitSchemaRequest.class, + com.google.pubsub.v1.CommitSchemaRequest.Builder.class); + } + + private int bitField0_; + public static final int NAME_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; + + /** + * + * + *
    +   * Required. The name of the schema we are revising.
    +   * Format is `projects/{project}/schemas/{schema}`.
    +   * 
    + * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + + /** + * + * + *
    +   * Required. The name of the schema we are revising.
    +   * Format is `projects/{project}/schemas/{schema}`.
    +   * 
    + * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SCHEMA_FIELD_NUMBER = 2; + private com.google.pubsub.v1.Schema schema_; + + /** + * + * + *
    +   * Required. The schema revision to commit.
    +   * 
    + * + * .google.pubsub.v1.Schema schema = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return Whether the schema field is set. + */ + @java.lang.Override + public boolean hasSchema() { + return ((bitField0_ & 0x00000001) != 0); + } + + /** + * + * + *
    +   * Required. The schema revision to commit.
    +   * 
    + * + * .google.pubsub.v1.Schema schema = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The schema. + */ + @java.lang.Override + public com.google.pubsub.v1.Schema getSchema() { + return schema_ == null ? com.google.pubsub.v1.Schema.getDefaultInstance() : schema_; + } + + /** + * + * + *
    +   * Required. The schema revision to commit.
    +   * 
    + * + * .google.pubsub.v1.Schema schema = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + @java.lang.Override + public com.google.pubsub.v1.SchemaOrBuilder getSchemaOrBuilder() { + return schema_ == null ? com.google.pubsub.v1.Schema.getDefaultInstance() : schema_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, name_); + } + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(2, getSchema()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, name_); + } + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getSchema()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.pubsub.v1.CommitSchemaRequest)) { + return super.equals(obj); + } + com.google.pubsub.v1.CommitSchemaRequest other = (com.google.pubsub.v1.CommitSchemaRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (hasSchema() != other.hasSchema()) return false; + if (hasSchema()) { + if (!getSchema().equals(other.getSchema())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + if (hasSchema()) { + hash = (37 * hash) + SCHEMA_FIELD_NUMBER; + hash = (53 * hash) + getSchema().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.pubsub.v1.CommitSchemaRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.CommitSchemaRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.CommitSchemaRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.CommitSchemaRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.CommitSchemaRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.CommitSchemaRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.CommitSchemaRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.CommitSchemaRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.CommitSchemaRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.CommitSchemaRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.CommitSchemaRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.CommitSchemaRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.pubsub.v1.CommitSchemaRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + + /** + * + * + *
    +   * Request for CommitSchema method.
    +   * 
    + * + * Protobuf type {@code google.pubsub.v1.CommitSchemaRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder + implements + // @@protoc_insertion_point(builder_implements:google.pubsub.v1.CommitSchemaRequest) + com.google.pubsub.v1.CommitSchemaRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.SchemaProto + .internal_static_google_pubsub_v1_CommitSchemaRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.SchemaProto + .internal_static_google_pubsub_v1_CommitSchemaRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.CommitSchemaRequest.class, + com.google.pubsub.v1.CommitSchemaRequest.Builder.class); + } + + // Construct using com.google.pubsub.v1.CommitSchemaRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + internalGetSchemaFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + name_ = ""; + schema_ = null; + if (schemaBuilder_ != null) { + schemaBuilder_.dispose(); + schemaBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.pubsub.v1.SchemaProto + .internal_static_google_pubsub_v1_CommitSchemaRequest_descriptor; + } + + @java.lang.Override + public com.google.pubsub.v1.CommitSchemaRequest getDefaultInstanceForType() { + return com.google.pubsub.v1.CommitSchemaRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.pubsub.v1.CommitSchemaRequest build() { + com.google.pubsub.v1.CommitSchemaRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.pubsub.v1.CommitSchemaRequest buildPartial() { + com.google.pubsub.v1.CommitSchemaRequest result = + new com.google.pubsub.v1.CommitSchemaRequest(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.pubsub.v1.CommitSchemaRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.name_ = name_; + } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000002) != 0)) { + result.schema_ = schemaBuilder_ == null ? schema_ : schemaBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.pubsub.v1.CommitSchemaRequest) { + return mergeFrom((com.google.pubsub.v1.CommitSchemaRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.pubsub.v1.CommitSchemaRequest other) { + if (other == com.google.pubsub.v1.CommitSchemaRequest.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (other.hasSchema()) { + mergeSchema(other.getSchema()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + name_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + input.readMessage(internalGetSchemaFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.lang.Object name_ = ""; + + /** + * + * + *
    +     * Required. The name of the schema we are revising.
    +     * Format is `projects/{project}/schemas/{schema}`.
    +     * 
    + * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +     * Required. The name of the schema we are revising.
    +     * Format is `projects/{project}/schemas/{schema}`.
    +     * 
    + * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +     * Required. The name of the schema we are revising.
    +     * Format is `projects/{project}/schemas/{schema}`.
    +     * 
    + * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Required. The name of the schema we are revising.
    +     * Format is `projects/{project}/schemas/{schema}`.
    +     * 
    + * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + + /** + * + * + *
    +     * Required. The name of the schema we are revising.
    +     * Format is `projects/{project}/schemas/{schema}`.
    +     * 
    + * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private com.google.pubsub.v1.Schema schema_; + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.Schema, + com.google.pubsub.v1.Schema.Builder, + com.google.pubsub.v1.SchemaOrBuilder> + schemaBuilder_; + + /** + * + * + *
    +     * Required. The schema revision to commit.
    +     * 
    + * + * .google.pubsub.v1.Schema schema = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return Whether the schema field is set. + */ + public boolean hasSchema() { + return ((bitField0_ & 0x00000002) != 0); + } + + /** + * + * + *
    +     * Required. The schema revision to commit.
    +     * 
    + * + * .google.pubsub.v1.Schema schema = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The schema. + */ + public com.google.pubsub.v1.Schema getSchema() { + if (schemaBuilder_ == null) { + return schema_ == null ? com.google.pubsub.v1.Schema.getDefaultInstance() : schema_; + } else { + return schemaBuilder_.getMessage(); + } + } + + /** + * + * + *
    +     * Required. The schema revision to commit.
    +     * 
    + * + * .google.pubsub.v1.Schema schema = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder setSchema(com.google.pubsub.v1.Schema value) { + if (schemaBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + schema_ = value; + } else { + schemaBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Required. The schema revision to commit.
    +     * 
    + * + * .google.pubsub.v1.Schema schema = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder setSchema(com.google.pubsub.v1.Schema.Builder builderForValue) { + if (schemaBuilder_ == null) { + schema_ = builderForValue.build(); + } else { + schemaBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Required. The schema revision to commit.
    +     * 
    + * + * .google.pubsub.v1.Schema schema = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder mergeSchema(com.google.pubsub.v1.Schema value) { + if (schemaBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0) + && schema_ != null + && schema_ != com.google.pubsub.v1.Schema.getDefaultInstance()) { + getSchemaBuilder().mergeFrom(value); + } else { + schema_ = value; + } + } else { + schemaBuilder_.mergeFrom(value); + } + if (schema_ != null) { + bitField0_ |= 0x00000002; + onChanged(); + } + return this; + } + + /** + * + * + *
    +     * Required. The schema revision to commit.
    +     * 
    + * + * .google.pubsub.v1.Schema schema = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder clearSchema() { + bitField0_ = (bitField0_ & ~0x00000002); + schema_ = null; + if (schemaBuilder_ != null) { + schemaBuilder_.dispose(); + schemaBuilder_ = null; + } + onChanged(); + return this; + } + + /** + * + * + *
    +     * Required. The schema revision to commit.
    +     * 
    + * + * .google.pubsub.v1.Schema schema = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + public com.google.pubsub.v1.Schema.Builder getSchemaBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return internalGetSchemaFieldBuilder().getBuilder(); + } + + /** + * + * + *
    +     * Required. The schema revision to commit.
    +     * 
    + * + * .google.pubsub.v1.Schema schema = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + public com.google.pubsub.v1.SchemaOrBuilder getSchemaOrBuilder() { + if (schemaBuilder_ != null) { + return schemaBuilder_.getMessageOrBuilder(); + } else { + return schema_ == null ? com.google.pubsub.v1.Schema.getDefaultInstance() : schema_; + } + } + + /** + * + * + *
    +     * Required. The schema revision to commit.
    +     * 
    + * + * .google.pubsub.v1.Schema schema = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.Schema, + com.google.pubsub.v1.Schema.Builder, + com.google.pubsub.v1.SchemaOrBuilder> + internalGetSchemaFieldBuilder() { + if (schemaBuilder_ == null) { + schemaBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.Schema, + com.google.pubsub.v1.Schema.Builder, + com.google.pubsub.v1.SchemaOrBuilder>( + getSchema(), getParentForChildren(), isClean()); + schema_ = null; + } + return schemaBuilder_; + } + + // @@protoc_insertion_point(builder_scope:google.pubsub.v1.CommitSchemaRequest) + } + + // @@protoc_insertion_point(class_scope:google.pubsub.v1.CommitSchemaRequest) + private static final com.google.pubsub.v1.CommitSchemaRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.pubsub.v1.CommitSchemaRequest(); + } + + public static com.google.pubsub.v1.CommitSchemaRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public CommitSchemaRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.pubsub.v1.CommitSchemaRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/CommitSchemaRequestOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/CommitSchemaRequestOrBuilder.java new file mode 100644 index 000000000..b904f9d0e --- /dev/null +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/CommitSchemaRequestOrBuilder.java @@ -0,0 +1,97 @@ +/* + * Copyright 2026 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: google/pubsub/v1/schema.proto +// Protobuf Java Version: 4.33.2 + +package com.google.pubsub.v1; + +@com.google.protobuf.Generated +public interface CommitSchemaRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.pubsub.v1.CommitSchemaRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
    +   * Required. The name of the schema we are revising.
    +   * Format is `projects/{project}/schemas/{schema}`.
    +   * 
    + * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + + /** + * + * + *
    +   * Required. The name of the schema we are revising.
    +   * Format is `projects/{project}/schemas/{schema}`.
    +   * 
    + * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
    +   * Required. The schema revision to commit.
    +   * 
    + * + * .google.pubsub.v1.Schema schema = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return Whether the schema field is set. + */ + boolean hasSchema(); + + /** + * + * + *
    +   * Required. The schema revision to commit.
    +   * 
    + * + * .google.pubsub.v1.Schema schema = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The schema. + */ + com.google.pubsub.v1.Schema getSchema(); + + /** + * + * + *
    +   * Required. The schema revision to commit.
    +   * 
    + * + * .google.pubsub.v1.Schema schema = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + com.google.pubsub.v1.SchemaOrBuilder getSchemaOrBuilder(); +} diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/CreateSchemaRequest.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/CreateSchemaRequest.java index 6c7618f9c..4db632921 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/CreateSchemaRequest.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/CreateSchemaRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/schema.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; @@ -27,13 +29,25 @@ * * Protobuf type {@code google.pubsub.v1.CreateSchemaRequest} */ -public final class CreateSchemaRequest extends com.google.protobuf.GeneratedMessageV3 +@com.google.protobuf.Generated +public final class CreateSchemaRequest extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:google.pubsub.v1.CreateSchemaRequest) CreateSchemaRequestOrBuilder { private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "CreateSchemaRequest"); + } + // Use CreateSchemaRequest.newBuilder() to construct. - private CreateSchemaRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + private CreateSchemaRequest(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); } @@ -42,89 +56,13 @@ private CreateSchemaRequest() { schemaId_ = ""; } - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new CreateSchemaRequest(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - private CreateSchemaRequest( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - java.lang.String s = input.readStringRequireUtf8(); - - parent_ = s; - break; - } - case 18: - { - com.google.pubsub.v1.Schema.Builder subBuilder = null; - if (schema_ != null) { - subBuilder = schema_.toBuilder(); - } - schema_ = input.readMessage(com.google.pubsub.v1.Schema.parser(), extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(schema_); - schema_ = subBuilder.buildPartial(); - } - - break; - } - case 26: - { - java.lang.String s = input.readStringRequireUtf8(); - - schemaId_ = s; - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.pubsub.v1.SchemaProto .internal_static_google_pubsub_v1_CreateSchemaRequest_descriptor; } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.SchemaProto .internal_static_google_pubsub_v1_CreateSchemaRequest_fieldAccessorTable @@ -133,8 +71,12 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { com.google.pubsub.v1.CreateSchemaRequest.Builder.class); } + private int bitField0_; public static final int PARENT_FIELD_NUMBER = 1; - private volatile java.lang.Object parent_; + + @SuppressWarnings("serial") + private volatile java.lang.Object parent_ = ""; + /** * * @@ -161,6 +103,7 @@ public java.lang.String getParent() { return s; } } + /** * * @@ -190,11 +133,13 @@ public com.google.protobuf.ByteString getParentBytes() { public static final int SCHEMA_FIELD_NUMBER = 2; private com.google.pubsub.v1.Schema schema_; + /** * * *
        * Required. The schema object to create.
    +   *
        * This schema's `name` parameter is ignored. The schema object returned
        * by CreateSchema will have a `name` made using the given `parent` and
        * `schema_id`.
    @@ -206,13 +151,15 @@ public com.google.protobuf.ByteString getParentBytes() {
        */
       @java.lang.Override
       public boolean hasSchema() {
    -    return schema_ != null;
    +    return ((bitField0_ & 0x00000001) != 0);
       }
    +
       /**
        *
        *
        * 
        * Required. The schema object to create.
    +   *
        * This schema's `name` parameter is ignored. The schema object returned
        * by CreateSchema will have a `name` made using the given `parent` and
        * `schema_id`.
    @@ -226,11 +173,13 @@ public boolean hasSchema() {
       public com.google.pubsub.v1.Schema getSchema() {
         return schema_ == null ? com.google.pubsub.v1.Schema.getDefaultInstance() : schema_;
       }
    +
       /**
        *
        *
        * 
        * Required. The schema object to create.
    +   *
        * This schema's `name` parameter is ignored. The schema object returned
        * by CreateSchema will have a `name` made using the given `parent` and
        * `schema_id`.
    @@ -240,19 +189,23 @@ public com.google.pubsub.v1.Schema getSchema() {
        */
       @java.lang.Override
       public com.google.pubsub.v1.SchemaOrBuilder getSchemaOrBuilder() {
    -    return getSchema();
    +    return schema_ == null ? com.google.pubsub.v1.Schema.getDefaultInstance() : schema_;
       }
     
       public static final int SCHEMA_ID_FIELD_NUMBER = 3;
    -  private volatile java.lang.Object schemaId_;
    +
    +  @SuppressWarnings("serial")
    +  private volatile java.lang.Object schemaId_ = "";
    +
       /**
        *
        *
        * 
        * The ID to use for the schema, which will become the final component of
        * the schema's resource name.
    -   * See https://cloud.google.com/pubsub/docs/admin#resource_names for resource
    -   * name constraints.
    +   *
    +   * See https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names for
    +   * resource name constraints.
        * 
    * * string schema_id = 3; @@ -271,14 +224,16 @@ public java.lang.String getSchemaId() { return s; } } + /** * * *
        * The ID to use for the schema, which will become the final component of
        * the schema's resource name.
    -   * See https://cloud.google.com/pubsub/docs/admin#resource_names for resource
    -   * name constraints.
    +   *
    +   * See https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names for
    +   * resource name constraints.
        * 
    * * string schema_id = 3; @@ -312,16 +267,16 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!getParentBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(parent_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, parent_); } - if (schema_ != null) { + if (((bitField0_ & 0x00000001) != 0)) { output.writeMessage(2, getSchema()); } - if (!getSchemaIdBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 3, schemaId_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(schemaId_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 3, schemaId_); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -330,16 +285,16 @@ public int getSerializedSize() { if (size != -1) return size; size = 0; - if (!getParentBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(parent_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, parent_); } - if (schema_ != null) { + if (((bitField0_ & 0x00000001) != 0)) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getSchema()); } - if (!getSchemaIdBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, schemaId_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(schemaId_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(3, schemaId_); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -360,7 +315,7 @@ public boolean equals(final java.lang.Object obj) { if (!getSchema().equals(other.getSchema())) return false; } if (!getSchemaId().equals(other.getSchemaId())) return false; - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -379,7 +334,7 @@ public int hashCode() { } hash = (37 * hash) + SCHEMA_ID_FIELD_NUMBER; hash = (53 * hash) + getSchemaId().hashCode(); - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -421,38 +376,38 @@ public static com.google.pubsub.v1.CreateSchemaRequest parseFrom( public static com.google.pubsub.v1.CreateSchemaRequest parseFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.CreateSchemaRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.CreateSchemaRequest parseDelimitedFrom( java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); } public static com.google.pubsub.v1.CreateSchemaRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.CreateSchemaRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.CreateSchemaRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } @@ -475,10 +430,11 @@ public Builder toBuilder() { } @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** * * @@ -488,7 +444,7 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build * * Protobuf type {@code google.pubsub.v1.CreateSchemaRequest} */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements // @@protoc_insertion_point(builder_implements:google.pubsub.v1.CreateSchemaRequest) com.google.pubsub.v1.CreateSchemaRequestOrBuilder { @@ -498,7 +454,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.SchemaProto .internal_static_google_pubsub_v1_CreateSchemaRequest_fieldAccessorTable @@ -512,28 +468,28 @@ private Builder() { maybeForceBuilderInitialization(); } - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + internalGetSchemaFieldBuilder(); + } } @java.lang.Override public Builder clear() { super.clear(); + bitField0_ = 0; parent_ = ""; - - if (schemaBuilder_ == null) { - schema_ = null; - } else { - schema_ = null; + schema_ = null; + if (schemaBuilder_ != null) { + schemaBuilder_.dispose(); schemaBuilder_ = null; } schemaId_ = ""; - return this; } @@ -561,48 +517,27 @@ public com.google.pubsub.v1.CreateSchemaRequest build() { public com.google.pubsub.v1.CreateSchemaRequest buildPartial() { com.google.pubsub.v1.CreateSchemaRequest result = new com.google.pubsub.v1.CreateSchemaRequest(this); - result.parent_ = parent_; - if (schemaBuilder_ == null) { - result.schema_ = schema_; - } else { - result.schema_ = schemaBuilder_.build(); + if (bitField0_ != 0) { + buildPartial0(result); } - result.schemaId_ = schemaId_; onBuilt(); return result; } - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); + private void buildPartial0(com.google.pubsub.v1.CreateSchemaRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.parent_ = parent_; + } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000002) != 0)) { + result.schema_ = schemaBuilder_ == null ? schema_ : schemaBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.schemaId_ = schemaId_; + } + result.bitField0_ |= to_bitField0_; } @java.lang.Override @@ -619,6 +554,7 @@ public Builder mergeFrom(com.google.pubsub.v1.CreateSchemaRequest other) { if (other == com.google.pubsub.v1.CreateSchemaRequest.getDefaultInstance()) return this; if (!other.getParent().isEmpty()) { parent_ = other.parent_; + bitField0_ |= 0x00000001; onChanged(); } if (other.hasSchema()) { @@ -626,9 +562,10 @@ public Builder mergeFrom(com.google.pubsub.v1.CreateSchemaRequest other) { } if (!other.getSchemaId().isEmpty()) { schemaId_ = other.schemaId_; + bitField0_ |= 0x00000004; onChanged(); } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -643,21 +580,56 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.pubsub.v1.CreateSchemaRequest parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + parent_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + input.readMessage(internalGetSchemaFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: + { + schemaId_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000004; + break; + } // case 26 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.google.pubsub.v1.CreateSchemaRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } + private int bitField0_; + private java.lang.Object parent_ = ""; + /** * * @@ -683,6 +655,7 @@ public java.lang.String getParent() { return (java.lang.String) ref; } } + /** * * @@ -708,6 +681,7 @@ public com.google.protobuf.ByteString getParentBytes() { return (com.google.protobuf.ByteString) ref; } } + /** * * @@ -727,11 +701,12 @@ public Builder setParent(java.lang.String value) { if (value == null) { throw new NullPointerException(); } - parent_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } + /** * * @@ -747,11 +722,12 @@ public Builder setParent(java.lang.String value) { * @return This builder for chaining. */ public Builder clearParent() { - parent_ = getDefaultInstance().getParent(); + bitField0_ = (bitField0_ & ~0x00000001); onChanged(); return this; } + /** * * @@ -772,23 +748,25 @@ public Builder setParentBytes(com.google.protobuf.ByteString value) { throw new NullPointerException(); } checkByteStringIsUtf8(value); - parent_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } private com.google.pubsub.v1.Schema schema_; - private com.google.protobuf.SingleFieldBuilderV3< + private com.google.protobuf.SingleFieldBuilder< com.google.pubsub.v1.Schema, com.google.pubsub.v1.Schema.Builder, com.google.pubsub.v1.SchemaOrBuilder> schemaBuilder_; + /** * * *
          * Required. The schema object to create.
    +     *
          * This schema's `name` parameter is ignored. The schema object returned
          * by CreateSchema will have a `name` made using the given `parent` and
          * `schema_id`.
    @@ -799,13 +777,15 @@ public Builder setParentBytes(com.google.protobuf.ByteString value) {
          * @return Whether the schema field is set.
          */
         public boolean hasSchema() {
    -      return schemaBuilder_ != null || schema_ != null;
    +      return ((bitField0_ & 0x00000002) != 0);
         }
    +
         /**
          *
          *
          * 
          * Required. The schema object to create.
    +     *
          * This schema's `name` parameter is ignored. The schema object returned
          * by CreateSchema will have a `name` made using the given `parent` and
          * `schema_id`.
    @@ -822,11 +802,13 @@ public com.google.pubsub.v1.Schema getSchema() {
             return schemaBuilder_.getMessage();
           }
         }
    +
         /**
          *
          *
          * 
          * Required. The schema object to create.
    +     *
          * This schema's `name` parameter is ignored. The schema object returned
          * by CreateSchema will have a `name` made using the given `parent` and
          * `schema_id`.
    @@ -840,18 +822,20 @@ public Builder setSchema(com.google.pubsub.v1.Schema value) {
               throw new NullPointerException();
             }
             schema_ = value;
    -        onChanged();
           } else {
             schemaBuilder_.setMessage(value);
           }
    -
    +      bitField0_ |= 0x00000002;
    +      onChanged();
           return this;
         }
    +
         /**
          *
          *
          * 
          * Required. The schema object to create.
    +     *
          * This schema's `name` parameter is ignored. The schema object returned
          * by CreateSchema will have a `name` made using the given `parent` and
          * `schema_id`.
    @@ -862,18 +846,20 @@ public Builder setSchema(com.google.pubsub.v1.Schema value) {
         public Builder setSchema(com.google.pubsub.v1.Schema.Builder builderForValue) {
           if (schemaBuilder_ == null) {
             schema_ = builderForValue.build();
    -        onChanged();
           } else {
             schemaBuilder_.setMessage(builderForValue.build());
           }
    -
    +      bitField0_ |= 0x00000002;
    +      onChanged();
           return this;
         }
    +
         /**
          *
          *
          * 
          * Required. The schema object to create.
    +     *
          * This schema's `name` parameter is ignored. The schema object returned
          * by CreateSchema will have a `name` made using the given `parent` and
          * `schema_id`.
    @@ -883,23 +869,29 @@ public Builder setSchema(com.google.pubsub.v1.Schema.Builder builderForValue) {
          */
         public Builder mergeSchema(com.google.pubsub.v1.Schema value) {
           if (schemaBuilder_ == null) {
    -        if (schema_ != null) {
    -          schema_ = com.google.pubsub.v1.Schema.newBuilder(schema_).mergeFrom(value).buildPartial();
    +        if (((bitField0_ & 0x00000002) != 0)
    +            && schema_ != null
    +            && schema_ != com.google.pubsub.v1.Schema.getDefaultInstance()) {
    +          getSchemaBuilder().mergeFrom(value);
             } else {
               schema_ = value;
             }
    -        onChanged();
           } else {
             schemaBuilder_.mergeFrom(value);
           }
    -
    +      if (schema_ != null) {
    +        bitField0_ |= 0x00000002;
    +        onChanged();
    +      }
           return this;
         }
    +
         /**
          *
          *
          * 
          * Required. The schema object to create.
    +     *
          * This schema's `name` parameter is ignored. The schema object returned
          * by CreateSchema will have a `name` made using the given `parent` and
          * `schema_id`.
    @@ -908,21 +900,22 @@ public Builder mergeSchema(com.google.pubsub.v1.Schema value) {
          * .google.pubsub.v1.Schema schema = 2 [(.google.api.field_behavior) = REQUIRED];
          */
         public Builder clearSchema() {
    -      if (schemaBuilder_ == null) {
    -        schema_ = null;
    -        onChanged();
    -      } else {
    -        schema_ = null;
    +      bitField0_ = (bitField0_ & ~0x00000002);
    +      schema_ = null;
    +      if (schemaBuilder_ != null) {
    +        schemaBuilder_.dispose();
             schemaBuilder_ = null;
           }
    -
    +      onChanged();
           return this;
         }
    +
         /**
          *
          *
          * 
          * Required. The schema object to create.
    +     *
          * This schema's `name` parameter is ignored. The schema object returned
          * by CreateSchema will have a `name` made using the given `parent` and
          * `schema_id`.
    @@ -931,15 +924,17 @@ public Builder clearSchema() {
          * .google.pubsub.v1.Schema schema = 2 [(.google.api.field_behavior) = REQUIRED];
          */
         public com.google.pubsub.v1.Schema.Builder getSchemaBuilder() {
    -
    +      bitField0_ |= 0x00000002;
           onChanged();
    -      return getSchemaFieldBuilder().getBuilder();
    +      return internalGetSchemaFieldBuilder().getBuilder();
         }
    +
         /**
          *
          *
          * 
          * Required. The schema object to create.
    +     *
          * This schema's `name` parameter is ignored. The schema object returned
          * by CreateSchema will have a `name` made using the given `parent` and
          * `schema_id`.
    @@ -954,11 +949,13 @@ public com.google.pubsub.v1.SchemaOrBuilder getSchemaOrBuilder() {
             return schema_ == null ? com.google.pubsub.v1.Schema.getDefaultInstance() : schema_;
           }
         }
    +
         /**
          *
          *
          * 
          * Required. The schema object to create.
    +     *
          * This schema's `name` parameter is ignored. The schema object returned
          * by CreateSchema will have a `name` made using the given `parent` and
          * `schema_id`.
    @@ -966,14 +963,14 @@ public com.google.pubsub.v1.SchemaOrBuilder getSchemaOrBuilder() {
          *
          * .google.pubsub.v1.Schema schema = 2 [(.google.api.field_behavior) = REQUIRED];
          */
    -    private com.google.protobuf.SingleFieldBuilderV3<
    +    private com.google.protobuf.SingleFieldBuilder<
                 com.google.pubsub.v1.Schema,
                 com.google.pubsub.v1.Schema.Builder,
                 com.google.pubsub.v1.SchemaOrBuilder>
    -        getSchemaFieldBuilder() {
    +        internalGetSchemaFieldBuilder() {
           if (schemaBuilder_ == null) {
             schemaBuilder_ =
    -            new com.google.protobuf.SingleFieldBuilderV3<
    +            new com.google.protobuf.SingleFieldBuilder<
                     com.google.pubsub.v1.Schema,
                     com.google.pubsub.v1.Schema.Builder,
                     com.google.pubsub.v1.SchemaOrBuilder>(
    @@ -984,14 +981,16 @@ public com.google.pubsub.v1.SchemaOrBuilder getSchemaOrBuilder() {
         }
     
         private java.lang.Object schemaId_ = "";
    +
         /**
          *
          *
          * 
          * The ID to use for the schema, which will become the final component of
          * the schema's resource name.
    -     * See https://cloud.google.com/pubsub/docs/admin#resource_names for resource
    -     * name constraints.
    +     *
    +     * See https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names for
    +     * resource name constraints.
          * 
    * * string schema_id = 3; @@ -1009,14 +1008,16 @@ public java.lang.String getSchemaId() { return (java.lang.String) ref; } } + /** * * *
          * The ID to use for the schema, which will become the final component of
          * the schema's resource name.
    -     * See https://cloud.google.com/pubsub/docs/admin#resource_names for resource
    -     * name constraints.
    +     *
    +     * See https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names for
    +     * resource name constraints.
          * 
    * * string schema_id = 3; @@ -1034,14 +1035,16 @@ public com.google.protobuf.ByteString getSchemaIdBytes() { return (com.google.protobuf.ByteString) ref; } } + /** * * *
          * The ID to use for the schema, which will become the final component of
          * the schema's resource name.
    -     * See https://cloud.google.com/pubsub/docs/admin#resource_names for resource
    -     * name constraints.
    +     *
    +     * See https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names for
    +     * resource name constraints.
          * 
    * * string schema_id = 3; @@ -1053,19 +1056,21 @@ public Builder setSchemaId(java.lang.String value) { if (value == null) { throw new NullPointerException(); } - schemaId_ = value; + bitField0_ |= 0x00000004; onChanged(); return this; } + /** * * *
          * The ID to use for the schema, which will become the final component of
          * the schema's resource name.
    -     * See https://cloud.google.com/pubsub/docs/admin#resource_names for resource
    -     * name constraints.
    +     *
    +     * See https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names for
    +     * resource name constraints.
          * 
    * * string schema_id = 3; @@ -1073,19 +1078,21 @@ public Builder setSchemaId(java.lang.String value) { * @return This builder for chaining. */ public Builder clearSchemaId() { - schemaId_ = getDefaultInstance().getSchemaId(); + bitField0_ = (bitField0_ & ~0x00000004); onChanged(); return this; } + /** * * *
          * The ID to use for the schema, which will become the final component of
          * the schema's resource name.
    -     * See https://cloud.google.com/pubsub/docs/admin#resource_names for resource
    -     * name constraints.
    +     *
    +     * See https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names for
    +     * resource name constraints.
          * 
    * * string schema_id = 3; @@ -1098,23 +1105,12 @@ public Builder setSchemaIdBytes(com.google.protobuf.ByteString value) { throw new NullPointerException(); } checkByteStringIsUtf8(value); - schemaId_ = value; + bitField0_ |= 0x00000004; onChanged(); return this; } - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - // @@protoc_insertion_point(builder_scope:google.pubsub.v1.CreateSchemaRequest) } @@ -1136,7 +1132,18 @@ public CreateSchemaRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new CreateSchemaRequest(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/CreateSchemaRequestOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/CreateSchemaRequestOrBuilder.java index 395a549cf..4fa65546b 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/CreateSchemaRequestOrBuilder.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/CreateSchemaRequestOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/schema.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; +@com.google.protobuf.Generated public interface CreateSchemaRequestOrBuilder extends // @@protoc_insertion_point(interface_extends:google.pubsub.v1.CreateSchemaRequest) @@ -38,6 +41,7 @@ public interface CreateSchemaRequestOrBuilder * @return The parent. */ java.lang.String getParent(); + /** * * @@ -59,6 +63,7 @@ public interface CreateSchemaRequestOrBuilder * *
        * Required. The schema object to create.
    +   *
        * This schema's `name` parameter is ignored. The schema object returned
        * by CreateSchema will have a `name` made using the given `parent` and
        * `schema_id`.
    @@ -69,11 +74,13 @@ public interface CreateSchemaRequestOrBuilder
        * @return Whether the schema field is set.
        */
       boolean hasSchema();
    +
       /**
        *
        *
        * 
        * Required. The schema object to create.
    +   *
        * This schema's `name` parameter is ignored. The schema object returned
        * by CreateSchema will have a `name` made using the given `parent` and
        * `schema_id`.
    @@ -84,11 +91,13 @@ public interface CreateSchemaRequestOrBuilder
        * @return The schema.
        */
       com.google.pubsub.v1.Schema getSchema();
    +
       /**
        *
        *
        * 
        * Required. The schema object to create.
    +   *
        * This schema's `name` parameter is ignored. The schema object returned
        * by CreateSchema will have a `name` made using the given `parent` and
        * `schema_id`.
    @@ -104,8 +113,9 @@ public interface CreateSchemaRequestOrBuilder
        * 
        * The ID to use for the schema, which will become the final component of
        * the schema's resource name.
    -   * See https://cloud.google.com/pubsub/docs/admin#resource_names for resource
    -   * name constraints.
    +   *
    +   * See https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names for
    +   * resource name constraints.
        * 
    * * string schema_id = 3; @@ -113,14 +123,16 @@ public interface CreateSchemaRequestOrBuilder * @return The schemaId. */ java.lang.String getSchemaId(); + /** * * *
        * The ID to use for the schema, which will become the final component of
        * the schema's resource name.
    -   * See https://cloud.google.com/pubsub/docs/admin#resource_names for resource
    -   * name constraints.
    +   *
    +   * See https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names for
    +   * resource name constraints.
        * 
    * * string schema_id = 3; 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 00ea43fcd..d911473d5 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 @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; @@ -27,13 +29,25 @@ * * Protobuf type {@code google.pubsub.v1.CreateSnapshotRequest} */ -public final class CreateSnapshotRequest extends com.google.protobuf.GeneratedMessageV3 +@com.google.protobuf.Generated +public final class CreateSnapshotRequest extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:google.pubsub.v1.CreateSnapshotRequest) CreateSnapshotRequestOrBuilder { private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "CreateSnapshotRequest"); + } + // Use CreateSnapshotRequest.newBuilder() to construct. - private CreateSnapshotRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + private CreateSnapshotRequest(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); } @@ -42,82 +56,6 @@ private CreateSnapshotRequest() { subscription_ = ""; } - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new CreateSnapshotRequest(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - private CreateSnapshotRequest( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - java.lang.String s = input.readStringRequireUtf8(); - - name_ = s; - break; - } - case 18: - { - java.lang.String s = input.readStringRequireUtf8(); - - subscription_ = s; - break; - } - case 26: - { - if (!((mutable_bitField0_ & 0x00000001) != 0)) { - labels_ = - com.google.protobuf.MapField.newMapField(LabelsDefaultEntryHolder.defaultEntry); - mutable_bitField0_ |= 0x00000001; - } - com.google.protobuf.MapEntry labels__ = - input.readMessage( - LabelsDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry); - labels_.getMutableMap().put(labels__.getKey(), labels__.getValue()); - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_CreateSnapshotRequest_descriptor; @@ -125,17 +63,20 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { @SuppressWarnings({"rawtypes"}) @java.lang.Override - protected com.google.protobuf.MapField internalGetMapField(int number) { + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldReflection( + int number) { switch (number) { case 3: return internalGetLabels(); + case 4: + return internalGetTags(); default: throw new RuntimeException("Invalid map field number: " + number); } } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_CreateSnapshotRequest_fieldAccessorTable @@ -145,7 +86,10 @@ protected com.google.protobuf.MapField internalGetMapField(int number) { } public static final int NAME_FIELD_NUMBER = 1; - private volatile java.lang.Object name_; + + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; + /** * * @@ -153,9 +97,9 @@ protected com.google.protobuf.MapField internalGetMapField(int number) { * Required. User-provided name for this snapshot. If the name is not provided * in the request, the server will assign a random name for this snapshot on * the same project as the subscription. Note that for REST API requests, you - * must specify a name. See the <a - * href="https://cloud.google.com/pubsub/docs/admin#resource_names"> resource - * name rules</a>. Format is `projects/{project}/snapshots/{snap}`. + * must specify a name. See the [resource name + * rules](https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). + * Format is `projects/{project}/snapshots/{snap}`. *
    * * @@ -176,6 +120,7 @@ public java.lang.String getName() { return s; } } + /** * * @@ -183,9 +128,9 @@ public java.lang.String getName() { * Required. User-provided name for this snapshot. If the name is not provided * in the request, the server will assign a random name for this snapshot on * the same project as the subscription. Note that for REST API requests, you - * must specify a name. See the <a - * href="https://cloud.google.com/pubsub/docs/admin#resource_names"> resource - * name rules</a>. Format is `projects/{project}/snapshots/{snap}`. + * must specify a name. See the [resource name + * rules](https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). + * Format is `projects/{project}/snapshots/{snap}`. *
    * * @@ -208,19 +153,22 @@ public com.google.protobuf.ByteString getNameBytes() { } public static final int SUBSCRIPTION_FIELD_NUMBER = 2; - private volatile java.lang.Object subscription_; + + @SuppressWarnings("serial") + private volatile java.lang.Object subscription_ = ""; + /** * * *
        * Required. The subscription whose backlog the snapshot retains.
        * Specifically, the created snapshot is guaranteed to retain:
    -   *  (a) The existing backlog on the subscription. More precisely, this is
    -   *      defined as the messages in the subscription's backlog that are
    -   *      unacknowledged upon the successful completion of the
    -   *      `CreateSnapshot` request; as well as:
    -   *  (b) Any messages published to the subscription's topic following the
    -   *      successful completion of the CreateSnapshot request.
    +   * (a) The existing backlog on the subscription. More precisely, this is
    +   * defined as the messages in the subscription's backlog that are
    +   * unacknowledged upon the successful completion of the
    +   * `CreateSnapshot` request; as well as:
    +   * (b) Any messages published to the subscription's topic following the
    +   * successful completion of the CreateSnapshot request.
        * Format is `projects/{project}/subscriptions/{sub}`.
        * 
    * @@ -242,18 +190,19 @@ public java.lang.String getSubscription() { return s; } } + /** * * *
        * Required. The subscription whose backlog the snapshot retains.
        * Specifically, the created snapshot is guaranteed to retain:
    -   *  (a) The existing backlog on the subscription. More precisely, this is
    -   *      defined as the messages in the subscription's backlog that are
    -   *      unacknowledged upon the successful completion of the
    -   *      `CreateSnapshot` request; as well as:
    -   *  (b) Any messages published to the subscription's topic following the
    -   *      successful completion of the CreateSnapshot request.
    +   * (a) The existing backlog on the subscription. More precisely, this is
    +   * defined as the messages in the subscription's backlog that are
    +   * unacknowledged upon the successful completion of the
    +   * `CreateSnapshot` request; as well as:
    +   * (b) Any messages published to the subscription's topic following the
    +   * successful completion of the CreateSnapshot request.
        * Format is `projects/{project}/subscriptions/{sub}`.
        * 
    * @@ -289,6 +238,7 @@ private static final class LabelsDefaultEntryHolder { ""); } + @SuppressWarnings("serial") private com.google.protobuf.MapField labels_; private com.google.protobuf.MapField internalGetLabels() { @@ -301,75 +251,83 @@ private com.google.protobuf.MapField interna public int getLabelsCount() { return internalGetLabels().getMap().size(); } + /** * * *
    -   * See <a href="https://cloud.google.com/pubsub/docs/labels"> Creating and
    -   * managing labels</a>.
    +   * Optional. See [Creating and managing
    +   * labels](https://cloud.google.com/pubsub/docs/labels).
        * 
    * - * map<string, string> labels = 3; + * map<string, string> labels = 3 [(.google.api.field_behavior) = OPTIONAL]; */ @java.lang.Override public boolean containsLabels(java.lang.String key) { if (key == null) { - throw new java.lang.NullPointerException(); + throw new NullPointerException("map key"); } return internalGetLabels().getMap().containsKey(key); } + /** Use {@link #getLabelsMap()} instead. */ @java.lang.Override @java.lang.Deprecated public java.util.Map getLabels() { return getLabelsMap(); } + /** * * *
    -   * See <a href="https://cloud.google.com/pubsub/docs/labels"> Creating and
    -   * managing labels</a>.
    +   * Optional. See [Creating and managing
    +   * labels](https://cloud.google.com/pubsub/docs/labels).
        * 
    * - * map<string, string> labels = 3; + * map<string, string> labels = 3 [(.google.api.field_behavior) = OPTIONAL]; */ @java.lang.Override public java.util.Map getLabelsMap() { return internalGetLabels().getMap(); } + /** * * *
    -   * See <a href="https://cloud.google.com/pubsub/docs/labels"> Creating and
    -   * managing labels</a>.
    +   * Optional. See [Creating and managing
    +   * labels](https://cloud.google.com/pubsub/docs/labels).
        * 
    * - * map<string, string> labels = 3; + * map<string, string> labels = 3 [(.google.api.field_behavior) = OPTIONAL]; */ @java.lang.Override - public java.lang.String getLabelsOrDefault(java.lang.String key, java.lang.String defaultValue) { + public /* nullable */ java.lang.String getLabelsOrDefault( + java.lang.String key, + /* nullable */ + java.lang.String defaultValue) { if (key == null) { - throw new java.lang.NullPointerException(); + throw new NullPointerException("map key"); } java.util.Map map = internalGetLabels().getMap(); return map.containsKey(key) ? map.get(key) : defaultValue; } + /** * * *
    -   * See <a href="https://cloud.google.com/pubsub/docs/labels"> Creating and
    -   * managing labels</a>.
    +   * Optional. See [Creating and managing
    +   * labels](https://cloud.google.com/pubsub/docs/labels).
        * 
    * - * map<string, string> labels = 3; + * map<string, string> labels = 3 [(.google.api.field_behavior) = OPTIONAL]; */ @java.lang.Override public java.lang.String getLabelsOrThrow(java.lang.String key) { if (key == null) { - throw new java.lang.NullPointerException(); + throw new NullPointerException("map key"); } java.util.Map map = internalGetLabels().getMap(); if (!map.containsKey(key)) { @@ -378,6 +336,141 @@ 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"
    +   * See https://docs.cloud.google.com/pubsub/docs/tags for more information on
    +   * using tags with Pub/Sub resources.
    +   * 
    + * + * + * 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"
    +   * See https://docs.cloud.google.com/pubsub/docs/tags for more information on
    +   * using tags with Pub/Sub resources.
    +   * 
    + * + * + * 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"
    +   * See https://docs.cloud.google.com/pubsub/docs/tags for more information on
    +   * using tags with Pub/Sub resources.
    +   * 
    + * + * + * 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"
    +   * See https://docs.cloud.google.com/pubsub/docs/tags for more information on
    +   * using tags with Pub/Sub resources.
    +   * 
    + * + * + * 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 @@ -392,15 +485,17 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!getNameBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, name_); } - if (!getSubscriptionBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 2, subscription_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(subscription_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, subscription_); } - com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( + com.google.protobuf.GeneratedMessage.serializeStringMapTo( output, internalGetLabels(), LabelsDefaultEntryHolder.defaultEntry, 3); - unknownFields.writeTo(output); + com.google.protobuf.GeneratedMessage.serializeStringMapTo( + output, internalGetTags(), TagsDefaultEntryHolder.defaultEntry, 4); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -409,11 +504,11 @@ public int getSerializedSize() { if (size != -1) return size; size = 0; - if (!getNameBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, name_); } - if (!getSubscriptionBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, subscription_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(subscription_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, subscription_); } for (java.util.Map.Entry entry : internalGetLabels().getMap().entrySet()) { @@ -425,7 +520,17 @@ public int getSerializedSize() { .build(); size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, labels__); } - size += unknownFields.getSerializedSize(); + 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; } @@ -444,7 +549,8 @@ 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 (!unknownFields.equals(other.unknownFields)) return false; + if (!internalGetTags().equals(other.internalGetTags())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -463,7 +569,11 @@ public int hashCode() { hash = (37 * hash) + LABELS_FIELD_NUMBER; hash = (53 * hash) + internalGetLabels().hashCode(); } - hash = (29 * hash) + unknownFields.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; } @@ -505,38 +615,38 @@ public static com.google.pubsub.v1.CreateSnapshotRequest parseFrom( public static com.google.pubsub.v1.CreateSnapshotRequest parseFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.CreateSnapshotRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.CreateSnapshotRequest parseDelimitedFrom( java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); } public static com.google.pubsub.v1.CreateSnapshotRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.CreateSnapshotRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.CreateSnapshotRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } @@ -559,10 +669,11 @@ public Builder toBuilder() { } @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** * * @@ -572,7 +683,7 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build * * Protobuf type {@code google.pubsub.v1.CreateSnapshotRequest} */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements // @@protoc_insertion_point(builder_implements:google.pubsub.v1.CreateSnapshotRequest) com.google.pubsub.v1.CreateSnapshotRequestOrBuilder { @@ -582,27 +693,33 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @SuppressWarnings({"rawtypes"}) - protected com.google.protobuf.MapField internalGetMapField(int number) { + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldReflection( + int number) { switch (number) { case 3: return internalGetLabels(); + case 4: + return internalGetTags(); default: throw new RuntimeException("Invalid map field number: " + number); } } @SuppressWarnings({"rawtypes"}) - protected com.google.protobuf.MapField internalGetMutableMapField(int number) { + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMutableMapFieldReflection( + int number) { switch (number) { case 3: return internalGetMutableLabels(); + case 4: + return internalGetMutableTags(); default: throw new RuntimeException("Invalid map field number: " + number); } } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_CreateSnapshotRequest_fieldAccessorTable @@ -612,27 +729,20 @@ protected com.google.protobuf.MapField internalGetMutableMapField(int number) { } // Construct using com.google.pubsub.v1.CreateSnapshotRequest.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } + private Builder() {} - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} } @java.lang.Override public Builder clear() { super.clear(); + bitField0_ = 0; name_ = ""; - subscription_ = ""; - internalGetMutableLabels().clear(); + internalGetMutableTags().clear(); return this; } @@ -660,46 +770,29 @@ public com.google.pubsub.v1.CreateSnapshotRequest build() { public com.google.pubsub.v1.CreateSnapshotRequest buildPartial() { com.google.pubsub.v1.CreateSnapshotRequest result = new com.google.pubsub.v1.CreateSnapshotRequest(this); - int from_bitField0_ = bitField0_; - result.name_ = name_; - result.subscription_ = subscription_; - result.labels_ = internalGetLabels(); - result.labels_.makeImmutable(); + if (bitField0_ != 0) { + buildPartial0(result); + } onBuilt(); return result; } - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); + private void buildPartial0(com.google.pubsub.v1.CreateSnapshotRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.name_ = name_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.subscription_ = subscription_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.labels_ = internalGetLabels(); + result.labels_.makeImmutable(); + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.tags_ = internalGetTags(); + result.tags_.makeImmutable(); + } } @java.lang.Override @@ -716,14 +809,19 @@ public Builder mergeFrom(com.google.pubsub.v1.CreateSnapshotRequest other) { if (other == com.google.pubsub.v1.CreateSnapshotRequest.getDefaultInstance()) return this; if (!other.getName().isEmpty()) { name_ = other.name_; + bitField0_ |= 0x00000001; onChanged(); } if (!other.getSubscription().isEmpty()) { subscription_ = other.subscription_; + bitField0_ |= 0x00000002; onChanged(); } internalGetMutableLabels().mergeFrom(other.internalGetLabels()); - this.mergeUnknownFields(other.unknownFields); + bitField0_ |= 0x00000004; + internalGetMutableTags().mergeFrom(other.internalGetTags()); + bitField0_ |= 0x00000008; + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -738,23 +836,71 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.pubsub.v1.CreateSnapshotRequest parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + name_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + subscription_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: + { + com.google.protobuf.MapEntry labels__ = + input.readMessage( + LabelsDefaultEntryHolder.defaultEntry.getParserForType(), + extensionRegistry); + internalGetMutableLabels() + .getMutableMap() + .put(labels__.getKey(), labels__.getValue()); + 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)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.google.pubsub.v1.CreateSnapshotRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } private int bitField0_; private java.lang.Object name_ = ""; + /** * * @@ -762,9 +908,9 @@ public Builder mergeFrom( * Required. User-provided name for this snapshot. If the name is not provided * in the request, the server will assign a random name for this snapshot on * the same project as the subscription. Note that for REST API requests, you - * must specify a name. See the <a - * href="https://cloud.google.com/pubsub/docs/admin#resource_names"> resource - * name rules</a>. Format is `projects/{project}/snapshots/{snap}`. + * must specify a name. See the [resource name + * rules](https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). + * Format is `projects/{project}/snapshots/{snap}`. *
    * * @@ -784,6 +930,7 @@ public java.lang.String getName() { return (java.lang.String) ref; } } + /** * * @@ -791,9 +938,9 @@ public java.lang.String getName() { * Required. User-provided name for this snapshot. If the name is not provided * in the request, the server will assign a random name for this snapshot on * the same project as the subscription. Note that for REST API requests, you - * must specify a name. See the <a - * href="https://cloud.google.com/pubsub/docs/admin#resource_names"> resource - * name rules</a>. Format is `projects/{project}/snapshots/{snap}`. + * must specify a name. See the [resource name + * rules](https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). + * Format is `projects/{project}/snapshots/{snap}`. *
    * * @@ -813,6 +960,7 @@ public com.google.protobuf.ByteString getNameBytes() { return (com.google.protobuf.ByteString) ref; } } + /** * * @@ -820,9 +968,9 @@ public com.google.protobuf.ByteString getNameBytes() { * Required. User-provided name for this snapshot. If the name is not provided * in the request, the server will assign a random name for this snapshot on * the same project as the subscription. Note that for REST API requests, you - * must specify a name. See the <a - * href="https://cloud.google.com/pubsub/docs/admin#resource_names"> resource - * name rules</a>. Format is `projects/{project}/snapshots/{snap}`. + * must specify a name. See the [resource name + * rules](https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). + * Format is `projects/{project}/snapshots/{snap}`. *
    * * @@ -836,11 +984,12 @@ public Builder setName(java.lang.String value) { if (value == null) { throw new NullPointerException(); } - name_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } + /** * * @@ -848,9 +997,9 @@ public Builder setName(java.lang.String value) { * Required. User-provided name for this snapshot. If the name is not provided * in the request, the server will assign a random name for this snapshot on * the same project as the subscription. Note that for REST API requests, you - * must specify a name. See the <a - * href="https://cloud.google.com/pubsub/docs/admin#resource_names"> resource - * name rules</a>. Format is `projects/{project}/snapshots/{snap}`. + * must specify a name. See the [resource name + * rules](https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). + * Format is `projects/{project}/snapshots/{snap}`. *
    * * @@ -860,11 +1009,12 @@ public Builder setName(java.lang.String value) { * @return This builder for chaining. */ public Builder clearName() { - name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000001); onChanged(); return this; } + /** * * @@ -872,9 +1022,9 @@ public Builder clearName() { * Required. User-provided name for this snapshot. If the name is not provided * in the request, the server will assign a random name for this snapshot on * the same project as the subscription. Note that for REST API requests, you - * must specify a name. See the <a - * href="https://cloud.google.com/pubsub/docs/admin#resource_names"> resource - * name rules</a>. Format is `projects/{project}/snapshots/{snap}`. + * must specify a name. See the [resource name + * rules](https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). + * Format is `projects/{project}/snapshots/{snap}`. *
    * * @@ -889,25 +1039,26 @@ public Builder setNameBytes(com.google.protobuf.ByteString value) { throw new NullPointerException(); } checkByteStringIsUtf8(value); - name_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } private java.lang.Object subscription_ = ""; + /** * * *
          * Required. The subscription whose backlog the snapshot retains.
          * Specifically, the created snapshot is guaranteed to retain:
    -     *  (a) The existing backlog on the subscription. More precisely, this is
    -     *      defined as the messages in the subscription's backlog that are
    -     *      unacknowledged upon the successful completion of the
    -     *      `CreateSnapshot` request; as well as:
    -     *  (b) Any messages published to the subscription's topic following the
    -     *      successful completion of the CreateSnapshot request.
    +     * (a) The existing backlog on the subscription. More precisely, this is
    +     * defined as the messages in the subscription's backlog that are
    +     * unacknowledged upon the successful completion of the
    +     * `CreateSnapshot` request; as well as:
    +     * (b) Any messages published to the subscription's topic following the
    +     * successful completion of the CreateSnapshot request.
          * Format is `projects/{project}/subscriptions/{sub}`.
          * 
    * @@ -928,18 +1079,19 @@ public java.lang.String getSubscription() { return (java.lang.String) ref; } } + /** * * *
          * Required. The subscription whose backlog the snapshot retains.
          * Specifically, the created snapshot is guaranteed to retain:
    -     *  (a) The existing backlog on the subscription. More precisely, this is
    -     *      defined as the messages in the subscription's backlog that are
    -     *      unacknowledged upon the successful completion of the
    -     *      `CreateSnapshot` request; as well as:
    -     *  (b) Any messages published to the subscription's topic following the
    -     *      successful completion of the CreateSnapshot request.
    +     * (a) The existing backlog on the subscription. More precisely, this is
    +     * defined as the messages in the subscription's backlog that are
    +     * unacknowledged upon the successful completion of the
    +     * `CreateSnapshot` request; as well as:
    +     * (b) Any messages published to the subscription's topic following the
    +     * successful completion of the CreateSnapshot request.
          * Format is `projects/{project}/subscriptions/{sub}`.
          * 
    * @@ -960,18 +1112,19 @@ public com.google.protobuf.ByteString getSubscriptionBytes() { return (com.google.protobuf.ByteString) ref; } } + /** * * *
          * Required. The subscription whose backlog the snapshot retains.
          * Specifically, the created snapshot is guaranteed to retain:
    -     *  (a) The existing backlog on the subscription. More precisely, this is
    -     *      defined as the messages in the subscription's backlog that are
    -     *      unacknowledged upon the successful completion of the
    -     *      `CreateSnapshot` request; as well as:
    -     *  (b) Any messages published to the subscription's topic following the
    -     *      successful completion of the CreateSnapshot request.
    +     * (a) The existing backlog on the subscription. More precisely, this is
    +     * defined as the messages in the subscription's backlog that are
    +     * unacknowledged upon the successful completion of the
    +     * `CreateSnapshot` request; as well as:
    +     * (b) Any messages published to the subscription's topic following the
    +     * successful completion of the CreateSnapshot request.
          * Format is `projects/{project}/subscriptions/{sub}`.
          * 
    * @@ -986,23 +1139,24 @@ public Builder setSubscription(java.lang.String value) { if (value == null) { throw new NullPointerException(); } - subscription_ = value; + bitField0_ |= 0x00000002; onChanged(); return this; } + /** * * *
          * Required. The subscription whose backlog the snapshot retains.
          * Specifically, the created snapshot is guaranteed to retain:
    -     *  (a) The existing backlog on the subscription. More precisely, this is
    -     *      defined as the messages in the subscription's backlog that are
    -     *      unacknowledged upon the successful completion of the
    -     *      `CreateSnapshot` request; as well as:
    -     *  (b) Any messages published to the subscription's topic following the
    -     *      successful completion of the CreateSnapshot request.
    +     * (a) The existing backlog on the subscription. More precisely, this is
    +     * defined as the messages in the subscription's backlog that are
    +     * unacknowledged upon the successful completion of the
    +     * `CreateSnapshot` request; as well as:
    +     * (b) Any messages published to the subscription's topic following the
    +     * successful completion of the CreateSnapshot request.
          * Format is `projects/{project}/subscriptions/{sub}`.
          * 
    * @@ -1013,23 +1167,24 @@ public Builder setSubscription(java.lang.String value) { * @return This builder for chaining. */ public Builder clearSubscription() { - subscription_ = getDefaultInstance().getSubscription(); + bitField0_ = (bitField0_ & ~0x00000002); onChanged(); return this; } + /** * * *
          * Required. The subscription whose backlog the snapshot retains.
          * Specifically, the created snapshot is guaranteed to retain:
    -     *  (a) The existing backlog on the subscription. More precisely, this is
    -     *      defined as the messages in the subscription's backlog that are
    -     *      unacknowledged upon the successful completion of the
    -     *      `CreateSnapshot` request; as well as:
    -     *  (b) Any messages published to the subscription's topic following the
    -     *      successful completion of the CreateSnapshot request.
    +     * (a) The existing backlog on the subscription. More precisely, this is
    +     * defined as the messages in the subscription's backlog that are
    +     * unacknowledged upon the successful completion of the
    +     * `CreateSnapshot` request; as well as:
    +     * (b) Any messages published to the subscription's topic following the
    +     * successful completion of the CreateSnapshot request.
          * Format is `projects/{project}/subscriptions/{sub}`.
          * 
    * @@ -1045,8 +1200,8 @@ public Builder setSubscriptionBytes(com.google.protobuf.ByteString value) { throw new NullPointerException(); } checkByteStringIsUtf8(value); - subscription_ = value; + bitField0_ |= 0x00000002; onChanged(); return this; } @@ -1062,90 +1217,97 @@ private com.google.protobuf.MapField interna private com.google.protobuf.MapField internalGetMutableLabels() { - onChanged(); - ; if (labels_ == null) { labels_ = com.google.protobuf.MapField.newMapField(LabelsDefaultEntryHolder.defaultEntry); } if (!labels_.isMutable()) { labels_ = labels_.copy(); } + bitField0_ |= 0x00000004; + onChanged(); return labels_; } public int getLabelsCount() { return internalGetLabels().getMap().size(); } + /** * * *
    -     * See <a href="https://cloud.google.com/pubsub/docs/labels"> Creating and
    -     * managing labels</a>.
    +     * Optional. See [Creating and managing
    +     * labels](https://cloud.google.com/pubsub/docs/labels).
          * 
    * - * map<string, string> labels = 3; + * map<string, string> labels = 3 [(.google.api.field_behavior) = OPTIONAL]; */ @java.lang.Override public boolean containsLabels(java.lang.String key) { if (key == null) { - throw new java.lang.NullPointerException(); + throw new NullPointerException("map key"); } return internalGetLabels().getMap().containsKey(key); } + /** Use {@link #getLabelsMap()} instead. */ @java.lang.Override @java.lang.Deprecated public java.util.Map getLabels() { return getLabelsMap(); } + /** * * *
    -     * See <a href="https://cloud.google.com/pubsub/docs/labels"> Creating and
    -     * managing labels</a>.
    +     * Optional. See [Creating and managing
    +     * labels](https://cloud.google.com/pubsub/docs/labels).
          * 
    * - * map<string, string> labels = 3; + * map<string, string> labels = 3 [(.google.api.field_behavior) = OPTIONAL]; */ @java.lang.Override public java.util.Map getLabelsMap() { return internalGetLabels().getMap(); } + /** * * *
    -     * See <a href="https://cloud.google.com/pubsub/docs/labels"> Creating and
    -     * managing labels</a>.
    +     * Optional. See [Creating and managing
    +     * labels](https://cloud.google.com/pubsub/docs/labels).
          * 
    * - * map<string, string> labels = 3; + * map<string, string> labels = 3 [(.google.api.field_behavior) = OPTIONAL]; */ @java.lang.Override - public java.lang.String getLabelsOrDefault( - java.lang.String key, java.lang.String defaultValue) { + public /* nullable */ java.lang.String getLabelsOrDefault( + java.lang.String key, + /* nullable */ + java.lang.String defaultValue) { if (key == null) { - throw new java.lang.NullPointerException(); + throw new NullPointerException("map key"); } java.util.Map map = internalGetLabels().getMap(); return map.containsKey(key) ? map.get(key) : defaultValue; } + /** * * *
    -     * See <a href="https://cloud.google.com/pubsub/docs/labels"> Creating and
    -     * managing labels</a>.
    +     * Optional. See [Creating and managing
    +     * labels](https://cloud.google.com/pubsub/docs/labels).
          * 
    * - * map<string, string> labels = 3; + * map<string, string> labels = 3 [(.google.api.field_behavior) = OPTIONAL]; */ @java.lang.Override public java.lang.String getLabelsOrThrow(java.lang.String key) { if (key == null) { - throw new java.lang.NullPointerException(); + throw new NullPointerException("map key"); } java.util.Map map = internalGetLabels().getMap(); if (!map.containsKey(key)) { @@ -1155,75 +1317,293 @@ public java.lang.String getLabelsOrThrow(java.lang.String key) { } public Builder clearLabels() { + bitField0_ = (bitField0_ & ~0x00000004); internalGetMutableLabels().getMutableMap().clear(); return this; } + /** * * *
    -     * See <a href="https://cloud.google.com/pubsub/docs/labels"> Creating and
    -     * managing labels</a>.
    +     * Optional. See [Creating and managing
    +     * labels](https://cloud.google.com/pubsub/docs/labels).
          * 
    * - * map<string, string> labels = 3; + * map<string, string> labels = 3 [(.google.api.field_behavior) = OPTIONAL]; */ public Builder removeLabels(java.lang.String key) { if (key == null) { - throw new java.lang.NullPointerException(); + throw new NullPointerException("map key"); } internalGetMutableLabels().getMutableMap().remove(key); return this; } + /** Use alternate mutation accessors instead. */ @java.lang.Deprecated public java.util.Map getMutableLabels() { + bitField0_ |= 0x00000004; return internalGetMutableLabels().getMutableMap(); } + /** * * *
    -     * See <a href="https://cloud.google.com/pubsub/docs/labels"> Creating and
    -     * managing labels</a>.
    +     * Optional. See [Creating and managing
    +     * labels](https://cloud.google.com/pubsub/docs/labels).
          * 
    * - * map<string, string> labels = 3; + * map<string, string> labels = 3 [(.google.api.field_behavior) = OPTIONAL]; */ public Builder putLabels(java.lang.String key, java.lang.String value) { if (key == null) { - throw new java.lang.NullPointerException(); + throw new NullPointerException("map key"); } if (value == null) { - throw new java.lang.NullPointerException(); + throw new NullPointerException("map value"); } internalGetMutableLabels().getMutableMap().put(key, value); + bitField0_ |= 0x00000004; return this; } + /** * * *
    -     * See <a href="https://cloud.google.com/pubsub/docs/labels"> Creating and
    -     * managing labels</a>.
    +     * Optional. See [Creating and managing
    +     * labels](https://cloud.google.com/pubsub/docs/labels).
          * 
    * - * map<string, string> labels = 3; + * map<string, string> labels = 3 [(.google.api.field_behavior) = OPTIONAL]; */ public Builder putAllLabels(java.util.Map values) { internalGetMutableLabels().getMutableMap().putAll(values); + bitField0_ |= 0x00000004; 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"
    +     * See https://docs.cloud.google.com/pubsub/docs/tags for more information on
    +     * using tags with Pub/Sub resources.
    +     * 
    + * + * + * 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 - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); + @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"
    +     * See https://docs.cloud.google.com/pubsub/docs/tags for more information on
    +     * using tags with Pub/Sub resources.
    +     * 
    + * + * + * 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 final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); + 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"
    +     * See https://docs.cloud.google.com/pubsub/docs/tags for more information on
    +     * using tags with Pub/Sub resources.
    +     * 
    + * + * + * 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"
    +     * See https://docs.cloud.google.com/pubsub/docs/tags for more information on
    +     * using tags with Pub/Sub resources.
    +     * 
    + * + * + * 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"
    +     * See https://docs.cloud.google.com/pubsub/docs/tags for more information on
    +     * using tags with Pub/Sub resources.
    +     * 
    + * + * + * 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"
    +     * See https://docs.cloud.google.com/pubsub/docs/tags for more information on
    +     * using tags with Pub/Sub resources.
    +     * 
    + * + * + * 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"
    +     * See https://docs.cloud.google.com/pubsub/docs/tags for more information on
    +     * using tags with Pub/Sub resources.
    +     * 
    + * + * + * 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; } // @@protoc_insertion_point(builder_scope:google.pubsub.v1.CreateSnapshotRequest) @@ -1247,7 +1627,18 @@ public CreateSnapshotRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new CreateSnapshotRequest(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; 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 b8e0ef2f9..2105ed01c 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 @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; +@com.google.protobuf.Generated public interface CreateSnapshotRequestOrBuilder extends // @@protoc_insertion_point(interface_extends:google.pubsub.v1.CreateSnapshotRequest) @@ -30,9 +33,9 @@ public interface CreateSnapshotRequestOrBuilder * Required. User-provided name for this snapshot. If the name is not provided * in the request, the server will assign a random name for this snapshot on * the same project as the subscription. Note that for REST API requests, you - * must specify a name. See the <a - * href="https://cloud.google.com/pubsub/docs/admin#resource_names"> resource - * name rules</a>. Format is `projects/{project}/snapshots/{snap}`. + * must specify a name. See the [resource name + * rules](https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). + * Format is `projects/{project}/snapshots/{snap}`. *
    * * @@ -42,6 +45,7 @@ public interface CreateSnapshotRequestOrBuilder * @return The name. */ java.lang.String getName(); + /** * * @@ -49,9 +53,9 @@ public interface CreateSnapshotRequestOrBuilder * Required. User-provided name for this snapshot. If the name is not provided * in the request, the server will assign a random name for this snapshot on * the same project as the subscription. Note that for REST API requests, you - * must specify a name. See the <a - * href="https://cloud.google.com/pubsub/docs/admin#resource_names"> resource - * name rules</a>. Format is `projects/{project}/snapshots/{snap}`. + * must specify a name. See the [resource name + * rules](https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). + * Format is `projects/{project}/snapshots/{snap}`. *
    * * @@ -68,12 +72,12 @@ public interface CreateSnapshotRequestOrBuilder *
        * Required. The subscription whose backlog the snapshot retains.
        * Specifically, the created snapshot is guaranteed to retain:
    -   *  (a) The existing backlog on the subscription. More precisely, this is
    -   *      defined as the messages in the subscription's backlog that are
    -   *      unacknowledged upon the successful completion of the
    -   *      `CreateSnapshot` request; as well as:
    -   *  (b) Any messages published to the subscription's topic following the
    -   *      successful completion of the CreateSnapshot request.
    +   * (a) The existing backlog on the subscription. More precisely, this is
    +   * defined as the messages in the subscription's backlog that are
    +   * unacknowledged upon the successful completion of the
    +   * `CreateSnapshot` request; as well as:
    +   * (b) Any messages published to the subscription's topic following the
    +   * successful completion of the CreateSnapshot request.
        * Format is `projects/{project}/subscriptions/{sub}`.
        * 
    * @@ -84,18 +88,19 @@ public interface CreateSnapshotRequestOrBuilder * @return The subscription. */ java.lang.String getSubscription(); + /** * * *
        * Required. The subscription whose backlog the snapshot retains.
        * Specifically, the created snapshot is guaranteed to retain:
    -   *  (a) The existing backlog on the subscription. More precisely, this is
    -   *      defined as the messages in the subscription's backlog that are
    -   *      unacknowledged upon the successful completion of the
    -   *      `CreateSnapshot` request; as well as:
    -   *  (b) Any messages published to the subscription's topic following the
    -   *      successful completion of the CreateSnapshot request.
    +   * (a) The existing backlog on the subscription. More precisely, this is
    +   * defined as the messages in the subscription's backlog that are
    +   * unacknowledged upon the successful completion of the
    +   * `CreateSnapshot` request; as well as:
    +   * (b) Any messages published to the subscription's topic following the
    +   * successful completion of the CreateSnapshot request.
        * Format is `projects/{project}/subscriptions/{sub}`.
        * 
    * @@ -111,58 +116,165 @@ public interface CreateSnapshotRequestOrBuilder * * *
    -   * See <a href="https://cloud.google.com/pubsub/docs/labels"> Creating and
    -   * managing labels</a>.
    +   * Optional. See [Creating and managing
    +   * labels](https://cloud.google.com/pubsub/docs/labels).
        * 
    * - * map<string, string> labels = 3; + * map<string, string> labels = 3 [(.google.api.field_behavior) = OPTIONAL]; */ int getLabelsCount(); + /** * * *
    -   * See <a href="https://cloud.google.com/pubsub/docs/labels"> Creating and
    -   * managing labels</a>.
    +   * Optional. See [Creating and managing
    +   * labels](https://cloud.google.com/pubsub/docs/labels).
        * 
    * - * map<string, string> labels = 3; + * map<string, string> labels = 3 [(.google.api.field_behavior) = OPTIONAL]; */ boolean containsLabels(java.lang.String key); + /** Use {@link #getLabelsMap()} instead. */ @java.lang.Deprecated java.util.Map getLabels(); + /** * * *
    -   * See <a href="https://cloud.google.com/pubsub/docs/labels"> Creating and
    -   * managing labels</a>.
    +   * Optional. See [Creating and managing
    +   * labels](https://cloud.google.com/pubsub/docs/labels).
        * 
    * - * map<string, string> labels = 3; + * map<string, string> labels = 3 [(.google.api.field_behavior) = OPTIONAL]; */ java.util.Map getLabelsMap(); + /** * * *
    -   * See <a href="https://cloud.google.com/pubsub/docs/labels"> Creating and
    -   * managing labels</a>.
    +   * Optional. See [Creating and managing
    +   * labels](https://cloud.google.com/pubsub/docs/labels).
        * 
    * - * map<string, string> labels = 3; + * map<string, string> labels = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - java.lang.String getLabelsOrDefault(java.lang.String key, java.lang.String defaultValue); + /* nullable */ + java.lang.String getLabelsOrDefault( + java.lang.String key, + /* nullable */ + java.lang.String defaultValue); + /** * * *
    -   * See <a href="https://cloud.google.com/pubsub/docs/labels"> Creating and
    -   * managing labels</a>.
    +   * Optional. See [Creating and managing
    +   * labels](https://cloud.google.com/pubsub/docs/labels).
        * 
    * - * map<string, string> labels = 3; + * 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"
    +   * See https://docs.cloud.google.com/pubsub/docs/tags for more information on
    +   * using tags with Pub/Sub resources.
    +   * 
    + * + * + * 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"
    +   * See https://docs.cloud.google.com/pubsub/docs/tags for more information on
    +   * using tags with Pub/Sub resources.
    +   * 
    + * + * + * 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"
    +   * See https://docs.cloud.google.com/pubsub/docs/tags for more information on
    +   * using tags with Pub/Sub resources.
    +   * 
    + * + * + * 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"
    +   * See https://docs.cloud.google.com/pubsub/docs/tags for more information on
    +   * using tags with Pub/Sub resources.
    +   * 
    + * + * + * 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"
    +   * See https://docs.cloud.google.com/pubsub/docs/tags for more information on
    +   * using tags with Pub/Sub resources.
    +   * 
    + * + * + * 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..c2b1411cb --- /dev/null +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/CryptoKeyName.java @@ -0,0 +1,261 @@ +/* + * Copyright 2026 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 773359cfa..f6ba7bb82 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 @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; @@ -24,19 +26,32 @@ *
      * Dead lettering is done on a best effort basis. The same message might be
      * dead lettered multiple times.
    + *
      * If validation on any of the fields fails at subscription creation/updation,
      * the create/update subscription request will fail.
      * 
    * * Protobuf type {@code google.pubsub.v1.DeadLetterPolicy} */ -public final class DeadLetterPolicy extends com.google.protobuf.GeneratedMessageV3 +@com.google.protobuf.Generated +public final class DeadLetterPolicy extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:google.pubsub.v1.DeadLetterPolicy) DeadLetterPolicyOrBuilder { private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "DeadLetterPolicy"); + } + // Use DeadLetterPolicy.newBuilder() to construct. - private DeadLetterPolicy(com.google.protobuf.GeneratedMessageV3.Builder builder) { + private DeadLetterPolicy(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); } @@ -44,73 +59,13 @@ private DeadLetterPolicy() { deadLetterTopic_ = ""; } - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new DeadLetterPolicy(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - private DeadLetterPolicy( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - java.lang.String s = input.readStringRequireUtf8(); - - deadLetterTopic_ = s; - break; - } - case 16: - { - maxDeliveryAttempts_ = input.readInt32(); - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_DeadLetterPolicy_descriptor; } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_DeadLetterPolicy_fieldAccessorTable @@ -120,22 +75,28 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } public static final int DEAD_LETTER_TOPIC_FIELD_NUMBER = 1; - private volatile java.lang.Object deadLetterTopic_; + + @SuppressWarnings("serial") + private volatile java.lang.Object deadLetterTopic_ = ""; + /** * * *
    -   * The name of the topic to which dead letter messages should be published.
    -   * Format is `projects/{project}/topics/{topic}`.The Cloud Pub/Sub service
    -   * account associated with the enclosing subscription's parent project (i.e.,
    -   * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
    -   * permission to Publish() to this topic.
    +   * Optional. The name of the topic to which dead letter messages should be
    +   * published. Format is `projects/{project}/topics/{topic}`.The Pub/Sub
    +   * service account associated with the enclosing subscription's parent project
    +   * (i.e., service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must
    +   * have permission to Publish() to this topic.
    +   *
        * 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; + * + * string dead_letter_topic = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return The deadLetterTopic. */ @@ -151,21 +112,25 @@ public java.lang.String getDeadLetterTopic() { return s; } } + /** * * *
    -   * The name of the topic to which dead letter messages should be published.
    -   * Format is `projects/{project}/topics/{topic}`.The Cloud Pub/Sub service
    -   * account associated with the enclosing subscription's parent project (i.e.,
    -   * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
    -   * permission to Publish() to this topic.
    +   * Optional. The name of the topic to which dead letter messages should be
    +   * published. Format is `projects/{project}/topics/{topic}`.The Pub/Sub
    +   * service account associated with the enclosing subscription's parent project
    +   * (i.e., service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must
    +   * have permission to Publish() to this topic.
    +   *
        * 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; + * + * string dead_letter_topic = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return The bytes for deadLetterTopic. */ @@ -183,23 +148,28 @@ public com.google.protobuf.ByteString getDeadLetterTopicBytes() { } public static final int MAX_DELIVERY_ATTEMPTS_FIELD_NUMBER = 2; - private int maxDeliveryAttempts_; + private int maxDeliveryAttempts_ = 0; + /** * * *
    -   * The maximum number of delivery attempts for any message. The value must be
    -   * between 5 and 100.
    +   * Optional. The maximum number of delivery attempts for any message. The
    +   * value must be between 5 and 100.
    +   *
        * The number of delivery attempts is defined as 1 + (the sum of number of
    -   * NACKs and number of times the acknowledgement deadline has been exceeded
    +   * NACKs and number of times the acknowledgment deadline has been exceeded
        * for the message).
    +   *
        * A NACK is any call to ModifyAckDeadline with a 0 deadline. Note that
        * client libraries may automatically extend ack_deadlines.
    +   *
        * This field will be honored on a best effort basis.
    +   *
        * If this parameter is 0, a default value of 5 is used.
        * 
    * - * int32 max_delivery_attempts = 2; + * int32 max_delivery_attempts = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The maxDeliveryAttempts. */ @@ -222,13 +192,13 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!getDeadLetterTopicBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, deadLetterTopic_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(deadLetterTopic_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, deadLetterTopic_); } if (maxDeliveryAttempts_ != 0) { output.writeInt32(2, maxDeliveryAttempts_); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -237,13 +207,13 @@ public int getSerializedSize() { if (size != -1) return size; size = 0; - if (!getDeadLetterTopicBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, deadLetterTopic_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(deadLetterTopic_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, deadLetterTopic_); } if (maxDeliveryAttempts_ != 0) { size += com.google.protobuf.CodedOutputStream.computeInt32Size(2, maxDeliveryAttempts_); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -260,7 +230,7 @@ public boolean equals(final java.lang.Object obj) { if (!getDeadLetterTopic().equals(other.getDeadLetterTopic())) return false; if (getMaxDeliveryAttempts() != other.getMaxDeliveryAttempts()) return false; - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -275,7 +245,7 @@ public int hashCode() { hash = (53 * hash) + getDeadLetterTopic().hashCode(); hash = (37 * hash) + MAX_DELIVERY_ATTEMPTS_FIELD_NUMBER; hash = (53 * hash) + getMaxDeliveryAttempts(); - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -316,38 +286,38 @@ public static com.google.pubsub.v1.DeadLetterPolicy parseFrom( public static com.google.pubsub.v1.DeadLetterPolicy parseFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.DeadLetterPolicy parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.DeadLetterPolicy parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); } public static com.google.pubsub.v1.DeadLetterPolicy parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.DeadLetterPolicy parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.DeadLetterPolicy parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } @@ -370,23 +340,25 @@ public Builder toBuilder() { } @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** * * *
        * Dead lettering is done on a best effort basis. The same message might be
        * dead lettered multiple times.
    +   *
        * If validation on any of the fields fails at subscription creation/updation,
        * the create/update subscription request will fail.
        * 
    * * Protobuf type {@code google.pubsub.v1.DeadLetterPolicy} */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements // @@protoc_insertion_point(builder_implements:google.pubsub.v1.DeadLetterPolicy) com.google.pubsub.v1.DeadLetterPolicyOrBuilder { @@ -396,7 +368,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_DeadLetterPolicy_fieldAccessorTable @@ -406,26 +378,18 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } // Construct using com.google.pubsub.v1.DeadLetterPolicy.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } + private Builder() {} - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} } @java.lang.Override public Builder clear() { super.clear(); + bitField0_ = 0; deadLetterTopic_ = ""; - maxDeliveryAttempts_ = 0; - return this; } @@ -453,43 +417,21 @@ public com.google.pubsub.v1.DeadLetterPolicy build() { public com.google.pubsub.v1.DeadLetterPolicy buildPartial() { com.google.pubsub.v1.DeadLetterPolicy result = new com.google.pubsub.v1.DeadLetterPolicy(this); - result.deadLetterTopic_ = deadLetterTopic_; - result.maxDeliveryAttempts_ = maxDeliveryAttempts_; + if (bitField0_ != 0) { + buildPartial0(result); + } onBuilt(); return result; } - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); + private void buildPartial0(com.google.pubsub.v1.DeadLetterPolicy result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.deadLetterTopic_ = deadLetterTopic_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.maxDeliveryAttempts_ = maxDeliveryAttempts_; + } } @java.lang.Override @@ -506,12 +448,13 @@ public Builder mergeFrom(com.google.pubsub.v1.DeadLetterPolicy other) { if (other == com.google.pubsub.v1.DeadLetterPolicy.getDefaultInstance()) return this; if (!other.getDeadLetterTopic().isEmpty()) { deadLetterTopic_ = other.deadLetterTopic_; + bitField0_ |= 0x00000001; onChanged(); } if (other.getMaxDeliveryAttempts() != 0) { setMaxDeliveryAttempts(other.getMaxDeliveryAttempts()); } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -526,36 +469,68 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.pubsub.v1.DeadLetterPolicy parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + deadLetterTopic_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 16: + { + maxDeliveryAttempts_ = input.readInt32(); + bitField0_ |= 0x00000002; + break; + } // case 16 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.google.pubsub.v1.DeadLetterPolicy) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } + private int bitField0_; + private java.lang.Object deadLetterTopic_ = ""; + /** * * *
    -     * The name of the topic to which dead letter messages should be published.
    -     * Format is `projects/{project}/topics/{topic}`.The Cloud Pub/Sub service
    -     * account associated with the enclosing subscription's parent project (i.e.,
    -     * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
    -     * permission to Publish() to this topic.
    +     * Optional. The name of the topic to which dead letter messages should be
    +     * published. Format is `projects/{project}/topics/{topic}`.The Pub/Sub
    +     * service account associated with the enclosing subscription's parent project
    +     * (i.e., service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must
    +     * have permission to Publish() to this topic.
    +     *
          * 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; + * + * string dead_letter_topic = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return The deadLetterTopic. */ @@ -570,21 +545,25 @@ public java.lang.String getDeadLetterTopic() { return (java.lang.String) ref; } } + /** * * *
    -     * The name of the topic to which dead letter messages should be published.
    -     * Format is `projects/{project}/topics/{topic}`.The Cloud Pub/Sub service
    -     * account associated with the enclosing subscription's parent project (i.e.,
    -     * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
    -     * permission to Publish() to this topic.
    +     * Optional. The name of the topic to which dead letter messages should be
    +     * published. Format is `projects/{project}/topics/{topic}`.The Pub/Sub
    +     * service account associated with the enclosing subscription's parent project
    +     * (i.e., service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must
    +     * have permission to Publish() to this topic.
    +     *
          * 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; + * + * string dead_letter_topic = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return The bytes for deadLetterTopic. */ @@ -599,21 +578,25 @@ public com.google.protobuf.ByteString getDeadLetterTopicBytes() { return (com.google.protobuf.ByteString) ref; } } + /** * * *
    -     * The name of the topic to which dead letter messages should be published.
    -     * Format is `projects/{project}/topics/{topic}`.The Cloud Pub/Sub service
    -     * account associated with the enclosing subscription's parent project (i.e.,
    -     * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
    -     * permission to Publish() to this topic.
    +     * Optional. The name of the topic to which dead letter messages should be
    +     * published. Format is `projects/{project}/topics/{topic}`.The Pub/Sub
    +     * service account associated with the enclosing subscription's parent project
    +     * (i.e., service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must
    +     * have permission to Publish() to this topic.
    +     *
          * 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; + * + * 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. @@ -622,50 +605,58 @@ public Builder setDeadLetterTopic(java.lang.String value) { if (value == null) { throw new NullPointerException(); } - deadLetterTopic_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } + /** * * *
    -     * The name of the topic to which dead letter messages should be published.
    -     * Format is `projects/{project}/topics/{topic}`.The Cloud Pub/Sub service
    -     * account associated with the enclosing subscription's parent project (i.e.,
    -     * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
    -     * permission to Publish() to this topic.
    +     * Optional. The name of the topic to which dead letter messages should be
    +     * published. Format is `projects/{project}/topics/{topic}`.The Pub/Sub
    +     * service account associated with the enclosing subscription's parent project
    +     * (i.e., service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must
    +     * have permission to Publish() to this topic.
    +     *
          * 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; + * + * string dead_letter_topic = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return This builder for chaining. */ public Builder clearDeadLetterTopic() { - deadLetterTopic_ = getDefaultInstance().getDeadLetterTopic(); + bitField0_ = (bitField0_ & ~0x00000001); onChanged(); return this; } + /** * * *
    -     * The name of the topic to which dead letter messages should be published.
    -     * Format is `projects/{project}/topics/{topic}`.The Cloud Pub/Sub service
    -     * account associated with the enclosing subscription's parent project (i.e.,
    -     * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
    -     * permission to Publish() to this topic.
    +     * Optional. The name of the topic to which dead letter messages should be
    +     * published. Format is `projects/{project}/topics/{topic}`.The Pub/Sub
    +     * service account associated with the enclosing subscription's parent project
    +     * (i.e., service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must
    +     * have permission to Publish() to this topic.
    +     *
          * 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; + * + * 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. @@ -675,29 +666,34 @@ public Builder setDeadLetterTopicBytes(com.google.protobuf.ByteString value) { throw new NullPointerException(); } checkByteStringIsUtf8(value); - deadLetterTopic_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } private int maxDeliveryAttempts_; + /** * * *
    -     * The maximum number of delivery attempts for any message. The value must be
    -     * between 5 and 100.
    +     * Optional. The maximum number of delivery attempts for any message. The
    +     * value must be between 5 and 100.
    +     *
          * The number of delivery attempts is defined as 1 + (the sum of number of
    -     * NACKs and number of times the acknowledgement deadline has been exceeded
    +     * NACKs and number of times the acknowledgment deadline has been exceeded
          * for the message).
    +     *
          * A NACK is any call to ModifyAckDeadline with a 0 deadline. Note that
          * client libraries may automatically extend ack_deadlines.
    +     *
          * This field will be honored on a best effort basis.
    +     *
          * If this parameter is 0, a default value of 5 is used.
          * 
    * - * int32 max_delivery_attempts = 2; + * int32 max_delivery_attempts = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The maxDeliveryAttempts. */ @@ -705,22 +701,27 @@ public Builder setDeadLetterTopicBytes(com.google.protobuf.ByteString value) { public int getMaxDeliveryAttempts() { return maxDeliveryAttempts_; } + /** * * *
    -     * The maximum number of delivery attempts for any message. The value must be
    -     * between 5 and 100.
    +     * Optional. The maximum number of delivery attempts for any message. The
    +     * value must be between 5 and 100.
    +     *
          * The number of delivery attempts is defined as 1 + (the sum of number of
    -     * NACKs and number of times the acknowledgement deadline has been exceeded
    +     * NACKs and number of times the acknowledgment deadline has been exceeded
          * for the message).
    +     *
          * A NACK is any call to ModifyAckDeadline with a 0 deadline. Note that
          * client libraries may automatically extend ack_deadlines.
    +     *
          * This field will be honored on a best effort basis.
    +     *
          * If this parameter is 0, a default value of 5 is used.
          * 
    * - * int32 max_delivery_attempts = 2; + * int32 max_delivery_attempts = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @param value The maxDeliveryAttempts to set. * @return This builder for chaining. @@ -728,46 +729,41 @@ public int getMaxDeliveryAttempts() { public Builder setMaxDeliveryAttempts(int value) { maxDeliveryAttempts_ = value; + bitField0_ |= 0x00000002; onChanged(); return this; } + /** * * *
    -     * The maximum number of delivery attempts for any message. The value must be
    -     * between 5 and 100.
    +     * Optional. The maximum number of delivery attempts for any message. The
    +     * value must be between 5 and 100.
    +     *
          * The number of delivery attempts is defined as 1 + (the sum of number of
    -     * NACKs and number of times the acknowledgement deadline has been exceeded
    +     * NACKs and number of times the acknowledgment deadline has been exceeded
          * for the message).
    +     *
          * A NACK is any call to ModifyAckDeadline with a 0 deadline. Note that
          * client libraries may automatically extend ack_deadlines.
    +     *
          * This field will be honored on a best effort basis.
    +     *
          * If this parameter is 0, a default value of 5 is used.
          * 
    * - * int32 max_delivery_attempts = 2; + * int32 max_delivery_attempts = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return This builder for chaining. */ public Builder clearMaxDeliveryAttempts() { - + bitField0_ = (bitField0_ & ~0x00000002); maxDeliveryAttempts_ = 0; onChanged(); return this; } - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - // @@protoc_insertion_point(builder_scope:google.pubsub.v1.DeadLetterPolicy) } @@ -789,7 +785,18 @@ public DeadLetterPolicy parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new DeadLetterPolicy(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; 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 1e3060f7b..9d8c29223 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 @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; +@com.google.protobuf.Generated public interface DeadLetterPolicyOrBuilder extends // @@protoc_insertion_point(interface_extends:google.pubsub.v1.DeadLetterPolicy) @@ -27,36 +30,43 @@ public interface DeadLetterPolicyOrBuilder * * *
    -   * The name of the topic to which dead letter messages should be published.
    -   * Format is `projects/{project}/topics/{topic}`.The Cloud Pub/Sub service
    -   * account associated with the enclosing subscription's parent project (i.e.,
    -   * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
    -   * permission to Publish() to this topic.
    +   * Optional. The name of the topic to which dead letter messages should be
    +   * published. Format is `projects/{project}/topics/{topic}`.The Pub/Sub
    +   * service account associated with the enclosing subscription's parent project
    +   * (i.e., service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must
    +   * have permission to Publish() to this topic.
    +   *
        * 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; + * + * string dead_letter_topic = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return The deadLetterTopic. */ java.lang.String getDeadLetterTopic(); + /** * * *
    -   * The name of the topic to which dead letter messages should be published.
    -   * Format is `projects/{project}/topics/{topic}`.The Cloud Pub/Sub service
    -   * account associated with the enclosing subscription's parent project (i.e.,
    -   * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
    -   * permission to Publish() to this topic.
    +   * Optional. The name of the topic to which dead letter messages should be
    +   * published. Format is `projects/{project}/topics/{topic}`.The Pub/Sub
    +   * service account associated with the enclosing subscription's parent project
    +   * (i.e., service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must
    +   * have permission to Publish() to this topic.
    +   *
        * 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; + * + * string dead_letter_topic = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return The bytes for deadLetterTopic. */ @@ -66,18 +76,22 @@ public interface DeadLetterPolicyOrBuilder * * *
    -   * The maximum number of delivery attempts for any message. The value must be
    -   * between 5 and 100.
    +   * Optional. The maximum number of delivery attempts for any message. The
    +   * value must be between 5 and 100.
    +   *
        * The number of delivery attempts is defined as 1 + (the sum of number of
    -   * NACKs and number of times the acknowledgement deadline has been exceeded
    +   * NACKs and number of times the acknowledgment deadline has been exceeded
        * for the message).
    +   *
        * A NACK is any call to ModifyAckDeadline with a 0 deadline. Note that
        * client libraries may automatically extend ack_deadlines.
    +   *
        * This field will be honored on a best effort basis.
    +   *
        * If this parameter is 0, a default value of 5 is used.
        * 
    * - * int32 max_delivery_attempts = 2; + * int32 max_delivery_attempts = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The maxDeliveryAttempts. */ diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeleteSchemaRequest.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeleteSchemaRequest.java index b09de9b8e..12f52ffd1 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeleteSchemaRequest.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeleteSchemaRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/schema.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; @@ -27,13 +29,25 @@ * * Protobuf type {@code google.pubsub.v1.DeleteSchemaRequest} */ -public final class DeleteSchemaRequest extends com.google.protobuf.GeneratedMessageV3 +@com.google.protobuf.Generated +public final class DeleteSchemaRequest extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:google.pubsub.v1.DeleteSchemaRequest) DeleteSchemaRequestOrBuilder { private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "DeleteSchemaRequest"); + } + // Use DeleteSchemaRequest.newBuilder() to construct. - private DeleteSchemaRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + private DeleteSchemaRequest(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); } @@ -41,68 +55,13 @@ private DeleteSchemaRequest() { name_ = ""; } - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new DeleteSchemaRequest(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - private DeleteSchemaRequest( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - java.lang.String s = input.readStringRequireUtf8(); - - name_ = s; - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.pubsub.v1.SchemaProto .internal_static_google_pubsub_v1_DeleteSchemaRequest_descriptor; } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.SchemaProto .internal_static_google_pubsub_v1_DeleteSchemaRequest_fieldAccessorTable @@ -112,7 +71,10 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } public static final int NAME_FIELD_NUMBER = 1; - private volatile java.lang.Object name_; + + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; + /** * * @@ -139,6 +101,7 @@ public java.lang.String getName() { return s; } } + /** * * @@ -180,10 +143,10 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!getNameBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, name_); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -192,10 +155,10 @@ public int getSerializedSize() { if (size != -1) return size; size = 0; - if (!getNameBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, name_); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -211,7 +174,7 @@ public boolean equals(final java.lang.Object obj) { com.google.pubsub.v1.DeleteSchemaRequest other = (com.google.pubsub.v1.DeleteSchemaRequest) obj; if (!getName().equals(other.getName())) return false; - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -224,7 +187,7 @@ public int hashCode() { hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + NAME_FIELD_NUMBER; hash = (53 * hash) + getName().hashCode(); - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -266,38 +229,38 @@ public static com.google.pubsub.v1.DeleteSchemaRequest parseFrom( public static com.google.pubsub.v1.DeleteSchemaRequest parseFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.DeleteSchemaRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.DeleteSchemaRequest parseDelimitedFrom( java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); } public static com.google.pubsub.v1.DeleteSchemaRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.DeleteSchemaRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.DeleteSchemaRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } @@ -320,10 +283,11 @@ public Builder toBuilder() { } @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** * * @@ -333,7 +297,7 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build * * Protobuf type {@code google.pubsub.v1.DeleteSchemaRequest} */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements // @@protoc_insertion_point(builder_implements:google.pubsub.v1.DeleteSchemaRequest) com.google.pubsub.v1.DeleteSchemaRequestOrBuilder { @@ -343,7 +307,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.SchemaProto .internal_static_google_pubsub_v1_DeleteSchemaRequest_fieldAccessorTable @@ -353,24 +317,17 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } // Construct using com.google.pubsub.v1.DeleteSchemaRequest.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } + private Builder() {} - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} } @java.lang.Override public Builder clear() { super.clear(); + bitField0_ = 0; name_ = ""; - return this; } @@ -398,42 +355,18 @@ public com.google.pubsub.v1.DeleteSchemaRequest build() { public com.google.pubsub.v1.DeleteSchemaRequest buildPartial() { com.google.pubsub.v1.DeleteSchemaRequest result = new com.google.pubsub.v1.DeleteSchemaRequest(this); - result.name_ = name_; + if (bitField0_ != 0) { + buildPartial0(result); + } onBuilt(); return result; } - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); + private void buildPartial0(com.google.pubsub.v1.DeleteSchemaRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.name_ = name_; + } } @java.lang.Override @@ -450,9 +383,10 @@ public Builder mergeFrom(com.google.pubsub.v1.DeleteSchemaRequest other) { if (other == com.google.pubsub.v1.DeleteSchemaRequest.getDefaultInstance()) return this; if (!other.getName().isEmpty()) { name_ = other.name_; + bitField0_ |= 0x00000001; onChanged(); } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -467,21 +401,44 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.pubsub.v1.DeleteSchemaRequest parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + name_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.google.pubsub.v1.DeleteSchemaRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } + private int bitField0_; + private java.lang.Object name_ = ""; + /** * * @@ -507,6 +464,7 @@ public java.lang.String getName() { return (java.lang.String) ref; } } + /** * * @@ -532,6 +490,7 @@ public com.google.protobuf.ByteString getNameBytes() { return (com.google.protobuf.ByteString) ref; } } + /** * * @@ -551,11 +510,12 @@ public Builder setName(java.lang.String value) { if (value == null) { throw new NullPointerException(); } - name_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } + /** * * @@ -571,11 +531,12 @@ public Builder setName(java.lang.String value) { * @return This builder for chaining. */ public Builder clearName() { - name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000001); onChanged(); return this; } + /** * * @@ -596,23 +557,12 @@ public Builder setNameBytes(com.google.protobuf.ByteString value) { throw new NullPointerException(); } checkByteStringIsUtf8(value); - name_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - // @@protoc_insertion_point(builder_scope:google.pubsub.v1.DeleteSchemaRequest) } @@ -634,7 +584,18 @@ public DeleteSchemaRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new DeleteSchemaRequest(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeleteSchemaRequestOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeleteSchemaRequestOrBuilder.java index 5b4e5d304..0d665ae9d 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeleteSchemaRequestOrBuilder.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeleteSchemaRequestOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/schema.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; +@com.google.protobuf.Generated public interface DeleteSchemaRequestOrBuilder extends // @@protoc_insertion_point(interface_extends:google.pubsub.v1.DeleteSchemaRequest) @@ -38,6 +41,7 @@ public interface DeleteSchemaRequestOrBuilder * @return The name. */ java.lang.String getName(); + /** * * diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeleteSchemaRevisionRequest.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeleteSchemaRevisionRequest.java new file mode 100644 index 000000000..5065b30b9 --- /dev/null +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeleteSchemaRevisionRequest.java @@ -0,0 +1,862 @@ +/* + * Copyright 2026 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: google/pubsub/v1/schema.proto +// Protobuf Java Version: 4.33.2 + +package com.google.pubsub.v1; + +/** + * + * + *
    + * Request for the `DeleteSchemaRevision` method.
    + * 
    + * + * Protobuf type {@code google.pubsub.v1.DeleteSchemaRevisionRequest} + */ +@com.google.protobuf.Generated +public final class DeleteSchemaRevisionRequest extends com.google.protobuf.GeneratedMessage + implements + // @@protoc_insertion_point(message_implements:google.pubsub.v1.DeleteSchemaRevisionRequest) + DeleteSchemaRevisionRequestOrBuilder { + private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "DeleteSchemaRevisionRequest"); + } + + // Use DeleteSchemaRevisionRequest.newBuilder() to construct. + private DeleteSchemaRevisionRequest(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + + private DeleteSchemaRevisionRequest() { + name_ = ""; + revisionId_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.SchemaProto + .internal_static_google_pubsub_v1_DeleteSchemaRevisionRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.SchemaProto + .internal_static_google_pubsub_v1_DeleteSchemaRevisionRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.DeleteSchemaRevisionRequest.class, + com.google.pubsub.v1.DeleteSchemaRevisionRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; + + /** + * + * + *
    +   * Required. The name of the schema revision to be deleted, with a revision ID
    +   * explicitly included.
    +   *
    +   * Example: `projects/123/schemas/my-schema@c7cfa2a8`
    +   * 
    + * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + + /** + * + * + *
    +   * Required. The name of the schema revision to be deleted, with a revision ID
    +   * explicitly included.
    +   *
    +   * Example: `projects/123/schemas/my-schema@c7cfa2a8`
    +   * 
    + * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int REVISION_ID_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private volatile java.lang.Object revisionId_ = ""; + + /** + * + * + *
    +   * Optional. This field is deprecated and should not be used for specifying
    +   * the revision ID. The revision ID should be specified via the `name`
    +   * parameter.
    +   * 
    + * + * string revision_id = 2 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; + * + * + * @deprecated google.pubsub.v1.DeleteSchemaRevisionRequest.revision_id is deprecated. See + * google/pubsub/v1/schema.proto;l=330 + * @return The revisionId. + */ + @java.lang.Override + @java.lang.Deprecated + public java.lang.String getRevisionId() { + java.lang.Object ref = revisionId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + revisionId_ = s; + return s; + } + } + + /** + * + * + *
    +   * Optional. This field is deprecated and should not be used for specifying
    +   * the revision ID. The revision ID should be specified via the `name`
    +   * parameter.
    +   * 
    + * + * string revision_id = 2 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; + * + * + * @deprecated google.pubsub.v1.DeleteSchemaRevisionRequest.revision_id is deprecated. See + * google/pubsub/v1/schema.proto;l=330 + * @return The bytes for revisionId. + */ + @java.lang.Override + @java.lang.Deprecated + public com.google.protobuf.ByteString getRevisionIdBytes() { + java.lang.Object ref = revisionId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + revisionId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, name_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(revisionId_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, revisionId_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, name_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(revisionId_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, revisionId_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.pubsub.v1.DeleteSchemaRevisionRequest)) { + return super.equals(obj); + } + com.google.pubsub.v1.DeleteSchemaRevisionRequest other = + (com.google.pubsub.v1.DeleteSchemaRevisionRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (!getRevisionId().equals(other.getRevisionId())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + REVISION_ID_FIELD_NUMBER; + hash = (53 * hash) + getRevisionId().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.pubsub.v1.DeleteSchemaRevisionRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.DeleteSchemaRevisionRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.DeleteSchemaRevisionRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.DeleteSchemaRevisionRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.DeleteSchemaRevisionRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.DeleteSchemaRevisionRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.DeleteSchemaRevisionRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.DeleteSchemaRevisionRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.DeleteSchemaRevisionRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.DeleteSchemaRevisionRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.DeleteSchemaRevisionRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.DeleteSchemaRevisionRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.pubsub.v1.DeleteSchemaRevisionRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + + /** + * + * + *
    +   * Request for the `DeleteSchemaRevision` method.
    +   * 
    + * + * Protobuf type {@code google.pubsub.v1.DeleteSchemaRevisionRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder + implements + // @@protoc_insertion_point(builder_implements:google.pubsub.v1.DeleteSchemaRevisionRequest) + com.google.pubsub.v1.DeleteSchemaRevisionRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.SchemaProto + .internal_static_google_pubsub_v1_DeleteSchemaRevisionRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.SchemaProto + .internal_static_google_pubsub_v1_DeleteSchemaRevisionRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.DeleteSchemaRevisionRequest.class, + com.google.pubsub.v1.DeleteSchemaRevisionRequest.Builder.class); + } + + // Construct using com.google.pubsub.v1.DeleteSchemaRevisionRequest.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + name_ = ""; + revisionId_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.pubsub.v1.SchemaProto + .internal_static_google_pubsub_v1_DeleteSchemaRevisionRequest_descriptor; + } + + @java.lang.Override + public com.google.pubsub.v1.DeleteSchemaRevisionRequest getDefaultInstanceForType() { + return com.google.pubsub.v1.DeleteSchemaRevisionRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.pubsub.v1.DeleteSchemaRevisionRequest build() { + com.google.pubsub.v1.DeleteSchemaRevisionRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.pubsub.v1.DeleteSchemaRevisionRequest buildPartial() { + com.google.pubsub.v1.DeleteSchemaRevisionRequest result = + new com.google.pubsub.v1.DeleteSchemaRevisionRequest(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.pubsub.v1.DeleteSchemaRevisionRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.name_ = name_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.revisionId_ = revisionId_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.pubsub.v1.DeleteSchemaRevisionRequest) { + return mergeFrom((com.google.pubsub.v1.DeleteSchemaRevisionRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.pubsub.v1.DeleteSchemaRevisionRequest other) { + if (other == com.google.pubsub.v1.DeleteSchemaRevisionRequest.getDefaultInstance()) + return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getRevisionId().isEmpty()) { + revisionId_ = other.revisionId_; + bitField0_ |= 0x00000002; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + name_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + revisionId_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.lang.Object name_ = ""; + + /** + * + * + *
    +     * Required. The name of the schema revision to be deleted, with a revision ID
    +     * explicitly included.
    +     *
    +     * Example: `projects/123/schemas/my-schema@c7cfa2a8`
    +     * 
    + * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +     * Required. The name of the schema revision to be deleted, with a revision ID
    +     * explicitly included.
    +     *
    +     * Example: `projects/123/schemas/my-schema@c7cfa2a8`
    +     * 
    + * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +     * Required. The name of the schema revision to be deleted, with a revision ID
    +     * explicitly included.
    +     *
    +     * Example: `projects/123/schemas/my-schema@c7cfa2a8`
    +     * 
    + * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Required. The name of the schema revision to be deleted, with a revision ID
    +     * explicitly included.
    +     *
    +     * Example: `projects/123/schemas/my-schema@c7cfa2a8`
    +     * 
    + * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + + /** + * + * + *
    +     * Required. The name of the schema revision to be deleted, with a revision ID
    +     * explicitly included.
    +     *
    +     * Example: `projects/123/schemas/my-schema@c7cfa2a8`
    +     * 
    + * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object revisionId_ = ""; + + /** + * + * + *
    +     * Optional. This field is deprecated and should not be used for specifying
    +     * the revision ID. The revision ID should be specified via the `name`
    +     * parameter.
    +     * 
    + * + * string revision_id = 2 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; + * + * + * @deprecated google.pubsub.v1.DeleteSchemaRevisionRequest.revision_id is deprecated. See + * google/pubsub/v1/schema.proto;l=330 + * @return The revisionId. + */ + @java.lang.Deprecated + public java.lang.String getRevisionId() { + java.lang.Object ref = revisionId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + revisionId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +     * Optional. This field is deprecated and should not be used for specifying
    +     * the revision ID. The revision ID should be specified via the `name`
    +     * parameter.
    +     * 
    + * + * string revision_id = 2 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; + * + * + * @deprecated google.pubsub.v1.DeleteSchemaRevisionRequest.revision_id is deprecated. See + * google/pubsub/v1/schema.proto;l=330 + * @return The bytes for revisionId. + */ + @java.lang.Deprecated + public com.google.protobuf.ByteString getRevisionIdBytes() { + java.lang.Object ref = revisionId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + revisionId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +     * Optional. This field is deprecated and should not be used for specifying
    +     * the revision ID. The revision ID should be specified via the `name`
    +     * parameter.
    +     * 
    + * + * string revision_id = 2 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; + * + * + * @deprecated google.pubsub.v1.DeleteSchemaRevisionRequest.revision_id is deprecated. See + * google/pubsub/v1/schema.proto;l=330 + * @param value The revisionId to set. + * @return This builder for chaining. + */ + @java.lang.Deprecated + public Builder setRevisionId(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + revisionId_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Optional. This field is deprecated and should not be used for specifying
    +     * the revision ID. The revision ID should be specified via the `name`
    +     * parameter.
    +     * 
    + * + * string revision_id = 2 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; + * + * + * @deprecated google.pubsub.v1.DeleteSchemaRevisionRequest.revision_id is deprecated. See + * google/pubsub/v1/schema.proto;l=330 + * @return This builder for chaining. + */ + @java.lang.Deprecated + public Builder clearRevisionId() { + revisionId_ = getDefaultInstance().getRevisionId(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + + /** + * + * + *
    +     * Optional. This field is deprecated and should not be used for specifying
    +     * the revision ID. The revision ID should be specified via the `name`
    +     * parameter.
    +     * 
    + * + * string revision_id = 2 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; + * + * + * @deprecated google.pubsub.v1.DeleteSchemaRevisionRequest.revision_id is deprecated. See + * google/pubsub/v1/schema.proto;l=330 + * @param value The bytes for revisionId to set. + * @return This builder for chaining. + */ + @java.lang.Deprecated + public Builder setRevisionIdBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + revisionId_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:google.pubsub.v1.DeleteSchemaRevisionRequest) + } + + // @@protoc_insertion_point(class_scope:google.pubsub.v1.DeleteSchemaRevisionRequest) + private static final com.google.pubsub.v1.DeleteSchemaRevisionRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.pubsub.v1.DeleteSchemaRevisionRequest(); + } + + public static com.google.pubsub.v1.DeleteSchemaRevisionRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public DeleteSchemaRevisionRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.pubsub.v1.DeleteSchemaRevisionRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeleteSchemaRevisionRequestOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeleteSchemaRevisionRequestOrBuilder.java new file mode 100644 index 000000000..a116ea05e --- /dev/null +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeleteSchemaRevisionRequestOrBuilder.java @@ -0,0 +1,102 @@ +/* + * Copyright 2026 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: google/pubsub/v1/schema.proto +// Protobuf Java Version: 4.33.2 + +package com.google.pubsub.v1; + +@com.google.protobuf.Generated +public interface DeleteSchemaRevisionRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.pubsub.v1.DeleteSchemaRevisionRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
    +   * Required. The name of the schema revision to be deleted, with a revision ID
    +   * explicitly included.
    +   *
    +   * Example: `projects/123/schemas/my-schema@c7cfa2a8`
    +   * 
    + * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + + /** + * + * + *
    +   * Required. The name of the schema revision to be deleted, with a revision ID
    +   * explicitly included.
    +   *
    +   * Example: `projects/123/schemas/my-schema@c7cfa2a8`
    +   * 
    + * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
    +   * Optional. This field is deprecated and should not be used for specifying
    +   * the revision ID. The revision ID should be specified via the `name`
    +   * parameter.
    +   * 
    + * + * string revision_id = 2 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; + * + * + * @deprecated google.pubsub.v1.DeleteSchemaRevisionRequest.revision_id is deprecated. See + * google/pubsub/v1/schema.proto;l=330 + * @return The revisionId. + */ + @java.lang.Deprecated + java.lang.String getRevisionId(); + + /** + * + * + *
    +   * Optional. This field is deprecated and should not be used for specifying
    +   * the revision ID. The revision ID should be specified via the `name`
    +   * parameter.
    +   * 
    + * + * string revision_id = 2 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; + * + * + * @deprecated google.pubsub.v1.DeleteSchemaRevisionRequest.revision_id is deprecated. See + * google/pubsub/v1/schema.proto;l=330 + * @return The bytes for revisionId. + */ + @java.lang.Deprecated + com.google.protobuf.ByteString getRevisionIdBytes(); +} diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeleteSnapshotRequest.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeleteSnapshotRequest.java index d43936019..4fd129540 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeleteSnapshotRequest.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeleteSnapshotRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; @@ -27,13 +29,25 @@ * * Protobuf type {@code google.pubsub.v1.DeleteSnapshotRequest} */ -public final class DeleteSnapshotRequest extends com.google.protobuf.GeneratedMessageV3 +@com.google.protobuf.Generated +public final class DeleteSnapshotRequest extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:google.pubsub.v1.DeleteSnapshotRequest) DeleteSnapshotRequestOrBuilder { private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "DeleteSnapshotRequest"); + } + // Use DeleteSnapshotRequest.newBuilder() to construct. - private DeleteSnapshotRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + private DeleteSnapshotRequest(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); } @@ -41,68 +55,13 @@ private DeleteSnapshotRequest() { snapshot_ = ""; } - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new DeleteSnapshotRequest(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - private DeleteSnapshotRequest( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - java.lang.String s = input.readStringRequireUtf8(); - - snapshot_ = s; - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_DeleteSnapshotRequest_descriptor; } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_DeleteSnapshotRequest_fieldAccessorTable @@ -112,7 +71,10 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } public static final int SNAPSHOT_FIELD_NUMBER = 1; - private volatile java.lang.Object snapshot_; + + @SuppressWarnings("serial") + private volatile java.lang.Object snapshot_ = ""; + /** * * @@ -139,6 +101,7 @@ public java.lang.String getSnapshot() { return s; } } + /** * * @@ -180,10 +143,10 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!getSnapshotBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, snapshot_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(snapshot_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, snapshot_); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -192,10 +155,10 @@ public int getSerializedSize() { if (size != -1) return size; size = 0; - if (!getSnapshotBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, snapshot_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(snapshot_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, snapshot_); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -212,7 +175,7 @@ public boolean equals(final java.lang.Object obj) { (com.google.pubsub.v1.DeleteSnapshotRequest) obj; if (!getSnapshot().equals(other.getSnapshot())) return false; - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -225,7 +188,7 @@ public int hashCode() { hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + SNAPSHOT_FIELD_NUMBER; hash = (53 * hash) + getSnapshot().hashCode(); - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -267,38 +230,38 @@ public static com.google.pubsub.v1.DeleteSnapshotRequest parseFrom( public static com.google.pubsub.v1.DeleteSnapshotRequest parseFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.DeleteSnapshotRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.DeleteSnapshotRequest parseDelimitedFrom( java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); } public static com.google.pubsub.v1.DeleteSnapshotRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.DeleteSnapshotRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.DeleteSnapshotRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } @@ -321,10 +284,11 @@ public Builder toBuilder() { } @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** * * @@ -334,7 +298,7 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build * * Protobuf type {@code google.pubsub.v1.DeleteSnapshotRequest} */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements // @@protoc_insertion_point(builder_implements:google.pubsub.v1.DeleteSnapshotRequest) com.google.pubsub.v1.DeleteSnapshotRequestOrBuilder { @@ -344,7 +308,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_DeleteSnapshotRequest_fieldAccessorTable @@ -354,24 +318,17 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } // Construct using com.google.pubsub.v1.DeleteSnapshotRequest.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } + private Builder() {} - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} } @java.lang.Override public Builder clear() { super.clear(); + bitField0_ = 0; snapshot_ = ""; - return this; } @@ -399,42 +356,18 @@ public com.google.pubsub.v1.DeleteSnapshotRequest build() { public com.google.pubsub.v1.DeleteSnapshotRequest buildPartial() { com.google.pubsub.v1.DeleteSnapshotRequest result = new com.google.pubsub.v1.DeleteSnapshotRequest(this); - result.snapshot_ = snapshot_; + if (bitField0_ != 0) { + buildPartial0(result); + } onBuilt(); return result; } - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); + private void buildPartial0(com.google.pubsub.v1.DeleteSnapshotRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.snapshot_ = snapshot_; + } } @java.lang.Override @@ -451,9 +384,10 @@ public Builder mergeFrom(com.google.pubsub.v1.DeleteSnapshotRequest other) { if (other == com.google.pubsub.v1.DeleteSnapshotRequest.getDefaultInstance()) return this; if (!other.getSnapshot().isEmpty()) { snapshot_ = other.snapshot_; + bitField0_ |= 0x00000001; onChanged(); } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -468,21 +402,44 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.pubsub.v1.DeleteSnapshotRequest parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + snapshot_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.google.pubsub.v1.DeleteSnapshotRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } + private int bitField0_; + private java.lang.Object snapshot_ = ""; + /** * * @@ -508,6 +465,7 @@ public java.lang.String getSnapshot() { return (java.lang.String) ref; } } + /** * * @@ -533,6 +491,7 @@ public com.google.protobuf.ByteString getSnapshotBytes() { return (com.google.protobuf.ByteString) ref; } } + /** * * @@ -552,11 +511,12 @@ public Builder setSnapshot(java.lang.String value) { if (value == null) { throw new NullPointerException(); } - snapshot_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } + /** * * @@ -572,11 +532,12 @@ public Builder setSnapshot(java.lang.String value) { * @return This builder for chaining. */ public Builder clearSnapshot() { - snapshot_ = getDefaultInstance().getSnapshot(); + bitField0_ = (bitField0_ & ~0x00000001); onChanged(); return this; } + /** * * @@ -597,23 +558,12 @@ public Builder setSnapshotBytes(com.google.protobuf.ByteString value) { throw new NullPointerException(); } checkByteStringIsUtf8(value); - snapshot_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - // @@protoc_insertion_point(builder_scope:google.pubsub.v1.DeleteSnapshotRequest) } @@ -635,7 +585,18 @@ public DeleteSnapshotRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new DeleteSnapshotRequest(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeleteSnapshotRequestOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeleteSnapshotRequestOrBuilder.java index 43c455746..aa0db9d68 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeleteSnapshotRequestOrBuilder.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeleteSnapshotRequestOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; +@com.google.protobuf.Generated public interface DeleteSnapshotRequestOrBuilder extends // @@protoc_insertion_point(interface_extends:google.pubsub.v1.DeleteSnapshotRequest) @@ -38,6 +41,7 @@ public interface DeleteSnapshotRequestOrBuilder * @return The snapshot. */ java.lang.String getSnapshot(); + /** * * diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeleteSubscriptionRequest.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeleteSubscriptionRequest.java index 82bd05b37..0b55f9447 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeleteSubscriptionRequest.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeleteSubscriptionRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; @@ -27,13 +29,25 @@ * * Protobuf type {@code google.pubsub.v1.DeleteSubscriptionRequest} */ -public final class DeleteSubscriptionRequest extends com.google.protobuf.GeneratedMessageV3 +@com.google.protobuf.Generated +public final class DeleteSubscriptionRequest extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:google.pubsub.v1.DeleteSubscriptionRequest) DeleteSubscriptionRequestOrBuilder { private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "DeleteSubscriptionRequest"); + } + // Use DeleteSubscriptionRequest.newBuilder() to construct. - private DeleteSubscriptionRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + private DeleteSubscriptionRequest(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); } @@ -41,68 +55,13 @@ private DeleteSubscriptionRequest() { subscription_ = ""; } - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new DeleteSubscriptionRequest(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - private DeleteSubscriptionRequest( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - java.lang.String s = input.readStringRequireUtf8(); - - subscription_ = s; - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_DeleteSubscriptionRequest_descriptor; } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_DeleteSubscriptionRequest_fieldAccessorTable @@ -112,7 +71,10 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } public static final int SUBSCRIPTION_FIELD_NUMBER = 1; - private volatile java.lang.Object subscription_; + + @SuppressWarnings("serial") + private volatile java.lang.Object subscription_ = ""; + /** * * @@ -139,6 +101,7 @@ public java.lang.String getSubscription() { return s; } } + /** * * @@ -180,10 +143,10 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!getSubscriptionBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, subscription_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(subscription_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, subscription_); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -192,10 +155,10 @@ public int getSerializedSize() { if (size != -1) return size; size = 0; - if (!getSubscriptionBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, subscription_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(subscription_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, subscription_); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -212,7 +175,7 @@ public boolean equals(final java.lang.Object obj) { (com.google.pubsub.v1.DeleteSubscriptionRequest) obj; if (!getSubscription().equals(other.getSubscription())) return false; - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -225,7 +188,7 @@ public int hashCode() { hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + SUBSCRIPTION_FIELD_NUMBER; hash = (53 * hash) + getSubscription().hashCode(); - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -267,38 +230,38 @@ public static com.google.pubsub.v1.DeleteSubscriptionRequest parseFrom( public static com.google.pubsub.v1.DeleteSubscriptionRequest parseFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.DeleteSubscriptionRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.DeleteSubscriptionRequest parseDelimitedFrom( java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); } public static com.google.pubsub.v1.DeleteSubscriptionRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.DeleteSubscriptionRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.DeleteSubscriptionRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } @@ -321,10 +284,11 @@ public Builder toBuilder() { } @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** * * @@ -334,7 +298,7 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build * * Protobuf type {@code google.pubsub.v1.DeleteSubscriptionRequest} */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements // @@protoc_insertion_point(builder_implements:google.pubsub.v1.DeleteSubscriptionRequest) com.google.pubsub.v1.DeleteSubscriptionRequestOrBuilder { @@ -344,7 +308,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_DeleteSubscriptionRequest_fieldAccessorTable @@ -354,24 +318,17 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } // Construct using com.google.pubsub.v1.DeleteSubscriptionRequest.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } + private Builder() {} - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} } @java.lang.Override public Builder clear() { super.clear(); + bitField0_ = 0; subscription_ = ""; - return this; } @@ -399,42 +356,18 @@ public com.google.pubsub.v1.DeleteSubscriptionRequest build() { public com.google.pubsub.v1.DeleteSubscriptionRequest buildPartial() { com.google.pubsub.v1.DeleteSubscriptionRequest result = new com.google.pubsub.v1.DeleteSubscriptionRequest(this); - result.subscription_ = subscription_; + if (bitField0_ != 0) { + buildPartial0(result); + } onBuilt(); return result; } - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); + private void buildPartial0(com.google.pubsub.v1.DeleteSubscriptionRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.subscription_ = subscription_; + } } @java.lang.Override @@ -451,9 +384,10 @@ public Builder mergeFrom(com.google.pubsub.v1.DeleteSubscriptionRequest other) { if (other == com.google.pubsub.v1.DeleteSubscriptionRequest.getDefaultInstance()) return this; if (!other.getSubscription().isEmpty()) { subscription_ = other.subscription_; + bitField0_ |= 0x00000001; onChanged(); } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -468,21 +402,44 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.pubsub.v1.DeleteSubscriptionRequest parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + subscription_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.google.pubsub.v1.DeleteSubscriptionRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } + private int bitField0_; + private java.lang.Object subscription_ = ""; + /** * * @@ -508,6 +465,7 @@ public java.lang.String getSubscription() { return (java.lang.String) ref; } } + /** * * @@ -533,6 +491,7 @@ public com.google.protobuf.ByteString getSubscriptionBytes() { return (com.google.protobuf.ByteString) ref; } } + /** * * @@ -552,11 +511,12 @@ public Builder setSubscription(java.lang.String value) { if (value == null) { throw new NullPointerException(); } - subscription_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } + /** * * @@ -572,11 +532,12 @@ public Builder setSubscription(java.lang.String value) { * @return This builder for chaining. */ public Builder clearSubscription() { - subscription_ = getDefaultInstance().getSubscription(); + bitField0_ = (bitField0_ & ~0x00000001); onChanged(); return this; } + /** * * @@ -597,23 +558,12 @@ public Builder setSubscriptionBytes(com.google.protobuf.ByteString value) { throw new NullPointerException(); } checkByteStringIsUtf8(value); - subscription_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - // @@protoc_insertion_point(builder_scope:google.pubsub.v1.DeleteSubscriptionRequest) } @@ -635,7 +585,18 @@ public DeleteSubscriptionRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new DeleteSubscriptionRequest(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeleteSubscriptionRequestOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeleteSubscriptionRequestOrBuilder.java index d48320804..407ff8133 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeleteSubscriptionRequestOrBuilder.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeleteSubscriptionRequestOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; +@com.google.protobuf.Generated public interface DeleteSubscriptionRequestOrBuilder extends // @@protoc_insertion_point(interface_extends:google.pubsub.v1.DeleteSubscriptionRequest) @@ -38,6 +41,7 @@ public interface DeleteSubscriptionRequestOrBuilder * @return The subscription. */ java.lang.String getSubscription(); + /** * * diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeleteTopicRequest.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeleteTopicRequest.java index 68db7a957..2d2b37801 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeleteTopicRequest.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeleteTopicRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; @@ -27,13 +29,25 @@ * * Protobuf type {@code google.pubsub.v1.DeleteTopicRequest} */ -public final class DeleteTopicRequest extends com.google.protobuf.GeneratedMessageV3 +@com.google.protobuf.Generated +public final class DeleteTopicRequest extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:google.pubsub.v1.DeleteTopicRequest) DeleteTopicRequestOrBuilder { private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "DeleteTopicRequest"); + } + // Use DeleteTopicRequest.newBuilder() to construct. - private DeleteTopicRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + private DeleteTopicRequest(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); } @@ -41,68 +55,13 @@ private DeleteTopicRequest() { topic_ = ""; } - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new DeleteTopicRequest(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - private DeleteTopicRequest( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - java.lang.String s = input.readStringRequireUtf8(); - - topic_ = s; - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_DeleteTopicRequest_descriptor; } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_DeleteTopicRequest_fieldAccessorTable @@ -112,7 +71,10 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } public static final int TOPIC_FIELD_NUMBER = 1; - private volatile java.lang.Object topic_; + + @SuppressWarnings("serial") + private volatile java.lang.Object topic_ = ""; + /** * * @@ -139,6 +101,7 @@ public java.lang.String getTopic() { return s; } } + /** * * @@ -180,10 +143,10 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!getTopicBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, topic_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(topic_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, topic_); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -192,10 +155,10 @@ public int getSerializedSize() { if (size != -1) return size; size = 0; - if (!getTopicBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, topic_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(topic_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, topic_); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -211,7 +174,7 @@ public boolean equals(final java.lang.Object obj) { com.google.pubsub.v1.DeleteTopicRequest other = (com.google.pubsub.v1.DeleteTopicRequest) obj; if (!getTopic().equals(other.getTopic())) return false; - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -224,7 +187,7 @@ public int hashCode() { hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + TOPIC_FIELD_NUMBER; hash = (53 * hash) + getTopic().hashCode(); - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -266,38 +229,38 @@ public static com.google.pubsub.v1.DeleteTopicRequest parseFrom( public static com.google.pubsub.v1.DeleteTopicRequest parseFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.DeleteTopicRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.DeleteTopicRequest parseDelimitedFrom( java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); } public static com.google.pubsub.v1.DeleteTopicRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.DeleteTopicRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.DeleteTopicRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } @@ -320,10 +283,11 @@ public Builder toBuilder() { } @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** * * @@ -333,7 +297,7 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build * * Protobuf type {@code google.pubsub.v1.DeleteTopicRequest} */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements // @@protoc_insertion_point(builder_implements:google.pubsub.v1.DeleteTopicRequest) com.google.pubsub.v1.DeleteTopicRequestOrBuilder { @@ -343,7 +307,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_DeleteTopicRequest_fieldAccessorTable @@ -353,24 +317,17 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } // Construct using com.google.pubsub.v1.DeleteTopicRequest.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } + private Builder() {} - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} } @java.lang.Override public Builder clear() { super.clear(); + bitField0_ = 0; topic_ = ""; - return this; } @@ -398,42 +355,18 @@ public com.google.pubsub.v1.DeleteTopicRequest build() { public com.google.pubsub.v1.DeleteTopicRequest buildPartial() { com.google.pubsub.v1.DeleteTopicRequest result = new com.google.pubsub.v1.DeleteTopicRequest(this); - result.topic_ = topic_; + if (bitField0_ != 0) { + buildPartial0(result); + } onBuilt(); return result; } - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); + private void buildPartial0(com.google.pubsub.v1.DeleteTopicRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.topic_ = topic_; + } } @java.lang.Override @@ -450,9 +383,10 @@ public Builder mergeFrom(com.google.pubsub.v1.DeleteTopicRequest other) { if (other == com.google.pubsub.v1.DeleteTopicRequest.getDefaultInstance()) return this; if (!other.getTopic().isEmpty()) { topic_ = other.topic_; + bitField0_ |= 0x00000001; onChanged(); } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -467,21 +401,44 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.pubsub.v1.DeleteTopicRequest parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + topic_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.google.pubsub.v1.DeleteTopicRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } + private int bitField0_; + private java.lang.Object topic_ = ""; + /** * * @@ -507,6 +464,7 @@ public java.lang.String getTopic() { return (java.lang.String) ref; } } + /** * * @@ -532,6 +490,7 @@ public com.google.protobuf.ByteString getTopicBytes() { return (com.google.protobuf.ByteString) ref; } } + /** * * @@ -551,11 +510,12 @@ public Builder setTopic(java.lang.String value) { if (value == null) { throw new NullPointerException(); } - topic_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } + /** * * @@ -571,11 +531,12 @@ public Builder setTopic(java.lang.String value) { * @return This builder for chaining. */ public Builder clearTopic() { - topic_ = getDefaultInstance().getTopic(); + bitField0_ = (bitField0_ & ~0x00000001); onChanged(); return this; } + /** * * @@ -596,23 +557,12 @@ public Builder setTopicBytes(com.google.protobuf.ByteString value) { throw new NullPointerException(); } checkByteStringIsUtf8(value); - topic_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - // @@protoc_insertion_point(builder_scope:google.pubsub.v1.DeleteTopicRequest) } @@ -634,7 +584,18 @@ public DeleteTopicRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new DeleteTopicRequest(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeleteTopicRequestOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeleteTopicRequestOrBuilder.java index a7267ded0..ba2de1ac4 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeleteTopicRequestOrBuilder.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeleteTopicRequestOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; +@com.google.protobuf.Generated public interface DeleteTopicRequestOrBuilder extends // @@protoc_insertion_point(interface_extends:google.pubsub.v1.DeleteTopicRequest) @@ -38,6 +41,7 @@ public interface DeleteTopicRequestOrBuilder * @return The topic. */ java.lang.String getTopic(); + /** * * diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DetachSubscriptionRequest.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DetachSubscriptionRequest.java index 6b738acfa..074171a8e 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DetachSubscriptionRequest.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DetachSubscriptionRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; @@ -27,13 +29,25 @@ * * Protobuf type {@code google.pubsub.v1.DetachSubscriptionRequest} */ -public final class DetachSubscriptionRequest extends com.google.protobuf.GeneratedMessageV3 +@com.google.protobuf.Generated +public final class DetachSubscriptionRequest extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:google.pubsub.v1.DetachSubscriptionRequest) DetachSubscriptionRequestOrBuilder { private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "DetachSubscriptionRequest"); + } + // Use DetachSubscriptionRequest.newBuilder() to construct. - private DetachSubscriptionRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + private DetachSubscriptionRequest(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); } @@ -41,68 +55,13 @@ private DetachSubscriptionRequest() { subscription_ = ""; } - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new DetachSubscriptionRequest(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - private DetachSubscriptionRequest( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - java.lang.String s = input.readStringRequireUtf8(); - - subscription_ = s; - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_DetachSubscriptionRequest_descriptor; } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_DetachSubscriptionRequest_fieldAccessorTable @@ -112,7 +71,10 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } public static final int SUBSCRIPTION_FIELD_NUMBER = 1; - private volatile java.lang.Object subscription_; + + @SuppressWarnings("serial") + private volatile java.lang.Object subscription_ = ""; + /** * * @@ -139,6 +101,7 @@ public java.lang.String getSubscription() { return s; } } + /** * * @@ -180,10 +143,10 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!getSubscriptionBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, subscription_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(subscription_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, subscription_); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -192,10 +155,10 @@ public int getSerializedSize() { if (size != -1) return size; size = 0; - if (!getSubscriptionBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, subscription_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(subscription_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, subscription_); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -212,7 +175,7 @@ public boolean equals(final java.lang.Object obj) { (com.google.pubsub.v1.DetachSubscriptionRequest) obj; if (!getSubscription().equals(other.getSubscription())) return false; - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -225,7 +188,7 @@ public int hashCode() { hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + SUBSCRIPTION_FIELD_NUMBER; hash = (53 * hash) + getSubscription().hashCode(); - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -267,38 +230,38 @@ public static com.google.pubsub.v1.DetachSubscriptionRequest parseFrom( public static com.google.pubsub.v1.DetachSubscriptionRequest parseFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.DetachSubscriptionRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.DetachSubscriptionRequest parseDelimitedFrom( java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); } public static com.google.pubsub.v1.DetachSubscriptionRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.DetachSubscriptionRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.DetachSubscriptionRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } @@ -321,10 +284,11 @@ public Builder toBuilder() { } @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** * * @@ -334,7 +298,7 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build * * Protobuf type {@code google.pubsub.v1.DetachSubscriptionRequest} */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements // @@protoc_insertion_point(builder_implements:google.pubsub.v1.DetachSubscriptionRequest) com.google.pubsub.v1.DetachSubscriptionRequestOrBuilder { @@ -344,7 +308,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_DetachSubscriptionRequest_fieldAccessorTable @@ -354,24 +318,17 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } // Construct using com.google.pubsub.v1.DetachSubscriptionRequest.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } + private Builder() {} - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} } @java.lang.Override public Builder clear() { super.clear(); + bitField0_ = 0; subscription_ = ""; - return this; } @@ -399,42 +356,18 @@ public com.google.pubsub.v1.DetachSubscriptionRequest build() { public com.google.pubsub.v1.DetachSubscriptionRequest buildPartial() { com.google.pubsub.v1.DetachSubscriptionRequest result = new com.google.pubsub.v1.DetachSubscriptionRequest(this); - result.subscription_ = subscription_; + if (bitField0_ != 0) { + buildPartial0(result); + } onBuilt(); return result; } - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); + private void buildPartial0(com.google.pubsub.v1.DetachSubscriptionRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.subscription_ = subscription_; + } } @java.lang.Override @@ -451,9 +384,10 @@ public Builder mergeFrom(com.google.pubsub.v1.DetachSubscriptionRequest other) { if (other == com.google.pubsub.v1.DetachSubscriptionRequest.getDefaultInstance()) return this; if (!other.getSubscription().isEmpty()) { subscription_ = other.subscription_; + bitField0_ |= 0x00000001; onChanged(); } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -468,21 +402,44 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.pubsub.v1.DetachSubscriptionRequest parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + subscription_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.google.pubsub.v1.DetachSubscriptionRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } + private int bitField0_; + private java.lang.Object subscription_ = ""; + /** * * @@ -508,6 +465,7 @@ public java.lang.String getSubscription() { return (java.lang.String) ref; } } + /** * * @@ -533,6 +491,7 @@ public com.google.protobuf.ByteString getSubscriptionBytes() { return (com.google.protobuf.ByteString) ref; } } + /** * * @@ -552,11 +511,12 @@ public Builder setSubscription(java.lang.String value) { if (value == null) { throw new NullPointerException(); } - subscription_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } + /** * * @@ -572,11 +532,12 @@ public Builder setSubscription(java.lang.String value) { * @return This builder for chaining. */ public Builder clearSubscription() { - subscription_ = getDefaultInstance().getSubscription(); + bitField0_ = (bitField0_ & ~0x00000001); onChanged(); return this; } + /** * * @@ -597,23 +558,12 @@ public Builder setSubscriptionBytes(com.google.protobuf.ByteString value) { throw new NullPointerException(); } checkByteStringIsUtf8(value); - subscription_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - // @@protoc_insertion_point(builder_scope:google.pubsub.v1.DetachSubscriptionRequest) } @@ -635,7 +585,18 @@ public DetachSubscriptionRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new DetachSubscriptionRequest(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DetachSubscriptionRequestOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DetachSubscriptionRequestOrBuilder.java index 27cd842bc..2980352a4 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DetachSubscriptionRequestOrBuilder.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DetachSubscriptionRequestOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; +@com.google.protobuf.Generated public interface DetachSubscriptionRequestOrBuilder extends // @@protoc_insertion_point(interface_extends:google.pubsub.v1.DetachSubscriptionRequest) @@ -38,6 +41,7 @@ public interface DetachSubscriptionRequestOrBuilder * @return The subscription. */ java.lang.String getSubscription(); + /** * * diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DetachSubscriptionResponse.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DetachSubscriptionResponse.java index a473832a2..6cc5449ec 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DetachSubscriptionResponse.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DetachSubscriptionResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; @@ -28,65 +30,29 @@ * * Protobuf type {@code google.pubsub.v1.DetachSubscriptionResponse} */ -public final class DetachSubscriptionResponse extends com.google.protobuf.GeneratedMessageV3 +@com.google.protobuf.Generated +public final class DetachSubscriptionResponse extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:google.pubsub.v1.DetachSubscriptionResponse) DetachSubscriptionResponseOrBuilder { private static final long serialVersionUID = 0L; - // Use DetachSubscriptionResponse.newBuilder() to construct. - private DetachSubscriptionResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - private DetachSubscriptionResponse() {} - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new DetachSubscriptionResponse(); + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "DetachSubscriptionResponse"); } - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; + // Use DetachSubscriptionResponse.newBuilder() to construct. + private DetachSubscriptionResponse(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); } - private DetachSubscriptionResponse( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } + private DetachSubscriptionResponse() {} public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.pubsub.v1.PubsubProto @@ -94,7 +60,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_DetachSubscriptionResponse_fieldAccessorTable @@ -117,7 +83,7 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -126,7 +92,7 @@ public int getSerializedSize() { if (size != -1) return size; size = 0; - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -142,7 +108,7 @@ public boolean equals(final java.lang.Object obj) { com.google.pubsub.v1.DetachSubscriptionResponse other = (com.google.pubsub.v1.DetachSubscriptionResponse) obj; - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -153,7 +119,7 @@ public int hashCode() { } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -195,38 +161,38 @@ public static com.google.pubsub.v1.DetachSubscriptionResponse parseFrom( public static com.google.pubsub.v1.DetachSubscriptionResponse parseFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.DetachSubscriptionResponse parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.DetachSubscriptionResponse parseDelimitedFrom( java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); } public static com.google.pubsub.v1.DetachSubscriptionResponse parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.DetachSubscriptionResponse parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.DetachSubscriptionResponse parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } @@ -249,10 +215,11 @@ public Builder toBuilder() { } @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** * * @@ -263,7 +230,7 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build * * Protobuf type {@code google.pubsub.v1.DetachSubscriptionResponse} */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements // @@protoc_insertion_point(builder_implements:google.pubsub.v1.DetachSubscriptionResponse) com.google.pubsub.v1.DetachSubscriptionResponseOrBuilder { @@ -273,7 +240,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_DetachSubscriptionResponse_fieldAccessorTable @@ -283,17 +250,10 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } // Construct using com.google.pubsub.v1.DetachSubscriptionResponse.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } + private Builder() {} - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} } @java.lang.Override @@ -330,39 +290,6 @@ public com.google.pubsub.v1.DetachSubscriptionResponse buildPartial() { return result; } - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); - } - @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.google.pubsub.v1.DetachSubscriptionResponse) { @@ -376,7 +303,7 @@ public Builder mergeFrom(com.google.protobuf.Message other) { public Builder mergeFrom(com.google.pubsub.v1.DetachSubscriptionResponse other) { if (other == com.google.pubsub.v1.DetachSubscriptionResponse.getDefaultInstance()) return this; - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -391,31 +318,34 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.pubsub.v1.DetachSubscriptionResponse parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.google.pubsub.v1.DetachSubscriptionResponse) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - // @@protoc_insertion_point(builder_scope:google.pubsub.v1.DetachSubscriptionResponse) } @@ -437,7 +367,18 @@ public DetachSubscriptionResponse parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new DetachSubscriptionResponse(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DetachSubscriptionResponseOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DetachSubscriptionResponseOrBuilder.java index ce75ecb80..52e34716c 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DetachSubscriptionResponseOrBuilder.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DetachSubscriptionResponseOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; +@com.google.protobuf.Generated public interface DetachSubscriptionResponseOrBuilder extends // @@protoc_insertion_point(interface_extends:google.pubsub.v1.DetachSubscriptionResponse) diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/Encoding.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/Encoding.java index 838fe7682..3c03c8a9e 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/Encoding.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/Encoding.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/schema.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; @@ -27,6 +29,7 @@ * * Protobuf enum {@code google.pubsub.v1.Encoding} */ +@com.google.protobuf.Generated public enum Encoding implements com.google.protobuf.ProtocolMessageEnum { /** * @@ -62,6 +65,16 @@ public enum Encoding implements com.google.protobuf.ProtocolMessageEnum { UNRECOGNIZED(-1), ; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "Encoding"); + } + /** * * @@ -72,6 +85,7 @@ public enum Encoding implements com.google.protobuf.ProtocolMessageEnum { * ENCODING_UNSPECIFIED = 0; */ public static final int ENCODING_UNSPECIFIED_VALUE = 0; + /** * * @@ -82,6 +96,7 @@ public enum Encoding implements com.google.protobuf.ProtocolMessageEnum { * JSON = 1; */ public static final int JSON_VALUE = 1; + /** * * @@ -152,7 +167,7 @@ public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType return getDescriptor(); } - public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + public static com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { return com.google.pubsub.v1.SchemaProto.getDescriptor().getEnumTypes().get(1); } diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ExpirationPolicy.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ExpirationPolicy.java index 5c88243ee..ef25fb02c 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ExpirationPolicy.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ExpirationPolicy.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; @@ -28,79 +30,29 @@ * * Protobuf type {@code google.pubsub.v1.ExpirationPolicy} */ -public final class ExpirationPolicy extends com.google.protobuf.GeneratedMessageV3 +@com.google.protobuf.Generated +public final class ExpirationPolicy extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:google.pubsub.v1.ExpirationPolicy) ExpirationPolicyOrBuilder { private static final long serialVersionUID = 0L; - // Use ExpirationPolicy.newBuilder() to construct. - private ExpirationPolicy(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - private ExpirationPolicy() {} - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new ExpirationPolicy(); + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "ExpirationPolicy"); } - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; + // Use ExpirationPolicy.newBuilder() to construct. + private ExpirationPolicy(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); } - private ExpirationPolicy( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - com.google.protobuf.Duration.Builder subBuilder = null; - if (ttl_ != null) { - subBuilder = ttl_.toBuilder(); - } - ttl_ = input.readMessage(com.google.protobuf.Duration.parser(), extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(ttl_); - ttl_ = subBuilder.buildPartial(); - } - - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } + private ExpirationPolicy() {} public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.pubsub.v1.PubsubProto @@ -108,7 +60,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_ExpirationPolicy_fieldAccessorTable @@ -117,41 +69,44 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { com.google.pubsub.v1.ExpirationPolicy.Builder.class); } + private int bitField0_; public static final int TTL_FIELD_NUMBER = 1; private com.google.protobuf.Duration ttl_; + /** * * *
    -   * Specifies the "time-to-live" duration for an associated resource. The
    -   * resource expires if it is not active for a period of `ttl`. The definition
    -   * of "activity" depends on the type of the associated resource. The minimum
    -   * and maximum allowed values for `ttl` depend on the type of the associated
    -   * resource, as well. If `ttl` is not set, the associated resource never
    -   * expires.
    +   * Optional. Specifies the "time-to-live" duration for an associated resource.
    +   * The resource expires if it is not active for a period of `ttl`. The
    +   * definition of "activity" depends on the type of the associated resource.
    +   * The minimum and maximum allowed values for `ttl` depend on the type of the
    +   * associated resource, as well. If `ttl` is not set, the associated resource
    +   * never expires.
        * 
    * - * .google.protobuf.Duration ttl = 1; + * .google.protobuf.Duration ttl = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @return Whether the ttl field is set. */ @java.lang.Override public boolean hasTtl() { - return ttl_ != null; + return ((bitField0_ & 0x00000001) != 0); } + /** * * *
    -   * Specifies the "time-to-live" duration for an associated resource. The
    -   * resource expires if it is not active for a period of `ttl`. The definition
    -   * of "activity" depends on the type of the associated resource. The minimum
    -   * and maximum allowed values for `ttl` depend on the type of the associated
    -   * resource, as well. If `ttl` is not set, the associated resource never
    -   * expires.
    +   * Optional. Specifies the "time-to-live" duration for an associated resource.
    +   * The resource expires if it is not active for a period of `ttl`. The
    +   * definition of "activity" depends on the type of the associated resource.
    +   * The minimum and maximum allowed values for `ttl` depend on the type of the
    +   * associated resource, as well. If `ttl` is not set, the associated resource
    +   * never expires.
        * 
    * - * .google.protobuf.Duration ttl = 1; + * .google.protobuf.Duration ttl = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @return The ttl. */ @@ -159,23 +114,24 @@ public boolean hasTtl() { public com.google.protobuf.Duration getTtl() { return ttl_ == null ? com.google.protobuf.Duration.getDefaultInstance() : ttl_; } + /** * * *
    -   * Specifies the "time-to-live" duration for an associated resource. The
    -   * resource expires if it is not active for a period of `ttl`. The definition
    -   * of "activity" depends on the type of the associated resource. The minimum
    -   * and maximum allowed values for `ttl` depend on the type of the associated
    -   * resource, as well. If `ttl` is not set, the associated resource never
    -   * expires.
    +   * Optional. Specifies the "time-to-live" duration for an associated resource.
    +   * The resource expires if it is not active for a period of `ttl`. The
    +   * definition of "activity" depends on the type of the associated resource.
    +   * The minimum and maximum allowed values for `ttl` depend on the type of the
    +   * associated resource, as well. If `ttl` is not set, the associated resource
    +   * never expires.
        * 
    * - * .google.protobuf.Duration ttl = 1; + * .google.protobuf.Duration ttl = 1 [(.google.api.field_behavior) = OPTIONAL]; */ @java.lang.Override public com.google.protobuf.DurationOrBuilder getTtlOrBuilder() { - return getTtl(); + return ttl_ == null ? com.google.protobuf.Duration.getDefaultInstance() : ttl_; } private byte memoizedIsInitialized = -1; @@ -192,10 +148,10 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (ttl_ != null) { + if (((bitField0_ & 0x00000001) != 0)) { output.writeMessage(1, getTtl()); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -204,10 +160,10 @@ public int getSerializedSize() { if (size != -1) return size; size = 0; - if (ttl_ != null) { + if (((bitField0_ & 0x00000001) != 0)) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getTtl()); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -226,7 +182,7 @@ public boolean equals(final java.lang.Object obj) { if (hasTtl()) { if (!getTtl().equals(other.getTtl())) return false; } - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -241,7 +197,7 @@ public int hashCode() { hash = (37 * hash) + TTL_FIELD_NUMBER; hash = (53 * hash) + getTtl().hashCode(); } - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -282,38 +238,38 @@ public static com.google.pubsub.v1.ExpirationPolicy parseFrom( public static com.google.pubsub.v1.ExpirationPolicy parseFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.ExpirationPolicy parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.ExpirationPolicy parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); } public static com.google.pubsub.v1.ExpirationPolicy parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.ExpirationPolicy parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.ExpirationPolicy parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } @@ -336,10 +292,11 @@ public Builder toBuilder() { } @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** * * @@ -350,7 +307,7 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build * * Protobuf type {@code google.pubsub.v1.ExpirationPolicy} */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements // @@protoc_insertion_point(builder_implements:google.pubsub.v1.ExpirationPolicy) com.google.pubsub.v1.ExpirationPolicyOrBuilder { @@ -360,7 +317,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_ExpirationPolicy_fieldAccessorTable @@ -374,22 +331,24 @@ private Builder() { maybeForceBuilderInitialization(); } - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + internalGetTtlFieldBuilder(); + } } @java.lang.Override public Builder clear() { super.clear(); - if (ttlBuilder_ == null) { - ttl_ = null; - } else { - ttl_ = null; + bitField0_ = 0; + ttl_ = null; + if (ttlBuilder_ != null) { + ttlBuilder_.dispose(); ttlBuilder_ = null; } return this; @@ -419,46 +378,21 @@ public com.google.pubsub.v1.ExpirationPolicy build() { public com.google.pubsub.v1.ExpirationPolicy buildPartial() { com.google.pubsub.v1.ExpirationPolicy result = new com.google.pubsub.v1.ExpirationPolicy(this); - if (ttlBuilder_ == null) { - result.ttl_ = ttl_; - } else { - result.ttl_ = ttlBuilder_.build(); + if (bitField0_ != 0) { + buildPartial0(result); } onBuilt(); return result; } - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); + private void buildPartial0(com.google.pubsub.v1.ExpirationPolicy result) { + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.ttl_ = ttlBuilder_ == null ? ttl_ : ttlBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + result.bitField0_ |= to_bitField0_; } @java.lang.Override @@ -476,7 +410,7 @@ public Builder mergeFrom(com.google.pubsub.v1.ExpirationPolicy other) { if (other.hasTtl()) { mergeTtl(other.getTtl()); } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -491,58 +425,82 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.pubsub.v1.ExpirationPolicy parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + input.readMessage(internalGetTtlFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000001; + break; + } // case 10 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.google.pubsub.v1.ExpirationPolicy) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } + private int bitField0_; + private com.google.protobuf.Duration ttl_; - private com.google.protobuf.SingleFieldBuilderV3< + private com.google.protobuf.SingleFieldBuilder< com.google.protobuf.Duration, com.google.protobuf.Duration.Builder, com.google.protobuf.DurationOrBuilder> ttlBuilder_; + /** * * *
    -     * Specifies the "time-to-live" duration for an associated resource. The
    -     * resource expires if it is not active for a period of `ttl`. The definition
    -     * of "activity" depends on the type of the associated resource. The minimum
    -     * and maximum allowed values for `ttl` depend on the type of the associated
    -     * resource, as well. If `ttl` is not set, the associated resource never
    -     * expires.
    +     * Optional. Specifies the "time-to-live" duration for an associated resource.
    +     * The resource expires if it is not active for a period of `ttl`. The
    +     * definition of "activity" depends on the type of the associated resource.
    +     * The minimum and maximum allowed values for `ttl` depend on the type of the
    +     * associated resource, as well. If `ttl` is not set, the associated resource
    +     * never expires.
          * 
    * - * .google.protobuf.Duration ttl = 1; + * .google.protobuf.Duration ttl = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @return Whether the ttl field is set. */ public boolean hasTtl() { - return ttlBuilder_ != null || ttl_ != null; + return ((bitField0_ & 0x00000001) != 0); } + /** * * *
    -     * Specifies the "time-to-live" duration for an associated resource. The
    -     * resource expires if it is not active for a period of `ttl`. The definition
    -     * of "activity" depends on the type of the associated resource. The minimum
    -     * and maximum allowed values for `ttl` depend on the type of the associated
    -     * resource, as well. If `ttl` is not set, the associated resource never
    -     * expires.
    +     * Optional. Specifies the "time-to-live" duration for an associated resource.
    +     * The resource expires if it is not active for a period of `ttl`. The
    +     * definition of "activity" depends on the type of the associated resource.
    +     * The minimum and maximum allowed values for `ttl` depend on the type of the
    +     * associated resource, as well. If `ttl` is not set, the associated resource
    +     * never expires.
          * 
    * - * .google.protobuf.Duration ttl = 1; + * .google.protobuf.Duration ttl = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @return The ttl. */ @@ -553,19 +511,20 @@ public com.google.protobuf.Duration getTtl() { return ttlBuilder_.getMessage(); } } + /** * * *
    -     * Specifies the "time-to-live" duration for an associated resource. The
    -     * resource expires if it is not active for a period of `ttl`. The definition
    -     * of "activity" depends on the type of the associated resource. The minimum
    -     * and maximum allowed values for `ttl` depend on the type of the associated
    -     * resource, as well. If `ttl` is not set, the associated resource never
    -     * expires.
    +     * Optional. Specifies the "time-to-live" duration for an associated resource.
    +     * The resource expires if it is not active for a period of `ttl`. The
    +     * definition of "activity" depends on the type of the associated resource.
    +     * The minimum and maximum allowed values for `ttl` depend on the type of the
    +     * associated resource, as well. If `ttl` is not set, the associated resource
    +     * never expires.
          * 
    * - * .google.protobuf.Duration ttl = 1; + * .google.protobuf.Duration ttl = 1 [(.google.api.field_behavior) = OPTIONAL]; */ public Builder setTtl(com.google.protobuf.Duration value) { if (ttlBuilder_ == null) { @@ -573,122 +532,130 @@ public Builder setTtl(com.google.protobuf.Duration value) { throw new NullPointerException(); } ttl_ = value; - onChanged(); } else { ttlBuilder_.setMessage(value); } - + bitField0_ |= 0x00000001; + onChanged(); return this; } + /** * * *
    -     * Specifies the "time-to-live" duration for an associated resource. The
    -     * resource expires if it is not active for a period of `ttl`. The definition
    -     * of "activity" depends on the type of the associated resource. The minimum
    -     * and maximum allowed values for `ttl` depend on the type of the associated
    -     * resource, as well. If `ttl` is not set, the associated resource never
    -     * expires.
    +     * Optional. Specifies the "time-to-live" duration for an associated resource.
    +     * The resource expires if it is not active for a period of `ttl`. The
    +     * definition of "activity" depends on the type of the associated resource.
    +     * The minimum and maximum allowed values for `ttl` depend on the type of the
    +     * associated resource, as well. If `ttl` is not set, the associated resource
    +     * never expires.
          * 
    * - * .google.protobuf.Duration ttl = 1; + * .google.protobuf.Duration ttl = 1 [(.google.api.field_behavior) = OPTIONAL]; */ public Builder setTtl(com.google.protobuf.Duration.Builder builderForValue) { if (ttlBuilder_ == null) { ttl_ = builderForValue.build(); - onChanged(); } else { ttlBuilder_.setMessage(builderForValue.build()); } - + bitField0_ |= 0x00000001; + onChanged(); return this; } + /** * * *
    -     * Specifies the "time-to-live" duration for an associated resource. The
    -     * resource expires if it is not active for a period of `ttl`. The definition
    -     * of "activity" depends on the type of the associated resource. The minimum
    -     * and maximum allowed values for `ttl` depend on the type of the associated
    -     * resource, as well. If `ttl` is not set, the associated resource never
    -     * expires.
    +     * Optional. Specifies the "time-to-live" duration for an associated resource.
    +     * The resource expires if it is not active for a period of `ttl`. The
    +     * definition of "activity" depends on the type of the associated resource.
    +     * The minimum and maximum allowed values for `ttl` depend on the type of the
    +     * associated resource, as well. If `ttl` is not set, the associated resource
    +     * never expires.
          * 
    * - * .google.protobuf.Duration ttl = 1; + * .google.protobuf.Duration ttl = 1 [(.google.api.field_behavior) = OPTIONAL]; */ public Builder mergeTtl(com.google.protobuf.Duration value) { if (ttlBuilder_ == null) { - if (ttl_ != null) { - ttl_ = com.google.protobuf.Duration.newBuilder(ttl_).mergeFrom(value).buildPartial(); + if (((bitField0_ & 0x00000001) != 0) + && ttl_ != null + && ttl_ != com.google.protobuf.Duration.getDefaultInstance()) { + getTtlBuilder().mergeFrom(value); } else { ttl_ = value; } - onChanged(); } else { ttlBuilder_.mergeFrom(value); } - + if (ttl_ != null) { + bitField0_ |= 0x00000001; + onChanged(); + } return this; } + /** * * *
    -     * Specifies the "time-to-live" duration for an associated resource. The
    -     * resource expires if it is not active for a period of `ttl`. The definition
    -     * of "activity" depends on the type of the associated resource. The minimum
    -     * and maximum allowed values for `ttl` depend on the type of the associated
    -     * resource, as well. If `ttl` is not set, the associated resource never
    -     * expires.
    +     * Optional. Specifies the "time-to-live" duration for an associated resource.
    +     * The resource expires if it is not active for a period of `ttl`. The
    +     * definition of "activity" depends on the type of the associated resource.
    +     * The minimum and maximum allowed values for `ttl` depend on the type of the
    +     * associated resource, as well. If `ttl` is not set, the associated resource
    +     * never expires.
          * 
    * - * .google.protobuf.Duration ttl = 1; + * .google.protobuf.Duration ttl = 1 [(.google.api.field_behavior) = OPTIONAL]; */ public Builder clearTtl() { - if (ttlBuilder_ == null) { - ttl_ = null; - onChanged(); - } else { - ttl_ = null; + bitField0_ = (bitField0_ & ~0x00000001); + ttl_ = null; + if (ttlBuilder_ != null) { + ttlBuilder_.dispose(); ttlBuilder_ = null; } - + onChanged(); return this; } + /** * * *
    -     * Specifies the "time-to-live" duration for an associated resource. The
    -     * resource expires if it is not active for a period of `ttl`. The definition
    -     * of "activity" depends on the type of the associated resource. The minimum
    -     * and maximum allowed values for `ttl` depend on the type of the associated
    -     * resource, as well. If `ttl` is not set, the associated resource never
    -     * expires.
    +     * Optional. Specifies the "time-to-live" duration for an associated resource.
    +     * The resource expires if it is not active for a period of `ttl`. The
    +     * definition of "activity" depends on the type of the associated resource.
    +     * The minimum and maximum allowed values for `ttl` depend on the type of the
    +     * associated resource, as well. If `ttl` is not set, the associated resource
    +     * never expires.
          * 
    * - * .google.protobuf.Duration ttl = 1; + * .google.protobuf.Duration ttl = 1 [(.google.api.field_behavior) = OPTIONAL]; */ public com.google.protobuf.Duration.Builder getTtlBuilder() { - + bitField0_ |= 0x00000001; onChanged(); - return getTtlFieldBuilder().getBuilder(); + return internalGetTtlFieldBuilder().getBuilder(); } + /** * * *
    -     * Specifies the "time-to-live" duration for an associated resource. The
    -     * resource expires if it is not active for a period of `ttl`. The definition
    -     * of "activity" depends on the type of the associated resource. The minimum
    -     * and maximum allowed values for `ttl` depend on the type of the associated
    -     * resource, as well. If `ttl` is not set, the associated resource never
    -     * expires.
    +     * Optional. Specifies the "time-to-live" duration for an associated resource.
    +     * The resource expires if it is not active for a period of `ttl`. The
    +     * definition of "activity" depends on the type of the associated resource.
    +     * The minimum and maximum allowed values for `ttl` depend on the type of the
    +     * associated resource, as well. If `ttl` is not set, the associated resource
    +     * never expires.
          * 
    * - * .google.protobuf.Duration ttl = 1; + * .google.protobuf.Duration ttl = 1 [(.google.api.field_behavior) = OPTIONAL]; */ public com.google.protobuf.DurationOrBuilder getTtlOrBuilder() { if (ttlBuilder_ != null) { @@ -697,28 +664,29 @@ public com.google.protobuf.DurationOrBuilder getTtlOrBuilder() { return ttl_ == null ? com.google.protobuf.Duration.getDefaultInstance() : ttl_; } } + /** * * *
    -     * Specifies the "time-to-live" duration for an associated resource. The
    -     * resource expires if it is not active for a period of `ttl`. The definition
    -     * of "activity" depends on the type of the associated resource. The minimum
    -     * and maximum allowed values for `ttl` depend on the type of the associated
    -     * resource, as well. If `ttl` is not set, the associated resource never
    -     * expires.
    +     * Optional. Specifies the "time-to-live" duration for an associated resource.
    +     * The resource expires if it is not active for a period of `ttl`. The
    +     * definition of "activity" depends on the type of the associated resource.
    +     * The minimum and maximum allowed values for `ttl` depend on the type of the
    +     * associated resource, as well. If `ttl` is not set, the associated resource
    +     * never expires.
          * 
    * - * .google.protobuf.Duration ttl = 1; + * .google.protobuf.Duration ttl = 1 [(.google.api.field_behavior) = OPTIONAL]; */ - private com.google.protobuf.SingleFieldBuilderV3< + private com.google.protobuf.SingleFieldBuilder< com.google.protobuf.Duration, com.google.protobuf.Duration.Builder, com.google.protobuf.DurationOrBuilder> - getTtlFieldBuilder() { + internalGetTtlFieldBuilder() { if (ttlBuilder_ == null) { ttlBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< + new com.google.protobuf.SingleFieldBuilder< com.google.protobuf.Duration, com.google.protobuf.Duration.Builder, com.google.protobuf.DurationOrBuilder>(getTtl(), getParentForChildren(), isClean()); @@ -727,17 +695,6 @@ public com.google.protobuf.DurationOrBuilder getTtlOrBuilder() { return ttlBuilder_; } - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - // @@protoc_insertion_point(builder_scope:google.pubsub.v1.ExpirationPolicy) } @@ -759,7 +716,18 @@ public ExpirationPolicy parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new ExpirationPolicy(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ExpirationPolicyOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ExpirationPolicyOrBuilder.java index ac04be2f7..825d9c775 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ExpirationPolicyOrBuilder.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ExpirationPolicyOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; +@com.google.protobuf.Generated public interface ExpirationPolicyOrBuilder extends // @@protoc_insertion_point(interface_extends:google.pubsub.v1.ExpirationPolicy) @@ -27,49 +30,51 @@ public interface ExpirationPolicyOrBuilder * * *
    -   * Specifies the "time-to-live" duration for an associated resource. The
    -   * resource expires if it is not active for a period of `ttl`. The definition
    -   * of "activity" depends on the type of the associated resource. The minimum
    -   * and maximum allowed values for `ttl` depend on the type of the associated
    -   * resource, as well. If `ttl` is not set, the associated resource never
    -   * expires.
    +   * Optional. Specifies the "time-to-live" duration for an associated resource.
    +   * The resource expires if it is not active for a period of `ttl`. The
    +   * definition of "activity" depends on the type of the associated resource.
    +   * The minimum and maximum allowed values for `ttl` depend on the type of the
    +   * associated resource, as well. If `ttl` is not set, the associated resource
    +   * never expires.
        * 
    * - * .google.protobuf.Duration ttl = 1; + * .google.protobuf.Duration ttl = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @return Whether the ttl field is set. */ boolean hasTtl(); + /** * * *
    -   * Specifies the "time-to-live" duration for an associated resource. The
    -   * resource expires if it is not active for a period of `ttl`. The definition
    -   * of "activity" depends on the type of the associated resource. The minimum
    -   * and maximum allowed values for `ttl` depend on the type of the associated
    -   * resource, as well. If `ttl` is not set, the associated resource never
    -   * expires.
    +   * Optional. Specifies the "time-to-live" duration for an associated resource.
    +   * The resource expires if it is not active for a period of `ttl`. The
    +   * definition of "activity" depends on the type of the associated resource.
    +   * The minimum and maximum allowed values for `ttl` depend on the type of the
    +   * associated resource, as well. If `ttl` is not set, the associated resource
    +   * never expires.
        * 
    * - * .google.protobuf.Duration ttl = 1; + * .google.protobuf.Duration ttl = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @return The ttl. */ com.google.protobuf.Duration getTtl(); + /** * * *
    -   * Specifies the "time-to-live" duration for an associated resource. The
    -   * resource expires if it is not active for a period of `ttl`. The definition
    -   * of "activity" depends on the type of the associated resource. The minimum
    -   * and maximum allowed values for `ttl` depend on the type of the associated
    -   * resource, as well. If `ttl` is not set, the associated resource never
    -   * expires.
    +   * Optional. Specifies the "time-to-live" duration for an associated resource.
    +   * The resource expires if it is not active for a period of `ttl`. The
    +   * definition of "activity" depends on the type of the associated resource.
    +   * The minimum and maximum allowed values for `ttl` depend on the type of the
    +   * associated resource, as well. If `ttl` is not set, the associated resource
    +   * never expires.
        * 
    * - * .google.protobuf.Duration ttl = 1; + * .google.protobuf.Duration ttl = 1 [(.google.api.field_behavior) = OPTIONAL]; */ com.google.protobuf.DurationOrBuilder getTtlOrBuilder(); } diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/GetSchemaRequest.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/GetSchemaRequest.java index d8dd20048..691454cd0 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/GetSchemaRequest.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/GetSchemaRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/schema.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; @@ -27,13 +29,25 @@ * * Protobuf type {@code google.pubsub.v1.GetSchemaRequest} */ -public final class GetSchemaRequest extends com.google.protobuf.GeneratedMessageV3 +@com.google.protobuf.Generated +public final class GetSchemaRequest extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:google.pubsub.v1.GetSchemaRequest) GetSchemaRequestOrBuilder { private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "GetSchemaRequest"); + } + // Use GetSchemaRequest.newBuilder() to construct. - private GetSchemaRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + private GetSchemaRequest(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); } @@ -42,75 +56,13 @@ private GetSchemaRequest() { view_ = 0; } - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new GetSchemaRequest(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - private GetSchemaRequest( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - java.lang.String s = input.readStringRequireUtf8(); - - name_ = s; - break; - } - case 16: - { - int rawValue = input.readEnum(); - - view_ = rawValue; - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.pubsub.v1.SchemaProto .internal_static_google_pubsub_v1_GetSchemaRequest_descriptor; } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.SchemaProto .internal_static_google_pubsub_v1_GetSchemaRequest_fieldAccessorTable @@ -120,7 +72,10 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } public static final int NAME_FIELD_NUMBER = 1; - private volatile java.lang.Object name_; + + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; + /** * * @@ -147,6 +102,7 @@ public java.lang.String getName() { return s; } } + /** * * @@ -175,14 +131,14 @@ public com.google.protobuf.ByteString getNameBytes() { } public static final int VIEW_FIELD_NUMBER = 2; - private int view_; + private int view_ = 0; + /** * * *
        * The set of fields to return in the response. If not set, returns a Schema
    -   * with `name` and `type`, but not `definition`. Set to `FULL` to retrieve all
    -   * fields.
    +   * with all fields filled out. Set to `BASIC` to omit the `definition`.
        * 
    * * .google.pubsub.v1.SchemaView view = 2; @@ -193,13 +149,13 @@ public com.google.protobuf.ByteString getNameBytes() { public int getViewValue() { return view_; } + /** * * *
        * The set of fields to return in the response. If not set, returns a Schema
    -   * with `name` and `type`, but not `definition`. Set to `FULL` to retrieve all
    -   * fields.
    +   * with all fields filled out. Set to `BASIC` to omit the `definition`.
        * 
    * * .google.pubsub.v1.SchemaView view = 2; @@ -208,8 +164,7 @@ public int getViewValue() { */ @java.lang.Override public com.google.pubsub.v1.SchemaView getView() { - @SuppressWarnings("deprecation") - com.google.pubsub.v1.SchemaView result = com.google.pubsub.v1.SchemaView.valueOf(view_); + com.google.pubsub.v1.SchemaView result = com.google.pubsub.v1.SchemaView.forNumber(view_); return result == null ? com.google.pubsub.v1.SchemaView.UNRECOGNIZED : result; } @@ -227,13 +182,13 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!getNameBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, name_); } if (view_ != com.google.pubsub.v1.SchemaView.SCHEMA_VIEW_UNSPECIFIED.getNumber()) { output.writeEnum(2, view_); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -242,13 +197,13 @@ public int getSerializedSize() { if (size != -1) return size; size = 0; - if (!getNameBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, name_); } if (view_ != com.google.pubsub.v1.SchemaView.SCHEMA_VIEW_UNSPECIFIED.getNumber()) { size += com.google.protobuf.CodedOutputStream.computeEnumSize(2, view_); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -265,7 +220,7 @@ public boolean equals(final java.lang.Object obj) { if (!getName().equals(other.getName())) return false; if (view_ != other.view_) return false; - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -280,7 +235,7 @@ public int hashCode() { hash = (53 * hash) + getName().hashCode(); hash = (37 * hash) + VIEW_FIELD_NUMBER; hash = (53 * hash) + view_; - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -321,38 +276,38 @@ public static com.google.pubsub.v1.GetSchemaRequest parseFrom( public static com.google.pubsub.v1.GetSchemaRequest parseFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.GetSchemaRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.GetSchemaRequest parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); } public static com.google.pubsub.v1.GetSchemaRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.GetSchemaRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.GetSchemaRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } @@ -375,10 +330,11 @@ public Builder toBuilder() { } @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** * * @@ -388,7 +344,7 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build * * Protobuf type {@code google.pubsub.v1.GetSchemaRequest} */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements // @@protoc_insertion_point(builder_implements:google.pubsub.v1.GetSchemaRequest) com.google.pubsub.v1.GetSchemaRequestOrBuilder { @@ -398,7 +354,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.SchemaProto .internal_static_google_pubsub_v1_GetSchemaRequest_fieldAccessorTable @@ -408,26 +364,18 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } // Construct using com.google.pubsub.v1.GetSchemaRequest.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } + private Builder() {} - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} } @java.lang.Override public Builder clear() { super.clear(); + bitField0_ = 0; name_ = ""; - view_ = 0; - return this; } @@ -455,43 +403,21 @@ public com.google.pubsub.v1.GetSchemaRequest build() { public com.google.pubsub.v1.GetSchemaRequest buildPartial() { com.google.pubsub.v1.GetSchemaRequest result = new com.google.pubsub.v1.GetSchemaRequest(this); - result.name_ = name_; - result.view_ = view_; + if (bitField0_ != 0) { + buildPartial0(result); + } onBuilt(); return result; } - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); + private void buildPartial0(com.google.pubsub.v1.GetSchemaRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.name_ = name_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.view_ = view_; + } } @java.lang.Override @@ -508,12 +434,13 @@ public Builder mergeFrom(com.google.pubsub.v1.GetSchemaRequest other) { if (other == com.google.pubsub.v1.GetSchemaRequest.getDefaultInstance()) return this; if (!other.getName().isEmpty()) { name_ = other.name_; + bitField0_ |= 0x00000001; onChanged(); } if (other.view_ != 0) { setViewValue(other.getViewValue()); } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -528,21 +455,50 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.pubsub.v1.GetSchemaRequest parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + name_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 16: + { + view_ = input.readEnum(); + bitField0_ |= 0x00000002; + break; + } // case 16 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.google.pubsub.v1.GetSchemaRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } + private int bitField0_; + private java.lang.Object name_ = ""; + /** * * @@ -568,6 +524,7 @@ public java.lang.String getName() { return (java.lang.String) ref; } } + /** * * @@ -593,6 +550,7 @@ public com.google.protobuf.ByteString getNameBytes() { return (com.google.protobuf.ByteString) ref; } } + /** * * @@ -612,11 +570,12 @@ public Builder setName(java.lang.String value) { if (value == null) { throw new NullPointerException(); } - name_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } + /** * * @@ -632,11 +591,12 @@ public Builder setName(java.lang.String value) { * @return This builder for chaining. */ public Builder clearName() { - name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000001); onChanged(); return this; } + /** * * @@ -657,20 +617,20 @@ public Builder setNameBytes(com.google.protobuf.ByteString value) { throw new NullPointerException(); } checkByteStringIsUtf8(value); - name_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } private int view_ = 0; + /** * * *
          * The set of fields to return in the response. If not set, returns a Schema
    -     * with `name` and `type`, but not `definition`. Set to `FULL` to retrieve all
    -     * fields.
    +     * with all fields filled out. Set to `BASIC` to omit the `definition`.
          * 
    * * .google.pubsub.v1.SchemaView view = 2; @@ -681,13 +641,13 @@ public Builder setNameBytes(com.google.protobuf.ByteString value) { public int getViewValue() { return view_; } + /** * * *
          * The set of fields to return in the response. If not set, returns a Schema
    -     * with `name` and `type`, but not `definition`. Set to `FULL` to retrieve all
    -     * fields.
    +     * with all fields filled out. Set to `BASIC` to omit the `definition`.
          * 
    * * .google.pubsub.v1.SchemaView view = 2; @@ -696,18 +656,18 @@ public int getViewValue() { * @return This builder for chaining. */ public Builder setViewValue(int value) { - view_ = value; + bitField0_ |= 0x00000002; onChanged(); return this; } + /** * * *
          * The set of fields to return in the response. If not set, returns a Schema
    -     * with `name` and `type`, but not `definition`. Set to `FULL` to retrieve all
    -     * fields.
    +     * with all fields filled out. Set to `BASIC` to omit the `definition`.
          * 
    * * .google.pubsub.v1.SchemaView view = 2; @@ -716,17 +676,16 @@ public Builder setViewValue(int value) { */ @java.lang.Override public com.google.pubsub.v1.SchemaView getView() { - @SuppressWarnings("deprecation") - com.google.pubsub.v1.SchemaView result = com.google.pubsub.v1.SchemaView.valueOf(view_); + com.google.pubsub.v1.SchemaView result = com.google.pubsub.v1.SchemaView.forNumber(view_); return result == null ? com.google.pubsub.v1.SchemaView.UNRECOGNIZED : result; } + /** * * *
          * The set of fields to return in the response. If not set, returns a Schema
    -     * with `name` and `type`, but not `definition`. Set to `FULL` to retrieve all
    -     * fields.
    +     * with all fields filled out. Set to `BASIC` to omit the `definition`.
          * 
    * * .google.pubsub.v1.SchemaView view = 2; @@ -738,18 +697,18 @@ public Builder setView(com.google.pubsub.v1.SchemaView value) { if (value == null) { throw new NullPointerException(); } - + bitField0_ |= 0x00000002; view_ = value.getNumber(); onChanged(); return this; } + /** * * *
          * The set of fields to return in the response. If not set, returns a Schema
    -     * with `name` and `type`, but not `definition`. Set to `FULL` to retrieve all
    -     * fields.
    +     * with all fields filled out. Set to `BASIC` to omit the `definition`.
          * 
    * * .google.pubsub.v1.SchemaView view = 2; @@ -757,23 +716,12 @@ public Builder setView(com.google.pubsub.v1.SchemaView value) { * @return This builder for chaining. */ public Builder clearView() { - + bitField0_ = (bitField0_ & ~0x00000002); view_ = 0; onChanged(); return this; } - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - // @@protoc_insertion_point(builder_scope:google.pubsub.v1.GetSchemaRequest) } @@ -795,7 +743,18 @@ public GetSchemaRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new GetSchemaRequest(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/GetSchemaRequestOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/GetSchemaRequestOrBuilder.java index 54c9481e2..7f09aef11 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/GetSchemaRequestOrBuilder.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/GetSchemaRequestOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/schema.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; +@com.google.protobuf.Generated public interface GetSchemaRequestOrBuilder extends // @@protoc_insertion_point(interface_extends:google.pubsub.v1.GetSchemaRequest) @@ -38,6 +41,7 @@ public interface GetSchemaRequestOrBuilder * @return The name. */ java.lang.String getName(); + /** * * @@ -59,8 +63,7 @@ public interface GetSchemaRequestOrBuilder * *
        * The set of fields to return in the response. If not set, returns a Schema
    -   * with `name` and `type`, but not `definition`. Set to `FULL` to retrieve all
    -   * fields.
    +   * with all fields filled out. Set to `BASIC` to omit the `definition`.
        * 
    * * .google.pubsub.v1.SchemaView view = 2; @@ -68,13 +71,13 @@ public interface GetSchemaRequestOrBuilder * @return The enum numeric value on the wire for view. */ int getViewValue(); + /** * * *
        * The set of fields to return in the response. If not set, returns a Schema
    -   * with `name` and `type`, but not `definition`. Set to `FULL` to retrieve all
    -   * fields.
    +   * with all fields filled out. Set to `BASIC` to omit the `definition`.
        * 
    * * .google.pubsub.v1.SchemaView view = 2; diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/GetSnapshotRequest.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/GetSnapshotRequest.java index ee75fc7d3..b8744fee0 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/GetSnapshotRequest.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/GetSnapshotRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; @@ -27,13 +29,25 @@ * * Protobuf type {@code google.pubsub.v1.GetSnapshotRequest} */ -public final class GetSnapshotRequest extends com.google.protobuf.GeneratedMessageV3 +@com.google.protobuf.Generated +public final class GetSnapshotRequest extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:google.pubsub.v1.GetSnapshotRequest) GetSnapshotRequestOrBuilder { private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "GetSnapshotRequest"); + } + // Use GetSnapshotRequest.newBuilder() to construct. - private GetSnapshotRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + private GetSnapshotRequest(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); } @@ -41,68 +55,13 @@ private GetSnapshotRequest() { snapshot_ = ""; } - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new GetSnapshotRequest(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - private GetSnapshotRequest( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - java.lang.String s = input.readStringRequireUtf8(); - - snapshot_ = s; - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_GetSnapshotRequest_descriptor; } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_GetSnapshotRequest_fieldAccessorTable @@ -112,7 +71,10 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } public static final int SNAPSHOT_FIELD_NUMBER = 1; - private volatile java.lang.Object snapshot_; + + @SuppressWarnings("serial") + private volatile java.lang.Object snapshot_ = ""; + /** * * @@ -139,6 +101,7 @@ public java.lang.String getSnapshot() { return s; } } + /** * * @@ -180,10 +143,10 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!getSnapshotBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, snapshot_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(snapshot_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, snapshot_); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -192,10 +155,10 @@ public int getSerializedSize() { if (size != -1) return size; size = 0; - if (!getSnapshotBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, snapshot_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(snapshot_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, snapshot_); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -211,7 +174,7 @@ public boolean equals(final java.lang.Object obj) { com.google.pubsub.v1.GetSnapshotRequest other = (com.google.pubsub.v1.GetSnapshotRequest) obj; if (!getSnapshot().equals(other.getSnapshot())) return false; - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -224,7 +187,7 @@ public int hashCode() { hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + SNAPSHOT_FIELD_NUMBER; hash = (53 * hash) + getSnapshot().hashCode(); - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -266,38 +229,38 @@ public static com.google.pubsub.v1.GetSnapshotRequest parseFrom( public static com.google.pubsub.v1.GetSnapshotRequest parseFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.GetSnapshotRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.GetSnapshotRequest parseDelimitedFrom( java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); } public static com.google.pubsub.v1.GetSnapshotRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.GetSnapshotRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.GetSnapshotRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } @@ -320,10 +283,11 @@ public Builder toBuilder() { } @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** * * @@ -333,7 +297,7 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build * * Protobuf type {@code google.pubsub.v1.GetSnapshotRequest} */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements // @@protoc_insertion_point(builder_implements:google.pubsub.v1.GetSnapshotRequest) com.google.pubsub.v1.GetSnapshotRequestOrBuilder { @@ -343,7 +307,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_GetSnapshotRequest_fieldAccessorTable @@ -353,24 +317,17 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } // Construct using com.google.pubsub.v1.GetSnapshotRequest.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } + private Builder() {} - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} } @java.lang.Override public Builder clear() { super.clear(); + bitField0_ = 0; snapshot_ = ""; - return this; } @@ -398,42 +355,18 @@ public com.google.pubsub.v1.GetSnapshotRequest build() { public com.google.pubsub.v1.GetSnapshotRequest buildPartial() { com.google.pubsub.v1.GetSnapshotRequest result = new com.google.pubsub.v1.GetSnapshotRequest(this); - result.snapshot_ = snapshot_; + if (bitField0_ != 0) { + buildPartial0(result); + } onBuilt(); return result; } - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); + private void buildPartial0(com.google.pubsub.v1.GetSnapshotRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.snapshot_ = snapshot_; + } } @java.lang.Override @@ -450,9 +383,10 @@ public Builder mergeFrom(com.google.pubsub.v1.GetSnapshotRequest other) { if (other == com.google.pubsub.v1.GetSnapshotRequest.getDefaultInstance()) return this; if (!other.getSnapshot().isEmpty()) { snapshot_ = other.snapshot_; + bitField0_ |= 0x00000001; onChanged(); } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -467,21 +401,44 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.pubsub.v1.GetSnapshotRequest parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + snapshot_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.google.pubsub.v1.GetSnapshotRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } + private int bitField0_; + private java.lang.Object snapshot_ = ""; + /** * * @@ -507,6 +464,7 @@ public java.lang.String getSnapshot() { return (java.lang.String) ref; } } + /** * * @@ -532,6 +490,7 @@ public com.google.protobuf.ByteString getSnapshotBytes() { return (com.google.protobuf.ByteString) ref; } } + /** * * @@ -551,11 +510,12 @@ public Builder setSnapshot(java.lang.String value) { if (value == null) { throw new NullPointerException(); } - snapshot_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } + /** * * @@ -571,11 +531,12 @@ public Builder setSnapshot(java.lang.String value) { * @return This builder for chaining. */ public Builder clearSnapshot() { - snapshot_ = getDefaultInstance().getSnapshot(); + bitField0_ = (bitField0_ & ~0x00000001); onChanged(); return this; } + /** * * @@ -596,23 +557,12 @@ public Builder setSnapshotBytes(com.google.protobuf.ByteString value) { throw new NullPointerException(); } checkByteStringIsUtf8(value); - snapshot_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - // @@protoc_insertion_point(builder_scope:google.pubsub.v1.GetSnapshotRequest) } @@ -634,7 +584,18 @@ public GetSnapshotRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new GetSnapshotRequest(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/GetSnapshotRequestOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/GetSnapshotRequestOrBuilder.java index f101510fd..d818ff674 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/GetSnapshotRequestOrBuilder.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/GetSnapshotRequestOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; +@com.google.protobuf.Generated public interface GetSnapshotRequestOrBuilder extends // @@protoc_insertion_point(interface_extends:google.pubsub.v1.GetSnapshotRequest) @@ -38,6 +41,7 @@ public interface GetSnapshotRequestOrBuilder * @return The snapshot. */ java.lang.String getSnapshot(); + /** * * diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/GetSubscriptionRequest.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/GetSubscriptionRequest.java index 7aed4b01a..df1d38b06 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/GetSubscriptionRequest.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/GetSubscriptionRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; @@ -27,13 +29,25 @@ * * Protobuf type {@code google.pubsub.v1.GetSubscriptionRequest} */ -public final class GetSubscriptionRequest extends com.google.protobuf.GeneratedMessageV3 +@com.google.protobuf.Generated +public final class GetSubscriptionRequest extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:google.pubsub.v1.GetSubscriptionRequest) GetSubscriptionRequestOrBuilder { private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "GetSubscriptionRequest"); + } + // Use GetSubscriptionRequest.newBuilder() to construct. - private GetSubscriptionRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + private GetSubscriptionRequest(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); } @@ -41,68 +55,13 @@ private GetSubscriptionRequest() { subscription_ = ""; } - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new GetSubscriptionRequest(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - private GetSubscriptionRequest( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - java.lang.String s = input.readStringRequireUtf8(); - - subscription_ = s; - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_GetSubscriptionRequest_descriptor; } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_GetSubscriptionRequest_fieldAccessorTable @@ -112,7 +71,10 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } public static final int SUBSCRIPTION_FIELD_NUMBER = 1; - private volatile java.lang.Object subscription_; + + @SuppressWarnings("serial") + private volatile java.lang.Object subscription_ = ""; + /** * * @@ -139,6 +101,7 @@ public java.lang.String getSubscription() { return s; } } + /** * * @@ -180,10 +143,10 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!getSubscriptionBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, subscription_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(subscription_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, subscription_); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -192,10 +155,10 @@ public int getSerializedSize() { if (size != -1) return size; size = 0; - if (!getSubscriptionBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, subscription_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(subscription_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, subscription_); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -212,7 +175,7 @@ public boolean equals(final java.lang.Object obj) { (com.google.pubsub.v1.GetSubscriptionRequest) obj; if (!getSubscription().equals(other.getSubscription())) return false; - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -225,7 +188,7 @@ public int hashCode() { hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + SUBSCRIPTION_FIELD_NUMBER; hash = (53 * hash) + getSubscription().hashCode(); - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -267,38 +230,38 @@ public static com.google.pubsub.v1.GetSubscriptionRequest parseFrom( public static com.google.pubsub.v1.GetSubscriptionRequest parseFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.GetSubscriptionRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.GetSubscriptionRequest parseDelimitedFrom( java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); } public static com.google.pubsub.v1.GetSubscriptionRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.GetSubscriptionRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.GetSubscriptionRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } @@ -321,10 +284,11 @@ public Builder toBuilder() { } @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** * * @@ -334,7 +298,7 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build * * Protobuf type {@code google.pubsub.v1.GetSubscriptionRequest} */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements // @@protoc_insertion_point(builder_implements:google.pubsub.v1.GetSubscriptionRequest) com.google.pubsub.v1.GetSubscriptionRequestOrBuilder { @@ -344,7 +308,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_GetSubscriptionRequest_fieldAccessorTable @@ -354,24 +318,17 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } // Construct using com.google.pubsub.v1.GetSubscriptionRequest.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } + private Builder() {} - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} } @java.lang.Override public Builder clear() { super.clear(); + bitField0_ = 0; subscription_ = ""; - return this; } @@ -399,42 +356,18 @@ public com.google.pubsub.v1.GetSubscriptionRequest build() { public com.google.pubsub.v1.GetSubscriptionRequest buildPartial() { com.google.pubsub.v1.GetSubscriptionRequest result = new com.google.pubsub.v1.GetSubscriptionRequest(this); - result.subscription_ = subscription_; + if (bitField0_ != 0) { + buildPartial0(result); + } onBuilt(); return result; } - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); + private void buildPartial0(com.google.pubsub.v1.GetSubscriptionRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.subscription_ = subscription_; + } } @java.lang.Override @@ -451,9 +384,10 @@ public Builder mergeFrom(com.google.pubsub.v1.GetSubscriptionRequest other) { if (other == com.google.pubsub.v1.GetSubscriptionRequest.getDefaultInstance()) return this; if (!other.getSubscription().isEmpty()) { subscription_ = other.subscription_; + bitField0_ |= 0x00000001; onChanged(); } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -468,21 +402,44 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.pubsub.v1.GetSubscriptionRequest parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + subscription_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.google.pubsub.v1.GetSubscriptionRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } + private int bitField0_; + private java.lang.Object subscription_ = ""; + /** * * @@ -508,6 +465,7 @@ public java.lang.String getSubscription() { return (java.lang.String) ref; } } + /** * * @@ -533,6 +491,7 @@ public com.google.protobuf.ByteString getSubscriptionBytes() { return (com.google.protobuf.ByteString) ref; } } + /** * * @@ -552,11 +511,12 @@ public Builder setSubscription(java.lang.String value) { if (value == null) { throw new NullPointerException(); } - subscription_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } + /** * * @@ -572,11 +532,12 @@ public Builder setSubscription(java.lang.String value) { * @return This builder for chaining. */ public Builder clearSubscription() { - subscription_ = getDefaultInstance().getSubscription(); + bitField0_ = (bitField0_ & ~0x00000001); onChanged(); return this; } + /** * * @@ -597,23 +558,12 @@ public Builder setSubscriptionBytes(com.google.protobuf.ByteString value) { throw new NullPointerException(); } checkByteStringIsUtf8(value); - subscription_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - // @@protoc_insertion_point(builder_scope:google.pubsub.v1.GetSubscriptionRequest) } @@ -635,7 +585,18 @@ public GetSubscriptionRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new GetSubscriptionRequest(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/GetSubscriptionRequestOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/GetSubscriptionRequestOrBuilder.java index ca8af6c8b..93a8ea4fa 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/GetSubscriptionRequestOrBuilder.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/GetSubscriptionRequestOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; +@com.google.protobuf.Generated public interface GetSubscriptionRequestOrBuilder extends // @@protoc_insertion_point(interface_extends:google.pubsub.v1.GetSubscriptionRequest) @@ -38,6 +41,7 @@ public interface GetSubscriptionRequestOrBuilder * @return The subscription. */ java.lang.String getSubscription(); + /** * * diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/GetTopicRequest.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/GetTopicRequest.java index acf62a7f7..215b1b7ce 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/GetTopicRequest.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/GetTopicRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; @@ -27,13 +29,25 @@ * * Protobuf type {@code google.pubsub.v1.GetTopicRequest} */ -public final class GetTopicRequest extends com.google.protobuf.GeneratedMessageV3 +@com.google.protobuf.Generated +public final class GetTopicRequest extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:google.pubsub.v1.GetTopicRequest) GetTopicRequestOrBuilder { private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "GetTopicRequest"); + } + // Use GetTopicRequest.newBuilder() to construct. - private GetTopicRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + private GetTopicRequest(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); } @@ -41,68 +55,13 @@ private GetTopicRequest() { topic_ = ""; } - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new GetTopicRequest(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - private GetTopicRequest( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - java.lang.String s = input.readStringRequireUtf8(); - - topic_ = s; - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_GetTopicRequest_descriptor; } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_GetTopicRequest_fieldAccessorTable @@ -112,7 +71,10 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } public static final int TOPIC_FIELD_NUMBER = 1; - private volatile java.lang.Object topic_; + + @SuppressWarnings("serial") + private volatile java.lang.Object topic_ = ""; + /** * * @@ -139,6 +101,7 @@ public java.lang.String getTopic() { return s; } } + /** * * @@ -180,10 +143,10 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!getTopicBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, topic_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(topic_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, topic_); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -192,10 +155,10 @@ public int getSerializedSize() { if (size != -1) return size; size = 0; - if (!getTopicBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, topic_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(topic_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, topic_); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -211,7 +174,7 @@ public boolean equals(final java.lang.Object obj) { com.google.pubsub.v1.GetTopicRequest other = (com.google.pubsub.v1.GetTopicRequest) obj; if (!getTopic().equals(other.getTopic())) return false; - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -224,7 +187,7 @@ public int hashCode() { hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + TOPIC_FIELD_NUMBER; hash = (53 * hash) + getTopic().hashCode(); - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -265,38 +228,38 @@ public static com.google.pubsub.v1.GetTopicRequest parseFrom( public static com.google.pubsub.v1.GetTopicRequest parseFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.GetTopicRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.GetTopicRequest parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); } public static com.google.pubsub.v1.GetTopicRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.GetTopicRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.GetTopicRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } @@ -319,10 +282,11 @@ public Builder toBuilder() { } @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** * * @@ -332,7 +296,7 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build * * Protobuf type {@code google.pubsub.v1.GetTopicRequest} */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements // @@protoc_insertion_point(builder_implements:google.pubsub.v1.GetTopicRequest) com.google.pubsub.v1.GetTopicRequestOrBuilder { @@ -342,7 +306,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_GetTopicRequest_fieldAccessorTable @@ -352,24 +316,17 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } // Construct using com.google.pubsub.v1.GetTopicRequest.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } + private Builder() {} - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} } @java.lang.Override public Builder clear() { super.clear(); + bitField0_ = 0; topic_ = ""; - return this; } @@ -396,42 +353,18 @@ public com.google.pubsub.v1.GetTopicRequest build() { @java.lang.Override public com.google.pubsub.v1.GetTopicRequest buildPartial() { com.google.pubsub.v1.GetTopicRequest result = new com.google.pubsub.v1.GetTopicRequest(this); - result.topic_ = topic_; + if (bitField0_ != 0) { + buildPartial0(result); + } onBuilt(); return result; } - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); + private void buildPartial0(com.google.pubsub.v1.GetTopicRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.topic_ = topic_; + } } @java.lang.Override @@ -448,9 +381,10 @@ public Builder mergeFrom(com.google.pubsub.v1.GetTopicRequest other) { if (other == com.google.pubsub.v1.GetTopicRequest.getDefaultInstance()) return this; if (!other.getTopic().isEmpty()) { topic_ = other.topic_; + bitField0_ |= 0x00000001; onChanged(); } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -465,21 +399,44 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.pubsub.v1.GetTopicRequest parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + topic_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.google.pubsub.v1.GetTopicRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } + private int bitField0_; + private java.lang.Object topic_ = ""; + /** * * @@ -505,6 +462,7 @@ public java.lang.String getTopic() { return (java.lang.String) ref; } } + /** * * @@ -530,6 +488,7 @@ public com.google.protobuf.ByteString getTopicBytes() { return (com.google.protobuf.ByteString) ref; } } + /** * * @@ -549,11 +508,12 @@ public Builder setTopic(java.lang.String value) { if (value == null) { throw new NullPointerException(); } - topic_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } + /** * * @@ -569,11 +529,12 @@ public Builder setTopic(java.lang.String value) { * @return This builder for chaining. */ public Builder clearTopic() { - topic_ = getDefaultInstance().getTopic(); + bitField0_ = (bitField0_ & ~0x00000001); onChanged(); return this; } + /** * * @@ -594,23 +555,12 @@ public Builder setTopicBytes(com.google.protobuf.ByteString value) { throw new NullPointerException(); } checkByteStringIsUtf8(value); - topic_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - // @@protoc_insertion_point(builder_scope:google.pubsub.v1.GetTopicRequest) } @@ -632,7 +582,18 @@ public GetTopicRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new GetTopicRequest(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/GetTopicRequestOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/GetTopicRequestOrBuilder.java index b3695fc5a..29713e8fc 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/GetTopicRequestOrBuilder.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/GetTopicRequestOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; +@com.google.protobuf.Generated public interface GetTopicRequestOrBuilder extends // @@protoc_insertion_point(interface_extends:google.pubsub.v1.GetTopicRequest) @@ -38,6 +41,7 @@ public interface GetTopicRequestOrBuilder * @return The topic. */ java.lang.String getTopic(); + /** * * 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 new file mode 100644 index 000000000..2eb76d04b --- /dev/null +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/IngestionDataSourceSettings.java @@ -0,0 +1,15117 @@ +/* + * Copyright 2026 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 + +package com.google.pubsub.v1; + +/** + * + * + *
    + * Settings for an ingestion data source on a topic.
    + * 
    + * + * Protobuf type {@code google.pubsub.v1.IngestionDataSourceSettings} + */ +@com.google.protobuf.Generated +public final class IngestionDataSourceSettings extends com.google.protobuf.GeneratedMessage + implements + // @@protoc_insertion_point(message_implements:google.pubsub.v1.IngestionDataSourceSettings) + IngestionDataSourceSettingsOrBuilder { + private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "IngestionDataSourceSettings"); + } + + // Use IngestionDataSourceSettings.newBuilder() to construct. + private IngestionDataSourceSettings(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + + private IngestionDataSourceSettings() {} + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionDataSourceSettings_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionDataSourceSettings_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.IngestionDataSourceSettings.class, + com.google.pubsub.v1.IngestionDataSourceSettings.Builder.class); + } + + public interface AwsKinesisOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
    +     * Output only. An output-only field that indicates the state of the Kinesis
    +     * ingestion source.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for state. + */ + int getStateValue(); + + /** + * + * + *
    +     * Output only. An output-only field that indicates the state of the Kinesis
    +     * ingestion source.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The state. + */ + com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.State getState(); + + /** + * + * + *
    +     * Required. The Kinesis stream ARN to ingest data from.
    +     * 
    + * + * string stream_arn = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The streamArn. + */ + java.lang.String getStreamArn(); + + /** + * + * + *
    +     * Required. The Kinesis stream ARN to ingest data from.
    +     * 
    + * + * string stream_arn = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for streamArn. + */ + com.google.protobuf.ByteString getStreamArnBytes(); + + /** + * + * + *
    +     * Required. The Kinesis consumer ARN to used for ingestion in Enhanced
    +     * Fan-Out mode. The consumer must be already created and ready to be used.
    +     * 
    + * + * string consumer_arn = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The consumerArn. + */ + java.lang.String getConsumerArn(); + + /** + * + * + *
    +     * Required. The Kinesis consumer ARN to used for ingestion in Enhanced
    +     * Fan-Out mode. The consumer must be already created and ready to be used.
    +     * 
    + * + * string consumer_arn = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for consumerArn. + */ + com.google.protobuf.ByteString getConsumerArnBytes(); + + /** + * + * + *
    +     * Required. AWS role ARN to be used for Federated Identity authentication
    +     * with Kinesis. Check the Pub/Sub docs for how to set up this role and the
    +     * required permissions that need to be attached to it.
    +     * 
    + * + * string aws_role_arn = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The awsRoleArn. + */ + java.lang.String getAwsRoleArn(); + + /** + * + * + *
    +     * Required. AWS role ARN to be used for Federated Identity authentication
    +     * with Kinesis. Check the Pub/Sub docs for how to set up this role and the
    +     * required permissions that need to be attached to it.
    +     * 
    + * + * string aws_role_arn = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for awsRoleArn. + */ + com.google.protobuf.ByteString getAwsRoleArnBytes(); + + /** + * + * + *
    +     * Required. The GCP service account to be used for Federated Identity
    +     * authentication with Kinesis (via a `AssumeRoleWithWebIdentity` call for
    +     * the provided role). The `aws_role_arn` must be set up with
    +     * `accounts.google.com:sub` equals to this service account number.
    +     * 
    + * + * string gcp_service_account = 5 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The gcpServiceAccount. + */ + java.lang.String getGcpServiceAccount(); + + /** + * + * + *
    +     * Required. The GCP service account to be used for Federated Identity
    +     * authentication with Kinesis (via a `AssumeRoleWithWebIdentity` call for
    +     * the provided role). The `aws_role_arn` must be set up with
    +     * `accounts.google.com:sub` equals to this service account number.
    +     * 
    + * + * string gcp_service_account = 5 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for gcpServiceAccount. + */ + com.google.protobuf.ByteString getGcpServiceAccountBytes(); + } + + /** + * + * + *
    +   * Ingestion settings for Amazon Kinesis Data Streams.
    +   * 
    + * + * Protobuf type {@code google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis} + */ + public static final class AwsKinesis extends com.google.protobuf.GeneratedMessage + implements + // @@protoc_insertion_point(message_implements:google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis) + AwsKinesisOrBuilder { + private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "AwsKinesis"); + } + + // Use AwsKinesis.newBuilder() to construct. + private AwsKinesis(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + + private AwsKinesis() { + state_ = 0; + streamArn_ = ""; + consumerArn_ = ""; + awsRoleArn_ = ""; + gcpServiceAccount_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionDataSourceSettings_AwsKinesis_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionDataSourceSettings_AwsKinesis_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.class, + com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.Builder.class); + } + + /** + * + * + *
    +     * Possible states for ingestion from Amazon Kinesis Data Streams.
    +     * 
    + * + * Protobuf enum {@code google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.State} + */ + public enum State implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
    +       * Default value. This value is unused.
    +       * 
    + * + * STATE_UNSPECIFIED = 0; + */ + STATE_UNSPECIFIED(0), + /** + * + * + *
    +       * Ingestion is active.
    +       * 
    + * + * ACTIVE = 1; + */ + ACTIVE(1), + /** + * + * + *
    +       * Permission denied encountered while consuming data from Kinesis.
    +       * This can happen if:
    +       * - The provided `aws_role_arn` does not exist or does not have the
    +       * appropriate permissions attached.
    +       * - The provided `aws_role_arn` is not set up properly for Identity
    +       * Federation using `gcp_service_account`.
    +       * - The Pub/Sub SA is not granted the
    +       * `iam.serviceAccounts.getOpenIdToken` permission on
    +       * `gcp_service_account`.
    +       * 
    + * + * KINESIS_PERMISSION_DENIED = 2; + */ + KINESIS_PERMISSION_DENIED(2), + /** + * + * + *
    +       * Permission denied encountered while publishing to the topic. This can
    +       * happen if the Pub/Sub SA has not been granted the [appropriate publish
    +       * permissions](https://cloud.google.com/pubsub/docs/access-control#pubsub.publisher)
    +       * 
    + * + * PUBLISH_PERMISSION_DENIED = 3; + */ + PUBLISH_PERMISSION_DENIED(3), + /** + * + * + *
    +       * The Kinesis stream does not exist.
    +       * 
    + * + * STREAM_NOT_FOUND = 4; + */ + STREAM_NOT_FOUND(4), + /** + * + * + *
    +       * The Kinesis consumer does not exist.
    +       * 
    + * + * CONSUMER_NOT_FOUND = 5; + */ + CONSUMER_NOT_FOUND(5), + UNRECOGNIZED(-1), + ; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "State"); + } + + /** + * + * + *
    +       * Default value. This value is unused.
    +       * 
    + * + * STATE_UNSPECIFIED = 0; + */ + public static final int STATE_UNSPECIFIED_VALUE = 0; + + /** + * + * + *
    +       * Ingestion is active.
    +       * 
    + * + * ACTIVE = 1; + */ + public static final int ACTIVE_VALUE = 1; + + /** + * + * + *
    +       * Permission denied encountered while consuming data from Kinesis.
    +       * This can happen if:
    +       * - The provided `aws_role_arn` does not exist or does not have the
    +       * appropriate permissions attached.
    +       * - The provided `aws_role_arn` is not set up properly for Identity
    +       * Federation using `gcp_service_account`.
    +       * - The Pub/Sub SA is not granted the
    +       * `iam.serviceAccounts.getOpenIdToken` permission on
    +       * `gcp_service_account`.
    +       * 
    + * + * KINESIS_PERMISSION_DENIED = 2; + */ + public static final int KINESIS_PERMISSION_DENIED_VALUE = 2; + + /** + * + * + *
    +       * Permission denied encountered while publishing to the topic. This can
    +       * happen if the Pub/Sub SA has not been granted the [appropriate publish
    +       * permissions](https://cloud.google.com/pubsub/docs/access-control#pubsub.publisher)
    +       * 
    + * + * PUBLISH_PERMISSION_DENIED = 3; + */ + public static final int PUBLISH_PERMISSION_DENIED_VALUE = 3; + + /** + * + * + *
    +       * The Kinesis stream does not exist.
    +       * 
    + * + * STREAM_NOT_FOUND = 4; + */ + public static final int STREAM_NOT_FOUND_VALUE = 4; + + /** + * + * + *
    +       * The Kinesis consumer does not exist.
    +       * 
    + * + * CONSUMER_NOT_FOUND = 5; + */ + public static final int CONSUMER_NOT_FOUND_VALUE = 5; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static State valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static State forNumber(int value) { + switch (value) { + case 0: + return STATE_UNSPECIFIED; + case 1: + return ACTIVE; + case 2: + return KINESIS_PERMISSION_DENIED; + case 3: + return PUBLISH_PERMISSION_DENIED; + case 4: + return STREAM_NOT_FOUND; + case 5: + return CONSUMER_NOT_FOUND; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public State findValueByNumber(int number) { + return State.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.getDescriptor() + .getEnumTypes() + .get(0); + } + + private static final State[] VALUES = values(); + + public static State valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private State(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.State) + } + + public static final int STATE_FIELD_NUMBER = 1; + private int state_ = 0; + + /** + * + * + *
    +     * Output only. An output-only field that indicates the state of the Kinesis
    +     * ingestion source.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for state. + */ + @java.lang.Override + public int getStateValue() { + return state_; + } + + /** + * + * + *
    +     * Output only. An output-only field that indicates the state of the Kinesis
    +     * ingestion source.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The state. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.State getState() { + com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.State result = + com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.State.forNumber(state_); + return result == null + ? com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.State.UNRECOGNIZED + : result; + } + + public static final int STREAM_ARN_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private volatile java.lang.Object streamArn_ = ""; + + /** + * + * + *
    +     * Required. The Kinesis stream ARN to ingest data from.
    +     * 
    + * + * string stream_arn = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The streamArn. + */ + @java.lang.Override + public java.lang.String getStreamArn() { + java.lang.Object ref = streamArn_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + streamArn_ = s; + return s; + } + } + + /** + * + * + *
    +     * Required. The Kinesis stream ARN to ingest data from.
    +     * 
    + * + * string stream_arn = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for streamArn. + */ + @java.lang.Override + public com.google.protobuf.ByteString getStreamArnBytes() { + java.lang.Object ref = streamArn_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + streamArn_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CONSUMER_ARN_FIELD_NUMBER = 3; + + @SuppressWarnings("serial") + private volatile java.lang.Object consumerArn_ = ""; + + /** + * + * + *
    +     * Required. The Kinesis consumer ARN to used for ingestion in Enhanced
    +     * Fan-Out mode. The consumer must be already created and ready to be used.
    +     * 
    + * + * string consumer_arn = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The consumerArn. + */ + @java.lang.Override + public java.lang.String getConsumerArn() { + java.lang.Object ref = consumerArn_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + consumerArn_ = s; + return s; + } + } + + /** + * + * + *
    +     * Required. The Kinesis consumer ARN to used for ingestion in Enhanced
    +     * Fan-Out mode. The consumer must be already created and ready to be used.
    +     * 
    + * + * string consumer_arn = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for consumerArn. + */ + @java.lang.Override + public com.google.protobuf.ByteString getConsumerArnBytes() { + java.lang.Object ref = consumerArn_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + consumerArn_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int AWS_ROLE_ARN_FIELD_NUMBER = 4; + + @SuppressWarnings("serial") + private volatile java.lang.Object awsRoleArn_ = ""; + + /** + * + * + *
    +     * Required. AWS role ARN to be used for Federated Identity authentication
    +     * with Kinesis. Check the Pub/Sub docs for how to set up this role and the
    +     * required permissions that need to be attached to it.
    +     * 
    + * + * string aws_role_arn = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The awsRoleArn. + */ + @java.lang.Override + public java.lang.String getAwsRoleArn() { + java.lang.Object ref = awsRoleArn_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + awsRoleArn_ = s; + return s; + } + } + + /** + * + * + *
    +     * Required. AWS role ARN to be used for Federated Identity authentication
    +     * with Kinesis. Check the Pub/Sub docs for how to set up this role and the
    +     * required permissions that need to be attached to it.
    +     * 
    + * + * string aws_role_arn = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for awsRoleArn. + */ + @java.lang.Override + public com.google.protobuf.ByteString getAwsRoleArnBytes() { + java.lang.Object ref = awsRoleArn_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + awsRoleArn_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int GCP_SERVICE_ACCOUNT_FIELD_NUMBER = 5; + + @SuppressWarnings("serial") + private volatile java.lang.Object gcpServiceAccount_ = ""; + + /** + * + * + *
    +     * Required. The GCP service account to be used for Federated Identity
    +     * authentication with Kinesis (via a `AssumeRoleWithWebIdentity` call for
    +     * the provided role). The `aws_role_arn` must be set up with
    +     * `accounts.google.com:sub` equals to this service account number.
    +     * 
    + * + * string gcp_service_account = 5 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The gcpServiceAccount. + */ + @java.lang.Override + public java.lang.String getGcpServiceAccount() { + java.lang.Object ref = gcpServiceAccount_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + gcpServiceAccount_ = s; + return s; + } + } + + /** + * + * + *
    +     * Required. The GCP service account to be used for Federated Identity
    +     * authentication with Kinesis (via a `AssumeRoleWithWebIdentity` call for
    +     * the provided role). The `aws_role_arn` must be set up with
    +     * `accounts.google.com:sub` equals to this service account number.
    +     * 
    + * + * string gcp_service_account = 5 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for gcpServiceAccount. + */ + @java.lang.Override + public com.google.protobuf.ByteString getGcpServiceAccountBytes() { + java.lang.Object ref = gcpServiceAccount_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + gcpServiceAccount_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (state_ + != com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.State.STATE_UNSPECIFIED + .getNumber()) { + output.writeEnum(1, state_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(streamArn_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, streamArn_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(consumerArn_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 3, consumerArn_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(awsRoleArn_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 4, awsRoleArn_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(gcpServiceAccount_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 5, gcpServiceAccount_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (state_ + != com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.State.STATE_UNSPECIFIED + .getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, state_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(streamArn_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, streamArn_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(consumerArn_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(3, consumerArn_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(awsRoleArn_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(4, awsRoleArn_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(gcpServiceAccount_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(5, gcpServiceAccount_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis)) { + return super.equals(obj); + } + com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis other = + (com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis) obj; + + if (state_ != other.state_) return false; + if (!getStreamArn().equals(other.getStreamArn())) return false; + if (!getConsumerArn().equals(other.getConsumerArn())) return false; + if (!getAwsRoleArn().equals(other.getAwsRoleArn())) return false; + if (!getGcpServiceAccount().equals(other.getGcpServiceAccount())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + STATE_FIELD_NUMBER; + hash = (53 * hash) + state_; + hash = (37 * hash) + STREAM_ARN_FIELD_NUMBER; + hash = (53 * hash) + getStreamArn().hashCode(); + hash = (37 * hash) + CONSUMER_ARN_FIELD_NUMBER; + hash = (53 * hash) + getConsumerArn().hashCode(); + hash = (37 * hash) + AWS_ROLE_ARN_FIELD_NUMBER; + hash = (53 * hash) + getAwsRoleArn().hashCode(); + hash = (37 * hash) + GCP_SERVICE_ACCOUNT_FIELD_NUMBER; + hash = (53 * hash) + getGcpServiceAccount().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + + /** + * + * + *
    +     * Ingestion settings for Amazon Kinesis Data Streams.
    +     * 
    + * + * Protobuf type {@code google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder + implements + // @@protoc_insertion_point(builder_implements:google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis) + com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesisOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionDataSourceSettings_AwsKinesis_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionDataSourceSettings_AwsKinesis_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.class, + com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.Builder.class); + } + + // Construct using com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + state_ = 0; + streamArn_ = ""; + consumerArn_ = ""; + awsRoleArn_ = ""; + gcpServiceAccount_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionDataSourceSettings_AwsKinesis_descriptor; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis + getDefaultInstanceForType() { + return com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.getDefaultInstance(); + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis build() { + com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis buildPartial() { + com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis result = + new com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0( + com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.state_ = state_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.streamArn_ = streamArn_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.consumerArn_ = consumerArn_; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.awsRoleArn_ = awsRoleArn_; + } + if (((from_bitField0_ & 0x00000010) != 0)) { + result.gcpServiceAccount_ = gcpServiceAccount_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis) { + return mergeFrom((com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis other) { + if (other + == com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.getDefaultInstance()) + return this; + if (other.state_ != 0) { + setStateValue(other.getStateValue()); + } + if (!other.getStreamArn().isEmpty()) { + streamArn_ = other.streamArn_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (!other.getConsumerArn().isEmpty()) { + consumerArn_ = other.consumerArn_; + bitField0_ |= 0x00000004; + onChanged(); + } + if (!other.getAwsRoleArn().isEmpty()) { + awsRoleArn_ = other.awsRoleArn_; + bitField0_ |= 0x00000008; + onChanged(); + } + if (!other.getGcpServiceAccount().isEmpty()) { + gcpServiceAccount_ = other.gcpServiceAccount_; + bitField0_ |= 0x00000010; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: + { + state_ = input.readEnum(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 18: + { + streamArn_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: + { + consumerArn_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000004; + break; + } // case 26 + case 34: + { + awsRoleArn_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000008; + break; + } // case 34 + case 42: + { + gcpServiceAccount_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000010; + break; + } // case 42 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private int state_ = 0; + + /** + * + * + *
    +       * Output only. An output-only field that indicates the state of the Kinesis
    +       * ingestion source.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for state. + */ + @java.lang.Override + public int getStateValue() { + return state_; + } + + /** + * + * + *
    +       * Output only. An output-only field that indicates the state of the Kinesis
    +       * ingestion source.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The enum numeric value on the wire for state to set. + * @return This builder for chaining. + */ + public Builder setStateValue(int value) { + state_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Output only. An output-only field that indicates the state of the Kinesis
    +       * ingestion source.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The state. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.State getState() { + com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.State result = + com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.State.forNumber(state_); + return result == null + ? com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.State.UNRECOGNIZED + : result; + } + + /** + * + * + *
    +       * Output only. An output-only field that indicates the state of the Kinesis
    +       * ingestion source.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The state to set. + * @return This builder for chaining. + */ + public Builder setState( + com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.State value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + state_ = value.getNumber(); + onChanged(); + return this; + } + + /** + * + * + *
    +       * Output only. An output-only field that indicates the state of the Kinesis
    +       * ingestion source.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return This builder for chaining. + */ + public Builder clearState() { + bitField0_ = (bitField0_ & ~0x00000001); + state_ = 0; + onChanged(); + return this; + } + + private java.lang.Object streamArn_ = ""; + + /** + * + * + *
    +       * Required. The Kinesis stream ARN to ingest data from.
    +       * 
    + * + * string stream_arn = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The streamArn. + */ + public java.lang.String getStreamArn() { + java.lang.Object ref = streamArn_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + streamArn_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +       * Required. The Kinesis stream ARN to ingest data from.
    +       * 
    + * + * string stream_arn = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for streamArn. + */ + public com.google.protobuf.ByteString getStreamArnBytes() { + java.lang.Object ref = streamArn_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + streamArn_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +       * Required. The Kinesis stream ARN to ingest data from.
    +       * 
    + * + * string stream_arn = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The streamArn to set. + * @return This builder for chaining. + */ + public Builder setStreamArn(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + streamArn_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Required. The Kinesis stream ARN to ingest data from.
    +       * 
    + * + * string stream_arn = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearStreamArn() { + streamArn_ = getDefaultInstance().getStreamArn(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + + /** + * + * + *
    +       * Required. The Kinesis stream ARN to ingest data from.
    +       * 
    + * + * string stream_arn = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for streamArn to set. + * @return This builder for chaining. + */ + public Builder setStreamArnBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + streamArn_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private java.lang.Object consumerArn_ = ""; + + /** + * + * + *
    +       * Required. The Kinesis consumer ARN to used for ingestion in Enhanced
    +       * Fan-Out mode. The consumer must be already created and ready to be used.
    +       * 
    + * + * string consumer_arn = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The consumerArn. + */ + public java.lang.String getConsumerArn() { + java.lang.Object ref = consumerArn_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + consumerArn_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +       * Required. The Kinesis consumer ARN to used for ingestion in Enhanced
    +       * Fan-Out mode. The consumer must be already created and ready to be used.
    +       * 
    + * + * string consumer_arn = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for consumerArn. + */ + public com.google.protobuf.ByteString getConsumerArnBytes() { + java.lang.Object ref = consumerArn_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + consumerArn_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +       * Required. The Kinesis consumer ARN to used for ingestion in Enhanced
    +       * Fan-Out mode. The consumer must be already created and ready to be used.
    +       * 
    + * + * string consumer_arn = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The consumerArn to set. + * @return This builder for chaining. + */ + public Builder setConsumerArn(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + consumerArn_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Required. The Kinesis consumer ARN to used for ingestion in Enhanced
    +       * Fan-Out mode. The consumer must be already created and ready to be used.
    +       * 
    + * + * string consumer_arn = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearConsumerArn() { + consumerArn_ = getDefaultInstance().getConsumerArn(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + + /** + * + * + *
    +       * Required. The Kinesis consumer ARN to used for ingestion in Enhanced
    +       * Fan-Out mode. The consumer must be already created and ready to be used.
    +       * 
    + * + * string consumer_arn = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for consumerArn to set. + * @return This builder for chaining. + */ + public Builder setConsumerArnBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + consumerArn_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + private java.lang.Object awsRoleArn_ = ""; + + /** + * + * + *
    +       * Required. AWS role ARN to be used for Federated Identity authentication
    +       * with Kinesis. Check the Pub/Sub docs for how to set up this role and the
    +       * required permissions that need to be attached to it.
    +       * 
    + * + * string aws_role_arn = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The awsRoleArn. + */ + public java.lang.String getAwsRoleArn() { + java.lang.Object ref = awsRoleArn_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + awsRoleArn_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +       * Required. AWS role ARN to be used for Federated Identity authentication
    +       * with Kinesis. Check the Pub/Sub docs for how to set up this role and the
    +       * required permissions that need to be attached to it.
    +       * 
    + * + * string aws_role_arn = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for awsRoleArn. + */ + public com.google.protobuf.ByteString getAwsRoleArnBytes() { + java.lang.Object ref = awsRoleArn_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + awsRoleArn_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +       * Required. AWS role ARN to be used for Federated Identity authentication
    +       * with Kinesis. Check the Pub/Sub docs for how to set up this role and the
    +       * required permissions that need to be attached to it.
    +       * 
    + * + * string aws_role_arn = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The awsRoleArn to set. + * @return This builder for chaining. + */ + public Builder setAwsRoleArn(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + awsRoleArn_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Required. AWS role ARN to be used for Federated Identity authentication
    +       * with Kinesis. Check the Pub/Sub docs for how to set up this role and the
    +       * required permissions that need to be attached to it.
    +       * 
    + * + * string aws_role_arn = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearAwsRoleArn() { + awsRoleArn_ = getDefaultInstance().getAwsRoleArn(); + bitField0_ = (bitField0_ & ~0x00000008); + onChanged(); + return this; + } + + /** + * + * + *
    +       * Required. AWS role ARN to be used for Federated Identity authentication
    +       * with Kinesis. Check the Pub/Sub docs for how to set up this role and the
    +       * required permissions that need to be attached to it.
    +       * 
    + * + * string aws_role_arn = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for awsRoleArn to set. + * @return This builder for chaining. + */ + public Builder setAwsRoleArnBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + awsRoleArn_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + + private java.lang.Object gcpServiceAccount_ = ""; + + /** + * + * + *
    +       * Required. The GCP service account to be used for Federated Identity
    +       * authentication with Kinesis (via a `AssumeRoleWithWebIdentity` call for
    +       * the provided role). The `aws_role_arn` must be set up with
    +       * `accounts.google.com:sub` equals to this service account number.
    +       * 
    + * + * string gcp_service_account = 5 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The gcpServiceAccount. + */ + public java.lang.String getGcpServiceAccount() { + java.lang.Object ref = gcpServiceAccount_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + gcpServiceAccount_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +       * Required. The GCP service account to be used for Federated Identity
    +       * authentication with Kinesis (via a `AssumeRoleWithWebIdentity` call for
    +       * the provided role). The `aws_role_arn` must be set up with
    +       * `accounts.google.com:sub` equals to this service account number.
    +       * 
    + * + * string gcp_service_account = 5 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for gcpServiceAccount. + */ + public com.google.protobuf.ByteString getGcpServiceAccountBytes() { + java.lang.Object ref = gcpServiceAccount_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + gcpServiceAccount_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +       * Required. The GCP service account to be used for Federated Identity
    +       * authentication with Kinesis (via a `AssumeRoleWithWebIdentity` call for
    +       * the provided role). The `aws_role_arn` must be set up with
    +       * `accounts.google.com:sub` equals to this service account number.
    +       * 
    + * + * string gcp_service_account = 5 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The gcpServiceAccount to set. + * @return This builder for chaining. + */ + public Builder setGcpServiceAccount(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + gcpServiceAccount_ = value; + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Required. The GCP service account to be used for Federated Identity
    +       * authentication with Kinesis (via a `AssumeRoleWithWebIdentity` call for
    +       * the provided role). The `aws_role_arn` must be set up with
    +       * `accounts.google.com:sub` equals to this service account number.
    +       * 
    + * + * string gcp_service_account = 5 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearGcpServiceAccount() { + gcpServiceAccount_ = getDefaultInstance().getGcpServiceAccount(); + bitField0_ = (bitField0_ & ~0x00000010); + onChanged(); + return this; + } + + /** + * + * + *
    +       * Required. The GCP service account to be used for Federated Identity
    +       * authentication with Kinesis (via a `AssumeRoleWithWebIdentity` call for
    +       * the provided role). The `aws_role_arn` must be set up with
    +       * `accounts.google.com:sub` equals to this service account number.
    +       * 
    + * + * string gcp_service_account = 5 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for gcpServiceAccount to set. + * @return This builder for chaining. + */ + public Builder setGcpServiceAccountBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + gcpServiceAccount_ = value; + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis) + } + + // @@protoc_insertion_point(class_scope:google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis) + private static final com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis(); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AwsKinesis parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException() + .setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public interface CloudStorageOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.pubsub.v1.IngestionDataSourceSettings.CloudStorage) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
    +     * Output only. An output-only field that indicates the state of the Cloud
    +     * Storage ingestion source.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for state. + */ + int getStateValue(); + + /** + * + * + *
    +     * Output only. An output-only field that indicates the state of the Cloud
    +     * Storage ingestion source.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The state. + */ + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.State getState(); + + /** + * + * + *
    +     * Optional. Cloud Storage bucket. The bucket name must be without any
    +     * prefix like "gs://". See the [bucket naming requirements]
    +     * (https://cloud.google.com/storage/docs/buckets#naming).
    +     * 
    + * + * string bucket = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bucket. + */ + java.lang.String getBucket(); + + /** + * + * + *
    +     * Optional. Cloud Storage bucket. The bucket name must be without any
    +     * prefix like "gs://". See the [bucket naming requirements]
    +     * (https://cloud.google.com/storage/docs/buckets#naming).
    +     * 
    + * + * string bucket = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for bucket. + */ + com.google.protobuf.ByteString getBucketBytes(); + + /** + * + * + *
    +     * Optional. Data from Cloud Storage will be interpreted as text.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat text_format = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the textFormat field is set. + */ + boolean hasTextFormat(); + + /** + * + * + *
    +     * Optional. Data from Cloud Storage will be interpreted as text.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat text_format = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The textFormat. + */ + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat getTextFormat(); + + /** + * + * + *
    +     * Optional. Data from Cloud Storage will be interpreted as text.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat text_format = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormatOrBuilder + getTextFormatOrBuilder(); + + /** + * + * + *
    +     * Optional. Data from Cloud Storage will be interpreted in Avro format.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat avro_format = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the avroFormat field is set. + */ + boolean hasAvroFormat(); + + /** + * + * + *
    +     * Optional. Data from Cloud Storage will be interpreted in Avro format.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat avro_format = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The avroFormat. + */ + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat getAvroFormat(); + + /** + * + * + *
    +     * Optional. Data from Cloud Storage will be interpreted in Avro format.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat avro_format = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormatOrBuilder + getAvroFormatOrBuilder(); + + /** + * + * + *
    +     * Optional. It will be assumed data from Cloud Storage was written via
    +     * [Cloud Storage
    +     * subscriptions](https://cloud.google.com/pubsub/docs/cloudstorage).
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat pubsub_avro_format = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the pubsubAvroFormat field is set. + */ + boolean hasPubsubAvroFormat(); + + /** + * + * + *
    +     * Optional. It will be assumed data from Cloud Storage was written via
    +     * [Cloud Storage
    +     * subscriptions](https://cloud.google.com/pubsub/docs/cloudstorage).
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat pubsub_avro_format = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The pubsubAvroFormat. + */ + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat + getPubsubAvroFormat(); + + /** + * + * + *
    +     * Optional. It will be assumed data from Cloud Storage was written via
    +     * [Cloud Storage
    +     * subscriptions](https://cloud.google.com/pubsub/docs/cloudstorage).
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat pubsub_avro_format = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormatOrBuilder + getPubsubAvroFormatOrBuilder(); + + /** + * + * + *
    +     * Optional. Only objects with a larger or equal creation timestamp will be
    +     * ingested.
    +     * 
    + * + * + * .google.protobuf.Timestamp minimum_object_create_time = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the minimumObjectCreateTime field is set. + */ + boolean hasMinimumObjectCreateTime(); + + /** + * + * + *
    +     * Optional. Only objects with a larger or equal creation timestamp will be
    +     * ingested.
    +     * 
    + * + * + * .google.protobuf.Timestamp minimum_object_create_time = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The minimumObjectCreateTime. + */ + com.google.protobuf.Timestamp getMinimumObjectCreateTime(); + + /** + * + * + *
    +     * Optional. Only objects with a larger or equal creation timestamp will be
    +     * ingested.
    +     * 
    + * + * + * .google.protobuf.Timestamp minimum_object_create_time = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.protobuf.TimestampOrBuilder getMinimumObjectCreateTimeOrBuilder(); + + /** + * + * + *
    +     * Optional. Glob pattern used to match objects that will be ingested. If
    +     * unset, all objects will be ingested. See the [supported
    +     * patterns](https://cloud.google.com/storage/docs/json_api/v1/objects/list#list-objects-and-prefixes-using-glob).
    +     * 
    + * + * string match_glob = 9 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The matchGlob. + */ + java.lang.String getMatchGlob(); + + /** + * + * + *
    +     * Optional. Glob pattern used to match objects that will be ingested. If
    +     * unset, all objects will be ingested. See the [supported
    +     * patterns](https://cloud.google.com/storage/docs/json_api/v1/objects/list#list-objects-and-prefixes-using-glob).
    +     * 
    + * + * string match_glob = 9 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for matchGlob. + */ + com.google.protobuf.ByteString getMatchGlobBytes(); + + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.InputFormatCase + getInputFormatCase(); + } + + /** + * + * + *
    +   * Ingestion settings for Cloud Storage.
    +   * 
    + * + * Protobuf type {@code google.pubsub.v1.IngestionDataSourceSettings.CloudStorage} + */ + public static final class CloudStorage extends com.google.protobuf.GeneratedMessage + implements + // @@protoc_insertion_point(message_implements:google.pubsub.v1.IngestionDataSourceSettings.CloudStorage) + CloudStorageOrBuilder { + private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "CloudStorage"); + } + + // Use CloudStorage.newBuilder() to construct. + private CloudStorage(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + + private CloudStorage() { + state_ = 0; + bucket_ = ""; + matchGlob_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionDataSourceSettings_CloudStorage_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionDataSourceSettings_CloudStorage_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.class, + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.Builder.class); + } + + /** + * + * + *
    +     * Possible states for ingestion from Cloud Storage.
    +     * 
    + * + * Protobuf enum {@code google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.State} + */ + public enum State implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
    +       * Default value. This value is unused.
    +       * 
    + * + * STATE_UNSPECIFIED = 0; + */ + STATE_UNSPECIFIED(0), + /** + * + * + *
    +       * Ingestion is active.
    +       * 
    + * + * ACTIVE = 1; + */ + ACTIVE(1), + /** + * + * + *
    +       * Permission denied encountered while calling the Cloud Storage API. This
    +       * can happen if the Pub/Sub SA has not been granted the
    +       * [appropriate
    +       * permissions](https://cloud.google.com/storage/docs/access-control/iam-permissions):
    +       * - storage.objects.list: to list the objects in a bucket.
    +       * - storage.objects.get: to read the objects in a bucket.
    +       * - storage.buckets.get: to verify the bucket exists.
    +       * 
    + * + * CLOUD_STORAGE_PERMISSION_DENIED = 2; + */ + CLOUD_STORAGE_PERMISSION_DENIED(2), + /** + * + * + *
    +       * Permission denied encountered while publishing to the topic. This can
    +       * happen if the Pub/Sub SA has not been granted the [appropriate publish
    +       * permissions](https://cloud.google.com/pubsub/docs/access-control#pubsub.publisher)
    +       * 
    + * + * PUBLISH_PERMISSION_DENIED = 3; + */ + PUBLISH_PERMISSION_DENIED(3), + /** + * + * + *
    +       * The provided Cloud Storage bucket doesn't exist.
    +       * 
    + * + * BUCKET_NOT_FOUND = 4; + */ + BUCKET_NOT_FOUND(4), + /** + * + * + *
    +       * The Cloud Storage bucket has too many objects, ingestion will be
    +       * paused.
    +       * 
    + * + * TOO_MANY_OBJECTS = 5; + */ + TOO_MANY_OBJECTS(5), + UNRECOGNIZED(-1), + ; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "State"); + } + + /** + * + * + *
    +       * Default value. This value is unused.
    +       * 
    + * + * STATE_UNSPECIFIED = 0; + */ + public static final int STATE_UNSPECIFIED_VALUE = 0; + + /** + * + * + *
    +       * Ingestion is active.
    +       * 
    + * + * ACTIVE = 1; + */ + public static final int ACTIVE_VALUE = 1; + + /** + * + * + *
    +       * Permission denied encountered while calling the Cloud Storage API. This
    +       * can happen if the Pub/Sub SA has not been granted the
    +       * [appropriate
    +       * permissions](https://cloud.google.com/storage/docs/access-control/iam-permissions):
    +       * - storage.objects.list: to list the objects in a bucket.
    +       * - storage.objects.get: to read the objects in a bucket.
    +       * - storage.buckets.get: to verify the bucket exists.
    +       * 
    + * + * CLOUD_STORAGE_PERMISSION_DENIED = 2; + */ + public static final int CLOUD_STORAGE_PERMISSION_DENIED_VALUE = 2; + + /** + * + * + *
    +       * Permission denied encountered while publishing to the topic. This can
    +       * happen if the Pub/Sub SA has not been granted the [appropriate publish
    +       * permissions](https://cloud.google.com/pubsub/docs/access-control#pubsub.publisher)
    +       * 
    + * + * PUBLISH_PERMISSION_DENIED = 3; + */ + public static final int PUBLISH_PERMISSION_DENIED_VALUE = 3; + + /** + * + * + *
    +       * The provided Cloud Storage bucket doesn't exist.
    +       * 
    + * + * BUCKET_NOT_FOUND = 4; + */ + public static final int BUCKET_NOT_FOUND_VALUE = 4; + + /** + * + * + *
    +       * The Cloud Storage bucket has too many objects, ingestion will be
    +       * paused.
    +       * 
    + * + * TOO_MANY_OBJECTS = 5; + */ + public static final int TOO_MANY_OBJECTS_VALUE = 5; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static State valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static State forNumber(int value) { + switch (value) { + case 0: + return STATE_UNSPECIFIED; + case 1: + return ACTIVE; + case 2: + return CLOUD_STORAGE_PERMISSION_DENIED; + case 3: + return PUBLISH_PERMISSION_DENIED; + case 4: + return BUCKET_NOT_FOUND; + case 5: + return TOO_MANY_OBJECTS; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public State findValueByNumber(int number) { + return State.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.getDescriptor() + .getEnumTypes() + .get(0); + } + + private static final State[] VALUES = values(); + + public static State valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private State(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.State) + } + + public interface TextFormatOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
    +       * Optional. When unset, '\n' is used.
    +       * 
    + * + * optional string delimiter = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return Whether the delimiter field is set. + */ + boolean hasDelimiter(); + + /** + * + * + *
    +       * Optional. When unset, '\n' is used.
    +       * 
    + * + * optional string delimiter = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The delimiter. + */ + java.lang.String getDelimiter(); + + /** + * + * + *
    +       * Optional. When unset, '\n' is used.
    +       * 
    + * + * optional string delimiter = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for delimiter. + */ + com.google.protobuf.ByteString getDelimiterBytes(); + } + + /** + * + * + *
    +     * Configuration for reading Cloud Storage data in text format. Each line of
    +     * text as specified by the delimiter will be set to the `data` field of a
    +     * Pub/Sub message.
    +     * 
    + * + * Protobuf type {@code google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat} + */ + public static final class TextFormat extends com.google.protobuf.GeneratedMessage + implements + // @@protoc_insertion_point(message_implements:google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat) + TextFormatOrBuilder { + private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "TextFormat"); + } + + // Use TextFormat.newBuilder() to construct. + private TextFormat(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + + private TextFormat() { + delimiter_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionDataSourceSettings_CloudStorage_TextFormat_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionDataSourceSettings_CloudStorage_TextFormat_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat.class, + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat.Builder + .class); + } + + private int bitField0_; + public static final int DELIMITER_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object delimiter_ = ""; + + /** + * + * + *
    +       * Optional. When unset, '\n' is used.
    +       * 
    + * + * optional string delimiter = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return Whether the delimiter field is set. + */ + @java.lang.Override + public boolean hasDelimiter() { + return ((bitField0_ & 0x00000001) != 0); + } + + /** + * + * + *
    +       * Optional. When unset, '\n' is used.
    +       * 
    + * + * optional string delimiter = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The delimiter. + */ + @java.lang.Override + public java.lang.String getDelimiter() { + java.lang.Object ref = delimiter_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + delimiter_ = s; + return s; + } + } + + /** + * + * + *
    +       * Optional. When unset, '\n' is used.
    +       * 
    + * + * optional string delimiter = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for delimiter. + */ + @java.lang.Override + public com.google.protobuf.ByteString getDelimiterBytes() { + java.lang.Object ref = delimiter_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + delimiter_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (((bitField0_ & 0x00000001) != 0)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, delimiter_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, delimiter_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj + instanceof com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat)) { + return super.equals(obj); + } + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat other = + (com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat) obj; + + if (hasDelimiter() != other.hasDelimiter()) return false; + if (hasDelimiter()) { + if (!getDelimiter().equals(other.getDelimiter())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasDelimiter()) { + hash = (37 * hash) + DELIMITER_FIELD_NUMBER; + hash = (53 * hash) + getDelimiter().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat + parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat + parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat + parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat + parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat + parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat + parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat + parseFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat + parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat + parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat + parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat + parseFrom(com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat + parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + + /** + * + * + *
    +       * Configuration for reading Cloud Storage data in text format. Each line of
    +       * text as specified by the delimiter will be set to the `data` field of a
    +       * Pub/Sub message.
    +       * 
    + * + * Protobuf type {@code google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessage.Builder + implements + // @@protoc_insertion_point(builder_implements:google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat) + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormatOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionDataSourceSettings_CloudStorage_TextFormat_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionDataSourceSettings_CloudStorage_TextFormat_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat.class, + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat.Builder + .class); + } + + // Construct using + // com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + delimiter_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionDataSourceSettings_CloudStorage_TextFormat_descriptor; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat + getDefaultInstanceForType() { + return com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat + .getDefaultInstance(); + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat build() { + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat result = + buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat + buildPartial() { + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat result = + new com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0( + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat result) { + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.delimiter_ = delimiter_; + to_bitField0_ |= 0x00000001; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other + instanceof com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat) { + return mergeFrom( + (com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat other) { + if (other + == com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat + .getDefaultInstance()) return this; + if (other.hasDelimiter()) { + delimiter_ = other.delimiter_; + bitField0_ |= 0x00000001; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + delimiter_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.lang.Object delimiter_ = ""; + + /** + * + * + *
    +         * Optional. When unset, '\n' is used.
    +         * 
    + * + * optional string delimiter = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return Whether the delimiter field is set. + */ + public boolean hasDelimiter() { + return ((bitField0_ & 0x00000001) != 0); + } + + /** + * + * + *
    +         * Optional. When unset, '\n' is used.
    +         * 
    + * + * optional string delimiter = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The delimiter. + */ + public java.lang.String getDelimiter() { + java.lang.Object ref = delimiter_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + delimiter_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +         * Optional. When unset, '\n' is used.
    +         * 
    + * + * optional string delimiter = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for delimiter. + */ + public com.google.protobuf.ByteString getDelimiterBytes() { + java.lang.Object ref = delimiter_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + delimiter_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +         * Optional. When unset, '\n' is used.
    +         * 
    + * + * optional string delimiter = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The delimiter to set. + * @return This builder for chaining. + */ + public Builder setDelimiter(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + delimiter_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + /** + * + * + *
    +         * Optional. When unset, '\n' is used.
    +         * 
    + * + * optional string delimiter = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearDelimiter() { + delimiter_ = getDefaultInstance().getDelimiter(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + + /** + * + * + *
    +         * Optional. When unset, '\n' is used.
    +         * 
    + * + * optional string delimiter = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for delimiter to set. + * @return This builder for chaining. + */ + public Builder setDelimiterBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + delimiter_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat) + } + + // @@protoc_insertion_point(class_scope:google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat) + private static final com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = + new com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat(); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public TextFormat parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException() + .setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public interface AvroFormatOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat) + com.google.protobuf.MessageOrBuilder {} + + /** + * + * + *
    +     * Configuration for reading Cloud Storage data in Avro binary format. The
    +     * bytes of each object will be set to the `data` field of a Pub/Sub
    +     * message.
    +     * 
    + * + * Protobuf type {@code google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat} + */ + public static final class AvroFormat extends com.google.protobuf.GeneratedMessage + implements + // @@protoc_insertion_point(message_implements:google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat) + AvroFormatOrBuilder { + private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "AvroFormat"); + } + + // Use AvroFormat.newBuilder() to construct. + private AvroFormat(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + + private AvroFormat() {} + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionDataSourceSettings_CloudStorage_AvroFormat_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionDataSourceSettings_CloudStorage_AvroFormat_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat.class, + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat.Builder + .class); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj + instanceof com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat)) { + return super.equals(obj); + } + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat other = + (com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat) obj; + + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat + parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat + parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat + parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat + parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat + parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat + parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat + parseFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat + parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat + parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat + parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat + parseFrom(com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat + parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + + /** + * + * + *
    +       * Configuration for reading Cloud Storage data in Avro binary format. The
    +       * bytes of each object will be set to the `data` field of a Pub/Sub
    +       * message.
    +       * 
    + * + * Protobuf type {@code google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessage.Builder + implements + // @@protoc_insertion_point(builder_implements:google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat) + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormatOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionDataSourceSettings_CloudStorage_AvroFormat_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionDataSourceSettings_CloudStorage_AvroFormat_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat.class, + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat.Builder + .class); + } + + // Construct using + // com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionDataSourceSettings_CloudStorage_AvroFormat_descriptor; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat + getDefaultInstanceForType() { + return com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat + .getDefaultInstance(); + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat build() { + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat result = + buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat + buildPartial() { + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat result = + new com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat(this); + onBuilt(); + return result; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other + instanceof com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat) { + return mergeFrom( + (com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat other) { + if (other + == com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat + .getDefaultInstance()) return this; + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + // @@protoc_insertion_point(builder_scope:google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat) + } + + // @@protoc_insertion_point(class_scope:google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat) + private static final com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = + new com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat(); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AvroFormat parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException() + .setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public interface PubSubAvroFormatOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat) + com.google.protobuf.MessageOrBuilder {} + + /** + * + * + *
    +     * Configuration for reading Cloud Storage data written via [Cloud Storage
    +     * subscriptions](https://cloud.google.com/pubsub/docs/cloudstorage). The
    +     * data and attributes fields of the originally exported Pub/Sub message
    +     * will be restored when publishing.
    +     * 
    + * + * Protobuf type {@code + * google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat} + */ + public static final class PubSubAvroFormat extends com.google.protobuf.GeneratedMessage + implements + // @@protoc_insertion_point(message_implements:google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat) + PubSubAvroFormatOrBuilder { + private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "PubSubAvroFormat"); + } + + // Use PubSubAvroFormat.newBuilder() to construct. + private PubSubAvroFormat(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + + private PubSubAvroFormat() {} + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionDataSourceSettings_CloudStorage_PubSubAvroFormat_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionDataSourceSettings_CloudStorage_PubSubAvroFormat_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat + .class, + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat + .Builder.class); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj + instanceof + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat)) { + return super.equals(obj); + } + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat other = + (com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat) obj; + + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat + parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat + parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat + parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat + parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat + parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat + parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat + parseFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat + parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat + parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat + parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat + parseFrom(com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat + parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat + prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + + /** + * + * + *
    +       * Configuration for reading Cloud Storage data written via [Cloud Storage
    +       * subscriptions](https://cloud.google.com/pubsub/docs/cloudstorage). The
    +       * data and attributes fields of the originally exported Pub/Sub message
    +       * will be restored when publishing.
    +       * 
    + * + * Protobuf type {@code + * google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessage.Builder + implements + // @@protoc_insertion_point(builder_implements:google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat) + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormatOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionDataSourceSettings_CloudStorage_PubSubAvroFormat_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionDataSourceSettings_CloudStorage_PubSubAvroFormat_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat + .class, + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat + .Builder.class); + } + + // Construct using + // com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionDataSourceSettings_CloudStorage_PubSubAvroFormat_descriptor; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat + getDefaultInstanceForType() { + return com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat + .getDefaultInstance(); + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat + build() { + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat result = + buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat + buildPartial() { + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat result = + new com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat( + this); + onBuilt(); + return result; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other + instanceof + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat) { + return mergeFrom( + (com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat) + other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat other) { + if (other + == com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat + .getDefaultInstance()) return this; + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + // @@protoc_insertion_point(builder_scope:google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat) + } + + // @@protoc_insertion_point(class_scope:google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat) + private static final com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage + .PubSubAvroFormat + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = + new com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat(); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public PubSubAvroFormat parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException() + .setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + private int bitField0_; + private int inputFormatCase_ = 0; + + @SuppressWarnings("serial") + private java.lang.Object inputFormat_; + + public enum InputFormatCase + implements + com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + TEXT_FORMAT(3), + AVRO_FORMAT(4), + PUBSUB_AVRO_FORMAT(5), + INPUTFORMAT_NOT_SET(0); + private final int value; + + private InputFormatCase(int value) { + this.value = value; + } + + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static InputFormatCase valueOf(int value) { + return forNumber(value); + } + + public static InputFormatCase forNumber(int value) { + switch (value) { + case 3: + return TEXT_FORMAT; + case 4: + return AVRO_FORMAT; + case 5: + return PUBSUB_AVRO_FORMAT; + case 0: + return INPUTFORMAT_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public InputFormatCase getInputFormatCase() { + return InputFormatCase.forNumber(inputFormatCase_); + } + + public static final int STATE_FIELD_NUMBER = 1; + private int state_ = 0; + + /** + * + * + *
    +     * Output only. An output-only field that indicates the state of the Cloud
    +     * Storage ingestion source.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for state. + */ + @java.lang.Override + public int getStateValue() { + return state_; + } + + /** + * + * + *
    +     * Output only. An output-only field that indicates the state of the Cloud
    +     * Storage ingestion source.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The state. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.State getState() { + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.State result = + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.State.forNumber(state_); + return result == null + ? com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.State.UNRECOGNIZED + : result; + } + + public static final int BUCKET_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private volatile java.lang.Object bucket_ = ""; + + /** + * + * + *
    +     * Optional. Cloud Storage bucket. The bucket name must be without any
    +     * prefix like "gs://". See the [bucket naming requirements]
    +     * (https://cloud.google.com/storage/docs/buckets#naming).
    +     * 
    + * + * string bucket = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bucket. + */ + @java.lang.Override + public java.lang.String getBucket() { + java.lang.Object ref = bucket_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + bucket_ = s; + return s; + } + } + + /** + * + * + *
    +     * Optional. Cloud Storage bucket. The bucket name must be without any
    +     * prefix like "gs://". See the [bucket naming requirements]
    +     * (https://cloud.google.com/storage/docs/buckets#naming).
    +     * 
    + * + * string bucket = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for bucket. + */ + @java.lang.Override + public com.google.protobuf.ByteString getBucketBytes() { + java.lang.Object ref = bucket_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + bucket_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int TEXT_FORMAT_FIELD_NUMBER = 3; + + /** + * + * + *
    +     * Optional. Data from Cloud Storage will be interpreted as text.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat text_format = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the textFormat field is set. + */ + @java.lang.Override + public boolean hasTextFormat() { + return inputFormatCase_ == 3; + } + + /** + * + * + *
    +     * Optional. Data from Cloud Storage will be interpreted as text.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat text_format = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The textFormat. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat + getTextFormat() { + if (inputFormatCase_ == 3) { + return (com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat) + inputFormat_; + } + return com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat + .getDefaultInstance(); + } + + /** + * + * + *
    +     * Optional. Data from Cloud Storage will be interpreted as text.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat text_format = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormatOrBuilder + getTextFormatOrBuilder() { + if (inputFormatCase_ == 3) { + return (com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat) + inputFormat_; + } + return com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat + .getDefaultInstance(); + } + + public static final int AVRO_FORMAT_FIELD_NUMBER = 4; + + /** + * + * + *
    +     * Optional. Data from Cloud Storage will be interpreted in Avro format.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat avro_format = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the avroFormat field is set. + */ + @java.lang.Override + public boolean hasAvroFormat() { + return inputFormatCase_ == 4; + } + + /** + * + * + *
    +     * Optional. Data from Cloud Storage will be interpreted in Avro format.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat avro_format = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The avroFormat. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat + getAvroFormat() { + if (inputFormatCase_ == 4) { + return (com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat) + inputFormat_; + } + return com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat + .getDefaultInstance(); + } + + /** + * + * + *
    +     * Optional. Data from Cloud Storage will be interpreted in Avro format.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat avro_format = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormatOrBuilder + getAvroFormatOrBuilder() { + if (inputFormatCase_ == 4) { + return (com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat) + inputFormat_; + } + return com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat + .getDefaultInstance(); + } + + public static final int PUBSUB_AVRO_FORMAT_FIELD_NUMBER = 5; + + /** + * + * + *
    +     * Optional. It will be assumed data from Cloud Storage was written via
    +     * [Cloud Storage
    +     * subscriptions](https://cloud.google.com/pubsub/docs/cloudstorage).
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat pubsub_avro_format = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the pubsubAvroFormat field is set. + */ + @java.lang.Override + public boolean hasPubsubAvroFormat() { + return inputFormatCase_ == 5; + } + + /** + * + * + *
    +     * Optional. It will be assumed data from Cloud Storage was written via
    +     * [Cloud Storage
    +     * subscriptions](https://cloud.google.com/pubsub/docs/cloudstorage).
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat pubsub_avro_format = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The pubsubAvroFormat. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat + getPubsubAvroFormat() { + if (inputFormatCase_ == 5) { + return (com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat) + inputFormat_; + } + return com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat + .getDefaultInstance(); + } + + /** + * + * + *
    +     * Optional. It will be assumed data from Cloud Storage was written via
    +     * [Cloud Storage
    +     * subscriptions](https://cloud.google.com/pubsub/docs/cloudstorage).
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat pubsub_avro_format = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormatOrBuilder + getPubsubAvroFormatOrBuilder() { + if (inputFormatCase_ == 5) { + return (com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat) + inputFormat_; + } + return com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat + .getDefaultInstance(); + } + + public static final int MINIMUM_OBJECT_CREATE_TIME_FIELD_NUMBER = 6; + private com.google.protobuf.Timestamp minimumObjectCreateTime_; + + /** + * + * + *
    +     * Optional. Only objects with a larger or equal creation timestamp will be
    +     * ingested.
    +     * 
    + * + * + * .google.protobuf.Timestamp minimum_object_create_time = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the minimumObjectCreateTime field is set. + */ + @java.lang.Override + public boolean hasMinimumObjectCreateTime() { + return ((bitField0_ & 0x00000001) != 0); + } + + /** + * + * + *
    +     * Optional. Only objects with a larger or equal creation timestamp will be
    +     * ingested.
    +     * 
    + * + * + * .google.protobuf.Timestamp minimum_object_create_time = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The minimumObjectCreateTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getMinimumObjectCreateTime() { + return minimumObjectCreateTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : minimumObjectCreateTime_; + } + + /** + * + * + *
    +     * Optional. Only objects with a larger or equal creation timestamp will be
    +     * ingested.
    +     * 
    + * + * + * .google.protobuf.Timestamp minimum_object_create_time = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getMinimumObjectCreateTimeOrBuilder() { + return minimumObjectCreateTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : minimumObjectCreateTime_; + } + + public static final int MATCH_GLOB_FIELD_NUMBER = 9; + + @SuppressWarnings("serial") + private volatile java.lang.Object matchGlob_ = ""; + + /** + * + * + *
    +     * Optional. Glob pattern used to match objects that will be ingested. If
    +     * unset, all objects will be ingested. See the [supported
    +     * patterns](https://cloud.google.com/storage/docs/json_api/v1/objects/list#list-objects-and-prefixes-using-glob).
    +     * 
    + * + * string match_glob = 9 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The matchGlob. + */ + @java.lang.Override + public java.lang.String getMatchGlob() { + java.lang.Object ref = matchGlob_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + matchGlob_ = s; + return s; + } + } + + /** + * + * + *
    +     * Optional. Glob pattern used to match objects that will be ingested. If
    +     * unset, all objects will be ingested. See the [supported
    +     * patterns](https://cloud.google.com/storage/docs/json_api/v1/objects/list#list-objects-and-prefixes-using-glob).
    +     * 
    + * + * string match_glob = 9 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for matchGlob. + */ + @java.lang.Override + public com.google.protobuf.ByteString getMatchGlobBytes() { + java.lang.Object ref = matchGlob_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + matchGlob_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (state_ + != com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.State.STATE_UNSPECIFIED + .getNumber()) { + output.writeEnum(1, state_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(bucket_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, bucket_); + } + if (inputFormatCase_ == 3) { + output.writeMessage( + 3, + (com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat) + inputFormat_); + } + if (inputFormatCase_ == 4) { + output.writeMessage( + 4, + (com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat) + inputFormat_); + } + if (inputFormatCase_ == 5) { + output.writeMessage( + 5, + (com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat) + inputFormat_); + } + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(6, getMinimumObjectCreateTime()); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(matchGlob_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 9, matchGlob_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (state_ + != com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.State.STATE_UNSPECIFIED + .getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, state_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(bucket_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, bucket_); + } + if (inputFormatCase_ == 3) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 3, + (com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat) + inputFormat_); + } + if (inputFormatCase_ == 4) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 4, + (com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat) + inputFormat_); + } + if (inputFormatCase_ == 5) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 5, + (com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat) + inputFormat_); + } + if (((bitField0_ & 0x00000001) != 0)) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 6, getMinimumObjectCreateTime()); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(matchGlob_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(9, matchGlob_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage)) { + return super.equals(obj); + } + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage other = + (com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage) obj; + + if (state_ != other.state_) return false; + if (!getBucket().equals(other.getBucket())) return false; + if (hasMinimumObjectCreateTime() != other.hasMinimumObjectCreateTime()) return false; + if (hasMinimumObjectCreateTime()) { + if (!getMinimumObjectCreateTime().equals(other.getMinimumObjectCreateTime())) return false; + } + if (!getMatchGlob().equals(other.getMatchGlob())) return false; + if (!getInputFormatCase().equals(other.getInputFormatCase())) return false; + switch (inputFormatCase_) { + case 3: + if (!getTextFormat().equals(other.getTextFormat())) return false; + break; + case 4: + if (!getAvroFormat().equals(other.getAvroFormat())) return false; + break; + case 5: + if (!getPubsubAvroFormat().equals(other.getPubsubAvroFormat())) return false; + break; + case 0: + default: + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + STATE_FIELD_NUMBER; + hash = (53 * hash) + state_; + hash = (37 * hash) + BUCKET_FIELD_NUMBER; + hash = (53 * hash) + getBucket().hashCode(); + if (hasMinimumObjectCreateTime()) { + hash = (37 * hash) + MINIMUM_OBJECT_CREATE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getMinimumObjectCreateTime().hashCode(); + } + hash = (37 * hash) + MATCH_GLOB_FIELD_NUMBER; + hash = (53 * hash) + getMatchGlob().hashCode(); + switch (inputFormatCase_) { + case 3: + hash = (37 * hash) + TEXT_FORMAT_FIELD_NUMBER; + hash = (53 * hash) + getTextFormat().hashCode(); + break; + case 4: + hash = (37 * hash) + AVRO_FORMAT_FIELD_NUMBER; + hash = (53 * hash) + getAvroFormat().hashCode(); + break; + case 5: + hash = (37 * hash) + PUBSUB_AVRO_FORMAT_FIELD_NUMBER; + hash = (53 * hash) + getPubsubAvroFormat().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage parseFrom( + byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + + /** + * + * + *
    +     * Ingestion settings for Cloud Storage.
    +     * 
    + * + * Protobuf type {@code google.pubsub.v1.IngestionDataSourceSettings.CloudStorage} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder + implements + // @@protoc_insertion_point(builder_implements:google.pubsub.v1.IngestionDataSourceSettings.CloudStorage) + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorageOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionDataSourceSettings_CloudStorage_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionDataSourceSettings_CloudStorage_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.class, + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.Builder.class); + } + + // Construct using com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + internalGetMinimumObjectCreateTimeFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + state_ = 0; + bucket_ = ""; + if (textFormatBuilder_ != null) { + textFormatBuilder_.clear(); + } + if (avroFormatBuilder_ != null) { + avroFormatBuilder_.clear(); + } + if (pubsubAvroFormatBuilder_ != null) { + pubsubAvroFormatBuilder_.clear(); + } + minimumObjectCreateTime_ = null; + if (minimumObjectCreateTimeBuilder_ != null) { + minimumObjectCreateTimeBuilder_.dispose(); + minimumObjectCreateTimeBuilder_ = null; + } + matchGlob_ = ""; + inputFormatCase_ = 0; + inputFormat_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionDataSourceSettings_CloudStorage_descriptor; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage + getDefaultInstanceForType() { + return com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.getDefaultInstance(); + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage build() { + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage buildPartial() { + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage result = + new com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + buildPartialOneofs(result); + onBuilt(); + return result; + } + + private void buildPartial0( + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.state_ = state_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.bucket_ = bucket_; + } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000020) != 0)) { + result.minimumObjectCreateTime_ = + minimumObjectCreateTimeBuilder_ == null + ? minimumObjectCreateTime_ + : minimumObjectCreateTimeBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000040) != 0)) { + result.matchGlob_ = matchGlob_; + } + result.bitField0_ |= to_bitField0_; + } + + private void buildPartialOneofs( + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage result) { + result.inputFormatCase_ = inputFormatCase_; + result.inputFormat_ = this.inputFormat_; + if (inputFormatCase_ == 3 && textFormatBuilder_ != null) { + result.inputFormat_ = textFormatBuilder_.build(); + } + if (inputFormatCase_ == 4 && avroFormatBuilder_ != null) { + result.inputFormat_ = avroFormatBuilder_.build(); + } + if (inputFormatCase_ == 5 && pubsubAvroFormatBuilder_ != null) { + result.inputFormat_ = pubsubAvroFormatBuilder_.build(); + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage) { + return mergeFrom((com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage other) { + if (other + == com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.getDefaultInstance()) + return this; + if (other.state_ != 0) { + setStateValue(other.getStateValue()); + } + if (!other.getBucket().isEmpty()) { + bucket_ = other.bucket_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (other.hasMinimumObjectCreateTime()) { + mergeMinimumObjectCreateTime(other.getMinimumObjectCreateTime()); + } + if (!other.getMatchGlob().isEmpty()) { + matchGlob_ = other.matchGlob_; + bitField0_ |= 0x00000040; + onChanged(); + } + switch (other.getInputFormatCase()) { + case TEXT_FORMAT: + { + mergeTextFormat(other.getTextFormat()); + break; + } + case AVRO_FORMAT: + { + mergeAvroFormat(other.getAvroFormat()); + break; + } + case PUBSUB_AVRO_FORMAT: + { + mergePubsubAvroFormat(other.getPubsubAvroFormat()); + break; + } + case INPUTFORMAT_NOT_SET: + { + break; + } + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: + { + state_ = input.readEnum(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 18: + { + bucket_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: + { + input.readMessage( + internalGetTextFormatFieldBuilder().getBuilder(), extensionRegistry); + inputFormatCase_ = 3; + break; + } // case 26 + case 34: + { + input.readMessage( + internalGetAvroFormatFieldBuilder().getBuilder(), extensionRegistry); + inputFormatCase_ = 4; + break; + } // case 34 + case 42: + { + input.readMessage( + internalGetPubsubAvroFormatFieldBuilder().getBuilder(), extensionRegistry); + inputFormatCase_ = 5; + break; + } // case 42 + case 50: + { + input.readMessage( + internalGetMinimumObjectCreateTimeFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000020; + break; + } // case 50 + case 74: + { + matchGlob_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000040; + break; + } // case 74 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int inputFormatCase_ = 0; + private java.lang.Object inputFormat_; + + public InputFormatCase getInputFormatCase() { + return InputFormatCase.forNumber(inputFormatCase_); + } + + public Builder clearInputFormat() { + inputFormatCase_ = 0; + inputFormat_ = null; + onChanged(); + return this; + } + + private int bitField0_; + + private int state_ = 0; + + /** + * + * + *
    +       * Output only. An output-only field that indicates the state of the Cloud
    +       * Storage ingestion source.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for state. + */ + @java.lang.Override + public int getStateValue() { + return state_; + } + + /** + * + * + *
    +       * Output only. An output-only field that indicates the state of the Cloud
    +       * Storage ingestion source.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The enum numeric value on the wire for state to set. + * @return This builder for chaining. + */ + public Builder setStateValue(int value) { + state_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Output only. An output-only field that indicates the state of the Cloud
    +       * Storage ingestion source.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The state. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.State getState() { + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.State result = + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.State.forNumber(state_); + return result == null + ? com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.State.UNRECOGNIZED + : result; + } + + /** + * + * + *
    +       * Output only. An output-only field that indicates the state of the Cloud
    +       * Storage ingestion source.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The state to set. + * @return This builder for chaining. + */ + public Builder setState( + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.State value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + state_ = value.getNumber(); + onChanged(); + return this; + } + + /** + * + * + *
    +       * Output only. An output-only field that indicates the state of the Cloud
    +       * Storage ingestion source.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return This builder for chaining. + */ + public Builder clearState() { + bitField0_ = (bitField0_ & ~0x00000001); + state_ = 0; + onChanged(); + return this; + } + + private java.lang.Object bucket_ = ""; + + /** + * + * + *
    +       * Optional. Cloud Storage bucket. The bucket name must be without any
    +       * prefix like "gs://". See the [bucket naming requirements]
    +       * (https://cloud.google.com/storage/docs/buckets#naming).
    +       * 
    + * + * string bucket = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bucket. + */ + public java.lang.String getBucket() { + java.lang.Object ref = bucket_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + bucket_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +       * Optional. Cloud Storage bucket. The bucket name must be without any
    +       * prefix like "gs://". See the [bucket naming requirements]
    +       * (https://cloud.google.com/storage/docs/buckets#naming).
    +       * 
    + * + * string bucket = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for bucket. + */ + public com.google.protobuf.ByteString getBucketBytes() { + java.lang.Object ref = bucket_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + bucket_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +       * Optional. Cloud Storage bucket. The bucket name must be without any
    +       * prefix like "gs://". See the [bucket naming requirements]
    +       * (https://cloud.google.com/storage/docs/buckets#naming).
    +       * 
    + * + * string bucket = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bucket to set. + * @return This builder for chaining. + */ + public Builder setBucket(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + bucket_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. Cloud Storage bucket. The bucket name must be without any
    +       * prefix like "gs://". See the [bucket naming requirements]
    +       * (https://cloud.google.com/storage/docs/buckets#naming).
    +       * 
    + * + * string bucket = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearBucket() { + bucket_ = getDefaultInstance().getBucket(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. Cloud Storage bucket. The bucket name must be without any
    +       * prefix like "gs://". See the [bucket naming requirements]
    +       * (https://cloud.google.com/storage/docs/buckets#naming).
    +       * 
    + * + * string bucket = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for bucket to set. + * @return This builder for chaining. + */ + public Builder setBucketBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + bucket_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat, + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat.Builder, + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormatOrBuilder> + textFormatBuilder_; + + /** + * + * + *
    +       * Optional. Data from Cloud Storage will be interpreted as text.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat text_format = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the textFormat field is set. + */ + @java.lang.Override + public boolean hasTextFormat() { + return inputFormatCase_ == 3; + } + + /** + * + * + *
    +       * Optional. Data from Cloud Storage will be interpreted as text.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat text_format = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The textFormat. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat + getTextFormat() { + if (textFormatBuilder_ == null) { + if (inputFormatCase_ == 3) { + return (com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat) + inputFormat_; + } + return com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat + .getDefaultInstance(); + } else { + if (inputFormatCase_ == 3) { + return textFormatBuilder_.getMessage(); + } + return com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat + .getDefaultInstance(); + } + } + + /** + * + * + *
    +       * Optional. Data from Cloud Storage will be interpreted as text.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat text_format = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setTextFormat( + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat value) { + if (textFormatBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + inputFormat_ = value; + onChanged(); + } else { + textFormatBuilder_.setMessage(value); + } + inputFormatCase_ = 3; + return this; + } + + /** + * + * + *
    +       * Optional. Data from Cloud Storage will be interpreted as text.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat text_format = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setTextFormat( + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat.Builder + builderForValue) { + if (textFormatBuilder_ == null) { + inputFormat_ = builderForValue.build(); + onChanged(); + } else { + textFormatBuilder_.setMessage(builderForValue.build()); + } + inputFormatCase_ = 3; + return this; + } + + /** + * + * + *
    +       * Optional. Data from Cloud Storage will be interpreted as text.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat text_format = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeTextFormat( + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat value) { + if (textFormatBuilder_ == null) { + if (inputFormatCase_ == 3 + && inputFormat_ + != com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat + .getDefaultInstance()) { + inputFormat_ = + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat.newBuilder( + (com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat) + inputFormat_) + .mergeFrom(value) + .buildPartial(); + } else { + inputFormat_ = value; + } + onChanged(); + } else { + if (inputFormatCase_ == 3) { + textFormatBuilder_.mergeFrom(value); + } else { + textFormatBuilder_.setMessage(value); + } + } + inputFormatCase_ = 3; + return this; + } + + /** + * + * + *
    +       * Optional. Data from Cloud Storage will be interpreted as text.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat text_format = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearTextFormat() { + if (textFormatBuilder_ == null) { + if (inputFormatCase_ == 3) { + inputFormatCase_ = 0; + inputFormat_ = null; + onChanged(); + } + } else { + if (inputFormatCase_ == 3) { + inputFormatCase_ = 0; + inputFormat_ = null; + } + textFormatBuilder_.clear(); + } + return this; + } + + /** + * + * + *
    +       * Optional. Data from Cloud Storage will be interpreted as text.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat text_format = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat.Builder + getTextFormatBuilder() { + return internalGetTextFormatFieldBuilder().getBuilder(); + } + + /** + * + * + *
    +       * Optional. Data from Cloud Storage will be interpreted as text.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat text_format = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormatOrBuilder + getTextFormatOrBuilder() { + if ((inputFormatCase_ == 3) && (textFormatBuilder_ != null)) { + return textFormatBuilder_.getMessageOrBuilder(); + } else { + if (inputFormatCase_ == 3) { + return (com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat) + inputFormat_; + } + return com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat + .getDefaultInstance(); + } + } + + /** + * + * + *
    +       * Optional. Data from Cloud Storage will be interpreted as text.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat text_format = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat, + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat.Builder, + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormatOrBuilder> + internalGetTextFormatFieldBuilder() { + if (textFormatBuilder_ == null) { + if (!(inputFormatCase_ == 3)) { + inputFormat_ = + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat + .getDefaultInstance(); + } + textFormatBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat, + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat.Builder, + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage + .TextFormatOrBuilder>( + (com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat) + inputFormat_, + getParentForChildren(), + isClean()); + inputFormat_ = null; + } + inputFormatCase_ = 3; + onChanged(); + return textFormatBuilder_; + } + + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat, + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat.Builder, + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormatOrBuilder> + avroFormatBuilder_; + + /** + * + * + *
    +       * Optional. Data from Cloud Storage will be interpreted in Avro format.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat avro_format = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the avroFormat field is set. + */ + @java.lang.Override + public boolean hasAvroFormat() { + return inputFormatCase_ == 4; + } + + /** + * + * + *
    +       * Optional. Data from Cloud Storage will be interpreted in Avro format.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat avro_format = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The avroFormat. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat + getAvroFormat() { + if (avroFormatBuilder_ == null) { + if (inputFormatCase_ == 4) { + return (com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat) + inputFormat_; + } + return com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat + .getDefaultInstance(); + } else { + if (inputFormatCase_ == 4) { + return avroFormatBuilder_.getMessage(); + } + return com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat + .getDefaultInstance(); + } + } + + /** + * + * + *
    +       * Optional. Data from Cloud Storage will be interpreted in Avro format.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat avro_format = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setAvroFormat( + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat value) { + if (avroFormatBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + inputFormat_ = value; + onChanged(); + } else { + avroFormatBuilder_.setMessage(value); + } + inputFormatCase_ = 4; + return this; + } + + /** + * + * + *
    +       * Optional. Data from Cloud Storage will be interpreted in Avro format.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat avro_format = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setAvroFormat( + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat.Builder + builderForValue) { + if (avroFormatBuilder_ == null) { + inputFormat_ = builderForValue.build(); + onChanged(); + } else { + avroFormatBuilder_.setMessage(builderForValue.build()); + } + inputFormatCase_ = 4; + return this; + } + + /** + * + * + *
    +       * Optional. Data from Cloud Storage will be interpreted in Avro format.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat avro_format = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeAvroFormat( + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat value) { + if (avroFormatBuilder_ == null) { + if (inputFormatCase_ == 4 + && inputFormat_ + != com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat + .getDefaultInstance()) { + inputFormat_ = + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat.newBuilder( + (com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat) + inputFormat_) + .mergeFrom(value) + .buildPartial(); + } else { + inputFormat_ = value; + } + onChanged(); + } else { + if (inputFormatCase_ == 4) { + avroFormatBuilder_.mergeFrom(value); + } else { + avroFormatBuilder_.setMessage(value); + } + } + inputFormatCase_ = 4; + return this; + } + + /** + * + * + *
    +       * Optional. Data from Cloud Storage will be interpreted in Avro format.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat avro_format = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearAvroFormat() { + if (avroFormatBuilder_ == null) { + if (inputFormatCase_ == 4) { + inputFormatCase_ = 0; + inputFormat_ = null; + onChanged(); + } + } else { + if (inputFormatCase_ == 4) { + inputFormatCase_ = 0; + inputFormat_ = null; + } + avroFormatBuilder_.clear(); + } + return this; + } + + /** + * + * + *
    +       * Optional. Data from Cloud Storage will be interpreted in Avro format.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat avro_format = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat.Builder + getAvroFormatBuilder() { + return internalGetAvroFormatFieldBuilder().getBuilder(); + } + + /** + * + * + *
    +       * Optional. Data from Cloud Storage will be interpreted in Avro format.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat avro_format = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormatOrBuilder + getAvroFormatOrBuilder() { + if ((inputFormatCase_ == 4) && (avroFormatBuilder_ != null)) { + return avroFormatBuilder_.getMessageOrBuilder(); + } else { + if (inputFormatCase_ == 4) { + return (com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat) + inputFormat_; + } + return com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat + .getDefaultInstance(); + } + } + + /** + * + * + *
    +       * Optional. Data from Cloud Storage will be interpreted in Avro format.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat avro_format = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat, + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat.Builder, + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormatOrBuilder> + internalGetAvroFormatFieldBuilder() { + if (avroFormatBuilder_ == null) { + if (!(inputFormatCase_ == 4)) { + inputFormat_ = + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat + .getDefaultInstance(); + } + avroFormatBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat, + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat.Builder, + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage + .AvroFormatOrBuilder>( + (com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat) + inputFormat_, + getParentForChildren(), + isClean()); + inputFormat_ = null; + } + inputFormatCase_ = 4; + onChanged(); + return avroFormatBuilder_; + } + + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat, + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat + .Builder, + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage + .PubSubAvroFormatOrBuilder> + pubsubAvroFormatBuilder_; + + /** + * + * + *
    +       * Optional. It will be assumed data from Cloud Storage was written via
    +       * [Cloud Storage
    +       * subscriptions](https://cloud.google.com/pubsub/docs/cloudstorage).
    +       * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat pubsub_avro_format = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the pubsubAvroFormat field is set. + */ + @java.lang.Override + public boolean hasPubsubAvroFormat() { + return inputFormatCase_ == 5; + } + + /** + * + * + *
    +       * Optional. It will be assumed data from Cloud Storage was written via
    +       * [Cloud Storage
    +       * subscriptions](https://cloud.google.com/pubsub/docs/cloudstorage).
    +       * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat pubsub_avro_format = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The pubsubAvroFormat. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat + getPubsubAvroFormat() { + if (pubsubAvroFormatBuilder_ == null) { + if (inputFormatCase_ == 5) { + return (com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat) + inputFormat_; + } + return com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat + .getDefaultInstance(); + } else { + if (inputFormatCase_ == 5) { + return pubsubAvroFormatBuilder_.getMessage(); + } + return com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat + .getDefaultInstance(); + } + } + + /** + * + * + *
    +       * Optional. It will be assumed data from Cloud Storage was written via
    +       * [Cloud Storage
    +       * subscriptions](https://cloud.google.com/pubsub/docs/cloudstorage).
    +       * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat pubsub_avro_format = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setPubsubAvroFormat( + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat value) { + if (pubsubAvroFormatBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + inputFormat_ = value; + onChanged(); + } else { + pubsubAvroFormatBuilder_.setMessage(value); + } + inputFormatCase_ = 5; + return this; + } + + /** + * + * + *
    +       * Optional. It will be assumed data from Cloud Storage was written via
    +       * [Cloud Storage
    +       * subscriptions](https://cloud.google.com/pubsub/docs/cloudstorage).
    +       * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat pubsub_avro_format = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setPubsubAvroFormat( + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat.Builder + builderForValue) { + if (pubsubAvroFormatBuilder_ == null) { + inputFormat_ = builderForValue.build(); + onChanged(); + } else { + pubsubAvroFormatBuilder_.setMessage(builderForValue.build()); + } + inputFormatCase_ = 5; + return this; + } + + /** + * + * + *
    +       * Optional. It will be assumed data from Cloud Storage was written via
    +       * [Cloud Storage
    +       * subscriptions](https://cloud.google.com/pubsub/docs/cloudstorage).
    +       * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat pubsub_avro_format = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergePubsubAvroFormat( + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat value) { + if (pubsubAvroFormatBuilder_ == null) { + if (inputFormatCase_ == 5 + && inputFormat_ + != com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat + .getDefaultInstance()) { + inputFormat_ = + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat + .newBuilder( + (com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage + .PubSubAvroFormat) + inputFormat_) + .mergeFrom(value) + .buildPartial(); + } else { + inputFormat_ = value; + } + onChanged(); + } else { + if (inputFormatCase_ == 5) { + pubsubAvroFormatBuilder_.mergeFrom(value); + } else { + pubsubAvroFormatBuilder_.setMessage(value); + } + } + inputFormatCase_ = 5; + return this; + } + + /** + * + * + *
    +       * Optional. It will be assumed data from Cloud Storage was written via
    +       * [Cloud Storage
    +       * subscriptions](https://cloud.google.com/pubsub/docs/cloudstorage).
    +       * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat pubsub_avro_format = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearPubsubAvroFormat() { + if (pubsubAvroFormatBuilder_ == null) { + if (inputFormatCase_ == 5) { + inputFormatCase_ = 0; + inputFormat_ = null; + onChanged(); + } + } else { + if (inputFormatCase_ == 5) { + inputFormatCase_ = 0; + inputFormat_ = null; + } + pubsubAvroFormatBuilder_.clear(); + } + return this; + } + + /** + * + * + *
    +       * Optional. It will be assumed data from Cloud Storage was written via
    +       * [Cloud Storage
    +       * subscriptions](https://cloud.google.com/pubsub/docs/cloudstorage).
    +       * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat pubsub_avro_format = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat.Builder + getPubsubAvroFormatBuilder() { + return internalGetPubsubAvroFormatFieldBuilder().getBuilder(); + } + + /** + * + * + *
    +       * Optional. It will be assumed data from Cloud Storage was written via
    +       * [Cloud Storage
    +       * subscriptions](https://cloud.google.com/pubsub/docs/cloudstorage).
    +       * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat pubsub_avro_format = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormatOrBuilder + getPubsubAvroFormatOrBuilder() { + if ((inputFormatCase_ == 5) && (pubsubAvroFormatBuilder_ != null)) { + return pubsubAvroFormatBuilder_.getMessageOrBuilder(); + } else { + if (inputFormatCase_ == 5) { + return (com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat) + inputFormat_; + } + return com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat + .getDefaultInstance(); + } + } + + /** + * + * + *
    +       * Optional. It will be assumed data from Cloud Storage was written via
    +       * [Cloud Storage
    +       * subscriptions](https://cloud.google.com/pubsub/docs/cloudstorage).
    +       * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat pubsub_avro_format = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat, + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat + .Builder, + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage + .PubSubAvroFormatOrBuilder> + internalGetPubsubAvroFormatFieldBuilder() { + if (pubsubAvroFormatBuilder_ == null) { + if (!(inputFormatCase_ == 5)) { + inputFormat_ = + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat + .getDefaultInstance(); + } + pubsubAvroFormatBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat, + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat + .Builder, + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage + .PubSubAvroFormatOrBuilder>( + (com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat) + inputFormat_, + getParentForChildren(), + isClean()); + inputFormat_ = null; + } + inputFormatCase_ = 5; + onChanged(); + return pubsubAvroFormatBuilder_; + } + + private com.google.protobuf.Timestamp minimumObjectCreateTime_; + private com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + minimumObjectCreateTimeBuilder_; + + /** + * + * + *
    +       * Optional. Only objects with a larger or equal creation timestamp will be
    +       * ingested.
    +       * 
    + * + * + * .google.protobuf.Timestamp minimum_object_create_time = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the minimumObjectCreateTime field is set. + */ + public boolean hasMinimumObjectCreateTime() { + return ((bitField0_ & 0x00000020) != 0); + } + + /** + * + * + *
    +       * Optional. Only objects with a larger or equal creation timestamp will be
    +       * ingested.
    +       * 
    + * + * + * .google.protobuf.Timestamp minimum_object_create_time = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The minimumObjectCreateTime. + */ + public com.google.protobuf.Timestamp getMinimumObjectCreateTime() { + if (minimumObjectCreateTimeBuilder_ == null) { + return minimumObjectCreateTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : minimumObjectCreateTime_; + } else { + return minimumObjectCreateTimeBuilder_.getMessage(); + } + } + + /** + * + * + *
    +       * Optional. Only objects with a larger or equal creation timestamp will be
    +       * ingested.
    +       * 
    + * + * + * .google.protobuf.Timestamp minimum_object_create_time = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setMinimumObjectCreateTime(com.google.protobuf.Timestamp value) { + if (minimumObjectCreateTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + minimumObjectCreateTime_ = value; + } else { + minimumObjectCreateTimeBuilder_.setMessage(value); + } + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. Only objects with a larger or equal creation timestamp will be
    +       * ingested.
    +       * 
    + * + * + * .google.protobuf.Timestamp minimum_object_create_time = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setMinimumObjectCreateTime( + com.google.protobuf.Timestamp.Builder builderForValue) { + if (minimumObjectCreateTimeBuilder_ == null) { + minimumObjectCreateTime_ = builderForValue.build(); + } else { + minimumObjectCreateTimeBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. Only objects with a larger or equal creation timestamp will be
    +       * ingested.
    +       * 
    + * + * + * .google.protobuf.Timestamp minimum_object_create_time = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeMinimumObjectCreateTime(com.google.protobuf.Timestamp value) { + if (minimumObjectCreateTimeBuilder_ == null) { + if (((bitField0_ & 0x00000020) != 0) + && minimumObjectCreateTime_ != null + && minimumObjectCreateTime_ != com.google.protobuf.Timestamp.getDefaultInstance()) { + getMinimumObjectCreateTimeBuilder().mergeFrom(value); + } else { + minimumObjectCreateTime_ = value; + } + } else { + minimumObjectCreateTimeBuilder_.mergeFrom(value); + } + if (minimumObjectCreateTime_ != null) { + bitField0_ |= 0x00000020; + onChanged(); + } + return this; + } + + /** + * + * + *
    +       * Optional. Only objects with a larger or equal creation timestamp will be
    +       * ingested.
    +       * 
    + * + * + * .google.protobuf.Timestamp minimum_object_create_time = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearMinimumObjectCreateTime() { + bitField0_ = (bitField0_ & ~0x00000020); + minimumObjectCreateTime_ = null; + if (minimumObjectCreateTimeBuilder_ != null) { + minimumObjectCreateTimeBuilder_.dispose(); + minimumObjectCreateTimeBuilder_ = null; + } + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. Only objects with a larger or equal creation timestamp will be
    +       * ingested.
    +       * 
    + * + * + * .google.protobuf.Timestamp minimum_object_create_time = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.protobuf.Timestamp.Builder getMinimumObjectCreateTimeBuilder() { + bitField0_ |= 0x00000020; + onChanged(); + return internalGetMinimumObjectCreateTimeFieldBuilder().getBuilder(); + } + + /** + * + * + *
    +       * Optional. Only objects with a larger or equal creation timestamp will be
    +       * ingested.
    +       * 
    + * + * + * .google.protobuf.Timestamp minimum_object_create_time = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.protobuf.TimestampOrBuilder getMinimumObjectCreateTimeOrBuilder() { + if (minimumObjectCreateTimeBuilder_ != null) { + return minimumObjectCreateTimeBuilder_.getMessageOrBuilder(); + } else { + return minimumObjectCreateTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : minimumObjectCreateTime_; + } + } + + /** + * + * + *
    +       * Optional. Only objects with a larger or equal creation timestamp will be
    +       * ingested.
    +       * 
    + * + * + * .google.protobuf.Timestamp minimum_object_create_time = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + internalGetMinimumObjectCreateTimeFieldBuilder() { + if (minimumObjectCreateTimeBuilder_ == null) { + minimumObjectCreateTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getMinimumObjectCreateTime(), getParentForChildren(), isClean()); + minimumObjectCreateTime_ = null; + } + return minimumObjectCreateTimeBuilder_; + } + + private java.lang.Object matchGlob_ = ""; + + /** + * + * + *
    +       * Optional. Glob pattern used to match objects that will be ingested. If
    +       * unset, all objects will be ingested. See the [supported
    +       * patterns](https://cloud.google.com/storage/docs/json_api/v1/objects/list#list-objects-and-prefixes-using-glob).
    +       * 
    + * + * string match_glob = 9 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The matchGlob. + */ + public java.lang.String getMatchGlob() { + java.lang.Object ref = matchGlob_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + matchGlob_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +       * Optional. Glob pattern used to match objects that will be ingested. If
    +       * unset, all objects will be ingested. See the [supported
    +       * patterns](https://cloud.google.com/storage/docs/json_api/v1/objects/list#list-objects-and-prefixes-using-glob).
    +       * 
    + * + * string match_glob = 9 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for matchGlob. + */ + public com.google.protobuf.ByteString getMatchGlobBytes() { + java.lang.Object ref = matchGlob_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + matchGlob_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +       * Optional. Glob pattern used to match objects that will be ingested. If
    +       * unset, all objects will be ingested. See the [supported
    +       * patterns](https://cloud.google.com/storage/docs/json_api/v1/objects/list#list-objects-and-prefixes-using-glob).
    +       * 
    + * + * string match_glob = 9 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The matchGlob to set. + * @return This builder for chaining. + */ + public Builder setMatchGlob(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + matchGlob_ = value; + bitField0_ |= 0x00000040; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. Glob pattern used to match objects that will be ingested. If
    +       * unset, all objects will be ingested. See the [supported
    +       * patterns](https://cloud.google.com/storage/docs/json_api/v1/objects/list#list-objects-and-prefixes-using-glob).
    +       * 
    + * + * string match_glob = 9 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearMatchGlob() { + matchGlob_ = getDefaultInstance().getMatchGlob(); + bitField0_ = (bitField0_ & ~0x00000040); + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. Glob pattern used to match objects that will be ingested. If
    +       * unset, all objects will be ingested. See the [supported
    +       * patterns](https://cloud.google.com/storage/docs/json_api/v1/objects/list#list-objects-and-prefixes-using-glob).
    +       * 
    + * + * string match_glob = 9 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for matchGlob to set. + * @return This builder for chaining. + */ + public Builder setMatchGlobBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + matchGlob_ = value; + bitField0_ |= 0x00000040; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:google.pubsub.v1.IngestionDataSourceSettings.CloudStorage) + } + + // @@protoc_insertion_point(class_scope:google.pubsub.v1.IngestionDataSourceSettings.CloudStorage) + private static final com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage(); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public CloudStorage parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException() + .setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public interface AzureEventHubsOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
    +     * Output only. An output-only field that indicates the state of the Event
    +     * Hubs ingestion source.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for state. + */ + int getStateValue(); + + /** + * + * + *
    +     * Output only. An output-only field that indicates the state of the Event
    +     * Hubs ingestion source.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The state. + */ + com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs.State getState(); + + /** + * + * + *
    +     * Optional. Name of the resource group within the azure subscription.
    +     * 
    + * + * string resource_group = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The resourceGroup. + */ + java.lang.String getResourceGroup(); + + /** + * + * + *
    +     * Optional. Name of the resource group within the azure subscription.
    +     * 
    + * + * string resource_group = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for resourceGroup. + */ + com.google.protobuf.ByteString getResourceGroupBytes(); + + /** + * + * + *
    +     * Optional. The name of the Event Hubs namespace.
    +     * 
    + * + * string namespace = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The namespace. + */ + java.lang.String getNamespace(); + + /** + * + * + *
    +     * Optional. The name of the Event Hubs namespace.
    +     * 
    + * + * string namespace = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for namespace. + */ + com.google.protobuf.ByteString getNamespaceBytes(); + + /** + * + * + *
    +     * Optional. The name of the Event Hub.
    +     * 
    + * + * string event_hub = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The eventHub. + */ + java.lang.String getEventHub(); + + /** + * + * + *
    +     * Optional. The name of the Event Hub.
    +     * 
    + * + * string event_hub = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for eventHub. + */ + com.google.protobuf.ByteString getEventHubBytes(); + + /** + * + * + *
    +     * Optional. The client id of the Azure application that is being used to
    +     * authenticate Pub/Sub.
    +     * 
    + * + * string client_id = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The clientId. + */ + java.lang.String getClientId(); + + /** + * + * + *
    +     * Optional. The client id of the Azure application that is being used to
    +     * authenticate Pub/Sub.
    +     * 
    + * + * string client_id = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for clientId. + */ + com.google.protobuf.ByteString getClientIdBytes(); + + /** + * + * + *
    +     * Optional. The tenant id of the Azure application that is being used to
    +     * authenticate Pub/Sub.
    +     * 
    + * + * string tenant_id = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The tenantId. + */ + java.lang.String getTenantId(); + + /** + * + * + *
    +     * Optional. The tenant id of the Azure application that is being used to
    +     * authenticate Pub/Sub.
    +     * 
    + * + * string tenant_id = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for tenantId. + */ + com.google.protobuf.ByteString getTenantIdBytes(); + + /** + * + * + *
    +     * Optional. The Azure subscription id.
    +     * 
    + * + * string subscription_id = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The subscriptionId. + */ + java.lang.String getSubscriptionId(); + + /** + * + * + *
    +     * Optional. The Azure subscription id.
    +     * 
    + * + * string subscription_id = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for subscriptionId. + */ + com.google.protobuf.ByteString getSubscriptionIdBytes(); + + /** + * + * + *
    +     * Optional. The GCP service account to be used for Federated Identity
    +     * authentication.
    +     * 
    + * + * string gcp_service_account = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The gcpServiceAccount. + */ + java.lang.String getGcpServiceAccount(); + + /** + * + * + *
    +     * Optional. The GCP service account to be used for Federated Identity
    +     * authentication.
    +     * 
    + * + * string gcp_service_account = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for gcpServiceAccount. + */ + com.google.protobuf.ByteString getGcpServiceAccountBytes(); + } + + /** + * + * + *
    +   * Ingestion settings for Azure Event Hubs.
    +   * 
    + * + * Protobuf type {@code google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs} + */ + public static final class AzureEventHubs extends com.google.protobuf.GeneratedMessage + implements + // @@protoc_insertion_point(message_implements:google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs) + AzureEventHubsOrBuilder { + private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "AzureEventHubs"); + } + + // Use AzureEventHubs.newBuilder() to construct. + private AzureEventHubs(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + + private AzureEventHubs() { + state_ = 0; + resourceGroup_ = ""; + namespace_ = ""; + eventHub_ = ""; + clientId_ = ""; + tenantId_ = ""; + subscriptionId_ = ""; + gcpServiceAccount_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionDataSourceSettings_AzureEventHubs_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionDataSourceSettings_AzureEventHubs_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs.class, + com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs.Builder.class); + } + + /** + * + * + *
    +     * Possible states for managed ingestion from Event Hubs.
    +     * 
    + * + * Protobuf enum {@code google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs.State} + */ + public enum State implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
    +       * Default value. This value is unused.
    +       * 
    + * + * STATE_UNSPECIFIED = 0; + */ + STATE_UNSPECIFIED(0), + /** + * + * + *
    +       * Ingestion is active.
    +       * 
    + * + * ACTIVE = 1; + */ + ACTIVE(1), + /** + * + * + *
    +       * Permission denied encountered while consuming data from Event Hubs.
    +       * This can happen when `client_id`, or `tenant_id` are invalid. Or the
    +       * right permissions haven't been granted.
    +       * 
    + * + * EVENT_HUBS_PERMISSION_DENIED = 2; + */ + EVENT_HUBS_PERMISSION_DENIED(2), + /** + * + * + *
    +       * Permission denied encountered while publishing to the topic.
    +       * 
    + * + * PUBLISH_PERMISSION_DENIED = 3; + */ + PUBLISH_PERMISSION_DENIED(3), + /** + * + * + *
    +       * The provided Event Hubs namespace couldn't be found.
    +       * 
    + * + * NAMESPACE_NOT_FOUND = 4; + */ + NAMESPACE_NOT_FOUND(4), + /** + * + * + *
    +       * The provided Event Hub couldn't be found.
    +       * 
    + * + * EVENT_HUB_NOT_FOUND = 5; + */ + EVENT_HUB_NOT_FOUND(5), + /** + * + * + *
    +       * The provided Event Hubs subscription couldn't be found.
    +       * 
    + * + * SUBSCRIPTION_NOT_FOUND = 6; + */ + SUBSCRIPTION_NOT_FOUND(6), + /** + * + * + *
    +       * The provided Event Hubs resource group couldn't be found.
    +       * 
    + * + * RESOURCE_GROUP_NOT_FOUND = 7; + */ + RESOURCE_GROUP_NOT_FOUND(7), + UNRECOGNIZED(-1), + ; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "State"); + } + + /** + * + * + *
    +       * Default value. This value is unused.
    +       * 
    + * + * STATE_UNSPECIFIED = 0; + */ + public static final int STATE_UNSPECIFIED_VALUE = 0; + + /** + * + * + *
    +       * Ingestion is active.
    +       * 
    + * + * ACTIVE = 1; + */ + public static final int ACTIVE_VALUE = 1; + + /** + * + * + *
    +       * Permission denied encountered while consuming data from Event Hubs.
    +       * This can happen when `client_id`, or `tenant_id` are invalid. Or the
    +       * right permissions haven't been granted.
    +       * 
    + * + * EVENT_HUBS_PERMISSION_DENIED = 2; + */ + public static final int EVENT_HUBS_PERMISSION_DENIED_VALUE = 2; + + /** + * + * + *
    +       * Permission denied encountered while publishing to the topic.
    +       * 
    + * + * PUBLISH_PERMISSION_DENIED = 3; + */ + public static final int PUBLISH_PERMISSION_DENIED_VALUE = 3; + + /** + * + * + *
    +       * The provided Event Hubs namespace couldn't be found.
    +       * 
    + * + * NAMESPACE_NOT_FOUND = 4; + */ + public static final int NAMESPACE_NOT_FOUND_VALUE = 4; + + /** + * + * + *
    +       * The provided Event Hub couldn't be found.
    +       * 
    + * + * EVENT_HUB_NOT_FOUND = 5; + */ + public static final int EVENT_HUB_NOT_FOUND_VALUE = 5; + + /** + * + * + *
    +       * The provided Event Hubs subscription couldn't be found.
    +       * 
    + * + * SUBSCRIPTION_NOT_FOUND = 6; + */ + public static final int SUBSCRIPTION_NOT_FOUND_VALUE = 6; + + /** + * + * + *
    +       * The provided Event Hubs resource group couldn't be found.
    +       * 
    + * + * RESOURCE_GROUP_NOT_FOUND = 7; + */ + public static final int RESOURCE_GROUP_NOT_FOUND_VALUE = 7; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static State valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static State forNumber(int value) { + switch (value) { + case 0: + return STATE_UNSPECIFIED; + case 1: + return ACTIVE; + case 2: + return EVENT_HUBS_PERMISSION_DENIED; + case 3: + return PUBLISH_PERMISSION_DENIED; + case 4: + return NAMESPACE_NOT_FOUND; + case 5: + return EVENT_HUB_NOT_FOUND; + case 6: + return SUBSCRIPTION_NOT_FOUND; + case 7: + return RESOURCE_GROUP_NOT_FOUND; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public State findValueByNumber(int number) { + return State.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs.getDescriptor() + .getEnumTypes() + .get(0); + } + + private static final State[] VALUES = values(); + + public static State valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private State(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs.State) + } + + public static final int STATE_FIELD_NUMBER = 1; + private int state_ = 0; + + /** + * + * + *
    +     * Output only. An output-only field that indicates the state of the Event
    +     * Hubs ingestion source.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for state. + */ + @java.lang.Override + public int getStateValue() { + return state_; + } + + /** + * + * + *
    +     * Output only. An output-only field that indicates the state of the Event
    +     * Hubs ingestion source.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The state. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs.State getState() { + com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs.State result = + com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs.State.forNumber(state_); + return result == null + ? com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs.State.UNRECOGNIZED + : result; + } + + public static final int RESOURCE_GROUP_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private volatile java.lang.Object resourceGroup_ = ""; + + /** + * + * + *
    +     * Optional. Name of the resource group within the azure subscription.
    +     * 
    + * + * string resource_group = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The resourceGroup. + */ + @java.lang.Override + public java.lang.String getResourceGroup() { + java.lang.Object ref = resourceGroup_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + resourceGroup_ = s; + return s; + } + } + + /** + * + * + *
    +     * Optional. Name of the resource group within the azure subscription.
    +     * 
    + * + * string resource_group = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for resourceGroup. + */ + @java.lang.Override + public com.google.protobuf.ByteString getResourceGroupBytes() { + java.lang.Object ref = resourceGroup_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + resourceGroup_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int NAMESPACE_FIELD_NUMBER = 3; + + @SuppressWarnings("serial") + private volatile java.lang.Object namespace_ = ""; + + /** + * + * + *
    +     * Optional. The name of the Event Hubs namespace.
    +     * 
    + * + * string namespace = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The namespace. + */ + @java.lang.Override + public java.lang.String getNamespace() { + java.lang.Object ref = namespace_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + namespace_ = s; + return s; + } + } + + /** + * + * + *
    +     * Optional. The name of the Event Hubs namespace.
    +     * 
    + * + * string namespace = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for namespace. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNamespaceBytes() { + java.lang.Object ref = namespace_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + namespace_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int EVENT_HUB_FIELD_NUMBER = 4; + + @SuppressWarnings("serial") + private volatile java.lang.Object eventHub_ = ""; + + /** + * + * + *
    +     * Optional. The name of the Event Hub.
    +     * 
    + * + * string event_hub = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The eventHub. + */ + @java.lang.Override + public java.lang.String getEventHub() { + java.lang.Object ref = eventHub_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + eventHub_ = s; + return s; + } + } + + /** + * + * + *
    +     * Optional. The name of the Event Hub.
    +     * 
    + * + * string event_hub = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for eventHub. + */ + @java.lang.Override + public com.google.protobuf.ByteString getEventHubBytes() { + java.lang.Object ref = eventHub_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + eventHub_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CLIENT_ID_FIELD_NUMBER = 5; + + @SuppressWarnings("serial") + private volatile java.lang.Object clientId_ = ""; + + /** + * + * + *
    +     * Optional. The client id of the Azure application that is being used to
    +     * authenticate Pub/Sub.
    +     * 
    + * + * string client_id = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The clientId. + */ + @java.lang.Override + public java.lang.String getClientId() { + java.lang.Object ref = clientId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + clientId_ = s; + return s; + } + } + + /** + * + * + *
    +     * Optional. The client id of the Azure application that is being used to
    +     * authenticate Pub/Sub.
    +     * 
    + * + * string client_id = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for clientId. + */ + @java.lang.Override + public com.google.protobuf.ByteString getClientIdBytes() { + java.lang.Object ref = clientId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + clientId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int TENANT_ID_FIELD_NUMBER = 6; + + @SuppressWarnings("serial") + private volatile java.lang.Object tenantId_ = ""; + + /** + * + * + *
    +     * Optional. The tenant id of the Azure application that is being used to
    +     * authenticate Pub/Sub.
    +     * 
    + * + * string tenant_id = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The tenantId. + */ + @java.lang.Override + public java.lang.String getTenantId() { + java.lang.Object ref = tenantId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + tenantId_ = s; + return s; + } + } + + /** + * + * + *
    +     * Optional. The tenant id of the Azure application that is being used to
    +     * authenticate Pub/Sub.
    +     * 
    + * + * string tenant_id = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for tenantId. + */ + @java.lang.Override + public com.google.protobuf.ByteString getTenantIdBytes() { + java.lang.Object ref = tenantId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + tenantId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SUBSCRIPTION_ID_FIELD_NUMBER = 7; + + @SuppressWarnings("serial") + private volatile java.lang.Object subscriptionId_ = ""; + + /** + * + * + *
    +     * Optional. The Azure subscription id.
    +     * 
    + * + * string subscription_id = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The subscriptionId. + */ + @java.lang.Override + public java.lang.String getSubscriptionId() { + java.lang.Object ref = subscriptionId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + subscriptionId_ = s; + return s; + } + } + + /** + * + * + *
    +     * Optional. The Azure subscription id.
    +     * 
    + * + * string subscription_id = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for subscriptionId. + */ + @java.lang.Override + public com.google.protobuf.ByteString getSubscriptionIdBytes() { + java.lang.Object ref = subscriptionId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + subscriptionId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int GCP_SERVICE_ACCOUNT_FIELD_NUMBER = 8; + + @SuppressWarnings("serial") + private volatile java.lang.Object gcpServiceAccount_ = ""; + + /** + * + * + *
    +     * Optional. The GCP service account to be used for Federated Identity
    +     * authentication.
    +     * 
    + * + * string gcp_service_account = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The gcpServiceAccount. + */ + @java.lang.Override + public java.lang.String getGcpServiceAccount() { + java.lang.Object ref = gcpServiceAccount_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + gcpServiceAccount_ = s; + return s; + } + } + + /** + * + * + *
    +     * Optional. The GCP service account to be used for Federated Identity
    +     * authentication.
    +     * 
    + * + * string gcp_service_account = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for gcpServiceAccount. + */ + @java.lang.Override + public com.google.protobuf.ByteString getGcpServiceAccountBytes() { + java.lang.Object ref = gcpServiceAccount_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + gcpServiceAccount_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (state_ + != com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs.State.STATE_UNSPECIFIED + .getNumber()) { + output.writeEnum(1, state_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(resourceGroup_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, resourceGroup_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(namespace_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 3, namespace_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(eventHub_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 4, eventHub_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(clientId_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 5, clientId_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(tenantId_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 6, tenantId_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(subscriptionId_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 7, subscriptionId_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(gcpServiceAccount_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 8, gcpServiceAccount_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (state_ + != com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs.State.STATE_UNSPECIFIED + .getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, state_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(resourceGroup_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, resourceGroup_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(namespace_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(3, namespace_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(eventHub_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(4, eventHub_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(clientId_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(5, clientId_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(tenantId_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(6, tenantId_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(subscriptionId_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(7, subscriptionId_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(gcpServiceAccount_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(8, gcpServiceAccount_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs)) { + return super.equals(obj); + } + com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs other = + (com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs) obj; + + if (state_ != other.state_) return false; + if (!getResourceGroup().equals(other.getResourceGroup())) return false; + if (!getNamespace().equals(other.getNamespace())) return false; + if (!getEventHub().equals(other.getEventHub())) return false; + if (!getClientId().equals(other.getClientId())) return false; + if (!getTenantId().equals(other.getTenantId())) return false; + if (!getSubscriptionId().equals(other.getSubscriptionId())) return false; + if (!getGcpServiceAccount().equals(other.getGcpServiceAccount())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + STATE_FIELD_NUMBER; + hash = (53 * hash) + state_; + hash = (37 * hash) + RESOURCE_GROUP_FIELD_NUMBER; + hash = (53 * hash) + getResourceGroup().hashCode(); + hash = (37 * hash) + NAMESPACE_FIELD_NUMBER; + hash = (53 * hash) + getNamespace().hashCode(); + hash = (37 * hash) + EVENT_HUB_FIELD_NUMBER; + hash = (53 * hash) + getEventHub().hashCode(); + hash = (37 * hash) + CLIENT_ID_FIELD_NUMBER; + hash = (53 * hash) + getClientId().hashCode(); + hash = (37 * hash) + TENANT_ID_FIELD_NUMBER; + hash = (53 * hash) + getTenantId().hashCode(); + hash = (37 * hash) + SUBSCRIPTION_ID_FIELD_NUMBER; + hash = (53 * hash) + getSubscriptionId().hashCode(); + hash = (37 * hash) + GCP_SERVICE_ACCOUNT_FIELD_NUMBER; + hash = (53 * hash) + getGcpServiceAccount().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs parseFrom( + byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs + parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs + parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + + /** + * + * + *
    +     * Ingestion settings for Azure Event Hubs.
    +     * 
    + * + * Protobuf type {@code google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder + implements + // @@protoc_insertion_point(builder_implements:google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs) + com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubsOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionDataSourceSettings_AzureEventHubs_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionDataSourceSettings_AzureEventHubs_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs.class, + com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs.Builder.class); + } + + // Construct using + // com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + state_ = 0; + resourceGroup_ = ""; + namespace_ = ""; + eventHub_ = ""; + clientId_ = ""; + tenantId_ = ""; + subscriptionId_ = ""; + gcpServiceAccount_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionDataSourceSettings_AzureEventHubs_descriptor; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs + getDefaultInstanceForType() { + return com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs.getDefaultInstance(); + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs build() { + com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs buildPartial() { + com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs result = + new com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0( + com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.state_ = state_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.resourceGroup_ = resourceGroup_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.namespace_ = namespace_; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.eventHub_ = eventHub_; + } + if (((from_bitField0_ & 0x00000010) != 0)) { + result.clientId_ = clientId_; + } + if (((from_bitField0_ & 0x00000020) != 0)) { + result.tenantId_ = tenantId_; + } + if (((from_bitField0_ & 0x00000040) != 0)) { + result.subscriptionId_ = subscriptionId_; + } + if (((from_bitField0_ & 0x00000080) != 0)) { + result.gcpServiceAccount_ = gcpServiceAccount_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs) { + return mergeFrom((com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs other) { + if (other + == com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs.getDefaultInstance()) + return this; + if (other.state_ != 0) { + setStateValue(other.getStateValue()); + } + if (!other.getResourceGroup().isEmpty()) { + resourceGroup_ = other.resourceGroup_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (!other.getNamespace().isEmpty()) { + namespace_ = other.namespace_; + bitField0_ |= 0x00000004; + onChanged(); + } + if (!other.getEventHub().isEmpty()) { + eventHub_ = other.eventHub_; + bitField0_ |= 0x00000008; + onChanged(); + } + if (!other.getClientId().isEmpty()) { + clientId_ = other.clientId_; + bitField0_ |= 0x00000010; + onChanged(); + } + if (!other.getTenantId().isEmpty()) { + tenantId_ = other.tenantId_; + bitField0_ |= 0x00000020; + onChanged(); + } + if (!other.getSubscriptionId().isEmpty()) { + subscriptionId_ = other.subscriptionId_; + bitField0_ |= 0x00000040; + onChanged(); + } + if (!other.getGcpServiceAccount().isEmpty()) { + gcpServiceAccount_ = other.gcpServiceAccount_; + bitField0_ |= 0x00000080; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: + { + state_ = input.readEnum(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 18: + { + resourceGroup_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: + { + namespace_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000004; + break; + } // case 26 + case 34: + { + eventHub_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000008; + break; + } // case 34 + case 42: + { + clientId_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000010; + break; + } // case 42 + case 50: + { + tenantId_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000020; + break; + } // case 50 + case 58: + { + subscriptionId_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000040; + break; + } // case 58 + case 66: + { + gcpServiceAccount_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000080; + break; + } // case 66 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private int state_ = 0; + + /** + * + * + *
    +       * Output only. An output-only field that indicates the state of the Event
    +       * Hubs ingestion source.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for state. + */ + @java.lang.Override + public int getStateValue() { + return state_; + } + + /** + * + * + *
    +       * Output only. An output-only field that indicates the state of the Event
    +       * Hubs ingestion source.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The enum numeric value on the wire for state to set. + * @return This builder for chaining. + */ + public Builder setStateValue(int value) { + state_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Output only. An output-only field that indicates the state of the Event
    +       * Hubs ingestion source.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The state. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs.State getState() { + com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs.State result = + com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs.State.forNumber(state_); + return result == null + ? com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs.State.UNRECOGNIZED + : result; + } + + /** + * + * + *
    +       * Output only. An output-only field that indicates the state of the Event
    +       * Hubs ingestion source.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The state to set. + * @return This builder for chaining. + */ + public Builder setState( + com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs.State value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + state_ = value.getNumber(); + onChanged(); + return this; + } + + /** + * + * + *
    +       * Output only. An output-only field that indicates the state of the Event
    +       * Hubs ingestion source.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return This builder for chaining. + */ + public Builder clearState() { + bitField0_ = (bitField0_ & ~0x00000001); + state_ = 0; + onChanged(); + return this; + } + + private java.lang.Object resourceGroup_ = ""; + + /** + * + * + *
    +       * Optional. Name of the resource group within the azure subscription.
    +       * 
    + * + * string resource_group = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The resourceGroup. + */ + public java.lang.String getResourceGroup() { + java.lang.Object ref = resourceGroup_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + resourceGroup_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +       * Optional. Name of the resource group within the azure subscription.
    +       * 
    + * + * string resource_group = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for resourceGroup. + */ + public com.google.protobuf.ByteString getResourceGroupBytes() { + java.lang.Object ref = resourceGroup_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + resourceGroup_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +       * Optional. Name of the resource group within the azure subscription.
    +       * 
    + * + * string resource_group = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The resourceGroup to set. + * @return This builder for chaining. + */ + public Builder setResourceGroup(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + resourceGroup_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. Name of the resource group within the azure subscription.
    +       * 
    + * + * string resource_group = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearResourceGroup() { + resourceGroup_ = getDefaultInstance().getResourceGroup(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. Name of the resource group within the azure subscription.
    +       * 
    + * + * string resource_group = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for resourceGroup to set. + * @return This builder for chaining. + */ + public Builder setResourceGroupBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + resourceGroup_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private java.lang.Object namespace_ = ""; + + /** + * + * + *
    +       * Optional. The name of the Event Hubs namespace.
    +       * 
    + * + * string namespace = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The namespace. + */ + public java.lang.String getNamespace() { + java.lang.Object ref = namespace_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + namespace_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +       * Optional. The name of the Event Hubs namespace.
    +       * 
    + * + * string namespace = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for namespace. + */ + public com.google.protobuf.ByteString getNamespaceBytes() { + java.lang.Object ref = namespace_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + namespace_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +       * Optional. The name of the Event Hubs namespace.
    +       * 
    + * + * string namespace = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The namespace to set. + * @return This builder for chaining. + */ + public Builder setNamespace(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + namespace_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. The name of the Event Hubs namespace.
    +       * 
    + * + * string namespace = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearNamespace() { + namespace_ = getDefaultInstance().getNamespace(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. The name of the Event Hubs namespace.
    +       * 
    + * + * string namespace = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for namespace to set. + * @return This builder for chaining. + */ + public Builder setNamespaceBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + namespace_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + private java.lang.Object eventHub_ = ""; + + /** + * + * + *
    +       * Optional. The name of the Event Hub.
    +       * 
    + * + * string event_hub = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The eventHub. + */ + public java.lang.String getEventHub() { + java.lang.Object ref = eventHub_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + eventHub_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +       * Optional. The name of the Event Hub.
    +       * 
    + * + * string event_hub = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for eventHub. + */ + public com.google.protobuf.ByteString getEventHubBytes() { + java.lang.Object ref = eventHub_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + eventHub_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +       * Optional. The name of the Event Hub.
    +       * 
    + * + * string event_hub = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The eventHub to set. + * @return This builder for chaining. + */ + public Builder setEventHub(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + eventHub_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. The name of the Event Hub.
    +       * 
    + * + * string event_hub = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearEventHub() { + eventHub_ = getDefaultInstance().getEventHub(); + bitField0_ = (bitField0_ & ~0x00000008); + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. The name of the Event Hub.
    +       * 
    + * + * string event_hub = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for eventHub to set. + * @return This builder for chaining. + */ + public Builder setEventHubBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + eventHub_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + + private java.lang.Object clientId_ = ""; + + /** + * + * + *
    +       * Optional. The client id of the Azure application that is being used to
    +       * authenticate Pub/Sub.
    +       * 
    + * + * string client_id = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The clientId. + */ + public java.lang.String getClientId() { + java.lang.Object ref = clientId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + clientId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +       * Optional. The client id of the Azure application that is being used to
    +       * authenticate Pub/Sub.
    +       * 
    + * + * string client_id = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for clientId. + */ + public com.google.protobuf.ByteString getClientIdBytes() { + java.lang.Object ref = clientId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + clientId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +       * Optional. The client id of the Azure application that is being used to
    +       * authenticate Pub/Sub.
    +       * 
    + * + * string client_id = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The clientId to set. + * @return This builder for chaining. + */ + public Builder setClientId(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + clientId_ = value; + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. The client id of the Azure application that is being used to
    +       * authenticate Pub/Sub.
    +       * 
    + * + * string client_id = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearClientId() { + clientId_ = getDefaultInstance().getClientId(); + bitField0_ = (bitField0_ & ~0x00000010); + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. The client id of the Azure application that is being used to
    +       * authenticate Pub/Sub.
    +       * 
    + * + * string client_id = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for clientId to set. + * @return This builder for chaining. + */ + public Builder setClientIdBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + clientId_ = value; + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + + private java.lang.Object tenantId_ = ""; + + /** + * + * + *
    +       * Optional. The tenant id of the Azure application that is being used to
    +       * authenticate Pub/Sub.
    +       * 
    + * + * string tenant_id = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The tenantId. + */ + public java.lang.String getTenantId() { + java.lang.Object ref = tenantId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + tenantId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +       * Optional. The tenant id of the Azure application that is being used to
    +       * authenticate Pub/Sub.
    +       * 
    + * + * string tenant_id = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for tenantId. + */ + public com.google.protobuf.ByteString getTenantIdBytes() { + java.lang.Object ref = tenantId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + tenantId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +       * Optional. The tenant id of the Azure application that is being used to
    +       * authenticate Pub/Sub.
    +       * 
    + * + * string tenant_id = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The tenantId to set. + * @return This builder for chaining. + */ + public Builder setTenantId(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + tenantId_ = value; + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. The tenant id of the Azure application that is being used to
    +       * authenticate Pub/Sub.
    +       * 
    + * + * string tenant_id = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearTenantId() { + tenantId_ = getDefaultInstance().getTenantId(); + bitField0_ = (bitField0_ & ~0x00000020); + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. The tenant id of the Azure application that is being used to
    +       * authenticate Pub/Sub.
    +       * 
    + * + * string tenant_id = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for tenantId to set. + * @return This builder for chaining. + */ + public Builder setTenantIdBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + tenantId_ = value; + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + + private java.lang.Object subscriptionId_ = ""; + + /** + * + * + *
    +       * Optional. The Azure subscription id.
    +       * 
    + * + * string subscription_id = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The subscriptionId. + */ + public java.lang.String getSubscriptionId() { + java.lang.Object ref = subscriptionId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + subscriptionId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +       * Optional. The Azure subscription id.
    +       * 
    + * + * string subscription_id = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for subscriptionId. + */ + public com.google.protobuf.ByteString getSubscriptionIdBytes() { + java.lang.Object ref = subscriptionId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + subscriptionId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +       * Optional. The Azure subscription id.
    +       * 
    + * + * string subscription_id = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The subscriptionId to set. + * @return This builder for chaining. + */ + public Builder setSubscriptionId(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + subscriptionId_ = value; + bitField0_ |= 0x00000040; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. The Azure subscription id.
    +       * 
    + * + * string subscription_id = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearSubscriptionId() { + subscriptionId_ = getDefaultInstance().getSubscriptionId(); + bitField0_ = (bitField0_ & ~0x00000040); + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. The Azure subscription id.
    +       * 
    + * + * string subscription_id = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for subscriptionId to set. + * @return This builder for chaining. + */ + public Builder setSubscriptionIdBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + subscriptionId_ = value; + bitField0_ |= 0x00000040; + onChanged(); + return this; + } + + private java.lang.Object gcpServiceAccount_ = ""; + + /** + * + * + *
    +       * Optional. The GCP service account to be used for Federated Identity
    +       * authentication.
    +       * 
    + * + * string gcp_service_account = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The gcpServiceAccount. + */ + public java.lang.String getGcpServiceAccount() { + java.lang.Object ref = gcpServiceAccount_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + gcpServiceAccount_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +       * Optional. The GCP service account to be used for Federated Identity
    +       * authentication.
    +       * 
    + * + * string gcp_service_account = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for gcpServiceAccount. + */ + public com.google.protobuf.ByteString getGcpServiceAccountBytes() { + java.lang.Object ref = gcpServiceAccount_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + gcpServiceAccount_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +       * Optional. The GCP service account to be used for Federated Identity
    +       * authentication.
    +       * 
    + * + * string gcp_service_account = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The gcpServiceAccount to set. + * @return This builder for chaining. + */ + public Builder setGcpServiceAccount(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + gcpServiceAccount_ = value; + bitField0_ |= 0x00000080; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. The GCP service account to be used for Federated Identity
    +       * authentication.
    +       * 
    + * + * string gcp_service_account = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearGcpServiceAccount() { + gcpServiceAccount_ = getDefaultInstance().getGcpServiceAccount(); + bitField0_ = (bitField0_ & ~0x00000080); + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. The GCP service account to be used for Federated Identity
    +       * authentication.
    +       * 
    + * + * string gcp_service_account = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for gcpServiceAccount to set. + * @return This builder for chaining. + */ + public Builder setGcpServiceAccountBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + gcpServiceAccount_ = value; + bitField0_ |= 0x00000080; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs) + } + + // @@protoc_insertion_point(class_scope:google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs) + private static final com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs(); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AzureEventHubs parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException() + .setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public interface AwsMskOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.pubsub.v1.IngestionDataSourceSettings.AwsMsk) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
    +     * Output only. An output-only field that indicates the state of the Amazon
    +     * MSK ingestion source.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AwsMsk.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for state. + */ + int getStateValue(); + + /** + * + * + *
    +     * Output only. An output-only field that indicates the state of the Amazon
    +     * MSK ingestion source.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AwsMsk.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The state. + */ + com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk.State getState(); + + /** + * + * + *
    +     * Required. The Amazon Resource Name (ARN) that uniquely identifies the
    +     * cluster.
    +     * 
    + * + * string cluster_arn = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The clusterArn. + */ + java.lang.String getClusterArn(); + + /** + * + * + *
    +     * Required. The Amazon Resource Name (ARN) that uniquely identifies the
    +     * cluster.
    +     * 
    + * + * string cluster_arn = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for clusterArn. + */ + com.google.protobuf.ByteString getClusterArnBytes(); + + /** + * + * + *
    +     * 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, (.google.api.resource_reference) = { ... } + * + * + * @return The topic. + */ + java.lang.String getTopic(); + + /** + * + * + *
    +     * 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, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for topic. + */ + com.google.protobuf.ByteString getTopicBytes(); + + /** + * + * + *
    +     * 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
    +     * the required permissions that need to be attached to it.
    +     * 
    + * + * string aws_role_arn = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The awsRoleArn. + */ + java.lang.String getAwsRoleArn(); + + /** + * + * + *
    +     * 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
    +     * the required permissions that need to be attached to it.
    +     * 
    + * + * string aws_role_arn = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for awsRoleArn. + */ + com.google.protobuf.ByteString getAwsRoleArnBytes(); + + /** + * + * + *
    +     * Required. The GCP service account to be used for Federated Identity
    +     * authentication with Amazon MSK (via a `AssumeRoleWithWebIdentity` call
    +     * for the provided role). The `aws_role_arn` must be set up with
    +     * `accounts.google.com:sub` equals to this service account number.
    +     * 
    + * + * string gcp_service_account = 5 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The gcpServiceAccount. + */ + java.lang.String getGcpServiceAccount(); + + /** + * + * + *
    +     * Required. The GCP service account to be used for Federated Identity
    +     * authentication with Amazon MSK (via a `AssumeRoleWithWebIdentity` call
    +     * for the provided role). The `aws_role_arn` must be set up with
    +     * `accounts.google.com:sub` equals to this service account number.
    +     * 
    + * + * string gcp_service_account = 5 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for gcpServiceAccount. + */ + com.google.protobuf.ByteString getGcpServiceAccountBytes(); + } + + /** + * + * + *
    +   * Ingestion settings for Amazon MSK.
    +   * 
    + * + * Protobuf type {@code google.pubsub.v1.IngestionDataSourceSettings.AwsMsk} + */ + public static final class AwsMsk extends com.google.protobuf.GeneratedMessage + implements + // @@protoc_insertion_point(message_implements:google.pubsub.v1.IngestionDataSourceSettings.AwsMsk) + AwsMskOrBuilder { + private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "AwsMsk"); + } + + // Use AwsMsk.newBuilder() to construct. + private AwsMsk(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + + private AwsMsk() { + state_ = 0; + clusterArn_ = ""; + topic_ = ""; + awsRoleArn_ = ""; + gcpServiceAccount_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionDataSourceSettings_AwsMsk_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionDataSourceSettings_AwsMsk_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk.class, + com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk.Builder.class); + } + + /** + * + * + *
    +     * Possible states for managed ingestion from Amazon MSK.
    +     * 
    + * + * Protobuf enum {@code google.pubsub.v1.IngestionDataSourceSettings.AwsMsk.State} + */ + public enum State implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
    +       * Default value. This value is unused.
    +       * 
    + * + * STATE_UNSPECIFIED = 0; + */ + STATE_UNSPECIFIED(0), + /** + * + * + *
    +       * Ingestion is active.
    +       * 
    + * + * ACTIVE = 1; + */ + ACTIVE(1), + /** + * + * + *
    +       * Permission denied encountered while consuming data from Amazon MSK.
    +       * 
    + * + * MSK_PERMISSION_DENIED = 2; + */ + MSK_PERMISSION_DENIED(2), + /** + * + * + *
    +       * Permission denied encountered while publishing to the topic.
    +       * 
    + * + * PUBLISH_PERMISSION_DENIED = 3; + */ + PUBLISH_PERMISSION_DENIED(3), + /** + * + * + *
    +       * The provided MSK cluster wasn't found.
    +       * 
    + * + * CLUSTER_NOT_FOUND = 4; + */ + CLUSTER_NOT_FOUND(4), + /** + * + * + *
    +       * The provided topic wasn't found.
    +       * 
    + * + * TOPIC_NOT_FOUND = 5; + */ + TOPIC_NOT_FOUND(5), + UNRECOGNIZED(-1), + ; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "State"); + } + + /** + * + * + *
    +       * Default value. This value is unused.
    +       * 
    + * + * STATE_UNSPECIFIED = 0; + */ + public static final int STATE_UNSPECIFIED_VALUE = 0; + + /** + * + * + *
    +       * Ingestion is active.
    +       * 
    + * + * ACTIVE = 1; + */ + public static final int ACTIVE_VALUE = 1; + + /** + * + * + *
    +       * Permission denied encountered while consuming data from Amazon MSK.
    +       * 
    + * + * MSK_PERMISSION_DENIED = 2; + */ + public static final int MSK_PERMISSION_DENIED_VALUE = 2; + + /** + * + * + *
    +       * Permission denied encountered while publishing to the topic.
    +       * 
    + * + * PUBLISH_PERMISSION_DENIED = 3; + */ + public static final int PUBLISH_PERMISSION_DENIED_VALUE = 3; + + /** + * + * + *
    +       * The provided MSK cluster wasn't found.
    +       * 
    + * + * CLUSTER_NOT_FOUND = 4; + */ + public static final int CLUSTER_NOT_FOUND_VALUE = 4; + + /** + * + * + *
    +       * The provided topic wasn't found.
    +       * 
    + * + * TOPIC_NOT_FOUND = 5; + */ + public static final int TOPIC_NOT_FOUND_VALUE = 5; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static State valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static State forNumber(int value) { + switch (value) { + case 0: + return STATE_UNSPECIFIED; + case 1: + return ACTIVE; + case 2: + return MSK_PERMISSION_DENIED; + case 3: + return PUBLISH_PERMISSION_DENIED; + case 4: + return CLUSTER_NOT_FOUND; + case 5: + return TOPIC_NOT_FOUND; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public State findValueByNumber(int number) { + return State.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk.getDescriptor() + .getEnumTypes() + .get(0); + } + + private static final State[] VALUES = values(); + + public static State valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private State(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.pubsub.v1.IngestionDataSourceSettings.AwsMsk.State) + } + + public static final int STATE_FIELD_NUMBER = 1; + private int state_ = 0; + + /** + * + * + *
    +     * Output only. An output-only field that indicates the state of the Amazon
    +     * MSK ingestion source.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AwsMsk.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for state. + */ + @java.lang.Override + public int getStateValue() { + return state_; + } + + /** + * + * + *
    +     * Output only. An output-only field that indicates the state of the Amazon
    +     * MSK ingestion source.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AwsMsk.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The state. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk.State getState() { + com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk.State result = + com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk.State.forNumber(state_); + return result == null + ? com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk.State.UNRECOGNIZED + : result; + } + + public static final int CLUSTER_ARN_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private volatile java.lang.Object clusterArn_ = ""; + + /** + * + * + *
    +     * Required. The Amazon Resource Name (ARN) that uniquely identifies the
    +     * cluster.
    +     * 
    + * + * string cluster_arn = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The clusterArn. + */ + @java.lang.Override + public java.lang.String getClusterArn() { + java.lang.Object ref = clusterArn_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + clusterArn_ = s; + return s; + } + } + + /** + * + * + *
    +     * Required. The Amazon Resource Name (ARN) that uniquely identifies the
    +     * cluster.
    +     * 
    + * + * string cluster_arn = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for clusterArn. + */ + @java.lang.Override + public com.google.protobuf.ByteString getClusterArnBytes() { + java.lang.Object ref = clusterArn_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + clusterArn_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int TOPIC_FIELD_NUMBER = 3; + + @SuppressWarnings("serial") + private volatile java.lang.Object topic_ = ""; + + /** + * + * + *
    +     * 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, (.google.api.resource_reference) = { ... } + * + * + * @return The topic. + */ + @java.lang.Override + public java.lang.String getTopic() { + java.lang.Object ref = topic_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + topic_ = s; + return s; + } + } + + /** + * + * + *
    +     * 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, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for topic. + */ + @java.lang.Override + public com.google.protobuf.ByteString getTopicBytes() { + java.lang.Object ref = topic_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + topic_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int AWS_ROLE_ARN_FIELD_NUMBER = 4; + + @SuppressWarnings("serial") + private volatile java.lang.Object awsRoleArn_ = ""; + + /** + * + * + *
    +     * 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
    +     * the required permissions that need to be attached to it.
    +     * 
    + * + * string aws_role_arn = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The awsRoleArn. + */ + @java.lang.Override + public java.lang.String getAwsRoleArn() { + java.lang.Object ref = awsRoleArn_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + awsRoleArn_ = s; + return s; + } + } + + /** + * + * + *
    +     * 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
    +     * the required permissions that need to be attached to it.
    +     * 
    + * + * string aws_role_arn = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for awsRoleArn. + */ + @java.lang.Override + public com.google.protobuf.ByteString getAwsRoleArnBytes() { + java.lang.Object ref = awsRoleArn_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + awsRoleArn_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int GCP_SERVICE_ACCOUNT_FIELD_NUMBER = 5; + + @SuppressWarnings("serial") + private volatile java.lang.Object gcpServiceAccount_ = ""; + + /** + * + * + *
    +     * Required. The GCP service account to be used for Federated Identity
    +     * authentication with Amazon MSK (via a `AssumeRoleWithWebIdentity` call
    +     * for the provided role). The `aws_role_arn` must be set up with
    +     * `accounts.google.com:sub` equals to this service account number.
    +     * 
    + * + * string gcp_service_account = 5 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The gcpServiceAccount. + */ + @java.lang.Override + public java.lang.String getGcpServiceAccount() { + java.lang.Object ref = gcpServiceAccount_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + gcpServiceAccount_ = s; + return s; + } + } + + /** + * + * + *
    +     * Required. The GCP service account to be used for Federated Identity
    +     * authentication with Amazon MSK (via a `AssumeRoleWithWebIdentity` call
    +     * for the provided role). The `aws_role_arn` must be set up with
    +     * `accounts.google.com:sub` equals to this service account number.
    +     * 
    + * + * string gcp_service_account = 5 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for gcpServiceAccount. + */ + @java.lang.Override + public com.google.protobuf.ByteString getGcpServiceAccountBytes() { + java.lang.Object ref = gcpServiceAccount_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + gcpServiceAccount_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (state_ + != com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk.State.STATE_UNSPECIFIED + .getNumber()) { + output.writeEnum(1, state_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(clusterArn_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, clusterArn_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(topic_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 3, topic_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(awsRoleArn_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 4, awsRoleArn_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(gcpServiceAccount_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 5, gcpServiceAccount_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (state_ + != com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk.State.STATE_UNSPECIFIED + .getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, state_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(clusterArn_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, clusterArn_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(topic_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(3, topic_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(awsRoleArn_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(4, awsRoleArn_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(gcpServiceAccount_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(5, gcpServiceAccount_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk)) { + return super.equals(obj); + } + com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk other = + (com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk) obj; + + if (state_ != other.state_) return false; + if (!getClusterArn().equals(other.getClusterArn())) return false; + if (!getTopic().equals(other.getTopic())) return false; + if (!getAwsRoleArn().equals(other.getAwsRoleArn())) return false; + if (!getGcpServiceAccount().equals(other.getGcpServiceAccount())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + STATE_FIELD_NUMBER; + hash = (53 * hash) + state_; + hash = (37 * hash) + CLUSTER_ARN_FIELD_NUMBER; + hash = (53 * hash) + getClusterArn().hashCode(); + hash = (37 * hash) + TOPIC_FIELD_NUMBER; + hash = (53 * hash) + getTopic().hashCode(); + hash = (37 * hash) + AWS_ROLE_ARN_FIELD_NUMBER; + hash = (53 * hash) + getAwsRoleArn().hashCode(); + hash = (37 * hash) + GCP_SERVICE_ACCOUNT_FIELD_NUMBER; + hash = (53 * hash) + getGcpServiceAccount().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + + /** + * + * + *
    +     * Ingestion settings for Amazon MSK.
    +     * 
    + * + * Protobuf type {@code google.pubsub.v1.IngestionDataSourceSettings.AwsMsk} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder + implements + // @@protoc_insertion_point(builder_implements:google.pubsub.v1.IngestionDataSourceSettings.AwsMsk) + com.google.pubsub.v1.IngestionDataSourceSettings.AwsMskOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionDataSourceSettings_AwsMsk_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionDataSourceSettings_AwsMsk_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk.class, + com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk.Builder.class); + } + + // Construct using com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + state_ = 0; + clusterArn_ = ""; + topic_ = ""; + awsRoleArn_ = ""; + gcpServiceAccount_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionDataSourceSettings_AwsMsk_descriptor; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk getDefaultInstanceForType() { + return com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk.getDefaultInstance(); + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk build() { + com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk buildPartial() { + com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk result = + new com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.state_ = state_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.clusterArn_ = clusterArn_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.topic_ = topic_; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.awsRoleArn_ = awsRoleArn_; + } + if (((from_bitField0_ & 0x00000010) != 0)) { + result.gcpServiceAccount_ = gcpServiceAccount_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk) { + return mergeFrom((com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk other) { + if (other == com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk.getDefaultInstance()) + return this; + if (other.state_ != 0) { + setStateValue(other.getStateValue()); + } + if (!other.getClusterArn().isEmpty()) { + clusterArn_ = other.clusterArn_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (!other.getTopic().isEmpty()) { + topic_ = other.topic_; + bitField0_ |= 0x00000004; + onChanged(); + } + if (!other.getAwsRoleArn().isEmpty()) { + awsRoleArn_ = other.awsRoleArn_; + bitField0_ |= 0x00000008; + onChanged(); + } + if (!other.getGcpServiceAccount().isEmpty()) { + gcpServiceAccount_ = other.gcpServiceAccount_; + bitField0_ |= 0x00000010; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: + { + state_ = input.readEnum(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 18: + { + clusterArn_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: + { + topic_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000004; + break; + } // case 26 + case 34: + { + awsRoleArn_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000008; + break; + } // case 34 + case 42: + { + gcpServiceAccount_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000010; + break; + } // case 42 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private int state_ = 0; + + /** + * + * + *
    +       * Output only. An output-only field that indicates the state of the Amazon
    +       * MSK ingestion source.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AwsMsk.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for state. + */ + @java.lang.Override + public int getStateValue() { + return state_; + } + + /** + * + * + *
    +       * Output only. An output-only field that indicates the state of the Amazon
    +       * MSK ingestion source.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AwsMsk.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The enum numeric value on the wire for state to set. + * @return This builder for chaining. + */ + public Builder setStateValue(int value) { + state_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Output only. An output-only field that indicates the state of the Amazon
    +       * MSK ingestion source.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AwsMsk.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The state. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk.State getState() { + com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk.State result = + com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk.State.forNumber(state_); + return result == null + ? com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk.State.UNRECOGNIZED + : result; + } + + /** + * + * + *
    +       * Output only. An output-only field that indicates the state of the Amazon
    +       * MSK ingestion source.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AwsMsk.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The state to set. + * @return This builder for chaining. + */ + public Builder setState(com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk.State value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + state_ = value.getNumber(); + onChanged(); + return this; + } + + /** + * + * + *
    +       * Output only. An output-only field that indicates the state of the Amazon
    +       * MSK ingestion source.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AwsMsk.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return This builder for chaining. + */ + public Builder clearState() { + bitField0_ = (bitField0_ & ~0x00000001); + state_ = 0; + onChanged(); + return this; + } + + private java.lang.Object clusterArn_ = ""; + + /** + * + * + *
    +       * Required. The Amazon Resource Name (ARN) that uniquely identifies the
    +       * cluster.
    +       * 
    + * + * string cluster_arn = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The clusterArn. + */ + public java.lang.String getClusterArn() { + java.lang.Object ref = clusterArn_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + clusterArn_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +       * Required. The Amazon Resource Name (ARN) that uniquely identifies the
    +       * cluster.
    +       * 
    + * + * string cluster_arn = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for clusterArn. + */ + public com.google.protobuf.ByteString getClusterArnBytes() { + java.lang.Object ref = clusterArn_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + clusterArn_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +       * Required. The Amazon Resource Name (ARN) that uniquely identifies the
    +       * cluster.
    +       * 
    + * + * string cluster_arn = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The clusterArn to set. + * @return This builder for chaining. + */ + public Builder setClusterArn(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + clusterArn_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Required. The Amazon Resource Name (ARN) that uniquely identifies the
    +       * cluster.
    +       * 
    + * + * string cluster_arn = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearClusterArn() { + clusterArn_ = getDefaultInstance().getClusterArn(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + + /** + * + * + *
    +       * Required. The Amazon Resource Name (ARN) that uniquely identifies the
    +       * cluster.
    +       * 
    + * + * string cluster_arn = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for clusterArn to set. + * @return This builder for chaining. + */ + public Builder setClusterArnBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + clusterArn_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private java.lang.Object topic_ = ""; + + /** + * + * + *
    +       * 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, (.google.api.resource_reference) = { ... } + * + * + * @return The topic. + */ + public java.lang.String getTopic() { + java.lang.Object ref = topic_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + topic_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +       * 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, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for topic. + */ + public com.google.protobuf.ByteString getTopicBytes() { + java.lang.Object ref = topic_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + topic_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +       * 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, (.google.api.resource_reference) = { ... } + * + * + * @param value The topic to set. + * @return This builder for chaining. + */ + public Builder setTopic(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + topic_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + /** + * + * + *
    +       * 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, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearTopic() { + topic_ = getDefaultInstance().getTopic(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + + /** + * + * + *
    +       * 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, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for topic to set. + * @return This builder for chaining. + */ + public Builder setTopicBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + topic_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + private java.lang.Object awsRoleArn_ = ""; + + /** + * + * + *
    +       * 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
    +       * the required permissions that need to be attached to it.
    +       * 
    + * + * string aws_role_arn = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The awsRoleArn. + */ + public java.lang.String getAwsRoleArn() { + java.lang.Object ref = awsRoleArn_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + awsRoleArn_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +       * 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
    +       * the required permissions that need to be attached to it.
    +       * 
    + * + * string aws_role_arn = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for awsRoleArn. + */ + public com.google.protobuf.ByteString getAwsRoleArnBytes() { + java.lang.Object ref = awsRoleArn_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + awsRoleArn_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +       * 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
    +       * the required permissions that need to be attached to it.
    +       * 
    + * + * string aws_role_arn = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The awsRoleArn to set. + * @return This builder for chaining. + */ + public Builder setAwsRoleArn(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + awsRoleArn_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + + /** + * + * + *
    +       * 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
    +       * the required permissions that need to be attached to it.
    +       * 
    + * + * string aws_role_arn = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearAwsRoleArn() { + awsRoleArn_ = getDefaultInstance().getAwsRoleArn(); + bitField0_ = (bitField0_ & ~0x00000008); + onChanged(); + return this; + } + + /** + * + * + *
    +       * 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
    +       * the required permissions that need to be attached to it.
    +       * 
    + * + * string aws_role_arn = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for awsRoleArn to set. + * @return This builder for chaining. + */ + public Builder setAwsRoleArnBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + awsRoleArn_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + + private java.lang.Object gcpServiceAccount_ = ""; + + /** + * + * + *
    +       * Required. The GCP service account to be used for Federated Identity
    +       * authentication with Amazon MSK (via a `AssumeRoleWithWebIdentity` call
    +       * for the provided role). The `aws_role_arn` must be set up with
    +       * `accounts.google.com:sub` equals to this service account number.
    +       * 
    + * + * string gcp_service_account = 5 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The gcpServiceAccount. + */ + public java.lang.String getGcpServiceAccount() { + java.lang.Object ref = gcpServiceAccount_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + gcpServiceAccount_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +       * Required. The GCP service account to be used for Federated Identity
    +       * authentication with Amazon MSK (via a `AssumeRoleWithWebIdentity` call
    +       * for the provided role). The `aws_role_arn` must be set up with
    +       * `accounts.google.com:sub` equals to this service account number.
    +       * 
    + * + * string gcp_service_account = 5 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for gcpServiceAccount. + */ + public com.google.protobuf.ByteString getGcpServiceAccountBytes() { + java.lang.Object ref = gcpServiceAccount_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + gcpServiceAccount_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +       * Required. The GCP service account to be used for Federated Identity
    +       * authentication with Amazon MSK (via a `AssumeRoleWithWebIdentity` call
    +       * for the provided role). The `aws_role_arn` must be set up with
    +       * `accounts.google.com:sub` equals to this service account number.
    +       * 
    + * + * string gcp_service_account = 5 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The gcpServiceAccount to set. + * @return This builder for chaining. + */ + public Builder setGcpServiceAccount(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + gcpServiceAccount_ = value; + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Required. The GCP service account to be used for Federated Identity
    +       * authentication with Amazon MSK (via a `AssumeRoleWithWebIdentity` call
    +       * for the provided role). The `aws_role_arn` must be set up with
    +       * `accounts.google.com:sub` equals to this service account number.
    +       * 
    + * + * string gcp_service_account = 5 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearGcpServiceAccount() { + gcpServiceAccount_ = getDefaultInstance().getGcpServiceAccount(); + bitField0_ = (bitField0_ & ~0x00000010); + onChanged(); + return this; + } + + /** + * + * + *
    +       * Required. The GCP service account to be used for Federated Identity
    +       * authentication with Amazon MSK (via a `AssumeRoleWithWebIdentity` call
    +       * for the provided role). The `aws_role_arn` must be set up with
    +       * `accounts.google.com:sub` equals to this service account number.
    +       * 
    + * + * string gcp_service_account = 5 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for gcpServiceAccount to set. + * @return This builder for chaining. + */ + public Builder setGcpServiceAccountBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + gcpServiceAccount_ = value; + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:google.pubsub.v1.IngestionDataSourceSettings.AwsMsk) + } + + // @@protoc_insertion_point(class_scope:google.pubsub.v1.IngestionDataSourceSettings.AwsMsk) + private static final com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk(); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AwsMsk parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException() + .setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public interface ConfluentCloudOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
    +     * Output only. An output-only field that indicates the state of the
    +     * Confluent Cloud ingestion source.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for state. + */ + int getStateValue(); + + /** + * + * + *
    +     * Output only. An output-only field that indicates the state of the
    +     * Confluent Cloud ingestion source.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The state. + */ + com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud.State getState(); + + /** + * + * + *
    +     * Required. The address of the bootstrap server. The format is url:port.
    +     * 
    + * + * string bootstrap_server = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bootstrapServer. + */ + java.lang.String getBootstrapServer(); + + /** + * + * + *
    +     * Required. The address of the bootstrap server. The format is url:port.
    +     * 
    + * + * string bootstrap_server = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for bootstrapServer. + */ + com.google.protobuf.ByteString getBootstrapServerBytes(); + + /** + * + * + *
    +     * Required. The id of the cluster.
    +     * 
    + * + * string cluster_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The clusterId. + */ + java.lang.String getClusterId(); + + /** + * + * + *
    +     * Required. The id of the cluster.
    +     * 
    + * + * string cluster_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for clusterId. + */ + com.google.protobuf.ByteString getClusterIdBytes(); + + /** + * + * + *
    +     * Required. The name of the topic in the Confluent Cloud cluster that
    +     * Pub/Sub will import from.
    +     * 
    + * + * string topic = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The topic. + */ + java.lang.String getTopic(); + + /** + * + * + *
    +     * Required. The name of the topic in the Confluent Cloud cluster that
    +     * Pub/Sub will import from.
    +     * 
    + * + * string topic = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for topic. + */ + com.google.protobuf.ByteString getTopicBytes(); + + /** + * + * + *
    +     * Required. The id of the identity pool to be used for Federated Identity
    +     * authentication with Confluent Cloud. See
    +     * https://docs.confluent.io/cloud/current/security/authenticate/workload-identities/identity-providers/oauth/identity-pools.html#add-oauth-identity-pools.
    +     * 
    + * + * string identity_pool_id = 5 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The identityPoolId. + */ + java.lang.String getIdentityPoolId(); + + /** + * + * + *
    +     * Required. The id of the identity pool to be used for Federated Identity
    +     * authentication with Confluent Cloud. See
    +     * https://docs.confluent.io/cloud/current/security/authenticate/workload-identities/identity-providers/oauth/identity-pools.html#add-oauth-identity-pools.
    +     * 
    + * + * string identity_pool_id = 5 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for identityPoolId. + */ + com.google.protobuf.ByteString getIdentityPoolIdBytes(); + + /** + * + * + *
    +     * Required. The GCP service account to be used for Federated Identity
    +     * authentication with `identity_pool_id`.
    +     * 
    + * + * string gcp_service_account = 6 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The gcpServiceAccount. + */ + java.lang.String getGcpServiceAccount(); + + /** + * + * + *
    +     * Required. The GCP service account to be used for Federated Identity
    +     * authentication with `identity_pool_id`.
    +     * 
    + * + * string gcp_service_account = 6 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for gcpServiceAccount. + */ + com.google.protobuf.ByteString getGcpServiceAccountBytes(); + } + + /** + * + * + *
    +   * Ingestion settings for Confluent Cloud.
    +   * 
    + * + * Protobuf type {@code google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud} + */ + public static final class ConfluentCloud extends com.google.protobuf.GeneratedMessage + implements + // @@protoc_insertion_point(message_implements:google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud) + ConfluentCloudOrBuilder { + private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "ConfluentCloud"); + } + + // Use ConfluentCloud.newBuilder() to construct. + private ConfluentCloud(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + + private ConfluentCloud() { + state_ = 0; + bootstrapServer_ = ""; + clusterId_ = ""; + topic_ = ""; + identityPoolId_ = ""; + gcpServiceAccount_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionDataSourceSettings_ConfluentCloud_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionDataSourceSettings_ConfluentCloud_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud.class, + com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud.Builder.class); + } + + /** + * + * + *
    +     * Possible states for managed ingestion from Confluent Cloud.
    +     * 
    + * + * Protobuf enum {@code google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud.State} + */ + public enum State implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
    +       * Default value. This value is unused.
    +       * 
    + * + * STATE_UNSPECIFIED = 0; + */ + STATE_UNSPECIFIED(0), + /** + * + * + *
    +       * Ingestion is active.
    +       * 
    + * + * ACTIVE = 1; + */ + ACTIVE(1), + /** + * + * + *
    +       * Permission denied encountered while consuming data from Confluent
    +       * Cloud.
    +       * 
    + * + * CONFLUENT_CLOUD_PERMISSION_DENIED = 2; + */ + CONFLUENT_CLOUD_PERMISSION_DENIED(2), + /** + * + * + *
    +       * Permission denied encountered while publishing to the topic.
    +       * 
    + * + * PUBLISH_PERMISSION_DENIED = 3; + */ + PUBLISH_PERMISSION_DENIED(3), + /** + * + * + *
    +       * The provided bootstrap server address is unreachable.
    +       * 
    + * + * UNREACHABLE_BOOTSTRAP_SERVER = 4; + */ + UNREACHABLE_BOOTSTRAP_SERVER(4), + /** + * + * + *
    +       * The provided cluster wasn't found.
    +       * 
    + * + * CLUSTER_NOT_FOUND = 5; + */ + CLUSTER_NOT_FOUND(5), + /** + * + * + *
    +       * The provided topic wasn't found.
    +       * 
    + * + * TOPIC_NOT_FOUND = 6; + */ + TOPIC_NOT_FOUND(6), + UNRECOGNIZED(-1), + ; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "State"); + } + + /** + * + * + *
    +       * Default value. This value is unused.
    +       * 
    + * + * STATE_UNSPECIFIED = 0; + */ + public static final int STATE_UNSPECIFIED_VALUE = 0; + + /** + * + * + *
    +       * Ingestion is active.
    +       * 
    + * + * ACTIVE = 1; + */ + public static final int ACTIVE_VALUE = 1; + + /** + * + * + *
    +       * Permission denied encountered while consuming data from Confluent
    +       * Cloud.
    +       * 
    + * + * CONFLUENT_CLOUD_PERMISSION_DENIED = 2; + */ + public static final int CONFLUENT_CLOUD_PERMISSION_DENIED_VALUE = 2; + + /** + * + * + *
    +       * Permission denied encountered while publishing to the topic.
    +       * 
    + * + * PUBLISH_PERMISSION_DENIED = 3; + */ + public static final int PUBLISH_PERMISSION_DENIED_VALUE = 3; + + /** + * + * + *
    +       * The provided bootstrap server address is unreachable.
    +       * 
    + * + * UNREACHABLE_BOOTSTRAP_SERVER = 4; + */ + public static final int UNREACHABLE_BOOTSTRAP_SERVER_VALUE = 4; + + /** + * + * + *
    +       * The provided cluster wasn't found.
    +       * 
    + * + * CLUSTER_NOT_FOUND = 5; + */ + public static final int CLUSTER_NOT_FOUND_VALUE = 5; + + /** + * + * + *
    +       * The provided topic wasn't found.
    +       * 
    + * + * TOPIC_NOT_FOUND = 6; + */ + public static final int TOPIC_NOT_FOUND_VALUE = 6; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static State valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static State forNumber(int value) { + switch (value) { + case 0: + return STATE_UNSPECIFIED; + case 1: + return ACTIVE; + case 2: + return CONFLUENT_CLOUD_PERMISSION_DENIED; + case 3: + return PUBLISH_PERMISSION_DENIED; + case 4: + return UNREACHABLE_BOOTSTRAP_SERVER; + case 5: + return CLUSTER_NOT_FOUND; + case 6: + return TOPIC_NOT_FOUND; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public State findValueByNumber(int number) { + return State.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud.getDescriptor() + .getEnumTypes() + .get(0); + } + + private static final State[] VALUES = values(); + + public static State valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private State(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud.State) + } + + public static final int STATE_FIELD_NUMBER = 1; + private int state_ = 0; + + /** + * + * + *
    +     * Output only. An output-only field that indicates the state of the
    +     * Confluent Cloud ingestion source.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for state. + */ + @java.lang.Override + public int getStateValue() { + return state_; + } + + /** + * + * + *
    +     * Output only. An output-only field that indicates the state of the
    +     * Confluent Cloud ingestion source.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The state. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud.State getState() { + com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud.State result = + com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud.State.forNumber(state_); + return result == null + ? com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud.State.UNRECOGNIZED + : result; + } + + public static final int BOOTSTRAP_SERVER_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private volatile java.lang.Object bootstrapServer_ = ""; + + /** + * + * + *
    +     * Required. The address of the bootstrap server. The format is url:port.
    +     * 
    + * + * string bootstrap_server = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bootstrapServer. + */ + @java.lang.Override + public java.lang.String getBootstrapServer() { + java.lang.Object ref = bootstrapServer_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + bootstrapServer_ = s; + return s; + } + } + + /** + * + * + *
    +     * Required. The address of the bootstrap server. The format is url:port.
    +     * 
    + * + * string bootstrap_server = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for bootstrapServer. + */ + @java.lang.Override + public com.google.protobuf.ByteString getBootstrapServerBytes() { + java.lang.Object ref = bootstrapServer_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + bootstrapServer_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CLUSTER_ID_FIELD_NUMBER = 3; + + @SuppressWarnings("serial") + private volatile java.lang.Object clusterId_ = ""; + + /** + * + * + *
    +     * Required. The id of the cluster.
    +     * 
    + * + * string cluster_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The clusterId. + */ + @java.lang.Override + public java.lang.String getClusterId() { + java.lang.Object ref = clusterId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + clusterId_ = s; + return s; + } + } + + /** + * + * + *
    +     * Required. The id of the cluster.
    +     * 
    + * + * string cluster_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for clusterId. + */ + @java.lang.Override + public com.google.protobuf.ByteString getClusterIdBytes() { + java.lang.Object ref = clusterId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + clusterId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int TOPIC_FIELD_NUMBER = 4; + + @SuppressWarnings("serial") + private volatile java.lang.Object topic_ = ""; + + /** + * + * + *
    +     * Required. The name of the topic in the Confluent Cloud cluster that
    +     * Pub/Sub will import from.
    +     * 
    + * + * string topic = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The topic. + */ + @java.lang.Override + public java.lang.String getTopic() { + java.lang.Object ref = topic_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + topic_ = s; + return s; + } + } + + /** + * + * + *
    +     * Required. The name of the topic in the Confluent Cloud cluster that
    +     * Pub/Sub will import from.
    +     * 
    + * + * string topic = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for topic. + */ + @java.lang.Override + public com.google.protobuf.ByteString getTopicBytes() { + java.lang.Object ref = topic_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + topic_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int IDENTITY_POOL_ID_FIELD_NUMBER = 5; + + @SuppressWarnings("serial") + private volatile java.lang.Object identityPoolId_ = ""; + + /** + * + * + *
    +     * Required. The id of the identity pool to be used for Federated Identity
    +     * authentication with Confluent Cloud. See
    +     * https://docs.confluent.io/cloud/current/security/authenticate/workload-identities/identity-providers/oauth/identity-pools.html#add-oauth-identity-pools.
    +     * 
    + * + * string identity_pool_id = 5 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The identityPoolId. + */ + @java.lang.Override + public java.lang.String getIdentityPoolId() { + java.lang.Object ref = identityPoolId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + identityPoolId_ = s; + return s; + } + } + + /** + * + * + *
    +     * Required. The id of the identity pool to be used for Federated Identity
    +     * authentication with Confluent Cloud. See
    +     * https://docs.confluent.io/cloud/current/security/authenticate/workload-identities/identity-providers/oauth/identity-pools.html#add-oauth-identity-pools.
    +     * 
    + * + * string identity_pool_id = 5 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for identityPoolId. + */ + @java.lang.Override + public com.google.protobuf.ByteString getIdentityPoolIdBytes() { + java.lang.Object ref = identityPoolId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + identityPoolId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int GCP_SERVICE_ACCOUNT_FIELD_NUMBER = 6; + + @SuppressWarnings("serial") + private volatile java.lang.Object gcpServiceAccount_ = ""; + + /** + * + * + *
    +     * Required. The GCP service account to be used for Federated Identity
    +     * authentication with `identity_pool_id`.
    +     * 
    + * + * string gcp_service_account = 6 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The gcpServiceAccount. + */ + @java.lang.Override + public java.lang.String getGcpServiceAccount() { + java.lang.Object ref = gcpServiceAccount_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + gcpServiceAccount_ = s; + return s; + } + } + + /** + * + * + *
    +     * Required. The GCP service account to be used for Federated Identity
    +     * authentication with `identity_pool_id`.
    +     * 
    + * + * string gcp_service_account = 6 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for gcpServiceAccount. + */ + @java.lang.Override + public com.google.protobuf.ByteString getGcpServiceAccountBytes() { + java.lang.Object ref = gcpServiceAccount_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + gcpServiceAccount_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (state_ + != com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud.State.STATE_UNSPECIFIED + .getNumber()) { + output.writeEnum(1, state_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(bootstrapServer_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, bootstrapServer_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(clusterId_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 3, clusterId_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(topic_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 4, topic_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(identityPoolId_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 5, identityPoolId_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(gcpServiceAccount_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 6, gcpServiceAccount_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (state_ + != com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud.State.STATE_UNSPECIFIED + .getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, state_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(bootstrapServer_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, bootstrapServer_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(clusterId_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(3, clusterId_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(topic_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(4, topic_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(identityPoolId_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(5, identityPoolId_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(gcpServiceAccount_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(6, gcpServiceAccount_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud)) { + return super.equals(obj); + } + com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud other = + (com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud) obj; + + if (state_ != other.state_) return false; + if (!getBootstrapServer().equals(other.getBootstrapServer())) return false; + if (!getClusterId().equals(other.getClusterId())) return false; + if (!getTopic().equals(other.getTopic())) return false; + if (!getIdentityPoolId().equals(other.getIdentityPoolId())) return false; + if (!getGcpServiceAccount().equals(other.getGcpServiceAccount())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + STATE_FIELD_NUMBER; + hash = (53 * hash) + state_; + hash = (37 * hash) + BOOTSTRAP_SERVER_FIELD_NUMBER; + hash = (53 * hash) + getBootstrapServer().hashCode(); + hash = (37 * hash) + CLUSTER_ID_FIELD_NUMBER; + hash = (53 * hash) + getClusterId().hashCode(); + hash = (37 * hash) + TOPIC_FIELD_NUMBER; + hash = (53 * hash) + getTopic().hashCode(); + hash = (37 * hash) + IDENTITY_POOL_ID_FIELD_NUMBER; + hash = (53 * hash) + getIdentityPoolId().hashCode(); + hash = (37 * hash) + GCP_SERVICE_ACCOUNT_FIELD_NUMBER; + hash = (53 * hash) + getGcpServiceAccount().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud parseFrom( + byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud + parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud + parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + + /** + * + * + *
    +     * Ingestion settings for Confluent Cloud.
    +     * 
    + * + * Protobuf type {@code google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder + implements + // @@protoc_insertion_point(builder_implements:google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud) + com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloudOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionDataSourceSettings_ConfluentCloud_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionDataSourceSettings_ConfluentCloud_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud.class, + com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud.Builder.class); + } + + // Construct using + // com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + state_ = 0; + bootstrapServer_ = ""; + clusterId_ = ""; + topic_ = ""; + identityPoolId_ = ""; + gcpServiceAccount_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionDataSourceSettings_ConfluentCloud_descriptor; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud + getDefaultInstanceForType() { + return com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud.getDefaultInstance(); + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud build() { + com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud buildPartial() { + com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud result = + new com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0( + com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.state_ = state_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.bootstrapServer_ = bootstrapServer_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.clusterId_ = clusterId_; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.topic_ = topic_; + } + if (((from_bitField0_ & 0x00000010) != 0)) { + result.identityPoolId_ = identityPoolId_; + } + if (((from_bitField0_ & 0x00000020) != 0)) { + result.gcpServiceAccount_ = gcpServiceAccount_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud) { + return mergeFrom((com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud other) { + if (other + == com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud.getDefaultInstance()) + return this; + if (other.state_ != 0) { + setStateValue(other.getStateValue()); + } + if (!other.getBootstrapServer().isEmpty()) { + bootstrapServer_ = other.bootstrapServer_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (!other.getClusterId().isEmpty()) { + clusterId_ = other.clusterId_; + bitField0_ |= 0x00000004; + onChanged(); + } + if (!other.getTopic().isEmpty()) { + topic_ = other.topic_; + bitField0_ |= 0x00000008; + onChanged(); + } + if (!other.getIdentityPoolId().isEmpty()) { + identityPoolId_ = other.identityPoolId_; + bitField0_ |= 0x00000010; + onChanged(); + } + if (!other.getGcpServiceAccount().isEmpty()) { + gcpServiceAccount_ = other.gcpServiceAccount_; + bitField0_ |= 0x00000020; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: + { + state_ = input.readEnum(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 18: + { + bootstrapServer_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: + { + clusterId_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000004; + break; + } // case 26 + case 34: + { + topic_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000008; + break; + } // case 34 + case 42: + { + identityPoolId_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000010; + break; + } // case 42 + case 50: + { + gcpServiceAccount_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000020; + break; + } // case 50 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private int state_ = 0; + + /** + * + * + *
    +       * Output only. An output-only field that indicates the state of the
    +       * Confluent Cloud ingestion source.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for state. + */ + @java.lang.Override + public int getStateValue() { + return state_; + } + + /** + * + * + *
    +       * Output only. An output-only field that indicates the state of the
    +       * Confluent Cloud ingestion source.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The enum numeric value on the wire for state to set. + * @return This builder for chaining. + */ + public Builder setStateValue(int value) { + state_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Output only. An output-only field that indicates the state of the
    +       * Confluent Cloud ingestion source.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The state. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud.State getState() { + com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud.State result = + com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud.State.forNumber(state_); + return result == null + ? com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud.State.UNRECOGNIZED + : result; + } + + /** + * + * + *
    +       * Output only. An output-only field that indicates the state of the
    +       * Confluent Cloud ingestion source.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The state to set. + * @return This builder for chaining. + */ + public Builder setState( + com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud.State value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + state_ = value.getNumber(); + onChanged(); + return this; + } + + /** + * + * + *
    +       * Output only. An output-only field that indicates the state of the
    +       * Confluent Cloud ingestion source.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return This builder for chaining. + */ + public Builder clearState() { + bitField0_ = (bitField0_ & ~0x00000001); + state_ = 0; + onChanged(); + return this; + } + + private java.lang.Object bootstrapServer_ = ""; + + /** + * + * + *
    +       * Required. The address of the bootstrap server. The format is url:port.
    +       * 
    + * + * string bootstrap_server = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bootstrapServer. + */ + public java.lang.String getBootstrapServer() { + java.lang.Object ref = bootstrapServer_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + bootstrapServer_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +       * Required. The address of the bootstrap server. The format is url:port.
    +       * 
    + * + * string bootstrap_server = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for bootstrapServer. + */ + public com.google.protobuf.ByteString getBootstrapServerBytes() { + java.lang.Object ref = bootstrapServer_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + bootstrapServer_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +       * Required. The address of the bootstrap server. The format is url:port.
    +       * 
    + * + * string bootstrap_server = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bootstrapServer to set. + * @return This builder for chaining. + */ + public Builder setBootstrapServer(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + bootstrapServer_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Required. The address of the bootstrap server. The format is url:port.
    +       * 
    + * + * string bootstrap_server = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearBootstrapServer() { + bootstrapServer_ = getDefaultInstance().getBootstrapServer(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + + /** + * + * + *
    +       * Required. The address of the bootstrap server. The format is url:port.
    +       * 
    + * + * string bootstrap_server = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for bootstrapServer to set. + * @return This builder for chaining. + */ + public Builder setBootstrapServerBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + bootstrapServer_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private java.lang.Object clusterId_ = ""; + + /** + * + * + *
    +       * Required. The id of the cluster.
    +       * 
    + * + * string cluster_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The clusterId. + */ + public java.lang.String getClusterId() { + java.lang.Object ref = clusterId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + clusterId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +       * Required. The id of the cluster.
    +       * 
    + * + * string cluster_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for clusterId. + */ + public com.google.protobuf.ByteString getClusterIdBytes() { + java.lang.Object ref = clusterId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + clusterId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +       * Required. The id of the cluster.
    +       * 
    + * + * string cluster_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The clusterId to set. + * @return This builder for chaining. + */ + public Builder setClusterId(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + clusterId_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Required. The id of the cluster.
    +       * 
    + * + * string cluster_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearClusterId() { + clusterId_ = getDefaultInstance().getClusterId(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + + /** + * + * + *
    +       * Required. The id of the cluster.
    +       * 
    + * + * string cluster_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for clusterId to set. + * @return This builder for chaining. + */ + public Builder setClusterIdBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + clusterId_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + private java.lang.Object topic_ = ""; + + /** + * + * + *
    +       * Required. The name of the topic in the Confluent Cloud cluster that
    +       * Pub/Sub will import from.
    +       * 
    + * + * string topic = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The topic. + */ + public java.lang.String getTopic() { + java.lang.Object ref = topic_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + topic_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +       * Required. The name of the topic in the Confluent Cloud cluster that
    +       * Pub/Sub will import from.
    +       * 
    + * + * string topic = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for topic. + */ + public com.google.protobuf.ByteString getTopicBytes() { + java.lang.Object ref = topic_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + topic_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +       * Required. The name of the topic in the Confluent Cloud cluster that
    +       * Pub/Sub will import from.
    +       * 
    + * + * string topic = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The topic to set. + * @return This builder for chaining. + */ + public Builder setTopic(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + topic_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Required. The name of the topic in the Confluent Cloud cluster that
    +       * Pub/Sub will import from.
    +       * 
    + * + * string topic = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearTopic() { + topic_ = getDefaultInstance().getTopic(); + bitField0_ = (bitField0_ & ~0x00000008); + onChanged(); + return this; + } + + /** + * + * + *
    +       * Required. The name of the topic in the Confluent Cloud cluster that
    +       * Pub/Sub will import from.
    +       * 
    + * + * string topic = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for topic to set. + * @return This builder for chaining. + */ + public Builder setTopicBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + topic_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + + private java.lang.Object identityPoolId_ = ""; + + /** + * + * + *
    +       * Required. The id of the identity pool to be used for Federated Identity
    +       * authentication with Confluent Cloud. See
    +       * https://docs.confluent.io/cloud/current/security/authenticate/workload-identities/identity-providers/oauth/identity-pools.html#add-oauth-identity-pools.
    +       * 
    + * + * string identity_pool_id = 5 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The identityPoolId. + */ + public java.lang.String getIdentityPoolId() { + java.lang.Object ref = identityPoolId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + identityPoolId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +       * Required. The id of the identity pool to be used for Federated Identity
    +       * authentication with Confluent Cloud. See
    +       * https://docs.confluent.io/cloud/current/security/authenticate/workload-identities/identity-providers/oauth/identity-pools.html#add-oauth-identity-pools.
    +       * 
    + * + * string identity_pool_id = 5 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for identityPoolId. + */ + public com.google.protobuf.ByteString getIdentityPoolIdBytes() { + java.lang.Object ref = identityPoolId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + identityPoolId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +       * Required. The id of the identity pool to be used for Federated Identity
    +       * authentication with Confluent Cloud. See
    +       * https://docs.confluent.io/cloud/current/security/authenticate/workload-identities/identity-providers/oauth/identity-pools.html#add-oauth-identity-pools.
    +       * 
    + * + * string identity_pool_id = 5 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The identityPoolId to set. + * @return This builder for chaining. + */ + public Builder setIdentityPoolId(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + identityPoolId_ = value; + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Required. The id of the identity pool to be used for Federated Identity
    +       * authentication with Confluent Cloud. See
    +       * https://docs.confluent.io/cloud/current/security/authenticate/workload-identities/identity-providers/oauth/identity-pools.html#add-oauth-identity-pools.
    +       * 
    + * + * string identity_pool_id = 5 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearIdentityPoolId() { + identityPoolId_ = getDefaultInstance().getIdentityPoolId(); + bitField0_ = (bitField0_ & ~0x00000010); + onChanged(); + return this; + } + + /** + * + * + *
    +       * Required. The id of the identity pool to be used for Federated Identity
    +       * authentication with Confluent Cloud. See
    +       * https://docs.confluent.io/cloud/current/security/authenticate/workload-identities/identity-providers/oauth/identity-pools.html#add-oauth-identity-pools.
    +       * 
    + * + * string identity_pool_id = 5 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for identityPoolId to set. + * @return This builder for chaining. + */ + public Builder setIdentityPoolIdBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + identityPoolId_ = value; + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + + private java.lang.Object gcpServiceAccount_ = ""; + + /** + * + * + *
    +       * Required. The GCP service account to be used for Federated Identity
    +       * authentication with `identity_pool_id`.
    +       * 
    + * + * string gcp_service_account = 6 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The gcpServiceAccount. + */ + public java.lang.String getGcpServiceAccount() { + java.lang.Object ref = gcpServiceAccount_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + gcpServiceAccount_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +       * Required. The GCP service account to be used for Federated Identity
    +       * authentication with `identity_pool_id`.
    +       * 
    + * + * string gcp_service_account = 6 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for gcpServiceAccount. + */ + public com.google.protobuf.ByteString getGcpServiceAccountBytes() { + java.lang.Object ref = gcpServiceAccount_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + gcpServiceAccount_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +       * Required. The GCP service account to be used for Federated Identity
    +       * authentication with `identity_pool_id`.
    +       * 
    + * + * string gcp_service_account = 6 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The gcpServiceAccount to set. + * @return This builder for chaining. + */ + public Builder setGcpServiceAccount(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + gcpServiceAccount_ = value; + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Required. The GCP service account to be used for Federated Identity
    +       * authentication with `identity_pool_id`.
    +       * 
    + * + * string gcp_service_account = 6 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearGcpServiceAccount() { + gcpServiceAccount_ = getDefaultInstance().getGcpServiceAccount(); + bitField0_ = (bitField0_ & ~0x00000020); + onChanged(); + return this; + } + + /** + * + * + *
    +       * Required. The GCP service account to be used for Federated Identity
    +       * authentication with `identity_pool_id`.
    +       * 
    + * + * string gcp_service_account = 6 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for gcpServiceAccount to set. + * @return This builder for chaining. + */ + public Builder setGcpServiceAccountBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + gcpServiceAccount_ = value; + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud) + } + + // @@protoc_insertion_point(class_scope:google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud) + private static final com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud(); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ConfluentCloud parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException() + .setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + private int bitField0_; + private int sourceCase_ = 0; + + @SuppressWarnings("serial") + private java.lang.Object source_; + + public enum SourceCase + implements + com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + AWS_KINESIS(1), + CLOUD_STORAGE(2), + AZURE_EVENT_HUBS(3), + AWS_MSK(5), + CONFLUENT_CLOUD(6), + SOURCE_NOT_SET(0); + private final int value; + + private SourceCase(int value) { + this.value = value; + } + + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static SourceCase valueOf(int value) { + return forNumber(value); + } + + public static SourceCase forNumber(int value) { + switch (value) { + case 1: + return AWS_KINESIS; + case 2: + return CLOUD_STORAGE; + case 3: + return AZURE_EVENT_HUBS; + case 5: + return AWS_MSK; + case 6: + return CONFLUENT_CLOUD; + case 0: + return SOURCE_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public SourceCase getSourceCase() { + return SourceCase.forNumber(sourceCase_); + } + + public static final int AWS_KINESIS_FIELD_NUMBER = 1; + + /** + * + * + *
    +   * Optional. Amazon Kinesis Data Streams.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis aws_kinesis = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the awsKinesis field is set. + */ + @java.lang.Override + public boolean hasAwsKinesis() { + return sourceCase_ == 1; + } + + /** + * + * + *
    +   * Optional. Amazon Kinesis Data Streams.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis aws_kinesis = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The awsKinesis. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis getAwsKinesis() { + if (sourceCase_ == 1) { + return (com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis) source_; + } + return com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.getDefaultInstance(); + } + + /** + * + * + *
    +   * Optional. Amazon Kinesis Data Streams.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis aws_kinesis = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesisOrBuilder + getAwsKinesisOrBuilder() { + if (sourceCase_ == 1) { + return (com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis) source_; + } + return com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.getDefaultInstance(); + } + + public static final int CLOUD_STORAGE_FIELD_NUMBER = 2; + + /** + * + * + *
    +   * Optional. Cloud Storage.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage cloud_storage = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the cloudStorage field is set. + */ + @java.lang.Override + public boolean hasCloudStorage() { + return sourceCase_ == 2; + } + + /** + * + * + *
    +   * Optional. Cloud Storage.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage cloud_storage = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The cloudStorage. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage getCloudStorage() { + if (sourceCase_ == 2) { + return (com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage) source_; + } + return com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.getDefaultInstance(); + } + + /** + * + * + *
    +   * Optional. Cloud Storage.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage cloud_storage = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorageOrBuilder + getCloudStorageOrBuilder() { + if (sourceCase_ == 2) { + return (com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage) source_; + } + return com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.getDefaultInstance(); + } + + public static final int AZURE_EVENT_HUBS_FIELD_NUMBER = 3; + + /** + * + * + *
    +   * Optional. Azure Event Hubs.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs azure_event_hubs = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the azureEventHubs field is set. + */ + @java.lang.Override + public boolean hasAzureEventHubs() { + return sourceCase_ == 3; + } + + /** + * + * + *
    +   * Optional. Azure Event Hubs.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs azure_event_hubs = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The azureEventHubs. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs getAzureEventHubs() { + if (sourceCase_ == 3) { + return (com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs) source_; + } + return com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs.getDefaultInstance(); + } + + /** + * + * + *
    +   * Optional. Azure Event Hubs.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs azure_event_hubs = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubsOrBuilder + getAzureEventHubsOrBuilder() { + if (sourceCase_ == 3) { + return (com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs) source_; + } + return com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs.getDefaultInstance(); + } + + public static final int AWS_MSK_FIELD_NUMBER = 5; + + /** + * + * + *
    +   * Optional. Amazon MSK.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AwsMsk aws_msk = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the awsMsk field is set. + */ + @java.lang.Override + public boolean hasAwsMsk() { + return sourceCase_ == 5; + } + + /** + * + * + *
    +   * Optional. Amazon MSK.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AwsMsk aws_msk = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The awsMsk. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk getAwsMsk() { + if (sourceCase_ == 5) { + return (com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk) source_; + } + return com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk.getDefaultInstance(); + } + + /** + * + * + *
    +   * Optional. Amazon MSK.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AwsMsk aws_msk = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.AwsMskOrBuilder getAwsMskOrBuilder() { + if (sourceCase_ == 5) { + return (com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk) source_; + } + return com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk.getDefaultInstance(); + } + + public static final int CONFLUENT_CLOUD_FIELD_NUMBER = 6; + + /** + * + * + *
    +   * Optional. Confluent Cloud.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud confluent_cloud = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the confluentCloud field is set. + */ + @java.lang.Override + public boolean hasConfluentCloud() { + return sourceCase_ == 6; + } + + /** + * + * + *
    +   * Optional. Confluent Cloud.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud confluent_cloud = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The confluentCloud. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud getConfluentCloud() { + if (sourceCase_ == 6) { + return (com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud) source_; + } + return com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud.getDefaultInstance(); + } + + /** + * + * + *
    +   * Optional. Confluent Cloud.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud confluent_cloud = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloudOrBuilder + getConfluentCloudOrBuilder() { + if (sourceCase_ == 6) { + return (com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud) source_; + } + return com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud.getDefaultInstance(); + } + + public static final int PLATFORM_LOGS_SETTINGS_FIELD_NUMBER = 4; + private com.google.pubsub.v1.PlatformLogsSettings platformLogsSettings_; + + /** + * + * + *
    +   * Optional. Platform Logs settings. If unset, no Platform Logs will be
    +   * generated.
    +   * 
    + * + * + * .google.pubsub.v1.PlatformLogsSettings platform_logs_settings = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the platformLogsSettings field is set. + */ + @java.lang.Override + public boolean hasPlatformLogsSettings() { + return ((bitField0_ & 0x00000001) != 0); + } + + /** + * + * + *
    +   * Optional. Platform Logs settings. If unset, no Platform Logs will be
    +   * generated.
    +   * 
    + * + * + * .google.pubsub.v1.PlatformLogsSettings platform_logs_settings = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The platformLogsSettings. + */ + @java.lang.Override + public com.google.pubsub.v1.PlatformLogsSettings getPlatformLogsSettings() { + return platformLogsSettings_ == null + ? com.google.pubsub.v1.PlatformLogsSettings.getDefaultInstance() + : platformLogsSettings_; + } + + /** + * + * + *
    +   * Optional. Platform Logs settings. If unset, no Platform Logs will be
    +   * generated.
    +   * 
    + * + * + * .google.pubsub.v1.PlatformLogsSettings platform_logs_settings = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.PlatformLogsSettingsOrBuilder getPlatformLogsSettingsOrBuilder() { + return platformLogsSettings_ == null + ? com.google.pubsub.v1.PlatformLogsSettings.getDefaultInstance() + : platformLogsSettings_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (sourceCase_ == 1) { + output.writeMessage(1, (com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis) source_); + } + if (sourceCase_ == 2) { + output.writeMessage( + 2, (com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage) source_); + } + if (sourceCase_ == 3) { + output.writeMessage( + 3, (com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs) source_); + } + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(4, getPlatformLogsSettings()); + } + if (sourceCase_ == 5) { + output.writeMessage(5, (com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk) source_); + } + if (sourceCase_ == 6) { + output.writeMessage( + 6, (com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud) source_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (sourceCase_ == 1) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 1, (com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis) source_); + } + if (sourceCase_ == 2) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 2, (com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage) source_); + } + if (sourceCase_ == 3) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 3, (com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs) source_); + } + if (((bitField0_ & 0x00000001) != 0)) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize(4, getPlatformLogsSettings()); + } + if (sourceCase_ == 5) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 5, (com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk) source_); + } + if (sourceCase_ == 6) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 6, (com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud) source_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.pubsub.v1.IngestionDataSourceSettings)) { + return super.equals(obj); + } + com.google.pubsub.v1.IngestionDataSourceSettings other = + (com.google.pubsub.v1.IngestionDataSourceSettings) obj; + + if (hasPlatformLogsSettings() != other.hasPlatformLogsSettings()) return false; + if (hasPlatformLogsSettings()) { + if (!getPlatformLogsSettings().equals(other.getPlatformLogsSettings())) return false; + } + if (!getSourceCase().equals(other.getSourceCase())) return false; + switch (sourceCase_) { + case 1: + if (!getAwsKinesis().equals(other.getAwsKinesis())) return false; + break; + case 2: + if (!getCloudStorage().equals(other.getCloudStorage())) return false; + break; + case 3: + if (!getAzureEventHubs().equals(other.getAzureEventHubs())) return false; + break; + case 5: + if (!getAwsMsk().equals(other.getAwsMsk())) return false; + break; + case 6: + if (!getConfluentCloud().equals(other.getConfluentCloud())) return false; + break; + case 0: + default: + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasPlatformLogsSettings()) { + hash = (37 * hash) + PLATFORM_LOGS_SETTINGS_FIELD_NUMBER; + hash = (53 * hash) + getPlatformLogsSettings().hashCode(); + } + switch (sourceCase_) { + case 1: + hash = (37 * hash) + AWS_KINESIS_FIELD_NUMBER; + hash = (53 * hash) + getAwsKinesis().hashCode(); + break; + case 2: + hash = (37 * hash) + CLOUD_STORAGE_FIELD_NUMBER; + hash = (53 * hash) + getCloudStorage().hashCode(); + break; + case 3: + hash = (37 * hash) + AZURE_EVENT_HUBS_FIELD_NUMBER; + hash = (53 * hash) + getAzureEventHubs().hashCode(); + break; + case 5: + hash = (37 * hash) + AWS_MSK_FIELD_NUMBER; + hash = (53 * hash) + getAwsMsk().hashCode(); + break; + case 6: + hash = (37 * hash) + CONFLUENT_CLOUD_FIELD_NUMBER; + hash = (53 * hash) + getConfluentCloud().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.pubsub.v1.IngestionDataSourceSettings prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + + /** + * + * + *
    +   * Settings for an ingestion data source on a topic.
    +   * 
    + * + * Protobuf type {@code google.pubsub.v1.IngestionDataSourceSettings} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder + implements + // @@protoc_insertion_point(builder_implements:google.pubsub.v1.IngestionDataSourceSettings) + com.google.pubsub.v1.IngestionDataSourceSettingsOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionDataSourceSettings_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionDataSourceSettings_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.IngestionDataSourceSettings.class, + com.google.pubsub.v1.IngestionDataSourceSettings.Builder.class); + } + + // Construct using com.google.pubsub.v1.IngestionDataSourceSettings.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + internalGetPlatformLogsSettingsFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + if (awsKinesisBuilder_ != null) { + awsKinesisBuilder_.clear(); + } + if (cloudStorageBuilder_ != null) { + cloudStorageBuilder_.clear(); + } + if (azureEventHubsBuilder_ != null) { + azureEventHubsBuilder_.clear(); + } + if (awsMskBuilder_ != null) { + awsMskBuilder_.clear(); + } + if (confluentCloudBuilder_ != null) { + confluentCloudBuilder_.clear(); + } + platformLogsSettings_ = null; + if (platformLogsSettingsBuilder_ != null) { + platformLogsSettingsBuilder_.dispose(); + platformLogsSettingsBuilder_ = null; + } + sourceCase_ = 0; + source_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionDataSourceSettings_descriptor; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings getDefaultInstanceForType() { + return com.google.pubsub.v1.IngestionDataSourceSettings.getDefaultInstance(); + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings build() { + com.google.pubsub.v1.IngestionDataSourceSettings result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings buildPartial() { + com.google.pubsub.v1.IngestionDataSourceSettings result = + new com.google.pubsub.v1.IngestionDataSourceSettings(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + buildPartialOneofs(result); + onBuilt(); + return result; + } + + private void buildPartial0(com.google.pubsub.v1.IngestionDataSourceSettings result) { + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000020) != 0)) { + result.platformLogsSettings_ = + platformLogsSettingsBuilder_ == null + ? platformLogsSettings_ + : platformLogsSettingsBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + result.bitField0_ |= to_bitField0_; + } + + private void buildPartialOneofs(com.google.pubsub.v1.IngestionDataSourceSettings result) { + result.sourceCase_ = sourceCase_; + result.source_ = this.source_; + if (sourceCase_ == 1 && awsKinesisBuilder_ != null) { + result.source_ = awsKinesisBuilder_.build(); + } + if (sourceCase_ == 2 && cloudStorageBuilder_ != null) { + result.source_ = cloudStorageBuilder_.build(); + } + if (sourceCase_ == 3 && azureEventHubsBuilder_ != null) { + result.source_ = azureEventHubsBuilder_.build(); + } + if (sourceCase_ == 5 && awsMskBuilder_ != null) { + result.source_ = awsMskBuilder_.build(); + } + if (sourceCase_ == 6 && confluentCloudBuilder_ != null) { + result.source_ = confluentCloudBuilder_.build(); + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.pubsub.v1.IngestionDataSourceSettings) { + return mergeFrom((com.google.pubsub.v1.IngestionDataSourceSettings) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.pubsub.v1.IngestionDataSourceSettings other) { + if (other == com.google.pubsub.v1.IngestionDataSourceSettings.getDefaultInstance()) + return this; + if (other.hasPlatformLogsSettings()) { + mergePlatformLogsSettings(other.getPlatformLogsSettings()); + } + switch (other.getSourceCase()) { + case AWS_KINESIS: + { + mergeAwsKinesis(other.getAwsKinesis()); + break; + } + case CLOUD_STORAGE: + { + mergeCloudStorage(other.getCloudStorage()); + break; + } + case AZURE_EVENT_HUBS: + { + mergeAzureEventHubs(other.getAzureEventHubs()); + break; + } + case AWS_MSK: + { + mergeAwsMsk(other.getAwsMsk()); + break; + } + case CONFLUENT_CLOUD: + { + mergeConfluentCloud(other.getConfluentCloud()); + break; + } + case SOURCE_NOT_SET: + { + break; + } + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + input.readMessage( + internalGetAwsKinesisFieldBuilder().getBuilder(), extensionRegistry); + sourceCase_ = 1; + break; + } // case 10 + case 18: + { + input.readMessage( + internalGetCloudStorageFieldBuilder().getBuilder(), extensionRegistry); + sourceCase_ = 2; + break; + } // case 18 + case 26: + { + input.readMessage( + internalGetAzureEventHubsFieldBuilder().getBuilder(), extensionRegistry); + sourceCase_ = 3; + break; + } // case 26 + case 34: + { + input.readMessage( + internalGetPlatformLogsSettingsFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000020; + break; + } // case 34 + case 42: + { + input.readMessage(internalGetAwsMskFieldBuilder().getBuilder(), extensionRegistry); + sourceCase_ = 5; + break; + } // case 42 + case 50: + { + input.readMessage( + internalGetConfluentCloudFieldBuilder().getBuilder(), extensionRegistry); + sourceCase_ = 6; + break; + } // case 50 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int sourceCase_ = 0; + private java.lang.Object source_; + + public SourceCase getSourceCase() { + return SourceCase.forNumber(sourceCase_); + } + + public Builder clearSource() { + sourceCase_ = 0; + source_ = null; + onChanged(); + return this; + } + + private int bitField0_; + + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis, + com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.Builder, + com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesisOrBuilder> + awsKinesisBuilder_; + + /** + * + * + *
    +     * Optional. Amazon Kinesis Data Streams.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis aws_kinesis = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the awsKinesis field is set. + */ + @java.lang.Override + public boolean hasAwsKinesis() { + return sourceCase_ == 1; + } + + /** + * + * + *
    +     * Optional. Amazon Kinesis Data Streams.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis aws_kinesis = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The awsKinesis. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis getAwsKinesis() { + if (awsKinesisBuilder_ == null) { + if (sourceCase_ == 1) { + return (com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis) source_; + } + return com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.getDefaultInstance(); + } else { + if (sourceCase_ == 1) { + return awsKinesisBuilder_.getMessage(); + } + return com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.getDefaultInstance(); + } + } + + /** + * + * + *
    +     * Optional. Amazon Kinesis Data Streams.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis aws_kinesis = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setAwsKinesis( + com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis value) { + if (awsKinesisBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + source_ = value; + onChanged(); + } else { + awsKinesisBuilder_.setMessage(value); + } + sourceCase_ = 1; + return this; + } + + /** + * + * + *
    +     * Optional. Amazon Kinesis Data Streams.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis aws_kinesis = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setAwsKinesis( + com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.Builder builderForValue) { + if (awsKinesisBuilder_ == null) { + source_ = builderForValue.build(); + onChanged(); + } else { + awsKinesisBuilder_.setMessage(builderForValue.build()); + } + sourceCase_ = 1; + return this; + } + + /** + * + * + *
    +     * Optional. Amazon Kinesis Data Streams.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis aws_kinesis = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeAwsKinesis( + com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis value) { + if (awsKinesisBuilder_ == null) { + if (sourceCase_ == 1 + && source_ + != com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis + .getDefaultInstance()) { + source_ = + com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.newBuilder( + (com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis) source_) + .mergeFrom(value) + .buildPartial(); + } else { + source_ = value; + } + onChanged(); + } else { + if (sourceCase_ == 1) { + awsKinesisBuilder_.mergeFrom(value); + } else { + awsKinesisBuilder_.setMessage(value); + } + } + sourceCase_ = 1; + return this; + } + + /** + * + * + *
    +     * Optional. Amazon Kinesis Data Streams.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis aws_kinesis = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearAwsKinesis() { + if (awsKinesisBuilder_ == null) { + if (sourceCase_ == 1) { + sourceCase_ = 0; + source_ = null; + onChanged(); + } + } else { + if (sourceCase_ == 1) { + sourceCase_ = 0; + source_ = null; + } + awsKinesisBuilder_.clear(); + } + return this; + } + + /** + * + * + *
    +     * Optional. Amazon Kinesis Data Streams.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis aws_kinesis = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.Builder + getAwsKinesisBuilder() { + return internalGetAwsKinesisFieldBuilder().getBuilder(); + } + + /** + * + * + *
    +     * Optional. Amazon Kinesis Data Streams.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis aws_kinesis = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesisOrBuilder + getAwsKinesisOrBuilder() { + if ((sourceCase_ == 1) && (awsKinesisBuilder_ != null)) { + return awsKinesisBuilder_.getMessageOrBuilder(); + } else { + if (sourceCase_ == 1) { + return (com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis) source_; + } + return com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.getDefaultInstance(); + } + } + + /** + * + * + *
    +     * Optional. Amazon Kinesis Data Streams.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis aws_kinesis = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis, + com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.Builder, + com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesisOrBuilder> + internalGetAwsKinesisFieldBuilder() { + if (awsKinesisBuilder_ == null) { + if (!(sourceCase_ == 1)) { + source_ = + com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.getDefaultInstance(); + } + awsKinesisBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis, + com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.Builder, + com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesisOrBuilder>( + (com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis) source_, + getParentForChildren(), + isClean()); + source_ = null; + } + sourceCase_ = 1; + onChanged(); + return awsKinesisBuilder_; + } + + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage, + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.Builder, + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorageOrBuilder> + cloudStorageBuilder_; + + /** + * + * + *
    +     * Optional. Cloud Storage.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage cloud_storage = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the cloudStorage field is set. + */ + @java.lang.Override + public boolean hasCloudStorage() { + return sourceCase_ == 2; + } + + /** + * + * + *
    +     * Optional. Cloud Storage.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage cloud_storage = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The cloudStorage. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage getCloudStorage() { + if (cloudStorageBuilder_ == null) { + if (sourceCase_ == 2) { + return (com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage) source_; + } + return com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.getDefaultInstance(); + } else { + if (sourceCase_ == 2) { + return cloudStorageBuilder_.getMessage(); + } + return com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.getDefaultInstance(); + } + } + + /** + * + * + *
    +     * Optional. Cloud Storage.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage cloud_storage = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setCloudStorage( + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage value) { + if (cloudStorageBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + source_ = value; + onChanged(); + } else { + cloudStorageBuilder_.setMessage(value); + } + sourceCase_ = 2; + return this; + } + + /** + * + * + *
    +     * Optional. Cloud Storage.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage cloud_storage = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setCloudStorage( + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.Builder builderForValue) { + if (cloudStorageBuilder_ == null) { + source_ = builderForValue.build(); + onChanged(); + } else { + cloudStorageBuilder_.setMessage(builderForValue.build()); + } + sourceCase_ = 2; + return this; + } + + /** + * + * + *
    +     * Optional. Cloud Storage.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage cloud_storage = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeCloudStorage( + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage value) { + if (cloudStorageBuilder_ == null) { + if (sourceCase_ == 2 + && source_ + != com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage + .getDefaultInstance()) { + source_ = + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.newBuilder( + (com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage) source_) + .mergeFrom(value) + .buildPartial(); + } else { + source_ = value; + } + onChanged(); + } else { + if (sourceCase_ == 2) { + cloudStorageBuilder_.mergeFrom(value); + } else { + cloudStorageBuilder_.setMessage(value); + } + } + sourceCase_ = 2; + return this; + } + + /** + * + * + *
    +     * Optional. Cloud Storage.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage cloud_storage = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearCloudStorage() { + if (cloudStorageBuilder_ == null) { + if (sourceCase_ == 2) { + sourceCase_ = 0; + source_ = null; + onChanged(); + } + } else { + if (sourceCase_ == 2) { + sourceCase_ = 0; + source_ = null; + } + cloudStorageBuilder_.clear(); + } + return this; + } + + /** + * + * + *
    +     * Optional. Cloud Storage.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage cloud_storage = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.Builder + getCloudStorageBuilder() { + return internalGetCloudStorageFieldBuilder().getBuilder(); + } + + /** + * + * + *
    +     * Optional. Cloud Storage.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage cloud_storage = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorageOrBuilder + getCloudStorageOrBuilder() { + if ((sourceCase_ == 2) && (cloudStorageBuilder_ != null)) { + return cloudStorageBuilder_.getMessageOrBuilder(); + } else { + if (sourceCase_ == 2) { + return (com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage) source_; + } + return com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.getDefaultInstance(); + } + } + + /** + * + * + *
    +     * Optional. Cloud Storage.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage cloud_storage = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage, + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.Builder, + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorageOrBuilder> + internalGetCloudStorageFieldBuilder() { + if (cloudStorageBuilder_ == null) { + if (!(sourceCase_ == 2)) { + source_ = + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.getDefaultInstance(); + } + cloudStorageBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage, + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.Builder, + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorageOrBuilder>( + (com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage) source_, + getParentForChildren(), + isClean()); + source_ = null; + } + sourceCase_ = 2; + onChanged(); + return cloudStorageBuilder_; + } + + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs, + com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs.Builder, + com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubsOrBuilder> + azureEventHubsBuilder_; + + /** + * + * + *
    +     * Optional. Azure Event Hubs.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs azure_event_hubs = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the azureEventHubs field is set. + */ + @java.lang.Override + public boolean hasAzureEventHubs() { + return sourceCase_ == 3; + } + + /** + * + * + *
    +     * Optional. Azure Event Hubs.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs azure_event_hubs = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The azureEventHubs. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs getAzureEventHubs() { + if (azureEventHubsBuilder_ == null) { + if (sourceCase_ == 3) { + return (com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs) source_; + } + return com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs.getDefaultInstance(); + } else { + if (sourceCase_ == 3) { + return azureEventHubsBuilder_.getMessage(); + } + return com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs.getDefaultInstance(); + } + } + + /** + * + * + *
    +     * Optional. Azure Event Hubs.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs azure_event_hubs = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setAzureEventHubs( + com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs value) { + if (azureEventHubsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + source_ = value; + onChanged(); + } else { + azureEventHubsBuilder_.setMessage(value); + } + sourceCase_ = 3; + return this; + } + + /** + * + * + *
    +     * Optional. Azure Event Hubs.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs azure_event_hubs = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setAzureEventHubs( + com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs.Builder builderForValue) { + if (azureEventHubsBuilder_ == null) { + source_ = builderForValue.build(); + onChanged(); + } else { + azureEventHubsBuilder_.setMessage(builderForValue.build()); + } + sourceCase_ = 3; + return this; + } + + /** + * + * + *
    +     * Optional. Azure Event Hubs.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs azure_event_hubs = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeAzureEventHubs( + com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs value) { + if (azureEventHubsBuilder_ == null) { + if (sourceCase_ == 3 + && source_ + != com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs + .getDefaultInstance()) { + source_ = + com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs.newBuilder( + (com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs) source_) + .mergeFrom(value) + .buildPartial(); + } else { + source_ = value; + } + onChanged(); + } else { + if (sourceCase_ == 3) { + azureEventHubsBuilder_.mergeFrom(value); + } else { + azureEventHubsBuilder_.setMessage(value); + } + } + sourceCase_ = 3; + return this; + } + + /** + * + * + *
    +     * Optional. Azure Event Hubs.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs azure_event_hubs = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearAzureEventHubs() { + if (azureEventHubsBuilder_ == null) { + if (sourceCase_ == 3) { + sourceCase_ = 0; + source_ = null; + onChanged(); + } + } else { + if (sourceCase_ == 3) { + sourceCase_ = 0; + source_ = null; + } + azureEventHubsBuilder_.clear(); + } + return this; + } + + /** + * + * + *
    +     * Optional. Azure Event Hubs.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs azure_event_hubs = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs.Builder + getAzureEventHubsBuilder() { + return internalGetAzureEventHubsFieldBuilder().getBuilder(); + } + + /** + * + * + *
    +     * Optional. Azure Event Hubs.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs azure_event_hubs = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubsOrBuilder + getAzureEventHubsOrBuilder() { + if ((sourceCase_ == 3) && (azureEventHubsBuilder_ != null)) { + return azureEventHubsBuilder_.getMessageOrBuilder(); + } else { + if (sourceCase_ == 3) { + return (com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs) source_; + } + return com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs.getDefaultInstance(); + } + } + + /** + * + * + *
    +     * Optional. Azure Event Hubs.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs azure_event_hubs = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs, + com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs.Builder, + com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubsOrBuilder> + internalGetAzureEventHubsFieldBuilder() { + if (azureEventHubsBuilder_ == null) { + if (!(sourceCase_ == 3)) { + source_ = + com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs.getDefaultInstance(); + } + azureEventHubsBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs, + com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs.Builder, + com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubsOrBuilder>( + (com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs) source_, + getParentForChildren(), + isClean()); + source_ = null; + } + sourceCase_ = 3; + onChanged(); + return azureEventHubsBuilder_; + } + + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk, + com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk.Builder, + com.google.pubsub.v1.IngestionDataSourceSettings.AwsMskOrBuilder> + awsMskBuilder_; + + /** + * + * + *
    +     * Optional. Amazon MSK.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AwsMsk aws_msk = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the awsMsk field is set. + */ + @java.lang.Override + public boolean hasAwsMsk() { + return sourceCase_ == 5; + } + + /** + * + * + *
    +     * Optional. Amazon MSK.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AwsMsk aws_msk = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The awsMsk. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk getAwsMsk() { + if (awsMskBuilder_ == null) { + if (sourceCase_ == 5) { + return (com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk) source_; + } + return com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk.getDefaultInstance(); + } else { + if (sourceCase_ == 5) { + return awsMskBuilder_.getMessage(); + } + return com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk.getDefaultInstance(); + } + } + + /** + * + * + *
    +     * Optional. Amazon MSK.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AwsMsk aws_msk = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setAwsMsk(com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk value) { + if (awsMskBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + source_ = value; + onChanged(); + } else { + awsMskBuilder_.setMessage(value); + } + sourceCase_ = 5; + return this; + } + + /** + * + * + *
    +     * Optional. Amazon MSK.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AwsMsk aws_msk = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setAwsMsk( + com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk.Builder builderForValue) { + if (awsMskBuilder_ == null) { + source_ = builderForValue.build(); + onChanged(); + } else { + awsMskBuilder_.setMessage(builderForValue.build()); + } + sourceCase_ = 5; + return this; + } + + /** + * + * + *
    +     * Optional. Amazon MSK.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AwsMsk aws_msk = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeAwsMsk(com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk value) { + if (awsMskBuilder_ == null) { + if (sourceCase_ == 5 + && source_ + != com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk.getDefaultInstance()) { + source_ = + com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk.newBuilder( + (com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk) source_) + .mergeFrom(value) + .buildPartial(); + } else { + source_ = value; + } + onChanged(); + } else { + if (sourceCase_ == 5) { + awsMskBuilder_.mergeFrom(value); + } else { + awsMskBuilder_.setMessage(value); + } + } + sourceCase_ = 5; + return this; + } + + /** + * + * + *
    +     * Optional. Amazon MSK.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AwsMsk aws_msk = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearAwsMsk() { + if (awsMskBuilder_ == null) { + if (sourceCase_ == 5) { + sourceCase_ = 0; + source_ = null; + onChanged(); + } + } else { + if (sourceCase_ == 5) { + sourceCase_ = 0; + source_ = null; + } + awsMskBuilder_.clear(); + } + return this; + } + + /** + * + * + *
    +     * Optional. Amazon MSK.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AwsMsk aws_msk = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk.Builder getAwsMskBuilder() { + return internalGetAwsMskFieldBuilder().getBuilder(); + } + + /** + * + * + *
    +     * Optional. Amazon MSK.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AwsMsk aws_msk = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.AwsMskOrBuilder getAwsMskOrBuilder() { + if ((sourceCase_ == 5) && (awsMskBuilder_ != null)) { + return awsMskBuilder_.getMessageOrBuilder(); + } else { + if (sourceCase_ == 5) { + return (com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk) source_; + } + return com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk.getDefaultInstance(); + } + } + + /** + * + * + *
    +     * Optional. Amazon MSK.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AwsMsk aws_msk = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk, + com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk.Builder, + com.google.pubsub.v1.IngestionDataSourceSettings.AwsMskOrBuilder> + internalGetAwsMskFieldBuilder() { + if (awsMskBuilder_ == null) { + if (!(sourceCase_ == 5)) { + source_ = com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk.getDefaultInstance(); + } + awsMskBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk, + com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk.Builder, + com.google.pubsub.v1.IngestionDataSourceSettings.AwsMskOrBuilder>( + (com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk) source_, + getParentForChildren(), + isClean()); + source_ = null; + } + sourceCase_ = 5; + onChanged(); + return awsMskBuilder_; + } + + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud, + com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud.Builder, + com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloudOrBuilder> + confluentCloudBuilder_; + + /** + * + * + *
    +     * Optional. Confluent Cloud.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud confluent_cloud = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the confluentCloud field is set. + */ + @java.lang.Override + public boolean hasConfluentCloud() { + return sourceCase_ == 6; + } + + /** + * + * + *
    +     * Optional. Confluent Cloud.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud confluent_cloud = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The confluentCloud. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud getConfluentCloud() { + if (confluentCloudBuilder_ == null) { + if (sourceCase_ == 6) { + return (com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud) source_; + } + return com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud.getDefaultInstance(); + } else { + if (sourceCase_ == 6) { + return confluentCloudBuilder_.getMessage(); + } + return com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud.getDefaultInstance(); + } + } + + /** + * + * + *
    +     * Optional. Confluent Cloud.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud confluent_cloud = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setConfluentCloud( + com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud value) { + if (confluentCloudBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + source_ = value; + onChanged(); + } else { + confluentCloudBuilder_.setMessage(value); + } + sourceCase_ = 6; + return this; + } + + /** + * + * + *
    +     * Optional. Confluent Cloud.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud confluent_cloud = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setConfluentCloud( + com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud.Builder builderForValue) { + if (confluentCloudBuilder_ == null) { + source_ = builderForValue.build(); + onChanged(); + } else { + confluentCloudBuilder_.setMessage(builderForValue.build()); + } + sourceCase_ = 6; + return this; + } + + /** + * + * + *
    +     * Optional. Confluent Cloud.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud confluent_cloud = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeConfluentCloud( + com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud value) { + if (confluentCloudBuilder_ == null) { + if (sourceCase_ == 6 + && source_ + != com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud + .getDefaultInstance()) { + source_ = + com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud.newBuilder( + (com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud) source_) + .mergeFrom(value) + .buildPartial(); + } else { + source_ = value; + } + onChanged(); + } else { + if (sourceCase_ == 6) { + confluentCloudBuilder_.mergeFrom(value); + } else { + confluentCloudBuilder_.setMessage(value); + } + } + sourceCase_ = 6; + return this; + } + + /** + * + * + *
    +     * Optional. Confluent Cloud.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud confluent_cloud = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearConfluentCloud() { + if (confluentCloudBuilder_ == null) { + if (sourceCase_ == 6) { + sourceCase_ = 0; + source_ = null; + onChanged(); + } + } else { + if (sourceCase_ == 6) { + sourceCase_ = 0; + source_ = null; + } + confluentCloudBuilder_.clear(); + } + return this; + } + + /** + * + * + *
    +     * Optional. Confluent Cloud.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud confluent_cloud = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud.Builder + getConfluentCloudBuilder() { + return internalGetConfluentCloudFieldBuilder().getBuilder(); + } + + /** + * + * + *
    +     * Optional. Confluent Cloud.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud confluent_cloud = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloudOrBuilder + getConfluentCloudOrBuilder() { + if ((sourceCase_ == 6) && (confluentCloudBuilder_ != null)) { + return confluentCloudBuilder_.getMessageOrBuilder(); + } else { + if (sourceCase_ == 6) { + return (com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud) source_; + } + return com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud.getDefaultInstance(); + } + } + + /** + * + * + *
    +     * Optional. Confluent Cloud.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud confluent_cloud = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud, + com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud.Builder, + com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloudOrBuilder> + internalGetConfluentCloudFieldBuilder() { + if (confluentCloudBuilder_ == null) { + if (!(sourceCase_ == 6)) { + source_ = + com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud.getDefaultInstance(); + } + confluentCloudBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud, + com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud.Builder, + com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloudOrBuilder>( + (com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud) source_, + getParentForChildren(), + isClean()); + source_ = null; + } + sourceCase_ = 6; + onChanged(); + return confluentCloudBuilder_; + } + + private com.google.pubsub.v1.PlatformLogsSettings platformLogsSettings_; + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.PlatformLogsSettings, + com.google.pubsub.v1.PlatformLogsSettings.Builder, + com.google.pubsub.v1.PlatformLogsSettingsOrBuilder> + platformLogsSettingsBuilder_; + + /** + * + * + *
    +     * Optional. Platform Logs settings. If unset, no Platform Logs will be
    +     * generated.
    +     * 
    + * + * + * .google.pubsub.v1.PlatformLogsSettings platform_logs_settings = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the platformLogsSettings field is set. + */ + public boolean hasPlatformLogsSettings() { + return ((bitField0_ & 0x00000020) != 0); + } + + /** + * + * + *
    +     * Optional. Platform Logs settings. If unset, no Platform Logs will be
    +     * generated.
    +     * 
    + * + * + * .google.pubsub.v1.PlatformLogsSettings platform_logs_settings = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The platformLogsSettings. + */ + public com.google.pubsub.v1.PlatformLogsSettings getPlatformLogsSettings() { + if (platformLogsSettingsBuilder_ == null) { + return platformLogsSettings_ == null + ? com.google.pubsub.v1.PlatformLogsSettings.getDefaultInstance() + : platformLogsSettings_; + } else { + return platformLogsSettingsBuilder_.getMessage(); + } + } + + /** + * + * + *
    +     * Optional. Platform Logs settings. If unset, no Platform Logs will be
    +     * generated.
    +     * 
    + * + * + * .google.pubsub.v1.PlatformLogsSettings platform_logs_settings = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setPlatformLogsSettings(com.google.pubsub.v1.PlatformLogsSettings value) { + if (platformLogsSettingsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + platformLogsSettings_ = value; + } else { + platformLogsSettingsBuilder_.setMessage(value); + } + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Optional. Platform Logs settings. If unset, no Platform Logs will be
    +     * generated.
    +     * 
    + * + * + * .google.pubsub.v1.PlatformLogsSettings platform_logs_settings = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setPlatformLogsSettings( + com.google.pubsub.v1.PlatformLogsSettings.Builder builderForValue) { + if (platformLogsSettingsBuilder_ == null) { + platformLogsSettings_ = builderForValue.build(); + } else { + platformLogsSettingsBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Optional. Platform Logs settings. If unset, no Platform Logs will be
    +     * generated.
    +     * 
    + * + * + * .google.pubsub.v1.PlatformLogsSettings platform_logs_settings = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergePlatformLogsSettings(com.google.pubsub.v1.PlatformLogsSettings value) { + if (platformLogsSettingsBuilder_ == null) { + if (((bitField0_ & 0x00000020) != 0) + && platformLogsSettings_ != null + && platformLogsSettings_ + != com.google.pubsub.v1.PlatformLogsSettings.getDefaultInstance()) { + getPlatformLogsSettingsBuilder().mergeFrom(value); + } else { + platformLogsSettings_ = value; + } + } else { + platformLogsSettingsBuilder_.mergeFrom(value); + } + if (platformLogsSettings_ != null) { + bitField0_ |= 0x00000020; + onChanged(); + } + return this; + } + + /** + * + * + *
    +     * Optional. Platform Logs settings. If unset, no Platform Logs will be
    +     * generated.
    +     * 
    + * + * + * .google.pubsub.v1.PlatformLogsSettings platform_logs_settings = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearPlatformLogsSettings() { + bitField0_ = (bitField0_ & ~0x00000020); + platformLogsSettings_ = null; + if (platformLogsSettingsBuilder_ != null) { + platformLogsSettingsBuilder_.dispose(); + platformLogsSettingsBuilder_ = null; + } + onChanged(); + return this; + } + + /** + * + * + *
    +     * Optional. Platform Logs settings. If unset, no Platform Logs will be
    +     * generated.
    +     * 
    + * + * + * .google.pubsub.v1.PlatformLogsSettings platform_logs_settings = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.PlatformLogsSettings.Builder getPlatformLogsSettingsBuilder() { + bitField0_ |= 0x00000020; + onChanged(); + return internalGetPlatformLogsSettingsFieldBuilder().getBuilder(); + } + + /** + * + * + *
    +     * Optional. Platform Logs settings. If unset, no Platform Logs will be
    +     * generated.
    +     * 
    + * + * + * .google.pubsub.v1.PlatformLogsSettings platform_logs_settings = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.PlatformLogsSettingsOrBuilder getPlatformLogsSettingsOrBuilder() { + if (platformLogsSettingsBuilder_ != null) { + return platformLogsSettingsBuilder_.getMessageOrBuilder(); + } else { + return platformLogsSettings_ == null + ? com.google.pubsub.v1.PlatformLogsSettings.getDefaultInstance() + : platformLogsSettings_; + } + } + + /** + * + * + *
    +     * Optional. Platform Logs settings. If unset, no Platform Logs will be
    +     * generated.
    +     * 
    + * + * + * .google.pubsub.v1.PlatformLogsSettings platform_logs_settings = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.PlatformLogsSettings, + com.google.pubsub.v1.PlatformLogsSettings.Builder, + com.google.pubsub.v1.PlatformLogsSettingsOrBuilder> + internalGetPlatformLogsSettingsFieldBuilder() { + if (platformLogsSettingsBuilder_ == null) { + platformLogsSettingsBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.PlatformLogsSettings, + com.google.pubsub.v1.PlatformLogsSettings.Builder, + com.google.pubsub.v1.PlatformLogsSettingsOrBuilder>( + getPlatformLogsSettings(), getParentForChildren(), isClean()); + platformLogsSettings_ = null; + } + return platformLogsSettingsBuilder_; + } + + // @@protoc_insertion_point(builder_scope:google.pubsub.v1.IngestionDataSourceSettings) + } + + // @@protoc_insertion_point(class_scope:google.pubsub.v1.IngestionDataSourceSettings) + private static final com.google.pubsub.v1.IngestionDataSourceSettings DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.pubsub.v1.IngestionDataSourceSettings(); + } + + public static com.google.pubsub.v1.IngestionDataSourceSettings getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public IngestionDataSourceSettings parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/IngestionDataSourceSettingsOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/IngestionDataSourceSettingsOrBuilder.java new file mode 100644 index 000000000..9e641bb67 --- /dev/null +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/IngestionDataSourceSettingsOrBuilder.java @@ -0,0 +1,293 @@ +/* + * Copyright 2026 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 + +package com.google.pubsub.v1; + +@com.google.protobuf.Generated +public interface IngestionDataSourceSettingsOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.pubsub.v1.IngestionDataSourceSettings) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
    +   * Optional. Amazon Kinesis Data Streams.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis aws_kinesis = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the awsKinesis field is set. + */ + boolean hasAwsKinesis(); + + /** + * + * + *
    +   * Optional. Amazon Kinesis Data Streams.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis aws_kinesis = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The awsKinesis. + */ + com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis getAwsKinesis(); + + /** + * + * + *
    +   * Optional. Amazon Kinesis Data Streams.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis aws_kinesis = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesisOrBuilder getAwsKinesisOrBuilder(); + + /** + * + * + *
    +   * Optional. Cloud Storage.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage cloud_storage = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the cloudStorage field is set. + */ + boolean hasCloudStorage(); + + /** + * + * + *
    +   * Optional. Cloud Storage.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage cloud_storage = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The cloudStorage. + */ + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage getCloudStorage(); + + /** + * + * + *
    +   * Optional. Cloud Storage.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.CloudStorage cloud_storage = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.pubsub.v1.IngestionDataSourceSettings.CloudStorageOrBuilder getCloudStorageOrBuilder(); + + /** + * + * + *
    +   * Optional. Azure Event Hubs.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs azure_event_hubs = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the azureEventHubs field is set. + */ + boolean hasAzureEventHubs(); + + /** + * + * + *
    +   * Optional. Azure Event Hubs.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs azure_event_hubs = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The azureEventHubs. + */ + com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs getAzureEventHubs(); + + /** + * + * + *
    +   * Optional. Azure Event Hubs.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs azure_event_hubs = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubsOrBuilder + getAzureEventHubsOrBuilder(); + + /** + * + * + *
    +   * Optional. Amazon MSK.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AwsMsk aws_msk = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the awsMsk field is set. + */ + boolean hasAwsMsk(); + + /** + * + * + *
    +   * Optional. Amazon MSK.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AwsMsk aws_msk = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The awsMsk. + */ + com.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk getAwsMsk(); + + /** + * + * + *
    +   * Optional. Amazon MSK.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.AwsMsk aws_msk = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.pubsub.v1.IngestionDataSourceSettings.AwsMskOrBuilder getAwsMskOrBuilder(); + + /** + * + * + *
    +   * Optional. Confluent Cloud.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud confluent_cloud = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the confluentCloud field is set. + */ + boolean hasConfluentCloud(); + + /** + * + * + *
    +   * Optional. Confluent Cloud.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud confluent_cloud = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The confluentCloud. + */ + com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud getConfluentCloud(); + + /** + * + * + *
    +   * Optional. Confluent Cloud.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud confluent_cloud = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloudOrBuilder + getConfluentCloudOrBuilder(); + + /** + * + * + *
    +   * Optional. Platform Logs settings. If unset, no Platform Logs will be
    +   * generated.
    +   * 
    + * + * + * .google.pubsub.v1.PlatformLogsSettings platform_logs_settings = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the platformLogsSettings field is set. + */ + boolean hasPlatformLogsSettings(); + + /** + * + * + *
    +   * Optional. Platform Logs settings. If unset, no Platform Logs will be
    +   * generated.
    +   * 
    + * + * + * .google.pubsub.v1.PlatformLogsSettings platform_logs_settings = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The platformLogsSettings. + */ + com.google.pubsub.v1.PlatformLogsSettings getPlatformLogsSettings(); + + /** + * + * + *
    +   * Optional. Platform Logs settings. If unset, no Platform Logs will be
    +   * generated.
    +   * 
    + * + * + * .google.pubsub.v1.PlatformLogsSettings platform_logs_settings = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.pubsub.v1.PlatformLogsSettingsOrBuilder getPlatformLogsSettingsOrBuilder(); + + com.google.pubsub.v1.IngestionDataSourceSettings.SourceCase getSourceCase(); +} 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 new file mode 100644 index 000000000..6fde71fb1 --- /dev/null +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/IngestionFailureEvent.java @@ -0,0 +1,16331 @@ +/* + * Copyright 2026 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 + +package com.google.pubsub.v1; + +/** + * + * + *
    + * Payload of the Platform Log entry sent when a failure is encountered while
    + * ingesting.
    + * 
    + * + * Protobuf type {@code google.pubsub.v1.IngestionFailureEvent} + */ +@com.google.protobuf.Generated +public final class IngestionFailureEvent extends com.google.protobuf.GeneratedMessage + implements + // @@protoc_insertion_point(message_implements:google.pubsub.v1.IngestionFailureEvent) + IngestionFailureEventOrBuilder { + private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "IngestionFailureEvent"); + } + + // Use IngestionFailureEvent.newBuilder() to construct. + private IngestionFailureEvent(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + + private IngestionFailureEvent() { + topic_ = ""; + errorMessage_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionFailureEvent_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionFailureEvent_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.IngestionFailureEvent.class, + com.google.pubsub.v1.IngestionFailureEvent.Builder.class); + } + + public interface ApiViolationReasonOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.pubsub.v1.IngestionFailureEvent.ApiViolationReason) + com.google.protobuf.MessageOrBuilder {} + + /** + * + * + *
    +   * Specifies the reason why some data may have been left out of
    +   * the desired Pub/Sub message due to the API message limits
    +   * (https://cloud.google.com/pubsub/quotas#resource_limits). For example,
    +   * when the number of attributes is larger than 100, the number of
    +   * attributes is truncated to 100 to respect the limit on the attribute count.
    +   * Other attribute limits are treated similarly. When the size of the desired
    +   * message would've been larger than 10MB, the message won't be published at
    +   * all, and ingestion of the subsequent messages will proceed as normal.
    +   * 
    + * + * Protobuf type {@code google.pubsub.v1.IngestionFailureEvent.ApiViolationReason} + */ + public static final class ApiViolationReason extends com.google.protobuf.GeneratedMessage + implements + // @@protoc_insertion_point(message_implements:google.pubsub.v1.IngestionFailureEvent.ApiViolationReason) + ApiViolationReasonOrBuilder { + private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "ApiViolationReason"); + } + + // Use ApiViolationReason.newBuilder() to construct. + private ApiViolationReason(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + + private ApiViolationReason() {} + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionFailureEvent_ApiViolationReason_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionFailureEvent_ApiViolationReason_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.class, + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.Builder.class); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason)) { + return super.equals(obj); + } + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason other = + (com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason) obj; + + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason parseFrom( + byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + + /** + * + * + *
    +     * Specifies the reason why some data may have been left out of
    +     * the desired Pub/Sub message due to the API message limits
    +     * (https://cloud.google.com/pubsub/quotas#resource_limits). For example,
    +     * when the number of attributes is larger than 100, the number of
    +     * attributes is truncated to 100 to respect the limit on the attribute count.
    +     * Other attribute limits are treated similarly. When the size of the desired
    +     * message would've been larger than 10MB, the message won't be published at
    +     * all, and ingestion of the subsequent messages will proceed as normal.
    +     * 
    + * + * Protobuf type {@code google.pubsub.v1.IngestionFailureEvent.ApiViolationReason} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder + implements + // @@protoc_insertion_point(builder_implements:google.pubsub.v1.IngestionFailureEvent.ApiViolationReason) + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReasonOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionFailureEvent_ApiViolationReason_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionFailureEvent_ApiViolationReason_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.class, + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.Builder.class); + } + + // Construct using com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionFailureEvent_ApiViolationReason_descriptor; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason + getDefaultInstanceForType() { + return com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.getDefaultInstance(); + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason build() { + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason buildPartial() { + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason result = + new com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason(this); + onBuilt(); + return result; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason) { + return mergeFrom((com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason other) { + if (other + == com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.getDefaultInstance()) + return this; + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + // @@protoc_insertion_point(builder_scope:google.pubsub.v1.IngestionFailureEvent.ApiViolationReason) + } + + // @@protoc_insertion_point(class_scope:google.pubsub.v1.IngestionFailureEvent.ApiViolationReason) + private static final com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason(); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ApiViolationReason parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException() + .setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public interface AvroFailureReasonOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.pubsub.v1.IngestionFailureEvent.AvroFailureReason) + com.google.protobuf.MessageOrBuilder {} + + /** + * + * + *
    +   * Set when an Avro file is unsupported or its format is not valid. When this
    +   * occurs, one or more Avro objects won't be ingested.
    +   * 
    + * + * Protobuf type {@code google.pubsub.v1.IngestionFailureEvent.AvroFailureReason} + */ + public static final class AvroFailureReason extends com.google.protobuf.GeneratedMessage + implements + // @@protoc_insertion_point(message_implements:google.pubsub.v1.IngestionFailureEvent.AvroFailureReason) + AvroFailureReasonOrBuilder { + private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "AvroFailureReason"); + } + + // Use AvroFailureReason.newBuilder() to construct. + private AvroFailureReason(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + + private AvroFailureReason() {} + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionFailureEvent_AvroFailureReason_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionFailureEvent_AvroFailureReason_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason.class, + com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason.Builder.class); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason)) { + return super.equals(obj); + } + com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason other = + (com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason) obj; + + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason parseFrom( + byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + + /** + * + * + *
    +     * Set when an Avro file is unsupported or its format is not valid. When this
    +     * occurs, one or more Avro objects won't be ingested.
    +     * 
    + * + * Protobuf type {@code google.pubsub.v1.IngestionFailureEvent.AvroFailureReason} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder + implements + // @@protoc_insertion_point(builder_implements:google.pubsub.v1.IngestionFailureEvent.AvroFailureReason) + com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReasonOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionFailureEvent_AvroFailureReason_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionFailureEvent_AvroFailureReason_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason.class, + com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason.Builder.class); + } + + // Construct using com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionFailureEvent_AvroFailureReason_descriptor; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason + getDefaultInstanceForType() { + return com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason.getDefaultInstance(); + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason build() { + com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason buildPartial() { + com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason result = + new com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason(this); + onBuilt(); + return result; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason) { + return mergeFrom((com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason other) { + if (other + == com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason.getDefaultInstance()) + return this; + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + // @@protoc_insertion_point(builder_scope:google.pubsub.v1.IngestionFailureEvent.AvroFailureReason) + } + + // @@protoc_insertion_point(class_scope:google.pubsub.v1.IngestionFailureEvent.AvroFailureReason) + private static final com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason(); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AvroFailureReason parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException() + .setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public interface SchemaViolationReasonOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason) + com.google.protobuf.MessageOrBuilder {} + + /** + * + * + *
    +   * Set when a Pub/Sub message fails to get published due to a schema
    +   * validation violation.
    +   * 
    + * + * Protobuf type {@code google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason} + */ + public static final class SchemaViolationReason extends com.google.protobuf.GeneratedMessage + implements + // @@protoc_insertion_point(message_implements:google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason) + SchemaViolationReasonOrBuilder { + private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "SchemaViolationReason"); + } + + // Use SchemaViolationReason.newBuilder() to construct. + private SchemaViolationReason(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + + private SchemaViolationReason() {} + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionFailureEvent_SchemaViolationReason_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionFailureEvent_SchemaViolationReason_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.class, + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.Builder.class); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason)) { + return super.equals(obj); + } + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason other = + (com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason) obj; + + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason parseFrom( + byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason + parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason + parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + + /** + * + * + *
    +     * Set when a Pub/Sub message fails to get published due to a schema
    +     * validation violation.
    +     * 
    + * + * Protobuf type {@code google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder + implements + // @@protoc_insertion_point(builder_implements:google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason) + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReasonOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionFailureEvent_SchemaViolationReason_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionFailureEvent_SchemaViolationReason_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.class, + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.Builder.class); + } + + // Construct using + // com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionFailureEvent_SchemaViolationReason_descriptor; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason + getDefaultInstanceForType() { + return com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason + .getDefaultInstance(); + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason build() { + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason buildPartial() { + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason result = + new com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason(this); + onBuilt(); + return result; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason) { + return mergeFrom( + (com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason other) { + if (other + == com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason + .getDefaultInstance()) return this; + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + // @@protoc_insertion_point(builder_scope:google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason) + } + + // @@protoc_insertion_point(class_scope:google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason) + private static final com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason(); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public SchemaViolationReason parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException() + .setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public interface MessageTransformationFailureReasonOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason) + com.google.protobuf.MessageOrBuilder {} + + /** + * + * + *
    +   * Set when a Pub/Sub message fails to get published due to a message
    +   * transformation error.
    +   * 
    + * + * Protobuf type {@code google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason} + */ + public static final class MessageTransformationFailureReason + extends com.google.protobuf.GeneratedMessage + implements + // @@protoc_insertion_point(message_implements:google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason) + MessageTransformationFailureReasonOrBuilder { + private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "MessageTransformationFailureReason"); + } + + // Use MessageTransformationFailureReason.newBuilder() to construct. + private MessageTransformationFailureReason( + com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + + private MessageTransformationFailureReason() {} + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionFailureEvent_MessageTransformationFailureReason_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionFailureEvent_MessageTransformationFailureReason_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason.class, + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason.Builder + .class); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj + instanceof + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason)) { + return super.equals(obj); + } + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason other = + (com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason) obj; + + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + parseFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + parseFrom(com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + + /** + * + * + *
    +     * Set when a Pub/Sub message fails to get published due to a message
    +     * transformation error.
    +     * 
    + * + * Protobuf type {@code + * google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder + implements + // @@protoc_insertion_point(builder_implements:google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason) + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReasonOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionFailureEvent_MessageTransformationFailureReason_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionFailureEvent_MessageTransformationFailureReason_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason.class, + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + .Builder.class); + } + + // Construct using + // com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionFailureEvent_MessageTransformationFailureReason_descriptor; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + getDefaultInstanceForType() { + return com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + .getDefaultInstance(); + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason build() { + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason result = + buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + buildPartial() { + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason result = + new com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason(this); + onBuilt(); + return result; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other + instanceof + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason) { + return mergeFrom( + (com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason) + other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason other) { + if (other + == com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + .getDefaultInstance()) return this; + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + // @@protoc_insertion_point(builder_scope:google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason) + } + + // @@protoc_insertion_point(class_scope:google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason) + private static final com.google.pubsub.v1.IngestionFailureEvent + .MessageTransformationFailureReason + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = + new com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason(); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public MessageTransformationFailureReason parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException() + .setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public interface CloudStorageFailureOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
    +     * Optional. Name of the Cloud Storage bucket used for ingestion.
    +     * 
    + * + * string bucket = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bucket. + */ + java.lang.String getBucket(); + + /** + * + * + *
    +     * Optional. Name of the Cloud Storage bucket used for ingestion.
    +     * 
    + * + * string bucket = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for bucket. + */ + com.google.protobuf.ByteString getBucketBytes(); + + /** + * + * + *
    +     * Optional. Name of the Cloud Storage object which contained the section
    +     * that couldn't be ingested.
    +     * 
    + * + * string object_name = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The objectName. + */ + java.lang.String getObjectName(); + + /** + * + * + *
    +     * Optional. Name of the Cloud Storage object which contained the section
    +     * that couldn't be ingested.
    +     * 
    + * + * string object_name = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for objectName. + */ + com.google.protobuf.ByteString getObjectNameBytes(); + + /** + * + * + *
    +     * Optional. Generation of the Cloud Storage object which contained the
    +     * section that couldn't be ingested.
    +     * 
    + * + * int64 object_generation = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The objectGeneration. + */ + long getObjectGeneration(); + + /** + * + * + *
    +     * Optional. Failure encountered when parsing an Avro file.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AvroFailureReason avro_failure_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the avroFailureReason field is set. + */ + boolean hasAvroFailureReason(); + + /** + * + * + *
    +     * Optional. Failure encountered when parsing an Avro file.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AvroFailureReason avro_failure_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The avroFailureReason. + */ + com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason getAvroFailureReason(); + + /** + * + * + *
    +     * Optional. Failure encountered when parsing an Avro file.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AvroFailureReason avro_failure_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReasonOrBuilder + getAvroFailureReasonOrBuilder(); + + /** + * + * + *
    +     * Optional. The Pub/Sub API limits prevented the desired message from
    +     * being published.
    +     * 
    + * + * + * .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 Pub/Sub API limits prevented the desired message from
    +     * being published.
    +     * 
    + * + * + * .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 Pub/Sub API limits prevented the desired message from
    +     * being published.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReasonOrBuilder + getApiViolationReasonOrBuilder(); + + /** + * + * + *
    +     * Optional. The Pub/Sub message failed schema validation.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the schemaViolationReason field is set. + */ + boolean hasSchemaViolationReason(); + + /** + * + * + *
    +     * Optional. The Pub/Sub message failed schema validation.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The schemaViolationReason. + */ + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason getSchemaViolationReason(); + + /** + * + * + *
    +     * Optional. The Pub/Sub message failed schema validation.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReasonOrBuilder + getSchemaViolationReasonOrBuilder(); + + /** + * + * + *
    +     * Optional. Failure encountered when applying a message transformation to
    +     * the Pub/Sub message.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the messageTransformationFailureReason field is set. + */ + boolean hasMessageTransformationFailureReason(); + + /** + * + * + *
    +     * Optional. Failure encountered when applying a message transformation to
    +     * the Pub/Sub message.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The messageTransformationFailureReason. + */ + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + getMessageTransformationFailureReason(); + + /** + * + * + *
    +     * Optional. Failure encountered when applying a message transformation to
    +     * the Pub/Sub message.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReasonOrBuilder + getMessageTransformationFailureReasonOrBuilder(); + + com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure.ReasonCase getReasonCase(); + } + + /** + * + * + *
    +   * Failure when ingesting from a Cloud Storage source.
    +   * 
    + * + * Protobuf type {@code google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure} + */ + public static final class CloudStorageFailure extends com.google.protobuf.GeneratedMessage + implements + // @@protoc_insertion_point(message_implements:google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure) + CloudStorageFailureOrBuilder { + private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "CloudStorageFailure"); + } + + // Use CloudStorageFailure.newBuilder() to construct. + private CloudStorageFailure(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + + private CloudStorageFailure() { + bucket_ = ""; + objectName_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionFailureEvent_CloudStorageFailure_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionFailureEvent_CloudStorageFailure_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure.class, + com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure.Builder.class); + } + + private int reasonCase_ = 0; + + @SuppressWarnings("serial") + private java.lang.Object reason_; + + public enum ReasonCase + implements + com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + AVRO_FAILURE_REASON(5), + API_VIOLATION_REASON(6), + SCHEMA_VIOLATION_REASON(7), + MESSAGE_TRANSFORMATION_FAILURE_REASON(8), + REASON_NOT_SET(0); + private final int value; + + private ReasonCase(int value) { + this.value = value; + } + + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static ReasonCase valueOf(int value) { + return forNumber(value); + } + + public static ReasonCase forNumber(int value) { + switch (value) { + case 5: + return AVRO_FAILURE_REASON; + case 6: + return API_VIOLATION_REASON; + case 7: + return SCHEMA_VIOLATION_REASON; + case 8: + return MESSAGE_TRANSFORMATION_FAILURE_REASON; + case 0: + return REASON_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public ReasonCase getReasonCase() { + return ReasonCase.forNumber(reasonCase_); + } + + public static final int BUCKET_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object bucket_ = ""; + + /** + * + * + *
    +     * Optional. Name of the Cloud Storage bucket used for ingestion.
    +     * 
    + * + * string bucket = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bucket. + */ + @java.lang.Override + public java.lang.String getBucket() { + java.lang.Object ref = bucket_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + bucket_ = s; + return s; + } + } + + /** + * + * + *
    +     * Optional. Name of the Cloud Storage bucket used for ingestion.
    +     * 
    + * + * string bucket = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for bucket. + */ + @java.lang.Override + public com.google.protobuf.ByteString getBucketBytes() { + java.lang.Object ref = bucket_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + bucket_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int OBJECT_NAME_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private volatile java.lang.Object objectName_ = ""; + + /** + * + * + *
    +     * Optional. Name of the Cloud Storage object which contained the section
    +     * that couldn't be ingested.
    +     * 
    + * + * string object_name = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The objectName. + */ + @java.lang.Override + public java.lang.String getObjectName() { + java.lang.Object ref = objectName_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + objectName_ = s; + return s; + } + } + + /** + * + * + *
    +     * Optional. Name of the Cloud Storage object which contained the section
    +     * that couldn't be ingested.
    +     * 
    + * + * string object_name = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for objectName. + */ + @java.lang.Override + public com.google.protobuf.ByteString getObjectNameBytes() { + java.lang.Object ref = objectName_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + objectName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int OBJECT_GENERATION_FIELD_NUMBER = 3; + private long objectGeneration_ = 0L; + + /** + * + * + *
    +     * Optional. Generation of the Cloud Storage object which contained the
    +     * section that couldn't be ingested.
    +     * 
    + * + * int64 object_generation = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The objectGeneration. + */ + @java.lang.Override + public long getObjectGeneration() { + return objectGeneration_; + } + + public static final int AVRO_FAILURE_REASON_FIELD_NUMBER = 5; + + /** + * + * + *
    +     * Optional. Failure encountered when parsing an Avro file.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AvroFailureReason avro_failure_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the avroFailureReason field is set. + */ + @java.lang.Override + public boolean hasAvroFailureReason() { + return reasonCase_ == 5; + } + + /** + * + * + *
    +     * Optional. Failure encountered when parsing an Avro file.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AvroFailureReason avro_failure_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The avroFailureReason. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason getAvroFailureReason() { + if (reasonCase_ == 5) { + return (com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason) reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason.getDefaultInstance(); + } + + /** + * + * + *
    +     * Optional. Failure encountered when parsing an Avro file.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AvroFailureReason avro_failure_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReasonOrBuilder + getAvroFailureReasonOrBuilder() { + if (reasonCase_ == 5) { + return (com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason) reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason.getDefaultInstance(); + } + + public static final int API_VIOLATION_REASON_FIELD_NUMBER = 6; + + /** + * + * + *
    +     * Optional. The Pub/Sub API limits prevented the desired message from
    +     * being published.
    +     * 
    + * + * + * .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 Pub/Sub API limits prevented the desired message from
    +     * being published.
    +     * 
    + * + * + * .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 Pub/Sub API limits prevented the desired message from
    +     * being published.
    +     * 
    + * + * + * .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(); + } + + public static final int SCHEMA_VIOLATION_REASON_FIELD_NUMBER = 7; + + /** + * + * + *
    +     * Optional. The Pub/Sub message failed schema validation.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the schemaViolationReason field is set. + */ + @java.lang.Override + public boolean hasSchemaViolationReason() { + return reasonCase_ == 7; + } + + /** + * + * + *
    +     * Optional. The Pub/Sub message failed schema validation.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The schemaViolationReason. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason + getSchemaViolationReason() { + if (reasonCase_ == 7) { + return (com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason) reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.getDefaultInstance(); + } + + /** + * + * + *
    +     * Optional. The Pub/Sub message failed schema validation.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReasonOrBuilder + getSchemaViolationReasonOrBuilder() { + if (reasonCase_ == 7) { + return (com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason) reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.getDefaultInstance(); + } + + public static final int MESSAGE_TRANSFORMATION_FAILURE_REASON_FIELD_NUMBER = 8; + + /** + * + * + *
    +     * Optional. Failure encountered when applying a message transformation to
    +     * the Pub/Sub message.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the messageTransformationFailureReason field is set. + */ + @java.lang.Override + public boolean hasMessageTransformationFailureReason() { + return reasonCase_ == 8; + } + + /** + * + * + *
    +     * Optional. Failure encountered when applying a message transformation to
    +     * the Pub/Sub message.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The messageTransformationFailureReason. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + getMessageTransformationFailureReason() { + if (reasonCase_ == 8) { + return (com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason) + reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + .getDefaultInstance(); + } + + /** + * + * + *
    +     * Optional. Failure encountered when applying a message transformation to
    +     * the Pub/Sub message.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReasonOrBuilder + getMessageTransformationFailureReasonOrBuilder() { + if (reasonCase_ == 8) { + return (com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason) + reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + .getDefaultInstance(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(bucket_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, bucket_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(objectName_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, objectName_); + } + if (objectGeneration_ != 0L) { + output.writeInt64(3, objectGeneration_); + } + if (reasonCase_ == 5) { + output.writeMessage( + 5, (com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason) reason_); + } + if (reasonCase_ == 6) { + output.writeMessage( + 6, (com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason) reason_); + } + if (reasonCase_ == 7) { + output.writeMessage( + 7, (com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason) reason_); + } + if (reasonCase_ == 8) { + output.writeMessage( + 8, + (com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason) + reason_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(bucket_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, bucket_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(objectName_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, objectName_); + } + if (objectGeneration_ != 0L) { + size += com.google.protobuf.CodedOutputStream.computeInt64Size(3, objectGeneration_); + } + if (reasonCase_ == 5) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 5, (com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason) reason_); + } + if (reasonCase_ == 6) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 6, (com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason) reason_); + } + if (reasonCase_ == 7) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 7, (com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason) reason_); + } + if (reasonCase_ == 8) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 8, + (com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason) + reason_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure)) { + return super.equals(obj); + } + com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure other = + (com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure) obj; + + if (!getBucket().equals(other.getBucket())) return false; + if (!getObjectName().equals(other.getObjectName())) return false; + if (getObjectGeneration() != other.getObjectGeneration()) return false; + if (!getReasonCase().equals(other.getReasonCase())) return false; + switch (reasonCase_) { + case 5: + if (!getAvroFailureReason().equals(other.getAvroFailureReason())) return false; + break; + case 6: + if (!getApiViolationReason().equals(other.getApiViolationReason())) return false; + break; + case 7: + if (!getSchemaViolationReason().equals(other.getSchemaViolationReason())) return false; + break; + case 8: + if (!getMessageTransformationFailureReason() + .equals(other.getMessageTransformationFailureReason())) return false; + break; + case 0: + default: + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + BUCKET_FIELD_NUMBER; + hash = (53 * hash) + getBucket().hashCode(); + hash = (37 * hash) + OBJECT_NAME_FIELD_NUMBER; + hash = (53 * hash) + getObjectName().hashCode(); + hash = (37 * hash) + OBJECT_GENERATION_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getObjectGeneration()); + switch (reasonCase_) { + case 5: + hash = (37 * hash) + AVRO_FAILURE_REASON_FIELD_NUMBER; + hash = (53 * hash) + getAvroFailureReason().hashCode(); + break; + case 6: + hash = (37 * hash) + API_VIOLATION_REASON_FIELD_NUMBER; + hash = (53 * hash) + getApiViolationReason().hashCode(); + break; + case 7: + hash = (37 * hash) + SCHEMA_VIOLATION_REASON_FIELD_NUMBER; + hash = (53 * hash) + getSchemaViolationReason().hashCode(); + break; + case 8: + hash = (37 * hash) + MESSAGE_TRANSFORMATION_FAILURE_REASON_FIELD_NUMBER; + hash = (53 * hash) + getMessageTransformationFailureReason().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure parseFrom( + byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + + /** + * + * + *
    +     * Failure when ingesting from a Cloud Storage source.
    +     * 
    + * + * Protobuf type {@code google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder + implements + // @@protoc_insertion_point(builder_implements:google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure) + com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailureOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionFailureEvent_CloudStorageFailure_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionFailureEvent_CloudStorageFailure_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure.class, + com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure.Builder.class); + } + + // Construct using com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + bucket_ = ""; + objectName_ = ""; + objectGeneration_ = 0L; + if (avroFailureReasonBuilder_ != null) { + avroFailureReasonBuilder_.clear(); + } + if (apiViolationReasonBuilder_ != null) { + apiViolationReasonBuilder_.clear(); + } + if (schemaViolationReasonBuilder_ != null) { + schemaViolationReasonBuilder_.clear(); + } + if (messageTransformationFailureReasonBuilder_ != null) { + messageTransformationFailureReasonBuilder_.clear(); + } + reasonCase_ = 0; + reason_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionFailureEvent_CloudStorageFailure_descriptor; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure + getDefaultInstanceForType() { + return com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure.getDefaultInstance(); + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure build() { + com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure buildPartial() { + com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure result = + new com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + buildPartialOneofs(result); + onBuilt(); + return result; + } + + private void buildPartial0( + com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.bucket_ = bucket_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.objectName_ = objectName_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.objectGeneration_ = objectGeneration_; + } + } + + private void buildPartialOneofs( + com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure result) { + result.reasonCase_ = reasonCase_; + result.reason_ = this.reason_; + if (reasonCase_ == 5 && avroFailureReasonBuilder_ != null) { + result.reason_ = avroFailureReasonBuilder_.build(); + } + if (reasonCase_ == 6 && apiViolationReasonBuilder_ != null) { + result.reason_ = apiViolationReasonBuilder_.build(); + } + if (reasonCase_ == 7 && schemaViolationReasonBuilder_ != null) { + result.reason_ = schemaViolationReasonBuilder_.build(); + } + if (reasonCase_ == 8 && messageTransformationFailureReasonBuilder_ != null) { + result.reason_ = messageTransformationFailureReasonBuilder_.build(); + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure) { + return mergeFrom((com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure other) { + if (other + == com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure.getDefaultInstance()) + return this; + if (!other.getBucket().isEmpty()) { + bucket_ = other.bucket_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getObjectName().isEmpty()) { + objectName_ = other.objectName_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (other.getObjectGeneration() != 0L) { + setObjectGeneration(other.getObjectGeneration()); + } + switch (other.getReasonCase()) { + case AVRO_FAILURE_REASON: + { + mergeAvroFailureReason(other.getAvroFailureReason()); + break; + } + case API_VIOLATION_REASON: + { + mergeApiViolationReason(other.getApiViolationReason()); + break; + } + case SCHEMA_VIOLATION_REASON: + { + mergeSchemaViolationReason(other.getSchemaViolationReason()); + break; + } + case MESSAGE_TRANSFORMATION_FAILURE_REASON: + { + mergeMessageTransformationFailureReason( + other.getMessageTransformationFailureReason()); + break; + } + case REASON_NOT_SET: + { + break; + } + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + bucket_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + objectName_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 24: + { + objectGeneration_ = input.readInt64(); + bitField0_ |= 0x00000004; + break; + } // case 24 + case 42: + { + input.readMessage( + internalGetAvroFailureReasonFieldBuilder().getBuilder(), extensionRegistry); + reasonCase_ = 5; + break; + } // case 42 + case 50: + { + input.readMessage( + internalGetApiViolationReasonFieldBuilder().getBuilder(), extensionRegistry); + reasonCase_ = 6; + break; + } // case 50 + case 58: + { + input.readMessage( + internalGetSchemaViolationReasonFieldBuilder().getBuilder(), + extensionRegistry); + reasonCase_ = 7; + break; + } // case 58 + case 66: + { + input.readMessage( + internalGetMessageTransformationFailureReasonFieldBuilder().getBuilder(), + extensionRegistry); + reasonCase_ = 8; + break; + } // case 66 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int reasonCase_ = 0; + private java.lang.Object reason_; + + public ReasonCase getReasonCase() { + return ReasonCase.forNumber(reasonCase_); + } + + public Builder clearReason() { + reasonCase_ = 0; + reason_ = null; + onChanged(); + return this; + } + + private int bitField0_; + + private java.lang.Object bucket_ = ""; + + /** + * + * + *
    +       * Optional. Name of the Cloud Storage bucket used for ingestion.
    +       * 
    + * + * string bucket = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bucket. + */ + public java.lang.String getBucket() { + java.lang.Object ref = bucket_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + bucket_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +       * Optional. Name of the Cloud Storage bucket used for ingestion.
    +       * 
    + * + * string bucket = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for bucket. + */ + public com.google.protobuf.ByteString getBucketBytes() { + java.lang.Object ref = bucket_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + bucket_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +       * Optional. Name of the Cloud Storage bucket used for ingestion.
    +       * 
    + * + * string bucket = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bucket to set. + * @return This builder for chaining. + */ + public Builder setBucket(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + bucket_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. Name of the Cloud Storage bucket used for ingestion.
    +       * 
    + * + * string bucket = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearBucket() { + bucket_ = getDefaultInstance().getBucket(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. Name of the Cloud Storage bucket used for ingestion.
    +       * 
    + * + * string bucket = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for bucket to set. + * @return This builder for chaining. + */ + public Builder setBucketBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + bucket_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object objectName_ = ""; + + /** + * + * + *
    +       * Optional. Name of the Cloud Storage object which contained the section
    +       * that couldn't be ingested.
    +       * 
    + * + * string object_name = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The objectName. + */ + public java.lang.String getObjectName() { + java.lang.Object ref = objectName_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + objectName_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +       * Optional. Name of the Cloud Storage object which contained the section
    +       * that couldn't be ingested.
    +       * 
    + * + * string object_name = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for objectName. + */ + public com.google.protobuf.ByteString getObjectNameBytes() { + java.lang.Object ref = objectName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + objectName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +       * Optional. Name of the Cloud Storage object which contained the section
    +       * that couldn't be ingested.
    +       * 
    + * + * string object_name = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The objectName to set. + * @return This builder for chaining. + */ + public Builder setObjectName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + objectName_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. Name of the Cloud Storage object which contained the section
    +       * that couldn't be ingested.
    +       * 
    + * + * string object_name = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearObjectName() { + objectName_ = getDefaultInstance().getObjectName(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. Name of the Cloud Storage object which contained the section
    +       * that couldn't be ingested.
    +       * 
    + * + * string object_name = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for objectName to set. + * @return This builder for chaining. + */ + public Builder setObjectNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + objectName_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private long objectGeneration_; + + /** + * + * + *
    +       * Optional. Generation of the Cloud Storage object which contained the
    +       * section that couldn't be ingested.
    +       * 
    + * + * int64 object_generation = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The objectGeneration. + */ + @java.lang.Override + public long getObjectGeneration() { + return objectGeneration_; + } + + /** + * + * + *
    +       * Optional. Generation of the Cloud Storage object which contained the
    +       * section that couldn't be ingested.
    +       * 
    + * + * int64 object_generation = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The objectGeneration to set. + * @return This builder for chaining. + */ + public Builder setObjectGeneration(long value) { + + objectGeneration_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. Generation of the Cloud Storage object which contained the
    +       * section that couldn't be ingested.
    +       * 
    + * + * int64 object_generation = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearObjectGeneration() { + bitField0_ = (bitField0_ & ~0x00000004); + objectGeneration_ = 0L; + onChanged(); + return this; + } + + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason, + com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason.Builder, + com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReasonOrBuilder> + avroFailureReasonBuilder_; + + /** + * + * + *
    +       * Optional. Failure encountered when parsing an Avro file.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AvroFailureReason avro_failure_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the avroFailureReason field is set. + */ + @java.lang.Override + public boolean hasAvroFailureReason() { + return reasonCase_ == 5; + } + + /** + * + * + *
    +       * Optional. Failure encountered when parsing an Avro file.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AvroFailureReason avro_failure_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The avroFailureReason. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason getAvroFailureReason() { + if (avroFailureReasonBuilder_ == null) { + if (reasonCase_ == 5) { + return (com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason) reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason.getDefaultInstance(); + } else { + if (reasonCase_ == 5) { + return avroFailureReasonBuilder_.getMessage(); + } + return com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason.getDefaultInstance(); + } + } + + /** + * + * + *
    +       * Optional. Failure encountered when parsing an Avro file.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AvroFailureReason avro_failure_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setAvroFailureReason( + com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason value) { + if (avroFailureReasonBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + reason_ = value; + onChanged(); + } else { + avroFailureReasonBuilder_.setMessage(value); + } + reasonCase_ = 5; + return this; + } + + /** + * + * + *
    +       * Optional. Failure encountered when parsing an Avro file.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AvroFailureReason avro_failure_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setAvroFailureReason( + com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason.Builder builderForValue) { + if (avroFailureReasonBuilder_ == null) { + reason_ = builderForValue.build(); + onChanged(); + } else { + avroFailureReasonBuilder_.setMessage(builderForValue.build()); + } + reasonCase_ = 5; + return this; + } + + /** + * + * + *
    +       * Optional. Failure encountered when parsing an Avro file.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AvroFailureReason avro_failure_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeAvroFailureReason( + com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason value) { + if (avroFailureReasonBuilder_ == null) { + if (reasonCase_ == 5 + && reason_ + != com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason + .getDefaultInstance()) { + reason_ = + com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason.newBuilder( + (com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason) reason_) + .mergeFrom(value) + .buildPartial(); + } else { + reason_ = value; + } + onChanged(); + } else { + if (reasonCase_ == 5) { + avroFailureReasonBuilder_.mergeFrom(value); + } else { + avroFailureReasonBuilder_.setMessage(value); + } + } + reasonCase_ = 5; + return this; + } + + /** + * + * + *
    +       * Optional. Failure encountered when parsing an Avro file.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AvroFailureReason avro_failure_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearAvroFailureReason() { + if (avroFailureReasonBuilder_ == null) { + if (reasonCase_ == 5) { + reasonCase_ = 0; + reason_ = null; + onChanged(); + } + } else { + if (reasonCase_ == 5) { + reasonCase_ = 0; + reason_ = null; + } + avroFailureReasonBuilder_.clear(); + } + return this; + } + + /** + * + * + *
    +       * Optional. Failure encountered when parsing an Avro file.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AvroFailureReason avro_failure_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason.Builder + getAvroFailureReasonBuilder() { + return internalGetAvroFailureReasonFieldBuilder().getBuilder(); + } + + /** + * + * + *
    +       * Optional. Failure encountered when parsing an Avro file.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AvroFailureReason avro_failure_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReasonOrBuilder + getAvroFailureReasonOrBuilder() { + if ((reasonCase_ == 5) && (avroFailureReasonBuilder_ != null)) { + return avroFailureReasonBuilder_.getMessageOrBuilder(); + } else { + if (reasonCase_ == 5) { + return (com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason) reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason.getDefaultInstance(); + } + } + + /** + * + * + *
    +       * Optional. Failure encountered when parsing an Avro file.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AvroFailureReason avro_failure_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason, + com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason.Builder, + com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReasonOrBuilder> + internalGetAvroFailureReasonFieldBuilder() { + if (avroFailureReasonBuilder_ == null) { + if (!(reasonCase_ == 5)) { + reason_ = + com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason.getDefaultInstance(); + } + avroFailureReasonBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason, + com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason.Builder, + com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReasonOrBuilder>( + (com.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason) reason_, + getParentForChildren(), + isClean()); + reason_ = null; + } + reasonCase_ = 5; + onChanged(); + return avroFailureReasonBuilder_; + } + + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason, + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.Builder, + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReasonOrBuilder> + apiViolationReasonBuilder_; + + /** + * + * + *
    +       * Optional. The Pub/Sub API limits prevented the desired message from
    +       * being published.
    +       * 
    + * + * + * .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 Pub/Sub API limits prevented the desired message from
    +       * being published.
    +       * 
    + * + * + * .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 Pub/Sub API limits prevented the desired message from
    +       * being published.
    +       * 
    + * + * + * .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 Pub/Sub API limits prevented the desired message from
    +       * being published.
    +       * 
    + * + * + * .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 Pub/Sub API limits prevented the desired message from
    +       * being published.
    +       * 
    + * + * + * .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 Pub/Sub API limits prevented the desired message from
    +       * being published.
    +       * 
    + * + * + * .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 Pub/Sub API limits prevented the desired message from
    +       * being published.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.Builder + getApiViolationReasonBuilder() { + return internalGetApiViolationReasonFieldBuilder().getBuilder(); + } + + /** + * + * + *
    +       * Optional. The Pub/Sub API limits prevented the desired message from
    +       * being published.
    +       * 
    + * + * + * .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 Pub/Sub API limits prevented the desired message from
    +       * being published.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason, + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.Builder, + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReasonOrBuilder> + internalGetApiViolationReasonFieldBuilder() { + if (apiViolationReasonBuilder_ == null) { + if (!(reasonCase_ == 6)) { + reason_ = + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.getDefaultInstance(); + } + apiViolationReasonBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + 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_; + } + + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason, + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.Builder, + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReasonOrBuilder> + schemaViolationReasonBuilder_; + + /** + * + * + *
    +       * Optional. The Pub/Sub message failed schema validation.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the schemaViolationReason field is set. + */ + @java.lang.Override + public boolean hasSchemaViolationReason() { + return reasonCase_ == 7; + } + + /** + * + * + *
    +       * Optional. The Pub/Sub message failed schema validation.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The schemaViolationReason. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason + getSchemaViolationReason() { + if (schemaViolationReasonBuilder_ == null) { + if (reasonCase_ == 7) { + return (com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason) reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason + .getDefaultInstance(); + } else { + if (reasonCase_ == 7) { + return schemaViolationReasonBuilder_.getMessage(); + } + return com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason + .getDefaultInstance(); + } + } + + /** + * + * + *
    +       * Optional. The Pub/Sub message failed schema validation.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setSchemaViolationReason( + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason value) { + if (schemaViolationReasonBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + reason_ = value; + onChanged(); + } else { + schemaViolationReasonBuilder_.setMessage(value); + } + reasonCase_ = 7; + return this; + } + + /** + * + * + *
    +       * Optional. The Pub/Sub message failed schema validation.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setSchemaViolationReason( + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.Builder + builderForValue) { + if (schemaViolationReasonBuilder_ == null) { + reason_ = builderForValue.build(); + onChanged(); + } else { + schemaViolationReasonBuilder_.setMessage(builderForValue.build()); + } + reasonCase_ = 7; + return this; + } + + /** + * + * + *
    +       * Optional. The Pub/Sub message failed schema validation.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeSchemaViolationReason( + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason value) { + if (schemaViolationReasonBuilder_ == null) { + if (reasonCase_ == 7 + && reason_ + != com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason + .getDefaultInstance()) { + reason_ = + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.newBuilder( + (com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason) reason_) + .mergeFrom(value) + .buildPartial(); + } else { + reason_ = value; + } + onChanged(); + } else { + if (reasonCase_ == 7) { + schemaViolationReasonBuilder_.mergeFrom(value); + } else { + schemaViolationReasonBuilder_.setMessage(value); + } + } + reasonCase_ = 7; + return this; + } + + /** + * + * + *
    +       * Optional. The Pub/Sub message failed schema validation.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearSchemaViolationReason() { + if (schemaViolationReasonBuilder_ == null) { + if (reasonCase_ == 7) { + reasonCase_ = 0; + reason_ = null; + onChanged(); + } + } else { + if (reasonCase_ == 7) { + reasonCase_ = 0; + reason_ = null; + } + schemaViolationReasonBuilder_.clear(); + } + return this; + } + + /** + * + * + *
    +       * Optional. The Pub/Sub message failed schema validation.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.Builder + getSchemaViolationReasonBuilder() { + return internalGetSchemaViolationReasonFieldBuilder().getBuilder(); + } + + /** + * + * + *
    +       * Optional. The Pub/Sub message failed schema validation.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReasonOrBuilder + getSchemaViolationReasonOrBuilder() { + if ((reasonCase_ == 7) && (schemaViolationReasonBuilder_ != null)) { + return schemaViolationReasonBuilder_.getMessageOrBuilder(); + } else { + if (reasonCase_ == 7) { + return (com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason) reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason + .getDefaultInstance(); + } + } + + /** + * + * + *
    +       * Optional. The Pub/Sub message failed schema validation.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason, + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.Builder, + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReasonOrBuilder> + internalGetSchemaViolationReasonFieldBuilder() { + if (schemaViolationReasonBuilder_ == null) { + if (!(reasonCase_ == 7)) { + reason_ = + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason + .getDefaultInstance(); + } + schemaViolationReasonBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason, + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.Builder, + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReasonOrBuilder>( + (com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason) reason_, + getParentForChildren(), + isClean()); + reason_ = null; + } + reasonCase_ = 7; + onChanged(); + return schemaViolationReasonBuilder_; + } + + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason, + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason.Builder, + com.google.pubsub.v1.IngestionFailureEvent + .MessageTransformationFailureReasonOrBuilder> + messageTransformationFailureReasonBuilder_; + + /** + * + * + *
    +       * Optional. Failure encountered when applying a message transformation to
    +       * the Pub/Sub message.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the messageTransformationFailureReason field is set. + */ + @java.lang.Override + public boolean hasMessageTransformationFailureReason() { + return reasonCase_ == 8; + } + + /** + * + * + *
    +       * Optional. Failure encountered when applying a message transformation to
    +       * the Pub/Sub message.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The messageTransformationFailureReason. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + getMessageTransformationFailureReason() { + if (messageTransformationFailureReasonBuilder_ == null) { + if (reasonCase_ == 8) { + return (com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason) + reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + .getDefaultInstance(); + } else { + if (reasonCase_ == 8) { + return messageTransformationFailureReasonBuilder_.getMessage(); + } + return com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + .getDefaultInstance(); + } + } + + /** + * + * + *
    +       * Optional. Failure encountered when applying a message transformation to
    +       * the Pub/Sub message.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setMessageTransformationFailureReason( + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason value) { + if (messageTransformationFailureReasonBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + reason_ = value; + onChanged(); + } else { + messageTransformationFailureReasonBuilder_.setMessage(value); + } + reasonCase_ = 8; + return this; + } + + /** + * + * + *
    +       * Optional. Failure encountered when applying a message transformation to
    +       * the Pub/Sub message.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setMessageTransformationFailureReason( + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason.Builder + builderForValue) { + if (messageTransformationFailureReasonBuilder_ == null) { + reason_ = builderForValue.build(); + onChanged(); + } else { + messageTransformationFailureReasonBuilder_.setMessage(builderForValue.build()); + } + reasonCase_ = 8; + return this; + } + + /** + * + * + *
    +       * Optional. Failure encountered when applying a message transformation to
    +       * the Pub/Sub message.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeMessageTransformationFailureReason( + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason value) { + if (messageTransformationFailureReasonBuilder_ == null) { + if (reasonCase_ == 8 + && reason_ + != com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + .getDefaultInstance()) { + reason_ = + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + .newBuilder( + (com.google.pubsub.v1.IngestionFailureEvent + .MessageTransformationFailureReason) + reason_) + .mergeFrom(value) + .buildPartial(); + } else { + reason_ = value; + } + onChanged(); + } else { + if (reasonCase_ == 8) { + messageTransformationFailureReasonBuilder_.mergeFrom(value); + } else { + messageTransformationFailureReasonBuilder_.setMessage(value); + } + } + reasonCase_ = 8; + return this; + } + + /** + * + * + *
    +       * Optional. Failure encountered when applying a message transformation to
    +       * the Pub/Sub message.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearMessageTransformationFailureReason() { + if (messageTransformationFailureReasonBuilder_ == null) { + if (reasonCase_ == 8) { + reasonCase_ = 0; + reason_ = null; + onChanged(); + } + } else { + if (reasonCase_ == 8) { + reasonCase_ = 0; + reason_ = null; + } + messageTransformationFailureReasonBuilder_.clear(); + } + return this; + } + + /** + * + * + *
    +       * Optional. Failure encountered when applying a message transformation to
    +       * the Pub/Sub message.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason.Builder + getMessageTransformationFailureReasonBuilder() { + return internalGetMessageTransformationFailureReasonFieldBuilder().getBuilder(); + } + + /** + * + * + *
    +       * Optional. Failure encountered when applying a message transformation to
    +       * the Pub/Sub message.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReasonOrBuilder + getMessageTransformationFailureReasonOrBuilder() { + if ((reasonCase_ == 8) && (messageTransformationFailureReasonBuilder_ != null)) { + return messageTransformationFailureReasonBuilder_.getMessageOrBuilder(); + } else { + if (reasonCase_ == 8) { + return (com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason) + reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + .getDefaultInstance(); + } + } + + /** + * + * + *
    +       * Optional. Failure encountered when applying a message transformation to
    +       * the Pub/Sub message.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason, + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason.Builder, + com.google.pubsub.v1.IngestionFailureEvent + .MessageTransformationFailureReasonOrBuilder> + internalGetMessageTransformationFailureReasonFieldBuilder() { + if (messageTransformationFailureReasonBuilder_ == null) { + if (!(reasonCase_ == 8)) { + reason_ = + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + .getDefaultInstance(); + } + messageTransformationFailureReasonBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason, + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + .Builder, + com.google.pubsub.v1.IngestionFailureEvent + .MessageTransformationFailureReasonOrBuilder>( + (com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason) + reason_, + getParentForChildren(), + isClean()); + reason_ = null; + } + reasonCase_ = 8; + onChanged(); + return messageTransformationFailureReasonBuilder_; + } + + // @@protoc_insertion_point(builder_scope:google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure) + } + + // @@protoc_insertion_point(class_scope:google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure) + private static final com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure(); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public CloudStorageFailure parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException() + .setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public interface AwsMskFailureReasonOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
    +     * Optional. The ARN of the cluster of the topic being ingested from.
    +     * 
    + * + * string cluster_arn = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The clusterArn. + */ + java.lang.String getClusterArn(); + + /** + * + * + *
    +     * Optional. The ARN of the cluster of the topic being ingested from.
    +     * 
    + * + * string cluster_arn = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for clusterArn. + */ + com.google.protobuf.ByteString getClusterArnBytes(); + + /** + * + * + *
    +     * Optional. The name of the Kafka topic being ingested from.
    +     * 
    + * + * string kafka_topic = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The kafkaTopic. + */ + java.lang.String getKafkaTopic(); + + /** + * + * + *
    +     * Optional. The name of the Kafka topic being ingested from.
    +     * 
    + * + * string kafka_topic = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for kafkaTopic. + */ + com.google.protobuf.ByteString getKafkaTopicBytes(); + + /** + * + * + *
    +     * Optional. The partition ID of the message that failed to be ingested.
    +     * 
    + * + * int64 partition_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The partitionId. + */ + long getPartitionId(); + + /** + * + * + *
    +     * Optional. The offset within the partition of the message that failed to
    +     * be ingested.
    +     * 
    + * + * int64 offset = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The offset. + */ + long getOffset(); + + /** + * + * + *
    +     * Optional. The Pub/Sub API limits prevented the desired message from
    +     * being published.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the apiViolationReason field is set. + */ + boolean hasApiViolationReason(); + + /** + * + * + *
    +     * Optional. The Pub/Sub API limits prevented the desired message from
    +     * being published.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The apiViolationReason. + */ + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason getApiViolationReason(); + + /** + * + * + *
    +     * Optional. The Pub/Sub API limits prevented the desired message from
    +     * being published.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReasonOrBuilder + getApiViolationReasonOrBuilder(); + + /** + * + * + *
    +     * Optional. The Pub/Sub message failed schema validation.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the schemaViolationReason field is set. + */ + boolean hasSchemaViolationReason(); + + /** + * + * + *
    +     * Optional. The Pub/Sub message failed schema validation.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The schemaViolationReason. + */ + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason getSchemaViolationReason(); + + /** + * + * + *
    +     * Optional. The Pub/Sub message failed schema validation.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReasonOrBuilder + getSchemaViolationReasonOrBuilder(); + + /** + * + * + *
    +     * Optional. Failure encountered when applying a message transformation to
    +     * the Pub/Sub message.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the messageTransformationFailureReason field is set. + */ + boolean hasMessageTransformationFailureReason(); + + /** + * + * + *
    +     * Optional. Failure encountered when applying a message transformation to
    +     * the Pub/Sub message.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The messageTransformationFailureReason. + */ + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + getMessageTransformationFailureReason(); + + /** + * + * + *
    +     * Optional. Failure encountered when applying a message transformation to
    +     * the Pub/Sub message.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReasonOrBuilder + getMessageTransformationFailureReasonOrBuilder(); + + com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason.ReasonCase getReasonCase(); + } + + /** + * + * + *
    +   * Failure when ingesting from an Amazon MSK source.
    +   * 
    + * + * Protobuf type {@code google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason} + */ + public static final class AwsMskFailureReason extends com.google.protobuf.GeneratedMessage + implements + // @@protoc_insertion_point(message_implements:google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason) + AwsMskFailureReasonOrBuilder { + private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "AwsMskFailureReason"); + } + + // Use AwsMskFailureReason.newBuilder() to construct. + private AwsMskFailureReason(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + + private AwsMskFailureReason() { + clusterArn_ = ""; + kafkaTopic_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionFailureEvent_AwsMskFailureReason_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionFailureEvent_AwsMskFailureReason_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason.class, + com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason.Builder.class); + } + + private int reasonCase_ = 0; + + @SuppressWarnings("serial") + private java.lang.Object reason_; + + public enum ReasonCase + implements + com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + API_VIOLATION_REASON(5), + SCHEMA_VIOLATION_REASON(6), + MESSAGE_TRANSFORMATION_FAILURE_REASON(7), + REASON_NOT_SET(0); + private final int value; + + private ReasonCase(int value) { + this.value = value; + } + + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static ReasonCase valueOf(int value) { + return forNumber(value); + } + + public static ReasonCase forNumber(int value) { + switch (value) { + case 5: + return API_VIOLATION_REASON; + case 6: + return SCHEMA_VIOLATION_REASON; + case 7: + return MESSAGE_TRANSFORMATION_FAILURE_REASON; + case 0: + return REASON_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public ReasonCase getReasonCase() { + return ReasonCase.forNumber(reasonCase_); + } + + public static final int CLUSTER_ARN_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object clusterArn_ = ""; + + /** + * + * + *
    +     * Optional. The ARN of the cluster of the topic being ingested from.
    +     * 
    + * + * string cluster_arn = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The clusterArn. + */ + @java.lang.Override + public java.lang.String getClusterArn() { + java.lang.Object ref = clusterArn_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + clusterArn_ = s; + return s; + } + } + + /** + * + * + *
    +     * Optional. The ARN of the cluster of the topic being ingested from.
    +     * 
    + * + * string cluster_arn = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for clusterArn. + */ + @java.lang.Override + public com.google.protobuf.ByteString getClusterArnBytes() { + java.lang.Object ref = clusterArn_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + clusterArn_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int KAFKA_TOPIC_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private volatile java.lang.Object kafkaTopic_ = ""; + + /** + * + * + *
    +     * Optional. The name of the Kafka topic being ingested from.
    +     * 
    + * + * string kafka_topic = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The kafkaTopic. + */ + @java.lang.Override + public java.lang.String getKafkaTopic() { + java.lang.Object ref = kafkaTopic_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + kafkaTopic_ = s; + return s; + } + } + + /** + * + * + *
    +     * Optional. The name of the Kafka topic being ingested from.
    +     * 
    + * + * string kafka_topic = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for kafkaTopic. + */ + @java.lang.Override + public com.google.protobuf.ByteString getKafkaTopicBytes() { + java.lang.Object ref = kafkaTopic_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + kafkaTopic_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PARTITION_ID_FIELD_NUMBER = 3; + private long partitionId_ = 0L; + + /** + * + * + *
    +     * Optional. The partition ID of the message that failed to be ingested.
    +     * 
    + * + * int64 partition_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The partitionId. + */ + @java.lang.Override + public long getPartitionId() { + return partitionId_; + } + + public static final int OFFSET_FIELD_NUMBER = 4; + private long offset_ = 0L; + + /** + * + * + *
    +     * Optional. The offset within the partition of the message that failed to
    +     * be ingested.
    +     * 
    + * + * int64 offset = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The offset. + */ + @java.lang.Override + public long getOffset() { + return offset_; + } + + public static final int API_VIOLATION_REASON_FIELD_NUMBER = 5; + + /** + * + * + *
    +     * Optional. The Pub/Sub API limits prevented the desired message from
    +     * being published.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the apiViolationReason field is set. + */ + @java.lang.Override + public boolean hasApiViolationReason() { + return reasonCase_ == 5; + } + + /** + * + * + *
    +     * Optional. The Pub/Sub API limits prevented the desired message from
    +     * being published.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The apiViolationReason. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason getApiViolationReason() { + if (reasonCase_ == 5) { + return (com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason) reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.getDefaultInstance(); + } + + /** + * + * + *
    +     * Optional. The Pub/Sub API limits prevented the desired message from
    +     * being published.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReasonOrBuilder + getApiViolationReasonOrBuilder() { + if (reasonCase_ == 5) { + return (com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason) reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.getDefaultInstance(); + } + + public static final int SCHEMA_VIOLATION_REASON_FIELD_NUMBER = 6; + + /** + * + * + *
    +     * Optional. The Pub/Sub message failed schema validation.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the schemaViolationReason field is set. + */ + @java.lang.Override + public boolean hasSchemaViolationReason() { + return reasonCase_ == 6; + } + + /** + * + * + *
    +     * Optional. The Pub/Sub message failed schema validation.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The schemaViolationReason. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason + getSchemaViolationReason() { + if (reasonCase_ == 6) { + return (com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason) reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.getDefaultInstance(); + } + + /** + * + * + *
    +     * Optional. The Pub/Sub message failed schema validation.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReasonOrBuilder + getSchemaViolationReasonOrBuilder() { + if (reasonCase_ == 6) { + return (com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason) reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.getDefaultInstance(); + } + + public static final int MESSAGE_TRANSFORMATION_FAILURE_REASON_FIELD_NUMBER = 7; + + /** + * + * + *
    +     * Optional. Failure encountered when applying a message transformation to
    +     * the Pub/Sub message.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the messageTransformationFailureReason field is set. + */ + @java.lang.Override + public boolean hasMessageTransformationFailureReason() { + return reasonCase_ == 7; + } + + /** + * + * + *
    +     * Optional. Failure encountered when applying a message transformation to
    +     * the Pub/Sub message.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The messageTransformationFailureReason. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + getMessageTransformationFailureReason() { + if (reasonCase_ == 7) { + return (com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason) + reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + .getDefaultInstance(); + } + + /** + * + * + *
    +     * Optional. Failure encountered when applying a message transformation to
    +     * the Pub/Sub message.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReasonOrBuilder + getMessageTransformationFailureReasonOrBuilder() { + if (reasonCase_ == 7) { + return (com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason) + reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + .getDefaultInstance(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(clusterArn_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, clusterArn_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(kafkaTopic_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, kafkaTopic_); + } + if (partitionId_ != 0L) { + output.writeInt64(3, partitionId_); + } + if (offset_ != 0L) { + output.writeInt64(4, offset_); + } + if (reasonCase_ == 5) { + output.writeMessage( + 5, (com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason) reason_); + } + if (reasonCase_ == 6) { + output.writeMessage( + 6, (com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason) reason_); + } + if (reasonCase_ == 7) { + output.writeMessage( + 7, + (com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason) + reason_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(clusterArn_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, clusterArn_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(kafkaTopic_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, kafkaTopic_); + } + if (partitionId_ != 0L) { + size += com.google.protobuf.CodedOutputStream.computeInt64Size(3, partitionId_); + } + if (offset_ != 0L) { + size += com.google.protobuf.CodedOutputStream.computeInt64Size(4, offset_); + } + if (reasonCase_ == 5) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 5, (com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason) reason_); + } + if (reasonCase_ == 6) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 6, (com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason) reason_); + } + if (reasonCase_ == 7) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 7, + (com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason) + reason_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason)) { + return super.equals(obj); + } + com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason other = + (com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason) obj; + + if (!getClusterArn().equals(other.getClusterArn())) return false; + if (!getKafkaTopic().equals(other.getKafkaTopic())) return false; + if (getPartitionId() != other.getPartitionId()) return false; + if (getOffset() != other.getOffset()) return false; + if (!getReasonCase().equals(other.getReasonCase())) return false; + switch (reasonCase_) { + case 5: + if (!getApiViolationReason().equals(other.getApiViolationReason())) return false; + break; + case 6: + if (!getSchemaViolationReason().equals(other.getSchemaViolationReason())) return false; + break; + case 7: + if (!getMessageTransformationFailureReason() + .equals(other.getMessageTransformationFailureReason())) return false; + break; + case 0: + default: + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + CLUSTER_ARN_FIELD_NUMBER; + hash = (53 * hash) + getClusterArn().hashCode(); + hash = (37 * hash) + KAFKA_TOPIC_FIELD_NUMBER; + hash = (53 * hash) + getKafkaTopic().hashCode(); + hash = (37 * hash) + PARTITION_ID_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getPartitionId()); + hash = (37 * hash) + OFFSET_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getOffset()); + switch (reasonCase_) { + case 5: + hash = (37 * hash) + API_VIOLATION_REASON_FIELD_NUMBER; + hash = (53 * hash) + getApiViolationReason().hashCode(); + break; + case 6: + hash = (37 * hash) + SCHEMA_VIOLATION_REASON_FIELD_NUMBER; + hash = (53 * hash) + getSchemaViolationReason().hashCode(); + break; + case 7: + hash = (37 * hash) + MESSAGE_TRANSFORMATION_FAILURE_REASON_FIELD_NUMBER; + hash = (53 * hash) + getMessageTransformationFailureReason().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason parseFrom( + byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + + /** + * + * + *
    +     * Failure when ingesting from an Amazon MSK source.
    +     * 
    + * + * Protobuf type {@code google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder + implements + // @@protoc_insertion_point(builder_implements:google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason) + com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReasonOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionFailureEvent_AwsMskFailureReason_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionFailureEvent_AwsMskFailureReason_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason.class, + com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason.Builder.class); + } + + // Construct using com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + clusterArn_ = ""; + kafkaTopic_ = ""; + partitionId_ = 0L; + offset_ = 0L; + if (apiViolationReasonBuilder_ != null) { + apiViolationReasonBuilder_.clear(); + } + if (schemaViolationReasonBuilder_ != null) { + schemaViolationReasonBuilder_.clear(); + } + if (messageTransformationFailureReasonBuilder_ != null) { + messageTransformationFailureReasonBuilder_.clear(); + } + reasonCase_ = 0; + reason_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionFailureEvent_AwsMskFailureReason_descriptor; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason + getDefaultInstanceForType() { + return com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason.getDefaultInstance(); + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason build() { + com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason buildPartial() { + com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason result = + new com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + buildPartialOneofs(result); + onBuilt(); + return result; + } + + private void buildPartial0( + com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.clusterArn_ = clusterArn_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.kafkaTopic_ = kafkaTopic_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.partitionId_ = partitionId_; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.offset_ = offset_; + } + } + + private void buildPartialOneofs( + com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason result) { + result.reasonCase_ = reasonCase_; + result.reason_ = this.reason_; + if (reasonCase_ == 5 && apiViolationReasonBuilder_ != null) { + result.reason_ = apiViolationReasonBuilder_.build(); + } + if (reasonCase_ == 6 && schemaViolationReasonBuilder_ != null) { + result.reason_ = schemaViolationReasonBuilder_.build(); + } + if (reasonCase_ == 7 && messageTransformationFailureReasonBuilder_ != null) { + result.reason_ = messageTransformationFailureReasonBuilder_.build(); + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason) { + return mergeFrom((com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason other) { + if (other + == com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason.getDefaultInstance()) + return this; + if (!other.getClusterArn().isEmpty()) { + clusterArn_ = other.clusterArn_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getKafkaTopic().isEmpty()) { + kafkaTopic_ = other.kafkaTopic_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (other.getPartitionId() != 0L) { + setPartitionId(other.getPartitionId()); + } + if (other.getOffset() != 0L) { + setOffset(other.getOffset()); + } + switch (other.getReasonCase()) { + case API_VIOLATION_REASON: + { + mergeApiViolationReason(other.getApiViolationReason()); + break; + } + case SCHEMA_VIOLATION_REASON: + { + mergeSchemaViolationReason(other.getSchemaViolationReason()); + break; + } + case MESSAGE_TRANSFORMATION_FAILURE_REASON: + { + mergeMessageTransformationFailureReason( + other.getMessageTransformationFailureReason()); + break; + } + case REASON_NOT_SET: + { + break; + } + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + clusterArn_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + kafkaTopic_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 24: + { + partitionId_ = input.readInt64(); + bitField0_ |= 0x00000004; + break; + } // case 24 + case 32: + { + offset_ = input.readInt64(); + bitField0_ |= 0x00000008; + break; + } // case 32 + case 42: + { + input.readMessage( + internalGetApiViolationReasonFieldBuilder().getBuilder(), extensionRegistry); + reasonCase_ = 5; + break; + } // case 42 + case 50: + { + input.readMessage( + internalGetSchemaViolationReasonFieldBuilder().getBuilder(), + extensionRegistry); + reasonCase_ = 6; + break; + } // case 50 + case 58: + { + input.readMessage( + internalGetMessageTransformationFailureReasonFieldBuilder().getBuilder(), + extensionRegistry); + reasonCase_ = 7; + break; + } // case 58 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int reasonCase_ = 0; + private java.lang.Object reason_; + + public ReasonCase getReasonCase() { + return ReasonCase.forNumber(reasonCase_); + } + + public Builder clearReason() { + reasonCase_ = 0; + reason_ = null; + onChanged(); + return this; + } + + private int bitField0_; + + private java.lang.Object clusterArn_ = ""; + + /** + * + * + *
    +       * Optional. The ARN of the cluster of the topic being ingested from.
    +       * 
    + * + * string cluster_arn = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The clusterArn. + */ + public java.lang.String getClusterArn() { + java.lang.Object ref = clusterArn_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + clusterArn_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +       * Optional. The ARN of the cluster of the topic being ingested from.
    +       * 
    + * + * string cluster_arn = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for clusterArn. + */ + public com.google.protobuf.ByteString getClusterArnBytes() { + java.lang.Object ref = clusterArn_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + clusterArn_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +       * Optional. The ARN of the cluster of the topic being ingested from.
    +       * 
    + * + * string cluster_arn = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The clusterArn to set. + * @return This builder for chaining. + */ + public Builder setClusterArn(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + clusterArn_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. The ARN of the cluster of the topic being ingested from.
    +       * 
    + * + * string cluster_arn = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearClusterArn() { + clusterArn_ = getDefaultInstance().getClusterArn(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. The ARN of the cluster of the topic being ingested from.
    +       * 
    + * + * string cluster_arn = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for clusterArn to set. + * @return This builder for chaining. + */ + public Builder setClusterArnBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + clusterArn_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object kafkaTopic_ = ""; + + /** + * + * + *
    +       * Optional. The name of the Kafka topic being ingested from.
    +       * 
    + * + * string kafka_topic = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The kafkaTopic. + */ + public java.lang.String getKafkaTopic() { + java.lang.Object ref = kafkaTopic_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + kafkaTopic_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +       * Optional. The name of the Kafka topic being ingested from.
    +       * 
    + * + * string kafka_topic = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for kafkaTopic. + */ + public com.google.protobuf.ByteString getKafkaTopicBytes() { + java.lang.Object ref = kafkaTopic_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + kafkaTopic_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +       * Optional. The name of the Kafka topic being ingested from.
    +       * 
    + * + * string kafka_topic = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The kafkaTopic to set. + * @return This builder for chaining. + */ + public Builder setKafkaTopic(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + kafkaTopic_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. The name of the Kafka topic being ingested from.
    +       * 
    + * + * string kafka_topic = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearKafkaTopic() { + kafkaTopic_ = getDefaultInstance().getKafkaTopic(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. The name of the Kafka topic being ingested from.
    +       * 
    + * + * string kafka_topic = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for kafkaTopic to set. + * @return This builder for chaining. + */ + public Builder setKafkaTopicBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + kafkaTopic_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private long partitionId_; + + /** + * + * + *
    +       * Optional. The partition ID of the message that failed to be ingested.
    +       * 
    + * + * int64 partition_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The partitionId. + */ + @java.lang.Override + public long getPartitionId() { + return partitionId_; + } + + /** + * + * + *
    +       * Optional. The partition ID of the message that failed to be ingested.
    +       * 
    + * + * int64 partition_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The partitionId to set. + * @return This builder for chaining. + */ + public Builder setPartitionId(long value) { + + partitionId_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. The partition ID of the message that failed to be ingested.
    +       * 
    + * + * int64 partition_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearPartitionId() { + bitField0_ = (bitField0_ & ~0x00000004); + partitionId_ = 0L; + onChanged(); + return this; + } + + private long offset_; + + /** + * + * + *
    +       * Optional. The offset within the partition of the message that failed to
    +       * be ingested.
    +       * 
    + * + * int64 offset = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The offset. + */ + @java.lang.Override + public long getOffset() { + return offset_; + } + + /** + * + * + *
    +       * Optional. The offset within the partition of the message that failed to
    +       * be ingested.
    +       * 
    + * + * int64 offset = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The offset to set. + * @return This builder for chaining. + */ + public Builder setOffset(long value) { + + offset_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. The offset within the partition of the message that failed to
    +       * be ingested.
    +       * 
    + * + * int64 offset = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearOffset() { + bitField0_ = (bitField0_ & ~0x00000008); + offset_ = 0L; + onChanged(); + return this; + } + + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason, + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.Builder, + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReasonOrBuilder> + apiViolationReasonBuilder_; + + /** + * + * + *
    +       * Optional. The Pub/Sub API limits prevented the desired message from
    +       * being published.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the apiViolationReason field is set. + */ + @java.lang.Override + public boolean hasApiViolationReason() { + return reasonCase_ == 5; + } + + /** + * + * + *
    +       * Optional. The Pub/Sub API limits prevented the desired message from
    +       * being published.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The apiViolationReason. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason getApiViolationReason() { + if (apiViolationReasonBuilder_ == null) { + if (reasonCase_ == 5) { + return (com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason) reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.getDefaultInstance(); + } else { + if (reasonCase_ == 5) { + return apiViolationReasonBuilder_.getMessage(); + } + return com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.getDefaultInstance(); + } + } + + /** + * + * + *
    +       * Optional. The Pub/Sub API limits prevented the desired message from
    +       * being published.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 5 [(.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_ = 5; + return this; + } + + /** + * + * + *
    +       * Optional. The Pub/Sub API limits prevented the desired message from
    +       * being published.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 5 [(.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_ = 5; + return this; + } + + /** + * + * + *
    +       * Optional. The Pub/Sub API limits prevented the desired message from
    +       * being published.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeApiViolationReason( + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason value) { + if (apiViolationReasonBuilder_ == null) { + if (reasonCase_ == 5 + && 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_ == 5) { + apiViolationReasonBuilder_.mergeFrom(value); + } else { + apiViolationReasonBuilder_.setMessage(value); + } + } + reasonCase_ = 5; + return this; + } + + /** + * + * + *
    +       * Optional. The Pub/Sub API limits prevented the desired message from
    +       * being published.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearApiViolationReason() { + if (apiViolationReasonBuilder_ == null) { + if (reasonCase_ == 5) { + reasonCase_ = 0; + reason_ = null; + onChanged(); + } + } else { + if (reasonCase_ == 5) { + reasonCase_ = 0; + reason_ = null; + } + apiViolationReasonBuilder_.clear(); + } + return this; + } + + /** + * + * + *
    +       * Optional. The Pub/Sub API limits prevented the desired message from
    +       * being published.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.Builder + getApiViolationReasonBuilder() { + return internalGetApiViolationReasonFieldBuilder().getBuilder(); + } + + /** + * + * + *
    +       * Optional. The Pub/Sub API limits prevented the desired message from
    +       * being published.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReasonOrBuilder + getApiViolationReasonOrBuilder() { + if ((reasonCase_ == 5) && (apiViolationReasonBuilder_ != null)) { + return apiViolationReasonBuilder_.getMessageOrBuilder(); + } else { + if (reasonCase_ == 5) { + return (com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason) reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.getDefaultInstance(); + } + } + + /** + * + * + *
    +       * Optional. The Pub/Sub API limits prevented the desired message from
    +       * being published.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason, + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.Builder, + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReasonOrBuilder> + internalGetApiViolationReasonFieldBuilder() { + if (apiViolationReasonBuilder_ == null) { + if (!(reasonCase_ == 5)) { + reason_ = + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.getDefaultInstance(); + } + apiViolationReasonBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + 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_ = 5; + onChanged(); + return apiViolationReasonBuilder_; + } + + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason, + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.Builder, + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReasonOrBuilder> + schemaViolationReasonBuilder_; + + /** + * + * + *
    +       * Optional. The Pub/Sub message failed schema validation.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the schemaViolationReason field is set. + */ + @java.lang.Override + public boolean hasSchemaViolationReason() { + return reasonCase_ == 6; + } + + /** + * + * + *
    +       * Optional. The Pub/Sub message failed schema validation.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The schemaViolationReason. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason + getSchemaViolationReason() { + if (schemaViolationReasonBuilder_ == null) { + if (reasonCase_ == 6) { + return (com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason) reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason + .getDefaultInstance(); + } else { + if (reasonCase_ == 6) { + return schemaViolationReasonBuilder_.getMessage(); + } + return com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason + .getDefaultInstance(); + } + } + + /** + * + * + *
    +       * Optional. The Pub/Sub message failed schema validation.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setSchemaViolationReason( + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason value) { + if (schemaViolationReasonBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + reason_ = value; + onChanged(); + } else { + schemaViolationReasonBuilder_.setMessage(value); + } + reasonCase_ = 6; + return this; + } + + /** + * + * + *
    +       * Optional. The Pub/Sub message failed schema validation.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setSchemaViolationReason( + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.Builder + builderForValue) { + if (schemaViolationReasonBuilder_ == null) { + reason_ = builderForValue.build(); + onChanged(); + } else { + schemaViolationReasonBuilder_.setMessage(builderForValue.build()); + } + reasonCase_ = 6; + return this; + } + + /** + * + * + *
    +       * Optional. The Pub/Sub message failed schema validation.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeSchemaViolationReason( + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason value) { + if (schemaViolationReasonBuilder_ == null) { + if (reasonCase_ == 6 + && reason_ + != com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason + .getDefaultInstance()) { + reason_ = + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.newBuilder( + (com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason) reason_) + .mergeFrom(value) + .buildPartial(); + } else { + reason_ = value; + } + onChanged(); + } else { + if (reasonCase_ == 6) { + schemaViolationReasonBuilder_.mergeFrom(value); + } else { + schemaViolationReasonBuilder_.setMessage(value); + } + } + reasonCase_ = 6; + return this; + } + + /** + * + * + *
    +       * Optional. The Pub/Sub message failed schema validation.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearSchemaViolationReason() { + if (schemaViolationReasonBuilder_ == null) { + if (reasonCase_ == 6) { + reasonCase_ = 0; + reason_ = null; + onChanged(); + } + } else { + if (reasonCase_ == 6) { + reasonCase_ = 0; + reason_ = null; + } + schemaViolationReasonBuilder_.clear(); + } + return this; + } + + /** + * + * + *
    +       * Optional. The Pub/Sub message failed schema validation.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.Builder + getSchemaViolationReasonBuilder() { + return internalGetSchemaViolationReasonFieldBuilder().getBuilder(); + } + + /** + * + * + *
    +       * Optional. The Pub/Sub message failed schema validation.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReasonOrBuilder + getSchemaViolationReasonOrBuilder() { + if ((reasonCase_ == 6) && (schemaViolationReasonBuilder_ != null)) { + return schemaViolationReasonBuilder_.getMessageOrBuilder(); + } else { + if (reasonCase_ == 6) { + return (com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason) reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason + .getDefaultInstance(); + } + } + + /** + * + * + *
    +       * Optional. The Pub/Sub message failed schema validation.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason, + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.Builder, + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReasonOrBuilder> + internalGetSchemaViolationReasonFieldBuilder() { + if (schemaViolationReasonBuilder_ == null) { + if (!(reasonCase_ == 6)) { + reason_ = + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason + .getDefaultInstance(); + } + schemaViolationReasonBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason, + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.Builder, + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReasonOrBuilder>( + (com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason) reason_, + getParentForChildren(), + isClean()); + reason_ = null; + } + reasonCase_ = 6; + onChanged(); + return schemaViolationReasonBuilder_; + } + + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason, + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason.Builder, + com.google.pubsub.v1.IngestionFailureEvent + .MessageTransformationFailureReasonOrBuilder> + messageTransformationFailureReasonBuilder_; + + /** + * + * + *
    +       * Optional. Failure encountered when applying a message transformation to
    +       * the Pub/Sub message.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the messageTransformationFailureReason field is set. + */ + @java.lang.Override + public boolean hasMessageTransformationFailureReason() { + return reasonCase_ == 7; + } + + /** + * + * + *
    +       * Optional. Failure encountered when applying a message transformation to
    +       * the Pub/Sub message.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The messageTransformationFailureReason. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + getMessageTransformationFailureReason() { + if (messageTransformationFailureReasonBuilder_ == null) { + if (reasonCase_ == 7) { + return (com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason) + reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + .getDefaultInstance(); + } else { + if (reasonCase_ == 7) { + return messageTransformationFailureReasonBuilder_.getMessage(); + } + return com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + .getDefaultInstance(); + } + } + + /** + * + * + *
    +       * Optional. Failure encountered when applying a message transformation to
    +       * the Pub/Sub message.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setMessageTransformationFailureReason( + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason value) { + if (messageTransformationFailureReasonBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + reason_ = value; + onChanged(); + } else { + messageTransformationFailureReasonBuilder_.setMessage(value); + } + reasonCase_ = 7; + return this; + } + + /** + * + * + *
    +       * Optional. Failure encountered when applying a message transformation to
    +       * the Pub/Sub message.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setMessageTransformationFailureReason( + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason.Builder + builderForValue) { + if (messageTransformationFailureReasonBuilder_ == null) { + reason_ = builderForValue.build(); + onChanged(); + } else { + messageTransformationFailureReasonBuilder_.setMessage(builderForValue.build()); + } + reasonCase_ = 7; + return this; + } + + /** + * + * + *
    +       * Optional. Failure encountered when applying a message transformation to
    +       * the Pub/Sub message.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeMessageTransformationFailureReason( + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason value) { + if (messageTransformationFailureReasonBuilder_ == null) { + if (reasonCase_ == 7 + && reason_ + != com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + .getDefaultInstance()) { + reason_ = + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + .newBuilder( + (com.google.pubsub.v1.IngestionFailureEvent + .MessageTransformationFailureReason) + reason_) + .mergeFrom(value) + .buildPartial(); + } else { + reason_ = value; + } + onChanged(); + } else { + if (reasonCase_ == 7) { + messageTransformationFailureReasonBuilder_.mergeFrom(value); + } else { + messageTransformationFailureReasonBuilder_.setMessage(value); + } + } + reasonCase_ = 7; + return this; + } + + /** + * + * + *
    +       * Optional. Failure encountered when applying a message transformation to
    +       * the Pub/Sub message.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearMessageTransformationFailureReason() { + if (messageTransformationFailureReasonBuilder_ == null) { + if (reasonCase_ == 7) { + reasonCase_ = 0; + reason_ = null; + onChanged(); + } + } else { + if (reasonCase_ == 7) { + reasonCase_ = 0; + reason_ = null; + } + messageTransformationFailureReasonBuilder_.clear(); + } + return this; + } + + /** + * + * + *
    +       * Optional. Failure encountered when applying a message transformation to
    +       * the Pub/Sub message.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason.Builder + getMessageTransformationFailureReasonBuilder() { + return internalGetMessageTransformationFailureReasonFieldBuilder().getBuilder(); + } + + /** + * + * + *
    +       * Optional. Failure encountered when applying a message transformation to
    +       * the Pub/Sub message.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReasonOrBuilder + getMessageTransformationFailureReasonOrBuilder() { + if ((reasonCase_ == 7) && (messageTransformationFailureReasonBuilder_ != null)) { + return messageTransformationFailureReasonBuilder_.getMessageOrBuilder(); + } else { + if (reasonCase_ == 7) { + return (com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason) + reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + .getDefaultInstance(); + } + } + + /** + * + * + *
    +       * Optional. Failure encountered when applying a message transformation to
    +       * the Pub/Sub message.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason, + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason.Builder, + com.google.pubsub.v1.IngestionFailureEvent + .MessageTransformationFailureReasonOrBuilder> + internalGetMessageTransformationFailureReasonFieldBuilder() { + if (messageTransformationFailureReasonBuilder_ == null) { + if (!(reasonCase_ == 7)) { + reason_ = + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + .getDefaultInstance(); + } + messageTransformationFailureReasonBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason, + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + .Builder, + com.google.pubsub.v1.IngestionFailureEvent + .MessageTransformationFailureReasonOrBuilder>( + (com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason) + reason_, + getParentForChildren(), + isClean()); + reason_ = null; + } + reasonCase_ = 7; + onChanged(); + return messageTransformationFailureReasonBuilder_; + } + + // @@protoc_insertion_point(builder_scope:google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason) + } + + // @@protoc_insertion_point(class_scope:google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason) + private static final com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason(); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AwsMskFailureReason parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException() + .setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public interface AzureEventHubsFailureReasonOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
    +     * Optional. The namespace containing the event hub being ingested from.
    +     * 
    + * + * string namespace = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The namespace. + */ + java.lang.String getNamespace(); + + /** + * + * + *
    +     * Optional. The namespace containing the event hub being ingested from.
    +     * 
    + * + * string namespace = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for namespace. + */ + com.google.protobuf.ByteString getNamespaceBytes(); + + /** + * + * + *
    +     * Optional. The name of the event hub being ingested from.
    +     * 
    + * + * string event_hub = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The eventHub. + */ + java.lang.String getEventHub(); + + /** + * + * + *
    +     * Optional. The name of the event hub being ingested from.
    +     * 
    + * + * string event_hub = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for eventHub. + */ + com.google.protobuf.ByteString getEventHubBytes(); + + /** + * + * + *
    +     * Optional. The partition ID of the message that failed to be ingested.
    +     * 
    + * + * int64 partition_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The partitionId. + */ + long getPartitionId(); + + /** + * + * + *
    +     * Optional. The offset within the partition of the message that failed to
    +     * be ingested.
    +     * 
    + * + * int64 offset = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The offset. + */ + long getOffset(); + + /** + * + * + *
    +     * Optional. The Pub/Sub API limits prevented the desired message from
    +     * being published.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the apiViolationReason field is set. + */ + boolean hasApiViolationReason(); + + /** + * + * + *
    +     * Optional. The Pub/Sub API limits prevented the desired message from
    +     * being published.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The apiViolationReason. + */ + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason getApiViolationReason(); + + /** + * + * + *
    +     * Optional. The Pub/Sub API limits prevented the desired message from
    +     * being published.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReasonOrBuilder + getApiViolationReasonOrBuilder(); + + /** + * + * + *
    +     * Optional. The Pub/Sub message failed schema validation.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the schemaViolationReason field is set. + */ + boolean hasSchemaViolationReason(); + + /** + * + * + *
    +     * Optional. The Pub/Sub message failed schema validation.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The schemaViolationReason. + */ + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason getSchemaViolationReason(); + + /** + * + * + *
    +     * Optional. The Pub/Sub message failed schema validation.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReasonOrBuilder + getSchemaViolationReasonOrBuilder(); + + /** + * + * + *
    +     * Optional. Failure encountered when applying a message transformation to
    +     * the Pub/Sub message.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the messageTransformationFailureReason field is set. + */ + boolean hasMessageTransformationFailureReason(); + + /** + * + * + *
    +     * Optional. Failure encountered when applying a message transformation to
    +     * the Pub/Sub message.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The messageTransformationFailureReason. + */ + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + getMessageTransformationFailureReason(); + + /** + * + * + *
    +     * Optional. Failure encountered when applying a message transformation to
    +     * the Pub/Sub message.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReasonOrBuilder + getMessageTransformationFailureReasonOrBuilder(); + + com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason.ReasonCase + getReasonCase(); + } + + /** + * + * + *
    +   * Failure when ingesting from an Azure Event Hubs source.
    +   * 
    + * + * Protobuf type {@code google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason} + */ + public static final class AzureEventHubsFailureReason extends com.google.protobuf.GeneratedMessage + implements + // @@protoc_insertion_point(message_implements:google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason) + AzureEventHubsFailureReasonOrBuilder { + private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "AzureEventHubsFailureReason"); + } + + // Use AzureEventHubsFailureReason.newBuilder() to construct. + private AzureEventHubsFailureReason(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + + private AzureEventHubsFailureReason() { + namespace_ = ""; + eventHub_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionFailureEvent_AzureEventHubsFailureReason_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionFailureEvent_AzureEventHubsFailureReason_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason.class, + com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason.Builder.class); + } + + private int reasonCase_ = 0; + + @SuppressWarnings("serial") + private java.lang.Object reason_; + + public enum ReasonCase + implements + com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + API_VIOLATION_REASON(5), + SCHEMA_VIOLATION_REASON(6), + MESSAGE_TRANSFORMATION_FAILURE_REASON(7), + REASON_NOT_SET(0); + private final int value; + + private ReasonCase(int value) { + this.value = value; + } + + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static ReasonCase valueOf(int value) { + return forNumber(value); + } + + public static ReasonCase forNumber(int value) { + switch (value) { + case 5: + return API_VIOLATION_REASON; + case 6: + return SCHEMA_VIOLATION_REASON; + case 7: + return MESSAGE_TRANSFORMATION_FAILURE_REASON; + case 0: + return REASON_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public ReasonCase getReasonCase() { + return ReasonCase.forNumber(reasonCase_); + } + + public static final int NAMESPACE_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object namespace_ = ""; + + /** + * + * + *
    +     * Optional. The namespace containing the event hub being ingested from.
    +     * 
    + * + * string namespace = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The namespace. + */ + @java.lang.Override + public java.lang.String getNamespace() { + java.lang.Object ref = namespace_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + namespace_ = s; + return s; + } + } + + /** + * + * + *
    +     * Optional. The namespace containing the event hub being ingested from.
    +     * 
    + * + * string namespace = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for namespace. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNamespaceBytes() { + java.lang.Object ref = namespace_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + namespace_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int EVENT_HUB_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private volatile java.lang.Object eventHub_ = ""; + + /** + * + * + *
    +     * Optional. The name of the event hub being ingested from.
    +     * 
    + * + * string event_hub = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The eventHub. + */ + @java.lang.Override + public java.lang.String getEventHub() { + java.lang.Object ref = eventHub_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + eventHub_ = s; + return s; + } + } + + /** + * + * + *
    +     * Optional. The name of the event hub being ingested from.
    +     * 
    + * + * string event_hub = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for eventHub. + */ + @java.lang.Override + public com.google.protobuf.ByteString getEventHubBytes() { + java.lang.Object ref = eventHub_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + eventHub_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PARTITION_ID_FIELD_NUMBER = 3; + private long partitionId_ = 0L; + + /** + * + * + *
    +     * Optional. The partition ID of the message that failed to be ingested.
    +     * 
    + * + * int64 partition_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The partitionId. + */ + @java.lang.Override + public long getPartitionId() { + return partitionId_; + } + + public static final int OFFSET_FIELD_NUMBER = 4; + private long offset_ = 0L; + + /** + * + * + *
    +     * Optional. The offset within the partition of the message that failed to
    +     * be ingested.
    +     * 
    + * + * int64 offset = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The offset. + */ + @java.lang.Override + public long getOffset() { + return offset_; + } + + public static final int API_VIOLATION_REASON_FIELD_NUMBER = 5; + + /** + * + * + *
    +     * Optional. The Pub/Sub API limits prevented the desired message from
    +     * being published.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the apiViolationReason field is set. + */ + @java.lang.Override + public boolean hasApiViolationReason() { + return reasonCase_ == 5; + } + + /** + * + * + *
    +     * Optional. The Pub/Sub API limits prevented the desired message from
    +     * being published.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The apiViolationReason. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason getApiViolationReason() { + if (reasonCase_ == 5) { + return (com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason) reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.getDefaultInstance(); + } + + /** + * + * + *
    +     * Optional. The Pub/Sub API limits prevented the desired message from
    +     * being published.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReasonOrBuilder + getApiViolationReasonOrBuilder() { + if (reasonCase_ == 5) { + return (com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason) reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.getDefaultInstance(); + } + + public static final int SCHEMA_VIOLATION_REASON_FIELD_NUMBER = 6; + + /** + * + * + *
    +     * Optional. The Pub/Sub message failed schema validation.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the schemaViolationReason field is set. + */ + @java.lang.Override + public boolean hasSchemaViolationReason() { + return reasonCase_ == 6; + } + + /** + * + * + *
    +     * Optional. The Pub/Sub message failed schema validation.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The schemaViolationReason. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason + getSchemaViolationReason() { + if (reasonCase_ == 6) { + return (com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason) reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.getDefaultInstance(); + } + + /** + * + * + *
    +     * Optional. The Pub/Sub message failed schema validation.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReasonOrBuilder + getSchemaViolationReasonOrBuilder() { + if (reasonCase_ == 6) { + return (com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason) reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.getDefaultInstance(); + } + + public static final int MESSAGE_TRANSFORMATION_FAILURE_REASON_FIELD_NUMBER = 7; + + /** + * + * + *
    +     * Optional. Failure encountered when applying a message transformation to
    +     * the Pub/Sub message.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the messageTransformationFailureReason field is set. + */ + @java.lang.Override + public boolean hasMessageTransformationFailureReason() { + return reasonCase_ == 7; + } + + /** + * + * + *
    +     * Optional. Failure encountered when applying a message transformation to
    +     * the Pub/Sub message.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The messageTransformationFailureReason. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + getMessageTransformationFailureReason() { + if (reasonCase_ == 7) { + return (com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason) + reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + .getDefaultInstance(); + } + + /** + * + * + *
    +     * Optional. Failure encountered when applying a message transformation to
    +     * the Pub/Sub message.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReasonOrBuilder + getMessageTransformationFailureReasonOrBuilder() { + if (reasonCase_ == 7) { + return (com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason) + reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + .getDefaultInstance(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(namespace_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, namespace_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(eventHub_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, eventHub_); + } + if (partitionId_ != 0L) { + output.writeInt64(3, partitionId_); + } + if (offset_ != 0L) { + output.writeInt64(4, offset_); + } + if (reasonCase_ == 5) { + output.writeMessage( + 5, (com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason) reason_); + } + if (reasonCase_ == 6) { + output.writeMessage( + 6, (com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason) reason_); + } + if (reasonCase_ == 7) { + output.writeMessage( + 7, + (com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason) + reason_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(namespace_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, namespace_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(eventHub_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, eventHub_); + } + if (partitionId_ != 0L) { + size += com.google.protobuf.CodedOutputStream.computeInt64Size(3, partitionId_); + } + if (offset_ != 0L) { + size += com.google.protobuf.CodedOutputStream.computeInt64Size(4, offset_); + } + if (reasonCase_ == 5) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 5, (com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason) reason_); + } + if (reasonCase_ == 6) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 6, (com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason) reason_); + } + if (reasonCase_ == 7) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 7, + (com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason) + reason_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj + instanceof com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason)) { + return super.equals(obj); + } + com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason other = + (com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason) obj; + + if (!getNamespace().equals(other.getNamespace())) return false; + if (!getEventHub().equals(other.getEventHub())) return false; + if (getPartitionId() != other.getPartitionId()) return false; + if (getOffset() != other.getOffset()) return false; + if (!getReasonCase().equals(other.getReasonCase())) return false; + switch (reasonCase_) { + case 5: + if (!getApiViolationReason().equals(other.getApiViolationReason())) return false; + break; + case 6: + if (!getSchemaViolationReason().equals(other.getSchemaViolationReason())) return false; + break; + case 7: + if (!getMessageTransformationFailureReason() + .equals(other.getMessageTransformationFailureReason())) return false; + break; + case 0: + default: + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAMESPACE_FIELD_NUMBER; + hash = (53 * hash) + getNamespace().hashCode(); + hash = (37 * hash) + EVENT_HUB_FIELD_NUMBER; + hash = (53 * hash) + getEventHub().hashCode(); + hash = (37 * hash) + PARTITION_ID_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getPartitionId()); + hash = (37 * hash) + OFFSET_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getOffset()); + switch (reasonCase_) { + case 5: + hash = (37 * hash) + API_VIOLATION_REASON_FIELD_NUMBER; + hash = (53 * hash) + getApiViolationReason().hashCode(); + break; + case 6: + hash = (37 * hash) + SCHEMA_VIOLATION_REASON_FIELD_NUMBER; + hash = (53 * hash) + getSchemaViolationReason().hashCode(); + break; + case 7: + hash = (37 * hash) + MESSAGE_TRANSFORMATION_FAILURE_REASON_FIELD_NUMBER; + hash = (53 * hash) + getMessageTransformationFailureReason().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason parseFrom( + byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason + parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason + parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + + /** + * + * + *
    +     * Failure when ingesting from an Azure Event Hubs source.
    +     * 
    + * + * Protobuf type {@code google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder + implements + // @@protoc_insertion_point(builder_implements:google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason) + com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReasonOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionFailureEvent_AzureEventHubsFailureReason_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionFailureEvent_AzureEventHubsFailureReason_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason.class, + com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason.Builder + .class); + } + + // Construct using + // com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + namespace_ = ""; + eventHub_ = ""; + partitionId_ = 0L; + offset_ = 0L; + if (apiViolationReasonBuilder_ != null) { + apiViolationReasonBuilder_.clear(); + } + if (schemaViolationReasonBuilder_ != null) { + schemaViolationReasonBuilder_.clear(); + } + if (messageTransformationFailureReasonBuilder_ != null) { + messageTransformationFailureReasonBuilder_.clear(); + } + reasonCase_ = 0; + reason_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionFailureEvent_AzureEventHubsFailureReason_descriptor; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason + getDefaultInstanceForType() { + return com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason + .getDefaultInstance(); + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason build() { + com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason result = + buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason buildPartial() { + com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason result = + new com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + buildPartialOneofs(result); + onBuilt(); + return result; + } + + private void buildPartial0( + com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.namespace_ = namespace_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.eventHub_ = eventHub_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.partitionId_ = partitionId_; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.offset_ = offset_; + } + } + + private void buildPartialOneofs( + com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason result) { + result.reasonCase_ = reasonCase_; + result.reason_ = this.reason_; + if (reasonCase_ == 5 && apiViolationReasonBuilder_ != null) { + result.reason_ = apiViolationReasonBuilder_.build(); + } + if (reasonCase_ == 6 && schemaViolationReasonBuilder_ != null) { + result.reason_ = schemaViolationReasonBuilder_.build(); + } + if (reasonCase_ == 7 && messageTransformationFailureReasonBuilder_ != null) { + result.reason_ = messageTransformationFailureReasonBuilder_.build(); + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other + instanceof com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason) { + return mergeFrom( + (com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason other) { + if (other + == com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason + .getDefaultInstance()) return this; + if (!other.getNamespace().isEmpty()) { + namespace_ = other.namespace_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getEventHub().isEmpty()) { + eventHub_ = other.eventHub_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (other.getPartitionId() != 0L) { + setPartitionId(other.getPartitionId()); + } + if (other.getOffset() != 0L) { + setOffset(other.getOffset()); + } + switch (other.getReasonCase()) { + case API_VIOLATION_REASON: + { + mergeApiViolationReason(other.getApiViolationReason()); + break; + } + case SCHEMA_VIOLATION_REASON: + { + mergeSchemaViolationReason(other.getSchemaViolationReason()); + break; + } + case MESSAGE_TRANSFORMATION_FAILURE_REASON: + { + mergeMessageTransformationFailureReason( + other.getMessageTransformationFailureReason()); + break; + } + case REASON_NOT_SET: + { + break; + } + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + namespace_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + eventHub_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 24: + { + partitionId_ = input.readInt64(); + bitField0_ |= 0x00000004; + break; + } // case 24 + case 32: + { + offset_ = input.readInt64(); + bitField0_ |= 0x00000008; + break; + } // case 32 + case 42: + { + input.readMessage( + internalGetApiViolationReasonFieldBuilder().getBuilder(), extensionRegistry); + reasonCase_ = 5; + break; + } // case 42 + case 50: + { + input.readMessage( + internalGetSchemaViolationReasonFieldBuilder().getBuilder(), + extensionRegistry); + reasonCase_ = 6; + break; + } // case 50 + case 58: + { + input.readMessage( + internalGetMessageTransformationFailureReasonFieldBuilder().getBuilder(), + extensionRegistry); + reasonCase_ = 7; + break; + } // case 58 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int reasonCase_ = 0; + private java.lang.Object reason_; + + public ReasonCase getReasonCase() { + return ReasonCase.forNumber(reasonCase_); + } + + public Builder clearReason() { + reasonCase_ = 0; + reason_ = null; + onChanged(); + return this; + } + + private int bitField0_; + + private java.lang.Object namespace_ = ""; + + /** + * + * + *
    +       * Optional. The namespace containing the event hub being ingested from.
    +       * 
    + * + * string namespace = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The namespace. + */ + public java.lang.String getNamespace() { + java.lang.Object ref = namespace_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + namespace_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +       * Optional. The namespace containing the event hub being ingested from.
    +       * 
    + * + * string namespace = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for namespace. + */ + public com.google.protobuf.ByteString getNamespaceBytes() { + java.lang.Object ref = namespace_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + namespace_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +       * Optional. The namespace containing the event hub being ingested from.
    +       * 
    + * + * string namespace = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The namespace to set. + * @return This builder for chaining. + */ + public Builder setNamespace(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + namespace_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. The namespace containing the event hub being ingested from.
    +       * 
    + * + * string namespace = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearNamespace() { + namespace_ = getDefaultInstance().getNamespace(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. The namespace containing the event hub being ingested from.
    +       * 
    + * + * string namespace = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for namespace to set. + * @return This builder for chaining. + */ + public Builder setNamespaceBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + namespace_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object eventHub_ = ""; + + /** + * + * + *
    +       * Optional. The name of the event hub being ingested from.
    +       * 
    + * + * string event_hub = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The eventHub. + */ + public java.lang.String getEventHub() { + java.lang.Object ref = eventHub_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + eventHub_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +       * Optional. The name of the event hub being ingested from.
    +       * 
    + * + * string event_hub = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for eventHub. + */ + public com.google.protobuf.ByteString getEventHubBytes() { + java.lang.Object ref = eventHub_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + eventHub_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +       * Optional. The name of the event hub being ingested from.
    +       * 
    + * + * string event_hub = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The eventHub to set. + * @return This builder for chaining. + */ + public Builder setEventHub(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + eventHub_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. The name of the event hub being ingested from.
    +       * 
    + * + * string event_hub = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearEventHub() { + eventHub_ = getDefaultInstance().getEventHub(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. The name of the event hub being ingested from.
    +       * 
    + * + * string event_hub = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for eventHub to set. + * @return This builder for chaining. + */ + public Builder setEventHubBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + eventHub_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private long partitionId_; + + /** + * + * + *
    +       * Optional. The partition ID of the message that failed to be ingested.
    +       * 
    + * + * int64 partition_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The partitionId. + */ + @java.lang.Override + public long getPartitionId() { + return partitionId_; + } + + /** + * + * + *
    +       * Optional. The partition ID of the message that failed to be ingested.
    +       * 
    + * + * int64 partition_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The partitionId to set. + * @return This builder for chaining. + */ + public Builder setPartitionId(long value) { + + partitionId_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. The partition ID of the message that failed to be ingested.
    +       * 
    + * + * int64 partition_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearPartitionId() { + bitField0_ = (bitField0_ & ~0x00000004); + partitionId_ = 0L; + onChanged(); + return this; + } + + private long offset_; + + /** + * + * + *
    +       * Optional. The offset within the partition of the message that failed to
    +       * be ingested.
    +       * 
    + * + * int64 offset = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The offset. + */ + @java.lang.Override + public long getOffset() { + return offset_; + } + + /** + * + * + *
    +       * Optional. The offset within the partition of the message that failed to
    +       * be ingested.
    +       * 
    + * + * int64 offset = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The offset to set. + * @return This builder for chaining. + */ + public Builder setOffset(long value) { + + offset_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. The offset within the partition of the message that failed to
    +       * be ingested.
    +       * 
    + * + * int64 offset = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearOffset() { + bitField0_ = (bitField0_ & ~0x00000008); + offset_ = 0L; + onChanged(); + return this; + } + + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason, + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.Builder, + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReasonOrBuilder> + apiViolationReasonBuilder_; + + /** + * + * + *
    +       * Optional. The Pub/Sub API limits prevented the desired message from
    +       * being published.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the apiViolationReason field is set. + */ + @java.lang.Override + public boolean hasApiViolationReason() { + return reasonCase_ == 5; + } + + /** + * + * + *
    +       * Optional. The Pub/Sub API limits prevented the desired message from
    +       * being published.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The apiViolationReason. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason getApiViolationReason() { + if (apiViolationReasonBuilder_ == null) { + if (reasonCase_ == 5) { + return (com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason) reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.getDefaultInstance(); + } else { + if (reasonCase_ == 5) { + return apiViolationReasonBuilder_.getMessage(); + } + return com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.getDefaultInstance(); + } + } + + /** + * + * + *
    +       * Optional. The Pub/Sub API limits prevented the desired message from
    +       * being published.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 5 [(.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_ = 5; + return this; + } + + /** + * + * + *
    +       * Optional. The Pub/Sub API limits prevented the desired message from
    +       * being published.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 5 [(.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_ = 5; + return this; + } + + /** + * + * + *
    +       * Optional. The Pub/Sub API limits prevented the desired message from
    +       * being published.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeApiViolationReason( + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason value) { + if (apiViolationReasonBuilder_ == null) { + if (reasonCase_ == 5 + && 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_ == 5) { + apiViolationReasonBuilder_.mergeFrom(value); + } else { + apiViolationReasonBuilder_.setMessage(value); + } + } + reasonCase_ = 5; + return this; + } + + /** + * + * + *
    +       * Optional. The Pub/Sub API limits prevented the desired message from
    +       * being published.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearApiViolationReason() { + if (apiViolationReasonBuilder_ == null) { + if (reasonCase_ == 5) { + reasonCase_ = 0; + reason_ = null; + onChanged(); + } + } else { + if (reasonCase_ == 5) { + reasonCase_ = 0; + reason_ = null; + } + apiViolationReasonBuilder_.clear(); + } + return this; + } + + /** + * + * + *
    +       * Optional. The Pub/Sub API limits prevented the desired message from
    +       * being published.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.Builder + getApiViolationReasonBuilder() { + return internalGetApiViolationReasonFieldBuilder().getBuilder(); + } + + /** + * + * + *
    +       * Optional. The Pub/Sub API limits prevented the desired message from
    +       * being published.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReasonOrBuilder + getApiViolationReasonOrBuilder() { + if ((reasonCase_ == 5) && (apiViolationReasonBuilder_ != null)) { + return apiViolationReasonBuilder_.getMessageOrBuilder(); + } else { + if (reasonCase_ == 5) { + return (com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason) reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.getDefaultInstance(); + } + } + + /** + * + * + *
    +       * Optional. The Pub/Sub API limits prevented the desired message from
    +       * being published.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason, + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.Builder, + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReasonOrBuilder> + internalGetApiViolationReasonFieldBuilder() { + if (apiViolationReasonBuilder_ == null) { + if (!(reasonCase_ == 5)) { + reason_ = + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.getDefaultInstance(); + } + apiViolationReasonBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + 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_ = 5; + onChanged(); + return apiViolationReasonBuilder_; + } + + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason, + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.Builder, + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReasonOrBuilder> + schemaViolationReasonBuilder_; + + /** + * + * + *
    +       * Optional. The Pub/Sub message failed schema validation.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the schemaViolationReason field is set. + */ + @java.lang.Override + public boolean hasSchemaViolationReason() { + return reasonCase_ == 6; + } + + /** + * + * + *
    +       * Optional. The Pub/Sub message failed schema validation.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The schemaViolationReason. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason + getSchemaViolationReason() { + if (schemaViolationReasonBuilder_ == null) { + if (reasonCase_ == 6) { + return (com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason) reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason + .getDefaultInstance(); + } else { + if (reasonCase_ == 6) { + return schemaViolationReasonBuilder_.getMessage(); + } + return com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason + .getDefaultInstance(); + } + } + + /** + * + * + *
    +       * Optional. The Pub/Sub message failed schema validation.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setSchemaViolationReason( + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason value) { + if (schemaViolationReasonBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + reason_ = value; + onChanged(); + } else { + schemaViolationReasonBuilder_.setMessage(value); + } + reasonCase_ = 6; + return this; + } + + /** + * + * + *
    +       * Optional. The Pub/Sub message failed schema validation.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setSchemaViolationReason( + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.Builder + builderForValue) { + if (schemaViolationReasonBuilder_ == null) { + reason_ = builderForValue.build(); + onChanged(); + } else { + schemaViolationReasonBuilder_.setMessage(builderForValue.build()); + } + reasonCase_ = 6; + return this; + } + + /** + * + * + *
    +       * Optional. The Pub/Sub message failed schema validation.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeSchemaViolationReason( + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason value) { + if (schemaViolationReasonBuilder_ == null) { + if (reasonCase_ == 6 + && reason_ + != com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason + .getDefaultInstance()) { + reason_ = + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.newBuilder( + (com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason) reason_) + .mergeFrom(value) + .buildPartial(); + } else { + reason_ = value; + } + onChanged(); + } else { + if (reasonCase_ == 6) { + schemaViolationReasonBuilder_.mergeFrom(value); + } else { + schemaViolationReasonBuilder_.setMessage(value); + } + } + reasonCase_ = 6; + return this; + } + + /** + * + * + *
    +       * Optional. The Pub/Sub message failed schema validation.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearSchemaViolationReason() { + if (schemaViolationReasonBuilder_ == null) { + if (reasonCase_ == 6) { + reasonCase_ = 0; + reason_ = null; + onChanged(); + } + } else { + if (reasonCase_ == 6) { + reasonCase_ = 0; + reason_ = null; + } + schemaViolationReasonBuilder_.clear(); + } + return this; + } + + /** + * + * + *
    +       * Optional. The Pub/Sub message failed schema validation.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.Builder + getSchemaViolationReasonBuilder() { + return internalGetSchemaViolationReasonFieldBuilder().getBuilder(); + } + + /** + * + * + *
    +       * Optional. The Pub/Sub message failed schema validation.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReasonOrBuilder + getSchemaViolationReasonOrBuilder() { + if ((reasonCase_ == 6) && (schemaViolationReasonBuilder_ != null)) { + return schemaViolationReasonBuilder_.getMessageOrBuilder(); + } else { + if (reasonCase_ == 6) { + return (com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason) reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason + .getDefaultInstance(); + } + } + + /** + * + * + *
    +       * Optional. The Pub/Sub message failed schema validation.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason, + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.Builder, + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReasonOrBuilder> + internalGetSchemaViolationReasonFieldBuilder() { + if (schemaViolationReasonBuilder_ == null) { + if (!(reasonCase_ == 6)) { + reason_ = + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason + .getDefaultInstance(); + } + schemaViolationReasonBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason, + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.Builder, + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReasonOrBuilder>( + (com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason) reason_, + getParentForChildren(), + isClean()); + reason_ = null; + } + reasonCase_ = 6; + onChanged(); + return schemaViolationReasonBuilder_; + } + + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason, + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason.Builder, + com.google.pubsub.v1.IngestionFailureEvent + .MessageTransformationFailureReasonOrBuilder> + messageTransformationFailureReasonBuilder_; + + /** + * + * + *
    +       * Optional. Failure encountered when applying a message transformation to
    +       * the Pub/Sub message.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the messageTransformationFailureReason field is set. + */ + @java.lang.Override + public boolean hasMessageTransformationFailureReason() { + return reasonCase_ == 7; + } + + /** + * + * + *
    +       * Optional. Failure encountered when applying a message transformation to
    +       * the Pub/Sub message.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The messageTransformationFailureReason. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + getMessageTransformationFailureReason() { + if (messageTransformationFailureReasonBuilder_ == null) { + if (reasonCase_ == 7) { + return (com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason) + reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + .getDefaultInstance(); + } else { + if (reasonCase_ == 7) { + return messageTransformationFailureReasonBuilder_.getMessage(); + } + return com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + .getDefaultInstance(); + } + } + + /** + * + * + *
    +       * Optional. Failure encountered when applying a message transformation to
    +       * the Pub/Sub message.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setMessageTransformationFailureReason( + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason value) { + if (messageTransformationFailureReasonBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + reason_ = value; + onChanged(); + } else { + messageTransformationFailureReasonBuilder_.setMessage(value); + } + reasonCase_ = 7; + return this; + } + + /** + * + * + *
    +       * Optional. Failure encountered when applying a message transformation to
    +       * the Pub/Sub message.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setMessageTransformationFailureReason( + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason.Builder + builderForValue) { + if (messageTransformationFailureReasonBuilder_ == null) { + reason_ = builderForValue.build(); + onChanged(); + } else { + messageTransformationFailureReasonBuilder_.setMessage(builderForValue.build()); + } + reasonCase_ = 7; + return this; + } + + /** + * + * + *
    +       * Optional. Failure encountered when applying a message transformation to
    +       * the Pub/Sub message.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeMessageTransformationFailureReason( + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason value) { + if (messageTransformationFailureReasonBuilder_ == null) { + if (reasonCase_ == 7 + && reason_ + != com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + .getDefaultInstance()) { + reason_ = + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + .newBuilder( + (com.google.pubsub.v1.IngestionFailureEvent + .MessageTransformationFailureReason) + reason_) + .mergeFrom(value) + .buildPartial(); + } else { + reason_ = value; + } + onChanged(); + } else { + if (reasonCase_ == 7) { + messageTransformationFailureReasonBuilder_.mergeFrom(value); + } else { + messageTransformationFailureReasonBuilder_.setMessage(value); + } + } + reasonCase_ = 7; + return this; + } + + /** + * + * + *
    +       * Optional. Failure encountered when applying a message transformation to
    +       * the Pub/Sub message.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearMessageTransformationFailureReason() { + if (messageTransformationFailureReasonBuilder_ == null) { + if (reasonCase_ == 7) { + reasonCase_ = 0; + reason_ = null; + onChanged(); + } + } else { + if (reasonCase_ == 7) { + reasonCase_ = 0; + reason_ = null; + } + messageTransformationFailureReasonBuilder_.clear(); + } + return this; + } + + /** + * + * + *
    +       * Optional. Failure encountered when applying a message transformation to
    +       * the Pub/Sub message.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason.Builder + getMessageTransformationFailureReasonBuilder() { + return internalGetMessageTransformationFailureReasonFieldBuilder().getBuilder(); + } + + /** + * + * + *
    +       * Optional. Failure encountered when applying a message transformation to
    +       * the Pub/Sub message.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReasonOrBuilder + getMessageTransformationFailureReasonOrBuilder() { + if ((reasonCase_ == 7) && (messageTransformationFailureReasonBuilder_ != null)) { + return messageTransformationFailureReasonBuilder_.getMessageOrBuilder(); + } else { + if (reasonCase_ == 7) { + return (com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason) + reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + .getDefaultInstance(); + } + } + + /** + * + * + *
    +       * Optional. Failure encountered when applying a message transformation to
    +       * the Pub/Sub message.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason, + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason.Builder, + com.google.pubsub.v1.IngestionFailureEvent + .MessageTransformationFailureReasonOrBuilder> + internalGetMessageTransformationFailureReasonFieldBuilder() { + if (messageTransformationFailureReasonBuilder_ == null) { + if (!(reasonCase_ == 7)) { + reason_ = + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + .getDefaultInstance(); + } + messageTransformationFailureReasonBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason, + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + .Builder, + com.google.pubsub.v1.IngestionFailureEvent + .MessageTransformationFailureReasonOrBuilder>( + (com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason) + reason_, + getParentForChildren(), + isClean()); + reason_ = null; + } + reasonCase_ = 7; + onChanged(); + return messageTransformationFailureReasonBuilder_; + } + + // @@protoc_insertion_point(builder_scope:google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason) + } + + // @@protoc_insertion_point(class_scope:google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason) + private static final com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = + new com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason(); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AzureEventHubsFailureReason parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException() + .setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public interface ConfluentCloudFailureReasonOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
    +     * Optional. The cluster ID containing the topic being ingested from.
    +     * 
    + * + * string cluster_id = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The clusterId. + */ + java.lang.String getClusterId(); + + /** + * + * + *
    +     * Optional. The cluster ID containing the topic being ingested from.
    +     * 
    + * + * string cluster_id = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for clusterId. + */ + com.google.protobuf.ByteString getClusterIdBytes(); + + /** + * + * + *
    +     * Optional. The name of the Kafka topic being ingested from.
    +     * 
    + * + * string kafka_topic = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The kafkaTopic. + */ + java.lang.String getKafkaTopic(); + + /** + * + * + *
    +     * Optional. The name of the Kafka topic being ingested from.
    +     * 
    + * + * string kafka_topic = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for kafkaTopic. + */ + com.google.protobuf.ByteString getKafkaTopicBytes(); + + /** + * + * + *
    +     * Optional. The partition ID of the message that failed to be ingested.
    +     * 
    + * + * int64 partition_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The partitionId. + */ + long getPartitionId(); + + /** + * + * + *
    +     * Optional. The offset within the partition of the message that failed to
    +     * be ingested.
    +     * 
    + * + * int64 offset = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The offset. + */ + long getOffset(); + + /** + * + * + *
    +     * Optional. The Pub/Sub API limits prevented the desired message from
    +     * being published.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the apiViolationReason field is set. + */ + boolean hasApiViolationReason(); + + /** + * + * + *
    +     * Optional. The Pub/Sub API limits prevented the desired message from
    +     * being published.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The apiViolationReason. + */ + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason getApiViolationReason(); + + /** + * + * + *
    +     * Optional. The Pub/Sub API limits prevented the desired message from
    +     * being published.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReasonOrBuilder + getApiViolationReasonOrBuilder(); + + /** + * + * + *
    +     * Optional. The Pub/Sub message failed schema validation.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the schemaViolationReason field is set. + */ + boolean hasSchemaViolationReason(); + + /** + * + * + *
    +     * Optional. The Pub/Sub message failed schema validation.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The schemaViolationReason. + */ + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason getSchemaViolationReason(); + + /** + * + * + *
    +     * Optional. The Pub/Sub message failed schema validation.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReasonOrBuilder + getSchemaViolationReasonOrBuilder(); + + /** + * + * + *
    +     * Optional. Failure encountered when applying a message transformation to
    +     * the Pub/Sub message.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the messageTransformationFailureReason field is set. + */ + boolean hasMessageTransformationFailureReason(); + + /** + * + * + *
    +     * Optional. Failure encountered when applying a message transformation to
    +     * the Pub/Sub message.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The messageTransformationFailureReason. + */ + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + getMessageTransformationFailureReason(); + + /** + * + * + *
    +     * Optional. Failure encountered when applying a message transformation to
    +     * the Pub/Sub message.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReasonOrBuilder + getMessageTransformationFailureReasonOrBuilder(); + + com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason.ReasonCase + getReasonCase(); + } + + /** + * + * + *
    +   * Failure when ingesting from a Confluent Cloud source.
    +   * 
    + * + * Protobuf type {@code google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason} + */ + public static final class ConfluentCloudFailureReason extends com.google.protobuf.GeneratedMessage + implements + // @@protoc_insertion_point(message_implements:google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason) + ConfluentCloudFailureReasonOrBuilder { + private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "ConfluentCloudFailureReason"); + } + + // Use ConfluentCloudFailureReason.newBuilder() to construct. + private ConfluentCloudFailureReason(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + + private ConfluentCloudFailureReason() { + clusterId_ = ""; + kafkaTopic_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionFailureEvent_ConfluentCloudFailureReason_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionFailureEvent_ConfluentCloudFailureReason_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason.class, + com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason.Builder.class); + } + + private int reasonCase_ = 0; + + @SuppressWarnings("serial") + private java.lang.Object reason_; + + public enum ReasonCase + implements + com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + API_VIOLATION_REASON(5), + SCHEMA_VIOLATION_REASON(6), + MESSAGE_TRANSFORMATION_FAILURE_REASON(7), + REASON_NOT_SET(0); + private final int value; + + private ReasonCase(int value) { + this.value = value; + } + + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static ReasonCase valueOf(int value) { + return forNumber(value); + } + + public static ReasonCase forNumber(int value) { + switch (value) { + case 5: + return API_VIOLATION_REASON; + case 6: + return SCHEMA_VIOLATION_REASON; + case 7: + return MESSAGE_TRANSFORMATION_FAILURE_REASON; + case 0: + return REASON_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public ReasonCase getReasonCase() { + return ReasonCase.forNumber(reasonCase_); + } + + public static final int CLUSTER_ID_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object clusterId_ = ""; + + /** + * + * + *
    +     * Optional. The cluster ID containing the topic being ingested from.
    +     * 
    + * + * string cluster_id = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The clusterId. + */ + @java.lang.Override + public java.lang.String getClusterId() { + java.lang.Object ref = clusterId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + clusterId_ = s; + return s; + } + } + + /** + * + * + *
    +     * Optional. The cluster ID containing the topic being ingested from.
    +     * 
    + * + * string cluster_id = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for clusterId. + */ + @java.lang.Override + public com.google.protobuf.ByteString getClusterIdBytes() { + java.lang.Object ref = clusterId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + clusterId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int KAFKA_TOPIC_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private volatile java.lang.Object kafkaTopic_ = ""; + + /** + * + * + *
    +     * Optional. The name of the Kafka topic being ingested from.
    +     * 
    + * + * string kafka_topic = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The kafkaTopic. + */ + @java.lang.Override + public java.lang.String getKafkaTopic() { + java.lang.Object ref = kafkaTopic_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + kafkaTopic_ = s; + return s; + } + } + + /** + * + * + *
    +     * Optional. The name of the Kafka topic being ingested from.
    +     * 
    + * + * string kafka_topic = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for kafkaTopic. + */ + @java.lang.Override + public com.google.protobuf.ByteString getKafkaTopicBytes() { + java.lang.Object ref = kafkaTopic_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + kafkaTopic_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PARTITION_ID_FIELD_NUMBER = 3; + private long partitionId_ = 0L; + + /** + * + * + *
    +     * Optional. The partition ID of the message that failed to be ingested.
    +     * 
    + * + * int64 partition_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The partitionId. + */ + @java.lang.Override + public long getPartitionId() { + return partitionId_; + } + + public static final int OFFSET_FIELD_NUMBER = 4; + private long offset_ = 0L; + + /** + * + * + *
    +     * Optional. The offset within the partition of the message that failed to
    +     * be ingested.
    +     * 
    + * + * int64 offset = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The offset. + */ + @java.lang.Override + public long getOffset() { + return offset_; + } + + public static final int API_VIOLATION_REASON_FIELD_NUMBER = 5; + + /** + * + * + *
    +     * Optional. The Pub/Sub API limits prevented the desired message from
    +     * being published.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the apiViolationReason field is set. + */ + @java.lang.Override + public boolean hasApiViolationReason() { + return reasonCase_ == 5; + } + + /** + * + * + *
    +     * Optional. The Pub/Sub API limits prevented the desired message from
    +     * being published.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The apiViolationReason. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason getApiViolationReason() { + if (reasonCase_ == 5) { + return (com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason) reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.getDefaultInstance(); + } + + /** + * + * + *
    +     * Optional. The Pub/Sub API limits prevented the desired message from
    +     * being published.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReasonOrBuilder + getApiViolationReasonOrBuilder() { + if (reasonCase_ == 5) { + return (com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason) reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.getDefaultInstance(); + } + + public static final int SCHEMA_VIOLATION_REASON_FIELD_NUMBER = 6; + + /** + * + * + *
    +     * Optional. The Pub/Sub message failed schema validation.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the schemaViolationReason field is set. + */ + @java.lang.Override + public boolean hasSchemaViolationReason() { + return reasonCase_ == 6; + } + + /** + * + * + *
    +     * Optional. The Pub/Sub message failed schema validation.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The schemaViolationReason. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason + getSchemaViolationReason() { + if (reasonCase_ == 6) { + return (com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason) reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.getDefaultInstance(); + } + + /** + * + * + *
    +     * Optional. The Pub/Sub message failed schema validation.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReasonOrBuilder + getSchemaViolationReasonOrBuilder() { + if (reasonCase_ == 6) { + return (com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason) reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.getDefaultInstance(); + } + + public static final int MESSAGE_TRANSFORMATION_FAILURE_REASON_FIELD_NUMBER = 7; + + /** + * + * + *
    +     * Optional. Failure encountered when applying a message transformation to
    +     * the Pub/Sub message.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the messageTransformationFailureReason field is set. + */ + @java.lang.Override + public boolean hasMessageTransformationFailureReason() { + return reasonCase_ == 7; + } + + /** + * + * + *
    +     * Optional. Failure encountered when applying a message transformation to
    +     * the Pub/Sub message.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The messageTransformationFailureReason. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + getMessageTransformationFailureReason() { + if (reasonCase_ == 7) { + return (com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason) + reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + .getDefaultInstance(); + } + + /** + * + * + *
    +     * Optional. Failure encountered when applying a message transformation to
    +     * the Pub/Sub message.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReasonOrBuilder + getMessageTransformationFailureReasonOrBuilder() { + if (reasonCase_ == 7) { + return (com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason) + reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + .getDefaultInstance(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(clusterId_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, clusterId_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(kafkaTopic_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, kafkaTopic_); + } + if (partitionId_ != 0L) { + output.writeInt64(3, partitionId_); + } + if (offset_ != 0L) { + output.writeInt64(4, offset_); + } + if (reasonCase_ == 5) { + output.writeMessage( + 5, (com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason) reason_); + } + if (reasonCase_ == 6) { + output.writeMessage( + 6, (com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason) reason_); + } + if (reasonCase_ == 7) { + output.writeMessage( + 7, + (com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason) + reason_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(clusterId_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, clusterId_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(kafkaTopic_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, kafkaTopic_); + } + if (partitionId_ != 0L) { + size += com.google.protobuf.CodedOutputStream.computeInt64Size(3, partitionId_); + } + if (offset_ != 0L) { + size += com.google.protobuf.CodedOutputStream.computeInt64Size(4, offset_); + } + if (reasonCase_ == 5) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 5, (com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason) reason_); + } + if (reasonCase_ == 6) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 6, (com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason) reason_); + } + if (reasonCase_ == 7) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 7, + (com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason) + reason_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj + instanceof com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason)) { + return super.equals(obj); + } + com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason other = + (com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason) obj; + + if (!getClusterId().equals(other.getClusterId())) return false; + if (!getKafkaTopic().equals(other.getKafkaTopic())) return false; + if (getPartitionId() != other.getPartitionId()) return false; + if (getOffset() != other.getOffset()) return false; + if (!getReasonCase().equals(other.getReasonCase())) return false; + switch (reasonCase_) { + case 5: + if (!getApiViolationReason().equals(other.getApiViolationReason())) return false; + break; + case 6: + if (!getSchemaViolationReason().equals(other.getSchemaViolationReason())) return false; + break; + case 7: + if (!getMessageTransformationFailureReason() + .equals(other.getMessageTransformationFailureReason())) return false; + break; + case 0: + default: + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + CLUSTER_ID_FIELD_NUMBER; + hash = (53 * hash) + getClusterId().hashCode(); + hash = (37 * hash) + KAFKA_TOPIC_FIELD_NUMBER; + hash = (53 * hash) + getKafkaTopic().hashCode(); + hash = (37 * hash) + PARTITION_ID_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getPartitionId()); + hash = (37 * hash) + OFFSET_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getOffset()); + switch (reasonCase_) { + case 5: + hash = (37 * hash) + API_VIOLATION_REASON_FIELD_NUMBER; + hash = (53 * hash) + getApiViolationReason().hashCode(); + break; + case 6: + hash = (37 * hash) + SCHEMA_VIOLATION_REASON_FIELD_NUMBER; + hash = (53 * hash) + getSchemaViolationReason().hashCode(); + break; + case 7: + hash = (37 * hash) + MESSAGE_TRANSFORMATION_FAILURE_REASON_FIELD_NUMBER; + hash = (53 * hash) + getMessageTransformationFailureReason().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason parseFrom( + byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason + parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason + parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + + /** + * + * + *
    +     * Failure when ingesting from a Confluent Cloud source.
    +     * 
    + * + * Protobuf type {@code google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder + implements + // @@protoc_insertion_point(builder_implements:google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason) + com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReasonOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionFailureEvent_ConfluentCloudFailureReason_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionFailureEvent_ConfluentCloudFailureReason_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason.class, + com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason.Builder + .class); + } + + // Construct using + // com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + clusterId_ = ""; + kafkaTopic_ = ""; + partitionId_ = 0L; + offset_ = 0L; + if (apiViolationReasonBuilder_ != null) { + apiViolationReasonBuilder_.clear(); + } + if (schemaViolationReasonBuilder_ != null) { + schemaViolationReasonBuilder_.clear(); + } + if (messageTransformationFailureReasonBuilder_ != null) { + messageTransformationFailureReasonBuilder_.clear(); + } + reasonCase_ = 0; + reason_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionFailureEvent_ConfluentCloudFailureReason_descriptor; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason + getDefaultInstanceForType() { + return com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason + .getDefaultInstance(); + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason build() { + com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason result = + buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason buildPartial() { + com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason result = + new com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + buildPartialOneofs(result); + onBuilt(); + return result; + } + + private void buildPartial0( + com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.clusterId_ = clusterId_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.kafkaTopic_ = kafkaTopic_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.partitionId_ = partitionId_; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.offset_ = offset_; + } + } + + private void buildPartialOneofs( + com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason result) { + result.reasonCase_ = reasonCase_; + result.reason_ = this.reason_; + if (reasonCase_ == 5 && apiViolationReasonBuilder_ != null) { + result.reason_ = apiViolationReasonBuilder_.build(); + } + if (reasonCase_ == 6 && schemaViolationReasonBuilder_ != null) { + result.reason_ = schemaViolationReasonBuilder_.build(); + } + if (reasonCase_ == 7 && messageTransformationFailureReasonBuilder_ != null) { + result.reason_ = messageTransformationFailureReasonBuilder_.build(); + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other + instanceof com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason) { + return mergeFrom( + (com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason other) { + if (other + == com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason + .getDefaultInstance()) return this; + if (!other.getClusterId().isEmpty()) { + clusterId_ = other.clusterId_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getKafkaTopic().isEmpty()) { + kafkaTopic_ = other.kafkaTopic_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (other.getPartitionId() != 0L) { + setPartitionId(other.getPartitionId()); + } + if (other.getOffset() != 0L) { + setOffset(other.getOffset()); + } + switch (other.getReasonCase()) { + case API_VIOLATION_REASON: + { + mergeApiViolationReason(other.getApiViolationReason()); + break; + } + case SCHEMA_VIOLATION_REASON: + { + mergeSchemaViolationReason(other.getSchemaViolationReason()); + break; + } + case MESSAGE_TRANSFORMATION_FAILURE_REASON: + { + mergeMessageTransformationFailureReason( + other.getMessageTransformationFailureReason()); + break; + } + case REASON_NOT_SET: + { + break; + } + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + clusterId_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + kafkaTopic_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 24: + { + partitionId_ = input.readInt64(); + bitField0_ |= 0x00000004; + break; + } // case 24 + case 32: + { + offset_ = input.readInt64(); + bitField0_ |= 0x00000008; + break; + } // case 32 + case 42: + { + input.readMessage( + internalGetApiViolationReasonFieldBuilder().getBuilder(), extensionRegistry); + reasonCase_ = 5; + break; + } // case 42 + case 50: + { + input.readMessage( + internalGetSchemaViolationReasonFieldBuilder().getBuilder(), + extensionRegistry); + reasonCase_ = 6; + break; + } // case 50 + case 58: + { + input.readMessage( + internalGetMessageTransformationFailureReasonFieldBuilder().getBuilder(), + extensionRegistry); + reasonCase_ = 7; + break; + } // case 58 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int reasonCase_ = 0; + private java.lang.Object reason_; + + public ReasonCase getReasonCase() { + return ReasonCase.forNumber(reasonCase_); + } + + public Builder clearReason() { + reasonCase_ = 0; + reason_ = null; + onChanged(); + return this; + } + + private int bitField0_; + + private java.lang.Object clusterId_ = ""; + + /** + * + * + *
    +       * Optional. The cluster ID containing the topic being ingested from.
    +       * 
    + * + * string cluster_id = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The clusterId. + */ + public java.lang.String getClusterId() { + java.lang.Object ref = clusterId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + clusterId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +       * Optional. The cluster ID containing the topic being ingested from.
    +       * 
    + * + * string cluster_id = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for clusterId. + */ + public com.google.protobuf.ByteString getClusterIdBytes() { + java.lang.Object ref = clusterId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + clusterId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +       * Optional. The cluster ID containing the topic being ingested from.
    +       * 
    + * + * string cluster_id = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The clusterId to set. + * @return This builder for chaining. + */ + public Builder setClusterId(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + clusterId_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. The cluster ID containing the topic being ingested from.
    +       * 
    + * + * string cluster_id = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearClusterId() { + clusterId_ = getDefaultInstance().getClusterId(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. The cluster ID containing the topic being ingested from.
    +       * 
    + * + * string cluster_id = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for clusterId to set. + * @return This builder for chaining. + */ + public Builder setClusterIdBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + clusterId_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object kafkaTopic_ = ""; + + /** + * + * + *
    +       * Optional. The name of the Kafka topic being ingested from.
    +       * 
    + * + * string kafka_topic = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The kafkaTopic. + */ + public java.lang.String getKafkaTopic() { + java.lang.Object ref = kafkaTopic_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + kafkaTopic_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +       * Optional. The name of the Kafka topic being ingested from.
    +       * 
    + * + * string kafka_topic = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for kafkaTopic. + */ + public com.google.protobuf.ByteString getKafkaTopicBytes() { + java.lang.Object ref = kafkaTopic_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + kafkaTopic_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +       * Optional. The name of the Kafka topic being ingested from.
    +       * 
    + * + * string kafka_topic = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The kafkaTopic to set. + * @return This builder for chaining. + */ + public Builder setKafkaTopic(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + kafkaTopic_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. The name of the Kafka topic being ingested from.
    +       * 
    + * + * string kafka_topic = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearKafkaTopic() { + kafkaTopic_ = getDefaultInstance().getKafkaTopic(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. The name of the Kafka topic being ingested from.
    +       * 
    + * + * string kafka_topic = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for kafkaTopic to set. + * @return This builder for chaining. + */ + public Builder setKafkaTopicBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + kafkaTopic_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private long partitionId_; + + /** + * + * + *
    +       * Optional. The partition ID of the message that failed to be ingested.
    +       * 
    + * + * int64 partition_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The partitionId. + */ + @java.lang.Override + public long getPartitionId() { + return partitionId_; + } + + /** + * + * + *
    +       * Optional. The partition ID of the message that failed to be ingested.
    +       * 
    + * + * int64 partition_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The partitionId to set. + * @return This builder for chaining. + */ + public Builder setPartitionId(long value) { + + partitionId_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. The partition ID of the message that failed to be ingested.
    +       * 
    + * + * int64 partition_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearPartitionId() { + bitField0_ = (bitField0_ & ~0x00000004); + partitionId_ = 0L; + onChanged(); + return this; + } + + private long offset_; + + /** + * + * + *
    +       * Optional. The offset within the partition of the message that failed to
    +       * be ingested.
    +       * 
    + * + * int64 offset = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The offset. + */ + @java.lang.Override + public long getOffset() { + return offset_; + } + + /** + * + * + *
    +       * Optional. The offset within the partition of the message that failed to
    +       * be ingested.
    +       * 
    + * + * int64 offset = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The offset to set. + * @return This builder for chaining. + */ + public Builder setOffset(long value) { + + offset_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. The offset within the partition of the message that failed to
    +       * be ingested.
    +       * 
    + * + * int64 offset = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearOffset() { + bitField0_ = (bitField0_ & ~0x00000008); + offset_ = 0L; + onChanged(); + return this; + } + + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason, + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.Builder, + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReasonOrBuilder> + apiViolationReasonBuilder_; + + /** + * + * + *
    +       * Optional. The Pub/Sub API limits prevented the desired message from
    +       * being published.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the apiViolationReason field is set. + */ + @java.lang.Override + public boolean hasApiViolationReason() { + return reasonCase_ == 5; + } + + /** + * + * + *
    +       * Optional. The Pub/Sub API limits prevented the desired message from
    +       * being published.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The apiViolationReason. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason getApiViolationReason() { + if (apiViolationReasonBuilder_ == null) { + if (reasonCase_ == 5) { + return (com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason) reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.getDefaultInstance(); + } else { + if (reasonCase_ == 5) { + return apiViolationReasonBuilder_.getMessage(); + } + return com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.getDefaultInstance(); + } + } + + /** + * + * + *
    +       * Optional. The Pub/Sub API limits prevented the desired message from
    +       * being published.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 5 [(.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_ = 5; + return this; + } + + /** + * + * + *
    +       * Optional. The Pub/Sub API limits prevented the desired message from
    +       * being published.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 5 [(.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_ = 5; + return this; + } + + /** + * + * + *
    +       * Optional. The Pub/Sub API limits prevented the desired message from
    +       * being published.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeApiViolationReason( + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason value) { + if (apiViolationReasonBuilder_ == null) { + if (reasonCase_ == 5 + && 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_ == 5) { + apiViolationReasonBuilder_.mergeFrom(value); + } else { + apiViolationReasonBuilder_.setMessage(value); + } + } + reasonCase_ = 5; + return this; + } + + /** + * + * + *
    +       * Optional. The Pub/Sub API limits prevented the desired message from
    +       * being published.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearApiViolationReason() { + if (apiViolationReasonBuilder_ == null) { + if (reasonCase_ == 5) { + reasonCase_ = 0; + reason_ = null; + onChanged(); + } + } else { + if (reasonCase_ == 5) { + reasonCase_ = 0; + reason_ = null; + } + apiViolationReasonBuilder_.clear(); + } + return this; + } + + /** + * + * + *
    +       * Optional. The Pub/Sub API limits prevented the desired message from
    +       * being published.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.Builder + getApiViolationReasonBuilder() { + return internalGetApiViolationReasonFieldBuilder().getBuilder(); + } + + /** + * + * + *
    +       * Optional. The Pub/Sub API limits prevented the desired message from
    +       * being published.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReasonOrBuilder + getApiViolationReasonOrBuilder() { + if ((reasonCase_ == 5) && (apiViolationReasonBuilder_ != null)) { + return apiViolationReasonBuilder_.getMessageOrBuilder(); + } else { + if (reasonCase_ == 5) { + return (com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason) reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.getDefaultInstance(); + } + } + + /** + * + * + *
    +       * Optional. The Pub/Sub API limits prevented the desired message from
    +       * being published.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason, + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.Builder, + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReasonOrBuilder> + internalGetApiViolationReasonFieldBuilder() { + if (apiViolationReasonBuilder_ == null) { + if (!(reasonCase_ == 5)) { + reason_ = + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.getDefaultInstance(); + } + apiViolationReasonBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + 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_ = 5; + onChanged(); + return apiViolationReasonBuilder_; + } + + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason, + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.Builder, + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReasonOrBuilder> + schemaViolationReasonBuilder_; + + /** + * + * + *
    +       * Optional. The Pub/Sub message failed schema validation.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the schemaViolationReason field is set. + */ + @java.lang.Override + public boolean hasSchemaViolationReason() { + return reasonCase_ == 6; + } + + /** + * + * + *
    +       * Optional. The Pub/Sub message failed schema validation.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The schemaViolationReason. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason + getSchemaViolationReason() { + if (schemaViolationReasonBuilder_ == null) { + if (reasonCase_ == 6) { + return (com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason) reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason + .getDefaultInstance(); + } else { + if (reasonCase_ == 6) { + return schemaViolationReasonBuilder_.getMessage(); + } + return com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason + .getDefaultInstance(); + } + } + + /** + * + * + *
    +       * Optional. The Pub/Sub message failed schema validation.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setSchemaViolationReason( + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason value) { + if (schemaViolationReasonBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + reason_ = value; + onChanged(); + } else { + schemaViolationReasonBuilder_.setMessage(value); + } + reasonCase_ = 6; + return this; + } + + /** + * + * + *
    +       * Optional. The Pub/Sub message failed schema validation.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setSchemaViolationReason( + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.Builder + builderForValue) { + if (schemaViolationReasonBuilder_ == null) { + reason_ = builderForValue.build(); + onChanged(); + } else { + schemaViolationReasonBuilder_.setMessage(builderForValue.build()); + } + reasonCase_ = 6; + return this; + } + + /** + * + * + *
    +       * Optional. The Pub/Sub message failed schema validation.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeSchemaViolationReason( + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason value) { + if (schemaViolationReasonBuilder_ == null) { + if (reasonCase_ == 6 + && reason_ + != com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason + .getDefaultInstance()) { + reason_ = + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.newBuilder( + (com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason) reason_) + .mergeFrom(value) + .buildPartial(); + } else { + reason_ = value; + } + onChanged(); + } else { + if (reasonCase_ == 6) { + schemaViolationReasonBuilder_.mergeFrom(value); + } else { + schemaViolationReasonBuilder_.setMessage(value); + } + } + reasonCase_ = 6; + return this; + } + + /** + * + * + *
    +       * Optional. The Pub/Sub message failed schema validation.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearSchemaViolationReason() { + if (schemaViolationReasonBuilder_ == null) { + if (reasonCase_ == 6) { + reasonCase_ = 0; + reason_ = null; + onChanged(); + } + } else { + if (reasonCase_ == 6) { + reasonCase_ = 0; + reason_ = null; + } + schemaViolationReasonBuilder_.clear(); + } + return this; + } + + /** + * + * + *
    +       * Optional. The Pub/Sub message failed schema validation.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.Builder + getSchemaViolationReasonBuilder() { + return internalGetSchemaViolationReasonFieldBuilder().getBuilder(); + } + + /** + * + * + *
    +       * Optional. The Pub/Sub message failed schema validation.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReasonOrBuilder + getSchemaViolationReasonOrBuilder() { + if ((reasonCase_ == 6) && (schemaViolationReasonBuilder_ != null)) { + return schemaViolationReasonBuilder_.getMessageOrBuilder(); + } else { + if (reasonCase_ == 6) { + return (com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason) reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason + .getDefaultInstance(); + } + } + + /** + * + * + *
    +       * Optional. The Pub/Sub message failed schema validation.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason, + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.Builder, + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReasonOrBuilder> + internalGetSchemaViolationReasonFieldBuilder() { + if (schemaViolationReasonBuilder_ == null) { + if (!(reasonCase_ == 6)) { + reason_ = + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason + .getDefaultInstance(); + } + schemaViolationReasonBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason, + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.Builder, + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReasonOrBuilder>( + (com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason) reason_, + getParentForChildren(), + isClean()); + reason_ = null; + } + reasonCase_ = 6; + onChanged(); + return schemaViolationReasonBuilder_; + } + + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason, + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason.Builder, + com.google.pubsub.v1.IngestionFailureEvent + .MessageTransformationFailureReasonOrBuilder> + messageTransformationFailureReasonBuilder_; + + /** + * + * + *
    +       * Optional. Failure encountered when applying a message transformation to
    +       * the Pub/Sub message.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the messageTransformationFailureReason field is set. + */ + @java.lang.Override + public boolean hasMessageTransformationFailureReason() { + return reasonCase_ == 7; + } + + /** + * + * + *
    +       * Optional. Failure encountered when applying a message transformation to
    +       * the Pub/Sub message.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The messageTransformationFailureReason. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + getMessageTransformationFailureReason() { + if (messageTransformationFailureReasonBuilder_ == null) { + if (reasonCase_ == 7) { + return (com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason) + reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + .getDefaultInstance(); + } else { + if (reasonCase_ == 7) { + return messageTransformationFailureReasonBuilder_.getMessage(); + } + return com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + .getDefaultInstance(); + } + } + + /** + * + * + *
    +       * Optional. Failure encountered when applying a message transformation to
    +       * the Pub/Sub message.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setMessageTransformationFailureReason( + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason value) { + if (messageTransformationFailureReasonBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + reason_ = value; + onChanged(); + } else { + messageTransformationFailureReasonBuilder_.setMessage(value); + } + reasonCase_ = 7; + return this; + } + + /** + * + * + *
    +       * Optional. Failure encountered when applying a message transformation to
    +       * the Pub/Sub message.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setMessageTransformationFailureReason( + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason.Builder + builderForValue) { + if (messageTransformationFailureReasonBuilder_ == null) { + reason_ = builderForValue.build(); + onChanged(); + } else { + messageTransformationFailureReasonBuilder_.setMessage(builderForValue.build()); + } + reasonCase_ = 7; + return this; + } + + /** + * + * + *
    +       * Optional. Failure encountered when applying a message transformation to
    +       * the Pub/Sub message.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeMessageTransformationFailureReason( + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason value) { + if (messageTransformationFailureReasonBuilder_ == null) { + if (reasonCase_ == 7 + && reason_ + != com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + .getDefaultInstance()) { + reason_ = + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + .newBuilder( + (com.google.pubsub.v1.IngestionFailureEvent + .MessageTransformationFailureReason) + reason_) + .mergeFrom(value) + .buildPartial(); + } else { + reason_ = value; + } + onChanged(); + } else { + if (reasonCase_ == 7) { + messageTransformationFailureReasonBuilder_.mergeFrom(value); + } else { + messageTransformationFailureReasonBuilder_.setMessage(value); + } + } + reasonCase_ = 7; + return this; + } + + /** + * + * + *
    +       * Optional. Failure encountered when applying a message transformation to
    +       * the Pub/Sub message.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearMessageTransformationFailureReason() { + if (messageTransformationFailureReasonBuilder_ == null) { + if (reasonCase_ == 7) { + reasonCase_ = 0; + reason_ = null; + onChanged(); + } + } else { + if (reasonCase_ == 7) { + reasonCase_ = 0; + reason_ = null; + } + messageTransformationFailureReasonBuilder_.clear(); + } + return this; + } + + /** + * + * + *
    +       * Optional. Failure encountered when applying a message transformation to
    +       * the Pub/Sub message.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason.Builder + getMessageTransformationFailureReasonBuilder() { + return internalGetMessageTransformationFailureReasonFieldBuilder().getBuilder(); + } + + /** + * + * + *
    +       * Optional. Failure encountered when applying a message transformation to
    +       * the Pub/Sub message.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReasonOrBuilder + getMessageTransformationFailureReasonOrBuilder() { + if ((reasonCase_ == 7) && (messageTransformationFailureReasonBuilder_ != null)) { + return messageTransformationFailureReasonBuilder_.getMessageOrBuilder(); + } else { + if (reasonCase_ == 7) { + return (com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason) + reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + .getDefaultInstance(); + } + } + + /** + * + * + *
    +       * Optional. Failure encountered when applying a message transformation to
    +       * the Pub/Sub message.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason, + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason.Builder, + com.google.pubsub.v1.IngestionFailureEvent + .MessageTransformationFailureReasonOrBuilder> + internalGetMessageTransformationFailureReasonFieldBuilder() { + if (messageTransformationFailureReasonBuilder_ == null) { + if (!(reasonCase_ == 7)) { + reason_ = + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + .getDefaultInstance(); + } + messageTransformationFailureReasonBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason, + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + .Builder, + com.google.pubsub.v1.IngestionFailureEvent + .MessageTransformationFailureReasonOrBuilder>( + (com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason) + reason_, + getParentForChildren(), + isClean()); + reason_ = null; + } + reasonCase_ = 7; + onChanged(); + return messageTransformationFailureReasonBuilder_; + } + + // @@protoc_insertion_point(builder_scope:google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason) + } + + // @@protoc_insertion_point(class_scope:google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason) + private static final com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = + new com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason(); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ConfluentCloudFailureReason parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException() + .setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public interface AwsKinesisFailureReasonOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
    +     * Optional. The stream ARN of the Kinesis stream being ingested from.
    +     * 
    + * + * string stream_arn = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The streamArn. + */ + java.lang.String getStreamArn(); + + /** + * + * + *
    +     * Optional. The stream ARN of the Kinesis stream being ingested from.
    +     * 
    + * + * string stream_arn = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for streamArn. + */ + com.google.protobuf.ByteString getStreamArnBytes(); + + /** + * + * + *
    +     * Optional. The partition key of the message that failed to be ingested.
    +     * 
    + * + * string partition_key = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The partitionKey. + */ + java.lang.String getPartitionKey(); + + /** + * + * + *
    +     * Optional. The partition key of the message that failed to be ingested.
    +     * 
    + * + * string partition_key = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for partitionKey. + */ + com.google.protobuf.ByteString getPartitionKeyBytes(); + + /** + * + * + *
    +     * Optional. The sequence number of the message that failed to be ingested.
    +     * 
    + * + * string sequence_number = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The sequenceNumber. + */ + java.lang.String getSequenceNumber(); + + /** + * + * + *
    +     * Optional. The sequence number of the message that failed to be ingested.
    +     * 
    + * + * string sequence_number = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for sequenceNumber. + */ + com.google.protobuf.ByteString getSequenceNumberBytes(); + + /** + * + * + *
    +     * Optional. The Pub/Sub message failed schema validation.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the schemaViolationReason field is set. + */ + boolean hasSchemaViolationReason(); + + /** + * + * + *
    +     * Optional. The Pub/Sub message failed schema validation.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The schemaViolationReason. + */ + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason getSchemaViolationReason(); + + /** + * + * + *
    +     * Optional. The Pub/Sub message failed schema validation.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReasonOrBuilder + getSchemaViolationReasonOrBuilder(); + + /** + * + * + *
    +     * Optional. Failure encountered when applying a message transformation to
    +     * the Pub/Sub message.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the messageTransformationFailureReason field is set. + */ + boolean hasMessageTransformationFailureReason(); + + /** + * + * + *
    +     * Optional. Failure encountered when applying a message transformation to
    +     * the Pub/Sub message.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The messageTransformationFailureReason. + */ + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + getMessageTransformationFailureReason(); + + /** + * + * + *
    +     * Optional. Failure encountered when applying a message transformation to
    +     * the Pub/Sub message.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + 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(); + } + + /** + * + * + *
    +   * Failure when ingesting from an AWS Kinesis source.
    +   * 
    + * + * Protobuf type {@code google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason} + */ + public static final class AwsKinesisFailureReason extends com.google.protobuf.GeneratedMessage + implements + // @@protoc_insertion_point(message_implements:google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason) + AwsKinesisFailureReasonOrBuilder { + private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "AwsKinesisFailureReason"); + } + + // Use AwsKinesisFailureReason.newBuilder() to construct. + private AwsKinesisFailureReason(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + + private AwsKinesisFailureReason() { + streamArn_ = ""; + partitionKey_ = ""; + sequenceNumber_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionFailureEvent_AwsKinesisFailureReason_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionFailureEvent_AwsKinesisFailureReason_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason.class, + com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason.Builder.class); + } + + private int reasonCase_ = 0; + + @SuppressWarnings("serial") + private java.lang.Object reason_; + + public enum ReasonCase + implements + com.google.protobuf.Internal.EnumLite, + 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; + + private ReasonCase(int value) { + this.value = value; + } + + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static ReasonCase valueOf(int value) { + return forNumber(value); + } + + public static ReasonCase forNumber(int value) { + switch (value) { + case 4: + return SCHEMA_VIOLATION_REASON; + case 5: + return MESSAGE_TRANSFORMATION_FAILURE_REASON; + case 6: + return API_VIOLATION_REASON; + case 0: + return REASON_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public ReasonCase getReasonCase() { + return ReasonCase.forNumber(reasonCase_); + } + + public static final int STREAM_ARN_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object streamArn_ = ""; + + /** + * + * + *
    +     * Optional. The stream ARN of the Kinesis stream being ingested from.
    +     * 
    + * + * string stream_arn = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The streamArn. + */ + @java.lang.Override + public java.lang.String getStreamArn() { + java.lang.Object ref = streamArn_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + streamArn_ = s; + return s; + } + } + + /** + * + * + *
    +     * Optional. The stream ARN of the Kinesis stream being ingested from.
    +     * 
    + * + * string stream_arn = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for streamArn. + */ + @java.lang.Override + public com.google.protobuf.ByteString getStreamArnBytes() { + java.lang.Object ref = streamArn_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + streamArn_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PARTITION_KEY_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private volatile java.lang.Object partitionKey_ = ""; + + /** + * + * + *
    +     * Optional. The partition key of the message that failed to be ingested.
    +     * 
    + * + * string partition_key = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The partitionKey. + */ + @java.lang.Override + public java.lang.String getPartitionKey() { + java.lang.Object ref = partitionKey_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + partitionKey_ = s; + return s; + } + } + + /** + * + * + *
    +     * Optional. The partition key of the message that failed to be ingested.
    +     * 
    + * + * string partition_key = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for partitionKey. + */ + @java.lang.Override + public com.google.protobuf.ByteString getPartitionKeyBytes() { + java.lang.Object ref = partitionKey_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + partitionKey_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SEQUENCE_NUMBER_FIELD_NUMBER = 3; + + @SuppressWarnings("serial") + private volatile java.lang.Object sequenceNumber_ = ""; + + /** + * + * + *
    +     * Optional. The sequence number of the message that failed to be ingested.
    +     * 
    + * + * string sequence_number = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The sequenceNumber. + */ + @java.lang.Override + public java.lang.String getSequenceNumber() { + java.lang.Object ref = sequenceNumber_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + sequenceNumber_ = s; + return s; + } + } + + /** + * + * + *
    +     * Optional. The sequence number of the message that failed to be ingested.
    +     * 
    + * + * string sequence_number = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for sequenceNumber. + */ + @java.lang.Override + public com.google.protobuf.ByteString getSequenceNumberBytes() { + java.lang.Object ref = sequenceNumber_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + sequenceNumber_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SCHEMA_VIOLATION_REASON_FIELD_NUMBER = 4; + + /** + * + * + *
    +     * Optional. The Pub/Sub message failed schema validation.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the schemaViolationReason field is set. + */ + @java.lang.Override + public boolean hasSchemaViolationReason() { + return reasonCase_ == 4; + } + + /** + * + * + *
    +     * Optional. The Pub/Sub message failed schema validation.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The schemaViolationReason. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason + getSchemaViolationReason() { + if (reasonCase_ == 4) { + return (com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason) reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.getDefaultInstance(); + } + + /** + * + * + *
    +     * Optional. The Pub/Sub message failed schema validation.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReasonOrBuilder + getSchemaViolationReasonOrBuilder() { + if (reasonCase_ == 4) { + return (com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason) reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.getDefaultInstance(); + } + + public static final int MESSAGE_TRANSFORMATION_FAILURE_REASON_FIELD_NUMBER = 5; + + /** + * + * + *
    +     * Optional. Failure encountered when applying a message transformation to
    +     * the Pub/Sub message.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the messageTransformationFailureReason field is set. + */ + @java.lang.Override + public boolean hasMessageTransformationFailureReason() { + return reasonCase_ == 5; + } + + /** + * + * + *
    +     * Optional. Failure encountered when applying a message transformation to
    +     * the Pub/Sub message.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The messageTransformationFailureReason. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + getMessageTransformationFailureReason() { + if (reasonCase_ == 5) { + return (com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason) + reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + .getDefaultInstance(); + } + + /** + * + * + *
    +     * Optional. Failure encountered when applying a message transformation to
    +     * the Pub/Sub message.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReasonOrBuilder + getMessageTransformationFailureReasonOrBuilder() { + if (reasonCase_ == 5) { + return (com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason) + reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + .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 + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(streamArn_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, streamArn_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(partitionKey_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, partitionKey_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(sequenceNumber_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 3, sequenceNumber_); + } + if (reasonCase_ == 4) { + output.writeMessage( + 4, (com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason) reason_); + } + if (reasonCase_ == 5) { + output.writeMessage( + 5, + (com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason) + reason_); + } + if (reasonCase_ == 6) { + output.writeMessage( + 6, (com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason) reason_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(streamArn_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, streamArn_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(partitionKey_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, partitionKey_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(sequenceNumber_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(3, sequenceNumber_); + } + if (reasonCase_ == 4) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 4, (com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason) reason_); + } + if (reasonCase_ == 5) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 5, + (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; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason)) { + return super.equals(obj); + } + com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason other = + (com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason) obj; + + if (!getStreamArn().equals(other.getStreamArn())) return false; + if (!getPartitionKey().equals(other.getPartitionKey())) return false; + if (!getSequenceNumber().equals(other.getSequenceNumber())) return false; + if (!getReasonCase().equals(other.getReasonCase())) return false; + switch (reasonCase_) { + case 4: + if (!getSchemaViolationReason().equals(other.getSchemaViolationReason())) return false; + break; + case 5: + if (!getMessageTransformationFailureReason() + .equals(other.getMessageTransformationFailureReason())) return false; + break; + case 6: + if (!getApiViolationReason().equals(other.getApiViolationReason())) return false; + break; + case 0: + default: + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + STREAM_ARN_FIELD_NUMBER; + hash = (53 * hash) + getStreamArn().hashCode(); + hash = (37 * hash) + PARTITION_KEY_FIELD_NUMBER; + hash = (53 * hash) + getPartitionKey().hashCode(); + hash = (37 * hash) + SEQUENCE_NUMBER_FIELD_NUMBER; + hash = (53 * hash) + getSequenceNumber().hashCode(); + switch (reasonCase_) { + case 4: + hash = (37 * hash) + SCHEMA_VIOLATION_REASON_FIELD_NUMBER; + hash = (53 * hash) + getSchemaViolationReason().hashCode(); + break; + case 5: + 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: + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason parseFrom( + byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason + parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason + parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + + /** + * + * + *
    +     * Failure when ingesting from an AWS Kinesis source.
    +     * 
    + * + * Protobuf type {@code google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder + implements + // @@protoc_insertion_point(builder_implements:google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason) + com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReasonOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionFailureEvent_AwsKinesisFailureReason_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionFailureEvent_AwsKinesisFailureReason_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason.class, + com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason.Builder.class); + } + + // Construct using + // com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + streamArn_ = ""; + partitionKey_ = ""; + sequenceNumber_ = ""; + if (schemaViolationReasonBuilder_ != null) { + schemaViolationReasonBuilder_.clear(); + } + if (messageTransformationFailureReasonBuilder_ != null) { + messageTransformationFailureReasonBuilder_.clear(); + } + if (apiViolationReasonBuilder_ != null) { + apiViolationReasonBuilder_.clear(); + } + reasonCase_ = 0; + reason_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionFailureEvent_AwsKinesisFailureReason_descriptor; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason + getDefaultInstanceForType() { + return com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason + .getDefaultInstance(); + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason build() { + com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason buildPartial() { + com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason result = + new com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + buildPartialOneofs(result); + onBuilt(); + return result; + } + + private void buildPartial0( + com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.streamArn_ = streamArn_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.partitionKey_ = partitionKey_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.sequenceNumber_ = sequenceNumber_; + } + } + + private void buildPartialOneofs( + com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason result) { + result.reasonCase_ = reasonCase_; + result.reason_ = this.reason_; + if (reasonCase_ == 4 && schemaViolationReasonBuilder_ != null) { + result.reason_ = schemaViolationReasonBuilder_.build(); + } + if (reasonCase_ == 5 && messageTransformationFailureReasonBuilder_ != null) { + result.reason_ = messageTransformationFailureReasonBuilder_.build(); + } + if (reasonCase_ == 6 && apiViolationReasonBuilder_ != null) { + result.reason_ = apiViolationReasonBuilder_.build(); + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason) { + return mergeFrom( + (com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason other) { + if (other + == com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason + .getDefaultInstance()) return this; + if (!other.getStreamArn().isEmpty()) { + streamArn_ = other.streamArn_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getPartitionKey().isEmpty()) { + partitionKey_ = other.partitionKey_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (!other.getSequenceNumber().isEmpty()) { + sequenceNumber_ = other.sequenceNumber_; + bitField0_ |= 0x00000004; + onChanged(); + } + switch (other.getReasonCase()) { + case SCHEMA_VIOLATION_REASON: + { + mergeSchemaViolationReason(other.getSchemaViolationReason()); + break; + } + case MESSAGE_TRANSFORMATION_FAILURE_REASON: + { + mergeMessageTransformationFailureReason( + other.getMessageTransformationFailureReason()); + break; + } + case API_VIOLATION_REASON: + { + mergeApiViolationReason(other.getApiViolationReason()); + break; + } + case REASON_NOT_SET: + { + break; + } + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + streamArn_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + partitionKey_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: + { + sequenceNumber_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000004; + break; + } // case 26 + case 34: + { + input.readMessage( + internalGetSchemaViolationReasonFieldBuilder().getBuilder(), + extensionRegistry); + reasonCase_ = 4; + break; + } // case 34 + case 42: + { + input.readMessage( + internalGetMessageTransformationFailureReasonFieldBuilder().getBuilder(), + extensionRegistry); + reasonCase_ = 5; + break; + } // case 42 + case 50: + { + input.readMessage( + internalGetApiViolationReasonFieldBuilder().getBuilder(), extensionRegistry); + reasonCase_ = 6; + break; + } // case 50 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int reasonCase_ = 0; + private java.lang.Object reason_; + + public ReasonCase getReasonCase() { + return ReasonCase.forNumber(reasonCase_); + } + + public Builder clearReason() { + reasonCase_ = 0; + reason_ = null; + onChanged(); + return this; + } + + private int bitField0_; + + private java.lang.Object streamArn_ = ""; + + /** + * + * + *
    +       * Optional. The stream ARN of the Kinesis stream being ingested from.
    +       * 
    + * + * string stream_arn = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The streamArn. + */ + public java.lang.String getStreamArn() { + java.lang.Object ref = streamArn_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + streamArn_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +       * Optional. The stream ARN of the Kinesis stream being ingested from.
    +       * 
    + * + * string stream_arn = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for streamArn. + */ + public com.google.protobuf.ByteString getStreamArnBytes() { + java.lang.Object ref = streamArn_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + streamArn_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +       * Optional. The stream ARN of the Kinesis stream being ingested from.
    +       * 
    + * + * string stream_arn = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The streamArn to set. + * @return This builder for chaining. + */ + public Builder setStreamArn(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + streamArn_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. The stream ARN of the Kinesis stream being ingested from.
    +       * 
    + * + * string stream_arn = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearStreamArn() { + streamArn_ = getDefaultInstance().getStreamArn(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. The stream ARN of the Kinesis stream being ingested from.
    +       * 
    + * + * string stream_arn = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for streamArn to set. + * @return This builder for chaining. + */ + public Builder setStreamArnBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + streamArn_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object partitionKey_ = ""; + + /** + * + * + *
    +       * Optional. The partition key of the message that failed to be ingested.
    +       * 
    + * + * string partition_key = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The partitionKey. + */ + public java.lang.String getPartitionKey() { + java.lang.Object ref = partitionKey_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + partitionKey_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +       * Optional. The partition key of the message that failed to be ingested.
    +       * 
    + * + * string partition_key = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for partitionKey. + */ + public com.google.protobuf.ByteString getPartitionKeyBytes() { + java.lang.Object ref = partitionKey_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + partitionKey_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +       * Optional. The partition key of the message that failed to be ingested.
    +       * 
    + * + * string partition_key = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The partitionKey to set. + * @return This builder for chaining. + */ + public Builder setPartitionKey(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + partitionKey_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. The partition key of the message that failed to be ingested.
    +       * 
    + * + * string partition_key = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearPartitionKey() { + partitionKey_ = getDefaultInstance().getPartitionKey(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. The partition key of the message that failed to be ingested.
    +       * 
    + * + * string partition_key = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for partitionKey to set. + * @return This builder for chaining. + */ + public Builder setPartitionKeyBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + partitionKey_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private java.lang.Object sequenceNumber_ = ""; + + /** + * + * + *
    +       * Optional. The sequence number of the message that failed to be ingested.
    +       * 
    + * + * string sequence_number = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The sequenceNumber. + */ + public java.lang.String getSequenceNumber() { + java.lang.Object ref = sequenceNumber_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + sequenceNumber_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +       * Optional. The sequence number of the message that failed to be ingested.
    +       * 
    + * + * string sequence_number = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for sequenceNumber. + */ + public com.google.protobuf.ByteString getSequenceNumberBytes() { + java.lang.Object ref = sequenceNumber_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + sequenceNumber_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +       * Optional. The sequence number of the message that failed to be ingested.
    +       * 
    + * + * string sequence_number = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The sequenceNumber to set. + * @return This builder for chaining. + */ + public Builder setSequenceNumber(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + sequenceNumber_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. The sequence number of the message that failed to be ingested.
    +       * 
    + * + * string sequence_number = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearSequenceNumber() { + sequenceNumber_ = getDefaultInstance().getSequenceNumber(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. The sequence number of the message that failed to be ingested.
    +       * 
    + * + * string sequence_number = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for sequenceNumber to set. + * @return This builder for chaining. + */ + public Builder setSequenceNumberBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + sequenceNumber_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason, + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.Builder, + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReasonOrBuilder> + schemaViolationReasonBuilder_; + + /** + * + * + *
    +       * Optional. The Pub/Sub message failed schema validation.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the schemaViolationReason field is set. + */ + @java.lang.Override + public boolean hasSchemaViolationReason() { + return reasonCase_ == 4; + } + + /** + * + * + *
    +       * Optional. The Pub/Sub message failed schema validation.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The schemaViolationReason. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason + getSchemaViolationReason() { + if (schemaViolationReasonBuilder_ == null) { + if (reasonCase_ == 4) { + return (com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason) reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason + .getDefaultInstance(); + } else { + if (reasonCase_ == 4) { + return schemaViolationReasonBuilder_.getMessage(); + } + return com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason + .getDefaultInstance(); + } + } + + /** + * + * + *
    +       * Optional. The Pub/Sub message failed schema validation.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setSchemaViolationReason( + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason value) { + if (schemaViolationReasonBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + reason_ = value; + onChanged(); + } else { + schemaViolationReasonBuilder_.setMessage(value); + } + reasonCase_ = 4; + return this; + } + + /** + * + * + *
    +       * Optional. The Pub/Sub message failed schema validation.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setSchemaViolationReason( + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.Builder + builderForValue) { + if (schemaViolationReasonBuilder_ == null) { + reason_ = builderForValue.build(); + onChanged(); + } else { + schemaViolationReasonBuilder_.setMessage(builderForValue.build()); + } + reasonCase_ = 4; + return this; + } + + /** + * + * + *
    +       * Optional. The Pub/Sub message failed schema validation.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeSchemaViolationReason( + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason value) { + if (schemaViolationReasonBuilder_ == null) { + if (reasonCase_ == 4 + && reason_ + != com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason + .getDefaultInstance()) { + reason_ = + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.newBuilder( + (com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason) reason_) + .mergeFrom(value) + .buildPartial(); + } else { + reason_ = value; + } + onChanged(); + } else { + if (reasonCase_ == 4) { + schemaViolationReasonBuilder_.mergeFrom(value); + } else { + schemaViolationReasonBuilder_.setMessage(value); + } + } + reasonCase_ = 4; + return this; + } + + /** + * + * + *
    +       * Optional. The Pub/Sub message failed schema validation.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearSchemaViolationReason() { + if (schemaViolationReasonBuilder_ == null) { + if (reasonCase_ == 4) { + reasonCase_ = 0; + reason_ = null; + onChanged(); + } + } else { + if (reasonCase_ == 4) { + reasonCase_ = 0; + reason_ = null; + } + schemaViolationReasonBuilder_.clear(); + } + return this; + } + + /** + * + * + *
    +       * Optional. The Pub/Sub message failed schema validation.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.Builder + getSchemaViolationReasonBuilder() { + return internalGetSchemaViolationReasonFieldBuilder().getBuilder(); + } + + /** + * + * + *
    +       * Optional. The Pub/Sub message failed schema validation.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReasonOrBuilder + getSchemaViolationReasonOrBuilder() { + if ((reasonCase_ == 4) && (schemaViolationReasonBuilder_ != null)) { + return schemaViolationReasonBuilder_.getMessageOrBuilder(); + } else { + if (reasonCase_ == 4) { + return (com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason) reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason + .getDefaultInstance(); + } + } + + /** + * + * + *
    +       * Optional. The Pub/Sub message failed schema validation.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason, + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.Builder, + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReasonOrBuilder> + internalGetSchemaViolationReasonFieldBuilder() { + if (schemaViolationReasonBuilder_ == null) { + if (!(reasonCase_ == 4)) { + reason_ = + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason + .getDefaultInstance(); + } + schemaViolationReasonBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason, + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.Builder, + com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReasonOrBuilder>( + (com.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason) reason_, + getParentForChildren(), + isClean()); + reason_ = null; + } + reasonCase_ = 4; + onChanged(); + return schemaViolationReasonBuilder_; + } + + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason, + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason.Builder, + com.google.pubsub.v1.IngestionFailureEvent + .MessageTransformationFailureReasonOrBuilder> + messageTransformationFailureReasonBuilder_; + + /** + * + * + *
    +       * Optional. Failure encountered when applying a message transformation to
    +       * the Pub/Sub message.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the messageTransformationFailureReason field is set. + */ + @java.lang.Override + public boolean hasMessageTransformationFailureReason() { + return reasonCase_ == 5; + } + + /** + * + * + *
    +       * Optional. Failure encountered when applying a message transformation to
    +       * the Pub/Sub message.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The messageTransformationFailureReason. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + getMessageTransformationFailureReason() { + if (messageTransformationFailureReasonBuilder_ == null) { + if (reasonCase_ == 5) { + return (com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason) + reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + .getDefaultInstance(); + } else { + if (reasonCase_ == 5) { + return messageTransformationFailureReasonBuilder_.getMessage(); + } + return com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + .getDefaultInstance(); + } + } + + /** + * + * + *
    +       * Optional. Failure encountered when applying a message transformation to
    +       * the Pub/Sub message.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setMessageTransformationFailureReason( + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason value) { + if (messageTransformationFailureReasonBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + reason_ = value; + onChanged(); + } else { + messageTransformationFailureReasonBuilder_.setMessage(value); + } + reasonCase_ = 5; + return this; + } + + /** + * + * + *
    +       * Optional. Failure encountered when applying a message transformation to
    +       * the Pub/Sub message.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setMessageTransformationFailureReason( + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason.Builder + builderForValue) { + if (messageTransformationFailureReasonBuilder_ == null) { + reason_ = builderForValue.build(); + onChanged(); + } else { + messageTransformationFailureReasonBuilder_.setMessage(builderForValue.build()); + } + reasonCase_ = 5; + return this; + } + + /** + * + * + *
    +       * Optional. Failure encountered when applying a message transformation to
    +       * the Pub/Sub message.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeMessageTransformationFailureReason( + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason value) { + if (messageTransformationFailureReasonBuilder_ == null) { + if (reasonCase_ == 5 + && reason_ + != com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + .getDefaultInstance()) { + reason_ = + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + .newBuilder( + (com.google.pubsub.v1.IngestionFailureEvent + .MessageTransformationFailureReason) + reason_) + .mergeFrom(value) + .buildPartial(); + } else { + reason_ = value; + } + onChanged(); + } else { + if (reasonCase_ == 5) { + messageTransformationFailureReasonBuilder_.mergeFrom(value); + } else { + messageTransformationFailureReasonBuilder_.setMessage(value); + } + } + reasonCase_ = 5; + return this; + } + + /** + * + * + *
    +       * Optional. Failure encountered when applying a message transformation to
    +       * the Pub/Sub message.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearMessageTransformationFailureReason() { + if (messageTransformationFailureReasonBuilder_ == null) { + if (reasonCase_ == 5) { + reasonCase_ = 0; + reason_ = null; + onChanged(); + } + } else { + if (reasonCase_ == 5) { + reasonCase_ = 0; + reason_ = null; + } + messageTransformationFailureReasonBuilder_.clear(); + } + return this; + } + + /** + * + * + *
    +       * Optional. Failure encountered when applying a message transformation to
    +       * the Pub/Sub message.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason.Builder + getMessageTransformationFailureReasonBuilder() { + return internalGetMessageTransformationFailureReasonFieldBuilder().getBuilder(); + } + + /** + * + * + *
    +       * Optional. Failure encountered when applying a message transformation to
    +       * the Pub/Sub message.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReasonOrBuilder + getMessageTransformationFailureReasonOrBuilder() { + if ((reasonCase_ == 5) && (messageTransformationFailureReasonBuilder_ != null)) { + return messageTransformationFailureReasonBuilder_.getMessageOrBuilder(); + } else { + if (reasonCase_ == 5) { + return (com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason) + reason_; + } + return com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + .getDefaultInstance(); + } + } + + /** + * + * + *
    +       * Optional. Failure encountered when applying a message transformation to
    +       * the Pub/Sub message.
    +       * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason message_transformation_failure_reason = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason, + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason.Builder, + com.google.pubsub.v1.IngestionFailureEvent + .MessageTransformationFailureReasonOrBuilder> + internalGetMessageTransformationFailureReasonFieldBuilder() { + if (messageTransformationFailureReasonBuilder_ == null) { + if (!(reasonCase_ == 5)) { + reason_ = + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + .getDefaultInstance(); + } + messageTransformationFailureReasonBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason, + com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason + .Builder, + com.google.pubsub.v1.IngestionFailureEvent + .MessageTransformationFailureReasonOrBuilder>( + (com.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason) + reason_, + getParentForChildren(), + isClean()); + reason_ = null; + } + reasonCase_ = 5; + onChanged(); + return messageTransformationFailureReasonBuilder_; + } + + private com.google.protobuf.SingleFieldBuilder< + 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 internalGetApiViolationReasonFieldBuilder().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.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason, + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.Builder, + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReasonOrBuilder> + internalGetApiViolationReasonFieldBuilder() { + if (apiViolationReasonBuilder_ == null) { + if (!(reasonCase_ == 6)) { + reason_ = + com.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.getDefaultInstance(); + } + apiViolationReasonBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + 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_; + } + + // @@protoc_insertion_point(builder_scope:google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason) + } + + // @@protoc_insertion_point(class_scope:google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason) + private static final com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason(); + } + + public static com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AwsKinesisFailureReason parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException() + .setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + private int failureCase_ = 0; + + @SuppressWarnings("serial") + private java.lang.Object failure_; + + public enum FailureCase + implements + com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + CLOUD_STORAGE_FAILURE(3), + AWS_MSK_FAILURE(4), + AZURE_EVENT_HUBS_FAILURE(5), + CONFLUENT_CLOUD_FAILURE(6), + AWS_KINESIS_FAILURE(7), + FAILURE_NOT_SET(0); + private final int value; + + private FailureCase(int value) { + this.value = value; + } + + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static FailureCase valueOf(int value) { + return forNumber(value); + } + + public static FailureCase forNumber(int value) { + switch (value) { + case 3: + return CLOUD_STORAGE_FAILURE; + case 4: + return AWS_MSK_FAILURE; + case 5: + return AZURE_EVENT_HUBS_FAILURE; + case 6: + return CONFLUENT_CLOUD_FAILURE; + case 7: + return AWS_KINESIS_FAILURE; + case 0: + return FAILURE_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public FailureCase getFailureCase() { + return FailureCase.forNumber(failureCase_); + } + + public static final int TOPIC_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object topic_ = ""; + + /** + * + * + *
    +   * Required. Name of the import topic. Format is:
    +   * projects/{project_name}/topics/{topic_name}.
    +   * 
    + * + * + * string topic = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The topic. + */ + @java.lang.Override + public java.lang.String getTopic() { + java.lang.Object ref = topic_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + topic_ = s; + return s; + } + } + + /** + * + * + *
    +   * Required. Name of the import topic. Format is:
    +   * projects/{project_name}/topics/{topic_name}.
    +   * 
    + * + * + * string topic = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for topic. + */ + @java.lang.Override + public com.google.protobuf.ByteString getTopicBytes() { + java.lang.Object ref = topic_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + topic_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int ERROR_MESSAGE_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private volatile java.lang.Object errorMessage_ = ""; + + /** + * + * + *
    +   * Required. Error details explaining why ingestion to Pub/Sub has failed.
    +   * 
    + * + * string error_message = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The errorMessage. + */ + @java.lang.Override + public java.lang.String getErrorMessage() { + java.lang.Object ref = errorMessage_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + errorMessage_ = s; + return s; + } + } + + /** + * + * + *
    +   * Required. Error details explaining why ingestion to Pub/Sub has failed.
    +   * 
    + * + * string error_message = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for errorMessage. + */ + @java.lang.Override + public com.google.protobuf.ByteString getErrorMessageBytes() { + java.lang.Object ref = errorMessage_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + errorMessage_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CLOUD_STORAGE_FAILURE_FIELD_NUMBER = 3; + + /** + * + * + *
    +   * Optional. Failure when ingesting from Cloud Storage.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure cloud_storage_failure = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the cloudStorageFailure field is set. + */ + @java.lang.Override + public boolean hasCloudStorageFailure() { + return failureCase_ == 3; + } + + /** + * + * + *
    +   * Optional. Failure when ingesting from Cloud Storage.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure cloud_storage_failure = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The cloudStorageFailure. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure getCloudStorageFailure() { + if (failureCase_ == 3) { + return (com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure) failure_; + } + return com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure.getDefaultInstance(); + } + + /** + * + * + *
    +   * Optional. Failure when ingesting from Cloud Storage.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure cloud_storage_failure = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailureOrBuilder + getCloudStorageFailureOrBuilder() { + if (failureCase_ == 3) { + return (com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure) failure_; + } + return com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure.getDefaultInstance(); + } + + public static final int AWS_MSK_FAILURE_FIELD_NUMBER = 4; + + /** + * + * + *
    +   * Optional. Failure when ingesting from Amazon MSK.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason aws_msk_failure = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the awsMskFailure field is set. + */ + @java.lang.Override + public boolean hasAwsMskFailure() { + return failureCase_ == 4; + } + + /** + * + * + *
    +   * Optional. Failure when ingesting from Amazon MSK.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason aws_msk_failure = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The awsMskFailure. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason getAwsMskFailure() { + if (failureCase_ == 4) { + return (com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason) failure_; + } + return com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason.getDefaultInstance(); + } + + /** + * + * + *
    +   * Optional. Failure when ingesting from Amazon MSK.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason aws_msk_failure = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReasonOrBuilder + getAwsMskFailureOrBuilder() { + if (failureCase_ == 4) { + return (com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason) failure_; + } + return com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason.getDefaultInstance(); + } + + public static final int AZURE_EVENT_HUBS_FAILURE_FIELD_NUMBER = 5; + + /** + * + * + *
    +   * Optional. Failure when ingesting from Azure Event Hubs.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason azure_event_hubs_failure = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the azureEventHubsFailure field is set. + */ + @java.lang.Override + public boolean hasAzureEventHubsFailure() { + return failureCase_ == 5; + } + + /** + * + * + *
    +   * Optional. Failure when ingesting from Azure Event Hubs.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason azure_event_hubs_failure = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The azureEventHubsFailure. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason + getAzureEventHubsFailure() { + if (failureCase_ == 5) { + return (com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason) failure_; + } + return com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason + .getDefaultInstance(); + } + + /** + * + * + *
    +   * Optional. Failure when ingesting from Azure Event Hubs.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason azure_event_hubs_failure = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReasonOrBuilder + getAzureEventHubsFailureOrBuilder() { + if (failureCase_ == 5) { + return (com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason) failure_; + } + return com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason + .getDefaultInstance(); + } + + public static final int CONFLUENT_CLOUD_FAILURE_FIELD_NUMBER = 6; + + /** + * + * + *
    +   * Optional. Failure when ingesting from Confluent Cloud.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason confluent_cloud_failure = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the confluentCloudFailure field is set. + */ + @java.lang.Override + public boolean hasConfluentCloudFailure() { + return failureCase_ == 6; + } + + /** + * + * + *
    +   * Optional. Failure when ingesting from Confluent Cloud.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason confluent_cloud_failure = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The confluentCloudFailure. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason + getConfluentCloudFailure() { + if (failureCase_ == 6) { + return (com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason) failure_; + } + return com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason + .getDefaultInstance(); + } + + /** + * + * + *
    +   * Optional. Failure when ingesting from Confluent Cloud.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason confluent_cloud_failure = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReasonOrBuilder + getConfluentCloudFailureOrBuilder() { + if (failureCase_ == 6) { + return (com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason) failure_; + } + return com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason + .getDefaultInstance(); + } + + public static final int AWS_KINESIS_FAILURE_FIELD_NUMBER = 7; + + /** + * + * + *
    +   * Optional. Failure when ingesting from AWS Kinesis.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason aws_kinesis_failure = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the awsKinesisFailure field is set. + */ + @java.lang.Override + public boolean hasAwsKinesisFailure() { + return failureCase_ == 7; + } + + /** + * + * + *
    +   * Optional. Failure when ingesting from AWS Kinesis.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason aws_kinesis_failure = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The awsKinesisFailure. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason getAwsKinesisFailure() { + if (failureCase_ == 7) { + return (com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason) failure_; + } + return com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason.getDefaultInstance(); + } + + /** + * + * + *
    +   * Optional. Failure when ingesting from AWS Kinesis.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason aws_kinesis_failure = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReasonOrBuilder + getAwsKinesisFailureOrBuilder() { + if (failureCase_ == 7) { + return (com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason) failure_; + } + return com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason.getDefaultInstance(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(topic_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, topic_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(errorMessage_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, errorMessage_); + } + if (failureCase_ == 3) { + output.writeMessage( + 3, (com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure) failure_); + } + if (failureCase_ == 4) { + output.writeMessage( + 4, (com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason) failure_); + } + if (failureCase_ == 5) { + output.writeMessage( + 5, (com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason) failure_); + } + if (failureCase_ == 6) { + output.writeMessage( + 6, (com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason) failure_); + } + if (failureCase_ == 7) { + output.writeMessage( + 7, (com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason) failure_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(topic_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, topic_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(errorMessage_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, errorMessage_); + } + if (failureCase_ == 3) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 3, (com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure) failure_); + } + if (failureCase_ == 4) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 4, (com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason) failure_); + } + if (failureCase_ == 5) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 5, (com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason) failure_); + } + if (failureCase_ == 6) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 6, (com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason) failure_); + } + if (failureCase_ == 7) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 7, (com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason) failure_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.pubsub.v1.IngestionFailureEvent)) { + return super.equals(obj); + } + com.google.pubsub.v1.IngestionFailureEvent other = + (com.google.pubsub.v1.IngestionFailureEvent) obj; + + if (!getTopic().equals(other.getTopic())) return false; + if (!getErrorMessage().equals(other.getErrorMessage())) return false; + if (!getFailureCase().equals(other.getFailureCase())) return false; + switch (failureCase_) { + case 3: + if (!getCloudStorageFailure().equals(other.getCloudStorageFailure())) return false; + break; + case 4: + if (!getAwsMskFailure().equals(other.getAwsMskFailure())) return false; + break; + case 5: + if (!getAzureEventHubsFailure().equals(other.getAzureEventHubsFailure())) return false; + break; + case 6: + if (!getConfluentCloudFailure().equals(other.getConfluentCloudFailure())) return false; + break; + case 7: + if (!getAwsKinesisFailure().equals(other.getAwsKinesisFailure())) return false; + break; + case 0: + default: + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + TOPIC_FIELD_NUMBER; + hash = (53 * hash) + getTopic().hashCode(); + hash = (37 * hash) + ERROR_MESSAGE_FIELD_NUMBER; + hash = (53 * hash) + getErrorMessage().hashCode(); + switch (failureCase_) { + case 3: + hash = (37 * hash) + CLOUD_STORAGE_FAILURE_FIELD_NUMBER; + hash = (53 * hash) + getCloudStorageFailure().hashCode(); + break; + case 4: + hash = (37 * hash) + AWS_MSK_FAILURE_FIELD_NUMBER; + hash = (53 * hash) + getAwsMskFailure().hashCode(); + break; + case 5: + hash = (37 * hash) + AZURE_EVENT_HUBS_FAILURE_FIELD_NUMBER; + hash = (53 * hash) + getAzureEventHubsFailure().hashCode(); + break; + case 6: + hash = (37 * hash) + CONFLUENT_CLOUD_FAILURE_FIELD_NUMBER; + hash = (53 * hash) + getConfluentCloudFailure().hashCode(); + break; + case 7: + hash = (37 * hash) + AWS_KINESIS_FAILURE_FIELD_NUMBER; + hash = (53 * hash) + getAwsKinesisFailure().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.pubsub.v1.IngestionFailureEvent parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionFailureEvent parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionFailureEvent parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionFailureEvent parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionFailureEvent parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.IngestionFailureEvent parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionFailureEvent parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionFailureEvent parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionFailureEvent parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionFailureEvent parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.IngestionFailureEvent parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.IngestionFailureEvent parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.pubsub.v1.IngestionFailureEvent prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + + /** + * + * + *
    +   * Payload of the Platform Log entry sent when a failure is encountered while
    +   * ingesting.
    +   * 
    + * + * Protobuf type {@code google.pubsub.v1.IngestionFailureEvent} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder + implements + // @@protoc_insertion_point(builder_implements:google.pubsub.v1.IngestionFailureEvent) + com.google.pubsub.v1.IngestionFailureEventOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionFailureEvent_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionFailureEvent_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.IngestionFailureEvent.class, + com.google.pubsub.v1.IngestionFailureEvent.Builder.class); + } + + // Construct using com.google.pubsub.v1.IngestionFailureEvent.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + topic_ = ""; + errorMessage_ = ""; + if (cloudStorageFailureBuilder_ != null) { + cloudStorageFailureBuilder_.clear(); + } + if (awsMskFailureBuilder_ != null) { + awsMskFailureBuilder_.clear(); + } + if (azureEventHubsFailureBuilder_ != null) { + azureEventHubsFailureBuilder_.clear(); + } + if (confluentCloudFailureBuilder_ != null) { + confluentCloudFailureBuilder_.clear(); + } + if (awsKinesisFailureBuilder_ != null) { + awsKinesisFailureBuilder_.clear(); + } + failureCase_ = 0; + failure_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_IngestionFailureEvent_descriptor; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent getDefaultInstanceForType() { + return com.google.pubsub.v1.IngestionFailureEvent.getDefaultInstance(); + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent build() { + com.google.pubsub.v1.IngestionFailureEvent result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent buildPartial() { + com.google.pubsub.v1.IngestionFailureEvent result = + new com.google.pubsub.v1.IngestionFailureEvent(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + buildPartialOneofs(result); + onBuilt(); + return result; + } + + private void buildPartial0(com.google.pubsub.v1.IngestionFailureEvent result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.topic_ = topic_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.errorMessage_ = errorMessage_; + } + } + + private void buildPartialOneofs(com.google.pubsub.v1.IngestionFailureEvent result) { + result.failureCase_ = failureCase_; + result.failure_ = this.failure_; + if (failureCase_ == 3 && cloudStorageFailureBuilder_ != null) { + result.failure_ = cloudStorageFailureBuilder_.build(); + } + if (failureCase_ == 4 && awsMskFailureBuilder_ != null) { + result.failure_ = awsMskFailureBuilder_.build(); + } + if (failureCase_ == 5 && azureEventHubsFailureBuilder_ != null) { + result.failure_ = azureEventHubsFailureBuilder_.build(); + } + if (failureCase_ == 6 && confluentCloudFailureBuilder_ != null) { + result.failure_ = confluentCloudFailureBuilder_.build(); + } + if (failureCase_ == 7 && awsKinesisFailureBuilder_ != null) { + result.failure_ = awsKinesisFailureBuilder_.build(); + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.pubsub.v1.IngestionFailureEvent) { + return mergeFrom((com.google.pubsub.v1.IngestionFailureEvent) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.pubsub.v1.IngestionFailureEvent other) { + if (other == com.google.pubsub.v1.IngestionFailureEvent.getDefaultInstance()) return this; + if (!other.getTopic().isEmpty()) { + topic_ = other.topic_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getErrorMessage().isEmpty()) { + errorMessage_ = other.errorMessage_; + bitField0_ |= 0x00000002; + onChanged(); + } + switch (other.getFailureCase()) { + case CLOUD_STORAGE_FAILURE: + { + mergeCloudStorageFailure(other.getCloudStorageFailure()); + break; + } + case AWS_MSK_FAILURE: + { + mergeAwsMskFailure(other.getAwsMskFailure()); + break; + } + case AZURE_EVENT_HUBS_FAILURE: + { + mergeAzureEventHubsFailure(other.getAzureEventHubsFailure()); + break; + } + case CONFLUENT_CLOUD_FAILURE: + { + mergeConfluentCloudFailure(other.getConfluentCloudFailure()); + break; + } + case AWS_KINESIS_FAILURE: + { + mergeAwsKinesisFailure(other.getAwsKinesisFailure()); + break; + } + case FAILURE_NOT_SET: + { + break; + } + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + topic_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + errorMessage_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: + { + input.readMessage( + internalGetCloudStorageFailureFieldBuilder().getBuilder(), extensionRegistry); + failureCase_ = 3; + break; + } // case 26 + case 34: + { + input.readMessage( + internalGetAwsMskFailureFieldBuilder().getBuilder(), extensionRegistry); + failureCase_ = 4; + break; + } // case 34 + case 42: + { + input.readMessage( + internalGetAzureEventHubsFailureFieldBuilder().getBuilder(), extensionRegistry); + failureCase_ = 5; + break; + } // case 42 + case 50: + { + input.readMessage( + internalGetConfluentCloudFailureFieldBuilder().getBuilder(), extensionRegistry); + failureCase_ = 6; + break; + } // case 50 + case 58: + { + input.readMessage( + internalGetAwsKinesisFailureFieldBuilder().getBuilder(), extensionRegistry); + failureCase_ = 7; + break; + } // case 58 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int failureCase_ = 0; + private java.lang.Object failure_; + + public FailureCase getFailureCase() { + return FailureCase.forNumber(failureCase_); + } + + public Builder clearFailure() { + failureCase_ = 0; + failure_ = null; + onChanged(); + return this; + } + + private int bitField0_; + + private java.lang.Object topic_ = ""; + + /** + * + * + *
    +     * Required. Name of the import topic. Format is:
    +     * projects/{project_name}/topics/{topic_name}.
    +     * 
    + * + * + * string topic = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The topic. + */ + public java.lang.String getTopic() { + java.lang.Object ref = topic_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + topic_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +     * Required. Name of the import topic. Format is:
    +     * projects/{project_name}/topics/{topic_name}.
    +     * 
    + * + * + * string topic = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for topic. + */ + public com.google.protobuf.ByteString getTopicBytes() { + java.lang.Object ref = topic_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + topic_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +     * Required. Name of the import topic. Format is:
    +     * projects/{project_name}/topics/{topic_name}.
    +     * 
    + * + * + * string topic = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The topic to set. + * @return This builder for chaining. + */ + public Builder setTopic(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + topic_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Required. Name of the import topic. Format is:
    +     * projects/{project_name}/topics/{topic_name}.
    +     * 
    + * + * + * string topic = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearTopic() { + topic_ = getDefaultInstance().getTopic(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + + /** + * + * + *
    +     * Required. Name of the import topic. Format is:
    +     * projects/{project_name}/topics/{topic_name}.
    +     * 
    + * + * + * 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. + */ + public Builder setTopicBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + topic_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object errorMessage_ = ""; + + /** + * + * + *
    +     * Required. Error details explaining why ingestion to Pub/Sub has failed.
    +     * 
    + * + * string error_message = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The errorMessage. + */ + public java.lang.String getErrorMessage() { + java.lang.Object ref = errorMessage_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + errorMessage_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +     * Required. Error details explaining why ingestion to Pub/Sub has failed.
    +     * 
    + * + * string error_message = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for errorMessage. + */ + public com.google.protobuf.ByteString getErrorMessageBytes() { + java.lang.Object ref = errorMessage_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + errorMessage_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +     * Required. Error details explaining why ingestion to Pub/Sub has failed.
    +     * 
    + * + * string error_message = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The errorMessage to set. + * @return This builder for chaining. + */ + public Builder setErrorMessage(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + errorMessage_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Required. Error details explaining why ingestion to Pub/Sub has failed.
    +     * 
    + * + * string error_message = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearErrorMessage() { + errorMessage_ = getDefaultInstance().getErrorMessage(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + + /** + * + * + *
    +     * Required. Error details explaining why ingestion to Pub/Sub has failed.
    +     * 
    + * + * string error_message = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for errorMessage to set. + * @return This builder for chaining. + */ + public Builder setErrorMessageBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + errorMessage_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure, + com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure.Builder, + com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailureOrBuilder> + cloudStorageFailureBuilder_; + + /** + * + * + *
    +     * Optional. Failure when ingesting from Cloud Storage.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure cloud_storage_failure = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the cloudStorageFailure field is set. + */ + @java.lang.Override + public boolean hasCloudStorageFailure() { + return failureCase_ == 3; + } + + /** + * + * + *
    +     * Optional. Failure when ingesting from Cloud Storage.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure cloud_storage_failure = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The cloudStorageFailure. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure getCloudStorageFailure() { + if (cloudStorageFailureBuilder_ == null) { + if (failureCase_ == 3) { + return (com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure) failure_; + } + return com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure.getDefaultInstance(); + } else { + if (failureCase_ == 3) { + return cloudStorageFailureBuilder_.getMessage(); + } + return com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure.getDefaultInstance(); + } + } + + /** + * + * + *
    +     * Optional. Failure when ingesting from Cloud Storage.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure cloud_storage_failure = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setCloudStorageFailure( + com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure value) { + if (cloudStorageFailureBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + failure_ = value; + onChanged(); + } else { + cloudStorageFailureBuilder_.setMessage(value); + } + failureCase_ = 3; + return this; + } + + /** + * + * + *
    +     * Optional. Failure when ingesting from Cloud Storage.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure cloud_storage_failure = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setCloudStorageFailure( + com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure.Builder builderForValue) { + if (cloudStorageFailureBuilder_ == null) { + failure_ = builderForValue.build(); + onChanged(); + } else { + cloudStorageFailureBuilder_.setMessage(builderForValue.build()); + } + failureCase_ = 3; + return this; + } + + /** + * + * + *
    +     * Optional. Failure when ingesting from Cloud Storage.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure cloud_storage_failure = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeCloudStorageFailure( + com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure value) { + if (cloudStorageFailureBuilder_ == null) { + if (failureCase_ == 3 + && failure_ + != com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure + .getDefaultInstance()) { + failure_ = + com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure.newBuilder( + (com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure) failure_) + .mergeFrom(value) + .buildPartial(); + } else { + failure_ = value; + } + onChanged(); + } else { + if (failureCase_ == 3) { + cloudStorageFailureBuilder_.mergeFrom(value); + } else { + cloudStorageFailureBuilder_.setMessage(value); + } + } + failureCase_ = 3; + return this; + } + + /** + * + * + *
    +     * Optional. Failure when ingesting from Cloud Storage.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure cloud_storage_failure = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearCloudStorageFailure() { + if (cloudStorageFailureBuilder_ == null) { + if (failureCase_ == 3) { + failureCase_ = 0; + failure_ = null; + onChanged(); + } + } else { + if (failureCase_ == 3) { + failureCase_ = 0; + failure_ = null; + } + cloudStorageFailureBuilder_.clear(); + } + return this; + } + + /** + * + * + *
    +     * Optional. Failure when ingesting from Cloud Storage.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure cloud_storage_failure = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure.Builder + getCloudStorageFailureBuilder() { + return internalGetCloudStorageFailureFieldBuilder().getBuilder(); + } + + /** + * + * + *
    +     * Optional. Failure when ingesting from Cloud Storage.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure cloud_storage_failure = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailureOrBuilder + getCloudStorageFailureOrBuilder() { + if ((failureCase_ == 3) && (cloudStorageFailureBuilder_ != null)) { + return cloudStorageFailureBuilder_.getMessageOrBuilder(); + } else { + if (failureCase_ == 3) { + return (com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure) failure_; + } + return com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure.getDefaultInstance(); + } + } + + /** + * + * + *
    +     * Optional. Failure when ingesting from Cloud Storage.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure cloud_storage_failure = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure, + com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure.Builder, + com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailureOrBuilder> + internalGetCloudStorageFailureFieldBuilder() { + if (cloudStorageFailureBuilder_ == null) { + if (!(failureCase_ == 3)) { + failure_ = + com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure.getDefaultInstance(); + } + cloudStorageFailureBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure, + com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure.Builder, + com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailureOrBuilder>( + (com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure) failure_, + getParentForChildren(), + isClean()); + failure_ = null; + } + failureCase_ = 3; + onChanged(); + return cloudStorageFailureBuilder_; + } + + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason, + com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason.Builder, + com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReasonOrBuilder> + awsMskFailureBuilder_; + + /** + * + * + *
    +     * Optional. Failure when ingesting from Amazon MSK.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason aws_msk_failure = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the awsMskFailure field is set. + */ + @java.lang.Override + public boolean hasAwsMskFailure() { + return failureCase_ == 4; + } + + /** + * + * + *
    +     * Optional. Failure when ingesting from Amazon MSK.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason aws_msk_failure = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The awsMskFailure. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason getAwsMskFailure() { + if (awsMskFailureBuilder_ == null) { + if (failureCase_ == 4) { + return (com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason) failure_; + } + return com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason.getDefaultInstance(); + } else { + if (failureCase_ == 4) { + return awsMskFailureBuilder_.getMessage(); + } + return com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason.getDefaultInstance(); + } + } + + /** + * + * + *
    +     * Optional. Failure when ingesting from Amazon MSK.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason aws_msk_failure = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setAwsMskFailure( + com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason value) { + if (awsMskFailureBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + failure_ = value; + onChanged(); + } else { + awsMskFailureBuilder_.setMessage(value); + } + failureCase_ = 4; + return this; + } + + /** + * + * + *
    +     * Optional. Failure when ingesting from Amazon MSK.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason aws_msk_failure = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setAwsMskFailure( + com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason.Builder builderForValue) { + if (awsMskFailureBuilder_ == null) { + failure_ = builderForValue.build(); + onChanged(); + } else { + awsMskFailureBuilder_.setMessage(builderForValue.build()); + } + failureCase_ = 4; + return this; + } + + /** + * + * + *
    +     * Optional. Failure when ingesting from Amazon MSK.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason aws_msk_failure = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeAwsMskFailure( + com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason value) { + if (awsMskFailureBuilder_ == null) { + if (failureCase_ == 4 + && failure_ + != com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason + .getDefaultInstance()) { + failure_ = + com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason.newBuilder( + (com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason) failure_) + .mergeFrom(value) + .buildPartial(); + } else { + failure_ = value; + } + onChanged(); + } else { + if (failureCase_ == 4) { + awsMskFailureBuilder_.mergeFrom(value); + } else { + awsMskFailureBuilder_.setMessage(value); + } + } + failureCase_ = 4; + return this; + } + + /** + * + * + *
    +     * Optional. Failure when ingesting from Amazon MSK.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason aws_msk_failure = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearAwsMskFailure() { + if (awsMskFailureBuilder_ == null) { + if (failureCase_ == 4) { + failureCase_ = 0; + failure_ = null; + onChanged(); + } + } else { + if (failureCase_ == 4) { + failureCase_ = 0; + failure_ = null; + } + awsMskFailureBuilder_.clear(); + } + return this; + } + + /** + * + * + *
    +     * Optional. Failure when ingesting from Amazon MSK.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason aws_msk_failure = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason.Builder + getAwsMskFailureBuilder() { + return internalGetAwsMskFailureFieldBuilder().getBuilder(); + } + + /** + * + * + *
    +     * Optional. Failure when ingesting from Amazon MSK.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason aws_msk_failure = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReasonOrBuilder + getAwsMskFailureOrBuilder() { + if ((failureCase_ == 4) && (awsMskFailureBuilder_ != null)) { + return awsMskFailureBuilder_.getMessageOrBuilder(); + } else { + if (failureCase_ == 4) { + return (com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason) failure_; + } + return com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason.getDefaultInstance(); + } + } + + /** + * + * + *
    +     * Optional. Failure when ingesting from Amazon MSK.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason aws_msk_failure = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason, + com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason.Builder, + com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReasonOrBuilder> + internalGetAwsMskFailureFieldBuilder() { + if (awsMskFailureBuilder_ == null) { + if (!(failureCase_ == 4)) { + failure_ = + com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason.getDefaultInstance(); + } + awsMskFailureBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason, + com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason.Builder, + com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReasonOrBuilder>( + (com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason) failure_, + getParentForChildren(), + isClean()); + failure_ = null; + } + failureCase_ = 4; + onChanged(); + return awsMskFailureBuilder_; + } + + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason, + com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason.Builder, + com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReasonOrBuilder> + azureEventHubsFailureBuilder_; + + /** + * + * + *
    +     * Optional. Failure when ingesting from Azure Event Hubs.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason azure_event_hubs_failure = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the azureEventHubsFailure field is set. + */ + @java.lang.Override + public boolean hasAzureEventHubsFailure() { + return failureCase_ == 5; + } + + /** + * + * + *
    +     * Optional. Failure when ingesting from Azure Event Hubs.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason azure_event_hubs_failure = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The azureEventHubsFailure. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason + getAzureEventHubsFailure() { + if (azureEventHubsFailureBuilder_ == null) { + if (failureCase_ == 5) { + return (com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason) failure_; + } + return com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason + .getDefaultInstance(); + } else { + if (failureCase_ == 5) { + return azureEventHubsFailureBuilder_.getMessage(); + } + return com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason + .getDefaultInstance(); + } + } + + /** + * + * + *
    +     * Optional. Failure when ingesting from Azure Event Hubs.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason azure_event_hubs_failure = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setAzureEventHubsFailure( + com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason value) { + if (azureEventHubsFailureBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + failure_ = value; + onChanged(); + } else { + azureEventHubsFailureBuilder_.setMessage(value); + } + failureCase_ = 5; + return this; + } + + /** + * + * + *
    +     * Optional. Failure when ingesting from Azure Event Hubs.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason azure_event_hubs_failure = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setAzureEventHubsFailure( + com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason.Builder + builderForValue) { + if (azureEventHubsFailureBuilder_ == null) { + failure_ = builderForValue.build(); + onChanged(); + } else { + azureEventHubsFailureBuilder_.setMessage(builderForValue.build()); + } + failureCase_ = 5; + return this; + } + + /** + * + * + *
    +     * Optional. Failure when ingesting from Azure Event Hubs.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason azure_event_hubs_failure = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeAzureEventHubsFailure( + com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason value) { + if (azureEventHubsFailureBuilder_ == null) { + if (failureCase_ == 5 + && failure_ + != com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason + .getDefaultInstance()) { + failure_ = + com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason.newBuilder( + (com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason) + failure_) + .mergeFrom(value) + .buildPartial(); + } else { + failure_ = value; + } + onChanged(); + } else { + if (failureCase_ == 5) { + azureEventHubsFailureBuilder_.mergeFrom(value); + } else { + azureEventHubsFailureBuilder_.setMessage(value); + } + } + failureCase_ = 5; + return this; + } + + /** + * + * + *
    +     * Optional. Failure when ingesting from Azure Event Hubs.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason azure_event_hubs_failure = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearAzureEventHubsFailure() { + if (azureEventHubsFailureBuilder_ == null) { + if (failureCase_ == 5) { + failureCase_ = 0; + failure_ = null; + onChanged(); + } + } else { + if (failureCase_ == 5) { + failureCase_ = 0; + failure_ = null; + } + azureEventHubsFailureBuilder_.clear(); + } + return this; + } + + /** + * + * + *
    +     * Optional. Failure when ingesting from Azure Event Hubs.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason azure_event_hubs_failure = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason.Builder + getAzureEventHubsFailureBuilder() { + return internalGetAzureEventHubsFailureFieldBuilder().getBuilder(); + } + + /** + * + * + *
    +     * Optional. Failure when ingesting from Azure Event Hubs.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason azure_event_hubs_failure = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReasonOrBuilder + getAzureEventHubsFailureOrBuilder() { + if ((failureCase_ == 5) && (azureEventHubsFailureBuilder_ != null)) { + return azureEventHubsFailureBuilder_.getMessageOrBuilder(); + } else { + if (failureCase_ == 5) { + return (com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason) failure_; + } + return com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason + .getDefaultInstance(); + } + } + + /** + * + * + *
    +     * Optional. Failure when ingesting from Azure Event Hubs.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason azure_event_hubs_failure = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason, + com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason.Builder, + com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReasonOrBuilder> + internalGetAzureEventHubsFailureFieldBuilder() { + if (azureEventHubsFailureBuilder_ == null) { + if (!(failureCase_ == 5)) { + failure_ = + com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason + .getDefaultInstance(); + } + azureEventHubsFailureBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason, + com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason.Builder, + com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReasonOrBuilder>( + (com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason) failure_, + getParentForChildren(), + isClean()); + failure_ = null; + } + failureCase_ = 5; + onChanged(); + return azureEventHubsFailureBuilder_; + } + + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason, + com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason.Builder, + com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReasonOrBuilder> + confluentCloudFailureBuilder_; + + /** + * + * + *
    +     * Optional. Failure when ingesting from Confluent Cloud.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason confluent_cloud_failure = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the confluentCloudFailure field is set. + */ + @java.lang.Override + public boolean hasConfluentCloudFailure() { + return failureCase_ == 6; + } + + /** + * + * + *
    +     * Optional. Failure when ingesting from Confluent Cloud.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason confluent_cloud_failure = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The confluentCloudFailure. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason + getConfluentCloudFailure() { + if (confluentCloudFailureBuilder_ == null) { + if (failureCase_ == 6) { + return (com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason) failure_; + } + return com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason + .getDefaultInstance(); + } else { + if (failureCase_ == 6) { + return confluentCloudFailureBuilder_.getMessage(); + } + return com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason + .getDefaultInstance(); + } + } + + /** + * + * + *
    +     * Optional. Failure when ingesting from Confluent Cloud.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason confluent_cloud_failure = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setConfluentCloudFailure( + com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason value) { + if (confluentCloudFailureBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + failure_ = value; + onChanged(); + } else { + confluentCloudFailureBuilder_.setMessage(value); + } + failureCase_ = 6; + return this; + } + + /** + * + * + *
    +     * Optional. Failure when ingesting from Confluent Cloud.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason confluent_cloud_failure = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setConfluentCloudFailure( + com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason.Builder + builderForValue) { + if (confluentCloudFailureBuilder_ == null) { + failure_ = builderForValue.build(); + onChanged(); + } else { + confluentCloudFailureBuilder_.setMessage(builderForValue.build()); + } + failureCase_ = 6; + return this; + } + + /** + * + * + *
    +     * Optional. Failure when ingesting from Confluent Cloud.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason confluent_cloud_failure = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeConfluentCloudFailure( + com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason value) { + if (confluentCloudFailureBuilder_ == null) { + if (failureCase_ == 6 + && failure_ + != com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason + .getDefaultInstance()) { + failure_ = + com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason.newBuilder( + (com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason) + failure_) + .mergeFrom(value) + .buildPartial(); + } else { + failure_ = value; + } + onChanged(); + } else { + if (failureCase_ == 6) { + confluentCloudFailureBuilder_.mergeFrom(value); + } else { + confluentCloudFailureBuilder_.setMessage(value); + } + } + failureCase_ = 6; + return this; + } + + /** + * + * + *
    +     * Optional. Failure when ingesting from Confluent Cloud.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason confluent_cloud_failure = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearConfluentCloudFailure() { + if (confluentCloudFailureBuilder_ == null) { + if (failureCase_ == 6) { + failureCase_ = 0; + failure_ = null; + onChanged(); + } + } else { + if (failureCase_ == 6) { + failureCase_ = 0; + failure_ = null; + } + confluentCloudFailureBuilder_.clear(); + } + return this; + } + + /** + * + * + *
    +     * Optional. Failure when ingesting from Confluent Cloud.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason confluent_cloud_failure = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason.Builder + getConfluentCloudFailureBuilder() { + return internalGetConfluentCloudFailureFieldBuilder().getBuilder(); + } + + /** + * + * + *
    +     * Optional. Failure when ingesting from Confluent Cloud.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason confluent_cloud_failure = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReasonOrBuilder + getConfluentCloudFailureOrBuilder() { + if ((failureCase_ == 6) && (confluentCloudFailureBuilder_ != null)) { + return confluentCloudFailureBuilder_.getMessageOrBuilder(); + } else { + if (failureCase_ == 6) { + return (com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason) failure_; + } + return com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason + .getDefaultInstance(); + } + } + + /** + * + * + *
    +     * Optional. Failure when ingesting from Confluent Cloud.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason confluent_cloud_failure = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason, + com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason.Builder, + com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReasonOrBuilder> + internalGetConfluentCloudFailureFieldBuilder() { + if (confluentCloudFailureBuilder_ == null) { + if (!(failureCase_ == 6)) { + failure_ = + com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason + .getDefaultInstance(); + } + confluentCloudFailureBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason, + com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason.Builder, + com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReasonOrBuilder>( + (com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason) failure_, + getParentForChildren(), + isClean()); + failure_ = null; + } + failureCase_ = 6; + onChanged(); + return confluentCloudFailureBuilder_; + } + + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason, + com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason.Builder, + com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReasonOrBuilder> + awsKinesisFailureBuilder_; + + /** + * + * + *
    +     * Optional. Failure when ingesting from AWS Kinesis.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason aws_kinesis_failure = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the awsKinesisFailure field is set. + */ + @java.lang.Override + public boolean hasAwsKinesisFailure() { + return failureCase_ == 7; + } + + /** + * + * + *
    +     * Optional. Failure when ingesting from AWS Kinesis.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason aws_kinesis_failure = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The awsKinesisFailure. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason + getAwsKinesisFailure() { + if (awsKinesisFailureBuilder_ == null) { + if (failureCase_ == 7) { + return (com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason) failure_; + } + return com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason + .getDefaultInstance(); + } else { + if (failureCase_ == 7) { + return awsKinesisFailureBuilder_.getMessage(); + } + return com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason + .getDefaultInstance(); + } + } + + /** + * + * + *
    +     * Optional. Failure when ingesting from AWS Kinesis.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason aws_kinesis_failure = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setAwsKinesisFailure( + com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason value) { + if (awsKinesisFailureBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + failure_ = value; + onChanged(); + } else { + awsKinesisFailureBuilder_.setMessage(value); + } + failureCase_ = 7; + return this; + } + + /** + * + * + *
    +     * Optional. Failure when ingesting from AWS Kinesis.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason aws_kinesis_failure = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setAwsKinesisFailure( + com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason.Builder + builderForValue) { + if (awsKinesisFailureBuilder_ == null) { + failure_ = builderForValue.build(); + onChanged(); + } else { + awsKinesisFailureBuilder_.setMessage(builderForValue.build()); + } + failureCase_ = 7; + return this; + } + + /** + * + * + *
    +     * Optional. Failure when ingesting from AWS Kinesis.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason aws_kinesis_failure = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeAwsKinesisFailure( + com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason value) { + if (awsKinesisFailureBuilder_ == null) { + if (failureCase_ == 7 + && failure_ + != com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason + .getDefaultInstance()) { + failure_ = + com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason.newBuilder( + (com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason) failure_) + .mergeFrom(value) + .buildPartial(); + } else { + failure_ = value; + } + onChanged(); + } else { + if (failureCase_ == 7) { + awsKinesisFailureBuilder_.mergeFrom(value); + } else { + awsKinesisFailureBuilder_.setMessage(value); + } + } + failureCase_ = 7; + return this; + } + + /** + * + * + *
    +     * Optional. Failure when ingesting from AWS Kinesis.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason aws_kinesis_failure = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearAwsKinesisFailure() { + if (awsKinesisFailureBuilder_ == null) { + if (failureCase_ == 7) { + failureCase_ = 0; + failure_ = null; + onChanged(); + } + } else { + if (failureCase_ == 7) { + failureCase_ = 0; + failure_ = null; + } + awsKinesisFailureBuilder_.clear(); + } + return this; + } + + /** + * + * + *
    +     * Optional. Failure when ingesting from AWS Kinesis.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason aws_kinesis_failure = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason.Builder + getAwsKinesisFailureBuilder() { + return internalGetAwsKinesisFailureFieldBuilder().getBuilder(); + } + + /** + * + * + *
    +     * Optional. Failure when ingesting from AWS Kinesis.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason aws_kinesis_failure = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReasonOrBuilder + getAwsKinesisFailureOrBuilder() { + if ((failureCase_ == 7) && (awsKinesisFailureBuilder_ != null)) { + return awsKinesisFailureBuilder_.getMessageOrBuilder(); + } else { + if (failureCase_ == 7) { + return (com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason) failure_; + } + return com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason + .getDefaultInstance(); + } + } + + /** + * + * + *
    +     * Optional. Failure when ingesting from AWS Kinesis.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason aws_kinesis_failure = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason, + com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason.Builder, + com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReasonOrBuilder> + internalGetAwsKinesisFailureFieldBuilder() { + if (awsKinesisFailureBuilder_ == null) { + if (!(failureCase_ == 7)) { + failure_ = + com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason + .getDefaultInstance(); + } + awsKinesisFailureBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason, + com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason.Builder, + com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReasonOrBuilder>( + (com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason) failure_, + getParentForChildren(), + isClean()); + failure_ = null; + } + failureCase_ = 7; + onChanged(); + return awsKinesisFailureBuilder_; + } + + // @@protoc_insertion_point(builder_scope:google.pubsub.v1.IngestionFailureEvent) + } + + // @@protoc_insertion_point(class_scope:google.pubsub.v1.IngestionFailureEvent) + private static final com.google.pubsub.v1.IngestionFailureEvent DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.pubsub.v1.IngestionFailureEvent(); + } + + public static com.google.pubsub.v1.IngestionFailureEvent getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public IngestionFailureEvent parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.pubsub.v1.IngestionFailureEvent getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} 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 new file mode 100644 index 000000000..3fe15ccd9 --- /dev/null +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/IngestionFailureEventOrBuilder.java @@ -0,0 +1,308 @@ +/* + * Copyright 2026 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 + +package com.google.pubsub.v1; + +@com.google.protobuf.Generated +public interface IngestionFailureEventOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.pubsub.v1.IngestionFailureEvent) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
    +   * Required. Name of the import topic. Format is:
    +   * projects/{project_name}/topics/{topic_name}.
    +   * 
    + * + * + * string topic = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The topic. + */ + java.lang.String getTopic(); + + /** + * + * + *
    +   * Required. Name of the import topic. Format is:
    +   * projects/{project_name}/topics/{topic_name}.
    +   * 
    + * + * + * string topic = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for topic. + */ + com.google.protobuf.ByteString getTopicBytes(); + + /** + * + * + *
    +   * Required. Error details explaining why ingestion to Pub/Sub has failed.
    +   * 
    + * + * string error_message = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The errorMessage. + */ + java.lang.String getErrorMessage(); + + /** + * + * + *
    +   * Required. Error details explaining why ingestion to Pub/Sub has failed.
    +   * 
    + * + * string error_message = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for errorMessage. + */ + com.google.protobuf.ByteString getErrorMessageBytes(); + + /** + * + * + *
    +   * Optional. Failure when ingesting from Cloud Storage.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure cloud_storage_failure = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the cloudStorageFailure field is set. + */ + boolean hasCloudStorageFailure(); + + /** + * + * + *
    +   * Optional. Failure when ingesting from Cloud Storage.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure cloud_storage_failure = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The cloudStorageFailure. + */ + com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure getCloudStorageFailure(); + + /** + * + * + *
    +   * Optional. Failure when ingesting from Cloud Storage.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure cloud_storage_failure = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailureOrBuilder + getCloudStorageFailureOrBuilder(); + + /** + * + * + *
    +   * Optional. Failure when ingesting from Amazon MSK.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason aws_msk_failure = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the awsMskFailure field is set. + */ + boolean hasAwsMskFailure(); + + /** + * + * + *
    +   * Optional. Failure when ingesting from Amazon MSK.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason aws_msk_failure = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The awsMskFailure. + */ + com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason getAwsMskFailure(); + + /** + * + * + *
    +   * Optional. Failure when ingesting from Amazon MSK.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason aws_msk_failure = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReasonOrBuilder + getAwsMskFailureOrBuilder(); + + /** + * + * + *
    +   * Optional. Failure when ingesting from Azure Event Hubs.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason azure_event_hubs_failure = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the azureEventHubsFailure field is set. + */ + boolean hasAzureEventHubsFailure(); + + /** + * + * + *
    +   * Optional. Failure when ingesting from Azure Event Hubs.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason azure_event_hubs_failure = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The azureEventHubsFailure. + */ + com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason getAzureEventHubsFailure(); + + /** + * + * + *
    +   * Optional. Failure when ingesting from Azure Event Hubs.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason azure_event_hubs_failure = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReasonOrBuilder + getAzureEventHubsFailureOrBuilder(); + + /** + * + * + *
    +   * Optional. Failure when ingesting from Confluent Cloud.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason confluent_cloud_failure = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the confluentCloudFailure field is set. + */ + boolean hasConfluentCloudFailure(); + + /** + * + * + *
    +   * Optional. Failure when ingesting from Confluent Cloud.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason confluent_cloud_failure = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The confluentCloudFailure. + */ + com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason getConfluentCloudFailure(); + + /** + * + * + *
    +   * Optional. Failure when ingesting from Confluent Cloud.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason confluent_cloud_failure = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReasonOrBuilder + getConfluentCloudFailureOrBuilder(); + + /** + * + * + *
    +   * Optional. Failure when ingesting from AWS Kinesis.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason aws_kinesis_failure = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the awsKinesisFailure field is set. + */ + boolean hasAwsKinesisFailure(); + + /** + * + * + *
    +   * Optional. Failure when ingesting from AWS Kinesis.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason aws_kinesis_failure = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The awsKinesisFailure. + */ + com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason getAwsKinesisFailure(); + + /** + * + * + *
    +   * Optional. Failure when ingesting from AWS Kinesis.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason aws_kinesis_failure = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReasonOrBuilder + getAwsKinesisFailureOrBuilder(); + + com.google.pubsub.v1.IngestionFailureEvent.FailureCase getFailureCase(); +} diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/JavaScriptUDF.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/JavaScriptUDF.java new file mode 100644 index 000000000..18ac95eb0 --- /dev/null +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/JavaScriptUDF.java @@ -0,0 +1,993 @@ +/* + * Copyright 2026 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 + +package com.google.pubsub.v1; + +/** + * + * + *
    + * User-defined JavaScript function that can transform or filter a Pub/Sub
    + * message.
    + * 
    + * + * Protobuf type {@code google.pubsub.v1.JavaScriptUDF} + */ +@com.google.protobuf.Generated +public final class JavaScriptUDF extends com.google.protobuf.GeneratedMessage + implements + // @@protoc_insertion_point(message_implements:google.pubsub.v1.JavaScriptUDF) + JavaScriptUDFOrBuilder { + private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "JavaScriptUDF"); + } + + // Use JavaScriptUDF.newBuilder() to construct. + private JavaScriptUDF(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + + private JavaScriptUDF() { + functionName_ = ""; + code_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_JavaScriptUDF_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_JavaScriptUDF_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.JavaScriptUDF.class, + com.google.pubsub.v1.JavaScriptUDF.Builder.class); + } + + public static final int FUNCTION_NAME_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object functionName_ = ""; + + /** + * + * + *
    +   * Required. Name of the JavasScript function that should applied to Pub/Sub
    +   * messages.
    +   * 
    + * + * string function_name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The functionName. + */ + @java.lang.Override + public java.lang.String getFunctionName() { + java.lang.Object ref = functionName_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + functionName_ = s; + return s; + } + } + + /** + * + * + *
    +   * Required. Name of the JavasScript function that should applied to Pub/Sub
    +   * messages.
    +   * 
    + * + * string function_name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for functionName. + */ + @java.lang.Override + public com.google.protobuf.ByteString getFunctionNameBytes() { + java.lang.Object ref = functionName_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + functionName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CODE_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private volatile java.lang.Object code_ = ""; + + /** + * + * + *
    +   * Required. JavaScript code that contains a function `function_name` with the
    +   * below signature:
    +   *
    +   * ```
    +   * /**
    +   * * Transforms a Pub/Sub message.
    +   *
    +   * * @return {(Object<string, (string | Object<string, string>)>|null)} - To
    +   * * filter a message, return `null`. To transform a message return a map
    +   * * with the following keys:
    +   * *   - (required) 'data' : {string}
    +   * *   - (optional) 'attributes' : {Object<string, string>}
    +   * * Returning empty `attributes` will remove all attributes from the
    +   * * message.
    +   * *
    +   * * @param  {(Object<string, (string | Object<string, string>)>} Pub/Sub
    +   * * message. Keys:
    +   * *   - (required) 'data' : {string}
    +   * *   - (required) 'attributes' : {Object<string, string>}
    +   * *
    +   * * @param  {Object<string, any>} metadata - Pub/Sub message metadata.
    +   * * Keys:
    +   * *   - (optional) 'message_id'  : {string}
    +   * *   - (optional) 'publish_time': {string} YYYY-MM-DDTHH:MM:SSZ format
    +   * *   - (optional) 'ordering_key': {string}
    +   * */
    +   *
    +   * function <function_name>(message, metadata) {
    +   * }
    +   * ```
    +   * 
    + * + * string code = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The code. + */ + @java.lang.Override + public java.lang.String getCode() { + java.lang.Object ref = code_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + code_ = s; + return s; + } + } + + /** + * + * + *
    +   * Required. JavaScript code that contains a function `function_name` with the
    +   * below signature:
    +   *
    +   * ```
    +   * /**
    +   * * Transforms a Pub/Sub message.
    +   *
    +   * * @return {(Object<string, (string | Object<string, string>)>|null)} - To
    +   * * filter a message, return `null`. To transform a message return a map
    +   * * with the following keys:
    +   * *   - (required) 'data' : {string}
    +   * *   - (optional) 'attributes' : {Object<string, string>}
    +   * * Returning empty `attributes` will remove all attributes from the
    +   * * message.
    +   * *
    +   * * @param  {(Object<string, (string | Object<string, string>)>} Pub/Sub
    +   * * message. Keys:
    +   * *   - (required) 'data' : {string}
    +   * *   - (required) 'attributes' : {Object<string, string>}
    +   * *
    +   * * @param  {Object<string, any>} metadata - Pub/Sub message metadata.
    +   * * Keys:
    +   * *   - (optional) 'message_id'  : {string}
    +   * *   - (optional) 'publish_time': {string} YYYY-MM-DDTHH:MM:SSZ format
    +   * *   - (optional) 'ordering_key': {string}
    +   * */
    +   *
    +   * function <function_name>(message, metadata) {
    +   * }
    +   * ```
    +   * 
    + * + * string code = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for code. + */ + @java.lang.Override + public com.google.protobuf.ByteString getCodeBytes() { + java.lang.Object ref = code_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + code_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(functionName_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, functionName_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(code_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, code_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(functionName_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, functionName_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(code_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, code_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.pubsub.v1.JavaScriptUDF)) { + return super.equals(obj); + } + com.google.pubsub.v1.JavaScriptUDF other = (com.google.pubsub.v1.JavaScriptUDF) obj; + + if (!getFunctionName().equals(other.getFunctionName())) return false; + if (!getCode().equals(other.getCode())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + FUNCTION_NAME_FIELD_NUMBER; + hash = (53 * hash) + getFunctionName().hashCode(); + hash = (37 * hash) + CODE_FIELD_NUMBER; + hash = (53 * hash) + getCode().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.pubsub.v1.JavaScriptUDF parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.JavaScriptUDF parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.JavaScriptUDF parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.JavaScriptUDF parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.JavaScriptUDF parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.JavaScriptUDF parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.JavaScriptUDF parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.JavaScriptUDF parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.JavaScriptUDF parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.JavaScriptUDF parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.JavaScriptUDF parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.JavaScriptUDF parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.pubsub.v1.JavaScriptUDF prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + + /** + * + * + *
    +   * User-defined JavaScript function that can transform or filter a Pub/Sub
    +   * message.
    +   * 
    + * + * Protobuf type {@code google.pubsub.v1.JavaScriptUDF} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder + implements + // @@protoc_insertion_point(builder_implements:google.pubsub.v1.JavaScriptUDF) + com.google.pubsub.v1.JavaScriptUDFOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_JavaScriptUDF_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_JavaScriptUDF_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.JavaScriptUDF.class, + com.google.pubsub.v1.JavaScriptUDF.Builder.class); + } + + // Construct using com.google.pubsub.v1.JavaScriptUDF.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + functionName_ = ""; + code_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_JavaScriptUDF_descriptor; + } + + @java.lang.Override + public com.google.pubsub.v1.JavaScriptUDF getDefaultInstanceForType() { + return com.google.pubsub.v1.JavaScriptUDF.getDefaultInstance(); + } + + @java.lang.Override + public com.google.pubsub.v1.JavaScriptUDF build() { + com.google.pubsub.v1.JavaScriptUDF result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.pubsub.v1.JavaScriptUDF buildPartial() { + com.google.pubsub.v1.JavaScriptUDF result = new com.google.pubsub.v1.JavaScriptUDF(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.pubsub.v1.JavaScriptUDF result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.functionName_ = functionName_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.code_ = code_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.pubsub.v1.JavaScriptUDF) { + return mergeFrom((com.google.pubsub.v1.JavaScriptUDF) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.pubsub.v1.JavaScriptUDF other) { + if (other == com.google.pubsub.v1.JavaScriptUDF.getDefaultInstance()) return this; + if (!other.getFunctionName().isEmpty()) { + functionName_ = other.functionName_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getCode().isEmpty()) { + code_ = other.code_; + bitField0_ |= 0x00000002; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + functionName_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + code_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.lang.Object functionName_ = ""; + + /** + * + * + *
    +     * Required. Name of the JavasScript function that should applied to Pub/Sub
    +     * messages.
    +     * 
    + * + * string function_name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The functionName. + */ + public java.lang.String getFunctionName() { + java.lang.Object ref = functionName_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + functionName_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +     * Required. Name of the JavasScript function that should applied to Pub/Sub
    +     * messages.
    +     * 
    + * + * string function_name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for functionName. + */ + public com.google.protobuf.ByteString getFunctionNameBytes() { + java.lang.Object ref = functionName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + functionName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +     * Required. Name of the JavasScript function that should applied to Pub/Sub
    +     * messages.
    +     * 
    + * + * string function_name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The functionName to set. + * @return This builder for chaining. + */ + public Builder setFunctionName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + functionName_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Required. Name of the JavasScript function that should applied to Pub/Sub
    +     * messages.
    +     * 
    + * + * string function_name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearFunctionName() { + functionName_ = getDefaultInstance().getFunctionName(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + + /** + * + * + *
    +     * Required. Name of the JavasScript function that should applied to Pub/Sub
    +     * messages.
    +     * 
    + * + * string function_name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for functionName to set. + * @return This builder for chaining. + */ + public Builder setFunctionNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + functionName_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object code_ = ""; + + /** + * + * + *
    +     * Required. JavaScript code that contains a function `function_name` with the
    +     * below signature:
    +     *
    +     * ```
    +     * /**
    +     * * Transforms a Pub/Sub message.
    +     *
    +     * * @return {(Object<string, (string | Object<string, string>)>|null)} - To
    +     * * filter a message, return `null`. To transform a message return a map
    +     * * with the following keys:
    +     * *   - (required) 'data' : {string}
    +     * *   - (optional) 'attributes' : {Object<string, string>}
    +     * * Returning empty `attributes` will remove all attributes from the
    +     * * message.
    +     * *
    +     * * @param  {(Object<string, (string | Object<string, string>)>} Pub/Sub
    +     * * message. Keys:
    +     * *   - (required) 'data' : {string}
    +     * *   - (required) 'attributes' : {Object<string, string>}
    +     * *
    +     * * @param  {Object<string, any>} metadata - Pub/Sub message metadata.
    +     * * Keys:
    +     * *   - (optional) 'message_id'  : {string}
    +     * *   - (optional) 'publish_time': {string} YYYY-MM-DDTHH:MM:SSZ format
    +     * *   - (optional) 'ordering_key': {string}
    +     * */
    +     *
    +     * function <function_name>(message, metadata) {
    +     * }
    +     * ```
    +     * 
    + * + * string code = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The code. + */ + public java.lang.String getCode() { + java.lang.Object ref = code_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + code_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +     * Required. JavaScript code that contains a function `function_name` with the
    +     * below signature:
    +     *
    +     * ```
    +     * /**
    +     * * Transforms a Pub/Sub message.
    +     *
    +     * * @return {(Object<string, (string | Object<string, string>)>|null)} - To
    +     * * filter a message, return `null`. To transform a message return a map
    +     * * with the following keys:
    +     * *   - (required) 'data' : {string}
    +     * *   - (optional) 'attributes' : {Object<string, string>}
    +     * * Returning empty `attributes` will remove all attributes from the
    +     * * message.
    +     * *
    +     * * @param  {(Object<string, (string | Object<string, string>)>} Pub/Sub
    +     * * message. Keys:
    +     * *   - (required) 'data' : {string}
    +     * *   - (required) 'attributes' : {Object<string, string>}
    +     * *
    +     * * @param  {Object<string, any>} metadata - Pub/Sub message metadata.
    +     * * Keys:
    +     * *   - (optional) 'message_id'  : {string}
    +     * *   - (optional) 'publish_time': {string} YYYY-MM-DDTHH:MM:SSZ format
    +     * *   - (optional) 'ordering_key': {string}
    +     * */
    +     *
    +     * function <function_name>(message, metadata) {
    +     * }
    +     * ```
    +     * 
    + * + * string code = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for code. + */ + public com.google.protobuf.ByteString getCodeBytes() { + java.lang.Object ref = code_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + code_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +     * Required. JavaScript code that contains a function `function_name` with the
    +     * below signature:
    +     *
    +     * ```
    +     * /**
    +     * * Transforms a Pub/Sub message.
    +     *
    +     * * @return {(Object<string, (string | Object<string, string>)>|null)} - To
    +     * * filter a message, return `null`. To transform a message return a map
    +     * * with the following keys:
    +     * *   - (required) 'data' : {string}
    +     * *   - (optional) 'attributes' : {Object<string, string>}
    +     * * Returning empty `attributes` will remove all attributes from the
    +     * * message.
    +     * *
    +     * * @param  {(Object<string, (string | Object<string, string>)>} Pub/Sub
    +     * * message. Keys:
    +     * *   - (required) 'data' : {string}
    +     * *   - (required) 'attributes' : {Object<string, string>}
    +     * *
    +     * * @param  {Object<string, any>} metadata - Pub/Sub message metadata.
    +     * * Keys:
    +     * *   - (optional) 'message_id'  : {string}
    +     * *   - (optional) 'publish_time': {string} YYYY-MM-DDTHH:MM:SSZ format
    +     * *   - (optional) 'ordering_key': {string}
    +     * */
    +     *
    +     * function <function_name>(message, metadata) {
    +     * }
    +     * ```
    +     * 
    + * + * string code = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The code to set. + * @return This builder for chaining. + */ + public Builder setCode(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + code_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Required. JavaScript code that contains a function `function_name` with the
    +     * below signature:
    +     *
    +     * ```
    +     * /**
    +     * * Transforms a Pub/Sub message.
    +     *
    +     * * @return {(Object<string, (string | Object<string, string>)>|null)} - To
    +     * * filter a message, return `null`. To transform a message return a map
    +     * * with the following keys:
    +     * *   - (required) 'data' : {string}
    +     * *   - (optional) 'attributes' : {Object<string, string>}
    +     * * Returning empty `attributes` will remove all attributes from the
    +     * * message.
    +     * *
    +     * * @param  {(Object<string, (string | Object<string, string>)>} Pub/Sub
    +     * * message. Keys:
    +     * *   - (required) 'data' : {string}
    +     * *   - (required) 'attributes' : {Object<string, string>}
    +     * *
    +     * * @param  {Object<string, any>} metadata - Pub/Sub message metadata.
    +     * * Keys:
    +     * *   - (optional) 'message_id'  : {string}
    +     * *   - (optional) 'publish_time': {string} YYYY-MM-DDTHH:MM:SSZ format
    +     * *   - (optional) 'ordering_key': {string}
    +     * */
    +     *
    +     * function <function_name>(message, metadata) {
    +     * }
    +     * ```
    +     * 
    + * + * string code = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearCode() { + code_ = getDefaultInstance().getCode(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + + /** + * + * + *
    +     * Required. JavaScript code that contains a function `function_name` with the
    +     * below signature:
    +     *
    +     * ```
    +     * /**
    +     * * Transforms a Pub/Sub message.
    +     *
    +     * * @return {(Object<string, (string | Object<string, string>)>|null)} - To
    +     * * filter a message, return `null`. To transform a message return a map
    +     * * with the following keys:
    +     * *   - (required) 'data' : {string}
    +     * *   - (optional) 'attributes' : {Object<string, string>}
    +     * * Returning empty `attributes` will remove all attributes from the
    +     * * message.
    +     * *
    +     * * @param  {(Object<string, (string | Object<string, string>)>} Pub/Sub
    +     * * message. Keys:
    +     * *   - (required) 'data' : {string}
    +     * *   - (required) 'attributes' : {Object<string, string>}
    +     * *
    +     * * @param  {Object<string, any>} metadata - Pub/Sub message metadata.
    +     * * Keys:
    +     * *   - (optional) 'message_id'  : {string}
    +     * *   - (optional) 'publish_time': {string} YYYY-MM-DDTHH:MM:SSZ format
    +     * *   - (optional) 'ordering_key': {string}
    +     * */
    +     *
    +     * function <function_name>(message, metadata) {
    +     * }
    +     * ```
    +     * 
    + * + * string code = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for code to set. + * @return This builder for chaining. + */ + public Builder setCodeBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + code_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:google.pubsub.v1.JavaScriptUDF) + } + + // @@protoc_insertion_point(class_scope:google.pubsub.v1.JavaScriptUDF) + private static final com.google.pubsub.v1.JavaScriptUDF DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.pubsub.v1.JavaScriptUDF(); + } + + public static com.google.pubsub.v1.JavaScriptUDF getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public JavaScriptUDF parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.pubsub.v1.JavaScriptUDF getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/JavaScriptUDFOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/JavaScriptUDFOrBuilder.java new file mode 100644 index 000000000..9e60471bf --- /dev/null +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/JavaScriptUDFOrBuilder.java @@ -0,0 +1,140 @@ +/* + * Copyright 2026 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 + +package com.google.pubsub.v1; + +@com.google.protobuf.Generated +public interface JavaScriptUDFOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.pubsub.v1.JavaScriptUDF) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
    +   * Required. Name of the JavasScript function that should applied to Pub/Sub
    +   * messages.
    +   * 
    + * + * string function_name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The functionName. + */ + java.lang.String getFunctionName(); + + /** + * + * + *
    +   * Required. Name of the JavasScript function that should applied to Pub/Sub
    +   * messages.
    +   * 
    + * + * string function_name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for functionName. + */ + com.google.protobuf.ByteString getFunctionNameBytes(); + + /** + * + * + *
    +   * Required. JavaScript code that contains a function `function_name` with the
    +   * below signature:
    +   *
    +   * ```
    +   * /**
    +   * * Transforms a Pub/Sub message.
    +   *
    +   * * @return {(Object<string, (string | Object<string, string>)>|null)} - To
    +   * * filter a message, return `null`. To transform a message return a map
    +   * * with the following keys:
    +   * *   - (required) 'data' : {string}
    +   * *   - (optional) 'attributes' : {Object<string, string>}
    +   * * Returning empty `attributes` will remove all attributes from the
    +   * * message.
    +   * *
    +   * * @param  {(Object<string, (string | Object<string, string>)>} Pub/Sub
    +   * * message. Keys:
    +   * *   - (required) 'data' : {string}
    +   * *   - (required) 'attributes' : {Object<string, string>}
    +   * *
    +   * * @param  {Object<string, any>} metadata - Pub/Sub message metadata.
    +   * * Keys:
    +   * *   - (optional) 'message_id'  : {string}
    +   * *   - (optional) 'publish_time': {string} YYYY-MM-DDTHH:MM:SSZ format
    +   * *   - (optional) 'ordering_key': {string}
    +   * */
    +   *
    +   * function <function_name>(message, metadata) {
    +   * }
    +   * ```
    +   * 
    + * + * string code = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The code. + */ + java.lang.String getCode(); + + /** + * + * + *
    +   * Required. JavaScript code that contains a function `function_name` with the
    +   * below signature:
    +   *
    +   * ```
    +   * /**
    +   * * Transforms a Pub/Sub message.
    +   *
    +   * * @return {(Object<string, (string | Object<string, string>)>|null)} - To
    +   * * filter a message, return `null`. To transform a message return a map
    +   * * with the following keys:
    +   * *   - (required) 'data' : {string}
    +   * *   - (optional) 'attributes' : {Object<string, string>}
    +   * * Returning empty `attributes` will remove all attributes from the
    +   * * message.
    +   * *
    +   * * @param  {(Object<string, (string | Object<string, string>)>} Pub/Sub
    +   * * message. Keys:
    +   * *   - (required) 'data' : {string}
    +   * *   - (required) 'attributes' : {Object<string, string>}
    +   * *
    +   * * @param  {Object<string, any>} metadata - Pub/Sub message metadata.
    +   * * Keys:
    +   * *   - (optional) 'message_id'  : {string}
    +   * *   - (optional) 'publish_time': {string} YYYY-MM-DDTHH:MM:SSZ format
    +   * *   - (optional) 'ordering_key': {string}
    +   * */
    +   *
    +   * function <function_name>(message, metadata) {
    +   * }
    +   * ```
    +   * 
    + * + * string code = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for code. + */ + com.google.protobuf.ByteString getCodeBytes(); +} diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSchemaRevisionsRequest.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSchemaRevisionsRequest.java new file mode 100644 index 000000000..f2a56f7b8 --- /dev/null +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSchemaRevisionsRequest.java @@ -0,0 +1,1070 @@ +/* + * Copyright 2026 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: google/pubsub/v1/schema.proto +// Protobuf Java Version: 4.33.2 + +package com.google.pubsub.v1; + +/** + * + * + *
    + * Request for the `ListSchemaRevisions` method.
    + * 
    + * + * Protobuf type {@code google.pubsub.v1.ListSchemaRevisionsRequest} + */ +@com.google.protobuf.Generated +public final class ListSchemaRevisionsRequest extends com.google.protobuf.GeneratedMessage + implements + // @@protoc_insertion_point(message_implements:google.pubsub.v1.ListSchemaRevisionsRequest) + ListSchemaRevisionsRequestOrBuilder { + private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "ListSchemaRevisionsRequest"); + } + + // Use ListSchemaRevisionsRequest.newBuilder() to construct. + private ListSchemaRevisionsRequest(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + + private ListSchemaRevisionsRequest() { + name_ = ""; + view_ = 0; + pageToken_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.SchemaProto + .internal_static_google_pubsub_v1_ListSchemaRevisionsRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.SchemaProto + .internal_static_google_pubsub_v1_ListSchemaRevisionsRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.ListSchemaRevisionsRequest.class, + com.google.pubsub.v1.ListSchemaRevisionsRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; + + /** + * + * + *
    +   * Required. The name of the schema to list revisions for.
    +   * 
    + * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + + /** + * + * + *
    +   * Required. The name of the schema to list revisions for.
    +   * 
    + * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int VIEW_FIELD_NUMBER = 2; + private int view_ = 0; + + /** + * + * + *
    +   * The set of Schema fields to return in the response. If not set, returns
    +   * Schemas with `name` and `type`, but not `definition`. Set to `FULL` to
    +   * retrieve all fields.
    +   * 
    + * + * .google.pubsub.v1.SchemaView view = 2; + * + * @return The enum numeric value on the wire for view. + */ + @java.lang.Override + public int getViewValue() { + return view_; + } + + /** + * + * + *
    +   * The set of Schema fields to return in the response. If not set, returns
    +   * Schemas with `name` and `type`, but not `definition`. Set to `FULL` to
    +   * retrieve all fields.
    +   * 
    + * + * .google.pubsub.v1.SchemaView view = 2; + * + * @return The view. + */ + @java.lang.Override + public com.google.pubsub.v1.SchemaView getView() { + com.google.pubsub.v1.SchemaView result = com.google.pubsub.v1.SchemaView.forNumber(view_); + return result == null ? com.google.pubsub.v1.SchemaView.UNRECOGNIZED : result; + } + + public static final int PAGE_SIZE_FIELD_NUMBER = 3; + private int pageSize_ = 0; + + /** + * + * + *
    +   * The maximum number of revisions to return per page.
    +   * 
    + * + * int32 page_size = 3; + * + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + + public static final int PAGE_TOKEN_FIELD_NUMBER = 4; + + @SuppressWarnings("serial") + private volatile java.lang.Object pageToken_ = ""; + + /** + * + * + *
    +   * The page token, received from a previous ListSchemaRevisions call.
    +   * Provide this to retrieve the subsequent page.
    +   * 
    + * + * string page_token = 4; + * + * @return The pageToken. + */ + @java.lang.Override + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageToken_ = s; + return s; + } + } + + /** + * + * + *
    +   * The page token, received from a previous ListSchemaRevisions call.
    +   * Provide this to retrieve the subsequent page.
    +   * 
    + * + * string page_token = 4; + * + * @return The bytes for pageToken. + */ + @java.lang.Override + public com.google.protobuf.ByteString getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, name_); + } + if (view_ != com.google.pubsub.v1.SchemaView.SCHEMA_VIEW_UNSPECIFIED.getNumber()) { + output.writeEnum(2, view_); + } + if (pageSize_ != 0) { + output.writeInt32(3, pageSize_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(pageToken_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 4, pageToken_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, name_); + } + if (view_ != com.google.pubsub.v1.SchemaView.SCHEMA_VIEW_UNSPECIFIED.getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(2, view_); + } + if (pageSize_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(3, pageSize_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(pageToken_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(4, pageToken_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.pubsub.v1.ListSchemaRevisionsRequest)) { + return super.equals(obj); + } + com.google.pubsub.v1.ListSchemaRevisionsRequest other = + (com.google.pubsub.v1.ListSchemaRevisionsRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (view_ != other.view_) return false; + if (getPageSize() != other.getPageSize()) return false; + if (!getPageToken().equals(other.getPageToken())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + VIEW_FIELD_NUMBER; + hash = (53 * hash) + view_; + hash = (37 * hash) + PAGE_SIZE_FIELD_NUMBER; + hash = (53 * hash) + getPageSize(); + hash = (37 * hash) + PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getPageToken().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.pubsub.v1.ListSchemaRevisionsRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.ListSchemaRevisionsRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.ListSchemaRevisionsRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.ListSchemaRevisionsRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.ListSchemaRevisionsRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.ListSchemaRevisionsRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.ListSchemaRevisionsRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.ListSchemaRevisionsRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.ListSchemaRevisionsRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.ListSchemaRevisionsRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.ListSchemaRevisionsRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.ListSchemaRevisionsRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.pubsub.v1.ListSchemaRevisionsRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + + /** + * + * + *
    +   * Request for the `ListSchemaRevisions` method.
    +   * 
    + * + * Protobuf type {@code google.pubsub.v1.ListSchemaRevisionsRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder + implements + // @@protoc_insertion_point(builder_implements:google.pubsub.v1.ListSchemaRevisionsRequest) + com.google.pubsub.v1.ListSchemaRevisionsRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.SchemaProto + .internal_static_google_pubsub_v1_ListSchemaRevisionsRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.SchemaProto + .internal_static_google_pubsub_v1_ListSchemaRevisionsRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.ListSchemaRevisionsRequest.class, + com.google.pubsub.v1.ListSchemaRevisionsRequest.Builder.class); + } + + // Construct using com.google.pubsub.v1.ListSchemaRevisionsRequest.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + name_ = ""; + view_ = 0; + pageSize_ = 0; + pageToken_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.pubsub.v1.SchemaProto + .internal_static_google_pubsub_v1_ListSchemaRevisionsRequest_descriptor; + } + + @java.lang.Override + public com.google.pubsub.v1.ListSchemaRevisionsRequest getDefaultInstanceForType() { + return com.google.pubsub.v1.ListSchemaRevisionsRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.pubsub.v1.ListSchemaRevisionsRequest build() { + com.google.pubsub.v1.ListSchemaRevisionsRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.pubsub.v1.ListSchemaRevisionsRequest buildPartial() { + com.google.pubsub.v1.ListSchemaRevisionsRequest result = + new com.google.pubsub.v1.ListSchemaRevisionsRequest(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.pubsub.v1.ListSchemaRevisionsRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.name_ = name_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.view_ = view_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.pageSize_ = pageSize_; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.pageToken_ = pageToken_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.pubsub.v1.ListSchemaRevisionsRequest) { + return mergeFrom((com.google.pubsub.v1.ListSchemaRevisionsRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.pubsub.v1.ListSchemaRevisionsRequest other) { + if (other == com.google.pubsub.v1.ListSchemaRevisionsRequest.getDefaultInstance()) + return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (other.view_ != 0) { + setViewValue(other.getViewValue()); + } + if (other.getPageSize() != 0) { + setPageSize(other.getPageSize()); + } + if (!other.getPageToken().isEmpty()) { + pageToken_ = other.pageToken_; + bitField0_ |= 0x00000008; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + name_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 16: + { + view_ = input.readEnum(); + bitField0_ |= 0x00000002; + break; + } // case 16 + case 24: + { + pageSize_ = input.readInt32(); + bitField0_ |= 0x00000004; + break; + } // case 24 + case 34: + { + pageToken_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000008; + break; + } // case 34 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.lang.Object name_ = ""; + + /** + * + * + *
    +     * Required. The name of the schema to list revisions for.
    +     * 
    + * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +     * Required. The name of the schema to list revisions for.
    +     * 
    + * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +     * Required. The name of the schema to list revisions for.
    +     * 
    + * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Required. The name of the schema to list revisions for.
    +     * 
    + * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + + /** + * + * + *
    +     * Required. The name of the schema to list revisions for.
    +     * 
    + * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private int view_ = 0; + + /** + * + * + *
    +     * The set of Schema fields to return in the response. If not set, returns
    +     * Schemas with `name` and `type`, but not `definition`. Set to `FULL` to
    +     * retrieve all fields.
    +     * 
    + * + * .google.pubsub.v1.SchemaView view = 2; + * + * @return The enum numeric value on the wire for view. + */ + @java.lang.Override + public int getViewValue() { + return view_; + } + + /** + * + * + *
    +     * The set of Schema fields to return in the response. If not set, returns
    +     * Schemas with `name` and `type`, but not `definition`. Set to `FULL` to
    +     * retrieve all fields.
    +     * 
    + * + * .google.pubsub.v1.SchemaView view = 2; + * + * @param value The enum numeric value on the wire for view to set. + * @return This builder for chaining. + */ + public Builder setViewValue(int value) { + view_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + /** + * + * + *
    +     * The set of Schema fields to return in the response. If not set, returns
    +     * Schemas with `name` and `type`, but not `definition`. Set to `FULL` to
    +     * retrieve all fields.
    +     * 
    + * + * .google.pubsub.v1.SchemaView view = 2; + * + * @return The view. + */ + @java.lang.Override + public com.google.pubsub.v1.SchemaView getView() { + com.google.pubsub.v1.SchemaView result = com.google.pubsub.v1.SchemaView.forNumber(view_); + return result == null ? com.google.pubsub.v1.SchemaView.UNRECOGNIZED : result; + } + + /** + * + * + *
    +     * The set of Schema fields to return in the response. If not set, returns
    +     * Schemas with `name` and `type`, but not `definition`. Set to `FULL` to
    +     * retrieve all fields.
    +     * 
    + * + * .google.pubsub.v1.SchemaView view = 2; + * + * @param value The view to set. + * @return This builder for chaining. + */ + public Builder setView(com.google.pubsub.v1.SchemaView value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + view_ = value.getNumber(); + onChanged(); + return this; + } + + /** + * + * + *
    +     * The set of Schema fields to return in the response. If not set, returns
    +     * Schemas with `name` and `type`, but not `definition`. Set to `FULL` to
    +     * retrieve all fields.
    +     * 
    + * + * .google.pubsub.v1.SchemaView view = 2; + * + * @return This builder for chaining. + */ + public Builder clearView() { + bitField0_ = (bitField0_ & ~0x00000002); + view_ = 0; + onChanged(); + return this; + } + + private int pageSize_; + + /** + * + * + *
    +     * The maximum number of revisions to return per page.
    +     * 
    + * + * int32 page_size = 3; + * + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + + /** + * + * + *
    +     * The maximum number of revisions to return per page.
    +     * 
    + * + * int32 page_size = 3; + * + * @param value The pageSize to set. + * @return This builder for chaining. + */ + public Builder setPageSize(int value) { + + pageSize_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + /** + * + * + *
    +     * The maximum number of revisions to return per page.
    +     * 
    + * + * int32 page_size = 3; + * + * @return This builder for chaining. + */ + public Builder clearPageSize() { + bitField0_ = (bitField0_ & ~0x00000004); + pageSize_ = 0; + onChanged(); + return this; + } + + private java.lang.Object pageToken_ = ""; + + /** + * + * + *
    +     * The page token, received from a previous ListSchemaRevisions call.
    +     * Provide this to retrieve the subsequent page.
    +     * 
    + * + * string page_token = 4; + * + * @return The pageToken. + */ + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +     * The page token, received from a previous ListSchemaRevisions call.
    +     * Provide this to retrieve the subsequent page.
    +     * 
    + * + * string page_token = 4; + * + * @return The bytes for pageToken. + */ + public com.google.protobuf.ByteString getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +     * The page token, received from a previous ListSchemaRevisions call.
    +     * Provide this to retrieve the subsequent page.
    +     * 
    + * + * string page_token = 4; + * + * @param value The pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + pageToken_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + + /** + * + * + *
    +     * The page token, received from a previous ListSchemaRevisions call.
    +     * Provide this to retrieve the subsequent page.
    +     * 
    + * + * string page_token = 4; + * + * @return This builder for chaining. + */ + public Builder clearPageToken() { + pageToken_ = getDefaultInstance().getPageToken(); + bitField0_ = (bitField0_ & ~0x00000008); + onChanged(); + return this; + } + + /** + * + * + *
    +     * The page token, received from a previous ListSchemaRevisions call.
    +     * Provide this to retrieve the subsequent page.
    +     * 
    + * + * string page_token = 4; + * + * @param value The bytes for pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + pageToken_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:google.pubsub.v1.ListSchemaRevisionsRequest) + } + + // @@protoc_insertion_point(class_scope:google.pubsub.v1.ListSchemaRevisionsRequest) + private static final com.google.pubsub.v1.ListSchemaRevisionsRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.pubsub.v1.ListSchemaRevisionsRequest(); + } + + public static com.google.pubsub.v1.ListSchemaRevisionsRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListSchemaRevisionsRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.pubsub.v1.ListSchemaRevisionsRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSchemaRevisionsRequestOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSchemaRevisionsRequestOrBuilder.java new file mode 100644 index 000000000..5145cce90 --- /dev/null +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSchemaRevisionsRequestOrBuilder.java @@ -0,0 +1,129 @@ +/* + * Copyright 2026 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: google/pubsub/v1/schema.proto +// Protobuf Java Version: 4.33.2 + +package com.google.pubsub.v1; + +@com.google.protobuf.Generated +public interface ListSchemaRevisionsRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.pubsub.v1.ListSchemaRevisionsRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
    +   * Required. The name of the schema to list revisions for.
    +   * 
    + * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + + /** + * + * + *
    +   * Required. The name of the schema to list revisions for.
    +   * 
    + * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
    +   * The set of Schema fields to return in the response. If not set, returns
    +   * Schemas with `name` and `type`, but not `definition`. Set to `FULL` to
    +   * retrieve all fields.
    +   * 
    + * + * .google.pubsub.v1.SchemaView view = 2; + * + * @return The enum numeric value on the wire for view. + */ + int getViewValue(); + + /** + * + * + *
    +   * The set of Schema fields to return in the response. If not set, returns
    +   * Schemas with `name` and `type`, but not `definition`. Set to `FULL` to
    +   * retrieve all fields.
    +   * 
    + * + * .google.pubsub.v1.SchemaView view = 2; + * + * @return The view. + */ + com.google.pubsub.v1.SchemaView getView(); + + /** + * + * + *
    +   * The maximum number of revisions to return per page.
    +   * 
    + * + * int32 page_size = 3; + * + * @return The pageSize. + */ + int getPageSize(); + + /** + * + * + *
    +   * The page token, received from a previous ListSchemaRevisions call.
    +   * Provide this to retrieve the subsequent page.
    +   * 
    + * + * string page_token = 4; + * + * @return The pageToken. + */ + java.lang.String getPageToken(); + + /** + * + * + *
    +   * The page token, received from a previous ListSchemaRevisions call.
    +   * Provide this to retrieve the subsequent page.
    +   * 
    + * + * string page_token = 4; + * + * @return The bytes for pageToken. + */ + com.google.protobuf.ByteString getPageTokenBytes(); +} diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSchemaRevisionsResponse.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSchemaRevisionsResponse.java new file mode 100644 index 000000000..c9bda70ee --- /dev/null +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSchemaRevisionsResponse.java @@ -0,0 +1,1112 @@ +/* + * Copyright 2026 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: google/pubsub/v1/schema.proto +// Protobuf Java Version: 4.33.2 + +package com.google.pubsub.v1; + +/** + * + * + *
    + * Response for the `ListSchemaRevisions` method.
    + * 
    + * + * Protobuf type {@code google.pubsub.v1.ListSchemaRevisionsResponse} + */ +@com.google.protobuf.Generated +public final class ListSchemaRevisionsResponse extends com.google.protobuf.GeneratedMessage + implements + // @@protoc_insertion_point(message_implements:google.pubsub.v1.ListSchemaRevisionsResponse) + ListSchemaRevisionsResponseOrBuilder { + private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "ListSchemaRevisionsResponse"); + } + + // Use ListSchemaRevisionsResponse.newBuilder() to construct. + private ListSchemaRevisionsResponse(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + + private ListSchemaRevisionsResponse() { + schemas_ = java.util.Collections.emptyList(); + nextPageToken_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.SchemaProto + .internal_static_google_pubsub_v1_ListSchemaRevisionsResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.SchemaProto + .internal_static_google_pubsub_v1_ListSchemaRevisionsResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.ListSchemaRevisionsResponse.class, + com.google.pubsub.v1.ListSchemaRevisionsResponse.Builder.class); + } + + public static final int SCHEMAS_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private java.util.List schemas_; + + /** + * + * + *
    +   * The revisions of the schema.
    +   * 
    + * + * repeated .google.pubsub.v1.Schema schemas = 1; + */ + @java.lang.Override + public java.util.List getSchemasList() { + return schemas_; + } + + /** + * + * + *
    +   * The revisions of the schema.
    +   * 
    + * + * repeated .google.pubsub.v1.Schema schemas = 1; + */ + @java.lang.Override + public java.util.List getSchemasOrBuilderList() { + return schemas_; + } + + /** + * + * + *
    +   * The revisions of the schema.
    +   * 
    + * + * repeated .google.pubsub.v1.Schema schemas = 1; + */ + @java.lang.Override + public int getSchemasCount() { + return schemas_.size(); + } + + /** + * + * + *
    +   * The revisions of the schema.
    +   * 
    + * + * repeated .google.pubsub.v1.Schema schemas = 1; + */ + @java.lang.Override + public com.google.pubsub.v1.Schema getSchemas(int index) { + return schemas_.get(index); + } + + /** + * + * + *
    +   * The revisions of the schema.
    +   * 
    + * + * repeated .google.pubsub.v1.Schema schemas = 1; + */ + @java.lang.Override + public com.google.pubsub.v1.SchemaOrBuilder getSchemasOrBuilder(int index) { + return schemas_.get(index); + } + + public static final int NEXT_PAGE_TOKEN_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private volatile java.lang.Object nextPageToken_ = ""; + + /** + * + * + *
    +   * A token that can be sent as `page_token` to retrieve the next page.
    +   * If this field is empty, there are no subsequent pages.
    +   * 
    + * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + @java.lang.Override + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } + } + + /** + * + * + *
    +   * A token that can be sent as `page_token` to retrieve the next page.
    +   * If this field is empty, there are no subsequent pages.
    +   * 
    + * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < schemas_.size(); i++) { + output.writeMessage(1, schemas_.get(i)); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(nextPageToken_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, nextPageToken_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < schemas_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, schemas_.get(i)); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(nextPageToken_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, nextPageToken_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.pubsub.v1.ListSchemaRevisionsResponse)) { + return super.equals(obj); + } + com.google.pubsub.v1.ListSchemaRevisionsResponse other = + (com.google.pubsub.v1.ListSchemaRevisionsResponse) obj; + + if (!getSchemasList().equals(other.getSchemasList())) return false; + if (!getNextPageToken().equals(other.getNextPageToken())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getSchemasCount() > 0) { + hash = (37 * hash) + SCHEMAS_FIELD_NUMBER; + hash = (53 * hash) + getSchemasList().hashCode(); + } + hash = (37 * hash) + NEXT_PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getNextPageToken().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.pubsub.v1.ListSchemaRevisionsResponse parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.ListSchemaRevisionsResponse parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.ListSchemaRevisionsResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.ListSchemaRevisionsResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.ListSchemaRevisionsResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.ListSchemaRevisionsResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.ListSchemaRevisionsResponse parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.ListSchemaRevisionsResponse parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.ListSchemaRevisionsResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.ListSchemaRevisionsResponse parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.ListSchemaRevisionsResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.ListSchemaRevisionsResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.pubsub.v1.ListSchemaRevisionsResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + + /** + * + * + *
    +   * Response for the `ListSchemaRevisions` method.
    +   * 
    + * + * Protobuf type {@code google.pubsub.v1.ListSchemaRevisionsResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder + implements + // @@protoc_insertion_point(builder_implements:google.pubsub.v1.ListSchemaRevisionsResponse) + com.google.pubsub.v1.ListSchemaRevisionsResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.SchemaProto + .internal_static_google_pubsub_v1_ListSchemaRevisionsResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.SchemaProto + .internal_static_google_pubsub_v1_ListSchemaRevisionsResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.ListSchemaRevisionsResponse.class, + com.google.pubsub.v1.ListSchemaRevisionsResponse.Builder.class); + } + + // Construct using com.google.pubsub.v1.ListSchemaRevisionsResponse.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + if (schemasBuilder_ == null) { + schemas_ = java.util.Collections.emptyList(); + } else { + schemas_ = null; + schemasBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + nextPageToken_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.pubsub.v1.SchemaProto + .internal_static_google_pubsub_v1_ListSchemaRevisionsResponse_descriptor; + } + + @java.lang.Override + public com.google.pubsub.v1.ListSchemaRevisionsResponse getDefaultInstanceForType() { + return com.google.pubsub.v1.ListSchemaRevisionsResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.pubsub.v1.ListSchemaRevisionsResponse build() { + com.google.pubsub.v1.ListSchemaRevisionsResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.pubsub.v1.ListSchemaRevisionsResponse buildPartial() { + com.google.pubsub.v1.ListSchemaRevisionsResponse result = + new com.google.pubsub.v1.ListSchemaRevisionsResponse(this); + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields( + com.google.pubsub.v1.ListSchemaRevisionsResponse result) { + if (schemasBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + schemas_ = java.util.Collections.unmodifiableList(schemas_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.schemas_ = schemas_; + } else { + result.schemas_ = schemasBuilder_.build(); + } + } + + private void buildPartial0(com.google.pubsub.v1.ListSchemaRevisionsResponse result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000002) != 0)) { + result.nextPageToken_ = nextPageToken_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.pubsub.v1.ListSchemaRevisionsResponse) { + return mergeFrom((com.google.pubsub.v1.ListSchemaRevisionsResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.pubsub.v1.ListSchemaRevisionsResponse other) { + if (other == com.google.pubsub.v1.ListSchemaRevisionsResponse.getDefaultInstance()) + return this; + if (schemasBuilder_ == null) { + if (!other.schemas_.isEmpty()) { + if (schemas_.isEmpty()) { + schemas_ = other.schemas_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureSchemasIsMutable(); + schemas_.addAll(other.schemas_); + } + onChanged(); + } + } else { + if (!other.schemas_.isEmpty()) { + if (schemasBuilder_.isEmpty()) { + schemasBuilder_.dispose(); + schemasBuilder_ = null; + schemas_ = other.schemas_; + bitField0_ = (bitField0_ & ~0x00000001); + schemasBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders + ? internalGetSchemasFieldBuilder() + : null; + } else { + schemasBuilder_.addAllMessages(other.schemas_); + } + } + } + if (!other.getNextPageToken().isEmpty()) { + nextPageToken_ = other.nextPageToken_; + bitField0_ |= 0x00000002; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.pubsub.v1.Schema m = + input.readMessage(com.google.pubsub.v1.Schema.parser(), extensionRegistry); + if (schemasBuilder_ == null) { + ensureSchemasIsMutable(); + schemas_.add(m); + } else { + schemasBuilder_.addMessage(m); + } + break; + } // case 10 + case 18: + { + nextPageToken_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.util.List schemas_ = + java.util.Collections.emptyList(); + + private void ensureSchemasIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + schemas_ = new java.util.ArrayList(schemas_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + com.google.pubsub.v1.Schema, + com.google.pubsub.v1.Schema.Builder, + com.google.pubsub.v1.SchemaOrBuilder> + schemasBuilder_; + + /** + * + * + *
    +     * The revisions of the schema.
    +     * 
    + * + * repeated .google.pubsub.v1.Schema schemas = 1; + */ + public java.util.List getSchemasList() { + if (schemasBuilder_ == null) { + return java.util.Collections.unmodifiableList(schemas_); + } else { + return schemasBuilder_.getMessageList(); + } + } + + /** + * + * + *
    +     * The revisions of the schema.
    +     * 
    + * + * repeated .google.pubsub.v1.Schema schemas = 1; + */ + public int getSchemasCount() { + if (schemasBuilder_ == null) { + return schemas_.size(); + } else { + return schemasBuilder_.getCount(); + } + } + + /** + * + * + *
    +     * The revisions of the schema.
    +     * 
    + * + * repeated .google.pubsub.v1.Schema schemas = 1; + */ + public com.google.pubsub.v1.Schema getSchemas(int index) { + if (schemasBuilder_ == null) { + return schemas_.get(index); + } else { + return schemasBuilder_.getMessage(index); + } + } + + /** + * + * + *
    +     * The revisions of the schema.
    +     * 
    + * + * repeated .google.pubsub.v1.Schema schemas = 1; + */ + public Builder setSchemas(int index, com.google.pubsub.v1.Schema value) { + if (schemasBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSchemasIsMutable(); + schemas_.set(index, value); + onChanged(); + } else { + schemasBuilder_.setMessage(index, value); + } + return this; + } + + /** + * + * + *
    +     * The revisions of the schema.
    +     * 
    + * + * repeated .google.pubsub.v1.Schema schemas = 1; + */ + public Builder setSchemas(int index, com.google.pubsub.v1.Schema.Builder builderForValue) { + if (schemasBuilder_ == null) { + ensureSchemasIsMutable(); + schemas_.set(index, builderForValue.build()); + onChanged(); + } else { + schemasBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + + /** + * + * + *
    +     * The revisions of the schema.
    +     * 
    + * + * repeated .google.pubsub.v1.Schema schemas = 1; + */ + public Builder addSchemas(com.google.pubsub.v1.Schema value) { + if (schemasBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSchemasIsMutable(); + schemas_.add(value); + onChanged(); + } else { + schemasBuilder_.addMessage(value); + } + return this; + } + + /** + * + * + *
    +     * The revisions of the schema.
    +     * 
    + * + * repeated .google.pubsub.v1.Schema schemas = 1; + */ + public Builder addSchemas(int index, com.google.pubsub.v1.Schema value) { + if (schemasBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSchemasIsMutable(); + schemas_.add(index, value); + onChanged(); + } else { + schemasBuilder_.addMessage(index, value); + } + return this; + } + + /** + * + * + *
    +     * The revisions of the schema.
    +     * 
    + * + * repeated .google.pubsub.v1.Schema schemas = 1; + */ + public Builder addSchemas(com.google.pubsub.v1.Schema.Builder builderForValue) { + if (schemasBuilder_ == null) { + ensureSchemasIsMutable(); + schemas_.add(builderForValue.build()); + onChanged(); + } else { + schemasBuilder_.addMessage(builderForValue.build()); + } + return this; + } + + /** + * + * + *
    +     * The revisions of the schema.
    +     * 
    + * + * repeated .google.pubsub.v1.Schema schemas = 1; + */ + public Builder addSchemas(int index, com.google.pubsub.v1.Schema.Builder builderForValue) { + if (schemasBuilder_ == null) { + ensureSchemasIsMutable(); + schemas_.add(index, builderForValue.build()); + onChanged(); + } else { + schemasBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + + /** + * + * + *
    +     * The revisions of the schema.
    +     * 
    + * + * repeated .google.pubsub.v1.Schema schemas = 1; + */ + public Builder addAllSchemas(java.lang.Iterable values) { + if (schemasBuilder_ == null) { + ensureSchemasIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, schemas_); + onChanged(); + } else { + schemasBuilder_.addAllMessages(values); + } + return this; + } + + /** + * + * + *
    +     * The revisions of the schema.
    +     * 
    + * + * repeated .google.pubsub.v1.Schema schemas = 1; + */ + public Builder clearSchemas() { + if (schemasBuilder_ == null) { + schemas_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + schemasBuilder_.clear(); + } + return this; + } + + /** + * + * + *
    +     * The revisions of the schema.
    +     * 
    + * + * repeated .google.pubsub.v1.Schema schemas = 1; + */ + public Builder removeSchemas(int index) { + if (schemasBuilder_ == null) { + ensureSchemasIsMutable(); + schemas_.remove(index); + onChanged(); + } else { + schemasBuilder_.remove(index); + } + return this; + } + + /** + * + * + *
    +     * The revisions of the schema.
    +     * 
    + * + * repeated .google.pubsub.v1.Schema schemas = 1; + */ + public com.google.pubsub.v1.Schema.Builder getSchemasBuilder(int index) { + return internalGetSchemasFieldBuilder().getBuilder(index); + } + + /** + * + * + *
    +     * The revisions of the schema.
    +     * 
    + * + * repeated .google.pubsub.v1.Schema schemas = 1; + */ + public com.google.pubsub.v1.SchemaOrBuilder getSchemasOrBuilder(int index) { + if (schemasBuilder_ == null) { + return schemas_.get(index); + } else { + return schemasBuilder_.getMessageOrBuilder(index); + } + } + + /** + * + * + *
    +     * The revisions of the schema.
    +     * 
    + * + * repeated .google.pubsub.v1.Schema schemas = 1; + */ + public java.util.List + getSchemasOrBuilderList() { + if (schemasBuilder_ != null) { + return schemasBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(schemas_); + } + } + + /** + * + * + *
    +     * The revisions of the schema.
    +     * 
    + * + * repeated .google.pubsub.v1.Schema schemas = 1; + */ + public com.google.pubsub.v1.Schema.Builder addSchemasBuilder() { + return internalGetSchemasFieldBuilder() + .addBuilder(com.google.pubsub.v1.Schema.getDefaultInstance()); + } + + /** + * + * + *
    +     * The revisions of the schema.
    +     * 
    + * + * repeated .google.pubsub.v1.Schema schemas = 1; + */ + public com.google.pubsub.v1.Schema.Builder addSchemasBuilder(int index) { + return internalGetSchemasFieldBuilder() + .addBuilder(index, com.google.pubsub.v1.Schema.getDefaultInstance()); + } + + /** + * + * + *
    +     * The revisions of the schema.
    +     * 
    + * + * repeated .google.pubsub.v1.Schema schemas = 1; + */ + public java.util.List getSchemasBuilderList() { + return internalGetSchemasFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilder< + com.google.pubsub.v1.Schema, + com.google.pubsub.v1.Schema.Builder, + com.google.pubsub.v1.SchemaOrBuilder> + internalGetSchemasFieldBuilder() { + if (schemasBuilder_ == null) { + schemasBuilder_ = + new com.google.protobuf.RepeatedFieldBuilder< + com.google.pubsub.v1.Schema, + com.google.pubsub.v1.Schema.Builder, + com.google.pubsub.v1.SchemaOrBuilder>( + schemas_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + schemas_ = null; + } + return schemasBuilder_; + } + + private java.lang.Object nextPageToken_ = ""; + + /** + * + * + *
    +     * A token that can be sent as `page_token` to retrieve the next page.
    +     * If this field is empty, there are no subsequent pages.
    +     * 
    + * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +     * A token that can be sent as `page_token` to retrieve the next page.
    +     * If this field is empty, there are no subsequent pages.
    +     * 
    + * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + public com.google.protobuf.ByteString getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +     * A token that can be sent as `page_token` to retrieve the next page.
    +     * If this field is empty, there are no subsequent pages.
    +     * 
    + * + * string next_page_token = 2; + * + * @param value The nextPageToken to set. + * @return This builder for chaining. + */ + public Builder setNextPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + nextPageToken_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + /** + * + * + *
    +     * A token that can be sent as `page_token` to retrieve the next page.
    +     * If this field is empty, there are no subsequent pages.
    +     * 
    + * + * string next_page_token = 2; + * + * @return This builder for chaining. + */ + public Builder clearNextPageToken() { + nextPageToken_ = getDefaultInstance().getNextPageToken(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + + /** + * + * + *
    +     * A token that can be sent as `page_token` to retrieve the next page.
    +     * If this field is empty, there are no subsequent pages.
    +     * 
    + * + * string next_page_token = 2; + * + * @param value The bytes for nextPageToken to set. + * @return This builder for chaining. + */ + public Builder setNextPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + nextPageToken_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:google.pubsub.v1.ListSchemaRevisionsResponse) + } + + // @@protoc_insertion_point(class_scope:google.pubsub.v1.ListSchemaRevisionsResponse) + private static final com.google.pubsub.v1.ListSchemaRevisionsResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.pubsub.v1.ListSchemaRevisionsResponse(); + } + + public static com.google.pubsub.v1.ListSchemaRevisionsResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListSchemaRevisionsResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.pubsub.v1.ListSchemaRevisionsResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSchemaRevisionsResponseOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSchemaRevisionsResponseOrBuilder.java new file mode 100644 index 000000000..5e423029e --- /dev/null +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSchemaRevisionsResponseOrBuilder.java @@ -0,0 +1,111 @@ +/* + * Copyright 2026 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: google/pubsub/v1/schema.proto +// Protobuf Java Version: 4.33.2 + +package com.google.pubsub.v1; + +@com.google.protobuf.Generated +public interface ListSchemaRevisionsResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.pubsub.v1.ListSchemaRevisionsResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
    +   * The revisions of the schema.
    +   * 
    + * + * repeated .google.pubsub.v1.Schema schemas = 1; + */ + java.util.List getSchemasList(); + + /** + * + * + *
    +   * The revisions of the schema.
    +   * 
    + * + * repeated .google.pubsub.v1.Schema schemas = 1; + */ + com.google.pubsub.v1.Schema getSchemas(int index); + + /** + * + * + *
    +   * The revisions of the schema.
    +   * 
    + * + * repeated .google.pubsub.v1.Schema schemas = 1; + */ + int getSchemasCount(); + + /** + * + * + *
    +   * The revisions of the schema.
    +   * 
    + * + * repeated .google.pubsub.v1.Schema schemas = 1; + */ + java.util.List getSchemasOrBuilderList(); + + /** + * + * + *
    +   * The revisions of the schema.
    +   * 
    + * + * repeated .google.pubsub.v1.Schema schemas = 1; + */ + com.google.pubsub.v1.SchemaOrBuilder getSchemasOrBuilder(int index); + + /** + * + * + *
    +   * A token that can be sent as `page_token` to retrieve the next page.
    +   * If this field is empty, there are no subsequent pages.
    +   * 
    + * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + java.lang.String getNextPageToken(); + + /** + * + * + *
    +   * A token that can be sent as `page_token` to retrieve the next page.
    +   * If this field is empty, there are no subsequent pages.
    +   * 
    + * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + com.google.protobuf.ByteString getNextPageTokenBytes(); +} diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSchemasRequest.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSchemasRequest.java index 95cf9ecab..20c5c2c1d 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSchemasRequest.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSchemasRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/schema.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; @@ -27,13 +29,25 @@ * * Protobuf type {@code google.pubsub.v1.ListSchemasRequest} */ -public final class ListSchemasRequest extends com.google.protobuf.GeneratedMessageV3 +@com.google.protobuf.Generated +public final class ListSchemasRequest extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:google.pubsub.v1.ListSchemasRequest) ListSchemasRequestOrBuilder { private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "ListSchemasRequest"); + } + // Use ListSchemasRequest.newBuilder() to construct. - private ListSchemasRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + private ListSchemasRequest(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); } @@ -43,87 +57,13 @@ private ListSchemasRequest() { pageToken_ = ""; } - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new ListSchemasRequest(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - private ListSchemasRequest( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - java.lang.String s = input.readStringRequireUtf8(); - - parent_ = s; - break; - } - case 16: - { - int rawValue = input.readEnum(); - - view_ = rawValue; - break; - } - case 24: - { - pageSize_ = input.readInt32(); - break; - } - case 34: - { - java.lang.String s = input.readStringRequireUtf8(); - - pageToken_ = s; - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.pubsub.v1.SchemaProto .internal_static_google_pubsub_v1_ListSchemasRequest_descriptor; } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.SchemaProto .internal_static_google_pubsub_v1_ListSchemasRequest_fieldAccessorTable @@ -133,7 +73,10 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } public static final int PARENT_FIELD_NUMBER = 1; - private volatile java.lang.Object parent_; + + @SuppressWarnings("serial") + private volatile java.lang.Object parent_ = ""; + /** * * @@ -160,6 +103,7 @@ public java.lang.String getParent() { return s; } } + /** * * @@ -188,7 +132,8 @@ public com.google.protobuf.ByteString getParentBytes() { } public static final int VIEW_FIELD_NUMBER = 2; - private int view_; + private int view_ = 0; + /** * * @@ -206,6 +151,7 @@ public com.google.protobuf.ByteString getParentBytes() { public int getViewValue() { return view_; } + /** * * @@ -221,13 +167,13 @@ public int getViewValue() { */ @java.lang.Override public com.google.pubsub.v1.SchemaView getView() { - @SuppressWarnings("deprecation") - com.google.pubsub.v1.SchemaView result = com.google.pubsub.v1.SchemaView.valueOf(view_); + com.google.pubsub.v1.SchemaView result = com.google.pubsub.v1.SchemaView.forNumber(view_); return result == null ? com.google.pubsub.v1.SchemaView.UNRECOGNIZED : result; } public static final int PAGE_SIZE_FIELD_NUMBER = 3; - private int pageSize_; + private int pageSize_ = 0; + /** * * @@ -245,7 +191,10 @@ public int getPageSize() { } public static final int PAGE_TOKEN_FIELD_NUMBER = 4; - private volatile java.lang.Object pageToken_; + + @SuppressWarnings("serial") + private volatile java.lang.Object pageToken_ = ""; + /** * * @@ -271,6 +220,7 @@ public java.lang.String getPageToken() { return s; } } + /** * * @@ -311,8 +261,8 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!getParentBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(parent_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, parent_); } if (view_ != com.google.pubsub.v1.SchemaView.SCHEMA_VIEW_UNSPECIFIED.getNumber()) { output.writeEnum(2, view_); @@ -320,10 +270,10 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io if (pageSize_ != 0) { output.writeInt32(3, pageSize_); } - if (!getPageTokenBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 4, pageToken_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(pageToken_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 4, pageToken_); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -332,8 +282,8 @@ public int getSerializedSize() { if (size != -1) return size; size = 0; - if (!getParentBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(parent_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, parent_); } if (view_ != com.google.pubsub.v1.SchemaView.SCHEMA_VIEW_UNSPECIFIED.getNumber()) { size += com.google.protobuf.CodedOutputStream.computeEnumSize(2, view_); @@ -341,10 +291,10 @@ public int getSerializedSize() { if (pageSize_ != 0) { size += com.google.protobuf.CodedOutputStream.computeInt32Size(3, pageSize_); } - if (!getPageTokenBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, pageToken_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(pageToken_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(4, pageToken_); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -363,7 +313,7 @@ public boolean equals(final java.lang.Object obj) { if (view_ != other.view_) return false; if (getPageSize() != other.getPageSize()) return false; if (!getPageToken().equals(other.getPageToken())) return false; - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -382,7 +332,7 @@ public int hashCode() { hash = (53 * hash) + getPageSize(); hash = (37 * hash) + PAGE_TOKEN_FIELD_NUMBER; hash = (53 * hash) + getPageToken().hashCode(); - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -424,38 +374,38 @@ public static com.google.pubsub.v1.ListSchemasRequest parseFrom( public static com.google.pubsub.v1.ListSchemasRequest parseFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.ListSchemasRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.ListSchemasRequest parseDelimitedFrom( java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); } public static com.google.pubsub.v1.ListSchemasRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.ListSchemasRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.ListSchemasRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } @@ -478,10 +428,11 @@ public Builder toBuilder() { } @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** * * @@ -491,7 +442,7 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build * * Protobuf type {@code google.pubsub.v1.ListSchemasRequest} */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements // @@protoc_insertion_point(builder_implements:google.pubsub.v1.ListSchemasRequest) com.google.pubsub.v1.ListSchemasRequestOrBuilder { @@ -501,7 +452,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.SchemaProto .internal_static_google_pubsub_v1_ListSchemasRequest_fieldAccessorTable @@ -511,30 +462,20 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } // Construct using com.google.pubsub.v1.ListSchemasRequest.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } + private Builder() {} - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} } @java.lang.Override public Builder clear() { super.clear(); + bitField0_ = 0; parent_ = ""; - view_ = 0; - pageSize_ = 0; - pageToken_ = ""; - return this; } @@ -562,45 +503,27 @@ public com.google.pubsub.v1.ListSchemasRequest build() { public com.google.pubsub.v1.ListSchemasRequest buildPartial() { com.google.pubsub.v1.ListSchemasRequest result = new com.google.pubsub.v1.ListSchemasRequest(this); - result.parent_ = parent_; - result.view_ = view_; - result.pageSize_ = pageSize_; - result.pageToken_ = pageToken_; + if (bitField0_ != 0) { + buildPartial0(result); + } onBuilt(); return result; } - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); + private void buildPartial0(com.google.pubsub.v1.ListSchemasRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.parent_ = parent_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.view_ = view_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.pageSize_ = pageSize_; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.pageToken_ = pageToken_; + } } @java.lang.Override @@ -617,6 +540,7 @@ public Builder mergeFrom(com.google.pubsub.v1.ListSchemasRequest other) { if (other == com.google.pubsub.v1.ListSchemasRequest.getDefaultInstance()) return this; if (!other.getParent().isEmpty()) { parent_ = other.parent_; + bitField0_ |= 0x00000001; onChanged(); } if (other.view_ != 0) { @@ -627,9 +551,10 @@ public Builder mergeFrom(com.google.pubsub.v1.ListSchemasRequest other) { } if (!other.getPageToken().isEmpty()) { pageToken_ = other.pageToken_; + bitField0_ |= 0x00000008; onChanged(); } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -644,21 +569,62 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.pubsub.v1.ListSchemasRequest parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + parent_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 16: + { + view_ = input.readEnum(); + bitField0_ |= 0x00000002; + break; + } // case 16 + case 24: + { + pageSize_ = input.readInt32(); + bitField0_ |= 0x00000004; + break; + } // case 24 + case 34: + { + pageToken_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000008; + break; + } // case 34 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.google.pubsub.v1.ListSchemasRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } + private int bitField0_; + private java.lang.Object parent_ = ""; + /** * * @@ -684,6 +650,7 @@ public java.lang.String getParent() { return (java.lang.String) ref; } } + /** * * @@ -709,6 +676,7 @@ public com.google.protobuf.ByteString getParentBytes() { return (com.google.protobuf.ByteString) ref; } } + /** * * @@ -728,11 +696,12 @@ public Builder setParent(java.lang.String value) { if (value == null) { throw new NullPointerException(); } - parent_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } + /** * * @@ -748,11 +717,12 @@ public Builder setParent(java.lang.String value) { * @return This builder for chaining. */ public Builder clearParent() { - parent_ = getDefaultInstance().getParent(); + bitField0_ = (bitField0_ & ~0x00000001); onChanged(); return this; } + /** * * @@ -773,13 +743,14 @@ public Builder setParentBytes(com.google.protobuf.ByteString value) { throw new NullPointerException(); } checkByteStringIsUtf8(value); - parent_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } private int view_ = 0; + /** * * @@ -797,6 +768,7 @@ public Builder setParentBytes(com.google.protobuf.ByteString value) { public int getViewValue() { return view_; } + /** * * @@ -812,11 +784,12 @@ public int getViewValue() { * @return This builder for chaining. */ public Builder setViewValue(int value) { - view_ = value; + bitField0_ |= 0x00000002; onChanged(); return this; } + /** * * @@ -832,10 +805,10 @@ public Builder setViewValue(int value) { */ @java.lang.Override public com.google.pubsub.v1.SchemaView getView() { - @SuppressWarnings("deprecation") - com.google.pubsub.v1.SchemaView result = com.google.pubsub.v1.SchemaView.valueOf(view_); + com.google.pubsub.v1.SchemaView result = com.google.pubsub.v1.SchemaView.forNumber(view_); return result == null ? com.google.pubsub.v1.SchemaView.UNRECOGNIZED : result; } + /** * * @@ -854,11 +827,12 @@ public Builder setView(com.google.pubsub.v1.SchemaView value) { if (value == null) { throw new NullPointerException(); } - + bitField0_ |= 0x00000002; view_ = value.getNumber(); onChanged(); return this; } + /** * * @@ -873,13 +847,14 @@ public Builder setView(com.google.pubsub.v1.SchemaView value) { * @return This builder for chaining. */ public Builder clearView() { - + bitField0_ = (bitField0_ & ~0x00000002); view_ = 0; onChanged(); return this; } private int pageSize_; + /** * * @@ -895,6 +870,7 @@ public Builder clearView() { public int getPageSize() { return pageSize_; } + /** * * @@ -910,9 +886,11 @@ public int getPageSize() { public Builder setPageSize(int value) { pageSize_ = value; + bitField0_ |= 0x00000004; onChanged(); return this; } + /** * * @@ -925,13 +903,14 @@ public Builder setPageSize(int value) { * @return This builder for chaining. */ public Builder clearPageSize() { - + bitField0_ = (bitField0_ & ~0x00000004); pageSize_ = 0; onChanged(); return this; } private java.lang.Object pageToken_ = ""; + /** * * @@ -956,6 +935,7 @@ public java.lang.String getPageToken() { return (java.lang.String) ref; } } + /** * * @@ -980,6 +960,7 @@ public com.google.protobuf.ByteString getPageTokenBytes() { return (com.google.protobuf.ByteString) ref; } } + /** * * @@ -998,11 +979,12 @@ public Builder setPageToken(java.lang.String value) { if (value == null) { throw new NullPointerException(); } - pageToken_ = value; + bitField0_ |= 0x00000008; onChanged(); return this; } + /** * * @@ -1017,11 +999,12 @@ public Builder setPageToken(java.lang.String value) { * @return This builder for chaining. */ public Builder clearPageToken() { - pageToken_ = getDefaultInstance().getPageToken(); + bitField0_ = (bitField0_ & ~0x00000008); onChanged(); return this; } + /** * * @@ -1041,23 +1024,12 @@ public Builder setPageTokenBytes(com.google.protobuf.ByteString value) { throw new NullPointerException(); } checkByteStringIsUtf8(value); - pageToken_ = value; + bitField0_ |= 0x00000008; onChanged(); return this; } - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - // @@protoc_insertion_point(builder_scope:google.pubsub.v1.ListSchemasRequest) } @@ -1079,7 +1051,18 @@ public ListSchemasRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new ListSchemasRequest(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSchemasRequestOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSchemasRequestOrBuilder.java index bd5787e76..ae335367a 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSchemasRequestOrBuilder.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSchemasRequestOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/schema.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; +@com.google.protobuf.Generated public interface ListSchemasRequestOrBuilder extends // @@protoc_insertion_point(interface_extends:google.pubsub.v1.ListSchemasRequest) @@ -38,6 +41,7 @@ public interface ListSchemasRequestOrBuilder * @return The parent. */ java.lang.String getParent(); + /** * * @@ -68,6 +72,7 @@ public interface ListSchemasRequestOrBuilder * @return The enum numeric value on the wire for view. */ int getViewValue(); + /** * * @@ -110,6 +115,7 @@ public interface ListSchemasRequestOrBuilder * @return The pageToken. */ java.lang.String getPageToken(); + /** * * diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSchemasResponse.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSchemasResponse.java index ea77ff15a..1b34d2651 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSchemasResponse.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSchemasResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/schema.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; @@ -27,13 +29,25 @@ * * Protobuf type {@code google.pubsub.v1.ListSchemasResponse} */ -public final class ListSchemasResponse extends com.google.protobuf.GeneratedMessageV3 +@com.google.protobuf.Generated +public final class ListSchemasResponse extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:google.pubsub.v1.ListSchemasResponse) ListSchemasResponseOrBuilder { private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "ListSchemasResponse"); + } + // Use ListSchemasResponse.newBuilder() to construct. - private ListSchemasResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + private ListSchemasResponse(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); } @@ -42,82 +56,13 @@ private ListSchemasResponse() { nextPageToken_ = ""; } - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new ListSchemasResponse(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - private ListSchemasResponse( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - if (!((mutable_bitField0_ & 0x00000001) != 0)) { - schemas_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000001; - } - schemas_.add( - input.readMessage(com.google.pubsub.v1.Schema.parser(), extensionRegistry)); - break; - } - case 18: - { - java.lang.String s = input.readStringRequireUtf8(); - - nextPageToken_ = s; - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000001) != 0)) { - schemas_ = java.util.Collections.unmodifiableList(schemas_); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.pubsub.v1.SchemaProto .internal_static_google_pubsub_v1_ListSchemasResponse_descriptor; } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.SchemaProto .internal_static_google_pubsub_v1_ListSchemasResponse_fieldAccessorTable @@ -127,7 +72,10 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } public static final int SCHEMAS_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") private java.util.List schemas_; + /** * * @@ -141,6 +89,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { public java.util.List getSchemasList() { return schemas_; } + /** * * @@ -154,6 +103,7 @@ public java.util.List getSchemasList() { public java.util.List getSchemasOrBuilderList() { return schemas_; } + /** * * @@ -167,6 +117,7 @@ public java.util.List getSchemas public int getSchemasCount() { return schemas_.size(); } + /** * * @@ -180,6 +131,7 @@ public int getSchemasCount() { public com.google.pubsub.v1.Schema getSchemas(int index) { return schemas_.get(index); } + /** * * @@ -195,7 +147,10 @@ public com.google.pubsub.v1.SchemaOrBuilder getSchemasOrBuilder(int index) { } public static final int NEXT_PAGE_TOKEN_FIELD_NUMBER = 2; - private volatile java.lang.Object nextPageToken_; + + @SuppressWarnings("serial") + private volatile java.lang.Object nextPageToken_ = ""; + /** * * @@ -220,6 +175,7 @@ public java.lang.String getNextPageToken() { return s; } } + /** * * @@ -262,10 +218,10 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io for (int i = 0; i < schemas_.size(); i++) { output.writeMessage(1, schemas_.get(i)); } - if (!getNextPageTokenBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 2, nextPageToken_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(nextPageToken_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, nextPageToken_); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -277,10 +233,10 @@ public int getSerializedSize() { for (int i = 0; i < schemas_.size(); i++) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, schemas_.get(i)); } - if (!getNextPageTokenBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, nextPageToken_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(nextPageToken_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, nextPageToken_); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -297,7 +253,7 @@ public boolean equals(final java.lang.Object obj) { if (!getSchemasList().equals(other.getSchemasList())) return false; if (!getNextPageToken().equals(other.getNextPageToken())) return false; - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -314,7 +270,7 @@ public int hashCode() { } hash = (37 * hash) + NEXT_PAGE_TOKEN_FIELD_NUMBER; hash = (53 * hash) + getNextPageToken().hashCode(); - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -356,38 +312,38 @@ public static com.google.pubsub.v1.ListSchemasResponse parseFrom( public static com.google.pubsub.v1.ListSchemasResponse parseFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.ListSchemasResponse parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.ListSchemasResponse parseDelimitedFrom( java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); } public static com.google.pubsub.v1.ListSchemasResponse parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.ListSchemasResponse parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.ListSchemasResponse parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } @@ -410,10 +366,11 @@ public Builder toBuilder() { } @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** * * @@ -423,7 +380,7 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build * * Protobuf type {@code google.pubsub.v1.ListSchemasResponse} */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements // @@protoc_insertion_point(builder_implements:google.pubsub.v1.ListSchemasResponse) com.google.pubsub.v1.ListSchemasResponseOrBuilder { @@ -433,7 +390,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.SchemaProto .internal_static_google_pubsub_v1_ListSchemasResponse_fieldAccessorTable @@ -443,32 +400,24 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } // Construct using com.google.pubsub.v1.ListSchemasResponse.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } + private Builder() {} - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { - getSchemasFieldBuilder(); - } } @java.lang.Override public Builder clear() { super.clear(); + bitField0_ = 0; if (schemasBuilder_ == null) { schemas_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); } else { + schemas_ = null; schemasBuilder_.clear(); } + bitField0_ = (bitField0_ & ~0x00000001); nextPageToken_ = ""; - return this; } @@ -496,7 +445,15 @@ public com.google.pubsub.v1.ListSchemasResponse build() { public com.google.pubsub.v1.ListSchemasResponse buildPartial() { com.google.pubsub.v1.ListSchemasResponse result = new com.google.pubsub.v1.ListSchemasResponse(this); - int from_bitField0_ = bitField0_; + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields(com.google.pubsub.v1.ListSchemasResponse result) { if (schemasBuilder_ == null) { if (((bitField0_ & 0x00000001) != 0)) { schemas_ = java.util.Collections.unmodifiableList(schemas_); @@ -506,42 +463,13 @@ public com.google.pubsub.v1.ListSchemasResponse buildPartial() { } else { result.schemas_ = schemasBuilder_.build(); } - result.nextPageToken_ = nextPageToken_; - onBuilt(); - return result; - } - - @java.lang.Override - public Builder clone() { - return super.clone(); } - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); + private void buildPartial0(com.google.pubsub.v1.ListSchemasResponse result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000002) != 0)) { + result.nextPageToken_ = nextPageToken_; + } } @java.lang.Override @@ -575,8 +503,8 @@ public Builder mergeFrom(com.google.pubsub.v1.ListSchemasResponse other) { schemas_ = other.schemas_; bitField0_ = (bitField0_ & ~0x00000001); schemasBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders - ? getSchemasFieldBuilder() + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders + ? internalGetSchemasFieldBuilder() : null; } else { schemasBuilder_.addAllMessages(other.schemas_); @@ -585,9 +513,10 @@ public Builder mergeFrom(com.google.pubsub.v1.ListSchemasResponse other) { } if (!other.getNextPageToken().isEmpty()) { nextPageToken_ = other.nextPageToken_; + bitField0_ |= 0x00000002; onChanged(); } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -602,17 +531,49 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.pubsub.v1.ListSchemasResponse parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.pubsub.v1.Schema m = + input.readMessage(com.google.pubsub.v1.Schema.parser(), extensionRegistry); + if (schemasBuilder_ == null) { + ensureSchemasIsMutable(); + schemas_.add(m); + } else { + schemasBuilder_.addMessage(m); + } + break; + } // case 10 + case 18: + { + nextPageToken_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.google.pubsub.v1.ListSchemasResponse) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } @@ -628,7 +589,7 @@ private void ensureSchemasIsMutable() { } } - private com.google.protobuf.RepeatedFieldBuilderV3< + private com.google.protobuf.RepeatedFieldBuilder< com.google.pubsub.v1.Schema, com.google.pubsub.v1.Schema.Builder, com.google.pubsub.v1.SchemaOrBuilder> @@ -650,6 +611,7 @@ public java.util.List getSchemasList() { return schemasBuilder_.getMessageList(); } } + /** * * @@ -666,6 +628,7 @@ public int getSchemasCount() { return schemasBuilder_.getCount(); } } + /** * * @@ -682,6 +645,7 @@ public com.google.pubsub.v1.Schema getSchemas(int index) { return schemasBuilder_.getMessage(index); } } + /** * * @@ -704,6 +668,7 @@ public Builder setSchemas(int index, com.google.pubsub.v1.Schema value) { } return this; } + /** * * @@ -723,6 +688,7 @@ public Builder setSchemas(int index, com.google.pubsub.v1.Schema.Builder builder } return this; } + /** * * @@ -745,6 +711,7 @@ public Builder addSchemas(com.google.pubsub.v1.Schema value) { } return this; } + /** * * @@ -767,6 +734,7 @@ public Builder addSchemas(int index, com.google.pubsub.v1.Schema value) { } return this; } + /** * * @@ -786,6 +754,7 @@ public Builder addSchemas(com.google.pubsub.v1.Schema.Builder builderForValue) { } return this; } + /** * * @@ -805,6 +774,7 @@ public Builder addSchemas(int index, com.google.pubsub.v1.Schema.Builder builder } return this; } + /** * * @@ -824,6 +794,7 @@ public Builder addAllSchemas(java.lang.Iterablerepeated .google.pubsub.v1.Schema schemas = 1;
    */ public com.google.pubsub.v1.Schema.Builder getSchemasBuilder(int index) { - return getSchemasFieldBuilder().getBuilder(index); + return internalGetSchemasFieldBuilder().getBuilder(index); } + /** * * @@ -890,6 +864,7 @@ public com.google.pubsub.v1.SchemaOrBuilder getSchemasOrBuilder(int index) { return schemasBuilder_.getMessageOrBuilder(index); } } + /** * * @@ -907,6 +882,7 @@ public com.google.pubsub.v1.SchemaOrBuilder getSchemasOrBuilder(int index) { return java.util.Collections.unmodifiableList(schemas_); } } + /** * * @@ -917,8 +893,10 @@ public com.google.pubsub.v1.SchemaOrBuilder getSchemasOrBuilder(int index) { * repeated .google.pubsub.v1.Schema schemas = 1; */ public com.google.pubsub.v1.Schema.Builder addSchemasBuilder() { - return getSchemasFieldBuilder().addBuilder(com.google.pubsub.v1.Schema.getDefaultInstance()); + return internalGetSchemasFieldBuilder() + .addBuilder(com.google.pubsub.v1.Schema.getDefaultInstance()); } + /** * * @@ -929,9 +907,10 @@ public com.google.pubsub.v1.Schema.Builder addSchemasBuilder() { * repeated .google.pubsub.v1.Schema schemas = 1; */ public com.google.pubsub.v1.Schema.Builder addSchemasBuilder(int index) { - return getSchemasFieldBuilder() + return internalGetSchemasFieldBuilder() .addBuilder(index, com.google.pubsub.v1.Schema.getDefaultInstance()); } + /** * * @@ -942,17 +921,17 @@ public com.google.pubsub.v1.Schema.Builder addSchemasBuilder(int index) { * repeated .google.pubsub.v1.Schema schemas = 1; */ public java.util.List getSchemasBuilderList() { - return getSchemasFieldBuilder().getBuilderList(); + return internalGetSchemasFieldBuilder().getBuilderList(); } - private com.google.protobuf.RepeatedFieldBuilderV3< + private com.google.protobuf.RepeatedFieldBuilder< com.google.pubsub.v1.Schema, com.google.pubsub.v1.Schema.Builder, com.google.pubsub.v1.SchemaOrBuilder> - getSchemasFieldBuilder() { + internalGetSchemasFieldBuilder() { if (schemasBuilder_ == null) { schemasBuilder_ = - new com.google.protobuf.RepeatedFieldBuilderV3< + new com.google.protobuf.RepeatedFieldBuilder< com.google.pubsub.v1.Schema, com.google.pubsub.v1.Schema.Builder, com.google.pubsub.v1.SchemaOrBuilder>( @@ -963,6 +942,7 @@ public java.util.List getSchemasBuilderList } private java.lang.Object nextPageToken_ = ""; + /** * * @@ -986,6 +966,7 @@ public java.lang.String getNextPageToken() { return (java.lang.String) ref; } } + /** * * @@ -1009,6 +990,7 @@ public com.google.protobuf.ByteString getNextPageTokenBytes() { return (com.google.protobuf.ByteString) ref; } } + /** * * @@ -1026,11 +1008,12 @@ public Builder setNextPageToken(java.lang.String value) { if (value == null) { throw new NullPointerException(); } - nextPageToken_ = value; + bitField0_ |= 0x00000002; onChanged(); return this; } + /** * * @@ -1044,11 +1027,12 @@ public Builder setNextPageToken(java.lang.String value) { * @return This builder for chaining. */ public Builder clearNextPageToken() { - nextPageToken_ = getDefaultInstance().getNextPageToken(); + bitField0_ = (bitField0_ & ~0x00000002); onChanged(); return this; } + /** * * @@ -1067,23 +1051,12 @@ public Builder setNextPageTokenBytes(com.google.protobuf.ByteString value) { throw new NullPointerException(); } checkByteStringIsUtf8(value); - nextPageToken_ = value; + bitField0_ |= 0x00000002; onChanged(); return this; } - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - // @@protoc_insertion_point(builder_scope:google.pubsub.v1.ListSchemasResponse) } @@ -1105,7 +1078,18 @@ public ListSchemasResponse parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new ListSchemasResponse(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSchemasResponseOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSchemasResponseOrBuilder.java index 3ee2015b1..5631cbf6e 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSchemasResponseOrBuilder.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSchemasResponseOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/schema.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; +@com.google.protobuf.Generated public interface ListSchemasResponseOrBuilder extends // @@protoc_insertion_point(interface_extends:google.pubsub.v1.ListSchemasResponse) @@ -33,6 +36,7 @@ public interface ListSchemasResponseOrBuilder * repeated .google.pubsub.v1.Schema schemas = 1; */ java.util.List getSchemasList(); + /** * * @@ -43,6 +47,7 @@ public interface ListSchemasResponseOrBuilder * repeated .google.pubsub.v1.Schema schemas = 1; */ com.google.pubsub.v1.Schema getSchemas(int index); + /** * * @@ -53,6 +58,7 @@ public interface ListSchemasResponseOrBuilder * repeated .google.pubsub.v1.Schema schemas = 1; */ int getSchemasCount(); + /** * * @@ -63,6 +69,7 @@ public interface ListSchemasResponseOrBuilder * repeated .google.pubsub.v1.Schema schemas = 1; */ java.util.List getSchemasOrBuilderList(); + /** * * @@ -87,6 +94,7 @@ public interface ListSchemasResponseOrBuilder * @return The nextPageToken. */ java.lang.String getNextPageToken(); + /** * * diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSnapshotsRequest.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSnapshotsRequest.java index 72ce020e1..f25cd5e2e 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSnapshotsRequest.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSnapshotsRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; @@ -27,13 +29,25 @@ * * Protobuf type {@code google.pubsub.v1.ListSnapshotsRequest} */ -public final class ListSnapshotsRequest extends com.google.protobuf.GeneratedMessageV3 +@com.google.protobuf.Generated +public final class ListSnapshotsRequest extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:google.pubsub.v1.ListSnapshotsRequest) ListSnapshotsRequestOrBuilder { private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "ListSnapshotsRequest"); + } + // Use ListSnapshotsRequest.newBuilder() to construct. - private ListSnapshotsRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + private ListSnapshotsRequest(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); } @@ -42,80 +56,13 @@ private ListSnapshotsRequest() { pageToken_ = ""; } - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new ListSnapshotsRequest(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - private ListSnapshotsRequest( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - java.lang.String s = input.readStringRequireUtf8(); - - project_ = s; - break; - } - case 16: - { - pageSize_ = input.readInt32(); - break; - } - case 26: - { - java.lang.String s = input.readStringRequireUtf8(); - - pageToken_ = s; - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_ListSnapshotsRequest_descriptor; } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_ListSnapshotsRequest_fieldAccessorTable @@ -125,7 +72,10 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } public static final int PROJECT_FIELD_NUMBER = 1; - private volatile java.lang.Object project_; + + @SuppressWarnings("serial") + private volatile java.lang.Object project_ = ""; + /** * * @@ -152,6 +102,7 @@ public java.lang.String getProject() { return s; } } + /** * * @@ -180,15 +131,16 @@ public com.google.protobuf.ByteString getProjectBytes() { } public static final int PAGE_SIZE_FIELD_NUMBER = 2; - private int pageSize_; + private int pageSize_ = 0; + /** * * *
    -   * Maximum number of snapshots to return.
    +   * Optional. Maximum number of snapshots to return.
        * 
    * - * int32 page_size = 2; + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The pageSize. */ @@ -198,17 +150,20 @@ public int getPageSize() { } public static final int PAGE_TOKEN_FIELD_NUMBER = 3; - private volatile java.lang.Object pageToken_; + + @SuppressWarnings("serial") + private volatile java.lang.Object pageToken_ = ""; + /** * * *
    -   * The value returned by the last `ListSnapshotsResponse`; indicates that this
    -   * is a continuation of a prior `ListSnapshots` call, and that the system
    -   * should return the next page of data.
    +   * Optional. The value returned by the last `ListSnapshotsResponse`; indicates
    +   * that this is a continuation of a prior `ListSnapshots` call, and that the
    +   * system should return the next page of data.
        * 
    * - * string page_token = 3; + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; * * @return The pageToken. */ @@ -224,16 +179,17 @@ public java.lang.String getPageToken() { return s; } } + /** * * *
    -   * The value returned by the last `ListSnapshotsResponse`; indicates that this
    -   * is a continuation of a prior `ListSnapshots` call, and that the system
    -   * should return the next page of data.
    +   * Optional. The value returned by the last `ListSnapshotsResponse`; indicates
    +   * that this is a continuation of a prior `ListSnapshots` call, and that the
    +   * system should return the next page of data.
        * 
    * - * string page_token = 3; + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; * * @return The bytes for pageToken. */ @@ -264,16 +220,16 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!getProjectBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, project_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(project_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, project_); } if (pageSize_ != 0) { output.writeInt32(2, pageSize_); } - if (!getPageTokenBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 3, pageToken_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(pageToken_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 3, pageToken_); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -282,16 +238,16 @@ public int getSerializedSize() { if (size != -1) return size; size = 0; - if (!getProjectBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, project_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(project_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, project_); } if (pageSize_ != 0) { size += com.google.protobuf.CodedOutputStream.computeInt32Size(2, pageSize_); } - if (!getPageTokenBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, pageToken_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(pageToken_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(3, pageToken_); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -310,7 +266,7 @@ public boolean equals(final java.lang.Object obj) { if (!getProject().equals(other.getProject())) return false; if (getPageSize() != other.getPageSize()) return false; if (!getPageToken().equals(other.getPageToken())) return false; - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -327,7 +283,7 @@ public int hashCode() { hash = (53 * hash) + getPageSize(); hash = (37 * hash) + PAGE_TOKEN_FIELD_NUMBER; hash = (53 * hash) + getPageToken().hashCode(); - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -369,38 +325,38 @@ public static com.google.pubsub.v1.ListSnapshotsRequest parseFrom( public static com.google.pubsub.v1.ListSnapshotsRequest parseFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.ListSnapshotsRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.ListSnapshotsRequest parseDelimitedFrom( java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); } public static com.google.pubsub.v1.ListSnapshotsRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.ListSnapshotsRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.ListSnapshotsRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } @@ -423,10 +379,11 @@ public Builder toBuilder() { } @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** * * @@ -436,7 +393,7 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build * * Protobuf type {@code google.pubsub.v1.ListSnapshotsRequest} */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements // @@protoc_insertion_point(builder_implements:google.pubsub.v1.ListSnapshotsRequest) com.google.pubsub.v1.ListSnapshotsRequestOrBuilder { @@ -446,7 +403,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_ListSnapshotsRequest_fieldAccessorTable @@ -456,28 +413,19 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } // Construct using com.google.pubsub.v1.ListSnapshotsRequest.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } + private Builder() {} - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} } @java.lang.Override public Builder clear() { super.clear(); + bitField0_ = 0; project_ = ""; - pageSize_ = 0; - pageToken_ = ""; - return this; } @@ -505,44 +453,24 @@ public com.google.pubsub.v1.ListSnapshotsRequest build() { public com.google.pubsub.v1.ListSnapshotsRequest buildPartial() { com.google.pubsub.v1.ListSnapshotsRequest result = new com.google.pubsub.v1.ListSnapshotsRequest(this); - result.project_ = project_; - result.pageSize_ = pageSize_; - result.pageToken_ = pageToken_; + if (bitField0_ != 0) { + buildPartial0(result); + } onBuilt(); return result; } - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); + private void buildPartial0(com.google.pubsub.v1.ListSnapshotsRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.project_ = project_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.pageSize_ = pageSize_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.pageToken_ = pageToken_; + } } @java.lang.Override @@ -559,6 +487,7 @@ public Builder mergeFrom(com.google.pubsub.v1.ListSnapshotsRequest other) { if (other == com.google.pubsub.v1.ListSnapshotsRequest.getDefaultInstance()) return this; if (!other.getProject().isEmpty()) { project_ = other.project_; + bitField0_ |= 0x00000001; onChanged(); } if (other.getPageSize() != 0) { @@ -566,9 +495,10 @@ public Builder mergeFrom(com.google.pubsub.v1.ListSnapshotsRequest other) { } if (!other.getPageToken().isEmpty()) { pageToken_ = other.pageToken_; + bitField0_ |= 0x00000004; onChanged(); } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -583,21 +513,56 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.pubsub.v1.ListSnapshotsRequest parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + project_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 16: + { + pageSize_ = input.readInt32(); + bitField0_ |= 0x00000002; + break; + } // case 16 + case 26: + { + pageToken_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000004; + break; + } // case 26 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.google.pubsub.v1.ListSnapshotsRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } + private int bitField0_; + private java.lang.Object project_ = ""; + /** * * @@ -623,6 +588,7 @@ public java.lang.String getProject() { return (java.lang.String) ref; } } + /** * * @@ -648,6 +614,7 @@ public com.google.protobuf.ByteString getProjectBytes() { return (com.google.protobuf.ByteString) ref; } } + /** * * @@ -667,11 +634,12 @@ public Builder setProject(java.lang.String value) { if (value == null) { throw new NullPointerException(); } - project_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } + /** * * @@ -687,11 +655,12 @@ public Builder setProject(java.lang.String value) { * @return This builder for chaining. */ public Builder clearProject() { - project_ = getDefaultInstance().getProject(); + bitField0_ = (bitField0_ & ~0x00000001); onChanged(); return this; } + /** * * @@ -712,21 +681,22 @@ public Builder setProjectBytes(com.google.protobuf.ByteString value) { throw new NullPointerException(); } checkByteStringIsUtf8(value); - project_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } private int pageSize_; + /** * * *
    -     * Maximum number of snapshots to return.
    +     * Optional. Maximum number of snapshots to return.
          * 
    * - * int32 page_size = 2; + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The pageSize. */ @@ -734,14 +704,15 @@ public Builder setProjectBytes(com.google.protobuf.ByteString value) { public int getPageSize() { return pageSize_; } + /** * * *
    -     * Maximum number of snapshots to return.
    +     * Optional. Maximum number of snapshots to return.
          * 
    * - * int32 page_size = 2; + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @param value The pageSize to set. * @return This builder for chaining. @@ -749,38 +720,41 @@ public int getPageSize() { public Builder setPageSize(int value) { pageSize_ = value; + bitField0_ |= 0x00000002; onChanged(); return this; } + /** * * *
    -     * Maximum number of snapshots to return.
    +     * Optional. Maximum number of snapshots to return.
          * 
    * - * int32 page_size = 2; + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return This builder for chaining. */ public Builder clearPageSize() { - + bitField0_ = (bitField0_ & ~0x00000002); pageSize_ = 0; onChanged(); return this; } private java.lang.Object pageToken_ = ""; + /** * * *
    -     * The value returned by the last `ListSnapshotsResponse`; indicates that this
    -     * is a continuation of a prior `ListSnapshots` call, and that the system
    -     * should return the next page of data.
    +     * Optional. The value returned by the last `ListSnapshotsResponse`; indicates
    +     * that this is a continuation of a prior `ListSnapshots` call, and that the
    +     * system should return the next page of data.
          * 
    * - * string page_token = 3; + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; * * @return The pageToken. */ @@ -795,16 +769,17 @@ public java.lang.String getPageToken() { return (java.lang.String) ref; } } + /** * * *
    -     * The value returned by the last `ListSnapshotsResponse`; indicates that this
    -     * is a continuation of a prior `ListSnapshots` call, and that the system
    -     * should return the next page of data.
    +     * Optional. The value returned by the last `ListSnapshotsResponse`; indicates
    +     * that this is a continuation of a prior `ListSnapshots` call, and that the
    +     * system should return the next page of data.
          * 
    * - * string page_token = 3; + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; * * @return The bytes for pageToken. */ @@ -819,16 +794,17 @@ public com.google.protobuf.ByteString getPageTokenBytes() { return (com.google.protobuf.ByteString) ref; } } + /** * * *
    -     * The value returned by the last `ListSnapshotsResponse`; indicates that this
    -     * is a continuation of a prior `ListSnapshots` call, and that the system
    -     * should return the next page of data.
    +     * Optional. The value returned by the last `ListSnapshotsResponse`; indicates
    +     * that this is a continuation of a prior `ListSnapshots` call, and that the
    +     * system should return the next page of data.
          * 
    * - * string page_token = 3; + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; * * @param value The pageToken to set. * @return This builder for chaining. @@ -837,40 +813,42 @@ public Builder setPageToken(java.lang.String value) { if (value == null) { throw new NullPointerException(); } - pageToken_ = value; + bitField0_ |= 0x00000004; onChanged(); return this; } + /** * * *
    -     * The value returned by the last `ListSnapshotsResponse`; indicates that this
    -     * is a continuation of a prior `ListSnapshots` call, and that the system
    -     * should return the next page of data.
    +     * Optional. The value returned by the last `ListSnapshotsResponse`; indicates
    +     * that this is a continuation of a prior `ListSnapshots` call, and that the
    +     * system should return the next page of data.
          * 
    * - * string page_token = 3; + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; * * @return This builder for chaining. */ public Builder clearPageToken() { - pageToken_ = getDefaultInstance().getPageToken(); + bitField0_ = (bitField0_ & ~0x00000004); onChanged(); return this; } + /** * * *
    -     * The value returned by the last `ListSnapshotsResponse`; indicates that this
    -     * is a continuation of a prior `ListSnapshots` call, and that the system
    -     * should return the next page of data.
    +     * Optional. The value returned by the last `ListSnapshotsResponse`; indicates
    +     * that this is a continuation of a prior `ListSnapshots` call, and that the
    +     * system should return the next page of data.
          * 
    * - * string page_token = 3; + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; * * @param value The bytes for pageToken to set. * @return This builder for chaining. @@ -880,23 +858,12 @@ public Builder setPageTokenBytes(com.google.protobuf.ByteString value) { throw new NullPointerException(); } checkByteStringIsUtf8(value); - pageToken_ = value; + bitField0_ |= 0x00000004; onChanged(); return this; } - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - // @@protoc_insertion_point(builder_scope:google.pubsub.v1.ListSnapshotsRequest) } @@ -918,7 +885,18 @@ public ListSnapshotsRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new ListSnapshotsRequest(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSnapshotsRequestOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSnapshotsRequestOrBuilder.java index c4a67ace0..b51ea89ab 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSnapshotsRequestOrBuilder.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSnapshotsRequestOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; +@com.google.protobuf.Generated public interface ListSnapshotsRequestOrBuilder extends // @@protoc_insertion_point(interface_extends:google.pubsub.v1.ListSnapshotsRequest) @@ -38,6 +41,7 @@ public interface ListSnapshotsRequestOrBuilder * @return The project. */ java.lang.String getProject(); + /** * * @@ -58,10 +62,10 @@ public interface ListSnapshotsRequestOrBuilder * * *
    -   * Maximum number of snapshots to return.
    +   * Optional. Maximum number of snapshots to return.
        * 
    * - * int32 page_size = 2; + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The pageSize. */ @@ -71,26 +75,27 @@ public interface ListSnapshotsRequestOrBuilder * * *
    -   * The value returned by the last `ListSnapshotsResponse`; indicates that this
    -   * is a continuation of a prior `ListSnapshots` call, and that the system
    -   * should return the next page of data.
    +   * Optional. The value returned by the last `ListSnapshotsResponse`; indicates
    +   * that this is a continuation of a prior `ListSnapshots` call, and that the
    +   * system should return the next page of data.
        * 
    * - * string page_token = 3; + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; * * @return The pageToken. */ java.lang.String getPageToken(); + /** * * *
    -   * The value returned by the last `ListSnapshotsResponse`; indicates that this
    -   * is a continuation of a prior `ListSnapshots` call, and that the system
    -   * should return the next page of data.
    +   * Optional. The value returned by the last `ListSnapshotsResponse`; indicates
    +   * that this is a continuation of a prior `ListSnapshots` call, and that the
    +   * system should return the next page of data.
        * 
    * - * string page_token = 3; + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; * * @return The bytes for pageToken. */ diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSnapshotsResponse.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSnapshotsResponse.java index e355e42f6..5c4719949 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSnapshotsResponse.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSnapshotsResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; @@ -27,13 +29,25 @@ * * Protobuf type {@code google.pubsub.v1.ListSnapshotsResponse} */ -public final class ListSnapshotsResponse extends com.google.protobuf.GeneratedMessageV3 +@com.google.protobuf.Generated +public final class ListSnapshotsResponse extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:google.pubsub.v1.ListSnapshotsResponse) ListSnapshotsResponseOrBuilder { private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "ListSnapshotsResponse"); + } + // Use ListSnapshotsResponse.newBuilder() to construct. - private ListSnapshotsResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + private ListSnapshotsResponse(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); } @@ -42,82 +56,13 @@ private ListSnapshotsResponse() { nextPageToken_ = ""; } - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new ListSnapshotsResponse(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - private ListSnapshotsResponse( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - if (!((mutable_bitField0_ & 0x00000001) != 0)) { - snapshots_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000001; - } - snapshots_.add( - input.readMessage(com.google.pubsub.v1.Snapshot.parser(), extensionRegistry)); - break; - } - case 18: - { - java.lang.String s = input.readStringRequireUtf8(); - - nextPageToken_ = s; - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000001) != 0)) { - snapshots_ = java.util.Collections.unmodifiableList(snapshots_); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_ListSnapshotsResponse_descriptor; } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_ListSnapshotsResponse_fieldAccessorTable @@ -127,68 +72,85 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } public static final int SNAPSHOTS_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") private java.util.List snapshots_; + /** * * *
    -   * The resulting snapshots.
    +   * Optional. The resulting snapshots.
        * 
    * - * repeated .google.pubsub.v1.Snapshot snapshots = 1; + * + * repeated .google.pubsub.v1.Snapshot snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ @java.lang.Override public java.util.List getSnapshotsList() { return snapshots_; } + /** * * *
    -   * The resulting snapshots.
    +   * Optional. The resulting snapshots.
        * 
    * - * repeated .google.pubsub.v1.Snapshot snapshots = 1; + * + * repeated .google.pubsub.v1.Snapshot snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ @java.lang.Override public java.util.List getSnapshotsOrBuilderList() { return snapshots_; } + /** * * *
    -   * The resulting snapshots.
    +   * Optional. The resulting snapshots.
        * 
    * - * repeated .google.pubsub.v1.Snapshot snapshots = 1; + * + * repeated .google.pubsub.v1.Snapshot snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ @java.lang.Override public int getSnapshotsCount() { return snapshots_.size(); } + /** * * *
    -   * The resulting snapshots.
    +   * Optional. The resulting snapshots.
        * 
    * - * repeated .google.pubsub.v1.Snapshot snapshots = 1; + * + * repeated .google.pubsub.v1.Snapshot snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ @java.lang.Override public com.google.pubsub.v1.Snapshot getSnapshots(int index) { return snapshots_.get(index); } + /** * * *
    -   * The resulting snapshots.
    +   * Optional. The resulting snapshots.
        * 
    * - * repeated .google.pubsub.v1.Snapshot snapshots = 1; + * + * repeated .google.pubsub.v1.Snapshot snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ @java.lang.Override public com.google.pubsub.v1.SnapshotOrBuilder getSnapshotsOrBuilder(int index) { @@ -196,16 +158,20 @@ public com.google.pubsub.v1.SnapshotOrBuilder getSnapshotsOrBuilder(int index) { } public static final int NEXT_PAGE_TOKEN_FIELD_NUMBER = 2; - private volatile java.lang.Object nextPageToken_; + + @SuppressWarnings("serial") + private volatile java.lang.Object nextPageToken_ = ""; + /** * * *
    -   * If not empty, indicates that there may be more snapshot that match the
    -   * request; this value should be passed in a new `ListSnapshotsRequest`.
    +   * Optional. If not empty, indicates that there may be more snapshot that
    +   * match the request; this value should be passed in a new
    +   * `ListSnapshotsRequest`.
        * 
    * - * string next_page_token = 2; + * string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The nextPageToken. */ @@ -221,15 +187,17 @@ public java.lang.String getNextPageToken() { return s; } } + /** * * *
    -   * If not empty, indicates that there may be more snapshot that match the
    -   * request; this value should be passed in a new `ListSnapshotsRequest`.
    +   * Optional. If not empty, indicates that there may be more snapshot that
    +   * match the request; this value should be passed in a new
    +   * `ListSnapshotsRequest`.
        * 
    * - * string next_page_token = 2; + * string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The bytes for nextPageToken. */ @@ -263,10 +231,10 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io for (int i = 0; i < snapshots_.size(); i++) { output.writeMessage(1, snapshots_.get(i)); } - if (!getNextPageTokenBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 2, nextPageToken_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(nextPageToken_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, nextPageToken_); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -278,10 +246,10 @@ public int getSerializedSize() { for (int i = 0; i < snapshots_.size(); i++) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, snapshots_.get(i)); } - if (!getNextPageTokenBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, nextPageToken_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(nextPageToken_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, nextPageToken_); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -299,7 +267,7 @@ public boolean equals(final java.lang.Object obj) { if (!getSnapshotsList().equals(other.getSnapshotsList())) return false; if (!getNextPageToken().equals(other.getNextPageToken())) return false; - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -316,7 +284,7 @@ public int hashCode() { } hash = (37 * hash) + NEXT_PAGE_TOKEN_FIELD_NUMBER; hash = (53 * hash) + getNextPageToken().hashCode(); - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -358,38 +326,38 @@ public static com.google.pubsub.v1.ListSnapshotsResponse parseFrom( public static com.google.pubsub.v1.ListSnapshotsResponse parseFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.ListSnapshotsResponse parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.ListSnapshotsResponse parseDelimitedFrom( java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); } public static com.google.pubsub.v1.ListSnapshotsResponse parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.ListSnapshotsResponse parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.ListSnapshotsResponse parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } @@ -412,10 +380,11 @@ public Builder toBuilder() { } @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** * * @@ -425,7 +394,7 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build * * Protobuf type {@code google.pubsub.v1.ListSnapshotsResponse} */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements // @@protoc_insertion_point(builder_implements:google.pubsub.v1.ListSnapshotsResponse) com.google.pubsub.v1.ListSnapshotsResponseOrBuilder { @@ -435,7 +404,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_ListSnapshotsResponse_fieldAccessorTable @@ -445,32 +414,24 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } // Construct using com.google.pubsub.v1.ListSnapshotsResponse.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } + private Builder() {} - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { - getSnapshotsFieldBuilder(); - } } @java.lang.Override public Builder clear() { super.clear(); + bitField0_ = 0; if (snapshotsBuilder_ == null) { snapshots_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); } else { + snapshots_ = null; snapshotsBuilder_.clear(); } + bitField0_ = (bitField0_ & ~0x00000001); nextPageToken_ = ""; - return this; } @@ -498,7 +459,15 @@ public com.google.pubsub.v1.ListSnapshotsResponse build() { public com.google.pubsub.v1.ListSnapshotsResponse buildPartial() { com.google.pubsub.v1.ListSnapshotsResponse result = new com.google.pubsub.v1.ListSnapshotsResponse(this); - int from_bitField0_ = bitField0_; + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields(com.google.pubsub.v1.ListSnapshotsResponse result) { if (snapshotsBuilder_ == null) { if (((bitField0_ & 0x00000001) != 0)) { snapshots_ = java.util.Collections.unmodifiableList(snapshots_); @@ -508,42 +477,13 @@ public com.google.pubsub.v1.ListSnapshotsResponse buildPartial() { } else { result.snapshots_ = snapshotsBuilder_.build(); } - result.nextPageToken_ = nextPageToken_; - onBuilt(); - return result; - } - - @java.lang.Override - public Builder clone() { - return super.clone(); } - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); + private void buildPartial0(com.google.pubsub.v1.ListSnapshotsResponse result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000002) != 0)) { + result.nextPageToken_ = nextPageToken_; + } } @java.lang.Override @@ -577,8 +517,8 @@ public Builder mergeFrom(com.google.pubsub.v1.ListSnapshotsResponse other) { snapshots_ = other.snapshots_; bitField0_ = (bitField0_ & ~0x00000001); snapshotsBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders - ? getSnapshotsFieldBuilder() + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders + ? internalGetSnapshotsFieldBuilder() : null; } else { snapshotsBuilder_.addAllMessages(other.snapshots_); @@ -587,9 +527,10 @@ public Builder mergeFrom(com.google.pubsub.v1.ListSnapshotsResponse other) { } if (!other.getNextPageToken().isEmpty()) { nextPageToken_ = other.nextPageToken_; + bitField0_ |= 0x00000002; onChanged(); } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -604,17 +545,49 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.pubsub.v1.ListSnapshotsResponse parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.pubsub.v1.Snapshot m = + input.readMessage(com.google.pubsub.v1.Snapshot.parser(), extensionRegistry); + if (snapshotsBuilder_ == null) { + ensureSnapshotsIsMutable(); + snapshots_.add(m); + } else { + snapshotsBuilder_.addMessage(m); + } + break; + } // case 10 + case 18: + { + nextPageToken_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.google.pubsub.v1.ListSnapshotsResponse) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } @@ -630,7 +603,7 @@ private void ensureSnapshotsIsMutable() { } } - private com.google.protobuf.RepeatedFieldBuilderV3< + private com.google.protobuf.RepeatedFieldBuilder< com.google.pubsub.v1.Snapshot, com.google.pubsub.v1.Snapshot.Builder, com.google.pubsub.v1.SnapshotOrBuilder> @@ -640,10 +613,12 @@ private void ensureSnapshotsIsMutable() { * * *
    -     * The resulting snapshots.
    +     * Optional. The resulting snapshots.
          * 
    * - * repeated .google.pubsub.v1.Snapshot snapshots = 1; + * + * repeated .google.pubsub.v1.Snapshot snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public java.util.List getSnapshotsList() { if (snapshotsBuilder_ == null) { @@ -652,14 +627,17 @@ public java.util.List getSnapshotsList() { return snapshotsBuilder_.getMessageList(); } } + /** * * *
    -     * The resulting snapshots.
    +     * Optional. The resulting snapshots.
          * 
    * - * repeated .google.pubsub.v1.Snapshot snapshots = 1; + * + * repeated .google.pubsub.v1.Snapshot snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public int getSnapshotsCount() { if (snapshotsBuilder_ == null) { @@ -668,14 +646,17 @@ public int getSnapshotsCount() { return snapshotsBuilder_.getCount(); } } + /** * * *
    -     * The resulting snapshots.
    +     * Optional. The resulting snapshots.
          * 
    * - * repeated .google.pubsub.v1.Snapshot snapshots = 1; + * + * repeated .google.pubsub.v1.Snapshot snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public com.google.pubsub.v1.Snapshot getSnapshots(int index) { if (snapshotsBuilder_ == null) { @@ -684,14 +665,17 @@ public com.google.pubsub.v1.Snapshot getSnapshots(int index) { return snapshotsBuilder_.getMessage(index); } } + /** * * *
    -     * The resulting snapshots.
    +     * Optional. The resulting snapshots.
          * 
    * - * repeated .google.pubsub.v1.Snapshot snapshots = 1; + * + * repeated .google.pubsub.v1.Snapshot snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public Builder setSnapshots(int index, com.google.pubsub.v1.Snapshot value) { if (snapshotsBuilder_ == null) { @@ -706,14 +690,17 @@ public Builder setSnapshots(int index, com.google.pubsub.v1.Snapshot value) { } return this; } + /** * * *
    -     * The resulting snapshots.
    +     * Optional. The resulting snapshots.
          * 
    * - * repeated .google.pubsub.v1.Snapshot snapshots = 1; + * + * repeated .google.pubsub.v1.Snapshot snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public Builder setSnapshots(int index, com.google.pubsub.v1.Snapshot.Builder builderForValue) { if (snapshotsBuilder_ == null) { @@ -725,14 +712,17 @@ public Builder setSnapshots(int index, com.google.pubsub.v1.Snapshot.Builder bui } return this; } + /** * * *
    -     * The resulting snapshots.
    +     * Optional. The resulting snapshots.
          * 
    * - * repeated .google.pubsub.v1.Snapshot snapshots = 1; + * + * repeated .google.pubsub.v1.Snapshot snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public Builder addSnapshots(com.google.pubsub.v1.Snapshot value) { if (snapshotsBuilder_ == null) { @@ -747,14 +737,17 @@ public Builder addSnapshots(com.google.pubsub.v1.Snapshot value) { } return this; } + /** * * *
    -     * The resulting snapshots.
    +     * Optional. The resulting snapshots.
          * 
    * - * repeated .google.pubsub.v1.Snapshot snapshots = 1; + * + * repeated .google.pubsub.v1.Snapshot snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public Builder addSnapshots(int index, com.google.pubsub.v1.Snapshot value) { if (snapshotsBuilder_ == null) { @@ -769,14 +762,17 @@ public Builder addSnapshots(int index, com.google.pubsub.v1.Snapshot value) { } return this; } + /** * * *
    -     * The resulting snapshots.
    +     * Optional. The resulting snapshots.
          * 
    * - * repeated .google.pubsub.v1.Snapshot snapshots = 1; + * + * repeated .google.pubsub.v1.Snapshot snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public Builder addSnapshots(com.google.pubsub.v1.Snapshot.Builder builderForValue) { if (snapshotsBuilder_ == null) { @@ -788,14 +784,17 @@ public Builder addSnapshots(com.google.pubsub.v1.Snapshot.Builder builderForValu } return this; } + /** * * *
    -     * The resulting snapshots.
    +     * Optional. The resulting snapshots.
          * 
    * - * repeated .google.pubsub.v1.Snapshot snapshots = 1; + * + * repeated .google.pubsub.v1.Snapshot snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public Builder addSnapshots(int index, com.google.pubsub.v1.Snapshot.Builder builderForValue) { if (snapshotsBuilder_ == null) { @@ -807,14 +806,17 @@ public Builder addSnapshots(int index, com.google.pubsub.v1.Snapshot.Builder bui } return this; } + /** * * *
    -     * The resulting snapshots.
    +     * Optional. The resulting snapshots.
          * 
    * - * repeated .google.pubsub.v1.Snapshot snapshots = 1; + * + * repeated .google.pubsub.v1.Snapshot snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public Builder addAllSnapshots( java.lang.Iterable values) { @@ -827,14 +829,17 @@ public Builder addAllSnapshots( } return this; } + /** * * *
    -     * The resulting snapshots.
    +     * Optional. The resulting snapshots.
          * 
    * - * repeated .google.pubsub.v1.Snapshot snapshots = 1; + * + * repeated .google.pubsub.v1.Snapshot snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public Builder clearSnapshots() { if (snapshotsBuilder_ == null) { @@ -846,14 +851,17 @@ public Builder clearSnapshots() { } return this; } + /** * * *
    -     * The resulting snapshots.
    +     * Optional. The resulting snapshots.
          * 
    * - * repeated .google.pubsub.v1.Snapshot snapshots = 1; + * + * repeated .google.pubsub.v1.Snapshot snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public Builder removeSnapshots(int index) { if (snapshotsBuilder_ == null) { @@ -865,26 +873,32 @@ public Builder removeSnapshots(int index) { } return this; } + /** * * *
    -     * The resulting snapshots.
    +     * Optional. The resulting snapshots.
          * 
    * - * repeated .google.pubsub.v1.Snapshot snapshots = 1; + * + * repeated .google.pubsub.v1.Snapshot snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public com.google.pubsub.v1.Snapshot.Builder getSnapshotsBuilder(int index) { - return getSnapshotsFieldBuilder().getBuilder(index); + return internalGetSnapshotsFieldBuilder().getBuilder(index); } + /** * * *
    -     * The resulting snapshots.
    +     * Optional. The resulting snapshots.
          * 
    * - * repeated .google.pubsub.v1.Snapshot snapshots = 1; + * + * repeated .google.pubsub.v1.Snapshot snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public com.google.pubsub.v1.SnapshotOrBuilder getSnapshotsOrBuilder(int index) { if (snapshotsBuilder_ == null) { @@ -893,14 +907,17 @@ public com.google.pubsub.v1.SnapshotOrBuilder getSnapshotsOrBuilder(int index) { return snapshotsBuilder_.getMessageOrBuilder(index); } } + /** * * *
    -     * The resulting snapshots.
    +     * Optional. The resulting snapshots.
          * 
    * - * repeated .google.pubsub.v1.Snapshot snapshots = 1; + * + * repeated .google.pubsub.v1.Snapshot snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public java.util.List getSnapshotsOrBuilderList() { @@ -910,53 +927,62 @@ public com.google.pubsub.v1.SnapshotOrBuilder getSnapshotsOrBuilder(int index) { return java.util.Collections.unmodifiableList(snapshots_); } } + /** * * *
    -     * The resulting snapshots.
    +     * Optional. The resulting snapshots.
          * 
    * - * repeated .google.pubsub.v1.Snapshot snapshots = 1; + * + * repeated .google.pubsub.v1.Snapshot snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public com.google.pubsub.v1.Snapshot.Builder addSnapshotsBuilder() { - return getSnapshotsFieldBuilder() + return internalGetSnapshotsFieldBuilder() .addBuilder(com.google.pubsub.v1.Snapshot.getDefaultInstance()); } + /** * * *
    -     * The resulting snapshots.
    +     * Optional. The resulting snapshots.
          * 
    * - * repeated .google.pubsub.v1.Snapshot snapshots = 1; + * + * repeated .google.pubsub.v1.Snapshot snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public com.google.pubsub.v1.Snapshot.Builder addSnapshotsBuilder(int index) { - return getSnapshotsFieldBuilder() + return internalGetSnapshotsFieldBuilder() .addBuilder(index, com.google.pubsub.v1.Snapshot.getDefaultInstance()); } + /** * * *
    -     * The resulting snapshots.
    +     * Optional. The resulting snapshots.
          * 
    * - * repeated .google.pubsub.v1.Snapshot snapshots = 1; + * + * repeated .google.pubsub.v1.Snapshot snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public java.util.List getSnapshotsBuilderList() { - return getSnapshotsFieldBuilder().getBuilderList(); + return internalGetSnapshotsFieldBuilder().getBuilderList(); } - private com.google.protobuf.RepeatedFieldBuilderV3< + private com.google.protobuf.RepeatedFieldBuilder< com.google.pubsub.v1.Snapshot, com.google.pubsub.v1.Snapshot.Builder, com.google.pubsub.v1.SnapshotOrBuilder> - getSnapshotsFieldBuilder() { + internalGetSnapshotsFieldBuilder() { if (snapshotsBuilder_ == null) { snapshotsBuilder_ = - new com.google.protobuf.RepeatedFieldBuilderV3< + new com.google.protobuf.RepeatedFieldBuilder< com.google.pubsub.v1.Snapshot, com.google.pubsub.v1.Snapshot.Builder, com.google.pubsub.v1.SnapshotOrBuilder>( @@ -967,15 +993,17 @@ public java.util.List getSnapshotsBuilder } private java.lang.Object nextPageToken_ = ""; + /** * * *
    -     * If not empty, indicates that there may be more snapshot that match the
    -     * request; this value should be passed in a new `ListSnapshotsRequest`.
    +     * Optional. If not empty, indicates that there may be more snapshot that
    +     * match the request; this value should be passed in a new
    +     * `ListSnapshotsRequest`.
          * 
    * - * string next_page_token = 2; + * string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The nextPageToken. */ @@ -990,15 +1018,17 @@ public java.lang.String getNextPageToken() { return (java.lang.String) ref; } } + /** * * *
    -     * If not empty, indicates that there may be more snapshot that match the
    -     * request; this value should be passed in a new `ListSnapshotsRequest`.
    +     * Optional. If not empty, indicates that there may be more snapshot that
    +     * match the request; this value should be passed in a new
    +     * `ListSnapshotsRequest`.
          * 
    * - * string next_page_token = 2; + * string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The bytes for nextPageToken. */ @@ -1013,15 +1043,17 @@ public com.google.protobuf.ByteString getNextPageTokenBytes() { return (com.google.protobuf.ByteString) ref; } } + /** * * *
    -     * If not empty, indicates that there may be more snapshot that match the
    -     * request; this value should be passed in a new `ListSnapshotsRequest`.
    +     * Optional. If not empty, indicates that there may be more snapshot that
    +     * match the request; this value should be passed in a new
    +     * `ListSnapshotsRequest`.
          * 
    * - * string next_page_token = 2; + * string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @param value The nextPageToken to set. * @return This builder for chaining. @@ -1030,38 +1062,42 @@ public Builder setNextPageToken(java.lang.String value) { if (value == null) { throw new NullPointerException(); } - nextPageToken_ = value; + bitField0_ |= 0x00000002; onChanged(); return this; } + /** * * *
    -     * If not empty, indicates that there may be more snapshot that match the
    -     * request; this value should be passed in a new `ListSnapshotsRequest`.
    +     * Optional. If not empty, indicates that there may be more snapshot that
    +     * match the request; this value should be passed in a new
    +     * `ListSnapshotsRequest`.
          * 
    * - * string next_page_token = 2; + * string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return This builder for chaining. */ public Builder clearNextPageToken() { - nextPageToken_ = getDefaultInstance().getNextPageToken(); + bitField0_ = (bitField0_ & ~0x00000002); onChanged(); return this; } + /** * * *
    -     * If not empty, indicates that there may be more snapshot that match the
    -     * request; this value should be passed in a new `ListSnapshotsRequest`.
    +     * Optional. If not empty, indicates that there may be more snapshot that
    +     * match the request; this value should be passed in a new
    +     * `ListSnapshotsRequest`.
          * 
    * - * string next_page_token = 2; + * string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @param value The bytes for nextPageToken to set. * @return This builder for chaining. @@ -1071,23 +1107,12 @@ public Builder setNextPageTokenBytes(com.google.protobuf.ByteString value) { throw new NullPointerException(); } checkByteStringIsUtf8(value); - nextPageToken_ = value; + bitField0_ |= 0x00000002; onChanged(); return this; } - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - // @@protoc_insertion_point(builder_scope:google.pubsub.v1.ListSnapshotsResponse) } @@ -1109,7 +1134,18 @@ public ListSnapshotsResponse parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new ListSnapshotsResponse(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSnapshotsResponseOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSnapshotsResponseOrBuilder.java index bbbf2955d..ec4643a06 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSnapshotsResponseOrBuilder.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSnapshotsResponseOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; +@com.google.protobuf.Generated public interface ListSnapshotsResponseOrBuilder extends // @@protoc_insertion_point(interface_extends:google.pubsub.v1.ListSnapshotsResponse) @@ -27,50 +30,64 @@ public interface ListSnapshotsResponseOrBuilder * * *
    -   * The resulting snapshots.
    +   * Optional. The resulting snapshots.
        * 
    * - * repeated .google.pubsub.v1.Snapshot snapshots = 1; + * + * repeated .google.pubsub.v1.Snapshot snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ java.util.List getSnapshotsList(); + /** * * *
    -   * The resulting snapshots.
    +   * Optional. The resulting snapshots.
        * 
    * - * repeated .google.pubsub.v1.Snapshot snapshots = 1; + * + * repeated .google.pubsub.v1.Snapshot snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ com.google.pubsub.v1.Snapshot getSnapshots(int index); + /** * * *
    -   * The resulting snapshots.
    +   * Optional. The resulting snapshots.
        * 
    * - * repeated .google.pubsub.v1.Snapshot snapshots = 1; + * + * repeated .google.pubsub.v1.Snapshot snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ int getSnapshotsCount(); + /** * * *
    -   * The resulting snapshots.
    +   * Optional. The resulting snapshots.
        * 
    * - * repeated .google.pubsub.v1.Snapshot snapshots = 1; + * + * repeated .google.pubsub.v1.Snapshot snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ java.util.List getSnapshotsOrBuilderList(); + /** * * *
    -   * The resulting snapshots.
    +   * Optional. The resulting snapshots.
        * 
    * - * repeated .google.pubsub.v1.Snapshot snapshots = 1; + * + * repeated .google.pubsub.v1.Snapshot snapshots = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ com.google.pubsub.v1.SnapshotOrBuilder getSnapshotsOrBuilder(int index); @@ -78,24 +95,27 @@ public interface ListSnapshotsResponseOrBuilder * * *
    -   * If not empty, indicates that there may be more snapshot that match the
    -   * request; this value should be passed in a new `ListSnapshotsRequest`.
    +   * Optional. If not empty, indicates that there may be more snapshot that
    +   * match the request; this value should be passed in a new
    +   * `ListSnapshotsRequest`.
        * 
    * - * string next_page_token = 2; + * string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The nextPageToken. */ java.lang.String getNextPageToken(); + /** * * *
    -   * If not empty, indicates that there may be more snapshot that match the
    -   * request; this value should be passed in a new `ListSnapshotsRequest`.
    +   * Optional. If not empty, indicates that there may be more snapshot that
    +   * match the request; this value should be passed in a new
    +   * `ListSnapshotsRequest`.
        * 
    * - * string next_page_token = 2; + * string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The bytes for nextPageToken. */ diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSubscriptionsRequest.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSubscriptionsRequest.java index a1484c696..c1e4ddcb1 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSubscriptionsRequest.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSubscriptionsRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; @@ -27,13 +29,25 @@ * * Protobuf type {@code google.pubsub.v1.ListSubscriptionsRequest} */ -public final class ListSubscriptionsRequest extends com.google.protobuf.GeneratedMessageV3 +@com.google.protobuf.Generated +public final class ListSubscriptionsRequest extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:google.pubsub.v1.ListSubscriptionsRequest) ListSubscriptionsRequestOrBuilder { private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "ListSubscriptionsRequest"); + } + // Use ListSubscriptionsRequest.newBuilder() to construct. - private ListSubscriptionsRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + private ListSubscriptionsRequest(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); } @@ -42,80 +56,13 @@ private ListSubscriptionsRequest() { pageToken_ = ""; } - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new ListSubscriptionsRequest(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - private ListSubscriptionsRequest( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - java.lang.String s = input.readStringRequireUtf8(); - - project_ = s; - break; - } - case 16: - { - pageSize_ = input.readInt32(); - break; - } - case 26: - { - java.lang.String s = input.readStringRequireUtf8(); - - pageToken_ = s; - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_ListSubscriptionsRequest_descriptor; } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_ListSubscriptionsRequest_fieldAccessorTable @@ -125,7 +72,10 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } public static final int PROJECT_FIELD_NUMBER = 1; - private volatile java.lang.Object project_; + + @SuppressWarnings("serial") + private volatile java.lang.Object project_ = ""; + /** * * @@ -152,6 +102,7 @@ public java.lang.String getProject() { return s; } } + /** * * @@ -180,15 +131,16 @@ public com.google.protobuf.ByteString getProjectBytes() { } public static final int PAGE_SIZE_FIELD_NUMBER = 2; - private int pageSize_; + private int pageSize_ = 0; + /** * * *
    -   * Maximum number of subscriptions to return.
    +   * Optional. Maximum number of subscriptions to return.
        * 
    * - * int32 page_size = 2; + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The pageSize. */ @@ -198,17 +150,20 @@ public int getPageSize() { } public static final int PAGE_TOKEN_FIELD_NUMBER = 3; - private volatile java.lang.Object pageToken_; + + @SuppressWarnings("serial") + private volatile java.lang.Object pageToken_ = ""; + /** * * *
    -   * The value returned by the last `ListSubscriptionsResponse`; indicates that
    -   * this is a continuation of a prior `ListSubscriptions` call, and that the
    -   * system should return the next page of data.
    +   * Optional. The value returned by the last `ListSubscriptionsResponse`;
    +   * indicates that this is a continuation of a prior `ListSubscriptions` call,
    +   * and that the system should return the next page of data.
        * 
    * - * string page_token = 3; + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; * * @return The pageToken. */ @@ -224,16 +179,17 @@ public java.lang.String getPageToken() { return s; } } + /** * * *
    -   * The value returned by the last `ListSubscriptionsResponse`; indicates that
    -   * this is a continuation of a prior `ListSubscriptions` call, and that the
    -   * system should return the next page of data.
    +   * Optional. The value returned by the last `ListSubscriptionsResponse`;
    +   * indicates that this is a continuation of a prior `ListSubscriptions` call,
    +   * and that the system should return the next page of data.
        * 
    * - * string page_token = 3; + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; * * @return The bytes for pageToken. */ @@ -264,16 +220,16 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!getProjectBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, project_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(project_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, project_); } if (pageSize_ != 0) { output.writeInt32(2, pageSize_); } - if (!getPageTokenBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 3, pageToken_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(pageToken_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 3, pageToken_); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -282,16 +238,16 @@ public int getSerializedSize() { if (size != -1) return size; size = 0; - if (!getProjectBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, project_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(project_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, project_); } if (pageSize_ != 0) { size += com.google.protobuf.CodedOutputStream.computeInt32Size(2, pageSize_); } - if (!getPageTokenBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, pageToken_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(pageToken_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(3, pageToken_); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -310,7 +266,7 @@ public boolean equals(final java.lang.Object obj) { if (!getProject().equals(other.getProject())) return false; if (getPageSize() != other.getPageSize()) return false; if (!getPageToken().equals(other.getPageToken())) return false; - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -327,7 +283,7 @@ public int hashCode() { hash = (53 * hash) + getPageSize(); hash = (37 * hash) + PAGE_TOKEN_FIELD_NUMBER; hash = (53 * hash) + getPageToken().hashCode(); - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -369,38 +325,38 @@ public static com.google.pubsub.v1.ListSubscriptionsRequest parseFrom( public static com.google.pubsub.v1.ListSubscriptionsRequest parseFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.ListSubscriptionsRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.ListSubscriptionsRequest parseDelimitedFrom( java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); } public static com.google.pubsub.v1.ListSubscriptionsRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.ListSubscriptionsRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.ListSubscriptionsRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } @@ -423,10 +379,11 @@ public Builder toBuilder() { } @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** * * @@ -436,7 +393,7 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build * * Protobuf type {@code google.pubsub.v1.ListSubscriptionsRequest} */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements // @@protoc_insertion_point(builder_implements:google.pubsub.v1.ListSubscriptionsRequest) com.google.pubsub.v1.ListSubscriptionsRequestOrBuilder { @@ -446,7 +403,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_ListSubscriptionsRequest_fieldAccessorTable @@ -456,28 +413,19 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } // Construct using com.google.pubsub.v1.ListSubscriptionsRequest.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } + private Builder() {} - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} } @java.lang.Override public Builder clear() { super.clear(); + bitField0_ = 0; project_ = ""; - pageSize_ = 0; - pageToken_ = ""; - return this; } @@ -505,44 +453,24 @@ public com.google.pubsub.v1.ListSubscriptionsRequest build() { public com.google.pubsub.v1.ListSubscriptionsRequest buildPartial() { com.google.pubsub.v1.ListSubscriptionsRequest result = new com.google.pubsub.v1.ListSubscriptionsRequest(this); - result.project_ = project_; - result.pageSize_ = pageSize_; - result.pageToken_ = pageToken_; + if (bitField0_ != 0) { + buildPartial0(result); + } onBuilt(); return result; } - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); + private void buildPartial0(com.google.pubsub.v1.ListSubscriptionsRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.project_ = project_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.pageSize_ = pageSize_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.pageToken_ = pageToken_; + } } @java.lang.Override @@ -559,6 +487,7 @@ public Builder mergeFrom(com.google.pubsub.v1.ListSubscriptionsRequest other) { if (other == com.google.pubsub.v1.ListSubscriptionsRequest.getDefaultInstance()) return this; if (!other.getProject().isEmpty()) { project_ = other.project_; + bitField0_ |= 0x00000001; onChanged(); } if (other.getPageSize() != 0) { @@ -566,9 +495,10 @@ public Builder mergeFrom(com.google.pubsub.v1.ListSubscriptionsRequest other) { } if (!other.getPageToken().isEmpty()) { pageToken_ = other.pageToken_; + bitField0_ |= 0x00000004; onChanged(); } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -583,21 +513,56 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.pubsub.v1.ListSubscriptionsRequest parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + project_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 16: + { + pageSize_ = input.readInt32(); + bitField0_ |= 0x00000002; + break; + } // case 16 + case 26: + { + pageToken_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000004; + break; + } // case 26 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.google.pubsub.v1.ListSubscriptionsRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } + private int bitField0_; + private java.lang.Object project_ = ""; + /** * * @@ -623,6 +588,7 @@ public java.lang.String getProject() { return (java.lang.String) ref; } } + /** * * @@ -648,6 +614,7 @@ public com.google.protobuf.ByteString getProjectBytes() { return (com.google.protobuf.ByteString) ref; } } + /** * * @@ -667,11 +634,12 @@ public Builder setProject(java.lang.String value) { if (value == null) { throw new NullPointerException(); } - project_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } + /** * * @@ -687,11 +655,12 @@ public Builder setProject(java.lang.String value) { * @return This builder for chaining. */ public Builder clearProject() { - project_ = getDefaultInstance().getProject(); + bitField0_ = (bitField0_ & ~0x00000001); onChanged(); return this; } + /** * * @@ -712,21 +681,22 @@ public Builder setProjectBytes(com.google.protobuf.ByteString value) { throw new NullPointerException(); } checkByteStringIsUtf8(value); - project_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } private int pageSize_; + /** * * *
    -     * Maximum number of subscriptions to return.
    +     * Optional. Maximum number of subscriptions to return.
          * 
    * - * int32 page_size = 2; + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The pageSize. */ @@ -734,14 +704,15 @@ public Builder setProjectBytes(com.google.protobuf.ByteString value) { public int getPageSize() { return pageSize_; } + /** * * *
    -     * Maximum number of subscriptions to return.
    +     * Optional. Maximum number of subscriptions to return.
          * 
    * - * int32 page_size = 2; + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @param value The pageSize to set. * @return This builder for chaining. @@ -749,38 +720,41 @@ public int getPageSize() { public Builder setPageSize(int value) { pageSize_ = value; + bitField0_ |= 0x00000002; onChanged(); return this; } + /** * * *
    -     * Maximum number of subscriptions to return.
    +     * Optional. Maximum number of subscriptions to return.
          * 
    * - * int32 page_size = 2; + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return This builder for chaining. */ public Builder clearPageSize() { - + bitField0_ = (bitField0_ & ~0x00000002); pageSize_ = 0; onChanged(); return this; } private java.lang.Object pageToken_ = ""; + /** * * *
    -     * The value returned by the last `ListSubscriptionsResponse`; indicates that
    -     * this is a continuation of a prior `ListSubscriptions` call, and that the
    -     * system should return the next page of data.
    +     * Optional. The value returned by the last `ListSubscriptionsResponse`;
    +     * indicates that this is a continuation of a prior `ListSubscriptions` call,
    +     * and that the system should return the next page of data.
          * 
    * - * string page_token = 3; + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; * * @return The pageToken. */ @@ -795,16 +769,17 @@ public java.lang.String getPageToken() { return (java.lang.String) ref; } } + /** * * *
    -     * The value returned by the last `ListSubscriptionsResponse`; indicates that
    -     * this is a continuation of a prior `ListSubscriptions` call, and that the
    -     * system should return the next page of data.
    +     * Optional. The value returned by the last `ListSubscriptionsResponse`;
    +     * indicates that this is a continuation of a prior `ListSubscriptions` call,
    +     * and that the system should return the next page of data.
          * 
    * - * string page_token = 3; + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; * * @return The bytes for pageToken. */ @@ -819,16 +794,17 @@ public com.google.protobuf.ByteString getPageTokenBytes() { return (com.google.protobuf.ByteString) ref; } } + /** * * *
    -     * The value returned by the last `ListSubscriptionsResponse`; indicates that
    -     * this is a continuation of a prior `ListSubscriptions` call, and that the
    -     * system should return the next page of data.
    +     * Optional. The value returned by the last `ListSubscriptionsResponse`;
    +     * indicates that this is a continuation of a prior `ListSubscriptions` call,
    +     * and that the system should return the next page of data.
          * 
    * - * string page_token = 3; + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; * * @param value The pageToken to set. * @return This builder for chaining. @@ -837,40 +813,42 @@ public Builder setPageToken(java.lang.String value) { if (value == null) { throw new NullPointerException(); } - pageToken_ = value; + bitField0_ |= 0x00000004; onChanged(); return this; } + /** * * *
    -     * The value returned by the last `ListSubscriptionsResponse`; indicates that
    -     * this is a continuation of a prior `ListSubscriptions` call, and that the
    -     * system should return the next page of data.
    +     * Optional. The value returned by the last `ListSubscriptionsResponse`;
    +     * indicates that this is a continuation of a prior `ListSubscriptions` call,
    +     * and that the system should return the next page of data.
          * 
    * - * string page_token = 3; + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; * * @return This builder for chaining. */ public Builder clearPageToken() { - pageToken_ = getDefaultInstance().getPageToken(); + bitField0_ = (bitField0_ & ~0x00000004); onChanged(); return this; } + /** * * *
    -     * The value returned by the last `ListSubscriptionsResponse`; indicates that
    -     * this is a continuation of a prior `ListSubscriptions` call, and that the
    -     * system should return the next page of data.
    +     * Optional. The value returned by the last `ListSubscriptionsResponse`;
    +     * indicates that this is a continuation of a prior `ListSubscriptions` call,
    +     * and that the system should return the next page of data.
          * 
    * - * string page_token = 3; + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; * * @param value The bytes for pageToken to set. * @return This builder for chaining. @@ -880,23 +858,12 @@ public Builder setPageTokenBytes(com.google.protobuf.ByteString value) { throw new NullPointerException(); } checkByteStringIsUtf8(value); - pageToken_ = value; + bitField0_ |= 0x00000004; onChanged(); return this; } - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - // @@protoc_insertion_point(builder_scope:google.pubsub.v1.ListSubscriptionsRequest) } @@ -918,7 +885,18 @@ public ListSubscriptionsRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new ListSubscriptionsRequest(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSubscriptionsRequestOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSubscriptionsRequestOrBuilder.java index 73b1fac51..85908081b 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSubscriptionsRequestOrBuilder.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSubscriptionsRequestOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; +@com.google.protobuf.Generated public interface ListSubscriptionsRequestOrBuilder extends // @@protoc_insertion_point(interface_extends:google.pubsub.v1.ListSubscriptionsRequest) @@ -38,6 +41,7 @@ public interface ListSubscriptionsRequestOrBuilder * @return The project. */ java.lang.String getProject(); + /** * * @@ -58,10 +62,10 @@ public interface ListSubscriptionsRequestOrBuilder * * *
    -   * Maximum number of subscriptions to return.
    +   * Optional. Maximum number of subscriptions to return.
        * 
    * - * int32 page_size = 2; + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The pageSize. */ @@ -71,26 +75,27 @@ public interface ListSubscriptionsRequestOrBuilder * * *
    -   * The value returned by the last `ListSubscriptionsResponse`; indicates that
    -   * this is a continuation of a prior `ListSubscriptions` call, and that the
    -   * system should return the next page of data.
    +   * Optional. The value returned by the last `ListSubscriptionsResponse`;
    +   * indicates that this is a continuation of a prior `ListSubscriptions` call,
    +   * and that the system should return the next page of data.
        * 
    * - * string page_token = 3; + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; * * @return The pageToken. */ java.lang.String getPageToken(); + /** * * *
    -   * The value returned by the last `ListSubscriptionsResponse`; indicates that
    -   * this is a continuation of a prior `ListSubscriptions` call, and that the
    -   * system should return the next page of data.
    +   * Optional. The value returned by the last `ListSubscriptionsResponse`;
    +   * indicates that this is a continuation of a prior `ListSubscriptions` call,
    +   * and that the system should return the next page of data.
        * 
    * - * string page_token = 3; + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; * * @return The bytes for pageToken. */ diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSubscriptionsResponse.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSubscriptionsResponse.java index 03b7ba951..44acf2f2d 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSubscriptionsResponse.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSubscriptionsResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; @@ -27,13 +29,25 @@ * * Protobuf type {@code google.pubsub.v1.ListSubscriptionsResponse} */ -public final class ListSubscriptionsResponse extends com.google.protobuf.GeneratedMessageV3 +@com.google.protobuf.Generated +public final class ListSubscriptionsResponse extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:google.pubsub.v1.ListSubscriptionsResponse) ListSubscriptionsResponseOrBuilder { private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "ListSubscriptionsResponse"); + } + // Use ListSubscriptionsResponse.newBuilder() to construct. - private ListSubscriptionsResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + private ListSubscriptionsResponse(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); } @@ -42,82 +56,13 @@ private ListSubscriptionsResponse() { nextPageToken_ = ""; } - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new ListSubscriptionsResponse(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - private ListSubscriptionsResponse( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - if (!((mutable_bitField0_ & 0x00000001) != 0)) { - subscriptions_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000001; - } - subscriptions_.add( - input.readMessage(com.google.pubsub.v1.Subscription.parser(), extensionRegistry)); - break; - } - case 18: - { - java.lang.String s = input.readStringRequireUtf8(); - - nextPageToken_ = s; - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000001) != 0)) { - subscriptions_ = java.util.Collections.unmodifiableList(subscriptions_); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_ListSubscriptionsResponse_descriptor; } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_ListSubscriptionsResponse_fieldAccessorTable @@ -127,68 +72,85 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } public static final int SUBSCRIPTIONS_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") private java.util.List subscriptions_; + /** * * *
    -   * The subscriptions that match the request.
    +   * Optional. The subscriptions that match the request.
        * 
    * - * repeated .google.pubsub.v1.Subscription subscriptions = 1; + * + * repeated .google.pubsub.v1.Subscription subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ @java.lang.Override public java.util.List getSubscriptionsList() { return subscriptions_; } + /** * * *
    -   * The subscriptions that match the request.
    +   * Optional. The subscriptions that match the request.
        * 
    * - * repeated .google.pubsub.v1.Subscription subscriptions = 1; + * + * repeated .google.pubsub.v1.Subscription subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ @java.lang.Override public java.util.List getSubscriptionsOrBuilderList() { return subscriptions_; } + /** * * *
    -   * The subscriptions that match the request.
    +   * Optional. The subscriptions that match the request.
        * 
    * - * repeated .google.pubsub.v1.Subscription subscriptions = 1; + * + * repeated .google.pubsub.v1.Subscription subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ @java.lang.Override public int getSubscriptionsCount() { return subscriptions_.size(); } + /** * * *
    -   * The subscriptions that match the request.
    +   * Optional. The subscriptions that match the request.
        * 
    * - * repeated .google.pubsub.v1.Subscription subscriptions = 1; + * + * repeated .google.pubsub.v1.Subscription subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ @java.lang.Override public com.google.pubsub.v1.Subscription getSubscriptions(int index) { return subscriptions_.get(index); } + /** * * *
    -   * The subscriptions that match the request.
    +   * Optional. The subscriptions that match the request.
        * 
    * - * repeated .google.pubsub.v1.Subscription subscriptions = 1; + * + * repeated .google.pubsub.v1.Subscription subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ @java.lang.Override public com.google.pubsub.v1.SubscriptionOrBuilder getSubscriptionsOrBuilder(int index) { @@ -196,17 +158,20 @@ public com.google.pubsub.v1.SubscriptionOrBuilder getSubscriptionsOrBuilder(int } public static final int NEXT_PAGE_TOKEN_FIELD_NUMBER = 2; - private volatile java.lang.Object nextPageToken_; + + @SuppressWarnings("serial") + private volatile java.lang.Object nextPageToken_ = ""; + /** * * *
    -   * If not empty, indicates that there may be more subscriptions that match
    -   * the request; this value should be passed in a new
    +   * Optional. If not empty, indicates that there may be more subscriptions that
    +   * match the request; this value should be passed in a new
        * `ListSubscriptionsRequest` to get more subscriptions.
        * 
    * - * string next_page_token = 2; + * string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The nextPageToken. */ @@ -222,16 +187,17 @@ public java.lang.String getNextPageToken() { return s; } } + /** * * *
    -   * If not empty, indicates that there may be more subscriptions that match
    -   * the request; this value should be passed in a new
    +   * Optional. If not empty, indicates that there may be more subscriptions that
    +   * match the request; this value should be passed in a new
        * `ListSubscriptionsRequest` to get more subscriptions.
        * 
    * - * string next_page_token = 2; + * string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The bytes for nextPageToken. */ @@ -265,10 +231,10 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io for (int i = 0; i < subscriptions_.size(); i++) { output.writeMessage(1, subscriptions_.get(i)); } - if (!getNextPageTokenBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 2, nextPageToken_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(nextPageToken_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, nextPageToken_); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -280,10 +246,10 @@ public int getSerializedSize() { for (int i = 0; i < subscriptions_.size(); i++) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, subscriptions_.get(i)); } - if (!getNextPageTokenBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, nextPageToken_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(nextPageToken_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, nextPageToken_); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -301,7 +267,7 @@ public boolean equals(final java.lang.Object obj) { if (!getSubscriptionsList().equals(other.getSubscriptionsList())) return false; if (!getNextPageToken().equals(other.getNextPageToken())) return false; - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -318,7 +284,7 @@ public int hashCode() { } hash = (37 * hash) + NEXT_PAGE_TOKEN_FIELD_NUMBER; hash = (53 * hash) + getNextPageToken().hashCode(); - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -360,38 +326,38 @@ public static com.google.pubsub.v1.ListSubscriptionsResponse parseFrom( public static com.google.pubsub.v1.ListSubscriptionsResponse parseFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.ListSubscriptionsResponse parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.ListSubscriptionsResponse parseDelimitedFrom( java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); } public static com.google.pubsub.v1.ListSubscriptionsResponse parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.ListSubscriptionsResponse parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.ListSubscriptionsResponse parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } @@ -414,10 +380,11 @@ public Builder toBuilder() { } @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** * * @@ -427,7 +394,7 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build * * Protobuf type {@code google.pubsub.v1.ListSubscriptionsResponse} */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements // @@protoc_insertion_point(builder_implements:google.pubsub.v1.ListSubscriptionsResponse) com.google.pubsub.v1.ListSubscriptionsResponseOrBuilder { @@ -437,7 +404,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_ListSubscriptionsResponse_fieldAccessorTable @@ -447,32 +414,24 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } // Construct using com.google.pubsub.v1.ListSubscriptionsResponse.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } + private Builder() {} - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { - getSubscriptionsFieldBuilder(); - } } @java.lang.Override public Builder clear() { super.clear(); + bitField0_ = 0; if (subscriptionsBuilder_ == null) { subscriptions_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); } else { + subscriptions_ = null; subscriptionsBuilder_.clear(); } + bitField0_ = (bitField0_ & ~0x00000001); nextPageToken_ = ""; - return this; } @@ -500,7 +459,15 @@ public com.google.pubsub.v1.ListSubscriptionsResponse build() { public com.google.pubsub.v1.ListSubscriptionsResponse buildPartial() { com.google.pubsub.v1.ListSubscriptionsResponse result = new com.google.pubsub.v1.ListSubscriptionsResponse(this); - int from_bitField0_ = bitField0_; + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields(com.google.pubsub.v1.ListSubscriptionsResponse result) { if (subscriptionsBuilder_ == null) { if (((bitField0_ & 0x00000001) != 0)) { subscriptions_ = java.util.Collections.unmodifiableList(subscriptions_); @@ -510,42 +477,13 @@ public com.google.pubsub.v1.ListSubscriptionsResponse buildPartial() { } else { result.subscriptions_ = subscriptionsBuilder_.build(); } - result.nextPageToken_ = nextPageToken_; - onBuilt(); - return result; - } - - @java.lang.Override - public Builder clone() { - return super.clone(); } - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); + private void buildPartial0(com.google.pubsub.v1.ListSubscriptionsResponse result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000002) != 0)) { + result.nextPageToken_ = nextPageToken_; + } } @java.lang.Override @@ -579,8 +517,8 @@ public Builder mergeFrom(com.google.pubsub.v1.ListSubscriptionsResponse other) { subscriptions_ = other.subscriptions_; bitField0_ = (bitField0_ & ~0x00000001); subscriptionsBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders - ? getSubscriptionsFieldBuilder() + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders + ? internalGetSubscriptionsFieldBuilder() : null; } else { subscriptionsBuilder_.addAllMessages(other.subscriptions_); @@ -589,9 +527,10 @@ public Builder mergeFrom(com.google.pubsub.v1.ListSubscriptionsResponse other) { } if (!other.getNextPageToken().isEmpty()) { nextPageToken_ = other.nextPageToken_; + bitField0_ |= 0x00000002; onChanged(); } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -606,17 +545,50 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.pubsub.v1.ListSubscriptionsResponse parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.pubsub.v1.Subscription m = + input.readMessage( + com.google.pubsub.v1.Subscription.parser(), extensionRegistry); + if (subscriptionsBuilder_ == null) { + ensureSubscriptionsIsMutable(); + subscriptions_.add(m); + } else { + subscriptionsBuilder_.addMessage(m); + } + break; + } // case 10 + case 18: + { + nextPageToken_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.google.pubsub.v1.ListSubscriptionsResponse) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } @@ -632,7 +604,7 @@ private void ensureSubscriptionsIsMutable() { } } - private com.google.protobuf.RepeatedFieldBuilderV3< + private com.google.protobuf.RepeatedFieldBuilder< com.google.pubsub.v1.Subscription, com.google.pubsub.v1.Subscription.Builder, com.google.pubsub.v1.SubscriptionOrBuilder> @@ -642,10 +614,12 @@ private void ensureSubscriptionsIsMutable() { * * *
    -     * The subscriptions that match the request.
    +     * Optional. The subscriptions that match the request.
          * 
    * - * repeated .google.pubsub.v1.Subscription subscriptions = 1; + * + * repeated .google.pubsub.v1.Subscription subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public java.util.List getSubscriptionsList() { if (subscriptionsBuilder_ == null) { @@ -654,14 +628,17 @@ public java.util.List getSubscriptionsList() return subscriptionsBuilder_.getMessageList(); } } + /** * * *
    -     * The subscriptions that match the request.
    +     * Optional. The subscriptions that match the request.
          * 
    * - * repeated .google.pubsub.v1.Subscription subscriptions = 1; + * + * repeated .google.pubsub.v1.Subscription subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public int getSubscriptionsCount() { if (subscriptionsBuilder_ == null) { @@ -670,14 +647,17 @@ public int getSubscriptionsCount() { return subscriptionsBuilder_.getCount(); } } + /** * * *
    -     * The subscriptions that match the request.
    +     * Optional. The subscriptions that match the request.
          * 
    * - * repeated .google.pubsub.v1.Subscription subscriptions = 1; + * + * repeated .google.pubsub.v1.Subscription subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public com.google.pubsub.v1.Subscription getSubscriptions(int index) { if (subscriptionsBuilder_ == null) { @@ -686,14 +666,17 @@ public com.google.pubsub.v1.Subscription getSubscriptions(int index) { return subscriptionsBuilder_.getMessage(index); } } + /** * * *
    -     * The subscriptions that match the request.
    +     * Optional. The subscriptions that match the request.
          * 
    * - * repeated .google.pubsub.v1.Subscription subscriptions = 1; + * + * repeated .google.pubsub.v1.Subscription subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public Builder setSubscriptions(int index, com.google.pubsub.v1.Subscription value) { if (subscriptionsBuilder_ == null) { @@ -708,14 +691,17 @@ public Builder setSubscriptions(int index, com.google.pubsub.v1.Subscription val } return this; } + /** * * *
    -     * The subscriptions that match the request.
    +     * Optional. The subscriptions that match the request.
          * 
    * - * repeated .google.pubsub.v1.Subscription subscriptions = 1; + * + * repeated .google.pubsub.v1.Subscription subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public Builder setSubscriptions( int index, com.google.pubsub.v1.Subscription.Builder builderForValue) { @@ -728,14 +714,17 @@ public Builder setSubscriptions( } return this; } + /** * * *
    -     * The subscriptions that match the request.
    +     * Optional. The subscriptions that match the request.
          * 
    * - * repeated .google.pubsub.v1.Subscription subscriptions = 1; + * + * repeated .google.pubsub.v1.Subscription subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public Builder addSubscriptions(com.google.pubsub.v1.Subscription value) { if (subscriptionsBuilder_ == null) { @@ -750,14 +739,17 @@ public Builder addSubscriptions(com.google.pubsub.v1.Subscription value) { } return this; } + /** * * *
    -     * The subscriptions that match the request.
    +     * Optional. The subscriptions that match the request.
          * 
    * - * repeated .google.pubsub.v1.Subscription subscriptions = 1; + * + * repeated .google.pubsub.v1.Subscription subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public Builder addSubscriptions(int index, com.google.pubsub.v1.Subscription value) { if (subscriptionsBuilder_ == null) { @@ -772,14 +764,17 @@ public Builder addSubscriptions(int index, com.google.pubsub.v1.Subscription val } return this; } + /** * * *
    -     * The subscriptions that match the request.
    +     * Optional. The subscriptions that match the request.
          * 
    * - * repeated .google.pubsub.v1.Subscription subscriptions = 1; + * + * repeated .google.pubsub.v1.Subscription subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public Builder addSubscriptions(com.google.pubsub.v1.Subscription.Builder builderForValue) { if (subscriptionsBuilder_ == null) { @@ -791,14 +786,17 @@ public Builder addSubscriptions(com.google.pubsub.v1.Subscription.Builder builde } return this; } + /** * * *
    -     * The subscriptions that match the request.
    +     * Optional. The subscriptions that match the request.
          * 
    * - * repeated .google.pubsub.v1.Subscription subscriptions = 1; + * + * repeated .google.pubsub.v1.Subscription subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public Builder addSubscriptions( int index, com.google.pubsub.v1.Subscription.Builder builderForValue) { @@ -811,14 +809,17 @@ public Builder addSubscriptions( } return this; } + /** * * *
    -     * The subscriptions that match the request.
    +     * Optional. The subscriptions that match the request.
          * 
    * - * repeated .google.pubsub.v1.Subscription subscriptions = 1; + * + * repeated .google.pubsub.v1.Subscription subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public Builder addAllSubscriptions( java.lang.Iterable values) { @@ -831,14 +832,17 @@ public Builder addAllSubscriptions( } return this; } + /** * * *
    -     * The subscriptions that match the request.
    +     * Optional. The subscriptions that match the request.
          * 
    * - * repeated .google.pubsub.v1.Subscription subscriptions = 1; + * + * repeated .google.pubsub.v1.Subscription subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public Builder clearSubscriptions() { if (subscriptionsBuilder_ == null) { @@ -850,14 +854,17 @@ public Builder clearSubscriptions() { } return this; } + /** * * *
    -     * The subscriptions that match the request.
    +     * Optional. The subscriptions that match the request.
          * 
    * - * repeated .google.pubsub.v1.Subscription subscriptions = 1; + * + * repeated .google.pubsub.v1.Subscription subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public Builder removeSubscriptions(int index) { if (subscriptionsBuilder_ == null) { @@ -869,26 +876,32 @@ public Builder removeSubscriptions(int index) { } return this; } + /** * * *
    -     * The subscriptions that match the request.
    +     * Optional. The subscriptions that match the request.
          * 
    * - * repeated .google.pubsub.v1.Subscription subscriptions = 1; + * + * repeated .google.pubsub.v1.Subscription subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public com.google.pubsub.v1.Subscription.Builder getSubscriptionsBuilder(int index) { - return getSubscriptionsFieldBuilder().getBuilder(index); + return internalGetSubscriptionsFieldBuilder().getBuilder(index); } + /** * * *
    -     * The subscriptions that match the request.
    +     * Optional. The subscriptions that match the request.
          * 
    * - * repeated .google.pubsub.v1.Subscription subscriptions = 1; + * + * repeated .google.pubsub.v1.Subscription subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public com.google.pubsub.v1.SubscriptionOrBuilder getSubscriptionsOrBuilder(int index) { if (subscriptionsBuilder_ == null) { @@ -897,14 +910,17 @@ public com.google.pubsub.v1.SubscriptionOrBuilder getSubscriptionsOrBuilder(int return subscriptionsBuilder_.getMessageOrBuilder(index); } } + /** * * *
    -     * The subscriptions that match the request.
    +     * Optional. The subscriptions that match the request.
          * 
    * - * repeated .google.pubsub.v1.Subscription subscriptions = 1; + * + * repeated .google.pubsub.v1.Subscription subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public java.util.List getSubscriptionsOrBuilderList() { @@ -914,53 +930,62 @@ public com.google.pubsub.v1.SubscriptionOrBuilder getSubscriptionsOrBuilder(int return java.util.Collections.unmodifiableList(subscriptions_); } } + /** * * *
    -     * The subscriptions that match the request.
    +     * Optional. The subscriptions that match the request.
          * 
    * - * repeated .google.pubsub.v1.Subscription subscriptions = 1; + * + * repeated .google.pubsub.v1.Subscription subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public com.google.pubsub.v1.Subscription.Builder addSubscriptionsBuilder() { - return getSubscriptionsFieldBuilder() + return internalGetSubscriptionsFieldBuilder() .addBuilder(com.google.pubsub.v1.Subscription.getDefaultInstance()); } + /** * * *
    -     * The subscriptions that match the request.
    +     * Optional. The subscriptions that match the request.
          * 
    * - * repeated .google.pubsub.v1.Subscription subscriptions = 1; + * + * repeated .google.pubsub.v1.Subscription subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public com.google.pubsub.v1.Subscription.Builder addSubscriptionsBuilder(int index) { - return getSubscriptionsFieldBuilder() + return internalGetSubscriptionsFieldBuilder() .addBuilder(index, com.google.pubsub.v1.Subscription.getDefaultInstance()); } + /** * * *
    -     * The subscriptions that match the request.
    +     * Optional. The subscriptions that match the request.
          * 
    * - * repeated .google.pubsub.v1.Subscription subscriptions = 1; + * + * repeated .google.pubsub.v1.Subscription subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public java.util.List getSubscriptionsBuilderList() { - return getSubscriptionsFieldBuilder().getBuilderList(); + return internalGetSubscriptionsFieldBuilder().getBuilderList(); } - private com.google.protobuf.RepeatedFieldBuilderV3< + private com.google.protobuf.RepeatedFieldBuilder< com.google.pubsub.v1.Subscription, com.google.pubsub.v1.Subscription.Builder, com.google.pubsub.v1.SubscriptionOrBuilder> - getSubscriptionsFieldBuilder() { + internalGetSubscriptionsFieldBuilder() { if (subscriptionsBuilder_ == null) { subscriptionsBuilder_ = - new com.google.protobuf.RepeatedFieldBuilderV3< + new com.google.protobuf.RepeatedFieldBuilder< com.google.pubsub.v1.Subscription, com.google.pubsub.v1.Subscription.Builder, com.google.pubsub.v1.SubscriptionOrBuilder>( @@ -974,16 +999,17 @@ public java.util.List getSubscription } private java.lang.Object nextPageToken_ = ""; + /** * * *
    -     * If not empty, indicates that there may be more subscriptions that match
    -     * the request; this value should be passed in a new
    +     * Optional. If not empty, indicates that there may be more subscriptions that
    +     * match the request; this value should be passed in a new
          * `ListSubscriptionsRequest` to get more subscriptions.
          * 
    * - * string next_page_token = 2; + * string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The nextPageToken. */ @@ -998,16 +1024,17 @@ public java.lang.String getNextPageToken() { return (java.lang.String) ref; } } + /** * * *
    -     * If not empty, indicates that there may be more subscriptions that match
    -     * the request; this value should be passed in a new
    +     * Optional. If not empty, indicates that there may be more subscriptions that
    +     * match the request; this value should be passed in a new
          * `ListSubscriptionsRequest` to get more subscriptions.
          * 
    * - * string next_page_token = 2; + * string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The bytes for nextPageToken. */ @@ -1022,16 +1049,17 @@ public com.google.protobuf.ByteString getNextPageTokenBytes() { return (com.google.protobuf.ByteString) ref; } } + /** * * *
    -     * If not empty, indicates that there may be more subscriptions that match
    -     * the request; this value should be passed in a new
    +     * Optional. If not empty, indicates that there may be more subscriptions that
    +     * match the request; this value should be passed in a new
          * `ListSubscriptionsRequest` to get more subscriptions.
          * 
    * - * string next_page_token = 2; + * string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @param value The nextPageToken to set. * @return This builder for chaining. @@ -1040,40 +1068,42 @@ public Builder setNextPageToken(java.lang.String value) { if (value == null) { throw new NullPointerException(); } - nextPageToken_ = value; + bitField0_ |= 0x00000002; onChanged(); return this; } + /** * * *
    -     * If not empty, indicates that there may be more subscriptions that match
    -     * the request; this value should be passed in a new
    +     * Optional. If not empty, indicates that there may be more subscriptions that
    +     * match the request; this value should be passed in a new
          * `ListSubscriptionsRequest` to get more subscriptions.
          * 
    * - * string next_page_token = 2; + * string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return This builder for chaining. */ public Builder clearNextPageToken() { - nextPageToken_ = getDefaultInstance().getNextPageToken(); + bitField0_ = (bitField0_ & ~0x00000002); onChanged(); return this; } + /** * * *
    -     * If not empty, indicates that there may be more subscriptions that match
    -     * the request; this value should be passed in a new
    +     * Optional. If not empty, indicates that there may be more subscriptions that
    +     * match the request; this value should be passed in a new
          * `ListSubscriptionsRequest` to get more subscriptions.
          * 
    * - * string next_page_token = 2; + * string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @param value The bytes for nextPageToken to set. * @return This builder for chaining. @@ -1083,23 +1113,12 @@ public Builder setNextPageTokenBytes(com.google.protobuf.ByteString value) { throw new NullPointerException(); } checkByteStringIsUtf8(value); - nextPageToken_ = value; + bitField0_ |= 0x00000002; onChanged(); return this; } - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - // @@protoc_insertion_point(builder_scope:google.pubsub.v1.ListSubscriptionsResponse) } @@ -1121,7 +1140,18 @@ public ListSubscriptionsResponse parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new ListSubscriptionsResponse(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSubscriptionsResponseOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSubscriptionsResponseOrBuilder.java index 1dcf23dd0..55129e301 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSubscriptionsResponseOrBuilder.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSubscriptionsResponseOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; +@com.google.protobuf.Generated public interface ListSubscriptionsResponseOrBuilder extends // @@protoc_insertion_point(interface_extends:google.pubsub.v1.ListSubscriptionsResponse) @@ -27,51 +30,65 @@ public interface ListSubscriptionsResponseOrBuilder * * *
    -   * The subscriptions that match the request.
    +   * Optional. The subscriptions that match the request.
        * 
    * - * repeated .google.pubsub.v1.Subscription subscriptions = 1; + * + * repeated .google.pubsub.v1.Subscription subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ java.util.List getSubscriptionsList(); + /** * * *
    -   * The subscriptions that match the request.
    +   * Optional. The subscriptions that match the request.
        * 
    * - * repeated .google.pubsub.v1.Subscription subscriptions = 1; + * + * repeated .google.pubsub.v1.Subscription subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ com.google.pubsub.v1.Subscription getSubscriptions(int index); + /** * * *
    -   * The subscriptions that match the request.
    +   * Optional. The subscriptions that match the request.
        * 
    * - * repeated .google.pubsub.v1.Subscription subscriptions = 1; + * + * repeated .google.pubsub.v1.Subscription subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ int getSubscriptionsCount(); + /** * * *
    -   * The subscriptions that match the request.
    +   * Optional. The subscriptions that match the request.
        * 
    * - * repeated .google.pubsub.v1.Subscription subscriptions = 1; + * + * repeated .google.pubsub.v1.Subscription subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ java.util.List getSubscriptionsOrBuilderList(); + /** * * *
    -   * The subscriptions that match the request.
    +   * Optional. The subscriptions that match the request.
        * 
    * - * repeated .google.pubsub.v1.Subscription subscriptions = 1; + * + * repeated .google.pubsub.v1.Subscription subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ com.google.pubsub.v1.SubscriptionOrBuilder getSubscriptionsOrBuilder(int index); @@ -79,26 +96,27 @@ public interface ListSubscriptionsResponseOrBuilder * * *
    -   * If not empty, indicates that there may be more subscriptions that match
    -   * the request; this value should be passed in a new
    +   * Optional. If not empty, indicates that there may be more subscriptions that
    +   * match the request; this value should be passed in a new
        * `ListSubscriptionsRequest` to get more subscriptions.
        * 
    * - * string next_page_token = 2; + * string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The nextPageToken. */ java.lang.String getNextPageToken(); + /** * * *
    -   * If not empty, indicates that there may be more subscriptions that match
    -   * the request; this value should be passed in a new
    +   * Optional. If not empty, indicates that there may be more subscriptions that
    +   * match the request; this value should be passed in a new
        * `ListSubscriptionsRequest` to get more subscriptions.
        * 
    * - * string next_page_token = 2; + * string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The bytes for nextPageToken. */ diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicSnapshotsRequest.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicSnapshotsRequest.java index 2edd5bdc8..0293fb6de 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicSnapshotsRequest.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicSnapshotsRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; @@ -27,13 +29,25 @@ * * Protobuf type {@code google.pubsub.v1.ListTopicSnapshotsRequest} */ -public final class ListTopicSnapshotsRequest extends com.google.protobuf.GeneratedMessageV3 +@com.google.protobuf.Generated +public final class ListTopicSnapshotsRequest extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:google.pubsub.v1.ListTopicSnapshotsRequest) ListTopicSnapshotsRequestOrBuilder { private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "ListTopicSnapshotsRequest"); + } + // Use ListTopicSnapshotsRequest.newBuilder() to construct. - private ListTopicSnapshotsRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + private ListTopicSnapshotsRequest(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); } @@ -42,80 +56,13 @@ private ListTopicSnapshotsRequest() { pageToken_ = ""; } - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new ListTopicSnapshotsRequest(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - private ListTopicSnapshotsRequest( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - java.lang.String s = input.readStringRequireUtf8(); - - topic_ = s; - break; - } - case 16: - { - pageSize_ = input.readInt32(); - break; - } - case 26: - { - java.lang.String s = input.readStringRequireUtf8(); - - pageToken_ = s; - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_ListTopicSnapshotsRequest_descriptor; } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_ListTopicSnapshotsRequest_fieldAccessorTable @@ -125,7 +72,10 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } public static final int TOPIC_FIELD_NUMBER = 1; - private volatile java.lang.Object topic_; + + @SuppressWarnings("serial") + private volatile java.lang.Object topic_ = ""; + /** * * @@ -152,6 +102,7 @@ public java.lang.String getTopic() { return s; } } + /** * * @@ -180,15 +131,16 @@ public com.google.protobuf.ByteString getTopicBytes() { } public static final int PAGE_SIZE_FIELD_NUMBER = 2; - private int pageSize_; + private int pageSize_ = 0; + /** * * *
    -   * Maximum number of snapshot names to return.
    +   * Optional. Maximum number of snapshot names to return.
        * 
    * - * int32 page_size = 2; + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The pageSize. */ @@ -198,17 +150,20 @@ public int getPageSize() { } public static final int PAGE_TOKEN_FIELD_NUMBER = 3; - private volatile java.lang.Object pageToken_; + + @SuppressWarnings("serial") + private volatile java.lang.Object pageToken_ = ""; + /** * * *
    -   * The value returned by the last `ListTopicSnapshotsResponse`; indicates
    -   * that this is a continuation of a prior `ListTopicSnapshots` call, and
    -   * that the system should return the next page of data.
    +   * Optional. The value returned by the last `ListTopicSnapshotsResponse`;
    +   * indicates that this is a continuation of a prior `ListTopicSnapshots` call,
    +   * and that the system should return the next page of data.
        * 
    * - * string page_token = 3; + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; * * @return The pageToken. */ @@ -224,16 +179,17 @@ public java.lang.String getPageToken() { return s; } } + /** * * *
    -   * The value returned by the last `ListTopicSnapshotsResponse`; indicates
    -   * that this is a continuation of a prior `ListTopicSnapshots` call, and
    -   * that the system should return the next page of data.
    +   * Optional. The value returned by the last `ListTopicSnapshotsResponse`;
    +   * indicates that this is a continuation of a prior `ListTopicSnapshots` call,
    +   * and that the system should return the next page of data.
        * 
    * - * string page_token = 3; + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; * * @return The bytes for pageToken. */ @@ -264,16 +220,16 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!getTopicBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, topic_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(topic_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, topic_); } if (pageSize_ != 0) { output.writeInt32(2, pageSize_); } - if (!getPageTokenBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 3, pageToken_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(pageToken_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 3, pageToken_); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -282,16 +238,16 @@ public int getSerializedSize() { if (size != -1) return size; size = 0; - if (!getTopicBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, topic_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(topic_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, topic_); } if (pageSize_ != 0) { size += com.google.protobuf.CodedOutputStream.computeInt32Size(2, pageSize_); } - if (!getPageTokenBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, pageToken_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(pageToken_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(3, pageToken_); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -310,7 +266,7 @@ public boolean equals(final java.lang.Object obj) { if (!getTopic().equals(other.getTopic())) return false; if (getPageSize() != other.getPageSize()) return false; if (!getPageToken().equals(other.getPageToken())) return false; - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -327,7 +283,7 @@ public int hashCode() { hash = (53 * hash) + getPageSize(); hash = (37 * hash) + PAGE_TOKEN_FIELD_NUMBER; hash = (53 * hash) + getPageToken().hashCode(); - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -369,38 +325,38 @@ public static com.google.pubsub.v1.ListTopicSnapshotsRequest parseFrom( public static com.google.pubsub.v1.ListTopicSnapshotsRequest parseFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.ListTopicSnapshotsRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.ListTopicSnapshotsRequest parseDelimitedFrom( java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); } public static com.google.pubsub.v1.ListTopicSnapshotsRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.ListTopicSnapshotsRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.ListTopicSnapshotsRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } @@ -423,10 +379,11 @@ public Builder toBuilder() { } @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** * * @@ -436,7 +393,7 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build * * Protobuf type {@code google.pubsub.v1.ListTopicSnapshotsRequest} */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements // @@protoc_insertion_point(builder_implements:google.pubsub.v1.ListTopicSnapshotsRequest) com.google.pubsub.v1.ListTopicSnapshotsRequestOrBuilder { @@ -446,7 +403,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_ListTopicSnapshotsRequest_fieldAccessorTable @@ -456,28 +413,19 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } // Construct using com.google.pubsub.v1.ListTopicSnapshotsRequest.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } + private Builder() {} - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} } @java.lang.Override public Builder clear() { super.clear(); + bitField0_ = 0; topic_ = ""; - pageSize_ = 0; - pageToken_ = ""; - return this; } @@ -505,44 +453,24 @@ public com.google.pubsub.v1.ListTopicSnapshotsRequest build() { public com.google.pubsub.v1.ListTopicSnapshotsRequest buildPartial() { com.google.pubsub.v1.ListTopicSnapshotsRequest result = new com.google.pubsub.v1.ListTopicSnapshotsRequest(this); - result.topic_ = topic_; - result.pageSize_ = pageSize_; - result.pageToken_ = pageToken_; + if (bitField0_ != 0) { + buildPartial0(result); + } onBuilt(); return result; } - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); + private void buildPartial0(com.google.pubsub.v1.ListTopicSnapshotsRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.topic_ = topic_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.pageSize_ = pageSize_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.pageToken_ = pageToken_; + } } @java.lang.Override @@ -559,6 +487,7 @@ public Builder mergeFrom(com.google.pubsub.v1.ListTopicSnapshotsRequest other) { if (other == com.google.pubsub.v1.ListTopicSnapshotsRequest.getDefaultInstance()) return this; if (!other.getTopic().isEmpty()) { topic_ = other.topic_; + bitField0_ |= 0x00000001; onChanged(); } if (other.getPageSize() != 0) { @@ -566,9 +495,10 @@ public Builder mergeFrom(com.google.pubsub.v1.ListTopicSnapshotsRequest other) { } if (!other.getPageToken().isEmpty()) { pageToken_ = other.pageToken_; + bitField0_ |= 0x00000004; onChanged(); } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -583,21 +513,56 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.pubsub.v1.ListTopicSnapshotsRequest parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + topic_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 16: + { + pageSize_ = input.readInt32(); + bitField0_ |= 0x00000002; + break; + } // case 16 + case 26: + { + pageToken_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000004; + break; + } // case 26 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.google.pubsub.v1.ListTopicSnapshotsRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } + private int bitField0_; + private java.lang.Object topic_ = ""; + /** * * @@ -623,6 +588,7 @@ public java.lang.String getTopic() { return (java.lang.String) ref; } } + /** * * @@ -648,6 +614,7 @@ public com.google.protobuf.ByteString getTopicBytes() { return (com.google.protobuf.ByteString) ref; } } + /** * * @@ -667,11 +634,12 @@ public Builder setTopic(java.lang.String value) { if (value == null) { throw new NullPointerException(); } - topic_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } + /** * * @@ -687,11 +655,12 @@ public Builder setTopic(java.lang.String value) { * @return This builder for chaining. */ public Builder clearTopic() { - topic_ = getDefaultInstance().getTopic(); + bitField0_ = (bitField0_ & ~0x00000001); onChanged(); return this; } + /** * * @@ -712,21 +681,22 @@ public Builder setTopicBytes(com.google.protobuf.ByteString value) { throw new NullPointerException(); } checkByteStringIsUtf8(value); - topic_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } private int pageSize_; + /** * * *
    -     * Maximum number of snapshot names to return.
    +     * Optional. Maximum number of snapshot names to return.
          * 
    * - * int32 page_size = 2; + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The pageSize. */ @@ -734,14 +704,15 @@ public Builder setTopicBytes(com.google.protobuf.ByteString value) { public int getPageSize() { return pageSize_; } + /** * * *
    -     * Maximum number of snapshot names to return.
    +     * Optional. Maximum number of snapshot names to return.
          * 
    * - * int32 page_size = 2; + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @param value The pageSize to set. * @return This builder for chaining. @@ -749,38 +720,41 @@ public int getPageSize() { public Builder setPageSize(int value) { pageSize_ = value; + bitField0_ |= 0x00000002; onChanged(); return this; } + /** * * *
    -     * Maximum number of snapshot names to return.
    +     * Optional. Maximum number of snapshot names to return.
          * 
    * - * int32 page_size = 2; + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return This builder for chaining. */ public Builder clearPageSize() { - + bitField0_ = (bitField0_ & ~0x00000002); pageSize_ = 0; onChanged(); return this; } private java.lang.Object pageToken_ = ""; + /** * * *
    -     * The value returned by the last `ListTopicSnapshotsResponse`; indicates
    -     * that this is a continuation of a prior `ListTopicSnapshots` call, and
    -     * that the system should return the next page of data.
    +     * Optional. The value returned by the last `ListTopicSnapshotsResponse`;
    +     * indicates that this is a continuation of a prior `ListTopicSnapshots` call,
    +     * and that the system should return the next page of data.
          * 
    * - * string page_token = 3; + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; * * @return The pageToken. */ @@ -795,16 +769,17 @@ public java.lang.String getPageToken() { return (java.lang.String) ref; } } + /** * * *
    -     * The value returned by the last `ListTopicSnapshotsResponse`; indicates
    -     * that this is a continuation of a prior `ListTopicSnapshots` call, and
    -     * that the system should return the next page of data.
    +     * Optional. The value returned by the last `ListTopicSnapshotsResponse`;
    +     * indicates that this is a continuation of a prior `ListTopicSnapshots` call,
    +     * and that the system should return the next page of data.
          * 
    * - * string page_token = 3; + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; * * @return The bytes for pageToken. */ @@ -819,16 +794,17 @@ public com.google.protobuf.ByteString getPageTokenBytes() { return (com.google.protobuf.ByteString) ref; } } + /** * * *
    -     * The value returned by the last `ListTopicSnapshotsResponse`; indicates
    -     * that this is a continuation of a prior `ListTopicSnapshots` call, and
    -     * that the system should return the next page of data.
    +     * Optional. The value returned by the last `ListTopicSnapshotsResponse`;
    +     * indicates that this is a continuation of a prior `ListTopicSnapshots` call,
    +     * and that the system should return the next page of data.
          * 
    * - * string page_token = 3; + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; * * @param value The pageToken to set. * @return This builder for chaining. @@ -837,40 +813,42 @@ public Builder setPageToken(java.lang.String value) { if (value == null) { throw new NullPointerException(); } - pageToken_ = value; + bitField0_ |= 0x00000004; onChanged(); return this; } + /** * * *
    -     * The value returned by the last `ListTopicSnapshotsResponse`; indicates
    -     * that this is a continuation of a prior `ListTopicSnapshots` call, and
    -     * that the system should return the next page of data.
    +     * Optional. The value returned by the last `ListTopicSnapshotsResponse`;
    +     * indicates that this is a continuation of a prior `ListTopicSnapshots` call,
    +     * and that the system should return the next page of data.
          * 
    * - * string page_token = 3; + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; * * @return This builder for chaining. */ public Builder clearPageToken() { - pageToken_ = getDefaultInstance().getPageToken(); + bitField0_ = (bitField0_ & ~0x00000004); onChanged(); return this; } + /** * * *
    -     * The value returned by the last `ListTopicSnapshotsResponse`; indicates
    -     * that this is a continuation of a prior `ListTopicSnapshots` call, and
    -     * that the system should return the next page of data.
    +     * Optional. The value returned by the last `ListTopicSnapshotsResponse`;
    +     * indicates that this is a continuation of a prior `ListTopicSnapshots` call,
    +     * and that the system should return the next page of data.
          * 
    * - * string page_token = 3; + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; * * @param value The bytes for pageToken to set. * @return This builder for chaining. @@ -880,23 +858,12 @@ public Builder setPageTokenBytes(com.google.protobuf.ByteString value) { throw new NullPointerException(); } checkByteStringIsUtf8(value); - pageToken_ = value; + bitField0_ |= 0x00000004; onChanged(); return this; } - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - // @@protoc_insertion_point(builder_scope:google.pubsub.v1.ListTopicSnapshotsRequest) } @@ -918,7 +885,18 @@ public ListTopicSnapshotsRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new ListTopicSnapshotsRequest(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicSnapshotsRequestOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicSnapshotsRequestOrBuilder.java index 3e3382705..bdddb1f3d 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicSnapshotsRequestOrBuilder.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicSnapshotsRequestOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; +@com.google.protobuf.Generated public interface ListTopicSnapshotsRequestOrBuilder extends // @@protoc_insertion_point(interface_extends:google.pubsub.v1.ListTopicSnapshotsRequest) @@ -38,6 +41,7 @@ public interface ListTopicSnapshotsRequestOrBuilder * @return The topic. */ java.lang.String getTopic(); + /** * * @@ -58,10 +62,10 @@ public interface ListTopicSnapshotsRequestOrBuilder * * *
    -   * Maximum number of snapshot names to return.
    +   * Optional. Maximum number of snapshot names to return.
        * 
    * - * int32 page_size = 2; + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The pageSize. */ @@ -71,26 +75,27 @@ public interface ListTopicSnapshotsRequestOrBuilder * * *
    -   * The value returned by the last `ListTopicSnapshotsResponse`; indicates
    -   * that this is a continuation of a prior `ListTopicSnapshots` call, and
    -   * that the system should return the next page of data.
    +   * Optional. The value returned by the last `ListTopicSnapshotsResponse`;
    +   * indicates that this is a continuation of a prior `ListTopicSnapshots` call,
    +   * and that the system should return the next page of data.
        * 
    * - * string page_token = 3; + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; * * @return The pageToken. */ java.lang.String getPageToken(); + /** * * *
    -   * The value returned by the last `ListTopicSnapshotsResponse`; indicates
    -   * that this is a continuation of a prior `ListTopicSnapshots` call, and
    -   * that the system should return the next page of data.
    +   * Optional. The value returned by the last `ListTopicSnapshotsResponse`;
    +   * indicates that this is a continuation of a prior `ListTopicSnapshots` call,
    +   * and that the system should return the next page of data.
        * 
    * - * string page_token = 3; + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; * * @return The bytes for pageToken. */ 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 a19c8778d..5f7ba1850 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 @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; @@ -27,97 +29,40 @@ * * Protobuf type {@code google.pubsub.v1.ListTopicSnapshotsResponse} */ -public final class ListTopicSnapshotsResponse extends com.google.protobuf.GeneratedMessageV3 +@com.google.protobuf.Generated +public final class ListTopicSnapshotsResponse extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:google.pubsub.v1.ListTopicSnapshotsResponse) ListTopicSnapshotsResponseOrBuilder { private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "ListTopicSnapshotsResponse"); + } + // Use ListTopicSnapshotsResponse.newBuilder() to construct. - private ListTopicSnapshotsResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + private ListTopicSnapshotsResponse(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); } private ListTopicSnapshotsResponse() { - snapshots_ = com.google.protobuf.LazyStringArrayList.EMPTY; + snapshots_ = com.google.protobuf.LazyStringArrayList.emptyList(); nextPageToken_ = ""; } - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new ListTopicSnapshotsResponse(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - private ListTopicSnapshotsResponse( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - java.lang.String s = input.readStringRequireUtf8(); - if (!((mutable_bitField0_ & 0x00000001) != 0)) { - snapshots_ = new com.google.protobuf.LazyStringArrayList(); - mutable_bitField0_ |= 0x00000001; - } - snapshots_.add(s); - break; - } - case 18: - { - java.lang.String s = input.readStringRequireUtf8(); - - nextPageToken_ = s; - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000001) != 0)) { - snapshots_ = snapshots_.getUnmodifiableView(); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_ListTopicSnapshotsResponse_descriptor; } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_ListTopicSnapshotsResponse_fieldAccessorTable @@ -127,43 +72,55 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } public static final int SNAPSHOTS_FIELD_NUMBER = 1; - private com.google.protobuf.LazyStringList snapshots_; + + @SuppressWarnings("serial") + private com.google.protobuf.LazyStringArrayList snapshots_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + /** * * *
    -   * The names of the snapshots that match the request.
    +   * Optional. The names of the snapshots that match the request.
        * 
    * - * repeated string snapshots = 1; + * + * repeated string snapshots = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return A list containing the snapshots. */ public com.google.protobuf.ProtocolStringList getSnapshotsList() { return snapshots_; } + /** * * *
    -   * The names of the snapshots that match the request.
    +   * Optional. The names of the snapshots that match the request.
        * 
    * - * repeated string snapshots = 1; + * + * repeated string snapshots = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return The count of snapshots. */ public int getSnapshotsCount() { return snapshots_.size(); } + /** * * *
    -   * The names of the snapshots that match the request.
    +   * Optional. The names of the snapshots that match the request.
        * 
    * - * repeated string snapshots = 1; + * + * 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. @@ -171,14 +128,17 @@ public int getSnapshotsCount() { public java.lang.String getSnapshots(int index) { return snapshots_.get(index); } + /** * * *
    -   * The names of the snapshots that match the request.
    +   * Optional. The names of the snapshots that match the request.
        * 
    * - * repeated string snapshots = 1; + * + * 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. @@ -188,17 +148,20 @@ public com.google.protobuf.ByteString getSnapshotsBytes(int index) { } public static final int NEXT_PAGE_TOKEN_FIELD_NUMBER = 2; - private volatile java.lang.Object nextPageToken_; + + @SuppressWarnings("serial") + private volatile java.lang.Object nextPageToken_ = ""; + /** * * *
    -   * If not empty, indicates that there may be more snapshots that match
    -   * the request; this value should be passed in a new
    +   * Optional. If not empty, indicates that there may be more snapshots that
    +   * match the request; this value should be passed in a new
        * `ListTopicSnapshotsRequest` to get more snapshots.
        * 
    * - * string next_page_token = 2; + * string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The nextPageToken. */ @@ -214,16 +177,17 @@ public java.lang.String getNextPageToken() { return s; } } + /** * * *
    -   * If not empty, indicates that there may be more snapshots that match
    -   * the request; this value should be passed in a new
    +   * Optional. If not empty, indicates that there may be more snapshots that
    +   * match the request; this value should be passed in a new
        * `ListTopicSnapshotsRequest` to get more snapshots.
        * 
    * - * string next_page_token = 2; + * string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The bytes for nextPageToken. */ @@ -255,12 +219,12 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { for (int i = 0; i < snapshots_.size(); i++) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, snapshots_.getRaw(i)); + com.google.protobuf.GeneratedMessage.writeString(output, 1, snapshots_.getRaw(i)); } - if (!getNextPageTokenBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 2, nextPageToken_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(nextPageToken_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, nextPageToken_); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -277,10 +241,10 @@ public int getSerializedSize() { size += dataSize; size += 1 * getSnapshotsList().size(); } - if (!getNextPageTokenBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, nextPageToken_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(nextPageToken_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, nextPageToken_); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -298,7 +262,7 @@ public boolean equals(final java.lang.Object obj) { if (!getSnapshotsList().equals(other.getSnapshotsList())) return false; if (!getNextPageToken().equals(other.getNextPageToken())) return false; - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -315,7 +279,7 @@ public int hashCode() { } hash = (37 * hash) + NEXT_PAGE_TOKEN_FIELD_NUMBER; hash = (53 * hash) + getNextPageToken().hashCode(); - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -357,38 +321,38 @@ public static com.google.pubsub.v1.ListTopicSnapshotsResponse parseFrom( public static com.google.pubsub.v1.ListTopicSnapshotsResponse parseFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.ListTopicSnapshotsResponse parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.ListTopicSnapshotsResponse parseDelimitedFrom( java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); } public static com.google.pubsub.v1.ListTopicSnapshotsResponse parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.ListTopicSnapshotsResponse parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.ListTopicSnapshotsResponse parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } @@ -411,10 +375,11 @@ public Builder toBuilder() { } @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** * * @@ -424,7 +389,7 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build * * Protobuf type {@code google.pubsub.v1.ListTopicSnapshotsResponse} */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements // @@protoc_insertion_point(builder_implements:google.pubsub.v1.ListTopicSnapshotsResponse) com.google.pubsub.v1.ListTopicSnapshotsResponseOrBuilder { @@ -434,7 +399,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_ListTopicSnapshotsResponse_fieldAccessorTable @@ -444,26 +409,18 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } // Construct using com.google.pubsub.v1.ListTopicSnapshotsResponse.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } + private Builder() {} - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} } @java.lang.Override public Builder clear() { super.clear(); - snapshots_ = com.google.protobuf.LazyStringArrayList.EMPTY; - bitField0_ = (bitField0_ & ~0x00000001); + bitField0_ = 0; + snapshots_ = com.google.protobuf.LazyStringArrayList.emptyList(); nextPageToken_ = ""; - return this; } @@ -491,48 +448,22 @@ public com.google.pubsub.v1.ListTopicSnapshotsResponse build() { public com.google.pubsub.v1.ListTopicSnapshotsResponse buildPartial() { com.google.pubsub.v1.ListTopicSnapshotsResponse result = new com.google.pubsub.v1.ListTopicSnapshotsResponse(this); - int from_bitField0_ = bitField0_; - if (((bitField0_ & 0x00000001) != 0)) { - snapshots_ = snapshots_.getUnmodifiableView(); - bitField0_ = (bitField0_ & ~0x00000001); + if (bitField0_ != 0) { + buildPartial0(result); } - result.snapshots_ = snapshots_; - result.nextPageToken_ = nextPageToken_; onBuilt(); return result; } - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); + private void buildPartial0(com.google.pubsub.v1.ListTopicSnapshotsResponse result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + snapshots_.makeImmutable(); + result.snapshots_ = snapshots_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.nextPageToken_ = nextPageToken_; + } } @java.lang.Override @@ -551,7 +482,7 @@ public Builder mergeFrom(com.google.pubsub.v1.ListTopicSnapshotsResponse other) if (!other.snapshots_.isEmpty()) { if (snapshots_.isEmpty()) { snapshots_ = other.snapshots_; - bitField0_ = (bitField0_ & ~0x00000001); + bitField0_ |= 0x00000001; } else { ensureSnapshotsIsMutable(); snapshots_.addAll(other.snapshots_); @@ -560,9 +491,10 @@ public Builder mergeFrom(com.google.pubsub.v1.ListTopicSnapshotsResponse other) } if (!other.getNextPageToken().isEmpty()) { nextPageToken_ = other.nextPageToken_; + bitField0_ |= 0x00000002; onChanged(); } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -577,67 +509,104 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.pubsub.v1.ListTopicSnapshotsResponse parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + ensureSnapshotsIsMutable(); + snapshots_.add(s); + break; + } // case 10 + case 18: + { + nextPageToken_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.google.pubsub.v1.ListTopicSnapshotsResponse) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } private int bitField0_; - private com.google.protobuf.LazyStringList snapshots_ = - com.google.protobuf.LazyStringArrayList.EMPTY; + private com.google.protobuf.LazyStringArrayList snapshots_ = + com.google.protobuf.LazyStringArrayList.emptyList(); private void ensureSnapshotsIsMutable() { - if (!((bitField0_ & 0x00000001) != 0)) { + if (!snapshots_.isModifiable()) { snapshots_ = new com.google.protobuf.LazyStringArrayList(snapshots_); - bitField0_ |= 0x00000001; } + bitField0_ |= 0x00000001; } + /** * * *
    -     * The names of the snapshots that match the request.
    +     * Optional. The names of the snapshots that match the request.
          * 
    * - * repeated string snapshots = 1; + * + * repeated string snapshots = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return A list containing the snapshots. */ public com.google.protobuf.ProtocolStringList getSnapshotsList() { - return snapshots_.getUnmodifiableView(); + snapshots_.makeImmutable(); + return snapshots_; } + /** * * *
    -     * The names of the snapshots that match the request.
    +     * Optional. The names of the snapshots that match the request.
          * 
    * - * repeated string snapshots = 1; + * + * repeated string snapshots = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return The count of snapshots. */ public int getSnapshotsCount() { return snapshots_.size(); } + /** * * *
    -     * The names of the snapshots that match the request.
    +     * Optional. The names of the snapshots that match the request.
          * 
    * - * repeated string snapshots = 1; + * + * 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. @@ -645,14 +614,17 @@ public int getSnapshotsCount() { public java.lang.String getSnapshots(int index) { return snapshots_.get(index); } + /** * * *
    -     * The names of the snapshots that match the request.
    +     * Optional. The names of the snapshots that match the request.
          * 
    * - * repeated string snapshots = 1; + * + * 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. @@ -660,14 +632,17 @@ public java.lang.String getSnapshots(int index) { public com.google.protobuf.ByteString getSnapshotsBytes(int index) { return snapshots_.getByteString(index); } + /** * * *
    -     * The names of the snapshots that match the request.
    +     * Optional. The names of the snapshots that match the request.
          * 
    * - * repeated string snapshots = 1; + * + * 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. @@ -679,17 +654,21 @@ public Builder setSnapshots(int index, java.lang.String value) { } ensureSnapshotsIsMutable(); snapshots_.set(index, value); + bitField0_ |= 0x00000001; onChanged(); return this; } + /** * * *
    -     * The names of the snapshots that match the request.
    +     * Optional. The names of the snapshots that match the request.
          * 
    * - * repeated string snapshots = 1; + * + * repeated string snapshots = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @param value The snapshots to add. * @return This builder for chaining. @@ -700,17 +679,21 @@ public Builder addSnapshots(java.lang.String value) { } ensureSnapshotsIsMutable(); snapshots_.add(value); + bitField0_ |= 0x00000001; onChanged(); return this; } + /** * * *
    -     * The names of the snapshots that match the request.
    +     * Optional. The names of the snapshots that match the request.
          * 
    * - * repeated string snapshots = 1; + * + * 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,34 +701,42 @@ public Builder addSnapshots(java.lang.String value) { public Builder addAllSnapshots(java.lang.Iterable values) { ensureSnapshotsIsMutable(); com.google.protobuf.AbstractMessageLite.Builder.addAll(values, snapshots_); + bitField0_ |= 0x00000001; onChanged(); return this; } + /** * * *
    -     * The names of the snapshots that match the request.
    +     * Optional. The names of the snapshots that match the request.
          * 
    * - * repeated string snapshots = 1; + * + * repeated string snapshots = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return This builder for chaining. */ public Builder clearSnapshots() { - snapshots_ = com.google.protobuf.LazyStringArrayList.EMPTY; + snapshots_ = com.google.protobuf.LazyStringArrayList.emptyList(); bitField0_ = (bitField0_ & ~0x00000001); + ; onChanged(); return this; } + /** * * *
    -     * The names of the snapshots that match the request.
    +     * Optional. The names of the snapshots that match the request.
          * 
    * - * repeated string snapshots = 1; + * + * 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. @@ -757,21 +748,23 @@ public Builder addSnapshotsBytes(com.google.protobuf.ByteString value) { checkByteStringIsUtf8(value); ensureSnapshotsIsMutable(); snapshots_.add(value); + bitField0_ |= 0x00000001; onChanged(); return this; } private java.lang.Object nextPageToken_ = ""; + /** * * *
    -     * If not empty, indicates that there may be more snapshots that match
    -     * the request; this value should be passed in a new
    +     * Optional. If not empty, indicates that there may be more snapshots that
    +     * match the request; this value should be passed in a new
          * `ListTopicSnapshotsRequest` to get more snapshots.
          * 
    * - * string next_page_token = 2; + * string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The nextPageToken. */ @@ -786,16 +779,17 @@ public java.lang.String getNextPageToken() { return (java.lang.String) ref; } } + /** * * *
    -     * If not empty, indicates that there may be more snapshots that match
    -     * the request; this value should be passed in a new
    +     * Optional. If not empty, indicates that there may be more snapshots that
    +     * match the request; this value should be passed in a new
          * `ListTopicSnapshotsRequest` to get more snapshots.
          * 
    * - * string next_page_token = 2; + * string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The bytes for nextPageToken. */ @@ -810,16 +804,17 @@ public com.google.protobuf.ByteString getNextPageTokenBytes() { return (com.google.protobuf.ByteString) ref; } } + /** * * *
    -     * If not empty, indicates that there may be more snapshots that match
    -     * the request; this value should be passed in a new
    +     * Optional. If not empty, indicates that there may be more snapshots that
    +     * match the request; this value should be passed in a new
          * `ListTopicSnapshotsRequest` to get more snapshots.
          * 
    * - * string next_page_token = 2; + * string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @param value The nextPageToken to set. * @return This builder for chaining. @@ -828,40 +823,42 @@ public Builder setNextPageToken(java.lang.String value) { if (value == null) { throw new NullPointerException(); } - nextPageToken_ = value; + bitField0_ |= 0x00000002; onChanged(); return this; } + /** * * *
    -     * If not empty, indicates that there may be more snapshots that match
    -     * the request; this value should be passed in a new
    +     * Optional. If not empty, indicates that there may be more snapshots that
    +     * match the request; this value should be passed in a new
          * `ListTopicSnapshotsRequest` to get more snapshots.
          * 
    * - * string next_page_token = 2; + * string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return This builder for chaining. */ public Builder clearNextPageToken() { - nextPageToken_ = getDefaultInstance().getNextPageToken(); + bitField0_ = (bitField0_ & ~0x00000002); onChanged(); return this; } + /** * * *
    -     * If not empty, indicates that there may be more snapshots that match
    -     * the request; this value should be passed in a new
    +     * Optional. If not empty, indicates that there may be more snapshots that
    +     * match the request; this value should be passed in a new
          * `ListTopicSnapshotsRequest` to get more snapshots.
          * 
    * - * string next_page_token = 2; + * string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @param value The bytes for nextPageToken to set. * @return This builder for chaining. @@ -871,23 +868,12 @@ public Builder setNextPageTokenBytes(com.google.protobuf.ByteString value) { throw new NullPointerException(); } checkByteStringIsUtf8(value); - nextPageToken_ = value; + bitField0_ |= 0x00000002; onChanged(); return this; } - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - // @@protoc_insertion_point(builder_scope:google.pubsub.v1.ListTopicSnapshotsResponse) } @@ -909,7 +895,18 @@ public ListTopicSnapshotsResponse parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new ListTopicSnapshotsResponse(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; 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 778a80008..25382f4f1 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 @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; +@com.google.protobuf.Generated public interface ListTopicSnapshotsResponseOrBuilder extends // @@protoc_insertion_point(interface_extends:google.pubsub.v1.ListTopicSnapshotsResponse) @@ -27,47 +30,58 @@ public interface ListTopicSnapshotsResponseOrBuilder * * *
    -   * The names of the snapshots that match the request.
    +   * Optional. The names of the snapshots that match the request.
        * 
    * - * repeated string snapshots = 1; + * + * repeated string snapshots = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return A list containing the snapshots. */ java.util.List getSnapshotsList(); + /** * * *
    -   * The names of the snapshots that match the request.
    +   * Optional. The names of the snapshots that match the request.
        * 
    * - * repeated string snapshots = 1; + * + * repeated string snapshots = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return The count of snapshots. */ int getSnapshotsCount(); + /** * * *
    -   * The names of the snapshots that match the request.
    +   * Optional. The names of the snapshots that match the request.
        * 
    * - * repeated string snapshots = 1; + * + * 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. */ java.lang.String getSnapshots(int index); + /** * * *
    -   * The names of the snapshots that match the request.
    +   * Optional. The names of the snapshots that match the request.
        * 
    * - * repeated string snapshots = 1; + * + * 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. @@ -78,26 +92,27 @@ public interface ListTopicSnapshotsResponseOrBuilder * * *
    -   * If not empty, indicates that there may be more snapshots that match
    -   * the request; this value should be passed in a new
    +   * Optional. If not empty, indicates that there may be more snapshots that
    +   * match the request; this value should be passed in a new
        * `ListTopicSnapshotsRequest` to get more snapshots.
        * 
    * - * string next_page_token = 2; + * string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The nextPageToken. */ java.lang.String getNextPageToken(); + /** * * *
    -   * If not empty, indicates that there may be more snapshots that match
    -   * the request; this value should be passed in a new
    +   * Optional. If not empty, indicates that there may be more snapshots that
    +   * match the request; this value should be passed in a new
        * `ListTopicSnapshotsRequest` to get more snapshots.
        * 
    * - * string next_page_token = 2; + * string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The bytes for nextPageToken. */ diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicSubscriptionsRequest.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicSubscriptionsRequest.java index 2bd00bee6..be6c24a99 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicSubscriptionsRequest.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicSubscriptionsRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; @@ -27,13 +29,25 @@ * * Protobuf type {@code google.pubsub.v1.ListTopicSubscriptionsRequest} */ -public final class ListTopicSubscriptionsRequest extends com.google.protobuf.GeneratedMessageV3 +@com.google.protobuf.Generated +public final class ListTopicSubscriptionsRequest extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:google.pubsub.v1.ListTopicSubscriptionsRequest) ListTopicSubscriptionsRequestOrBuilder { private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "ListTopicSubscriptionsRequest"); + } + // Use ListTopicSubscriptionsRequest.newBuilder() to construct. - private ListTopicSubscriptionsRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + private ListTopicSubscriptionsRequest(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); } @@ -42,80 +56,13 @@ private ListTopicSubscriptionsRequest() { pageToken_ = ""; } - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new ListTopicSubscriptionsRequest(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - private ListTopicSubscriptionsRequest( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - java.lang.String s = input.readStringRequireUtf8(); - - topic_ = s; - break; - } - case 16: - { - pageSize_ = input.readInt32(); - break; - } - case 26: - { - java.lang.String s = input.readStringRequireUtf8(); - - pageToken_ = s; - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_ListTopicSubscriptionsRequest_descriptor; } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_ListTopicSubscriptionsRequest_fieldAccessorTable @@ -125,7 +72,10 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } public static final int TOPIC_FIELD_NUMBER = 1; - private volatile java.lang.Object topic_; + + @SuppressWarnings("serial") + private volatile java.lang.Object topic_ = ""; + /** * * @@ -152,6 +102,7 @@ public java.lang.String getTopic() { return s; } } + /** * * @@ -180,15 +131,16 @@ public com.google.protobuf.ByteString getTopicBytes() { } public static final int PAGE_SIZE_FIELD_NUMBER = 2; - private int pageSize_; + private int pageSize_ = 0; + /** * * *
    -   * Maximum number of subscription names to return.
    +   * Optional. Maximum number of subscription names to return.
        * 
    * - * int32 page_size = 2; + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The pageSize. */ @@ -198,17 +150,20 @@ public int getPageSize() { } public static final int PAGE_TOKEN_FIELD_NUMBER = 3; - private volatile java.lang.Object pageToken_; + + @SuppressWarnings("serial") + private volatile java.lang.Object pageToken_ = ""; + /** * * *
    -   * The value returned by the last `ListTopicSubscriptionsResponse`; indicates
    -   * that this is a continuation of a prior `ListTopicSubscriptions` call, and
    -   * that the system should return the next page of data.
    +   * Optional. The value returned by the last `ListTopicSubscriptionsResponse`;
    +   * indicates that this is a continuation of a prior `ListTopicSubscriptions`
    +   * call, and that the system should return the next page of data.
        * 
    * - * string page_token = 3; + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; * * @return The pageToken. */ @@ -224,16 +179,17 @@ public java.lang.String getPageToken() { return s; } } + /** * * *
    -   * The value returned by the last `ListTopicSubscriptionsResponse`; indicates
    -   * that this is a continuation of a prior `ListTopicSubscriptions` call, and
    -   * that the system should return the next page of data.
    +   * Optional. The value returned by the last `ListTopicSubscriptionsResponse`;
    +   * indicates that this is a continuation of a prior `ListTopicSubscriptions`
    +   * call, and that the system should return the next page of data.
        * 
    * - * string page_token = 3; + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; * * @return The bytes for pageToken. */ @@ -264,16 +220,16 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!getTopicBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, topic_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(topic_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, topic_); } if (pageSize_ != 0) { output.writeInt32(2, pageSize_); } - if (!getPageTokenBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 3, pageToken_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(pageToken_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 3, pageToken_); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -282,16 +238,16 @@ public int getSerializedSize() { if (size != -1) return size; size = 0; - if (!getTopicBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, topic_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(topic_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, topic_); } if (pageSize_ != 0) { size += com.google.protobuf.CodedOutputStream.computeInt32Size(2, pageSize_); } - if (!getPageTokenBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, pageToken_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(pageToken_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(3, pageToken_); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -310,7 +266,7 @@ public boolean equals(final java.lang.Object obj) { if (!getTopic().equals(other.getTopic())) return false; if (getPageSize() != other.getPageSize()) return false; if (!getPageToken().equals(other.getPageToken())) return false; - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -327,7 +283,7 @@ public int hashCode() { hash = (53 * hash) + getPageSize(); hash = (37 * hash) + PAGE_TOKEN_FIELD_NUMBER; hash = (53 * hash) + getPageToken().hashCode(); - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -369,38 +325,38 @@ public static com.google.pubsub.v1.ListTopicSubscriptionsRequest parseFrom( public static com.google.pubsub.v1.ListTopicSubscriptionsRequest parseFrom( java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.ListTopicSubscriptionsRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.ListTopicSubscriptionsRequest parseDelimitedFrom( java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); } public static com.google.pubsub.v1.ListTopicSubscriptionsRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.ListTopicSubscriptionsRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.ListTopicSubscriptionsRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } @@ -423,10 +379,11 @@ public Builder toBuilder() { } @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** * * @@ -436,7 +393,7 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build * * Protobuf type {@code google.pubsub.v1.ListTopicSubscriptionsRequest} */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements // @@protoc_insertion_point(builder_implements:google.pubsub.v1.ListTopicSubscriptionsRequest) com.google.pubsub.v1.ListTopicSubscriptionsRequestOrBuilder { @@ -446,7 +403,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_ListTopicSubscriptionsRequest_fieldAccessorTable @@ -456,28 +413,19 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } // Construct using com.google.pubsub.v1.ListTopicSubscriptionsRequest.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } + private Builder() {} - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} } @java.lang.Override public Builder clear() { super.clear(); + bitField0_ = 0; topic_ = ""; - pageSize_ = 0; - pageToken_ = ""; - return this; } @@ -505,44 +453,24 @@ public com.google.pubsub.v1.ListTopicSubscriptionsRequest build() { public com.google.pubsub.v1.ListTopicSubscriptionsRequest buildPartial() { com.google.pubsub.v1.ListTopicSubscriptionsRequest result = new com.google.pubsub.v1.ListTopicSubscriptionsRequest(this); - result.topic_ = topic_; - result.pageSize_ = pageSize_; - result.pageToken_ = pageToken_; + if (bitField0_ != 0) { + buildPartial0(result); + } onBuilt(); return result; } - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); + private void buildPartial0(com.google.pubsub.v1.ListTopicSubscriptionsRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.topic_ = topic_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.pageSize_ = pageSize_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.pageToken_ = pageToken_; + } } @java.lang.Override @@ -560,6 +488,7 @@ public Builder mergeFrom(com.google.pubsub.v1.ListTopicSubscriptionsRequest othe return this; if (!other.getTopic().isEmpty()) { topic_ = other.topic_; + bitField0_ |= 0x00000001; onChanged(); } if (other.getPageSize() != 0) { @@ -567,9 +496,10 @@ public Builder mergeFrom(com.google.pubsub.v1.ListTopicSubscriptionsRequest othe } if (!other.getPageToken().isEmpty()) { pageToken_ = other.pageToken_; + bitField0_ |= 0x00000004; onChanged(); } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -584,22 +514,56 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.pubsub.v1.ListTopicSubscriptionsRequest parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + topic_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 16: + { + pageSize_ = input.readInt32(); + bitField0_ |= 0x00000002; + break; + } // case 16 + case 26: + { + pageToken_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000004; + break; + } // case 26 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = - (com.google.pubsub.v1.ListTopicSubscriptionsRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } + private int bitField0_; + private java.lang.Object topic_ = ""; + /** * * @@ -625,6 +589,7 @@ public java.lang.String getTopic() { return (java.lang.String) ref; } } + /** * * @@ -650,6 +615,7 @@ public com.google.protobuf.ByteString getTopicBytes() { return (com.google.protobuf.ByteString) ref; } } + /** * * @@ -669,11 +635,12 @@ public Builder setTopic(java.lang.String value) { if (value == null) { throw new NullPointerException(); } - topic_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } + /** * * @@ -689,11 +656,12 @@ public Builder setTopic(java.lang.String value) { * @return This builder for chaining. */ public Builder clearTopic() { - topic_ = getDefaultInstance().getTopic(); + bitField0_ = (bitField0_ & ~0x00000001); onChanged(); return this; } + /** * * @@ -714,21 +682,22 @@ public Builder setTopicBytes(com.google.protobuf.ByteString value) { throw new NullPointerException(); } checkByteStringIsUtf8(value); - topic_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } private int pageSize_; + /** * * *
    -     * Maximum number of subscription names to return.
    +     * Optional. Maximum number of subscription names to return.
          * 
    * - * int32 page_size = 2; + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The pageSize. */ @@ -736,14 +705,15 @@ public Builder setTopicBytes(com.google.protobuf.ByteString value) { public int getPageSize() { return pageSize_; } + /** * * *
    -     * Maximum number of subscription names to return.
    +     * Optional. Maximum number of subscription names to return.
          * 
    * - * int32 page_size = 2; + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @param value The pageSize to set. * @return This builder for chaining. @@ -751,38 +721,41 @@ public int getPageSize() { public Builder setPageSize(int value) { pageSize_ = value; + bitField0_ |= 0x00000002; onChanged(); return this; } + /** * * *
    -     * Maximum number of subscription names to return.
    +     * Optional. Maximum number of subscription names to return.
          * 
    * - * int32 page_size = 2; + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return This builder for chaining. */ public Builder clearPageSize() { - + bitField0_ = (bitField0_ & ~0x00000002); pageSize_ = 0; onChanged(); return this; } private java.lang.Object pageToken_ = ""; + /** * * *
    -     * The value returned by the last `ListTopicSubscriptionsResponse`; indicates
    -     * that this is a continuation of a prior `ListTopicSubscriptions` call, and
    -     * that the system should return the next page of data.
    +     * Optional. The value returned by the last `ListTopicSubscriptionsResponse`;
    +     * indicates that this is a continuation of a prior `ListTopicSubscriptions`
    +     * call, and that the system should return the next page of data.
          * 
    * - * string page_token = 3; + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; * * @return The pageToken. */ @@ -797,16 +770,17 @@ public java.lang.String getPageToken() { return (java.lang.String) ref; } } + /** * * *
    -     * The value returned by the last `ListTopicSubscriptionsResponse`; indicates
    -     * that this is a continuation of a prior `ListTopicSubscriptions` call, and
    -     * that the system should return the next page of data.
    +     * Optional. The value returned by the last `ListTopicSubscriptionsResponse`;
    +     * indicates that this is a continuation of a prior `ListTopicSubscriptions`
    +     * call, and that the system should return the next page of data.
          * 
    * - * string page_token = 3; + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; * * @return The bytes for pageToken. */ @@ -821,16 +795,17 @@ public com.google.protobuf.ByteString getPageTokenBytes() { return (com.google.protobuf.ByteString) ref; } } + /** * * *
    -     * The value returned by the last `ListTopicSubscriptionsResponse`; indicates
    -     * that this is a continuation of a prior `ListTopicSubscriptions` call, and
    -     * that the system should return the next page of data.
    +     * Optional. The value returned by the last `ListTopicSubscriptionsResponse`;
    +     * indicates that this is a continuation of a prior `ListTopicSubscriptions`
    +     * call, and that the system should return the next page of data.
          * 
    * - * string page_token = 3; + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; * * @param value The pageToken to set. * @return This builder for chaining. @@ -839,40 +814,42 @@ public Builder setPageToken(java.lang.String value) { if (value == null) { throw new NullPointerException(); } - pageToken_ = value; + bitField0_ |= 0x00000004; onChanged(); return this; } + /** * * *
    -     * The value returned by the last `ListTopicSubscriptionsResponse`; indicates
    -     * that this is a continuation of a prior `ListTopicSubscriptions` call, and
    -     * that the system should return the next page of data.
    +     * Optional. The value returned by the last `ListTopicSubscriptionsResponse`;
    +     * indicates that this is a continuation of a prior `ListTopicSubscriptions`
    +     * call, and that the system should return the next page of data.
          * 
    * - * string page_token = 3; + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; * * @return This builder for chaining. */ public Builder clearPageToken() { - pageToken_ = getDefaultInstance().getPageToken(); + bitField0_ = (bitField0_ & ~0x00000004); onChanged(); return this; } + /** * * *
    -     * The value returned by the last `ListTopicSubscriptionsResponse`; indicates
    -     * that this is a continuation of a prior `ListTopicSubscriptions` call, and
    -     * that the system should return the next page of data.
    +     * Optional. The value returned by the last `ListTopicSubscriptionsResponse`;
    +     * indicates that this is a continuation of a prior `ListTopicSubscriptions`
    +     * call, and that the system should return the next page of data.
          * 
    * - * string page_token = 3; + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; * * @param value The bytes for pageToken to set. * @return This builder for chaining. @@ -882,23 +859,12 @@ public Builder setPageTokenBytes(com.google.protobuf.ByteString value) { throw new NullPointerException(); } checkByteStringIsUtf8(value); - pageToken_ = value; + bitField0_ |= 0x00000004; onChanged(); return this; } - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - // @@protoc_insertion_point(builder_scope:google.pubsub.v1.ListTopicSubscriptionsRequest) } @@ -920,7 +886,18 @@ public ListTopicSubscriptionsRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new ListTopicSubscriptionsRequest(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicSubscriptionsRequestOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicSubscriptionsRequestOrBuilder.java index 2d09f8895..07a1f6124 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicSubscriptionsRequestOrBuilder.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicSubscriptionsRequestOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; +@com.google.protobuf.Generated public interface ListTopicSubscriptionsRequestOrBuilder extends // @@protoc_insertion_point(interface_extends:google.pubsub.v1.ListTopicSubscriptionsRequest) @@ -38,6 +41,7 @@ public interface ListTopicSubscriptionsRequestOrBuilder * @return The topic. */ java.lang.String getTopic(); + /** * * @@ -58,10 +62,10 @@ public interface ListTopicSubscriptionsRequestOrBuilder * * *
    -   * Maximum number of subscription names to return.
    +   * Optional. Maximum number of subscription names to return.
        * 
    * - * int32 page_size = 2; + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The pageSize. */ @@ -71,26 +75,27 @@ public interface ListTopicSubscriptionsRequestOrBuilder * * *
    -   * The value returned by the last `ListTopicSubscriptionsResponse`; indicates
    -   * that this is a continuation of a prior `ListTopicSubscriptions` call, and
    -   * that the system should return the next page of data.
    +   * Optional. The value returned by the last `ListTopicSubscriptionsResponse`;
    +   * indicates that this is a continuation of a prior `ListTopicSubscriptions`
    +   * call, and that the system should return the next page of data.
        * 
    * - * string page_token = 3; + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; * * @return The pageToken. */ java.lang.String getPageToken(); + /** * * *
    -   * The value returned by the last `ListTopicSubscriptionsResponse`; indicates
    -   * that this is a continuation of a prior `ListTopicSubscriptions` call, and
    -   * that the system should return the next page of data.
    +   * Optional. The value returned by the last `ListTopicSubscriptionsResponse`;
    +   * indicates that this is a continuation of a prior `ListTopicSubscriptions`
    +   * call, and that the system should return the next page of data.
        * 
    * - * string page_token = 3; + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; * * @return The bytes for pageToken. */ diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicSubscriptionsResponse.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicSubscriptionsResponse.java index 303bd86a4..ed115a4c5 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicSubscriptionsResponse.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicSubscriptionsResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; @@ -27,98 +29,40 @@ * * Protobuf type {@code google.pubsub.v1.ListTopicSubscriptionsResponse} */ -public final class ListTopicSubscriptionsResponse extends com.google.protobuf.GeneratedMessageV3 +@com.google.protobuf.Generated +public final class ListTopicSubscriptionsResponse extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:google.pubsub.v1.ListTopicSubscriptionsResponse) ListTopicSubscriptionsResponseOrBuilder { private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "ListTopicSubscriptionsResponse"); + } + // Use ListTopicSubscriptionsResponse.newBuilder() to construct. - private ListTopicSubscriptionsResponse( - com.google.protobuf.GeneratedMessageV3.Builder builder) { + private ListTopicSubscriptionsResponse(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); } private ListTopicSubscriptionsResponse() { - subscriptions_ = com.google.protobuf.LazyStringArrayList.EMPTY; + subscriptions_ = com.google.protobuf.LazyStringArrayList.emptyList(); nextPageToken_ = ""; } - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new ListTopicSubscriptionsResponse(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - private ListTopicSubscriptionsResponse( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - java.lang.String s = input.readStringRequireUtf8(); - if (!((mutable_bitField0_ & 0x00000001) != 0)) { - subscriptions_ = new com.google.protobuf.LazyStringArrayList(); - mutable_bitField0_ |= 0x00000001; - } - subscriptions_.add(s); - break; - } - case 18: - { - java.lang.String s = input.readStringRequireUtf8(); - - nextPageToken_ = s; - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000001) != 0)) { - subscriptions_ = subscriptions_.getUnmodifiableView(); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_ListTopicSubscriptionsResponse_descriptor; } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_ListTopicSubscriptionsResponse_fieldAccessorTable @@ -128,43 +72,58 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } public static final int SUBSCRIPTIONS_FIELD_NUMBER = 1; - private com.google.protobuf.LazyStringList subscriptions_; + + @SuppressWarnings("serial") + private com.google.protobuf.LazyStringArrayList subscriptions_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + /** * * *
    -   * The names of subscriptions attached to the topic specified in the request.
    +   * Optional. The names of subscriptions attached to the topic specified in the
    +   * request.
        * 
    * - * repeated string subscriptions = 1 [(.google.api.resource_reference) = { ... } + * + * repeated string subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return A list containing the subscriptions. */ public com.google.protobuf.ProtocolStringList getSubscriptionsList() { return subscriptions_; } + /** * * *
    -   * The names of subscriptions attached to the topic specified in the request.
    +   * Optional. The names of subscriptions attached to the topic specified in the
    +   * request.
        * 
    * - * repeated string subscriptions = 1 [(.google.api.resource_reference) = { ... } + * + * repeated string subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return The count of subscriptions. */ public int getSubscriptionsCount() { return subscriptions_.size(); } + /** * * *
    -   * The names of subscriptions attached to the topic specified in the request.
    +   * Optional. The names of subscriptions attached to the topic specified in the
    +   * request.
        * 
    * - * repeated string subscriptions = 1 [(.google.api.resource_reference) = { ... } + * + * repeated string subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @param index The index of the element to return. * @return The subscriptions at the given index. @@ -172,14 +131,18 @@ public int getSubscriptionsCount() { public java.lang.String getSubscriptions(int index) { return subscriptions_.get(index); } + /** * * *
    -   * The names of subscriptions attached to the topic specified in the request.
    +   * Optional. The names of subscriptions attached to the topic specified in the
    +   * request.
        * 
    * - * repeated string subscriptions = 1 [(.google.api.resource_reference) = { ... } + * + * repeated string subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @param index The index of the value to return. * @return The bytes of the subscriptions at the given index. @@ -189,17 +152,20 @@ public com.google.protobuf.ByteString getSubscriptionsBytes(int index) { } public static final int NEXT_PAGE_TOKEN_FIELD_NUMBER = 2; - private volatile java.lang.Object nextPageToken_; + + @SuppressWarnings("serial") + private volatile java.lang.Object nextPageToken_ = ""; + /** * * *
    -   * If not empty, indicates that there may be more subscriptions that match
    -   * the request; this value should be passed in a new
    +   * Optional. If not empty, indicates that there may be more subscriptions that
    +   * match the request; this value should be passed in a new
        * `ListTopicSubscriptionsRequest` to get more subscriptions.
        * 
    * - * string next_page_token = 2; + * string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The nextPageToken. */ @@ -215,16 +181,17 @@ public java.lang.String getNextPageToken() { return s; } } + /** * * *
    -   * If not empty, indicates that there may be more subscriptions that match
    -   * the request; this value should be passed in a new
    +   * Optional. If not empty, indicates that there may be more subscriptions that
    +   * match the request; this value should be passed in a new
        * `ListTopicSubscriptionsRequest` to get more subscriptions.
        * 
    * - * string next_page_token = 2; + * string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The bytes for nextPageToken. */ @@ -256,12 +223,12 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { for (int i = 0; i < subscriptions_.size(); i++) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, subscriptions_.getRaw(i)); + com.google.protobuf.GeneratedMessage.writeString(output, 1, subscriptions_.getRaw(i)); } - if (!getNextPageTokenBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 2, nextPageToken_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(nextPageToken_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, nextPageToken_); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -278,10 +245,10 @@ public int getSerializedSize() { size += dataSize; size += 1 * getSubscriptionsList().size(); } - if (!getNextPageTokenBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, nextPageToken_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(nextPageToken_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, nextPageToken_); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -299,7 +266,7 @@ public boolean equals(final java.lang.Object obj) { if (!getSubscriptionsList().equals(other.getSubscriptionsList())) return false; if (!getNextPageToken().equals(other.getNextPageToken())) return false; - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -316,7 +283,7 @@ public int hashCode() { } hash = (37 * hash) + NEXT_PAGE_TOKEN_FIELD_NUMBER; hash = (53 * hash) + getNextPageToken().hashCode(); - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -358,38 +325,38 @@ public static com.google.pubsub.v1.ListTopicSubscriptionsResponse parseFrom( public static com.google.pubsub.v1.ListTopicSubscriptionsResponse parseFrom( java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.ListTopicSubscriptionsResponse parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.ListTopicSubscriptionsResponse parseDelimitedFrom( java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); } public static com.google.pubsub.v1.ListTopicSubscriptionsResponse parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.ListTopicSubscriptionsResponse parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.ListTopicSubscriptionsResponse parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } @@ -412,10 +379,11 @@ public Builder toBuilder() { } @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** * * @@ -425,7 +393,7 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build * * Protobuf type {@code google.pubsub.v1.ListTopicSubscriptionsResponse} */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements // @@protoc_insertion_point(builder_implements:google.pubsub.v1.ListTopicSubscriptionsResponse) com.google.pubsub.v1.ListTopicSubscriptionsResponseOrBuilder { @@ -435,7 +403,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_ListTopicSubscriptionsResponse_fieldAccessorTable @@ -445,26 +413,18 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } // Construct using com.google.pubsub.v1.ListTopicSubscriptionsResponse.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } + private Builder() {} - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} } @java.lang.Override public Builder clear() { super.clear(); - subscriptions_ = com.google.protobuf.LazyStringArrayList.EMPTY; - bitField0_ = (bitField0_ & ~0x00000001); + bitField0_ = 0; + subscriptions_ = com.google.protobuf.LazyStringArrayList.emptyList(); nextPageToken_ = ""; - return this; } @@ -492,48 +452,22 @@ public com.google.pubsub.v1.ListTopicSubscriptionsResponse build() { public com.google.pubsub.v1.ListTopicSubscriptionsResponse buildPartial() { com.google.pubsub.v1.ListTopicSubscriptionsResponse result = new com.google.pubsub.v1.ListTopicSubscriptionsResponse(this); - int from_bitField0_ = bitField0_; - if (((bitField0_ & 0x00000001) != 0)) { - subscriptions_ = subscriptions_.getUnmodifiableView(); - bitField0_ = (bitField0_ & ~0x00000001); + if (bitField0_ != 0) { + buildPartial0(result); } - result.subscriptions_ = subscriptions_; - result.nextPageToken_ = nextPageToken_; onBuilt(); return result; } - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); + private void buildPartial0(com.google.pubsub.v1.ListTopicSubscriptionsResponse result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + subscriptions_.makeImmutable(); + result.subscriptions_ = subscriptions_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.nextPageToken_ = nextPageToken_; + } } @java.lang.Override @@ -552,7 +486,7 @@ public Builder mergeFrom(com.google.pubsub.v1.ListTopicSubscriptionsResponse oth if (!other.subscriptions_.isEmpty()) { if (subscriptions_.isEmpty()) { subscriptions_ = other.subscriptions_; - bitField0_ = (bitField0_ & ~0x00000001); + bitField0_ |= 0x00000001; } else { ensureSubscriptionsIsMutable(); subscriptions_.addAll(other.subscriptions_); @@ -561,9 +495,10 @@ public Builder mergeFrom(com.google.pubsub.v1.ListTopicSubscriptionsResponse oth } if (!other.getNextPageToken().isEmpty()) { nextPageToken_ = other.nextPageToken_; + bitField0_ |= 0x00000002; onChanged(); } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -578,68 +513,107 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.pubsub.v1.ListTopicSubscriptionsResponse parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + ensureSubscriptionsIsMutable(); + subscriptions_.add(s); + break; + } // case 10 + case 18: + { + nextPageToken_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = - (com.google.pubsub.v1.ListTopicSubscriptionsResponse) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } private int bitField0_; - private com.google.protobuf.LazyStringList subscriptions_ = - com.google.protobuf.LazyStringArrayList.EMPTY; + private com.google.protobuf.LazyStringArrayList subscriptions_ = + com.google.protobuf.LazyStringArrayList.emptyList(); private void ensureSubscriptionsIsMutable() { - if (!((bitField0_ & 0x00000001) != 0)) { + if (!subscriptions_.isModifiable()) { subscriptions_ = new com.google.protobuf.LazyStringArrayList(subscriptions_); - bitField0_ |= 0x00000001; } + bitField0_ |= 0x00000001; } + /** * * *
    -     * The names of subscriptions attached to the topic specified in the request.
    +     * Optional. The names of subscriptions attached to the topic specified in the
    +     * request.
          * 
    * - * repeated string subscriptions = 1 [(.google.api.resource_reference) = { ... } + * + * repeated string subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return A list containing the subscriptions. */ public com.google.protobuf.ProtocolStringList getSubscriptionsList() { - return subscriptions_.getUnmodifiableView(); + subscriptions_.makeImmutable(); + return subscriptions_; } + /** * * *
    -     * The names of subscriptions attached to the topic specified in the request.
    +     * Optional. The names of subscriptions attached to the topic specified in the
    +     * request.
          * 
    * - * repeated string subscriptions = 1 [(.google.api.resource_reference) = { ... } + * + * repeated string subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return The count of subscriptions. */ public int getSubscriptionsCount() { return subscriptions_.size(); } + /** * * *
    -     * The names of subscriptions attached to the topic specified in the request.
    +     * Optional. The names of subscriptions attached to the topic specified in the
    +     * request.
          * 
    * - * repeated string subscriptions = 1 [(.google.api.resource_reference) = { ... } + * + * repeated string subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @param index The index of the element to return. * @return The subscriptions at the given index. @@ -647,14 +621,18 @@ public int getSubscriptionsCount() { public java.lang.String getSubscriptions(int index) { return subscriptions_.get(index); } + /** * * *
    -     * The names of subscriptions attached to the topic specified in the request.
    +     * Optional. The names of subscriptions attached to the topic specified in the
    +     * request.
          * 
    * - * repeated string subscriptions = 1 [(.google.api.resource_reference) = { ... } + * + * repeated string subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @param index The index of the value to return. * @return The bytes of the subscriptions at the given index. @@ -662,14 +640,18 @@ public java.lang.String getSubscriptions(int index) { public com.google.protobuf.ByteString getSubscriptionsBytes(int index) { return subscriptions_.getByteString(index); } + /** * * *
    -     * The names of subscriptions attached to the topic specified in the request.
    +     * Optional. The names of subscriptions attached to the topic specified in the
    +     * request.
          * 
    * - * repeated string subscriptions = 1 [(.google.api.resource_reference) = { ... } + * + * repeated string subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @param index The index to set the value at. * @param value The subscriptions to set. @@ -681,17 +663,22 @@ public Builder setSubscriptions(int index, java.lang.String value) { } ensureSubscriptionsIsMutable(); subscriptions_.set(index, value); + bitField0_ |= 0x00000001; onChanged(); return this; } + /** * * *
    -     * The names of subscriptions attached to the topic specified in the request.
    +     * Optional. The names of subscriptions attached to the topic specified in the
    +     * request.
          * 
    * - * repeated string subscriptions = 1 [(.google.api.resource_reference) = { ... } + * + * repeated string subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @param value The subscriptions to add. * @return This builder for chaining. @@ -702,17 +689,22 @@ public Builder addSubscriptions(java.lang.String value) { } ensureSubscriptionsIsMutable(); subscriptions_.add(value); + bitField0_ |= 0x00000001; onChanged(); return this; } + /** * * *
    -     * The names of subscriptions attached to the topic specified in the request.
    +     * Optional. The names of subscriptions attached to the topic specified in the
    +     * request.
          * 
    * - * repeated string subscriptions = 1 [(.google.api.resource_reference) = { ... } + * + * repeated string subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @param values The subscriptions to add. * @return This builder for chaining. @@ -720,34 +712,44 @@ public Builder addSubscriptions(java.lang.String value) { public Builder addAllSubscriptions(java.lang.Iterable values) { ensureSubscriptionsIsMutable(); com.google.protobuf.AbstractMessageLite.Builder.addAll(values, subscriptions_); + bitField0_ |= 0x00000001; onChanged(); return this; } + /** * * *
    -     * The names of subscriptions attached to the topic specified in the request.
    +     * Optional. The names of subscriptions attached to the topic specified in the
    +     * request.
          * 
    * - * repeated string subscriptions = 1 [(.google.api.resource_reference) = { ... } + * + * repeated string subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return This builder for chaining. */ public Builder clearSubscriptions() { - subscriptions_ = com.google.protobuf.LazyStringArrayList.EMPTY; + subscriptions_ = com.google.protobuf.LazyStringArrayList.emptyList(); bitField0_ = (bitField0_ & ~0x00000001); + ; onChanged(); return this; } + /** * * *
    -     * The names of subscriptions attached to the topic specified in the request.
    +     * Optional. The names of subscriptions attached to the topic specified in the
    +     * request.
          * 
    * - * repeated string subscriptions = 1 [(.google.api.resource_reference) = { ... } + * + * repeated string subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @param value The bytes of the subscriptions to add. * @return This builder for chaining. @@ -759,21 +761,23 @@ public Builder addSubscriptionsBytes(com.google.protobuf.ByteString value) { checkByteStringIsUtf8(value); ensureSubscriptionsIsMutable(); subscriptions_.add(value); + bitField0_ |= 0x00000001; onChanged(); return this; } private java.lang.Object nextPageToken_ = ""; + /** * * *
    -     * If not empty, indicates that there may be more subscriptions that match
    -     * the request; this value should be passed in a new
    +     * Optional. If not empty, indicates that there may be more subscriptions that
    +     * match the request; this value should be passed in a new
          * `ListTopicSubscriptionsRequest` to get more subscriptions.
          * 
    * - * string next_page_token = 2; + * string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The nextPageToken. */ @@ -788,16 +792,17 @@ public java.lang.String getNextPageToken() { return (java.lang.String) ref; } } + /** * * *
    -     * If not empty, indicates that there may be more subscriptions that match
    -     * the request; this value should be passed in a new
    +     * Optional. If not empty, indicates that there may be more subscriptions that
    +     * match the request; this value should be passed in a new
          * `ListTopicSubscriptionsRequest` to get more subscriptions.
          * 
    * - * string next_page_token = 2; + * string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The bytes for nextPageToken. */ @@ -812,16 +817,17 @@ public com.google.protobuf.ByteString getNextPageTokenBytes() { return (com.google.protobuf.ByteString) ref; } } + /** * * *
    -     * If not empty, indicates that there may be more subscriptions that match
    -     * the request; this value should be passed in a new
    +     * Optional. If not empty, indicates that there may be more subscriptions that
    +     * match the request; this value should be passed in a new
          * `ListTopicSubscriptionsRequest` to get more subscriptions.
          * 
    * - * string next_page_token = 2; + * string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @param value The nextPageToken to set. * @return This builder for chaining. @@ -830,40 +836,42 @@ public Builder setNextPageToken(java.lang.String value) { if (value == null) { throw new NullPointerException(); } - nextPageToken_ = value; + bitField0_ |= 0x00000002; onChanged(); return this; } + /** * * *
    -     * If not empty, indicates that there may be more subscriptions that match
    -     * the request; this value should be passed in a new
    +     * Optional. If not empty, indicates that there may be more subscriptions that
    +     * match the request; this value should be passed in a new
          * `ListTopicSubscriptionsRequest` to get more subscriptions.
          * 
    * - * string next_page_token = 2; + * string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return This builder for chaining. */ public Builder clearNextPageToken() { - nextPageToken_ = getDefaultInstance().getNextPageToken(); + bitField0_ = (bitField0_ & ~0x00000002); onChanged(); return this; } + /** * * *
    -     * If not empty, indicates that there may be more subscriptions that match
    -     * the request; this value should be passed in a new
    +     * Optional. If not empty, indicates that there may be more subscriptions that
    +     * match the request; this value should be passed in a new
          * `ListTopicSubscriptionsRequest` to get more subscriptions.
          * 
    * - * string next_page_token = 2; + * string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @param value The bytes for nextPageToken to set. * @return This builder for chaining. @@ -873,23 +881,12 @@ public Builder setNextPageTokenBytes(com.google.protobuf.ByteString value) { throw new NullPointerException(); } checkByteStringIsUtf8(value); - nextPageToken_ = value; + bitField0_ |= 0x00000002; onChanged(); return this; } - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - // @@protoc_insertion_point(builder_scope:google.pubsub.v1.ListTopicSubscriptionsResponse) } @@ -911,7 +908,18 @@ public ListTopicSubscriptionsResponse parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new ListTopicSubscriptionsResponse(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicSubscriptionsResponseOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicSubscriptionsResponseOrBuilder.java index dffc961db..559bb08c2 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicSubscriptionsResponseOrBuilder.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicSubscriptionsResponseOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; +@com.google.protobuf.Generated public interface ListTopicSubscriptionsResponseOrBuilder extends // @@protoc_insertion_point(interface_extends:google.pubsub.v1.ListTopicSubscriptionsResponse) @@ -27,47 +30,62 @@ public interface ListTopicSubscriptionsResponseOrBuilder * * *
    -   * The names of subscriptions attached to the topic specified in the request.
    +   * Optional. The names of subscriptions attached to the topic specified in the
    +   * request.
        * 
    * - * repeated string subscriptions = 1 [(.google.api.resource_reference) = { ... } + * + * repeated string subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return A list containing the subscriptions. */ java.util.List getSubscriptionsList(); + /** * * *
    -   * The names of subscriptions attached to the topic specified in the request.
    +   * Optional. The names of subscriptions attached to the topic specified in the
    +   * request.
        * 
    * - * repeated string subscriptions = 1 [(.google.api.resource_reference) = { ... } + * + * repeated string subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return The count of subscriptions. */ int getSubscriptionsCount(); + /** * * *
    -   * The names of subscriptions attached to the topic specified in the request.
    +   * Optional. The names of subscriptions attached to the topic specified in the
    +   * request.
        * 
    * - * repeated string subscriptions = 1 [(.google.api.resource_reference) = { ... } + * + * repeated string subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @param index The index of the element to return. * @return The subscriptions at the given index. */ java.lang.String getSubscriptions(int index); + /** * * *
    -   * The names of subscriptions attached to the topic specified in the request.
    +   * Optional. The names of subscriptions attached to the topic specified in the
    +   * request.
        * 
    * - * repeated string subscriptions = 1 [(.google.api.resource_reference) = { ... } + * + * repeated string subscriptions = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @param index The index of the value to return. * @return The bytes of the subscriptions at the given index. @@ -78,26 +96,27 @@ public interface ListTopicSubscriptionsResponseOrBuilder * * *
    -   * If not empty, indicates that there may be more subscriptions that match
    -   * the request; this value should be passed in a new
    +   * Optional. If not empty, indicates that there may be more subscriptions that
    +   * match the request; this value should be passed in a new
        * `ListTopicSubscriptionsRequest` to get more subscriptions.
        * 
    * - * string next_page_token = 2; + * string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The nextPageToken. */ java.lang.String getNextPageToken(); + /** * * *
    -   * If not empty, indicates that there may be more subscriptions that match
    -   * the request; this value should be passed in a new
    +   * Optional. If not empty, indicates that there may be more subscriptions that
    +   * match the request; this value should be passed in a new
        * `ListTopicSubscriptionsRequest` to get more subscriptions.
        * 
    * - * string next_page_token = 2; + * string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The bytes for nextPageToken. */ diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicsRequest.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicsRequest.java index b6660177d..5db5c1454 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicsRequest.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicsRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; @@ -27,13 +29,25 @@ * * Protobuf type {@code google.pubsub.v1.ListTopicsRequest} */ -public final class ListTopicsRequest extends com.google.protobuf.GeneratedMessageV3 +@com.google.protobuf.Generated +public final class ListTopicsRequest extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:google.pubsub.v1.ListTopicsRequest) ListTopicsRequestOrBuilder { private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "ListTopicsRequest"); + } + // Use ListTopicsRequest.newBuilder() to construct. - private ListTopicsRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + private ListTopicsRequest(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); } @@ -42,80 +56,13 @@ private ListTopicsRequest() { pageToken_ = ""; } - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new ListTopicsRequest(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - private ListTopicsRequest( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - java.lang.String s = input.readStringRequireUtf8(); - - project_ = s; - break; - } - case 16: - { - pageSize_ = input.readInt32(); - break; - } - case 26: - { - java.lang.String s = input.readStringRequireUtf8(); - - pageToken_ = s; - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_ListTopicsRequest_descriptor; } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_ListTopicsRequest_fieldAccessorTable @@ -125,7 +72,10 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } public static final int PROJECT_FIELD_NUMBER = 1; - private volatile java.lang.Object project_; + + @SuppressWarnings("serial") + private volatile java.lang.Object project_ = ""; + /** * * @@ -152,6 +102,7 @@ public java.lang.String getProject() { return s; } } + /** * * @@ -180,15 +131,16 @@ public com.google.protobuf.ByteString getProjectBytes() { } public static final int PAGE_SIZE_FIELD_NUMBER = 2; - private int pageSize_; + private int pageSize_ = 0; + /** * * *
    -   * Maximum number of topics to return.
    +   * Optional. Maximum number of topics to return.
        * 
    * - * int32 page_size = 2; + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The pageSize. */ @@ -198,17 +150,20 @@ public int getPageSize() { } public static final int PAGE_TOKEN_FIELD_NUMBER = 3; - private volatile java.lang.Object pageToken_; + + @SuppressWarnings("serial") + private volatile java.lang.Object pageToken_ = ""; + /** * * *
    -   * The value returned by the last `ListTopicsResponse`; indicates that this is
    -   * a continuation of a prior `ListTopics` call, and that the system should
    -   * return the next page of data.
    +   * Optional. The value returned by the last `ListTopicsResponse`; indicates
    +   * that this is a continuation of a prior `ListTopics` call, and that the
    +   * system should return the next page of data.
        * 
    * - * string page_token = 3; + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; * * @return The pageToken. */ @@ -224,16 +179,17 @@ public java.lang.String getPageToken() { return s; } } + /** * * *
    -   * The value returned by the last `ListTopicsResponse`; indicates that this is
    -   * a continuation of a prior `ListTopics` call, and that the system should
    -   * return the next page of data.
    +   * Optional. The value returned by the last `ListTopicsResponse`; indicates
    +   * that this is a continuation of a prior `ListTopics` call, and that the
    +   * system should return the next page of data.
        * 
    * - * string page_token = 3; + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; * * @return The bytes for pageToken. */ @@ -264,16 +220,16 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!getProjectBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, project_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(project_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, project_); } if (pageSize_ != 0) { output.writeInt32(2, pageSize_); } - if (!getPageTokenBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 3, pageToken_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(pageToken_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 3, pageToken_); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -282,16 +238,16 @@ public int getSerializedSize() { if (size != -1) return size; size = 0; - if (!getProjectBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, project_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(project_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, project_); } if (pageSize_ != 0) { size += com.google.protobuf.CodedOutputStream.computeInt32Size(2, pageSize_); } - if (!getPageTokenBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, pageToken_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(pageToken_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(3, pageToken_); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -309,7 +265,7 @@ public boolean equals(final java.lang.Object obj) { if (!getProject().equals(other.getProject())) return false; if (getPageSize() != other.getPageSize()) return false; if (!getPageToken().equals(other.getPageToken())) return false; - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -326,7 +282,7 @@ public int hashCode() { hash = (53 * hash) + getPageSize(); hash = (37 * hash) + PAGE_TOKEN_FIELD_NUMBER; hash = (53 * hash) + getPageToken().hashCode(); - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -368,38 +324,38 @@ public static com.google.pubsub.v1.ListTopicsRequest parseFrom( public static com.google.pubsub.v1.ListTopicsRequest parseFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.ListTopicsRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.ListTopicsRequest parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); } public static com.google.pubsub.v1.ListTopicsRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.ListTopicsRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.ListTopicsRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } @@ -422,10 +378,11 @@ public Builder toBuilder() { } @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** * * @@ -435,7 +392,7 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build * * Protobuf type {@code google.pubsub.v1.ListTopicsRequest} */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements // @@protoc_insertion_point(builder_implements:google.pubsub.v1.ListTopicsRequest) com.google.pubsub.v1.ListTopicsRequestOrBuilder { @@ -445,7 +402,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_ListTopicsRequest_fieldAccessorTable @@ -455,28 +412,19 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } // Construct using com.google.pubsub.v1.ListTopicsRequest.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } + private Builder() {} - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} } @java.lang.Override public Builder clear() { super.clear(); + bitField0_ = 0; project_ = ""; - pageSize_ = 0; - pageToken_ = ""; - return this; } @@ -504,44 +452,24 @@ public com.google.pubsub.v1.ListTopicsRequest build() { public com.google.pubsub.v1.ListTopicsRequest buildPartial() { com.google.pubsub.v1.ListTopicsRequest result = new com.google.pubsub.v1.ListTopicsRequest(this); - result.project_ = project_; - result.pageSize_ = pageSize_; - result.pageToken_ = pageToken_; + if (bitField0_ != 0) { + buildPartial0(result); + } onBuilt(); return result; } - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); + private void buildPartial0(com.google.pubsub.v1.ListTopicsRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.project_ = project_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.pageSize_ = pageSize_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.pageToken_ = pageToken_; + } } @java.lang.Override @@ -558,6 +486,7 @@ public Builder mergeFrom(com.google.pubsub.v1.ListTopicsRequest other) { if (other == com.google.pubsub.v1.ListTopicsRequest.getDefaultInstance()) return this; if (!other.getProject().isEmpty()) { project_ = other.project_; + bitField0_ |= 0x00000001; onChanged(); } if (other.getPageSize() != 0) { @@ -565,9 +494,10 @@ public Builder mergeFrom(com.google.pubsub.v1.ListTopicsRequest other) { } if (!other.getPageToken().isEmpty()) { pageToken_ = other.pageToken_; + bitField0_ |= 0x00000004; onChanged(); } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -582,21 +512,56 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.pubsub.v1.ListTopicsRequest parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + project_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 16: + { + pageSize_ = input.readInt32(); + bitField0_ |= 0x00000002; + break; + } // case 16 + case 26: + { + pageToken_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000004; + break; + } // case 26 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.google.pubsub.v1.ListTopicsRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } + private int bitField0_; + private java.lang.Object project_ = ""; + /** * * @@ -622,6 +587,7 @@ public java.lang.String getProject() { return (java.lang.String) ref; } } + /** * * @@ -647,6 +613,7 @@ public com.google.protobuf.ByteString getProjectBytes() { return (com.google.protobuf.ByteString) ref; } } + /** * * @@ -666,11 +633,12 @@ public Builder setProject(java.lang.String value) { if (value == null) { throw new NullPointerException(); } - project_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } + /** * * @@ -686,11 +654,12 @@ public Builder setProject(java.lang.String value) { * @return This builder for chaining. */ public Builder clearProject() { - project_ = getDefaultInstance().getProject(); + bitField0_ = (bitField0_ & ~0x00000001); onChanged(); return this; } + /** * * @@ -711,21 +680,22 @@ public Builder setProjectBytes(com.google.protobuf.ByteString value) { throw new NullPointerException(); } checkByteStringIsUtf8(value); - project_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } private int pageSize_; + /** * * *
    -     * Maximum number of topics to return.
    +     * Optional. Maximum number of topics to return.
          * 
    * - * int32 page_size = 2; + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The pageSize. */ @@ -733,14 +703,15 @@ public Builder setProjectBytes(com.google.protobuf.ByteString value) { public int getPageSize() { return pageSize_; } + /** * * *
    -     * Maximum number of topics to return.
    +     * Optional. Maximum number of topics to return.
          * 
    * - * int32 page_size = 2; + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @param value The pageSize to set. * @return This builder for chaining. @@ -748,38 +719,41 @@ public int getPageSize() { public Builder setPageSize(int value) { pageSize_ = value; + bitField0_ |= 0x00000002; onChanged(); return this; } + /** * * *
    -     * Maximum number of topics to return.
    +     * Optional. Maximum number of topics to return.
          * 
    * - * int32 page_size = 2; + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return This builder for chaining. */ public Builder clearPageSize() { - + bitField0_ = (bitField0_ & ~0x00000002); pageSize_ = 0; onChanged(); return this; } private java.lang.Object pageToken_ = ""; + /** * * *
    -     * The value returned by the last `ListTopicsResponse`; indicates that this is
    -     * a continuation of a prior `ListTopics` call, and that the system should
    -     * return the next page of data.
    +     * Optional. The value returned by the last `ListTopicsResponse`; indicates
    +     * that this is a continuation of a prior `ListTopics` call, and that the
    +     * system should return the next page of data.
          * 
    * - * string page_token = 3; + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; * * @return The pageToken. */ @@ -794,16 +768,17 @@ public java.lang.String getPageToken() { return (java.lang.String) ref; } } + /** * * *
    -     * The value returned by the last `ListTopicsResponse`; indicates that this is
    -     * a continuation of a prior `ListTopics` call, and that the system should
    -     * return the next page of data.
    +     * Optional. The value returned by the last `ListTopicsResponse`; indicates
    +     * that this is a continuation of a prior `ListTopics` call, and that the
    +     * system should return the next page of data.
          * 
    * - * string page_token = 3; + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; * * @return The bytes for pageToken. */ @@ -818,16 +793,17 @@ public com.google.protobuf.ByteString getPageTokenBytes() { return (com.google.protobuf.ByteString) ref; } } + /** * * *
    -     * The value returned by the last `ListTopicsResponse`; indicates that this is
    -     * a continuation of a prior `ListTopics` call, and that the system should
    -     * return the next page of data.
    +     * Optional. The value returned by the last `ListTopicsResponse`; indicates
    +     * that this is a continuation of a prior `ListTopics` call, and that the
    +     * system should return the next page of data.
          * 
    * - * string page_token = 3; + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; * * @param value The pageToken to set. * @return This builder for chaining. @@ -836,40 +812,42 @@ public Builder setPageToken(java.lang.String value) { if (value == null) { throw new NullPointerException(); } - pageToken_ = value; + bitField0_ |= 0x00000004; onChanged(); return this; } + /** * * *
    -     * The value returned by the last `ListTopicsResponse`; indicates that this is
    -     * a continuation of a prior `ListTopics` call, and that the system should
    -     * return the next page of data.
    +     * Optional. The value returned by the last `ListTopicsResponse`; indicates
    +     * that this is a continuation of a prior `ListTopics` call, and that the
    +     * system should return the next page of data.
          * 
    * - * string page_token = 3; + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; * * @return This builder for chaining. */ public Builder clearPageToken() { - pageToken_ = getDefaultInstance().getPageToken(); + bitField0_ = (bitField0_ & ~0x00000004); onChanged(); return this; } + /** * * *
    -     * The value returned by the last `ListTopicsResponse`; indicates that this is
    -     * a continuation of a prior `ListTopics` call, and that the system should
    -     * return the next page of data.
    +     * Optional. The value returned by the last `ListTopicsResponse`; indicates
    +     * that this is a continuation of a prior `ListTopics` call, and that the
    +     * system should return the next page of data.
          * 
    * - * string page_token = 3; + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; * * @param value The bytes for pageToken to set. * @return This builder for chaining. @@ -879,23 +857,12 @@ public Builder setPageTokenBytes(com.google.protobuf.ByteString value) { throw new NullPointerException(); } checkByteStringIsUtf8(value); - pageToken_ = value; + bitField0_ |= 0x00000004; onChanged(); return this; } - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - // @@protoc_insertion_point(builder_scope:google.pubsub.v1.ListTopicsRequest) } @@ -917,7 +884,18 @@ public ListTopicsRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new ListTopicsRequest(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicsRequestOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicsRequestOrBuilder.java index 8f5219329..2b30c60b8 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicsRequestOrBuilder.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicsRequestOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; +@com.google.protobuf.Generated public interface ListTopicsRequestOrBuilder extends // @@protoc_insertion_point(interface_extends:google.pubsub.v1.ListTopicsRequest) @@ -38,6 +41,7 @@ public interface ListTopicsRequestOrBuilder * @return The project. */ java.lang.String getProject(); + /** * * @@ -58,10 +62,10 @@ public interface ListTopicsRequestOrBuilder * * *
    -   * Maximum number of topics to return.
    +   * Optional. Maximum number of topics to return.
        * 
    * - * int32 page_size = 2; + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The pageSize. */ @@ -71,26 +75,27 @@ public interface ListTopicsRequestOrBuilder * * *
    -   * The value returned by the last `ListTopicsResponse`; indicates that this is
    -   * a continuation of a prior `ListTopics` call, and that the system should
    -   * return the next page of data.
    +   * Optional. The value returned by the last `ListTopicsResponse`; indicates
    +   * that this is a continuation of a prior `ListTopics` call, and that the
    +   * system should return the next page of data.
        * 
    * - * string page_token = 3; + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; * * @return The pageToken. */ java.lang.String getPageToken(); + /** * * *
    -   * The value returned by the last `ListTopicsResponse`; indicates that this is
    -   * a continuation of a prior `ListTopics` call, and that the system should
    -   * return the next page of data.
    +   * Optional. The value returned by the last `ListTopicsResponse`; indicates
    +   * that this is a continuation of a prior `ListTopics` call, and that the
    +   * system should return the next page of data.
        * 
    * - * string page_token = 3; + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; * * @return The bytes for pageToken. */ diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicsResponse.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicsResponse.java index 6e42dbb0e..832ad62ae 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicsResponse.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicsResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; @@ -27,13 +29,25 @@ * * Protobuf type {@code google.pubsub.v1.ListTopicsResponse} */ -public final class ListTopicsResponse extends com.google.protobuf.GeneratedMessageV3 +@com.google.protobuf.Generated +public final class ListTopicsResponse extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:google.pubsub.v1.ListTopicsResponse) ListTopicsResponseOrBuilder { private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "ListTopicsResponse"); + } + // Use ListTopicsResponse.newBuilder() to construct. - private ListTopicsResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + private ListTopicsResponse(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); } @@ -42,82 +56,13 @@ private ListTopicsResponse() { nextPageToken_ = ""; } - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new ListTopicsResponse(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - private ListTopicsResponse( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - if (!((mutable_bitField0_ & 0x00000001) != 0)) { - topics_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000001; - } - topics_.add( - input.readMessage(com.google.pubsub.v1.Topic.parser(), extensionRegistry)); - break; - } - case 18: - { - java.lang.String s = input.readStringRequireUtf8(); - - nextPageToken_ = s; - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000001) != 0)) { - topics_ = java.util.Collections.unmodifiableList(topics_); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_ListTopicsResponse_descriptor; } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_ListTopicsResponse_fieldAccessorTable @@ -127,67 +72,79 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } public static final int TOPICS_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") private java.util.List topics_; + /** * * *
    -   * The resulting topics.
    +   * Optional. The resulting topics.
        * 
    * - * repeated .google.pubsub.v1.Topic topics = 1; + * repeated .google.pubsub.v1.Topic topics = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ @java.lang.Override public java.util.List getTopicsList() { return topics_; } + /** * * *
    -   * The resulting topics.
    +   * Optional. The resulting topics.
        * 
    * - * repeated .google.pubsub.v1.Topic topics = 1; + * repeated .google.pubsub.v1.Topic topics = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ @java.lang.Override public java.util.List getTopicsOrBuilderList() { return topics_; } + /** * * *
    -   * The resulting topics.
    +   * Optional. The resulting topics.
        * 
    * - * repeated .google.pubsub.v1.Topic topics = 1; + * repeated .google.pubsub.v1.Topic topics = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ @java.lang.Override public int getTopicsCount() { return topics_.size(); } + /** * * *
    -   * The resulting topics.
    +   * Optional. The resulting topics.
        * 
    * - * repeated .google.pubsub.v1.Topic topics = 1; + * repeated .google.pubsub.v1.Topic topics = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ @java.lang.Override public com.google.pubsub.v1.Topic getTopics(int index) { return topics_.get(index); } + /** * * *
    -   * The resulting topics.
    +   * Optional. The resulting topics.
        * 
    * - * repeated .google.pubsub.v1.Topic topics = 1; + * repeated .google.pubsub.v1.Topic topics = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ @java.lang.Override public com.google.pubsub.v1.TopicOrBuilder getTopicsOrBuilder(int index) { @@ -195,16 +152,19 @@ public com.google.pubsub.v1.TopicOrBuilder getTopicsOrBuilder(int index) { } public static final int NEXT_PAGE_TOKEN_FIELD_NUMBER = 2; - private volatile java.lang.Object nextPageToken_; + + @SuppressWarnings("serial") + private volatile java.lang.Object nextPageToken_ = ""; + /** * * *
    -   * If not empty, indicates that there may be more topics that match the
    -   * request; this value should be passed in a new `ListTopicsRequest`.
    +   * Optional. If not empty, indicates that there may be more topics that match
    +   * the request; this value should be passed in a new `ListTopicsRequest`.
        * 
    * - * string next_page_token = 2; + * string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The nextPageToken. */ @@ -220,15 +180,16 @@ public java.lang.String getNextPageToken() { return s; } } + /** * * *
    -   * If not empty, indicates that there may be more topics that match the
    -   * request; this value should be passed in a new `ListTopicsRequest`.
    +   * Optional. If not empty, indicates that there may be more topics that match
    +   * the request; this value should be passed in a new `ListTopicsRequest`.
        * 
    * - * string next_page_token = 2; + * string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The bytes for nextPageToken. */ @@ -262,10 +223,10 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io for (int i = 0; i < topics_.size(); i++) { output.writeMessage(1, topics_.get(i)); } - if (!getNextPageTokenBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 2, nextPageToken_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(nextPageToken_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, nextPageToken_); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -277,10 +238,10 @@ public int getSerializedSize() { for (int i = 0; i < topics_.size(); i++) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, topics_.get(i)); } - if (!getNextPageTokenBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, nextPageToken_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(nextPageToken_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, nextPageToken_); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -297,7 +258,7 @@ public boolean equals(final java.lang.Object obj) { if (!getTopicsList().equals(other.getTopicsList())) return false; if (!getNextPageToken().equals(other.getNextPageToken())) return false; - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -314,7 +275,7 @@ public int hashCode() { } hash = (37 * hash) + NEXT_PAGE_TOKEN_FIELD_NUMBER; hash = (53 * hash) + getNextPageToken().hashCode(); - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -356,38 +317,38 @@ public static com.google.pubsub.v1.ListTopicsResponse parseFrom( public static com.google.pubsub.v1.ListTopicsResponse parseFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.ListTopicsResponse parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.ListTopicsResponse parseDelimitedFrom( java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); } public static com.google.pubsub.v1.ListTopicsResponse parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.ListTopicsResponse parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.ListTopicsResponse parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } @@ -410,10 +371,11 @@ public Builder toBuilder() { } @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** * * @@ -423,7 +385,7 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build * * Protobuf type {@code google.pubsub.v1.ListTopicsResponse} */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements // @@protoc_insertion_point(builder_implements:google.pubsub.v1.ListTopicsResponse) com.google.pubsub.v1.ListTopicsResponseOrBuilder { @@ -433,7 +395,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_ListTopicsResponse_fieldAccessorTable @@ -443,32 +405,24 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } // Construct using com.google.pubsub.v1.ListTopicsResponse.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } + private Builder() {} - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { - getTopicsFieldBuilder(); - } } @java.lang.Override public Builder clear() { super.clear(); + bitField0_ = 0; if (topicsBuilder_ == null) { topics_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); } else { + topics_ = null; topicsBuilder_.clear(); } + bitField0_ = (bitField0_ & ~0x00000001); nextPageToken_ = ""; - return this; } @@ -496,7 +450,15 @@ public com.google.pubsub.v1.ListTopicsResponse build() { public com.google.pubsub.v1.ListTopicsResponse buildPartial() { com.google.pubsub.v1.ListTopicsResponse result = new com.google.pubsub.v1.ListTopicsResponse(this); - int from_bitField0_ = bitField0_; + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields(com.google.pubsub.v1.ListTopicsResponse result) { if (topicsBuilder_ == null) { if (((bitField0_ & 0x00000001) != 0)) { topics_ = java.util.Collections.unmodifiableList(topics_); @@ -506,42 +468,13 @@ public com.google.pubsub.v1.ListTopicsResponse buildPartial() { } else { result.topics_ = topicsBuilder_.build(); } - result.nextPageToken_ = nextPageToken_; - onBuilt(); - return result; - } - - @java.lang.Override - public Builder clone() { - return super.clone(); } - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); + private void buildPartial0(com.google.pubsub.v1.ListTopicsResponse result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000002) != 0)) { + result.nextPageToken_ = nextPageToken_; + } } @java.lang.Override @@ -575,8 +508,8 @@ public Builder mergeFrom(com.google.pubsub.v1.ListTopicsResponse other) { topics_ = other.topics_; bitField0_ = (bitField0_ & ~0x00000001); topicsBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders - ? getTopicsFieldBuilder() + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders + ? internalGetTopicsFieldBuilder() : null; } else { topicsBuilder_.addAllMessages(other.topics_); @@ -585,9 +518,10 @@ public Builder mergeFrom(com.google.pubsub.v1.ListTopicsResponse other) { } if (!other.getNextPageToken().isEmpty()) { nextPageToken_ = other.nextPageToken_; + bitField0_ |= 0x00000002; onChanged(); } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -602,17 +536,49 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.pubsub.v1.ListTopicsResponse parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.pubsub.v1.Topic m = + input.readMessage(com.google.pubsub.v1.Topic.parser(), extensionRegistry); + if (topicsBuilder_ == null) { + ensureTopicsIsMutable(); + topics_.add(m); + } else { + topicsBuilder_.addMessage(m); + } + break; + } // case 10 + case 18: + { + nextPageToken_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.google.pubsub.v1.ListTopicsResponse) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } @@ -627,7 +593,7 @@ private void ensureTopicsIsMutable() { } } - private com.google.protobuf.RepeatedFieldBuilderV3< + private com.google.protobuf.RepeatedFieldBuilder< com.google.pubsub.v1.Topic, com.google.pubsub.v1.Topic.Builder, com.google.pubsub.v1.TopicOrBuilder> @@ -637,10 +603,11 @@ private void ensureTopicsIsMutable() { * * *
    -     * The resulting topics.
    +     * Optional. The resulting topics.
          * 
    * - * repeated .google.pubsub.v1.Topic topics = 1; + * repeated .google.pubsub.v1.Topic topics = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public java.util.List getTopicsList() { if (topicsBuilder_ == null) { @@ -649,14 +616,16 @@ public java.util.List getTopicsList() { return topicsBuilder_.getMessageList(); } } + /** * * *
    -     * The resulting topics.
    +     * Optional. The resulting topics.
          * 
    * - * repeated .google.pubsub.v1.Topic topics = 1; + * repeated .google.pubsub.v1.Topic topics = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public int getTopicsCount() { if (topicsBuilder_ == null) { @@ -665,14 +634,16 @@ public int getTopicsCount() { return topicsBuilder_.getCount(); } } + /** * * *
    -     * The resulting topics.
    +     * Optional. The resulting topics.
          * 
    * - * repeated .google.pubsub.v1.Topic topics = 1; + * repeated .google.pubsub.v1.Topic topics = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public com.google.pubsub.v1.Topic getTopics(int index) { if (topicsBuilder_ == null) { @@ -681,14 +652,16 @@ public com.google.pubsub.v1.Topic getTopics(int index) { return topicsBuilder_.getMessage(index); } } + /** * * *
    -     * The resulting topics.
    +     * Optional. The resulting topics.
          * 
    * - * repeated .google.pubsub.v1.Topic topics = 1; + * repeated .google.pubsub.v1.Topic topics = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public Builder setTopics(int index, com.google.pubsub.v1.Topic value) { if (topicsBuilder_ == null) { @@ -703,14 +676,16 @@ public Builder setTopics(int index, com.google.pubsub.v1.Topic value) { } return this; } + /** * * *
    -     * The resulting topics.
    +     * Optional. The resulting topics.
          * 
    * - * repeated .google.pubsub.v1.Topic topics = 1; + * repeated .google.pubsub.v1.Topic topics = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public Builder setTopics(int index, com.google.pubsub.v1.Topic.Builder builderForValue) { if (topicsBuilder_ == null) { @@ -722,14 +697,16 @@ public Builder setTopics(int index, com.google.pubsub.v1.Topic.Builder builderFo } return this; } + /** * * *
    -     * The resulting topics.
    +     * Optional. The resulting topics.
          * 
    * - * repeated .google.pubsub.v1.Topic topics = 1; + * repeated .google.pubsub.v1.Topic topics = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public Builder addTopics(com.google.pubsub.v1.Topic value) { if (topicsBuilder_ == null) { @@ -744,14 +721,16 @@ public Builder addTopics(com.google.pubsub.v1.Topic value) { } return this; } + /** * * *
    -     * The resulting topics.
    +     * Optional. The resulting topics.
          * 
    * - * repeated .google.pubsub.v1.Topic topics = 1; + * repeated .google.pubsub.v1.Topic topics = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public Builder addTopics(int index, com.google.pubsub.v1.Topic value) { if (topicsBuilder_ == null) { @@ -766,14 +745,16 @@ public Builder addTopics(int index, com.google.pubsub.v1.Topic value) { } return this; } + /** * * *
    -     * The resulting topics.
    +     * Optional. The resulting topics.
          * 
    * - * repeated .google.pubsub.v1.Topic topics = 1; + * repeated .google.pubsub.v1.Topic topics = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public Builder addTopics(com.google.pubsub.v1.Topic.Builder builderForValue) { if (topicsBuilder_ == null) { @@ -785,14 +766,16 @@ public Builder addTopics(com.google.pubsub.v1.Topic.Builder builderForValue) { } return this; } + /** * * *
    -     * The resulting topics.
    +     * Optional. The resulting topics.
          * 
    * - * repeated .google.pubsub.v1.Topic topics = 1; + * repeated .google.pubsub.v1.Topic topics = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public Builder addTopics(int index, com.google.pubsub.v1.Topic.Builder builderForValue) { if (topicsBuilder_ == null) { @@ -804,14 +787,16 @@ public Builder addTopics(int index, com.google.pubsub.v1.Topic.Builder builderFo } return this; } + /** * * *
    -     * The resulting topics.
    +     * Optional. The resulting topics.
          * 
    * - * repeated .google.pubsub.v1.Topic topics = 1; + * repeated .google.pubsub.v1.Topic topics = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public Builder addAllTopics(java.lang.Iterable values) { if (topicsBuilder_ == null) { @@ -823,14 +808,16 @@ public Builder addAllTopics(java.lang.Iterable - * The resulting topics. + * Optional. The resulting topics. *
    * - * repeated .google.pubsub.v1.Topic topics = 1; + * repeated .google.pubsub.v1.Topic topics = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public Builder clearTopics() { if (topicsBuilder_ == null) { @@ -842,14 +829,16 @@ public Builder clearTopics() { } return this; } + /** * * *
    -     * The resulting topics.
    +     * Optional. The resulting topics.
          * 
    * - * repeated .google.pubsub.v1.Topic topics = 1; + * repeated .google.pubsub.v1.Topic topics = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public Builder removeTopics(int index) { if (topicsBuilder_ == null) { @@ -861,26 +850,30 @@ public Builder removeTopics(int index) { } return this; } + /** * * *
    -     * The resulting topics.
    +     * Optional. The resulting topics.
          * 
    * - * repeated .google.pubsub.v1.Topic topics = 1; + * repeated .google.pubsub.v1.Topic topics = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public com.google.pubsub.v1.Topic.Builder getTopicsBuilder(int index) { - return getTopicsFieldBuilder().getBuilder(index); + return internalGetTopicsFieldBuilder().getBuilder(index); } + /** * * *
    -     * The resulting topics.
    +     * Optional. The resulting topics.
          * 
    * - * repeated .google.pubsub.v1.Topic topics = 1; + * repeated .google.pubsub.v1.Topic topics = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public com.google.pubsub.v1.TopicOrBuilder getTopicsOrBuilder(int index) { if (topicsBuilder_ == null) { @@ -889,14 +882,16 @@ public com.google.pubsub.v1.TopicOrBuilder getTopicsOrBuilder(int index) { return topicsBuilder_.getMessageOrBuilder(index); } } + /** * * *
    -     * The resulting topics.
    +     * Optional. The resulting topics.
          * 
    * - * repeated .google.pubsub.v1.Topic topics = 1; + * repeated .google.pubsub.v1.Topic topics = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public java.util.List getTopicsOrBuilderList() { if (topicsBuilder_ != null) { @@ -905,52 +900,59 @@ public java.util.List getTopicsOr return java.util.Collections.unmodifiableList(topics_); } } + /** * * *
    -     * The resulting topics.
    +     * Optional. The resulting topics.
          * 
    * - * repeated .google.pubsub.v1.Topic topics = 1; + * repeated .google.pubsub.v1.Topic topics = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public com.google.pubsub.v1.Topic.Builder addTopicsBuilder() { - return getTopicsFieldBuilder().addBuilder(com.google.pubsub.v1.Topic.getDefaultInstance()); + return internalGetTopicsFieldBuilder() + .addBuilder(com.google.pubsub.v1.Topic.getDefaultInstance()); } + /** * * *
    -     * The resulting topics.
    +     * Optional. The resulting topics.
          * 
    * - * repeated .google.pubsub.v1.Topic topics = 1; + * repeated .google.pubsub.v1.Topic topics = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public com.google.pubsub.v1.Topic.Builder addTopicsBuilder(int index) { - return getTopicsFieldBuilder() + return internalGetTopicsFieldBuilder() .addBuilder(index, com.google.pubsub.v1.Topic.getDefaultInstance()); } + /** * * *
    -     * The resulting topics.
    +     * Optional. The resulting topics.
          * 
    * - * repeated .google.pubsub.v1.Topic topics = 1; + * repeated .google.pubsub.v1.Topic topics = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public java.util.List getTopicsBuilderList() { - return getTopicsFieldBuilder().getBuilderList(); + return internalGetTopicsFieldBuilder().getBuilderList(); } - private com.google.protobuf.RepeatedFieldBuilderV3< + private com.google.protobuf.RepeatedFieldBuilder< com.google.pubsub.v1.Topic, com.google.pubsub.v1.Topic.Builder, com.google.pubsub.v1.TopicOrBuilder> - getTopicsFieldBuilder() { + internalGetTopicsFieldBuilder() { if (topicsBuilder_ == null) { topicsBuilder_ = - new com.google.protobuf.RepeatedFieldBuilderV3< + new com.google.protobuf.RepeatedFieldBuilder< com.google.pubsub.v1.Topic, com.google.pubsub.v1.Topic.Builder, com.google.pubsub.v1.TopicOrBuilder>( @@ -961,15 +963,16 @@ public java.util.List getTopicsBuilderList() } private java.lang.Object nextPageToken_ = ""; + /** * * *
    -     * If not empty, indicates that there may be more topics that match the
    -     * request; this value should be passed in a new `ListTopicsRequest`.
    +     * Optional. If not empty, indicates that there may be more topics that match
    +     * the request; this value should be passed in a new `ListTopicsRequest`.
          * 
    * - * string next_page_token = 2; + * string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The nextPageToken. */ @@ -984,15 +987,16 @@ public java.lang.String getNextPageToken() { return (java.lang.String) ref; } } + /** * * *
    -     * If not empty, indicates that there may be more topics that match the
    -     * request; this value should be passed in a new `ListTopicsRequest`.
    +     * Optional. If not empty, indicates that there may be more topics that match
    +     * the request; this value should be passed in a new `ListTopicsRequest`.
          * 
    * - * string next_page_token = 2; + * string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The bytes for nextPageToken. */ @@ -1007,15 +1011,16 @@ public com.google.protobuf.ByteString getNextPageTokenBytes() { return (com.google.protobuf.ByteString) ref; } } + /** * * *
    -     * If not empty, indicates that there may be more topics that match the
    -     * request; this value should be passed in a new `ListTopicsRequest`.
    +     * Optional. If not empty, indicates that there may be more topics that match
    +     * the request; this value should be passed in a new `ListTopicsRequest`.
          * 
    * - * string next_page_token = 2; + * string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @param value The nextPageToken to set. * @return This builder for chaining. @@ -1024,38 +1029,40 @@ public Builder setNextPageToken(java.lang.String value) { if (value == null) { throw new NullPointerException(); } - nextPageToken_ = value; + bitField0_ |= 0x00000002; onChanged(); return this; } + /** * * *
    -     * If not empty, indicates that there may be more topics that match the
    -     * request; this value should be passed in a new `ListTopicsRequest`.
    +     * Optional. If not empty, indicates that there may be more topics that match
    +     * the request; this value should be passed in a new `ListTopicsRequest`.
          * 
    * - * string next_page_token = 2; + * string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return This builder for chaining. */ public Builder clearNextPageToken() { - nextPageToken_ = getDefaultInstance().getNextPageToken(); + bitField0_ = (bitField0_ & ~0x00000002); onChanged(); return this; } + /** * * *
    -     * If not empty, indicates that there may be more topics that match the
    -     * request; this value should be passed in a new `ListTopicsRequest`.
    +     * Optional. If not empty, indicates that there may be more topics that match
    +     * the request; this value should be passed in a new `ListTopicsRequest`.
          * 
    * - * string next_page_token = 2; + * string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @param value The bytes for nextPageToken to set. * @return This builder for chaining. @@ -1065,23 +1072,12 @@ public Builder setNextPageTokenBytes(com.google.protobuf.ByteString value) { throw new NullPointerException(); } checkByteStringIsUtf8(value); - nextPageToken_ = value; + bitField0_ |= 0x00000002; onChanged(); return this; } - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - // @@protoc_insertion_point(builder_scope:google.pubsub.v1.ListTopicsResponse) } @@ -1103,7 +1099,18 @@ public ListTopicsResponse parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new ListTopicsResponse(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicsResponseOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicsResponseOrBuilder.java index c29de3514..ff3026965 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicsResponseOrBuilder.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicsResponseOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; +@com.google.protobuf.Generated public interface ListTopicsResponseOrBuilder extends // @@protoc_insertion_point(interface_extends:google.pubsub.v1.ListTopicsResponse) @@ -27,50 +30,59 @@ public interface ListTopicsResponseOrBuilder * * *
    -   * The resulting topics.
    +   * Optional. The resulting topics.
        * 
    * - * repeated .google.pubsub.v1.Topic topics = 1; + * repeated .google.pubsub.v1.Topic topics = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ java.util.List getTopicsList(); + /** * * *
    -   * The resulting topics.
    +   * Optional. The resulting topics.
        * 
    * - * repeated .google.pubsub.v1.Topic topics = 1; + * repeated .google.pubsub.v1.Topic topics = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ com.google.pubsub.v1.Topic getTopics(int index); + /** * * *
    -   * The resulting topics.
    +   * Optional. The resulting topics.
        * 
    * - * repeated .google.pubsub.v1.Topic topics = 1; + * repeated .google.pubsub.v1.Topic topics = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ int getTopicsCount(); + /** * * *
    -   * The resulting topics.
    +   * Optional. The resulting topics.
        * 
    * - * repeated .google.pubsub.v1.Topic topics = 1; + * repeated .google.pubsub.v1.Topic topics = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ java.util.List getTopicsOrBuilderList(); + /** * * *
    -   * The resulting topics.
    +   * Optional. The resulting topics.
        * 
    * - * repeated .google.pubsub.v1.Topic topics = 1; + * repeated .google.pubsub.v1.Topic topics = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ com.google.pubsub.v1.TopicOrBuilder getTopicsOrBuilder(int index); @@ -78,24 +90,25 @@ public interface ListTopicsResponseOrBuilder * * *
    -   * If not empty, indicates that there may be more topics that match the
    -   * request; this value should be passed in a new `ListTopicsRequest`.
    +   * Optional. If not empty, indicates that there may be more topics that match
    +   * the request; this value should be passed in a new `ListTopicsRequest`.
        * 
    * - * string next_page_token = 2; + * string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The nextPageToken. */ java.lang.String getNextPageToken(); + /** * * *
    -   * If not empty, indicates that there may be more topics that match the
    -   * request; this value should be passed in a new `ListTopicsRequest`.
    +   * Optional. If not empty, indicates that there may be more topics that match
    +   * the request; this value should be passed in a new `ListTopicsRequest`.
        * 
    * - * string next_page_token = 2; + * string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The bytes for nextPageToken. */ diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/MessageStoragePolicy.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/MessageStoragePolicy.java index b03bda501..c19f2e154 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/MessageStoragePolicy.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/MessageStoragePolicy.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; @@ -27,80 +29,30 @@ * * Protobuf type {@code google.pubsub.v1.MessageStoragePolicy} */ -public final class MessageStoragePolicy extends com.google.protobuf.GeneratedMessageV3 +@com.google.protobuf.Generated +public final class MessageStoragePolicy extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:google.pubsub.v1.MessageStoragePolicy) MessageStoragePolicyOrBuilder { private static final long serialVersionUID = 0L; - // Use MessageStoragePolicy.newBuilder() to construct. - private MessageStoragePolicy(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private MessageStoragePolicy() { - allowedPersistenceRegions_ = com.google.protobuf.LazyStringArrayList.EMPTY; - } - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new MessageStoragePolicy(); + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "MessageStoragePolicy"); } - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; + // Use MessageStoragePolicy.newBuilder() to construct. + private MessageStoragePolicy(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); } - private MessageStoragePolicy( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - java.lang.String s = input.readStringRequireUtf8(); - if (!((mutable_bitField0_ & 0x00000001) != 0)) { - allowedPersistenceRegions_ = new com.google.protobuf.LazyStringArrayList(); - mutable_bitField0_ |= 0x00000001; - } - allowedPersistenceRegions_.add(s); - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000001) != 0)) { - allowedPersistenceRegions_ = allowedPersistenceRegions_.getUnmodifiableView(); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } + private MessageStoragePolicy() { + allowedPersistenceRegions_ = com.google.protobuf.LazyStringArrayList.emptyList(); } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { @@ -109,7 +61,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_MessageStoragePolicy_fieldAccessorTable @@ -119,55 +71,70 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } public static final int ALLOWED_PERSISTENCE_REGIONS_FIELD_NUMBER = 1; - private com.google.protobuf.LazyStringList allowedPersistenceRegions_; + + @SuppressWarnings("serial") + private com.google.protobuf.LazyStringArrayList allowedPersistenceRegions_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + /** * * *
    -   * A list of IDs of GCP regions where messages that are published to the topic
    -   * may be persisted in storage. Messages published by publishers running in
    -   * non-allowed GCP regions (or running outside of GCP altogether) will be
    -   * routed for storage in one of the allowed regions. An empty list means that
    -   * no regions are allowed, and is not a valid configuration.
    +   * Optional. A list of IDs of Google Cloud regions where messages that are
    +   * published to the topic may be persisted in storage. Messages published by
    +   * publishers running in non-allowed Google Cloud regions (or running outside
    +   * of Google Cloud altogether) are routed for storage in one of the allowed
    +   * regions. An empty list means that no regions are allowed, and is not a
    +   * valid configuration.
        * 
    * - * repeated string allowed_persistence_regions = 1; + * + * repeated string allowed_persistence_regions = 1 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return A list containing the allowedPersistenceRegions. */ public com.google.protobuf.ProtocolStringList getAllowedPersistenceRegionsList() { return allowedPersistenceRegions_; } + /** * * *
    -   * A list of IDs of GCP regions where messages that are published to the topic
    -   * may be persisted in storage. Messages published by publishers running in
    -   * non-allowed GCP regions (or running outside of GCP altogether) will be
    -   * routed for storage in one of the allowed regions. An empty list means that
    -   * no regions are allowed, and is not a valid configuration.
    +   * Optional. A list of IDs of Google Cloud regions where messages that are
    +   * published to the topic may be persisted in storage. Messages published by
    +   * publishers running in non-allowed Google Cloud regions (or running outside
    +   * of Google Cloud altogether) are routed for storage in one of the allowed
    +   * regions. An empty list means that no regions are allowed, and is not a
    +   * valid configuration.
        * 
    * - * repeated string allowed_persistence_regions = 1; + * + * repeated string allowed_persistence_regions = 1 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return The count of allowedPersistenceRegions. */ public int getAllowedPersistenceRegionsCount() { return allowedPersistenceRegions_.size(); } + /** * * *
    -   * A list of IDs of GCP regions where messages that are published to the topic
    -   * may be persisted in storage. Messages published by publishers running in
    -   * non-allowed GCP regions (or running outside of GCP altogether) will be
    -   * routed for storage in one of the allowed regions. An empty list means that
    -   * no regions are allowed, and is not a valid configuration.
    +   * Optional. A list of IDs of Google Cloud regions where messages that are
    +   * published to the topic may be persisted in storage. Messages published by
    +   * publishers running in non-allowed Google Cloud regions (or running outside
    +   * of Google Cloud altogether) are routed for storage in one of the allowed
    +   * regions. An empty list means that no regions are allowed, and is not a
    +   * valid configuration.
        * 
    * - * repeated string allowed_persistence_regions = 1; + * + * repeated string allowed_persistence_regions = 1 [(.google.api.field_behavior) = OPTIONAL]; + * * * @param index The index of the element to return. * @return The allowedPersistenceRegions at the given index. @@ -175,18 +142,22 @@ public int getAllowedPersistenceRegionsCount() { public java.lang.String getAllowedPersistenceRegions(int index) { return allowedPersistenceRegions_.get(index); } + /** * * *
    -   * A list of IDs of GCP regions where messages that are published to the topic
    -   * may be persisted in storage. Messages published by publishers running in
    -   * non-allowed GCP regions (or running outside of GCP altogether) will be
    -   * routed for storage in one of the allowed regions. An empty list means that
    -   * no regions are allowed, and is not a valid configuration.
    +   * Optional. A list of IDs of Google Cloud regions where messages that are
    +   * published to the topic may be persisted in storage. Messages published by
    +   * publishers running in non-allowed Google Cloud regions (or running outside
    +   * of Google Cloud altogether) are routed for storage in one of the allowed
    +   * regions. An empty list means that no regions are allowed, and is not a
    +   * valid configuration.
        * 
    * - * repeated string allowed_persistence_regions = 1; + * + * repeated string allowed_persistence_regions = 1 [(.google.api.field_behavior) = OPTIONAL]; + * * * @param index The index of the value to return. * @return The bytes of the allowedPersistenceRegions at the given index. @@ -195,6 +166,29 @@ public com.google.protobuf.ByteString getAllowedPersistenceRegionsBytes(int inde return allowedPersistenceRegions_.getByteString(index); } + public static final int ENFORCE_IN_TRANSIT_FIELD_NUMBER = 2; + private boolean enforceInTransit_ = false; + + /** + * + * + *
    +   * Optional. If true, `allowed_persistence_regions` is also used to enforce
    +   * in-transit guarantees for messages. That is, Pub/Sub will fail
    +   * Publish operations on this topic and subscribe operations
    +   * on any subscription attached to this topic in any region that is
    +   * not in `allowed_persistence_regions`.
    +   * 
    + * + * bool enforce_in_transit = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The enforceInTransit. + */ + @java.lang.Override + public boolean getEnforceInTransit() { + return enforceInTransit_; + } + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -210,10 +204,13 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { for (int i = 0; i < allowedPersistenceRegions_.size(); i++) { - com.google.protobuf.GeneratedMessageV3.writeString( + com.google.protobuf.GeneratedMessage.writeString( output, 1, allowedPersistenceRegions_.getRaw(i)); } - unknownFields.writeTo(output); + if (enforceInTransit_ != false) { + output.writeBool(2, enforceInTransit_); + } + getUnknownFields().writeTo(output); } @java.lang.Override @@ -230,7 +227,10 @@ public int getSerializedSize() { size += dataSize; size += 1 * getAllowedPersistenceRegionsList().size(); } - size += unknownFields.getSerializedSize(); + if (enforceInTransit_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(2, enforceInTransit_); + } + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -248,7 +248,8 @@ public boolean equals(final java.lang.Object obj) { if (!getAllowedPersistenceRegionsList().equals(other.getAllowedPersistenceRegionsList())) return false; - if (!unknownFields.equals(other.unknownFields)) return false; + if (getEnforceInTransit() != other.getEnforceInTransit()) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -263,7 +264,9 @@ public int hashCode() { hash = (37 * hash) + ALLOWED_PERSISTENCE_REGIONS_FIELD_NUMBER; hash = (53 * hash) + getAllowedPersistenceRegionsList().hashCode(); } - hash = (29 * hash) + unknownFields.hashCode(); + hash = (37 * hash) + ENFORCE_IN_TRANSIT_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getEnforceInTransit()); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -305,38 +308,38 @@ public static com.google.pubsub.v1.MessageStoragePolicy parseFrom( public static com.google.pubsub.v1.MessageStoragePolicy parseFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.MessageStoragePolicy parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.MessageStoragePolicy parseDelimitedFrom( java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); } public static com.google.pubsub.v1.MessageStoragePolicy parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.MessageStoragePolicy parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.MessageStoragePolicy parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } @@ -359,10 +362,11 @@ public Builder toBuilder() { } @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** * * @@ -372,7 +376,7 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build * * Protobuf type {@code google.pubsub.v1.MessageStoragePolicy} */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements // @@protoc_insertion_point(builder_implements:google.pubsub.v1.MessageStoragePolicy) com.google.pubsub.v1.MessageStoragePolicyOrBuilder { @@ -382,7 +386,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_MessageStoragePolicy_fieldAccessorTable @@ -392,24 +396,18 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } // Construct using com.google.pubsub.v1.MessageStoragePolicy.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } + private Builder() {} - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} } @java.lang.Override public Builder clear() { super.clear(); - allowedPersistenceRegions_ = com.google.protobuf.LazyStringArrayList.EMPTY; - bitField0_ = (bitField0_ & ~0x00000001); + bitField0_ = 0; + allowedPersistenceRegions_ = com.google.protobuf.LazyStringArrayList.emptyList(); + enforceInTransit_ = false; return this; } @@ -437,47 +435,22 @@ public com.google.pubsub.v1.MessageStoragePolicy build() { public com.google.pubsub.v1.MessageStoragePolicy buildPartial() { com.google.pubsub.v1.MessageStoragePolicy result = new com.google.pubsub.v1.MessageStoragePolicy(this); - int from_bitField0_ = bitField0_; - if (((bitField0_ & 0x00000001) != 0)) { - allowedPersistenceRegions_ = allowedPersistenceRegions_.getUnmodifiableView(); - bitField0_ = (bitField0_ & ~0x00000001); + if (bitField0_ != 0) { + buildPartial0(result); } - result.allowedPersistenceRegions_ = allowedPersistenceRegions_; onBuilt(); return result; } - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); + private void buildPartial0(com.google.pubsub.v1.MessageStoragePolicy result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + allowedPersistenceRegions_.makeImmutable(); + result.allowedPersistenceRegions_ = allowedPersistenceRegions_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.enforceInTransit_ = enforceInTransit_; + } } @java.lang.Override @@ -495,14 +468,17 @@ public Builder mergeFrom(com.google.pubsub.v1.MessageStoragePolicy other) { if (!other.allowedPersistenceRegions_.isEmpty()) { if (allowedPersistenceRegions_.isEmpty()) { allowedPersistenceRegions_ = other.allowedPersistenceRegions_; - bitField0_ = (bitField0_ & ~0x00000001); + bitField0_ |= 0x00000001; } else { ensureAllowedPersistenceRegionsIsMutable(); allowedPersistenceRegions_.addAll(other.allowedPersistenceRegions_); } onChanged(); } - this.mergeUnknownFields(other.unknownFields); + if (other.getEnforceInTransit() != false) { + setEnforceInTransit(other.getEnforceInTransit()); + } + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -517,80 +493,120 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.pubsub.v1.MessageStoragePolicy parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + ensureAllowedPersistenceRegionsIsMutable(); + allowedPersistenceRegions_.add(s); + break; + } // case 10 + case 16: + { + enforceInTransit_ = input.readBool(); + bitField0_ |= 0x00000002; + break; + } // case 16 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.google.pubsub.v1.MessageStoragePolicy) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } private int bitField0_; - private com.google.protobuf.LazyStringList allowedPersistenceRegions_ = - com.google.protobuf.LazyStringArrayList.EMPTY; + private com.google.protobuf.LazyStringArrayList allowedPersistenceRegions_ = + com.google.protobuf.LazyStringArrayList.emptyList(); private void ensureAllowedPersistenceRegionsIsMutable() { - if (!((bitField0_ & 0x00000001) != 0)) { + if (!allowedPersistenceRegions_.isModifiable()) { allowedPersistenceRegions_ = new com.google.protobuf.LazyStringArrayList(allowedPersistenceRegions_); - bitField0_ |= 0x00000001; } + bitField0_ |= 0x00000001; } + /** * * *
    -     * A list of IDs of GCP regions where messages that are published to the topic
    -     * may be persisted in storage. Messages published by publishers running in
    -     * non-allowed GCP regions (or running outside of GCP altogether) will be
    -     * routed for storage in one of the allowed regions. An empty list means that
    -     * no regions are allowed, and is not a valid configuration.
    +     * Optional. A list of IDs of Google Cloud regions where messages that are
    +     * published to the topic may be persisted in storage. Messages published by
    +     * publishers running in non-allowed Google Cloud regions (or running outside
    +     * of Google Cloud altogether) are routed for storage in one of the allowed
    +     * regions. An empty list means that no regions are allowed, and is not a
    +     * valid configuration.
          * 
    * - * repeated string allowed_persistence_regions = 1; + * + * repeated string allowed_persistence_regions = 1 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return A list containing the allowedPersistenceRegions. */ public com.google.protobuf.ProtocolStringList getAllowedPersistenceRegionsList() { - return allowedPersistenceRegions_.getUnmodifiableView(); + allowedPersistenceRegions_.makeImmutable(); + return allowedPersistenceRegions_; } + /** * * *
    -     * A list of IDs of GCP regions where messages that are published to the topic
    -     * may be persisted in storage. Messages published by publishers running in
    -     * non-allowed GCP regions (or running outside of GCP altogether) will be
    -     * routed for storage in one of the allowed regions. An empty list means that
    -     * no regions are allowed, and is not a valid configuration.
    +     * Optional. A list of IDs of Google Cloud regions where messages that are
    +     * published to the topic may be persisted in storage. Messages published by
    +     * publishers running in non-allowed Google Cloud regions (or running outside
    +     * of Google Cloud altogether) are routed for storage in one of the allowed
    +     * regions. An empty list means that no regions are allowed, and is not a
    +     * valid configuration.
          * 
    * - * repeated string allowed_persistence_regions = 1; + * + * repeated string allowed_persistence_regions = 1 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return The count of allowedPersistenceRegions. */ public int getAllowedPersistenceRegionsCount() { return allowedPersistenceRegions_.size(); } + /** * * *
    -     * A list of IDs of GCP regions where messages that are published to the topic
    -     * may be persisted in storage. Messages published by publishers running in
    -     * non-allowed GCP regions (or running outside of GCP altogether) will be
    -     * routed for storage in one of the allowed regions. An empty list means that
    -     * no regions are allowed, and is not a valid configuration.
    +     * Optional. A list of IDs of Google Cloud regions where messages that are
    +     * published to the topic may be persisted in storage. Messages published by
    +     * publishers running in non-allowed Google Cloud regions (or running outside
    +     * of Google Cloud altogether) are routed for storage in one of the allowed
    +     * regions. An empty list means that no regions are allowed, and is not a
    +     * valid configuration.
          * 
    * - * repeated string allowed_persistence_regions = 1; + * + * repeated string allowed_persistence_regions = 1 [(.google.api.field_behavior) = OPTIONAL]; + * * * @param index The index of the element to return. * @return The allowedPersistenceRegions at the given index. @@ -598,18 +614,22 @@ public int getAllowedPersistenceRegionsCount() { public java.lang.String getAllowedPersistenceRegions(int index) { return allowedPersistenceRegions_.get(index); } + /** * * *
    -     * A list of IDs of GCP regions where messages that are published to the topic
    -     * may be persisted in storage. Messages published by publishers running in
    -     * non-allowed GCP regions (or running outside of GCP altogether) will be
    -     * routed for storage in one of the allowed regions. An empty list means that
    -     * no regions are allowed, and is not a valid configuration.
    +     * Optional. A list of IDs of Google Cloud regions where messages that are
    +     * published to the topic may be persisted in storage. Messages published by
    +     * publishers running in non-allowed Google Cloud regions (or running outside
    +     * of Google Cloud altogether) are routed for storage in one of the allowed
    +     * regions. An empty list means that no regions are allowed, and is not a
    +     * valid configuration.
          * 
    * - * repeated string allowed_persistence_regions = 1; + * + * repeated string allowed_persistence_regions = 1 [(.google.api.field_behavior) = OPTIONAL]; + * * * @param index The index of the value to return. * @return The bytes of the allowedPersistenceRegions at the given index. @@ -617,18 +637,22 @@ public java.lang.String getAllowedPersistenceRegions(int index) { public com.google.protobuf.ByteString getAllowedPersistenceRegionsBytes(int index) { return allowedPersistenceRegions_.getByteString(index); } + /** * * *
    -     * A list of IDs of GCP regions where messages that are published to the topic
    -     * may be persisted in storage. Messages published by publishers running in
    -     * non-allowed GCP regions (or running outside of GCP altogether) will be
    -     * routed for storage in one of the allowed regions. An empty list means that
    -     * no regions are allowed, and is not a valid configuration.
    +     * Optional. A list of IDs of Google Cloud regions where messages that are
    +     * published to the topic may be persisted in storage. Messages published by
    +     * publishers running in non-allowed Google Cloud regions (or running outside
    +     * of Google Cloud altogether) are routed for storage in one of the allowed
    +     * regions. An empty list means that no regions are allowed, and is not a
    +     * valid configuration.
          * 
    * - * repeated string allowed_persistence_regions = 1; + * + * repeated string allowed_persistence_regions = 1 [(.google.api.field_behavior) = OPTIONAL]; + * * * @param index The index to set the value at. * @param value The allowedPersistenceRegions to set. @@ -640,21 +664,26 @@ public Builder setAllowedPersistenceRegions(int index, java.lang.String value) { } ensureAllowedPersistenceRegionsIsMutable(); allowedPersistenceRegions_.set(index, value); + bitField0_ |= 0x00000001; onChanged(); return this; } + /** * * *
    -     * A list of IDs of GCP regions where messages that are published to the topic
    -     * may be persisted in storage. Messages published by publishers running in
    -     * non-allowed GCP regions (or running outside of GCP altogether) will be
    -     * routed for storage in one of the allowed regions. An empty list means that
    -     * no regions are allowed, and is not a valid configuration.
    +     * Optional. A list of IDs of Google Cloud regions where messages that are
    +     * published to the topic may be persisted in storage. Messages published by
    +     * publishers running in non-allowed Google Cloud regions (or running outside
    +     * of Google Cloud altogether) are routed for storage in one of the allowed
    +     * regions. An empty list means that no regions are allowed, and is not a
    +     * valid configuration.
          * 
    * - * repeated string allowed_persistence_regions = 1; + * + * repeated string allowed_persistence_regions = 1 [(.google.api.field_behavior) = OPTIONAL]; + * * * @param value The allowedPersistenceRegions to add. * @return This builder for chaining. @@ -665,21 +694,26 @@ public Builder addAllowedPersistenceRegions(java.lang.String value) { } ensureAllowedPersistenceRegionsIsMutable(); allowedPersistenceRegions_.add(value); + bitField0_ |= 0x00000001; onChanged(); return this; } + /** * * *
    -     * A list of IDs of GCP regions where messages that are published to the topic
    -     * may be persisted in storage. Messages published by publishers running in
    -     * non-allowed GCP regions (or running outside of GCP altogether) will be
    -     * routed for storage in one of the allowed regions. An empty list means that
    -     * no regions are allowed, and is not a valid configuration.
    +     * Optional. A list of IDs of Google Cloud regions where messages that are
    +     * published to the topic may be persisted in storage. Messages published by
    +     * publishers running in non-allowed Google Cloud regions (or running outside
    +     * of Google Cloud altogether) are routed for storage in one of the allowed
    +     * regions. An empty list means that no regions are allowed, and is not a
    +     * valid configuration.
          * 
    * - * repeated string allowed_persistence_regions = 1; + * + * repeated string allowed_persistence_regions = 1 [(.google.api.field_behavior) = OPTIONAL]; + * * * @param values The allowedPersistenceRegions to add. * @return This builder for chaining. @@ -687,42 +721,52 @@ public Builder addAllowedPersistenceRegions(java.lang.String value) { public Builder addAllAllowedPersistenceRegions(java.lang.Iterable values) { ensureAllowedPersistenceRegionsIsMutable(); com.google.protobuf.AbstractMessageLite.Builder.addAll(values, allowedPersistenceRegions_); + bitField0_ |= 0x00000001; onChanged(); return this; } + /** * * *
    -     * A list of IDs of GCP regions where messages that are published to the topic
    -     * may be persisted in storage. Messages published by publishers running in
    -     * non-allowed GCP regions (or running outside of GCP altogether) will be
    -     * routed for storage in one of the allowed regions. An empty list means that
    -     * no regions are allowed, and is not a valid configuration.
    +     * Optional. A list of IDs of Google Cloud regions where messages that are
    +     * published to the topic may be persisted in storage. Messages published by
    +     * publishers running in non-allowed Google Cloud regions (or running outside
    +     * of Google Cloud altogether) are routed for storage in one of the allowed
    +     * regions. An empty list means that no regions are allowed, and is not a
    +     * valid configuration.
          * 
    * - * repeated string allowed_persistence_regions = 1; + * + * repeated string allowed_persistence_regions = 1 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return This builder for chaining. */ public Builder clearAllowedPersistenceRegions() { - allowedPersistenceRegions_ = com.google.protobuf.LazyStringArrayList.EMPTY; + allowedPersistenceRegions_ = com.google.protobuf.LazyStringArrayList.emptyList(); bitField0_ = (bitField0_ & ~0x00000001); + ; onChanged(); return this; } + /** * * *
    -     * A list of IDs of GCP regions where messages that are published to the topic
    -     * may be persisted in storage. Messages published by publishers running in
    -     * non-allowed GCP regions (or running outside of GCP altogether) will be
    -     * routed for storage in one of the allowed regions. An empty list means that
    -     * no regions are allowed, and is not a valid configuration.
    +     * Optional. A list of IDs of Google Cloud regions where messages that are
    +     * published to the topic may be persisted in storage. Messages published by
    +     * publishers running in non-allowed Google Cloud regions (or running outside
    +     * of Google Cloud altogether) are routed for storage in one of the allowed
    +     * regions. An empty list means that no regions are allowed, and is not a
    +     * valid configuration.
          * 
    * - * repeated string allowed_persistence_regions = 1; + * + * repeated string allowed_persistence_regions = 1 [(.google.api.field_behavior) = OPTIONAL]; + * * * @param value The bytes of the allowedPersistenceRegions to add. * @return This builder for chaining. @@ -734,19 +778,77 @@ public Builder addAllowedPersistenceRegionsBytes(com.google.protobuf.ByteString checkByteStringIsUtf8(value); ensureAllowedPersistenceRegionsIsMutable(); allowedPersistenceRegions_.add(value); + bitField0_ |= 0x00000001; onChanged(); return this; } + private boolean enforceInTransit_; + + /** + * + * + *
    +     * Optional. If true, `allowed_persistence_regions` is also used to enforce
    +     * in-transit guarantees for messages. That is, Pub/Sub will fail
    +     * Publish operations on this topic and subscribe operations
    +     * on any subscription attached to this topic in any region that is
    +     * not in `allowed_persistence_regions`.
    +     * 
    + * + * bool enforce_in_transit = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The enforceInTransit. + */ @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); + public boolean getEnforceInTransit() { + return enforceInTransit_; } - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); + /** + * + * + *
    +     * Optional. If true, `allowed_persistence_regions` is also used to enforce
    +     * in-transit guarantees for messages. That is, Pub/Sub will fail
    +     * Publish operations on this topic and subscribe operations
    +     * on any subscription attached to this topic in any region that is
    +     * not in `allowed_persistence_regions`.
    +     * 
    + * + * bool enforce_in_transit = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The enforceInTransit to set. + * @return This builder for chaining. + */ + public Builder setEnforceInTransit(boolean value) { + + enforceInTransit_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Optional. If true, `allowed_persistence_regions` is also used to enforce
    +     * in-transit guarantees for messages. That is, Pub/Sub will fail
    +     * Publish operations on this topic and subscribe operations
    +     * on any subscription attached to this topic in any region that is
    +     * not in `allowed_persistence_regions`.
    +     * 
    + * + * bool enforce_in_transit = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearEnforceInTransit() { + bitField0_ = (bitField0_ & ~0x00000002); + enforceInTransit_ = false; + onChanged(); + return this; } // @@protoc_insertion_point(builder_scope:google.pubsub.v1.MessageStoragePolicy) @@ -770,7 +872,18 @@ public MessageStoragePolicy parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new MessageStoragePolicy(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/MessageStoragePolicyOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/MessageStoragePolicyOrBuilder.java index e606797dc..b023c895a 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/MessageStoragePolicyOrBuilder.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/MessageStoragePolicyOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; +@com.google.protobuf.Generated public interface MessageStoragePolicyOrBuilder extends // @@protoc_insertion_point(interface_extends:google.pubsub.v1.MessageStoragePolicy) @@ -27,66 +30,98 @@ public interface MessageStoragePolicyOrBuilder * * *
    -   * A list of IDs of GCP regions where messages that are published to the topic
    -   * may be persisted in storage. Messages published by publishers running in
    -   * non-allowed GCP regions (or running outside of GCP altogether) will be
    -   * routed for storage in one of the allowed regions. An empty list means that
    -   * no regions are allowed, and is not a valid configuration.
    +   * Optional. A list of IDs of Google Cloud regions where messages that are
    +   * published to the topic may be persisted in storage. Messages published by
    +   * publishers running in non-allowed Google Cloud regions (or running outside
    +   * of Google Cloud altogether) are routed for storage in one of the allowed
    +   * regions. An empty list means that no regions are allowed, and is not a
    +   * valid configuration.
        * 
    * - * repeated string allowed_persistence_regions = 1; + * + * repeated string allowed_persistence_regions = 1 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return A list containing the allowedPersistenceRegions. */ java.util.List getAllowedPersistenceRegionsList(); + /** * * *
    -   * A list of IDs of GCP regions where messages that are published to the topic
    -   * may be persisted in storage. Messages published by publishers running in
    -   * non-allowed GCP regions (or running outside of GCP altogether) will be
    -   * routed for storage in one of the allowed regions. An empty list means that
    -   * no regions are allowed, and is not a valid configuration.
    +   * Optional. A list of IDs of Google Cloud regions where messages that are
    +   * published to the topic may be persisted in storage. Messages published by
    +   * publishers running in non-allowed Google Cloud regions (or running outside
    +   * of Google Cloud altogether) are routed for storage in one of the allowed
    +   * regions. An empty list means that no regions are allowed, and is not a
    +   * valid configuration.
        * 
    * - * repeated string allowed_persistence_regions = 1; + * + * repeated string allowed_persistence_regions = 1 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return The count of allowedPersistenceRegions. */ int getAllowedPersistenceRegionsCount(); + /** * * *
    -   * A list of IDs of GCP regions where messages that are published to the topic
    -   * may be persisted in storage. Messages published by publishers running in
    -   * non-allowed GCP regions (or running outside of GCP altogether) will be
    -   * routed for storage in one of the allowed regions. An empty list means that
    -   * no regions are allowed, and is not a valid configuration.
    +   * Optional. A list of IDs of Google Cloud regions where messages that are
    +   * published to the topic may be persisted in storage. Messages published by
    +   * publishers running in non-allowed Google Cloud regions (or running outside
    +   * of Google Cloud altogether) are routed for storage in one of the allowed
    +   * regions. An empty list means that no regions are allowed, and is not a
    +   * valid configuration.
        * 
    * - * repeated string allowed_persistence_regions = 1; + * + * repeated string allowed_persistence_regions = 1 [(.google.api.field_behavior) = OPTIONAL]; + * * * @param index The index of the element to return. * @return The allowedPersistenceRegions at the given index. */ java.lang.String getAllowedPersistenceRegions(int index); + /** * * *
    -   * A list of IDs of GCP regions where messages that are published to the topic
    -   * may be persisted in storage. Messages published by publishers running in
    -   * non-allowed GCP regions (or running outside of GCP altogether) will be
    -   * routed for storage in one of the allowed regions. An empty list means that
    -   * no regions are allowed, and is not a valid configuration.
    +   * Optional. A list of IDs of Google Cloud regions where messages that are
    +   * published to the topic may be persisted in storage. Messages published by
    +   * publishers running in non-allowed Google Cloud regions (or running outside
    +   * of Google Cloud altogether) are routed for storage in one of the allowed
    +   * regions. An empty list means that no regions are allowed, and is not a
    +   * valid configuration.
        * 
    * - * repeated string allowed_persistence_regions = 1; + * + * repeated string allowed_persistence_regions = 1 [(.google.api.field_behavior) = OPTIONAL]; + * * * @param index The index of the value to return. * @return The bytes of the allowedPersistenceRegions at the given index. */ com.google.protobuf.ByteString getAllowedPersistenceRegionsBytes(int index); + + /** + * + * + *
    +   * Optional. If true, `allowed_persistence_regions` is also used to enforce
    +   * in-transit guarantees for messages. That is, Pub/Sub will fail
    +   * Publish operations on this topic and subscribe operations
    +   * on any subscription attached to this topic in any region that is
    +   * not in `allowed_persistence_regions`.
    +   * 
    + * + * bool enforce_in_transit = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The enforceInTransit. + */ + boolean getEnforceInTransit(); } 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 new file mode 100644 index 000000000..64bffd993 --- /dev/null +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/MessageTransform.java @@ -0,0 +1,1389 @@ +/* + * Copyright 2026 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 + +package com.google.pubsub.v1; + +/** + * + * + *
    + * All supported message transforms types.
    + * 
    + * + * Protobuf type {@code google.pubsub.v1.MessageTransform} + */ +@com.google.protobuf.Generated +public final class MessageTransform extends com.google.protobuf.GeneratedMessage + implements + // @@protoc_insertion_point(message_implements:google.pubsub.v1.MessageTransform) + MessageTransformOrBuilder { + private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "MessageTransform"); + } + + // Use MessageTransform.newBuilder() to construct. + private MessageTransform(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + + private MessageTransform() {} + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_MessageTransform_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_MessageTransform_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.MessageTransform.class, + com.google.pubsub.v1.MessageTransform.Builder.class); + } + + private int transformCase_ = 0; + + @SuppressWarnings("serial") + private java.lang.Object transform_; + + public enum TransformCase + implements + com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + JAVASCRIPT_UDF(2), + AI_INFERENCE(6), + TRANSFORM_NOT_SET(0); + private final int value; + + private TransformCase(int value) { + this.value = value; + } + + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static TransformCase valueOf(int value) { + return forNumber(value); + } + + public static TransformCase forNumber(int value) { + switch (value) { + case 2: + return JAVASCRIPT_UDF; + case 6: + return AI_INFERENCE; + case 0: + return TRANSFORM_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public TransformCase getTransformCase() { + return TransformCase.forNumber(transformCase_); + } + + public static final int JAVASCRIPT_UDF_FIELD_NUMBER = 2; + + /** + * + * + *
    +   * Optional. JavaScript User Defined Function. If multiple JavaScriptUDF's
    +   * are specified on a resource, each must have a unique `function_name`.
    +   * 
    + * + * + * .google.pubsub.v1.JavaScriptUDF javascript_udf = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the javascriptUdf field is set. + */ + @java.lang.Override + public boolean hasJavascriptUdf() { + return transformCase_ == 2; + } + + /** + * + * + *
    +   * Optional. JavaScript User Defined Function. If multiple JavaScriptUDF's
    +   * are specified on a resource, each must have a unique `function_name`.
    +   * 
    + * + * + * .google.pubsub.v1.JavaScriptUDF javascript_udf = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The javascriptUdf. + */ + @java.lang.Override + public com.google.pubsub.v1.JavaScriptUDF getJavascriptUdf() { + if (transformCase_ == 2) { + return (com.google.pubsub.v1.JavaScriptUDF) transform_; + } + return com.google.pubsub.v1.JavaScriptUDF.getDefaultInstance(); + } + + /** + * + * + *
    +   * Optional. JavaScript User Defined Function. If multiple JavaScriptUDF's
    +   * are specified on a resource, each must have a unique `function_name`.
    +   * 
    + * + * + * .google.pubsub.v1.JavaScriptUDF javascript_udf = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.JavaScriptUDFOrBuilder getJavascriptUdfOrBuilder() { + if (transformCase_ == 2) { + return (com.google.pubsub.v1.JavaScriptUDF) transform_; + } + return com.google.pubsub.v1.JavaScriptUDF.getDefaultInstance(); + } + + public static final int AI_INFERENCE_FIELD_NUMBER = 6; + + /** + * + * + *
    +   * Optional. AI Inference. Specifies the Vertex AI endpoint that inference
    +   * requests built from the Pub/Sub message data and provided parameters will
    +   * be sent to.
    +   * 
    + * + * .google.pubsub.v1.AIInference ai_inference = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the aiInference field is set. + */ + @java.lang.Override + public boolean hasAiInference() { + return transformCase_ == 6; + } + + /** + * + * + *
    +   * Optional. AI Inference. Specifies the Vertex AI endpoint that inference
    +   * requests built from the Pub/Sub message data and provided parameters will
    +   * be sent to.
    +   * 
    + * + * .google.pubsub.v1.AIInference ai_inference = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The aiInference. + */ + @java.lang.Override + public com.google.pubsub.v1.AIInference getAiInference() { + if (transformCase_ == 6) { + return (com.google.pubsub.v1.AIInference) transform_; + } + return com.google.pubsub.v1.AIInference.getDefaultInstance(); + } + + /** + * + * + *
    +   * Optional. AI Inference. Specifies the Vertex AI endpoint that inference
    +   * requests built from the Pub/Sub message data and provided parameters will
    +   * be sent to.
    +   * 
    + * + * .google.pubsub.v1.AIInference ai_inference = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.AIInferenceOrBuilder getAiInferenceOrBuilder() { + if (transformCase_ == 6) { + return (com.google.pubsub.v1.AIInference) transform_; + } + return com.google.pubsub.v1.AIInference.getDefaultInstance(); + } + + public static final int ENABLED_FIELD_NUMBER = 3; + private boolean enabled_ = false; + + /** + * + * + *
    +   * Optional. This field is deprecated, use the `disabled` field to disable
    +   * transforms.
    +   * 
    + * + * 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=857 + * @return The enabled. + */ + @java.lang.Override + @java.lang.Deprecated + public boolean getEnabled() { + return enabled_; + } + + public static final int DISABLED_FIELD_NUMBER = 4; + private boolean disabled_ = false; + + /** + * + * + *
    +   * Optional. If true, the transform is disabled and will not be applied to
    +   * messages. Defaults to `false`.
    +   * 
    + * + * bool disabled = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The disabled. + */ + @java.lang.Override + public boolean getDisabled() { + return disabled_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (transformCase_ == 2) { + output.writeMessage(2, (com.google.pubsub.v1.JavaScriptUDF) transform_); + } + if (enabled_ != false) { + output.writeBool(3, enabled_); + } + if (disabled_ != false) { + output.writeBool(4, disabled_); + } + if (transformCase_ == 6) { + output.writeMessage(6, (com.google.pubsub.v1.AIInference) transform_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (transformCase_ == 2) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 2, (com.google.pubsub.v1.JavaScriptUDF) transform_); + } + if (enabled_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(3, enabled_); + } + if (disabled_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(4, disabled_); + } + if (transformCase_ == 6) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 6, (com.google.pubsub.v1.AIInference) transform_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.pubsub.v1.MessageTransform)) { + return super.equals(obj); + } + com.google.pubsub.v1.MessageTransform other = (com.google.pubsub.v1.MessageTransform) obj; + + if (getEnabled() != other.getEnabled()) return false; + if (getDisabled() != other.getDisabled()) return false; + if (!getTransformCase().equals(other.getTransformCase())) return false; + switch (transformCase_) { + case 2: + if (!getJavascriptUdf().equals(other.getJavascriptUdf())) return false; + break; + case 6: + if (!getAiInference().equals(other.getAiInference())) return false; + break; + case 0: + default: + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + ENABLED_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getEnabled()); + hash = (37 * hash) + DISABLED_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getDisabled()); + switch (transformCase_) { + case 2: + hash = (37 * hash) + JAVASCRIPT_UDF_FIELD_NUMBER; + hash = (53 * hash) + getJavascriptUdf().hashCode(); + break; + case 6: + hash = (37 * hash) + AI_INFERENCE_FIELD_NUMBER; + hash = (53 * hash) + getAiInference().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.pubsub.v1.MessageTransform parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.MessageTransform parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.MessageTransform parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.MessageTransform parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.MessageTransform parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.MessageTransform parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.MessageTransform parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.MessageTransform parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.MessageTransform parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.MessageTransform parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.MessageTransform parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.MessageTransform parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.pubsub.v1.MessageTransform prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + + /** + * + * + *
    +   * All supported message transforms types.
    +   * 
    + * + * Protobuf type {@code google.pubsub.v1.MessageTransform} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder + implements + // @@protoc_insertion_point(builder_implements:google.pubsub.v1.MessageTransform) + com.google.pubsub.v1.MessageTransformOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_MessageTransform_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_MessageTransform_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.MessageTransform.class, + com.google.pubsub.v1.MessageTransform.Builder.class); + } + + // Construct using com.google.pubsub.v1.MessageTransform.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + if (javascriptUdfBuilder_ != null) { + javascriptUdfBuilder_.clear(); + } + if (aiInferenceBuilder_ != null) { + aiInferenceBuilder_.clear(); + } + enabled_ = false; + disabled_ = false; + transformCase_ = 0; + transform_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_MessageTransform_descriptor; + } + + @java.lang.Override + public com.google.pubsub.v1.MessageTransform getDefaultInstanceForType() { + return com.google.pubsub.v1.MessageTransform.getDefaultInstance(); + } + + @java.lang.Override + public com.google.pubsub.v1.MessageTransform build() { + com.google.pubsub.v1.MessageTransform result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.pubsub.v1.MessageTransform buildPartial() { + com.google.pubsub.v1.MessageTransform result = + new com.google.pubsub.v1.MessageTransform(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + buildPartialOneofs(result); + onBuilt(); + return result; + } + + private void buildPartial0(com.google.pubsub.v1.MessageTransform result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000004) != 0)) { + result.enabled_ = enabled_; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.disabled_ = disabled_; + } + } + + private void buildPartialOneofs(com.google.pubsub.v1.MessageTransform result) { + result.transformCase_ = transformCase_; + result.transform_ = this.transform_; + if (transformCase_ == 2 && javascriptUdfBuilder_ != null) { + result.transform_ = javascriptUdfBuilder_.build(); + } + if (transformCase_ == 6 && aiInferenceBuilder_ != null) { + result.transform_ = aiInferenceBuilder_.build(); + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.pubsub.v1.MessageTransform) { + return mergeFrom((com.google.pubsub.v1.MessageTransform) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.pubsub.v1.MessageTransform other) { + if (other == com.google.pubsub.v1.MessageTransform.getDefaultInstance()) return this; + if (other.getEnabled() != false) { + setEnabled(other.getEnabled()); + } + if (other.getDisabled() != false) { + setDisabled(other.getDisabled()); + } + switch (other.getTransformCase()) { + case JAVASCRIPT_UDF: + { + mergeJavascriptUdf(other.getJavascriptUdf()); + break; + } + case AI_INFERENCE: + { + mergeAiInference(other.getAiInference()); + break; + } + case TRANSFORM_NOT_SET: + { + break; + } + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 18: + { + input.readMessage( + internalGetJavascriptUdfFieldBuilder().getBuilder(), extensionRegistry); + transformCase_ = 2; + break; + } // case 18 + case 24: + { + enabled_ = input.readBool(); + bitField0_ |= 0x00000004; + break; + } // case 24 + case 32: + { + disabled_ = input.readBool(); + bitField0_ |= 0x00000008; + break; + } // case 32 + case 50: + { + input.readMessage( + internalGetAiInferenceFieldBuilder().getBuilder(), extensionRegistry); + transformCase_ = 6; + break; + } // case 50 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int transformCase_ = 0; + private java.lang.Object transform_; + + public TransformCase getTransformCase() { + return TransformCase.forNumber(transformCase_); + } + + public Builder clearTransform() { + transformCase_ = 0; + transform_ = null; + onChanged(); + return this; + } + + private int bitField0_; + + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.JavaScriptUDF, + com.google.pubsub.v1.JavaScriptUDF.Builder, + com.google.pubsub.v1.JavaScriptUDFOrBuilder> + javascriptUdfBuilder_; + + /** + * + * + *
    +     * Optional. JavaScript User Defined Function. If multiple JavaScriptUDF's
    +     * are specified on a resource, each must have a unique `function_name`.
    +     * 
    + * + * + * .google.pubsub.v1.JavaScriptUDF javascript_udf = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the javascriptUdf field is set. + */ + @java.lang.Override + public boolean hasJavascriptUdf() { + return transformCase_ == 2; + } + + /** + * + * + *
    +     * Optional. JavaScript User Defined Function. If multiple JavaScriptUDF's
    +     * are specified on a resource, each must have a unique `function_name`.
    +     * 
    + * + * + * .google.pubsub.v1.JavaScriptUDF javascript_udf = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The javascriptUdf. + */ + @java.lang.Override + public com.google.pubsub.v1.JavaScriptUDF getJavascriptUdf() { + if (javascriptUdfBuilder_ == null) { + if (transformCase_ == 2) { + return (com.google.pubsub.v1.JavaScriptUDF) transform_; + } + return com.google.pubsub.v1.JavaScriptUDF.getDefaultInstance(); + } else { + if (transformCase_ == 2) { + return javascriptUdfBuilder_.getMessage(); + } + return com.google.pubsub.v1.JavaScriptUDF.getDefaultInstance(); + } + } + + /** + * + * + *
    +     * Optional. JavaScript User Defined Function. If multiple JavaScriptUDF's
    +     * are specified on a resource, each must have a unique `function_name`.
    +     * 
    + * + * + * .google.pubsub.v1.JavaScriptUDF javascript_udf = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setJavascriptUdf(com.google.pubsub.v1.JavaScriptUDF value) { + if (javascriptUdfBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + transform_ = value; + onChanged(); + } else { + javascriptUdfBuilder_.setMessage(value); + } + transformCase_ = 2; + return this; + } + + /** + * + * + *
    +     * Optional. JavaScript User Defined Function. If multiple JavaScriptUDF's
    +     * are specified on a resource, each must have a unique `function_name`.
    +     * 
    + * + * + * .google.pubsub.v1.JavaScriptUDF javascript_udf = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setJavascriptUdf(com.google.pubsub.v1.JavaScriptUDF.Builder builderForValue) { + if (javascriptUdfBuilder_ == null) { + transform_ = builderForValue.build(); + onChanged(); + } else { + javascriptUdfBuilder_.setMessage(builderForValue.build()); + } + transformCase_ = 2; + return this; + } + + /** + * + * + *
    +     * Optional. JavaScript User Defined Function. If multiple JavaScriptUDF's
    +     * are specified on a resource, each must have a unique `function_name`.
    +     * 
    + * + * + * .google.pubsub.v1.JavaScriptUDF javascript_udf = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeJavascriptUdf(com.google.pubsub.v1.JavaScriptUDF value) { + if (javascriptUdfBuilder_ == null) { + if (transformCase_ == 2 + && transform_ != com.google.pubsub.v1.JavaScriptUDF.getDefaultInstance()) { + transform_ = + com.google.pubsub.v1.JavaScriptUDF.newBuilder( + (com.google.pubsub.v1.JavaScriptUDF) transform_) + .mergeFrom(value) + .buildPartial(); + } else { + transform_ = value; + } + onChanged(); + } else { + if (transformCase_ == 2) { + javascriptUdfBuilder_.mergeFrom(value); + } else { + javascriptUdfBuilder_.setMessage(value); + } + } + transformCase_ = 2; + return this; + } + + /** + * + * + *
    +     * Optional. JavaScript User Defined Function. If multiple JavaScriptUDF's
    +     * are specified on a resource, each must have a unique `function_name`.
    +     * 
    + * + * + * .google.pubsub.v1.JavaScriptUDF javascript_udf = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearJavascriptUdf() { + if (javascriptUdfBuilder_ == null) { + if (transformCase_ == 2) { + transformCase_ = 0; + transform_ = null; + onChanged(); + } + } else { + if (transformCase_ == 2) { + transformCase_ = 0; + transform_ = null; + } + javascriptUdfBuilder_.clear(); + } + return this; + } + + /** + * + * + *
    +     * Optional. JavaScript User Defined Function. If multiple JavaScriptUDF's
    +     * are specified on a resource, each must have a unique `function_name`.
    +     * 
    + * + * + * .google.pubsub.v1.JavaScriptUDF javascript_udf = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.JavaScriptUDF.Builder getJavascriptUdfBuilder() { + return internalGetJavascriptUdfFieldBuilder().getBuilder(); + } + + /** + * + * + *
    +     * Optional. JavaScript User Defined Function. If multiple JavaScriptUDF's
    +     * are specified on a resource, each must have a unique `function_name`.
    +     * 
    + * + * + * .google.pubsub.v1.JavaScriptUDF javascript_udf = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.JavaScriptUDFOrBuilder getJavascriptUdfOrBuilder() { + if ((transformCase_ == 2) && (javascriptUdfBuilder_ != null)) { + return javascriptUdfBuilder_.getMessageOrBuilder(); + } else { + if (transformCase_ == 2) { + return (com.google.pubsub.v1.JavaScriptUDF) transform_; + } + return com.google.pubsub.v1.JavaScriptUDF.getDefaultInstance(); + } + } + + /** + * + * + *
    +     * Optional. JavaScript User Defined Function. If multiple JavaScriptUDF's
    +     * are specified on a resource, each must have a unique `function_name`.
    +     * 
    + * + * + * .google.pubsub.v1.JavaScriptUDF javascript_udf = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.JavaScriptUDF, + com.google.pubsub.v1.JavaScriptUDF.Builder, + com.google.pubsub.v1.JavaScriptUDFOrBuilder> + internalGetJavascriptUdfFieldBuilder() { + if (javascriptUdfBuilder_ == null) { + if (!(transformCase_ == 2)) { + transform_ = com.google.pubsub.v1.JavaScriptUDF.getDefaultInstance(); + } + javascriptUdfBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.JavaScriptUDF, + com.google.pubsub.v1.JavaScriptUDF.Builder, + com.google.pubsub.v1.JavaScriptUDFOrBuilder>( + (com.google.pubsub.v1.JavaScriptUDF) transform_, getParentForChildren(), isClean()); + transform_ = null; + } + transformCase_ = 2; + onChanged(); + return javascriptUdfBuilder_; + } + + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.AIInference, + com.google.pubsub.v1.AIInference.Builder, + com.google.pubsub.v1.AIInferenceOrBuilder> + aiInferenceBuilder_; + + /** + * + * + *
    +     * Optional. AI Inference. Specifies the Vertex AI endpoint that inference
    +     * requests built from the Pub/Sub message data and provided parameters will
    +     * be sent to.
    +     * 
    + * + * + * .google.pubsub.v1.AIInference ai_inference = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the aiInference field is set. + */ + @java.lang.Override + public boolean hasAiInference() { + return transformCase_ == 6; + } + + /** + * + * + *
    +     * Optional. AI Inference. Specifies the Vertex AI endpoint that inference
    +     * requests built from the Pub/Sub message data and provided parameters will
    +     * be sent to.
    +     * 
    + * + * + * .google.pubsub.v1.AIInference ai_inference = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The aiInference. + */ + @java.lang.Override + public com.google.pubsub.v1.AIInference getAiInference() { + if (aiInferenceBuilder_ == null) { + if (transformCase_ == 6) { + return (com.google.pubsub.v1.AIInference) transform_; + } + return com.google.pubsub.v1.AIInference.getDefaultInstance(); + } else { + if (transformCase_ == 6) { + return aiInferenceBuilder_.getMessage(); + } + return com.google.pubsub.v1.AIInference.getDefaultInstance(); + } + } + + /** + * + * + *
    +     * Optional. AI Inference. Specifies the Vertex AI endpoint that inference
    +     * requests built from the Pub/Sub message data and provided parameters will
    +     * be sent to.
    +     * 
    + * + * + * .google.pubsub.v1.AIInference ai_inference = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setAiInference(com.google.pubsub.v1.AIInference value) { + if (aiInferenceBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + transform_ = value; + onChanged(); + } else { + aiInferenceBuilder_.setMessage(value); + } + transformCase_ = 6; + return this; + } + + /** + * + * + *
    +     * Optional. AI Inference. Specifies the Vertex AI endpoint that inference
    +     * requests built from the Pub/Sub message data and provided parameters will
    +     * be sent to.
    +     * 
    + * + * + * .google.pubsub.v1.AIInference ai_inference = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setAiInference(com.google.pubsub.v1.AIInference.Builder builderForValue) { + if (aiInferenceBuilder_ == null) { + transform_ = builderForValue.build(); + onChanged(); + } else { + aiInferenceBuilder_.setMessage(builderForValue.build()); + } + transformCase_ = 6; + return this; + } + + /** + * + * + *
    +     * Optional. AI Inference. Specifies the Vertex AI endpoint that inference
    +     * requests built from the Pub/Sub message data and provided parameters will
    +     * be sent to.
    +     * 
    + * + * + * .google.pubsub.v1.AIInference ai_inference = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeAiInference(com.google.pubsub.v1.AIInference value) { + if (aiInferenceBuilder_ == null) { + if (transformCase_ == 6 + && transform_ != com.google.pubsub.v1.AIInference.getDefaultInstance()) { + transform_ = + com.google.pubsub.v1.AIInference.newBuilder( + (com.google.pubsub.v1.AIInference) transform_) + .mergeFrom(value) + .buildPartial(); + } else { + transform_ = value; + } + onChanged(); + } else { + if (transformCase_ == 6) { + aiInferenceBuilder_.mergeFrom(value); + } else { + aiInferenceBuilder_.setMessage(value); + } + } + transformCase_ = 6; + return this; + } + + /** + * + * + *
    +     * Optional. AI Inference. Specifies the Vertex AI endpoint that inference
    +     * requests built from the Pub/Sub message data and provided parameters will
    +     * be sent to.
    +     * 
    + * + * + * .google.pubsub.v1.AIInference ai_inference = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearAiInference() { + if (aiInferenceBuilder_ == null) { + if (transformCase_ == 6) { + transformCase_ = 0; + transform_ = null; + onChanged(); + } + } else { + if (transformCase_ == 6) { + transformCase_ = 0; + transform_ = null; + } + aiInferenceBuilder_.clear(); + } + return this; + } + + /** + * + * + *
    +     * Optional. AI Inference. Specifies the Vertex AI endpoint that inference
    +     * requests built from the Pub/Sub message data and provided parameters will
    +     * be sent to.
    +     * 
    + * + * + * .google.pubsub.v1.AIInference ai_inference = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.AIInference.Builder getAiInferenceBuilder() { + return internalGetAiInferenceFieldBuilder().getBuilder(); + } + + /** + * + * + *
    +     * Optional. AI Inference. Specifies the Vertex AI endpoint that inference
    +     * requests built from the Pub/Sub message data and provided parameters will
    +     * be sent to.
    +     * 
    + * + * + * .google.pubsub.v1.AIInference ai_inference = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.AIInferenceOrBuilder getAiInferenceOrBuilder() { + if ((transformCase_ == 6) && (aiInferenceBuilder_ != null)) { + return aiInferenceBuilder_.getMessageOrBuilder(); + } else { + if (transformCase_ == 6) { + return (com.google.pubsub.v1.AIInference) transform_; + } + return com.google.pubsub.v1.AIInference.getDefaultInstance(); + } + } + + /** + * + * + *
    +     * Optional. AI Inference. Specifies the Vertex AI endpoint that inference
    +     * requests built from the Pub/Sub message data and provided parameters will
    +     * be sent to.
    +     * 
    + * + * + * .google.pubsub.v1.AIInference ai_inference = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.AIInference, + com.google.pubsub.v1.AIInference.Builder, + com.google.pubsub.v1.AIInferenceOrBuilder> + internalGetAiInferenceFieldBuilder() { + if (aiInferenceBuilder_ == null) { + if (!(transformCase_ == 6)) { + transform_ = com.google.pubsub.v1.AIInference.getDefaultInstance(); + } + aiInferenceBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.AIInference, + com.google.pubsub.v1.AIInference.Builder, + com.google.pubsub.v1.AIInferenceOrBuilder>( + (com.google.pubsub.v1.AIInference) transform_, getParentForChildren(), isClean()); + transform_ = null; + } + transformCase_ = 6; + onChanged(); + return aiInferenceBuilder_; + } + + private boolean enabled_; + + /** + * + * + *
    +     * Optional. This field is deprecated, use the `disabled` field to disable
    +     * transforms.
    +     * 
    + * + * 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=857 + * @return The enabled. + */ + @java.lang.Override + @java.lang.Deprecated + public boolean getEnabled() { + return enabled_; + } + + /** + * + * + *
    +     * Optional. This field is deprecated, use the `disabled` field to disable
    +     * transforms.
    +     * 
    + * + * 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=857 + * @param value The enabled to set. + * @return This builder for chaining. + */ + @java.lang.Deprecated + public Builder setEnabled(boolean value) { + + enabled_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Optional. This field is deprecated, use the `disabled` field to disable
    +     * transforms.
    +     * 
    + * + * 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=857 + * @return This builder for chaining. + */ + @java.lang.Deprecated + public Builder clearEnabled() { + bitField0_ = (bitField0_ & ~0x00000004); + enabled_ = false; + onChanged(); + return this; + } + + private boolean disabled_; + + /** + * + * + *
    +     * Optional. If true, the transform is disabled and will not be applied to
    +     * messages. Defaults to `false`.
    +     * 
    + * + * bool disabled = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The disabled. + */ + @java.lang.Override + public boolean getDisabled() { + return disabled_; + } + + /** + * + * + *
    +     * Optional. If true, the transform is disabled and will not be applied to
    +     * messages. Defaults to `false`.
    +     * 
    + * + * bool disabled = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The disabled to set. + * @return This builder for chaining. + */ + public Builder setDisabled(boolean value) { + + disabled_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Optional. If true, the transform is disabled and will not be applied to
    +     * messages. Defaults to `false`.
    +     * 
    + * + * bool disabled = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearDisabled() { + bitField0_ = (bitField0_ & ~0x00000008); + disabled_ = false; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:google.pubsub.v1.MessageTransform) + } + + // @@protoc_insertion_point(class_scope:google.pubsub.v1.MessageTransform) + private static final com.google.pubsub.v1.MessageTransform DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.pubsub.v1.MessageTransform(); + } + + public static com.google.pubsub.v1.MessageTransform getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public MessageTransform parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.pubsub.v1.MessageTransform getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} 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 new file mode 100644 index 000000000..9c31737d0 --- /dev/null +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/MessageTransformOrBuilder.java @@ -0,0 +1,153 @@ +/* + * Copyright 2026 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 + +package com.google.pubsub.v1; + +@com.google.protobuf.Generated +public interface MessageTransformOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.pubsub.v1.MessageTransform) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
    +   * Optional. JavaScript User Defined Function. If multiple JavaScriptUDF's
    +   * are specified on a resource, each must have a unique `function_name`.
    +   * 
    + * + * + * .google.pubsub.v1.JavaScriptUDF javascript_udf = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the javascriptUdf field is set. + */ + boolean hasJavascriptUdf(); + + /** + * + * + *
    +   * Optional. JavaScript User Defined Function. If multiple JavaScriptUDF's
    +   * are specified on a resource, each must have a unique `function_name`.
    +   * 
    + * + * + * .google.pubsub.v1.JavaScriptUDF javascript_udf = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The javascriptUdf. + */ + com.google.pubsub.v1.JavaScriptUDF getJavascriptUdf(); + + /** + * + * + *
    +   * Optional. JavaScript User Defined Function. If multiple JavaScriptUDF's
    +   * are specified on a resource, each must have a unique `function_name`.
    +   * 
    + * + * + * .google.pubsub.v1.JavaScriptUDF javascript_udf = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.pubsub.v1.JavaScriptUDFOrBuilder getJavascriptUdfOrBuilder(); + + /** + * + * + *
    +   * Optional. AI Inference. Specifies the Vertex AI endpoint that inference
    +   * requests built from the Pub/Sub message data and provided parameters will
    +   * be sent to.
    +   * 
    + * + * .google.pubsub.v1.AIInference ai_inference = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the aiInference field is set. + */ + boolean hasAiInference(); + + /** + * + * + *
    +   * Optional. AI Inference. Specifies the Vertex AI endpoint that inference
    +   * requests built from the Pub/Sub message data and provided parameters will
    +   * be sent to.
    +   * 
    + * + * .google.pubsub.v1.AIInference ai_inference = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The aiInference. + */ + com.google.pubsub.v1.AIInference getAiInference(); + + /** + * + * + *
    +   * Optional. AI Inference. Specifies the Vertex AI endpoint that inference
    +   * requests built from the Pub/Sub message data and provided parameters will
    +   * be sent to.
    +   * 
    + * + * .google.pubsub.v1.AIInference ai_inference = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.pubsub.v1.AIInferenceOrBuilder getAiInferenceOrBuilder(); + + /** + * + * + *
    +   * Optional. This field is deprecated, use the `disabled` field to disable
    +   * transforms.
    +   * 
    + * + * 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=857 + * @return The enabled. + */ + @java.lang.Deprecated + boolean getEnabled(); + + /** + * + * + *
    +   * Optional. If true, the transform is disabled and will not be applied to
    +   * messages. Defaults to `false`.
    +   * 
    + * + * bool disabled = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The disabled. + */ + boolean getDisabled(); + + com.google.pubsub.v1.MessageTransform.TransformCase getTransformCase(); +} diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ModifyAckDeadlineRequest.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ModifyAckDeadlineRequest.java index a3e24dce8..383bd5c0e 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ModifyAckDeadlineRequest.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ModifyAckDeadlineRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; @@ -27,93 +29,31 @@ * * Protobuf type {@code google.pubsub.v1.ModifyAckDeadlineRequest} */ -public final class ModifyAckDeadlineRequest extends com.google.protobuf.GeneratedMessageV3 +@com.google.protobuf.Generated +public final class ModifyAckDeadlineRequest extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:google.pubsub.v1.ModifyAckDeadlineRequest) ModifyAckDeadlineRequestOrBuilder { private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "ModifyAckDeadlineRequest"); + } + // Use ModifyAckDeadlineRequest.newBuilder() to construct. - private ModifyAckDeadlineRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + private ModifyAckDeadlineRequest(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); } private ModifyAckDeadlineRequest() { subscription_ = ""; - ackIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new ModifyAckDeadlineRequest(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - private ModifyAckDeadlineRequest( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - java.lang.String s = input.readStringRequireUtf8(); - - subscription_ = s; - break; - } - case 24: - { - ackDeadlineSeconds_ = input.readInt32(); - break; - } - case 34: - { - java.lang.String s = input.readStringRequireUtf8(); - if (!((mutable_bitField0_ & 0x00000001) != 0)) { - ackIds_ = new com.google.protobuf.LazyStringArrayList(); - mutable_bitField0_ |= 0x00000001; - } - ackIds_.add(s); - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000001) != 0)) { - ackIds_ = ackIds_.getUnmodifiableView(); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } + ackIds_ = com.google.protobuf.LazyStringArrayList.emptyList(); } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { @@ -122,7 +62,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_ModifyAckDeadlineRequest_fieldAccessorTable @@ -132,7 +72,10 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } public static final int SUBSCRIPTION_FIELD_NUMBER = 1; - private volatile java.lang.Object subscription_; + + @SuppressWarnings("serial") + private volatile java.lang.Object subscription_ = ""; + /** * * @@ -159,6 +102,7 @@ public java.lang.String getSubscription() { return s; } } + /** * * @@ -187,7 +131,11 @@ public com.google.protobuf.ByteString getSubscriptionBytes() { } public static final int ACK_IDS_FIELD_NUMBER = 4; - private com.google.protobuf.LazyStringList ackIds_; + + @SuppressWarnings("serial") + private com.google.protobuf.LazyStringArrayList ackIds_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + /** * * @@ -202,6 +150,7 @@ public com.google.protobuf.ByteString getSubscriptionBytes() { public com.google.protobuf.ProtocolStringList getAckIdsList() { return ackIds_; } + /** * * @@ -216,6 +165,7 @@ public com.google.protobuf.ProtocolStringList getAckIdsList() { public int getAckIdsCount() { return ackIds_.size(); } + /** * * @@ -231,6 +181,7 @@ public int getAckIdsCount() { public java.lang.String getAckIds(int index) { return ackIds_.get(index); } + /** * * @@ -248,7 +199,8 @@ public com.google.protobuf.ByteString getAckIdsBytes(int index) { } public static final int ACK_DEADLINE_SECONDS_FIELD_NUMBER = 3; - private int ackDeadlineSeconds_; + private int ackDeadlineSeconds_ = 0; + /** * * @@ -260,7 +212,8 @@ public com.google.protobuf.ByteString getAckIdsBytes(int index) { * delivery to another subscriber client. This typically results in an * increase in the rate of message redeliveries (that is, duplicates). * The minimum deadline you can specify is 0 seconds. - * The maximum deadline you can specify is 600 seconds (10 minutes). + * The maximum deadline you can specify in a single request is 600 seconds + * (10 minutes). *
    * * int32 ack_deadline_seconds = 3 [(.google.api.field_behavior) = REQUIRED]; @@ -286,16 +239,16 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!getSubscriptionBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, subscription_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(subscription_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, subscription_); } if (ackDeadlineSeconds_ != 0) { output.writeInt32(3, ackDeadlineSeconds_); } for (int i = 0; i < ackIds_.size(); i++) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 4, ackIds_.getRaw(i)); + com.google.protobuf.GeneratedMessage.writeString(output, 4, ackIds_.getRaw(i)); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -304,8 +257,8 @@ public int getSerializedSize() { if (size != -1) return size; size = 0; - if (!getSubscriptionBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, subscription_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(subscription_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, subscription_); } if (ackDeadlineSeconds_ != 0) { size += com.google.protobuf.CodedOutputStream.computeInt32Size(3, ackDeadlineSeconds_); @@ -318,7 +271,7 @@ public int getSerializedSize() { size += dataSize; size += 1 * getAckIdsList().size(); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -337,7 +290,7 @@ public boolean equals(final java.lang.Object obj) { if (!getSubscription().equals(other.getSubscription())) return false; if (!getAckIdsList().equals(other.getAckIdsList())) return false; if (getAckDeadlineSeconds() != other.getAckDeadlineSeconds()) return false; - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -356,7 +309,7 @@ public int hashCode() { } hash = (37 * hash) + ACK_DEADLINE_SECONDS_FIELD_NUMBER; hash = (53 * hash) + getAckDeadlineSeconds(); - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -398,38 +351,38 @@ public static com.google.pubsub.v1.ModifyAckDeadlineRequest parseFrom( public static com.google.pubsub.v1.ModifyAckDeadlineRequest parseFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.ModifyAckDeadlineRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.ModifyAckDeadlineRequest parseDelimitedFrom( java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); } public static com.google.pubsub.v1.ModifyAckDeadlineRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.ModifyAckDeadlineRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.ModifyAckDeadlineRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } @@ -452,10 +405,11 @@ public Builder toBuilder() { } @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** * * @@ -465,7 +419,7 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build * * Protobuf type {@code google.pubsub.v1.ModifyAckDeadlineRequest} */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements // @@protoc_insertion_point(builder_implements:google.pubsub.v1.ModifyAckDeadlineRequest) com.google.pubsub.v1.ModifyAckDeadlineRequestOrBuilder { @@ -475,7 +429,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_ModifyAckDeadlineRequest_fieldAccessorTable @@ -485,28 +439,19 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } // Construct using com.google.pubsub.v1.ModifyAckDeadlineRequest.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } + private Builder() {} - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} } @java.lang.Override public Builder clear() { super.clear(); + bitField0_ = 0; subscription_ = ""; - - ackIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; - bitField0_ = (bitField0_ & ~0x00000001); + ackIds_ = com.google.protobuf.LazyStringArrayList.emptyList(); ackDeadlineSeconds_ = 0; - return this; } @@ -534,49 +479,25 @@ public com.google.pubsub.v1.ModifyAckDeadlineRequest build() { public com.google.pubsub.v1.ModifyAckDeadlineRequest buildPartial() { com.google.pubsub.v1.ModifyAckDeadlineRequest result = new com.google.pubsub.v1.ModifyAckDeadlineRequest(this); - int from_bitField0_ = bitField0_; - result.subscription_ = subscription_; - if (((bitField0_ & 0x00000001) != 0)) { - ackIds_ = ackIds_.getUnmodifiableView(); - bitField0_ = (bitField0_ & ~0x00000001); + if (bitField0_ != 0) { + buildPartial0(result); } - result.ackIds_ = ackIds_; - result.ackDeadlineSeconds_ = ackDeadlineSeconds_; onBuilt(); return result; } - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); + private void buildPartial0(com.google.pubsub.v1.ModifyAckDeadlineRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.subscription_ = subscription_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + ackIds_.makeImmutable(); + result.ackIds_ = ackIds_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.ackDeadlineSeconds_ = ackDeadlineSeconds_; + } } @java.lang.Override @@ -593,12 +514,13 @@ public Builder mergeFrom(com.google.pubsub.v1.ModifyAckDeadlineRequest other) { if (other == com.google.pubsub.v1.ModifyAckDeadlineRequest.getDefaultInstance()) return this; if (!other.getSubscription().isEmpty()) { subscription_ = other.subscription_; + bitField0_ |= 0x00000001; onChanged(); } if (!other.ackIds_.isEmpty()) { if (ackIds_.isEmpty()) { ackIds_ = other.ackIds_; - bitField0_ = (bitField0_ & ~0x00000001); + bitField0_ |= 0x00000002; } else { ensureAckIdsIsMutable(); ackIds_.addAll(other.ackIds_); @@ -608,7 +530,7 @@ public Builder mergeFrom(com.google.pubsub.v1.ModifyAckDeadlineRequest other) { if (other.getAckDeadlineSeconds() != 0) { setAckDeadlineSeconds(other.getAckDeadlineSeconds()); } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -623,23 +545,57 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.pubsub.v1.ModifyAckDeadlineRequest parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + subscription_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 24: + { + ackDeadlineSeconds_ = input.readInt32(); + bitField0_ |= 0x00000004; + break; + } // case 24 + case 34: + { + java.lang.String s = input.readStringRequireUtf8(); + ensureAckIdsIsMutable(); + ackIds_.add(s); + break; + } // case 34 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.google.pubsub.v1.ModifyAckDeadlineRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } private int bitField0_; private java.lang.Object subscription_ = ""; + /** * * @@ -665,6 +621,7 @@ public java.lang.String getSubscription() { return (java.lang.String) ref; } } + /** * * @@ -690,6 +647,7 @@ public com.google.protobuf.ByteString getSubscriptionBytes() { return (com.google.protobuf.ByteString) ref; } } + /** * * @@ -709,11 +667,12 @@ public Builder setSubscription(java.lang.String value) { if (value == null) { throw new NullPointerException(); } - subscription_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } + /** * * @@ -729,11 +688,12 @@ public Builder setSubscription(java.lang.String value) { * @return This builder for chaining. */ public Builder clearSubscription() { - subscription_ = getDefaultInstance().getSubscription(); + bitField0_ = (bitField0_ & ~0x00000001); onChanged(); return this; } + /** * * @@ -754,21 +714,22 @@ public Builder setSubscriptionBytes(com.google.protobuf.ByteString value) { throw new NullPointerException(); } checkByteStringIsUtf8(value); - subscription_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } - private com.google.protobuf.LazyStringList ackIds_ = - com.google.protobuf.LazyStringArrayList.EMPTY; + private com.google.protobuf.LazyStringArrayList ackIds_ = + com.google.protobuf.LazyStringArrayList.emptyList(); private void ensureAckIdsIsMutable() { - if (!((bitField0_ & 0x00000001) != 0)) { + if (!ackIds_.isModifiable()) { ackIds_ = new com.google.protobuf.LazyStringArrayList(ackIds_); - bitField0_ |= 0x00000001; } + bitField0_ |= 0x00000002; } + /** * * @@ -781,8 +742,10 @@ private void ensureAckIdsIsMutable() { * @return A list containing the ackIds. */ public com.google.protobuf.ProtocolStringList getAckIdsList() { - return ackIds_.getUnmodifiableView(); + ackIds_.makeImmutable(); + return ackIds_; } + /** * * @@ -797,6 +760,7 @@ public com.google.protobuf.ProtocolStringList getAckIdsList() { public int getAckIdsCount() { return ackIds_.size(); } + /** * * @@ -812,6 +776,7 @@ public int getAckIdsCount() { public java.lang.String getAckIds(int index) { return ackIds_.get(index); } + /** * * @@ -827,6 +792,7 @@ public java.lang.String getAckIds(int index) { public com.google.protobuf.ByteString getAckIdsBytes(int index) { return ackIds_.getByteString(index); } + /** * * @@ -846,9 +812,11 @@ public Builder setAckIds(int index, java.lang.String value) { } ensureAckIdsIsMutable(); ackIds_.set(index, value); + bitField0_ |= 0x00000002; onChanged(); return this; } + /** * * @@ -867,9 +835,11 @@ public Builder addAckIds(java.lang.String value) { } ensureAckIdsIsMutable(); ackIds_.add(value); + bitField0_ |= 0x00000002; onChanged(); return this; } + /** * * @@ -885,9 +855,11 @@ public Builder addAckIds(java.lang.String value) { public Builder addAllAckIds(java.lang.Iterable values) { ensureAckIdsIsMutable(); com.google.protobuf.AbstractMessageLite.Builder.addAll(values, ackIds_); + bitField0_ |= 0x00000002; onChanged(); return this; } + /** * * @@ -900,11 +872,13 @@ public Builder addAllAckIds(java.lang.Iterable values) { * @return This builder for chaining. */ public Builder clearAckIds() { - ackIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; - bitField0_ = (bitField0_ & ~0x00000001); + ackIds_ = com.google.protobuf.LazyStringArrayList.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + ; onChanged(); return this; } + /** * * @@ -924,11 +898,13 @@ public Builder addAckIdsBytes(com.google.protobuf.ByteString value) { checkByteStringIsUtf8(value); ensureAckIdsIsMutable(); ackIds_.add(value); + bitField0_ |= 0x00000002; onChanged(); return this; } private int ackDeadlineSeconds_; + /** * * @@ -940,7 +916,8 @@ public Builder addAckIdsBytes(com.google.protobuf.ByteString value) { * delivery to another subscriber client. This typically results in an * increase in the rate of message redeliveries (that is, duplicates). * The minimum deadline you can specify is 0 seconds. - * The maximum deadline you can specify is 600 seconds (10 minutes). + * The maximum deadline you can specify in a single request is 600 seconds + * (10 minutes). *
    * * int32 ack_deadline_seconds = 3 [(.google.api.field_behavior) = REQUIRED]; @@ -951,6 +928,7 @@ public Builder addAckIdsBytes(com.google.protobuf.ByteString value) { public int getAckDeadlineSeconds() { return ackDeadlineSeconds_; } + /** * * @@ -962,7 +940,8 @@ public int getAckDeadlineSeconds() { * delivery to another subscriber client. This typically results in an * increase in the rate of message redeliveries (that is, duplicates). * The minimum deadline you can specify is 0 seconds. - * The maximum deadline you can specify is 600 seconds (10 minutes). + * The maximum deadline you can specify in a single request is 600 seconds + * (10 minutes). *
    * * int32 ack_deadline_seconds = 3 [(.google.api.field_behavior) = REQUIRED]; @@ -973,9 +952,11 @@ public int getAckDeadlineSeconds() { public Builder setAckDeadlineSeconds(int value) { ackDeadlineSeconds_ = value; + bitField0_ |= 0x00000004; onChanged(); return this; } + /** * * @@ -987,7 +968,8 @@ public Builder setAckDeadlineSeconds(int value) { * delivery to another subscriber client. This typically results in an * increase in the rate of message redeliveries (that is, duplicates). * The minimum deadline you can specify is 0 seconds. - * The maximum deadline you can specify is 600 seconds (10 minutes). + * The maximum deadline you can specify in a single request is 600 seconds + * (10 minutes). *
    * * int32 ack_deadline_seconds = 3 [(.google.api.field_behavior) = REQUIRED]; @@ -995,23 +977,12 @@ public Builder setAckDeadlineSeconds(int value) { * @return This builder for chaining. */ public Builder clearAckDeadlineSeconds() { - + bitField0_ = (bitField0_ & ~0x00000004); ackDeadlineSeconds_ = 0; onChanged(); return this; } - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - // @@protoc_insertion_point(builder_scope:google.pubsub.v1.ModifyAckDeadlineRequest) } @@ -1033,7 +1004,18 @@ public ModifyAckDeadlineRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new ModifyAckDeadlineRequest(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ModifyAckDeadlineRequestOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ModifyAckDeadlineRequestOrBuilder.java index 663ca36d9..56439946d 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ModifyAckDeadlineRequestOrBuilder.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ModifyAckDeadlineRequestOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; +@com.google.protobuf.Generated public interface ModifyAckDeadlineRequestOrBuilder extends // @@protoc_insertion_point(interface_extends:google.pubsub.v1.ModifyAckDeadlineRequest) @@ -38,6 +41,7 @@ public interface ModifyAckDeadlineRequestOrBuilder * @return The subscription. */ java.lang.String getSubscription(); + /** * * @@ -66,6 +70,7 @@ public interface ModifyAckDeadlineRequestOrBuilder * @return A list containing the ackIds. */ java.util.List getAckIdsList(); + /** * * @@ -78,6 +83,7 @@ public interface ModifyAckDeadlineRequestOrBuilder * @return The count of ackIds. */ int getAckIdsCount(); + /** * * @@ -91,6 +97,7 @@ public interface ModifyAckDeadlineRequestOrBuilder * @return The ackIds at the given index. */ java.lang.String getAckIds(int index); + /** * * @@ -116,7 +123,8 @@ public interface ModifyAckDeadlineRequestOrBuilder * delivery to another subscriber client. This typically results in an * increase in the rate of message redeliveries (that is, duplicates). * The minimum deadline you can specify is 0 seconds. - * The maximum deadline you can specify is 600 seconds (10 minutes). + * The maximum deadline you can specify in a single request is 600 seconds + * (10 minutes). *
    * * int32 ack_deadline_seconds = 3 [(.google.api.field_behavior) = REQUIRED]; diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ModifyPushConfigRequest.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ModifyPushConfigRequest.java index 0ee605fad..0a0181ec3 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ModifyPushConfigRequest.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ModifyPushConfigRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; @@ -27,13 +29,25 @@ * * Protobuf type {@code google.pubsub.v1.ModifyPushConfigRequest} */ -public final class ModifyPushConfigRequest extends com.google.protobuf.GeneratedMessageV3 +@com.google.protobuf.Generated +public final class ModifyPushConfigRequest extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:google.pubsub.v1.ModifyPushConfigRequest) ModifyPushConfigRequestOrBuilder { private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "ModifyPushConfigRequest"); + } + // Use ModifyPushConfigRequest.newBuilder() to construct. - private ModifyPushConfigRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + private ModifyPushConfigRequest(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); } @@ -41,83 +55,13 @@ private ModifyPushConfigRequest() { subscription_ = ""; } - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new ModifyPushConfigRequest(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - private ModifyPushConfigRequest( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - java.lang.String s = input.readStringRequireUtf8(); - - subscription_ = s; - break; - } - case 18: - { - com.google.pubsub.v1.PushConfig.Builder subBuilder = null; - if (pushConfig_ != null) { - subBuilder = pushConfig_.toBuilder(); - } - pushConfig_ = - input.readMessage(com.google.pubsub.v1.PushConfig.parser(), extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(pushConfig_); - pushConfig_ = subBuilder.buildPartial(); - } - - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_ModifyPushConfigRequest_descriptor; } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_ModifyPushConfigRequest_fieldAccessorTable @@ -126,8 +70,12 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { com.google.pubsub.v1.ModifyPushConfigRequest.Builder.class); } + private int bitField0_; public static final int SUBSCRIPTION_FIELD_NUMBER = 1; - private volatile java.lang.Object subscription_; + + @SuppressWarnings("serial") + private volatile java.lang.Object subscription_ = ""; + /** * * @@ -154,6 +102,7 @@ public java.lang.String getSubscription() { return s; } } + /** * * @@ -183,11 +132,13 @@ public com.google.protobuf.ByteString getSubscriptionBytes() { public static final int PUSH_CONFIG_FIELD_NUMBER = 2; private com.google.pubsub.v1.PushConfig pushConfig_; + /** * * *
        * Required. The push configuration for future deliveries.
    +   *
        * An empty `pushConfig` indicates that the Pub/Sub system should
        * stop pushing messages from the given subscription and allow
        * messages to be pulled and acknowledged - effectively pausing
    @@ -201,13 +152,15 @@ public com.google.protobuf.ByteString getSubscriptionBytes() {
        */
       @java.lang.Override
       public boolean hasPushConfig() {
    -    return pushConfig_ != null;
    +    return ((bitField0_ & 0x00000001) != 0);
       }
    +
       /**
        *
        *
        * 
        * Required. The push configuration for future deliveries.
    +   *
        * An empty `pushConfig` indicates that the Pub/Sub system should
        * stop pushing messages from the given subscription and allow
        * messages to be pulled and acknowledged - effectively pausing
    @@ -223,11 +176,13 @@ public boolean hasPushConfig() {
       public com.google.pubsub.v1.PushConfig getPushConfig() {
         return pushConfig_ == null ? com.google.pubsub.v1.PushConfig.getDefaultInstance() : pushConfig_;
       }
    +
       /**
        *
        *
        * 
        * Required. The push configuration for future deliveries.
    +   *
        * An empty `pushConfig` indicates that the Pub/Sub system should
        * stop pushing messages from the given subscription and allow
        * messages to be pulled and acknowledged - effectively pausing
    @@ -239,7 +194,7 @@ public com.google.pubsub.v1.PushConfig getPushConfig() {
        */
       @java.lang.Override
       public com.google.pubsub.v1.PushConfigOrBuilder getPushConfigOrBuilder() {
    -    return getPushConfig();
    +    return pushConfig_ == null ? com.google.pubsub.v1.PushConfig.getDefaultInstance() : pushConfig_;
       }
     
       private byte memoizedIsInitialized = -1;
    @@ -256,13 +211,13 @@ public final boolean isInitialized() {
     
       @java.lang.Override
       public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
    -    if (!getSubscriptionBytes().isEmpty()) {
    -      com.google.protobuf.GeneratedMessageV3.writeString(output, 1, subscription_);
    +    if (!com.google.protobuf.GeneratedMessage.isStringEmpty(subscription_)) {
    +      com.google.protobuf.GeneratedMessage.writeString(output, 1, subscription_);
         }
    -    if (pushConfig_ != null) {
    +    if (((bitField0_ & 0x00000001) != 0)) {
           output.writeMessage(2, getPushConfig());
         }
    -    unknownFields.writeTo(output);
    +    getUnknownFields().writeTo(output);
       }
     
       @java.lang.Override
    @@ -271,13 +226,13 @@ public int getSerializedSize() {
         if (size != -1) return size;
     
         size = 0;
    -    if (!getSubscriptionBytes().isEmpty()) {
    -      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, subscription_);
    +    if (!com.google.protobuf.GeneratedMessage.isStringEmpty(subscription_)) {
    +      size += com.google.protobuf.GeneratedMessage.computeStringSize(1, subscription_);
         }
    -    if (pushConfig_ != null) {
    +    if (((bitField0_ & 0x00000001) != 0)) {
           size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getPushConfig());
         }
    -    size += unknownFields.getSerializedSize();
    +    size += getUnknownFields().getSerializedSize();
         memoizedSize = size;
         return size;
       }
    @@ -298,7 +253,7 @@ public boolean equals(final java.lang.Object obj) {
         if (hasPushConfig()) {
           if (!getPushConfig().equals(other.getPushConfig())) return false;
         }
    -    if (!unknownFields.equals(other.unknownFields)) return false;
    +    if (!getUnknownFields().equals(other.getUnknownFields())) return false;
         return true;
       }
     
    @@ -315,7 +270,7 @@ public int hashCode() {
           hash = (37 * hash) + PUSH_CONFIG_FIELD_NUMBER;
           hash = (53 * hash) + getPushConfig().hashCode();
         }
    -    hash = (29 * hash) + unknownFields.hashCode();
    +    hash = (29 * hash) + getUnknownFields().hashCode();
         memoizedHashCode = hash;
         return hash;
       }
    @@ -357,38 +312,38 @@ public static com.google.pubsub.v1.ModifyPushConfigRequest parseFrom(
     
       public static com.google.pubsub.v1.ModifyPushConfigRequest parseFrom(java.io.InputStream input)
           throws java.io.IOException {
    -    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
    +    return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input);
       }
     
       public static com.google.pubsub.v1.ModifyPushConfigRequest parseFrom(
           java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
           throws java.io.IOException {
    -    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
    +    return com.google.protobuf.GeneratedMessage.parseWithIOException(
             PARSER, input, extensionRegistry);
       }
     
       public static com.google.pubsub.v1.ModifyPushConfigRequest parseDelimitedFrom(
           java.io.InputStream input) throws java.io.IOException {
    -    return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
    +    return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input);
       }
     
       public static com.google.pubsub.v1.ModifyPushConfigRequest parseDelimitedFrom(
           java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
           throws java.io.IOException {
    -    return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(
    +    return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(
             PARSER, input, extensionRegistry);
       }
     
       public static com.google.pubsub.v1.ModifyPushConfigRequest parseFrom(
           com.google.protobuf.CodedInputStream input) throws java.io.IOException {
    -    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
    +    return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input);
       }
     
       public static com.google.pubsub.v1.ModifyPushConfigRequest parseFrom(
           com.google.protobuf.CodedInputStream input,
           com.google.protobuf.ExtensionRegistryLite extensionRegistry)
           throws java.io.IOException {
    -    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
    +    return com.google.protobuf.GeneratedMessage.parseWithIOException(
             PARSER, input, extensionRegistry);
       }
     
    @@ -411,10 +366,11 @@ public Builder toBuilder() {
       }
     
       @java.lang.Override
    -  protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
    +  protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) {
         Builder builder = new Builder(parent);
         return builder;
       }
    +
       /**
        *
        *
    @@ -424,7 +380,7 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build
        *
        * Protobuf type {@code google.pubsub.v1.ModifyPushConfigRequest}
        */
    -  public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder
    +  public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder
           implements
           // @@protoc_insertion_point(builder_implements:google.pubsub.v1.ModifyPushConfigRequest)
           com.google.pubsub.v1.ModifyPushConfigRequestOrBuilder {
    @@ -434,7 +390,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
         }
     
         @java.lang.Override
    -    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
    +    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
             internalGetFieldAccessorTable() {
           return com.google.pubsub.v1.PubsubProto
               .internal_static_google_pubsub_v1_ModifyPushConfigRequest_fieldAccessorTable
    @@ -448,24 +404,25 @@ private Builder() {
           maybeForceBuilderInitialization();
         }
     
    -    private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
    +    private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) {
           super(parent);
           maybeForceBuilderInitialization();
         }
     
         private void maybeForceBuilderInitialization() {
    -      if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {}
    +      if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
    +        internalGetPushConfigFieldBuilder();
    +      }
         }
     
         @java.lang.Override
         public Builder clear() {
           super.clear();
    +      bitField0_ = 0;
           subscription_ = "";
    -
    -      if (pushConfigBuilder_ == null) {
    -        pushConfig_ = null;
    -      } else {
    -        pushConfig_ = null;
    +      pushConfig_ = null;
    +      if (pushConfigBuilder_ != null) {
    +        pushConfigBuilder_.dispose();
             pushConfigBuilder_ = null;
           }
           return this;
    @@ -495,47 +452,24 @@ public com.google.pubsub.v1.ModifyPushConfigRequest build() {
         public com.google.pubsub.v1.ModifyPushConfigRequest buildPartial() {
           com.google.pubsub.v1.ModifyPushConfigRequest result =
               new com.google.pubsub.v1.ModifyPushConfigRequest(this);
    -      result.subscription_ = subscription_;
    -      if (pushConfigBuilder_ == null) {
    -        result.pushConfig_ = pushConfig_;
    -      } else {
    -        result.pushConfig_ = pushConfigBuilder_.build();
    +      if (bitField0_ != 0) {
    +        buildPartial0(result);
           }
           onBuilt();
           return result;
         }
     
    -    @java.lang.Override
    -    public Builder clone() {
    -      return super.clone();
    -    }
    -
    -    @java.lang.Override
    -    public Builder setField(
    -        com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
    -      return super.setField(field, value);
    -    }
    -
    -    @java.lang.Override
    -    public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) {
    -      return super.clearField(field);
    -    }
    -
    -    @java.lang.Override
    -    public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) {
    -      return super.clearOneof(oneof);
    -    }
    -
    -    @java.lang.Override
    -    public Builder setRepeatedField(
    -        com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) {
    -      return super.setRepeatedField(field, index, value);
    -    }
    -
    -    @java.lang.Override
    -    public Builder addRepeatedField(
    -        com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
    -      return super.addRepeatedField(field, value);
    +    private void buildPartial0(com.google.pubsub.v1.ModifyPushConfigRequest result) {
    +      int from_bitField0_ = bitField0_;
    +      if (((from_bitField0_ & 0x00000001) != 0)) {
    +        result.subscription_ = subscription_;
    +      }
    +      int to_bitField0_ = 0;
    +      if (((from_bitField0_ & 0x00000002) != 0)) {
    +        result.pushConfig_ = pushConfigBuilder_ == null ? pushConfig_ : pushConfigBuilder_.build();
    +        to_bitField0_ |= 0x00000001;
    +      }
    +      result.bitField0_ |= to_bitField0_;
         }
     
         @java.lang.Override
    @@ -552,12 +486,13 @@ public Builder mergeFrom(com.google.pubsub.v1.ModifyPushConfigRequest other) {
           if (other == com.google.pubsub.v1.ModifyPushConfigRequest.getDefaultInstance()) return this;
           if (!other.getSubscription().isEmpty()) {
             subscription_ = other.subscription_;
    +        bitField0_ |= 0x00000001;
             onChanged();
           }
           if (other.hasPushConfig()) {
             mergePushConfig(other.getPushConfig());
           }
    -      this.mergeUnknownFields(other.unknownFields);
    +      this.mergeUnknownFields(other.getUnknownFields());
           onChanged();
           return this;
         }
    @@ -572,21 +507,51 @@ public Builder mergeFrom(
             com.google.protobuf.CodedInputStream input,
             com.google.protobuf.ExtensionRegistryLite extensionRegistry)
             throws java.io.IOException {
    -      com.google.pubsub.v1.ModifyPushConfigRequest parsedMessage = null;
    +      if (extensionRegistry == null) {
    +        throw new java.lang.NullPointerException();
    +      }
           try {
    -        parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
    +        boolean done = false;
    +        while (!done) {
    +          int tag = input.readTag();
    +          switch (tag) {
    +            case 0:
    +              done = true;
    +              break;
    +            case 10:
    +              {
    +                subscription_ = input.readStringRequireUtf8();
    +                bitField0_ |= 0x00000001;
    +                break;
    +              } // case 10
    +            case 18:
    +              {
    +                input.readMessage(
    +                    internalGetPushConfigFieldBuilder().getBuilder(), extensionRegistry);
    +                bitField0_ |= 0x00000002;
    +                break;
    +              } // case 18
    +            default:
    +              {
    +                if (!super.parseUnknownField(input, extensionRegistry, tag)) {
    +                  done = true; // was an endgroup tag
    +                }
    +                break;
    +              } // default:
    +          } // switch (tag)
    +        } // while (!done)
           } catch (com.google.protobuf.InvalidProtocolBufferException e) {
    -        parsedMessage = (com.google.pubsub.v1.ModifyPushConfigRequest) e.getUnfinishedMessage();
             throw e.unwrapIOException();
           } finally {
    -        if (parsedMessage != null) {
    -          mergeFrom(parsedMessage);
    -        }
    -      }
    +        onChanged();
    +      } // finally
           return this;
         }
     
    +    private int bitField0_;
    +
         private java.lang.Object subscription_ = "";
    +
         /**
          *
          *
    @@ -612,6 +577,7 @@ public java.lang.String getSubscription() {
             return (java.lang.String) ref;
           }
         }
    +
         /**
          *
          *
    @@ -637,6 +603,7 @@ public com.google.protobuf.ByteString getSubscriptionBytes() {
             return (com.google.protobuf.ByteString) ref;
           }
         }
    +
         /**
          *
          *
    @@ -656,11 +623,12 @@ public Builder setSubscription(java.lang.String value) {
           if (value == null) {
             throw new NullPointerException();
           }
    -
           subscription_ = value;
    +      bitField0_ |= 0x00000001;
           onChanged();
           return this;
         }
    +
         /**
          *
          *
    @@ -676,11 +644,12 @@ public Builder setSubscription(java.lang.String value) {
          * @return This builder for chaining.
          */
         public Builder clearSubscription() {
    -
           subscription_ = getDefaultInstance().getSubscription();
    +      bitField0_ = (bitField0_ & ~0x00000001);
           onChanged();
           return this;
         }
    +
         /**
          *
          *
    @@ -701,23 +670,25 @@ public Builder setSubscriptionBytes(com.google.protobuf.ByteString value) {
             throw new NullPointerException();
           }
           checkByteStringIsUtf8(value);
    -
           subscription_ = value;
    +      bitField0_ |= 0x00000001;
           onChanged();
           return this;
         }
     
         private com.google.pubsub.v1.PushConfig pushConfig_;
    -    private com.google.protobuf.SingleFieldBuilderV3<
    +    private com.google.protobuf.SingleFieldBuilder<
                 com.google.pubsub.v1.PushConfig,
                 com.google.pubsub.v1.PushConfig.Builder,
                 com.google.pubsub.v1.PushConfigOrBuilder>
             pushConfigBuilder_;
    +
         /**
          *
          *
          * 
          * Required. The push configuration for future deliveries.
    +     *
          * An empty `pushConfig` indicates that the Pub/Sub system should
          * stop pushing messages from the given subscription and allow
          * messages to be pulled and acknowledged - effectively pausing
    @@ -730,13 +701,15 @@ public Builder setSubscriptionBytes(com.google.protobuf.ByteString value) {
          * @return Whether the pushConfig field is set.
          */
         public boolean hasPushConfig() {
    -      return pushConfigBuilder_ != null || pushConfig_ != null;
    +      return ((bitField0_ & 0x00000002) != 0);
         }
    +
         /**
          *
          *
          * 
          * Required. The push configuration for future deliveries.
    +     *
          * An empty `pushConfig` indicates that the Pub/Sub system should
          * stop pushing messages from the given subscription and allow
          * messages to be pulled and acknowledged - effectively pausing
    @@ -757,11 +730,13 @@ public com.google.pubsub.v1.PushConfig getPushConfig() {
             return pushConfigBuilder_.getMessage();
           }
         }
    +
         /**
          *
          *
          * 
          * Required. The push configuration for future deliveries.
    +     *
          * An empty `pushConfig` indicates that the Pub/Sub system should
          * stop pushing messages from the given subscription and allow
          * messages to be pulled and acknowledged - effectively pausing
    @@ -777,18 +752,20 @@ public Builder setPushConfig(com.google.pubsub.v1.PushConfig value) {
               throw new NullPointerException();
             }
             pushConfig_ = value;
    -        onChanged();
           } else {
             pushConfigBuilder_.setMessage(value);
           }
    -
    +      bitField0_ |= 0x00000002;
    +      onChanged();
           return this;
         }
    +
         /**
          *
          *
          * 
          * Required. The push configuration for future deliveries.
    +     *
          * An empty `pushConfig` indicates that the Pub/Sub system should
          * stop pushing messages from the given subscription and allow
          * messages to be pulled and acknowledged - effectively pausing
    @@ -801,18 +778,20 @@ public Builder setPushConfig(com.google.pubsub.v1.PushConfig value) {
         public Builder setPushConfig(com.google.pubsub.v1.PushConfig.Builder builderForValue) {
           if (pushConfigBuilder_ == null) {
             pushConfig_ = builderForValue.build();
    -        onChanged();
           } else {
             pushConfigBuilder_.setMessage(builderForValue.build());
           }
    -
    +      bitField0_ |= 0x00000002;
    +      onChanged();
           return this;
         }
    +
         /**
          *
          *
          * 
          * Required. The push configuration for future deliveries.
    +     *
          * An empty `pushConfig` indicates that the Pub/Sub system should
          * stop pushing messages from the given subscription and allow
          * messages to be pulled and acknowledged - effectively pausing
    @@ -824,26 +803,29 @@ public Builder setPushConfig(com.google.pubsub.v1.PushConfig.Builder builderForV
          */
         public Builder mergePushConfig(com.google.pubsub.v1.PushConfig value) {
           if (pushConfigBuilder_ == null) {
    -        if (pushConfig_ != null) {
    -          pushConfig_ =
    -              com.google.pubsub.v1.PushConfig.newBuilder(pushConfig_)
    -                  .mergeFrom(value)
    -                  .buildPartial();
    +        if (((bitField0_ & 0x00000002) != 0)
    +            && pushConfig_ != null
    +            && pushConfig_ != com.google.pubsub.v1.PushConfig.getDefaultInstance()) {
    +          getPushConfigBuilder().mergeFrom(value);
             } else {
               pushConfig_ = value;
             }
    -        onChanged();
           } else {
             pushConfigBuilder_.mergeFrom(value);
           }
    -
    +      if (pushConfig_ != null) {
    +        bitField0_ |= 0x00000002;
    +        onChanged();
    +      }
           return this;
         }
    +
         /**
          *
          *
          * 
          * Required. The push configuration for future deliveries.
    +     *
          * An empty `pushConfig` indicates that the Pub/Sub system should
          * stop pushing messages from the given subscription and allow
          * messages to be pulled and acknowledged - effectively pausing
    @@ -854,21 +836,22 @@ public Builder mergePushConfig(com.google.pubsub.v1.PushConfig value) {
          * 
          */
         public Builder clearPushConfig() {
    -      if (pushConfigBuilder_ == null) {
    -        pushConfig_ = null;
    -        onChanged();
    -      } else {
    -        pushConfig_ = null;
    +      bitField0_ = (bitField0_ & ~0x00000002);
    +      pushConfig_ = null;
    +      if (pushConfigBuilder_ != null) {
    +        pushConfigBuilder_.dispose();
             pushConfigBuilder_ = null;
           }
    -
    +      onChanged();
           return this;
         }
    +
         /**
          *
          *
          * 
          * Required. The push configuration for future deliveries.
    +     *
          * An empty `pushConfig` indicates that the Pub/Sub system should
          * stop pushing messages from the given subscription and allow
          * messages to be pulled and acknowledged - effectively pausing
    @@ -879,15 +862,17 @@ public Builder clearPushConfig() {
          * 
          */
         public com.google.pubsub.v1.PushConfig.Builder getPushConfigBuilder() {
    -
    +      bitField0_ |= 0x00000002;
           onChanged();
    -      return getPushConfigFieldBuilder().getBuilder();
    +      return internalGetPushConfigFieldBuilder().getBuilder();
         }
    +
         /**
          *
          *
          * 
          * Required. The push configuration for future deliveries.
    +     *
          * An empty `pushConfig` indicates that the Pub/Sub system should
          * stop pushing messages from the given subscription and allow
          * messages to be pulled and acknowledged - effectively pausing
    @@ -906,11 +891,13 @@ public com.google.pubsub.v1.PushConfigOrBuilder getPushConfigOrBuilder() {
                 : pushConfig_;
           }
         }
    +
         /**
          *
          *
          * 
          * Required. The push configuration for future deliveries.
    +     *
          * An empty `pushConfig` indicates that the Pub/Sub system should
          * stop pushing messages from the given subscription and allow
          * messages to be pulled and acknowledged - effectively pausing
    @@ -920,14 +907,14 @@ public com.google.pubsub.v1.PushConfigOrBuilder getPushConfigOrBuilder() {
          * .google.pubsub.v1.PushConfig push_config = 2 [(.google.api.field_behavior) = REQUIRED];
          * 
          */
    -    private com.google.protobuf.SingleFieldBuilderV3<
    +    private com.google.protobuf.SingleFieldBuilder<
                 com.google.pubsub.v1.PushConfig,
                 com.google.pubsub.v1.PushConfig.Builder,
                 com.google.pubsub.v1.PushConfigOrBuilder>
    -        getPushConfigFieldBuilder() {
    +        internalGetPushConfigFieldBuilder() {
           if (pushConfigBuilder_ == null) {
             pushConfigBuilder_ =
    -            new com.google.protobuf.SingleFieldBuilderV3<
    +            new com.google.protobuf.SingleFieldBuilder<
                     com.google.pubsub.v1.PushConfig,
                     com.google.pubsub.v1.PushConfig.Builder,
                     com.google.pubsub.v1.PushConfigOrBuilder>(
    @@ -937,17 +924,6 @@ public com.google.pubsub.v1.PushConfigOrBuilder getPushConfigOrBuilder() {
           return pushConfigBuilder_;
         }
     
    -    @java.lang.Override
    -    public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) {
    -      return super.setUnknownFields(unknownFields);
    -    }
    -
    -    @java.lang.Override
    -    public final Builder mergeUnknownFields(
    -        final com.google.protobuf.UnknownFieldSet unknownFields) {
    -      return super.mergeUnknownFields(unknownFields);
    -    }
    -
         // @@protoc_insertion_point(builder_scope:google.pubsub.v1.ModifyPushConfigRequest)
       }
     
    @@ -969,7 +945,18 @@ public ModifyPushConfigRequest parsePartialFrom(
                 com.google.protobuf.CodedInputStream input,
                 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                 throws com.google.protobuf.InvalidProtocolBufferException {
    -          return new ModifyPushConfigRequest(input, extensionRegistry);
    +          Builder builder = newBuilder();
    +          try {
    +            builder.mergeFrom(input, extensionRegistry);
    +          } catch (com.google.protobuf.InvalidProtocolBufferException e) {
    +            throw e.setUnfinishedMessage(builder.buildPartial());
    +          } catch (com.google.protobuf.UninitializedMessageException e) {
    +            throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
    +          } catch (java.io.IOException e) {
    +            throw new com.google.protobuf.InvalidProtocolBufferException(e)
    +                .setUnfinishedMessage(builder.buildPartial());
    +          }
    +          return builder.buildPartial();
             }
           };
     
    diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ModifyPushConfigRequestOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ModifyPushConfigRequestOrBuilder.java
    index 10a208c31..25f579d74 100644
    --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ModifyPushConfigRequestOrBuilder.java
    +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ModifyPushConfigRequestOrBuilder.java
    @@ -1,5 +1,5 @@
     /*
    - * Copyright 2020 Google LLC
    + * Copyright 2026 Google LLC
      *
      * Licensed under the Apache License, Version 2.0 (the "License");
      * you may not use this file except in compliance with the License.
    @@ -14,10 +14,13 @@
      * limitations under the License.
      */
     // Generated by the protocol buffer compiler.  DO NOT EDIT!
    +// NO CHECKED-IN PROTOBUF GENCODE
     // source: google/pubsub/v1/pubsub.proto
    +// Protobuf Java Version: 4.33.2
     
     package com.google.pubsub.v1;
     
    +@com.google.protobuf.Generated
     public interface ModifyPushConfigRequestOrBuilder
         extends
         // @@protoc_insertion_point(interface_extends:google.pubsub.v1.ModifyPushConfigRequest)
    @@ -38,6 +41,7 @@ public interface ModifyPushConfigRequestOrBuilder
        * @return The subscription.
        */
       java.lang.String getSubscription();
    +
       /**
        *
        *
    @@ -59,6 +63,7 @@ public interface ModifyPushConfigRequestOrBuilder
        *
        * 
        * Required. The push configuration for future deliveries.
    +   *
        * An empty `pushConfig` indicates that the Pub/Sub system should
        * stop pushing messages from the given subscription and allow
        * messages to be pulled and acknowledged - effectively pausing
    @@ -71,11 +76,13 @@ public interface ModifyPushConfigRequestOrBuilder
        * @return Whether the pushConfig field is set.
        */
       boolean hasPushConfig();
    +
       /**
        *
        *
        * 
        * Required. The push configuration for future deliveries.
    +   *
        * An empty `pushConfig` indicates that the Pub/Sub system should
        * stop pushing messages from the given subscription and allow
        * messages to be pulled and acknowledged - effectively pausing
    @@ -88,11 +95,13 @@ public interface ModifyPushConfigRequestOrBuilder
        * @return The pushConfig.
        */
       com.google.pubsub.v1.PushConfig getPushConfig();
    +
       /**
        *
        *
        * 
        * Required. The push configuration for future deliveries.
    +   *
        * An empty `pushConfig` indicates that the Pub/Sub system should
        * stop pushing messages from the given subscription and allow
        * messages to be pulled and acknowledged - effectively pausing
    diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PlatformLogsSettings.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PlatformLogsSettings.java
    new file mode 100644
    index 000000000..1135d99de
    --- /dev/null
    +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PlatformLogsSettings.java
    @@ -0,0 +1,819 @@
    +/*
    + * Copyright 2026 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.
    + */
    +// Generated by the protocol buffer compiler.  DO NOT EDIT!
    +// NO CHECKED-IN PROTOBUF GENCODE
    +// source: google/pubsub/v1/pubsub.proto
    +// Protobuf Java Version: 4.33.2
    +
    +package com.google.pubsub.v1;
    +
    +/**
    + *
    + *
    + * 
    + * Settings for Platform Logs produced by Pub/Sub.
    + * 
    + * + * Protobuf type {@code google.pubsub.v1.PlatformLogsSettings} + */ +@com.google.protobuf.Generated +public final class PlatformLogsSettings extends com.google.protobuf.GeneratedMessage + implements + // @@protoc_insertion_point(message_implements:google.pubsub.v1.PlatformLogsSettings) + PlatformLogsSettingsOrBuilder { + private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "PlatformLogsSettings"); + } + + // Use PlatformLogsSettings.newBuilder() to construct. + private PlatformLogsSettings(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + + private PlatformLogsSettings() { + severity_ = 0; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_PlatformLogsSettings_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_PlatformLogsSettings_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.PlatformLogsSettings.class, + com.google.pubsub.v1.PlatformLogsSettings.Builder.class); + } + + /** + * + * + *
    +   * Severity levels of Platform Logs.
    +   * 
    + * + * Protobuf enum {@code google.pubsub.v1.PlatformLogsSettings.Severity} + */ + public enum Severity implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
    +     * Default value. Logs level is unspecified. Logs will be disabled.
    +     * 
    + * + * SEVERITY_UNSPECIFIED = 0; + */ + SEVERITY_UNSPECIFIED(0), + /** + * + * + *
    +     * Logs will be disabled.
    +     * 
    + * + * DISABLED = 1; + */ + DISABLED(1), + /** + * + * + *
    +     * Debug logs and higher-severity logs will be written.
    +     * 
    + * + * DEBUG = 2; + */ + DEBUG(2), + /** + * + * + *
    +     * Info logs and higher-severity logs will be written.
    +     * 
    + * + * INFO = 3; + */ + INFO(3), + /** + * + * + *
    +     * Warning logs and higher-severity logs will be written.
    +     * 
    + * + * WARNING = 4; + */ + WARNING(4), + /** + * + * + *
    +     * Only error logs will be written.
    +     * 
    + * + * ERROR = 5; + */ + ERROR(5), + UNRECOGNIZED(-1), + ; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "Severity"); + } + + /** + * + * + *
    +     * Default value. Logs level is unspecified. Logs will be disabled.
    +     * 
    + * + * SEVERITY_UNSPECIFIED = 0; + */ + public static final int SEVERITY_UNSPECIFIED_VALUE = 0; + + /** + * + * + *
    +     * Logs will be disabled.
    +     * 
    + * + * DISABLED = 1; + */ + public static final int DISABLED_VALUE = 1; + + /** + * + * + *
    +     * Debug logs and higher-severity logs will be written.
    +     * 
    + * + * DEBUG = 2; + */ + public static final int DEBUG_VALUE = 2; + + /** + * + * + *
    +     * Info logs and higher-severity logs will be written.
    +     * 
    + * + * INFO = 3; + */ + public static final int INFO_VALUE = 3; + + /** + * + * + *
    +     * Warning logs and higher-severity logs will be written.
    +     * 
    + * + * WARNING = 4; + */ + public static final int WARNING_VALUE = 4; + + /** + * + * + *
    +     * Only error logs will be written.
    +     * 
    + * + * ERROR = 5; + */ + public static final int ERROR_VALUE = 5; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static Severity valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static Severity forNumber(int value) { + switch (value) { + case 0: + return SEVERITY_UNSPECIFIED; + case 1: + return DISABLED; + case 2: + return DEBUG; + case 3: + return INFO; + case 4: + return WARNING; + case 5: + return ERROR; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public Severity findValueByNumber(int number) { + return Severity.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.pubsub.v1.PlatformLogsSettings.getDescriptor().getEnumTypes().get(0); + } + + private static final Severity[] VALUES = values(); + + public static Severity valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private Severity(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.pubsub.v1.PlatformLogsSettings.Severity) + } + + public static final int SEVERITY_FIELD_NUMBER = 1; + private int severity_ = 0; + + /** + * + * + *
    +   * Optional. The minimum severity level of Platform Logs that will be written.
    +   * 
    + * + * + * .google.pubsub.v1.PlatformLogsSettings.Severity severity = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The enum numeric value on the wire for severity. + */ + @java.lang.Override + public int getSeverityValue() { + return severity_; + } + + /** + * + * + *
    +   * Optional. The minimum severity level of Platform Logs that will be written.
    +   * 
    + * + * + * .google.pubsub.v1.PlatformLogsSettings.Severity severity = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The severity. + */ + @java.lang.Override + public com.google.pubsub.v1.PlatformLogsSettings.Severity getSeverity() { + com.google.pubsub.v1.PlatformLogsSettings.Severity result = + com.google.pubsub.v1.PlatformLogsSettings.Severity.forNumber(severity_); + return result == null + ? com.google.pubsub.v1.PlatformLogsSettings.Severity.UNRECOGNIZED + : result; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (severity_ + != com.google.pubsub.v1.PlatformLogsSettings.Severity.SEVERITY_UNSPECIFIED.getNumber()) { + output.writeEnum(1, severity_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (severity_ + != com.google.pubsub.v1.PlatformLogsSettings.Severity.SEVERITY_UNSPECIFIED.getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, severity_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.pubsub.v1.PlatformLogsSettings)) { + return super.equals(obj); + } + com.google.pubsub.v1.PlatformLogsSettings other = + (com.google.pubsub.v1.PlatformLogsSettings) obj; + + if (severity_ != other.severity_) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + SEVERITY_FIELD_NUMBER; + hash = (53 * hash) + severity_; + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.pubsub.v1.PlatformLogsSettings parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.PlatformLogsSettings parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.PlatformLogsSettings parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.PlatformLogsSettings parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.PlatformLogsSettings parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.PlatformLogsSettings parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.PlatformLogsSettings parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.PlatformLogsSettings parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.PlatformLogsSettings parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.PlatformLogsSettings parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.PlatformLogsSettings parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.PlatformLogsSettings parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.pubsub.v1.PlatformLogsSettings prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + + /** + * + * + *
    +   * Settings for Platform Logs produced by Pub/Sub.
    +   * 
    + * + * Protobuf type {@code google.pubsub.v1.PlatformLogsSettings} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder + implements + // @@protoc_insertion_point(builder_implements:google.pubsub.v1.PlatformLogsSettings) + com.google.pubsub.v1.PlatformLogsSettingsOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_PlatformLogsSettings_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_PlatformLogsSettings_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.PlatformLogsSettings.class, + com.google.pubsub.v1.PlatformLogsSettings.Builder.class); + } + + // Construct using com.google.pubsub.v1.PlatformLogsSettings.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + severity_ = 0; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_PlatformLogsSettings_descriptor; + } + + @java.lang.Override + public com.google.pubsub.v1.PlatformLogsSettings getDefaultInstanceForType() { + return com.google.pubsub.v1.PlatformLogsSettings.getDefaultInstance(); + } + + @java.lang.Override + public com.google.pubsub.v1.PlatformLogsSettings build() { + com.google.pubsub.v1.PlatformLogsSettings result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.pubsub.v1.PlatformLogsSettings buildPartial() { + com.google.pubsub.v1.PlatformLogsSettings result = + new com.google.pubsub.v1.PlatformLogsSettings(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.pubsub.v1.PlatformLogsSettings result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.severity_ = severity_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.pubsub.v1.PlatformLogsSettings) { + return mergeFrom((com.google.pubsub.v1.PlatformLogsSettings) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.pubsub.v1.PlatformLogsSettings other) { + if (other == com.google.pubsub.v1.PlatformLogsSettings.getDefaultInstance()) return this; + if (other.severity_ != 0) { + setSeverityValue(other.getSeverityValue()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: + { + severity_ = input.readEnum(); + bitField0_ |= 0x00000001; + break; + } // case 8 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private int severity_ = 0; + + /** + * + * + *
    +     * Optional. The minimum severity level of Platform Logs that will be written.
    +     * 
    + * + * + * .google.pubsub.v1.PlatformLogsSettings.Severity severity = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The enum numeric value on the wire for severity. + */ + @java.lang.Override + public int getSeverityValue() { + return severity_; + } + + /** + * + * + *
    +     * Optional. The minimum severity level of Platform Logs that will be written.
    +     * 
    + * + * + * .google.pubsub.v1.PlatformLogsSettings.Severity severity = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param value The enum numeric value on the wire for severity to set. + * @return This builder for chaining. + */ + public Builder setSeverityValue(int value) { + severity_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Optional. The minimum severity level of Platform Logs that will be written.
    +     * 
    + * + * + * .google.pubsub.v1.PlatformLogsSettings.Severity severity = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The severity. + */ + @java.lang.Override + public com.google.pubsub.v1.PlatformLogsSettings.Severity getSeverity() { + com.google.pubsub.v1.PlatformLogsSettings.Severity result = + com.google.pubsub.v1.PlatformLogsSettings.Severity.forNumber(severity_); + return result == null + ? com.google.pubsub.v1.PlatformLogsSettings.Severity.UNRECOGNIZED + : result; + } + + /** + * + * + *
    +     * Optional. The minimum severity level of Platform Logs that will be written.
    +     * 
    + * + * + * .google.pubsub.v1.PlatformLogsSettings.Severity severity = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param value The severity to set. + * @return This builder for chaining. + */ + public Builder setSeverity(com.google.pubsub.v1.PlatformLogsSettings.Severity value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + severity_ = value.getNumber(); + onChanged(); + return this; + } + + /** + * + * + *
    +     * Optional. The minimum severity level of Platform Logs that will be written.
    +     * 
    + * + * + * .google.pubsub.v1.PlatformLogsSettings.Severity severity = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return This builder for chaining. + */ + public Builder clearSeverity() { + bitField0_ = (bitField0_ & ~0x00000001); + severity_ = 0; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:google.pubsub.v1.PlatformLogsSettings) + } + + // @@protoc_insertion_point(class_scope:google.pubsub.v1.PlatformLogsSettings) + private static final com.google.pubsub.v1.PlatformLogsSettings DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.pubsub.v1.PlatformLogsSettings(); + } + + public static com.google.pubsub.v1.PlatformLogsSettings getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public PlatformLogsSettings parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.pubsub.v1.PlatformLogsSettings getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PlatformLogsSettingsOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PlatformLogsSettingsOrBuilder.java new file mode 100644 index 000000000..e01f7b068 --- /dev/null +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PlatformLogsSettingsOrBuilder.java @@ -0,0 +1,58 @@ +/* + * Copyright 2026 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 + +package com.google.pubsub.v1; + +@com.google.protobuf.Generated +public interface PlatformLogsSettingsOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.pubsub.v1.PlatformLogsSettings) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
    +   * Optional. The minimum severity level of Platform Logs that will be written.
    +   * 
    + * + * + * .google.pubsub.v1.PlatformLogsSettings.Severity severity = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The enum numeric value on the wire for severity. + */ + int getSeverityValue(); + + /** + * + * + *
    +   * Optional. The minimum severity level of Platform Logs that will be written.
    +   * 
    + * + * + * .google.pubsub.v1.PlatformLogsSettings.Severity severity = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The severity. + */ + com.google.pubsub.v1.PlatformLogsSettings.Severity getSeverity(); +} diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ProjectName.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ProjectName.java index 42c0ab61f..a4f599b17 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ProjectName.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ProjectName.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 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 + * 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, @@ -23,18 +23,26 @@ 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 */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class ProjectName implements ResourceName { - - private static final PathTemplate PATH_TEMPLATE = + private static final PathTemplate PROJECT = PathTemplate.createWithoutUrlEncoding("projects/{project}"); - private volatile Map fieldValuesMap; - private final String project; + @Deprecated + protected ProjectName() { + project = null; + } + + private ProjectName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + } + public String getProject() { return project; } @@ -47,10 +55,6 @@ public Builder toBuilder() { return new Builder(this); } - private ProjectName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - } - public static ProjectName of(String project) { return newBuilder().setProject(project).build(); } @@ -64,7 +68,7 @@ public static ProjectName parse(String formattedString) { return null; } Map matchMap = - PATH_TEMPLATE.validatedMatch( + PROJECT.validatedMatch( formattedString, "ProjectName.parse: formattedString not in valid format"); return of(matchMap.get("project")); } @@ -78,7 +82,7 @@ public static List parseList(List formattedStrings) { } public static List toStringList(List values) { - List list = new ArrayList(values.size()); + List list = new ArrayList<>(values.size()); for (ProjectName value : values) { if (value == null) { list.add(""); @@ -90,15 +94,18 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PATH_TEMPLATE.matches(formattedString); + return PROJECT.matches(formattedString); } + @Override public Map getFieldValuesMap() { if (fieldValuesMap == null) { synchronized (this) { if (fieldValuesMap == null) { ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); - fieldMapBuilder.put("project", project); + if (project != null) { + fieldMapBuilder.put("project", project); + } fieldValuesMap = fieldMapBuilder.build(); } } @@ -112,14 +119,35 @@ public String getFieldValue(String fieldName) { @Override public String toString() { - return PATH_TEMPLATE.instantiate("project", project); + return PROJECT.instantiate("project", project); } - /** Builder for ProjectName. */ - public static class Builder { + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null && getClass() == o.getClass()) { + ProjectName that = ((ProjectName) o); + return Objects.equals(this.project, that.project); + } + return false; + } + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + return h; + } + + /** Builder for projects/{project}. */ + public static class Builder { private String project; + protected Builder() {} + public String getProject() { return project; } @@ -129,34 +157,12 @@ public Builder setProject(String project) { return this; } - private Builder() {} - private Builder(ProjectName projectName) { - project = projectName.project; + this.project = projectName.project; } public ProjectName build() { return new ProjectName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o instanceof ProjectName) { - ProjectName that = (ProjectName) o; - return (this.project.equals(that.project)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= project.hashCode(); - return h; - } } diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ProjectTopicName.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ProjectTopicName.java index abfffb2ee..6f0a86d37 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ProjectTopicName.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ProjectTopicName.java @@ -19,8 +19,6 @@ import com.google.api.pathtemplate.PathTemplate; import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableMap; -import java.util.ArrayList; -import java.util.List; import java.util.Map; /** AUTO-GENERATED DOCUMENTATION AND CLASS */ @@ -74,26 +72,6 @@ public static ProjectTopicName parse(String formattedString) { return of(matchMap.get("project"), matchMap.get("topic")); } - 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 (ProjectTopicName value : values) { - if (value == null) { - list.add(""); - } else { - list.add(value.toString()); - } - } - return list; - } - public static boolean isParsableFrom(String formattedString) { return PATH_TEMPLATE.matches(formattedString); } diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PublishRequest.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PublishRequest.java index f255ee55b..a98f3bd07 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PublishRequest.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PublishRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; @@ -27,13 +29,25 @@ * * Protobuf type {@code google.pubsub.v1.PublishRequest} */ -public final class PublishRequest extends com.google.protobuf.GeneratedMessageV3 +@com.google.protobuf.Generated +public final class PublishRequest extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:google.pubsub.v1.PublishRequest) PublishRequestOrBuilder { private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "PublishRequest"); + } + // Use PublishRequest.newBuilder() to construct. - private PublishRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + private PublishRequest(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); } @@ -42,83 +56,13 @@ private PublishRequest() { messages_ = java.util.Collections.emptyList(); } - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new PublishRequest(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - private PublishRequest( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - java.lang.String s = input.readStringRequireUtf8(); - - topic_ = s; - break; - } - case 18: - { - if (!((mutable_bitField0_ & 0x00000001) != 0)) { - messages_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000001; - } - messages_.add( - input.readMessage( - com.google.pubsub.v1.PubsubMessage.parser(), extensionRegistry)); - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000001) != 0)) { - messages_ = java.util.Collections.unmodifiableList(messages_); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_PublishRequest_descriptor; } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_PublishRequest_fieldAccessorTable @@ -128,7 +72,10 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } public static final int TOPIC_FIELD_NUMBER = 1; - private volatile java.lang.Object topic_; + + @SuppressWarnings("serial") + private volatile java.lang.Object topic_ = ""; + /** * * @@ -155,6 +102,7 @@ public java.lang.String getTopic() { return s; } } + /** * * @@ -183,7 +131,10 @@ public com.google.protobuf.ByteString getTopicBytes() { } public static final int MESSAGES_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") private java.util.List messages_; + /** * * @@ -199,6 +150,7 @@ public com.google.protobuf.ByteString getTopicBytes() { public java.util.List getMessagesList() { return messages_; } + /** * * @@ -215,6 +167,7 @@ public java.util.List getMessagesList() { getMessagesOrBuilderList() { return messages_; } + /** * * @@ -230,6 +183,7 @@ public java.util.List getMessagesList() { public int getMessagesCount() { return messages_.size(); } + /** * * @@ -245,6 +199,7 @@ public int getMessagesCount() { public com.google.pubsub.v1.PubsubMessage getMessages(int index) { return messages_.get(index); } + /** * * @@ -275,13 +230,13 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!getTopicBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, topic_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(topic_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, topic_); } for (int i = 0; i < messages_.size(); i++) { output.writeMessage(2, messages_.get(i)); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -290,13 +245,13 @@ public int getSerializedSize() { if (size != -1) return size; size = 0; - if (!getTopicBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, topic_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(topic_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, topic_); } for (int i = 0; i < messages_.size(); i++) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, messages_.get(i)); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -313,7 +268,7 @@ public boolean equals(final java.lang.Object obj) { if (!getTopic().equals(other.getTopic())) return false; if (!getMessagesList().equals(other.getMessagesList())) return false; - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -330,7 +285,7 @@ public int hashCode() { hash = (37 * hash) + MESSAGES_FIELD_NUMBER; hash = (53 * hash) + getMessagesList().hashCode(); } - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -371,38 +326,38 @@ public static com.google.pubsub.v1.PublishRequest parseFrom( public static com.google.pubsub.v1.PublishRequest parseFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.PublishRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.PublishRequest parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); } public static com.google.pubsub.v1.PublishRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.PublishRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.PublishRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } @@ -425,10 +380,11 @@ public Builder toBuilder() { } @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** * * @@ -438,7 +394,7 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build * * Protobuf type {@code google.pubsub.v1.PublishRequest} */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements // @@protoc_insertion_point(builder_implements:google.pubsub.v1.PublishRequest) com.google.pubsub.v1.PublishRequestOrBuilder { @@ -448,7 +404,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_PublishRequest_fieldAccessorTable @@ -458,32 +414,24 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } // Construct using com.google.pubsub.v1.PublishRequest.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } + private Builder() {} - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { - getMessagesFieldBuilder(); - } } @java.lang.Override public Builder clear() { super.clear(); + bitField0_ = 0; topic_ = ""; - if (messagesBuilder_ == null) { messages_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); } else { + messages_ = null; messagesBuilder_.clear(); } + bitField0_ = (bitField0_ & ~0x00000002); return this; } @@ -510,52 +458,31 @@ public com.google.pubsub.v1.PublishRequest build() { @java.lang.Override public com.google.pubsub.v1.PublishRequest buildPartial() { com.google.pubsub.v1.PublishRequest result = new com.google.pubsub.v1.PublishRequest(this); - int from_bitField0_ = bitField0_; - result.topic_ = topic_; + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields(com.google.pubsub.v1.PublishRequest result) { if (messagesBuilder_ == null) { - if (((bitField0_ & 0x00000001) != 0)) { + if (((bitField0_ & 0x00000002) != 0)) { messages_ = java.util.Collections.unmodifiableList(messages_); - bitField0_ = (bitField0_ & ~0x00000001); + bitField0_ = (bitField0_ & ~0x00000002); } result.messages_ = messages_; } else { result.messages_ = messagesBuilder_.build(); } - onBuilt(); - return result; - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); } - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); + private void buildPartial0(com.google.pubsub.v1.PublishRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.topic_ = topic_; + } } @java.lang.Override @@ -572,13 +499,14 @@ public Builder mergeFrom(com.google.pubsub.v1.PublishRequest other) { if (other == com.google.pubsub.v1.PublishRequest.getDefaultInstance()) return this; if (!other.getTopic().isEmpty()) { topic_ = other.topic_; + bitField0_ |= 0x00000001; onChanged(); } if (messagesBuilder_ == null) { if (!other.messages_.isEmpty()) { if (messages_.isEmpty()) { messages_ = other.messages_; - bitField0_ = (bitField0_ & ~0x00000001); + bitField0_ = (bitField0_ & ~0x00000002); } else { ensureMessagesIsMutable(); messages_.addAll(other.messages_); @@ -591,17 +519,17 @@ public Builder mergeFrom(com.google.pubsub.v1.PublishRequest other) { messagesBuilder_.dispose(); messagesBuilder_ = null; messages_ = other.messages_; - bitField0_ = (bitField0_ & ~0x00000001); + bitField0_ = (bitField0_ & ~0x00000002); messagesBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders - ? getMessagesFieldBuilder() + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders + ? internalGetMessagesFieldBuilder() : null; } else { messagesBuilder_.addAllMessages(other.messages_); } } } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -616,23 +544,57 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.pubsub.v1.PublishRequest parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + topic_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + com.google.pubsub.v1.PubsubMessage m = + input.readMessage( + com.google.pubsub.v1.PubsubMessage.parser(), extensionRegistry); + if (messagesBuilder_ == null) { + ensureMessagesIsMutable(); + messages_.add(m); + } else { + messagesBuilder_.addMessage(m); + } + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.google.pubsub.v1.PublishRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } private int bitField0_; private java.lang.Object topic_ = ""; + /** * * @@ -658,6 +620,7 @@ public java.lang.String getTopic() { return (java.lang.String) ref; } } + /** * * @@ -683,6 +646,7 @@ public com.google.protobuf.ByteString getTopicBytes() { return (com.google.protobuf.ByteString) ref; } } + /** * * @@ -702,11 +666,12 @@ public Builder setTopic(java.lang.String value) { if (value == null) { throw new NullPointerException(); } - topic_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } + /** * * @@ -722,11 +687,12 @@ public Builder setTopic(java.lang.String value) { * @return This builder for chaining. */ public Builder clearTopic() { - topic_ = getDefaultInstance().getTopic(); + bitField0_ = (bitField0_ & ~0x00000001); onChanged(); return this; } + /** * * @@ -747,8 +713,8 @@ public Builder setTopicBytes(com.google.protobuf.ByteString value) { throw new NullPointerException(); } checkByteStringIsUtf8(value); - topic_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } @@ -757,13 +723,13 @@ public Builder setTopicBytes(com.google.protobuf.ByteString value) { java.util.Collections.emptyList(); private void ensureMessagesIsMutable() { - if (!((bitField0_ & 0x00000001) != 0)) { + if (!((bitField0_ & 0x00000002) != 0)) { messages_ = new java.util.ArrayList(messages_); - bitField0_ |= 0x00000001; + bitField0_ |= 0x00000002; } } - private com.google.protobuf.RepeatedFieldBuilderV3< + private com.google.protobuf.RepeatedFieldBuilder< com.google.pubsub.v1.PubsubMessage, com.google.pubsub.v1.PubsubMessage.Builder, com.google.pubsub.v1.PubsubMessageOrBuilder> @@ -787,6 +753,7 @@ public java.util.List getMessagesList() { return messagesBuilder_.getMessageList(); } } + /** * * @@ -805,6 +772,7 @@ public int getMessagesCount() { return messagesBuilder_.getCount(); } } + /** * * @@ -823,6 +791,7 @@ public com.google.pubsub.v1.PubsubMessage getMessages(int index) { return messagesBuilder_.getMessage(index); } } + /** * * @@ -847,6 +816,7 @@ public Builder setMessages(int index, com.google.pubsub.v1.PubsubMessage value) } return this; } + /** * * @@ -869,6 +839,7 @@ public Builder setMessages( } return this; } + /** * * @@ -893,6 +864,7 @@ public Builder addMessages(com.google.pubsub.v1.PubsubMessage value) { } return this; } + /** * * @@ -917,6 +889,7 @@ public Builder addMessages(int index, com.google.pubsub.v1.PubsubMessage value) } return this; } + /** * * @@ -938,6 +911,7 @@ public Builder addMessages(com.google.pubsub.v1.PubsubMessage.Builder builderFor } return this; } + /** * * @@ -960,6 +934,7 @@ public Builder addMessages( } return this; } + /** * * @@ -982,6 +957,7 @@ public Builder addAllMessages( } return this; } + /** * * @@ -996,13 +972,14 @@ public Builder addAllMessages( public Builder clearMessages() { if (messagesBuilder_ == null) { messages_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); + bitField0_ = (bitField0_ & ~0x00000002); onChanged(); } else { messagesBuilder_.clear(); } return this; } + /** * * @@ -1024,6 +1001,7 @@ public Builder removeMessages(int index) { } return this; } + /** * * @@ -1036,8 +1014,9 @@ public Builder removeMessages(int index) { * */ public com.google.pubsub.v1.PubsubMessage.Builder getMessagesBuilder(int index) { - return getMessagesFieldBuilder().getBuilder(index); + return internalGetMessagesFieldBuilder().getBuilder(index); } + /** * * @@ -1056,6 +1035,7 @@ public com.google.pubsub.v1.PubsubMessageOrBuilder getMessagesOrBuilder(int inde return messagesBuilder_.getMessageOrBuilder(index); } } + /** * * @@ -1075,6 +1055,7 @@ public com.google.pubsub.v1.PubsubMessageOrBuilder getMessagesOrBuilder(int inde return java.util.Collections.unmodifiableList(messages_); } } + /** * * @@ -1087,9 +1068,10 @@ public com.google.pubsub.v1.PubsubMessageOrBuilder getMessagesOrBuilder(int inde * */ public com.google.pubsub.v1.PubsubMessage.Builder addMessagesBuilder() { - return getMessagesFieldBuilder() + return internalGetMessagesFieldBuilder() .addBuilder(com.google.pubsub.v1.PubsubMessage.getDefaultInstance()); } + /** * * @@ -1102,9 +1084,10 @@ public com.google.pubsub.v1.PubsubMessage.Builder addMessagesBuilder() { * */ public com.google.pubsub.v1.PubsubMessage.Builder addMessagesBuilder(int index) { - return getMessagesFieldBuilder() + return internalGetMessagesFieldBuilder() .addBuilder(index, com.google.pubsub.v1.PubsubMessage.getDefaultInstance()); } + /** * * @@ -1117,37 +1100,26 @@ public com.google.pubsub.v1.PubsubMessage.Builder addMessagesBuilder(int index) * */ public java.util.List getMessagesBuilderList() { - return getMessagesFieldBuilder().getBuilderList(); + return internalGetMessagesFieldBuilder().getBuilderList(); } - private com.google.protobuf.RepeatedFieldBuilderV3< + private com.google.protobuf.RepeatedFieldBuilder< com.google.pubsub.v1.PubsubMessage, com.google.pubsub.v1.PubsubMessage.Builder, com.google.pubsub.v1.PubsubMessageOrBuilder> - getMessagesFieldBuilder() { + internalGetMessagesFieldBuilder() { if (messagesBuilder_ == null) { messagesBuilder_ = - new com.google.protobuf.RepeatedFieldBuilderV3< + new com.google.protobuf.RepeatedFieldBuilder< com.google.pubsub.v1.PubsubMessage, com.google.pubsub.v1.PubsubMessage.Builder, com.google.pubsub.v1.PubsubMessageOrBuilder>( - messages_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + messages_, ((bitField0_ & 0x00000002) != 0), getParentForChildren(), isClean()); messages_ = null; } return messagesBuilder_; } - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - // @@protoc_insertion_point(builder_scope:google.pubsub.v1.PublishRequest) } @@ -1169,7 +1141,18 @@ public PublishRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new PublishRequest(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PublishRequestOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PublishRequestOrBuilder.java index d233bca82..18f0e8e57 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PublishRequestOrBuilder.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PublishRequestOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; +@com.google.protobuf.Generated public interface PublishRequestOrBuilder extends // @@protoc_insertion_point(interface_extends:google.pubsub.v1.PublishRequest) @@ -38,6 +41,7 @@ public interface PublishRequestOrBuilder * @return The topic. */ java.lang.String getTopic(); + /** * * @@ -66,6 +70,7 @@ public interface PublishRequestOrBuilder * */ java.util.List getMessagesList(); + /** * * @@ -78,6 +83,7 @@ public interface PublishRequestOrBuilder * */ com.google.pubsub.v1.PubsubMessage getMessages(int index); + /** * * @@ -90,6 +96,7 @@ public interface PublishRequestOrBuilder * */ int getMessagesCount(); + /** * * @@ -102,6 +109,7 @@ public interface PublishRequestOrBuilder * */ java.util.List getMessagesOrBuilderList(); + /** * * diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PublishResponse.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PublishResponse.java index 750a74022..d00cf0040 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PublishResponse.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PublishResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; @@ -27,80 +29,30 @@ * * Protobuf type {@code google.pubsub.v1.PublishResponse} */ -public final class PublishResponse extends com.google.protobuf.GeneratedMessageV3 +@com.google.protobuf.Generated +public final class PublishResponse extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:google.pubsub.v1.PublishResponse) PublishResponseOrBuilder { private static final long serialVersionUID = 0L; - // Use PublishResponse.newBuilder() to construct. - private PublishResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - private PublishResponse() { - messageIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new PublishResponse(); + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "PublishResponse"); } - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; + // Use PublishResponse.newBuilder() to construct. + private PublishResponse(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); } - private PublishResponse( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - java.lang.String s = input.readStringRequireUtf8(); - if (!((mutable_bitField0_ & 0x00000001) != 0)) { - messageIds_ = new com.google.protobuf.LazyStringArrayList(); - mutable_bitField0_ |= 0x00000001; - } - messageIds_.add(s); - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000001) != 0)) { - messageIds_ = messageIds_.getUnmodifiableView(); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } + private PublishResponse() { + messageIds_ = com.google.protobuf.LazyStringArrayList.emptyList(); } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { @@ -109,7 +61,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_PublishResponse_fieldAccessorTable @@ -119,49 +71,55 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } public static final int MESSAGE_IDS_FIELD_NUMBER = 1; - private com.google.protobuf.LazyStringList messageIds_; + + @SuppressWarnings("serial") + private com.google.protobuf.LazyStringArrayList messageIds_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + /** * * *
    -   * The server-assigned ID of each published message, in the same order as
    -   * the messages in the request. IDs are guaranteed to be unique within
    -   * the topic.
    +   * Optional. The server-assigned ID of each published message, in the same
    +   * order as the messages in the request. IDs are guaranteed to be unique
    +   * within the topic.
        * 
    * - * repeated string message_ids = 1; + * repeated string message_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @return A list containing the messageIds. */ public com.google.protobuf.ProtocolStringList getMessageIdsList() { return messageIds_; } + /** * * *
    -   * The server-assigned ID of each published message, in the same order as
    -   * the messages in the request. IDs are guaranteed to be unique within
    -   * the topic.
    +   * Optional. The server-assigned ID of each published message, in the same
    +   * order as the messages in the request. IDs are guaranteed to be unique
    +   * within the topic.
        * 
    * - * repeated string message_ids = 1; + * repeated string message_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @return The count of messageIds. */ public int getMessageIdsCount() { return messageIds_.size(); } + /** * * *
    -   * The server-assigned ID of each published message, in the same order as
    -   * the messages in the request. IDs are guaranteed to be unique within
    -   * the topic.
    +   * Optional. The server-assigned ID of each published message, in the same
    +   * order as the messages in the request. IDs are guaranteed to be unique
    +   * within the topic.
        * 
    * - * repeated string message_ids = 1; + * repeated string message_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @param index The index of the element to return. * @return The messageIds at the given index. @@ -169,16 +127,17 @@ public int getMessageIdsCount() { public java.lang.String getMessageIds(int index) { return messageIds_.get(index); } + /** * * *
    -   * The server-assigned ID of each published message, in the same order as
    -   * the messages in the request. IDs are guaranteed to be unique within
    -   * the topic.
    +   * Optional. The server-assigned ID of each published message, in the same
    +   * order as the messages in the request. IDs are guaranteed to be unique
    +   * within the topic.
        * 
    * - * repeated string message_ids = 1; + * repeated string message_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @param index The index of the value to return. * @return The bytes of the messageIds at the given index. @@ -202,9 +161,9 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { for (int i = 0; i < messageIds_.size(); i++) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, messageIds_.getRaw(i)); + com.google.protobuf.GeneratedMessage.writeString(output, 1, messageIds_.getRaw(i)); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -221,7 +180,7 @@ public int getSerializedSize() { size += dataSize; size += 1 * getMessageIdsList().size(); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -237,7 +196,7 @@ public boolean equals(final java.lang.Object obj) { com.google.pubsub.v1.PublishResponse other = (com.google.pubsub.v1.PublishResponse) obj; if (!getMessageIdsList().equals(other.getMessageIdsList())) return false; - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -252,7 +211,7 @@ public int hashCode() { hash = (37 * hash) + MESSAGE_IDS_FIELD_NUMBER; hash = (53 * hash) + getMessageIdsList().hashCode(); } - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -293,38 +252,38 @@ public static com.google.pubsub.v1.PublishResponse parseFrom( public static com.google.pubsub.v1.PublishResponse parseFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.PublishResponse parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.PublishResponse parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); } public static com.google.pubsub.v1.PublishResponse parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.PublishResponse parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.PublishResponse parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } @@ -347,10 +306,11 @@ public Builder toBuilder() { } @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** * * @@ -360,7 +320,7 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build * * Protobuf type {@code google.pubsub.v1.PublishResponse} */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements // @@protoc_insertion_point(builder_implements:google.pubsub.v1.PublishResponse) com.google.pubsub.v1.PublishResponseOrBuilder { @@ -370,7 +330,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_PublishResponse_fieldAccessorTable @@ -380,24 +340,17 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } // Construct using com.google.pubsub.v1.PublishResponse.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } + private Builder() {} - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} } @java.lang.Override public Builder clear() { super.clear(); - messageIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; - bitField0_ = (bitField0_ & ~0x00000001); + bitField0_ = 0; + messageIds_ = com.google.protobuf.LazyStringArrayList.emptyList(); return this; } @@ -424,47 +377,19 @@ public com.google.pubsub.v1.PublishResponse build() { @java.lang.Override public com.google.pubsub.v1.PublishResponse buildPartial() { com.google.pubsub.v1.PublishResponse result = new com.google.pubsub.v1.PublishResponse(this); - int from_bitField0_ = bitField0_; - if (((bitField0_ & 0x00000001) != 0)) { - messageIds_ = messageIds_.getUnmodifiableView(); - bitField0_ = (bitField0_ & ~0x00000001); + if (bitField0_ != 0) { + buildPartial0(result); } - result.messageIds_ = messageIds_; onBuilt(); return result; } - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); + private void buildPartial0(com.google.pubsub.v1.PublishResponse result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + messageIds_.makeImmutable(); + result.messageIds_ = messageIds_; + } } @java.lang.Override @@ -482,14 +407,14 @@ public Builder mergeFrom(com.google.pubsub.v1.PublishResponse other) { if (!other.messageIds_.isEmpty()) { if (messageIds_.isEmpty()) { messageIds_ = other.messageIds_; - bitField0_ = (bitField0_ & ~0x00000001); + bitField0_ |= 0x00000001; } else { ensureMessageIdsIsMutable(); messageIds_.addAll(other.messageIds_); } onChanged(); } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -504,73 +429,98 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.pubsub.v1.PublishResponse parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + ensureMessageIdsIsMutable(); + messageIds_.add(s); + break; + } // case 10 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.google.pubsub.v1.PublishResponse) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } private int bitField0_; - private com.google.protobuf.LazyStringList messageIds_ = - com.google.protobuf.LazyStringArrayList.EMPTY; + private com.google.protobuf.LazyStringArrayList messageIds_ = + com.google.protobuf.LazyStringArrayList.emptyList(); private void ensureMessageIdsIsMutable() { - if (!((bitField0_ & 0x00000001) != 0)) { + if (!messageIds_.isModifiable()) { messageIds_ = new com.google.protobuf.LazyStringArrayList(messageIds_); - bitField0_ |= 0x00000001; } + bitField0_ |= 0x00000001; } + /** * * *
    -     * The server-assigned ID of each published message, in the same order as
    -     * the messages in the request. IDs are guaranteed to be unique within
    -     * the topic.
    +     * Optional. The server-assigned ID of each published message, in the same
    +     * order as the messages in the request. IDs are guaranteed to be unique
    +     * within the topic.
          * 
    * - * repeated string message_ids = 1; + * repeated string message_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @return A list containing the messageIds. */ public com.google.protobuf.ProtocolStringList getMessageIdsList() { - return messageIds_.getUnmodifiableView(); + messageIds_.makeImmutable(); + return messageIds_; } + /** * * *
    -     * The server-assigned ID of each published message, in the same order as
    -     * the messages in the request. IDs are guaranteed to be unique within
    -     * the topic.
    +     * Optional. The server-assigned ID of each published message, in the same
    +     * order as the messages in the request. IDs are guaranteed to be unique
    +     * within the topic.
          * 
    * - * repeated string message_ids = 1; + * repeated string message_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @return The count of messageIds. */ public int getMessageIdsCount() { return messageIds_.size(); } + /** * * *
    -     * The server-assigned ID of each published message, in the same order as
    -     * the messages in the request. IDs are guaranteed to be unique within
    -     * the topic.
    +     * Optional. The server-assigned ID of each published message, in the same
    +     * order as the messages in the request. IDs are guaranteed to be unique
    +     * within the topic.
          * 
    * - * repeated string message_ids = 1; + * repeated string message_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @param index The index of the element to return. * @return The messageIds at the given index. @@ -578,16 +528,17 @@ public int getMessageIdsCount() { public java.lang.String getMessageIds(int index) { return messageIds_.get(index); } + /** * * *
    -     * The server-assigned ID of each published message, in the same order as
    -     * the messages in the request. IDs are guaranteed to be unique within
    -     * the topic.
    +     * Optional. The server-assigned ID of each published message, in the same
    +     * order as the messages in the request. IDs are guaranteed to be unique
    +     * within the topic.
          * 
    * - * repeated string message_ids = 1; + * repeated string message_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @param index The index of the value to return. * @return The bytes of the messageIds at the given index. @@ -595,16 +546,17 @@ public java.lang.String getMessageIds(int index) { public com.google.protobuf.ByteString getMessageIdsBytes(int index) { return messageIds_.getByteString(index); } + /** * * *
    -     * The server-assigned ID of each published message, in the same order as
    -     * the messages in the request. IDs are guaranteed to be unique within
    -     * the topic.
    +     * Optional. The server-assigned ID of each published message, in the same
    +     * order as the messages in the request. IDs are guaranteed to be unique
    +     * within the topic.
          * 
    * - * repeated string message_ids = 1; + * repeated string message_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @param index The index to set the value at. * @param value The messageIds to set. @@ -616,19 +568,21 @@ public Builder setMessageIds(int index, java.lang.String value) { } ensureMessageIdsIsMutable(); messageIds_.set(index, value); + bitField0_ |= 0x00000001; onChanged(); return this; } + /** * * *
    -     * The server-assigned ID of each published message, in the same order as
    -     * the messages in the request. IDs are guaranteed to be unique within
    -     * the topic.
    +     * Optional. The server-assigned ID of each published message, in the same
    +     * order as the messages in the request. IDs are guaranteed to be unique
    +     * within the topic.
          * 
    * - * repeated string message_ids = 1; + * repeated string message_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @param value The messageIds to add. * @return This builder for chaining. @@ -639,19 +593,21 @@ public Builder addMessageIds(java.lang.String value) { } ensureMessageIdsIsMutable(); messageIds_.add(value); + bitField0_ |= 0x00000001; onChanged(); return this; } + /** * * *
    -     * The server-assigned ID of each published message, in the same order as
    -     * the messages in the request. IDs are guaranteed to be unique within
    -     * the topic.
    +     * Optional. The server-assigned ID of each published message, in the same
    +     * order as the messages in the request. IDs are guaranteed to be unique
    +     * within the topic.
          * 
    * - * repeated string message_ids = 1; + * repeated string message_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @param values The messageIds to add. * @return This builder for chaining. @@ -659,38 +615,42 @@ public Builder addMessageIds(java.lang.String value) { public Builder addAllMessageIds(java.lang.Iterable values) { ensureMessageIdsIsMutable(); com.google.protobuf.AbstractMessageLite.Builder.addAll(values, messageIds_); + bitField0_ |= 0x00000001; onChanged(); return this; } + /** * * *
    -     * The server-assigned ID of each published message, in the same order as
    -     * the messages in the request. IDs are guaranteed to be unique within
    -     * the topic.
    +     * Optional. The server-assigned ID of each published message, in the same
    +     * order as the messages in the request. IDs are guaranteed to be unique
    +     * within the topic.
          * 
    * - * repeated string message_ids = 1; + * repeated string message_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @return This builder for chaining. */ public Builder clearMessageIds() { - messageIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; + messageIds_ = com.google.protobuf.LazyStringArrayList.emptyList(); bitField0_ = (bitField0_ & ~0x00000001); + ; onChanged(); return this; } + /** * * *
    -     * The server-assigned ID of each published message, in the same order as
    -     * the messages in the request. IDs are guaranteed to be unique within
    -     * the topic.
    +     * Optional. The server-assigned ID of each published message, in the same
    +     * order as the messages in the request. IDs are guaranteed to be unique
    +     * within the topic.
          * 
    * - * repeated string message_ids = 1; + * repeated string message_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @param value The bytes of the messageIds to add. * @return This builder for chaining. @@ -702,21 +662,11 @@ public Builder addMessageIdsBytes(com.google.protobuf.ByteString value) { checkByteStringIsUtf8(value); ensureMessageIdsIsMutable(); messageIds_.add(value); + bitField0_ |= 0x00000001; onChanged(); return this; } - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - // @@protoc_insertion_point(builder_scope:google.pubsub.v1.PublishResponse) } @@ -738,7 +688,18 @@ public PublishResponse parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new PublishResponse(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PublishResponseOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PublishResponseOrBuilder.java index 27dbe63f8..067a2b264 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PublishResponseOrBuilder.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PublishResponseOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; +@com.google.protobuf.Generated public interface PublishResponseOrBuilder extends // @@protoc_insertion_point(interface_extends:google.pubsub.v1.PublishResponse) @@ -27,55 +30,58 @@ public interface PublishResponseOrBuilder * * *
    -   * The server-assigned ID of each published message, in the same order as
    -   * the messages in the request. IDs are guaranteed to be unique within
    -   * the topic.
    +   * Optional. The server-assigned ID of each published message, in the same
    +   * order as the messages in the request. IDs are guaranteed to be unique
    +   * within the topic.
        * 
    * - * repeated string message_ids = 1; + * repeated string message_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @return A list containing the messageIds. */ java.util.List getMessageIdsList(); + /** * * *
    -   * The server-assigned ID of each published message, in the same order as
    -   * the messages in the request. IDs are guaranteed to be unique within
    -   * the topic.
    +   * Optional. The server-assigned ID of each published message, in the same
    +   * order as the messages in the request. IDs are guaranteed to be unique
    +   * within the topic.
        * 
    * - * repeated string message_ids = 1; + * repeated string message_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @return The count of messageIds. */ int getMessageIdsCount(); + /** * * *
    -   * The server-assigned ID of each published message, in the same order as
    -   * the messages in the request. IDs are guaranteed to be unique within
    -   * the topic.
    +   * Optional. The server-assigned ID of each published message, in the same
    +   * order as the messages in the request. IDs are guaranteed to be unique
    +   * within the topic.
        * 
    * - * repeated string message_ids = 1; + * repeated string message_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @param index The index of the element to return. * @return The messageIds at the given index. */ java.lang.String getMessageIds(int index); + /** * * *
    -   * The server-assigned ID of each published message, in the same order as
    -   * the messages in the request. IDs are guaranteed to be unique within
    -   * the topic.
    +   * Optional. The server-assigned ID of each published message, in the same
    +   * order as the messages in the request. IDs are guaranteed to be unique
    +   * within the topic.
        * 
    * - * repeated string message_ids = 1; + * repeated string message_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @param index The index of the value to return. * @return The bytes of the messageIds at the given index. diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PubsubMessage.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PubsubMessage.java index 297538098..ef7fcebb9 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PubsubMessage.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PubsubMessage.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; @@ -34,13 +36,25 @@ * * Protobuf type {@code google.pubsub.v1.PubsubMessage} */ -public final class PubsubMessage extends com.google.protobuf.GeneratedMessageV3 +@com.google.protobuf.Generated +public final class PubsubMessage extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:google.pubsub.v1.PubsubMessage) PubsubMessageOrBuilder { private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "PubsubMessage"); + } + // Use PubsubMessage.newBuilder() to construct. - private PubsubMessage(com.google.protobuf.GeneratedMessageV3.Builder builder) { + private PubsubMessage(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); } @@ -50,104 +64,6 @@ private PubsubMessage() { orderingKey_ = ""; } - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new PubsubMessage(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - private PubsubMessage( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - data_ = input.readBytes(); - break; - } - case 18: - { - if (!((mutable_bitField0_ & 0x00000001) != 0)) { - attributes_ = - com.google.protobuf.MapField.newMapField( - AttributesDefaultEntryHolder.defaultEntry); - mutable_bitField0_ |= 0x00000001; - } - com.google.protobuf.MapEntry attributes__ = - input.readMessage( - AttributesDefaultEntryHolder.defaultEntry.getParserForType(), - extensionRegistry); - attributes_.getMutableMap().put(attributes__.getKey(), attributes__.getValue()); - break; - } - case 26: - { - java.lang.String s = input.readStringRequireUtf8(); - - messageId_ = s; - break; - } - case 34: - { - com.google.protobuf.Timestamp.Builder subBuilder = null; - if (publishTime_ != null) { - subBuilder = publishTime_.toBuilder(); - } - publishTime_ = - input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(publishTime_); - publishTime_ = subBuilder.buildPartial(); - } - - break; - } - case 42: - { - java.lang.String s = input.readStringRequireUtf8(); - - orderingKey_ = s; - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_PubsubMessage_descriptor; @@ -155,7 +71,8 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { @SuppressWarnings({"rawtypes"}) @java.lang.Override - protected com.google.protobuf.MapField internalGetMapField(int number) { + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldReflection( + int number) { switch (number) { case 2: return internalGetAttributes(); @@ -165,7 +82,7 @@ protected com.google.protobuf.MapField internalGetMapField(int number) { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_PubsubMessage_fieldAccessorTable @@ -174,17 +91,19 @@ protected com.google.protobuf.MapField internalGetMapField(int number) { com.google.pubsub.v1.PubsubMessage.Builder.class); } + private int bitField0_; public static final int DATA_FIELD_NUMBER = 1; - private com.google.protobuf.ByteString data_; + private com.google.protobuf.ByteString data_ = com.google.protobuf.ByteString.EMPTY; + /** * * *
    -   * The message data field. If this field is empty, the message must contain
    -   * at least one attribute.
    +   * Optional. The message data field. If this field is empty, the message must
    +   * contain at least one attribute.
        * 
    * - * bytes data = 1; + * bytes data = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @return The data. */ @@ -206,6 +125,7 @@ private static final class AttributesDefaultEntryHolder { ""); } + @SuppressWarnings("serial") private com.google.protobuf.MapField attributes_; private com.google.protobuf.MapField internalGetAttributes() { @@ -218,80 +138,91 @@ private com.google.protobuf.MapField interna public int getAttributesCount() { return internalGetAttributes().getMap().size(); } + /** * * *
    -   * Attributes for this message. If this field is empty, the message must
    -   * contain non-empty data. This can be used to filter messages on the
    +   * Optional. Attributes for this message. If this field is empty, the message
    +   * must contain non-empty data. This can be used to filter messages on the
        * subscription.
        * 
    * - * map<string, string> attributes = 2; + * map<string, string> attributes = 2 [(.google.api.field_behavior) = OPTIONAL]; + * */ @java.lang.Override public boolean containsAttributes(java.lang.String key) { if (key == null) { - throw new java.lang.NullPointerException(); + throw new NullPointerException("map key"); } return internalGetAttributes().getMap().containsKey(key); } + /** Use {@link #getAttributesMap()} instead. */ @java.lang.Override @java.lang.Deprecated public java.util.Map getAttributes() { return getAttributesMap(); } + /** * * *
    -   * Attributes for this message. If this field is empty, the message must
    -   * contain non-empty data. This can be used to filter messages on the
    +   * Optional. Attributes for this message. If this field is empty, the message
    +   * must contain non-empty data. This can be used to filter messages on the
        * subscription.
        * 
    * - * map<string, string> attributes = 2; + * map<string, string> attributes = 2 [(.google.api.field_behavior) = OPTIONAL]; + * */ @java.lang.Override public java.util.Map getAttributesMap() { return internalGetAttributes().getMap(); } + /** * * *
    -   * Attributes for this message. If this field is empty, the message must
    -   * contain non-empty data. This can be used to filter messages on the
    +   * Optional. Attributes for this message. If this field is empty, the message
    +   * must contain non-empty data. This can be used to filter messages on the
        * subscription.
        * 
    * - * map<string, string> attributes = 2; + * map<string, string> attributes = 2 [(.google.api.field_behavior) = OPTIONAL]; + * */ @java.lang.Override - public java.lang.String getAttributesOrDefault( - java.lang.String key, java.lang.String defaultValue) { + public /* nullable */ java.lang.String getAttributesOrDefault( + java.lang.String key, + /* nullable */ + java.lang.String defaultValue) { if (key == null) { - throw new java.lang.NullPointerException(); + throw new NullPointerException("map key"); } java.util.Map map = internalGetAttributes().getMap(); return map.containsKey(key) ? map.get(key) : defaultValue; } + /** * * *
    -   * Attributes for this message. If this field is empty, the message must
    -   * contain non-empty data. This can be used to filter messages on the
    +   * Optional. Attributes for this message. If this field is empty, the message
    +   * must contain non-empty data. This can be used to filter messages on the
        * subscription.
        * 
    * - * map<string, string> attributes = 2; + * map<string, string> attributes = 2 [(.google.api.field_behavior) = OPTIONAL]; + * */ @java.lang.Override public java.lang.String getAttributesOrThrow(java.lang.String key) { if (key == null) { - throw new java.lang.NullPointerException(); + throw new NullPointerException("map key"); } java.util.Map map = internalGetAttributes().getMap(); if (!map.containsKey(key)) { @@ -301,7 +232,10 @@ public java.lang.String getAttributesOrThrow(java.lang.String key) { } public static final int MESSAGE_ID_FIELD_NUMBER = 3; - private volatile java.lang.Object messageId_; + + @SuppressWarnings("serial") + private volatile java.lang.Object messageId_ = ""; + /** * * @@ -328,6 +262,7 @@ public java.lang.String getMessageId() { return s; } } + /** * * @@ -357,6 +292,7 @@ public com.google.protobuf.ByteString getMessageIdBytes() { public static final int PUBLISH_TIME_FIELD_NUMBER = 4; private com.google.protobuf.Timestamp publishTime_; + /** * * @@ -372,8 +308,9 @@ public com.google.protobuf.ByteString getMessageIdBytes() { */ @java.lang.Override public boolean hasPublishTime() { - return publishTime_ != null; + return ((bitField0_ & 0x00000001) != 0); } + /** * * @@ -391,6 +328,7 @@ public boolean hasPublishTime() { public com.google.protobuf.Timestamp getPublishTime() { return publishTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : publishTime_; } + /** * * @@ -404,24 +342,29 @@ public com.google.protobuf.Timestamp getPublishTime() { */ @java.lang.Override public com.google.protobuf.TimestampOrBuilder getPublishTimeOrBuilder() { - return getPublishTime(); + return publishTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : publishTime_; } public static final int ORDERING_KEY_FIELD_NUMBER = 5; - private volatile java.lang.Object orderingKey_; + + @SuppressWarnings("serial") + private volatile java.lang.Object orderingKey_ = ""; + /** * * *
    -   * If non-empty, identifies related messages for which publish order should be
    -   * respected. If a `Subscription` has `enable_message_ordering` set to `true`,
    -   * messages published with the same non-empty `ordering_key` value will be
    -   * delivered to subscribers in the order in which they are received by the
    -   * Pub/Sub system. All `PubsubMessage`s published in a given `PublishRequest`
    -   * must specify the same `ordering_key` value.
    +   * Optional. If non-empty, identifies related messages for which publish order
    +   * should be respected. If a `Subscription` has `enable_message_ordering` set
    +   * to `true`, messages published with the same non-empty `ordering_key` value
    +   * will be delivered to subscribers in the order in which they are received by
    +   * the Pub/Sub system. All `PubsubMessage`s published in a given
    +   * `PublishRequest` must specify the same `ordering_key` value. For more
    +   * information, see [ordering
    +   * messages](https://cloud.google.com/pubsub/docs/ordering).
        * 
    * - * string ordering_key = 5; + * string ordering_key = 5 [(.google.api.field_behavior) = OPTIONAL]; * * @return The orderingKey. */ @@ -437,19 +380,22 @@ public java.lang.String getOrderingKey() { return s; } } + /** * * *
    -   * If non-empty, identifies related messages for which publish order should be
    -   * respected. If a `Subscription` has `enable_message_ordering` set to `true`,
    -   * messages published with the same non-empty `ordering_key` value will be
    -   * delivered to subscribers in the order in which they are received by the
    -   * Pub/Sub system. All `PubsubMessage`s published in a given `PublishRequest`
    -   * must specify the same `ordering_key` value.
    +   * Optional. If non-empty, identifies related messages for which publish order
    +   * should be respected. If a `Subscription` has `enable_message_ordering` set
    +   * to `true`, messages published with the same non-empty `ordering_key` value
    +   * will be delivered to subscribers in the order in which they are received by
    +   * the Pub/Sub system. All `PubsubMessage`s published in a given
    +   * `PublishRequest` must specify the same `ordering_key` value. For more
    +   * information, see [ordering
    +   * messages](https://cloud.google.com/pubsub/docs/ordering).
        * 
    * - * string ordering_key = 5; + * string ordering_key = 5 [(.google.api.field_behavior) = OPTIONAL]; * * @return The bytes for orderingKey. */ @@ -483,18 +429,18 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io if (!data_.isEmpty()) { output.writeBytes(1, data_); } - com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( + com.google.protobuf.GeneratedMessage.serializeStringMapTo( output, internalGetAttributes(), AttributesDefaultEntryHolder.defaultEntry, 2); - if (!getMessageIdBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 3, messageId_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(messageId_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 3, messageId_); } - if (publishTime_ != null) { + if (((bitField0_ & 0x00000001) != 0)) { output.writeMessage(4, getPublishTime()); } - if (!getOrderingKeyBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 5, orderingKey_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(orderingKey_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 5, orderingKey_); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -516,16 +462,16 @@ public int getSerializedSize() { .build(); size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, attributes__); } - if (!getMessageIdBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, messageId_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(messageId_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(3, messageId_); } - if (publishTime_ != null) { + if (((bitField0_ & 0x00000001) != 0)) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, getPublishTime()); } - if (!getOrderingKeyBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, orderingKey_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(orderingKey_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(5, orderingKey_); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -548,7 +494,7 @@ public boolean equals(final java.lang.Object obj) { if (!getPublishTime().equals(other.getPublishTime())) return false; } if (!getOrderingKey().equals(other.getOrderingKey())) return false; - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -573,7 +519,7 @@ public int hashCode() { } hash = (37 * hash) + ORDERING_KEY_FIELD_NUMBER; hash = (53 * hash) + getOrderingKey().hashCode(); - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -614,38 +560,38 @@ public static com.google.pubsub.v1.PubsubMessage parseFrom( public static com.google.pubsub.v1.PubsubMessage parseFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.PubsubMessage parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.PubsubMessage parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); } public static com.google.pubsub.v1.PubsubMessage parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.PubsubMessage parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.PubsubMessage parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } @@ -668,10 +614,11 @@ public Builder toBuilder() { } @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** * * @@ -688,7 +635,7 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build * * Protobuf type {@code google.pubsub.v1.PubsubMessage} */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements // @@protoc_insertion_point(builder_implements:google.pubsub.v1.PubsubMessage) com.google.pubsub.v1.PubsubMessageOrBuilder { @@ -698,7 +645,8 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @SuppressWarnings({"rawtypes"}) - protected com.google.protobuf.MapField internalGetMapField(int number) { + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldReflection( + int number) { switch (number) { case 2: return internalGetAttributes(); @@ -708,7 +656,8 @@ protected com.google.protobuf.MapField internalGetMapField(int number) { } @SuppressWarnings({"rawtypes"}) - protected com.google.protobuf.MapField internalGetMutableMapField(int number) { + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMutableMapFieldReflection( + int number) { switch (number) { case 2: return internalGetMutableAttributes(); @@ -718,7 +667,7 @@ protected com.google.protobuf.MapField internalGetMutableMapField(int number) { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_PubsubMessage_fieldAccessorTable @@ -732,31 +681,30 @@ private Builder() { maybeForceBuilderInitialization(); } - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + internalGetPublishTimeFieldBuilder(); + } } @java.lang.Override public Builder clear() { super.clear(); + bitField0_ = 0; data_ = com.google.protobuf.ByteString.EMPTY; - internalGetMutableAttributes().clear(); messageId_ = ""; - - if (publishTimeBuilder_ == null) { - publishTime_ = null; - } else { - publishTime_ = null; + publishTime_ = null; + if (publishTimeBuilder_ != null) { + publishTimeBuilder_.dispose(); publishTimeBuilder_ = null; } orderingKey_ = ""; - return this; } @@ -783,52 +731,35 @@ public com.google.pubsub.v1.PubsubMessage build() { @java.lang.Override public com.google.pubsub.v1.PubsubMessage buildPartial() { com.google.pubsub.v1.PubsubMessage result = new com.google.pubsub.v1.PubsubMessage(this); - int from_bitField0_ = bitField0_; - result.data_ = data_; - result.attributes_ = internalGetAttributes(); - result.attributes_.makeImmutable(); - result.messageId_ = messageId_; - if (publishTimeBuilder_ == null) { - result.publishTime_ = publishTime_; - } else { - result.publishTime_ = publishTimeBuilder_.build(); + if (bitField0_ != 0) { + buildPartial0(result); } - result.orderingKey_ = orderingKey_; onBuilt(); return result; } - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); + private void buildPartial0(com.google.pubsub.v1.PubsubMessage result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.data_ = data_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.attributes_ = internalGetAttributes(); + result.attributes_.makeImmutable(); + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.messageId_ = messageId_; + } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000008) != 0)) { + result.publishTime_ = + publishTimeBuilder_ == null ? publishTime_ : publishTimeBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000010) != 0)) { + result.orderingKey_ = orderingKey_; + } + result.bitField0_ |= to_bitField0_; } @java.lang.Override @@ -843,12 +774,14 @@ public Builder mergeFrom(com.google.protobuf.Message other) { public Builder mergeFrom(com.google.pubsub.v1.PubsubMessage other) { if (other == com.google.pubsub.v1.PubsubMessage.getDefaultInstance()) return this; - if (other.getData() != com.google.protobuf.ByteString.EMPTY) { + if (!other.getData().isEmpty()) { setData(other.getData()); } internalGetMutableAttributes().mergeFrom(other.internalGetAttributes()); + bitField0_ |= 0x00000002; if (!other.getMessageId().isEmpty()) { messageId_ = other.messageId_; + bitField0_ |= 0x00000004; onChanged(); } if (other.hasPublishTime()) { @@ -856,9 +789,10 @@ public Builder mergeFrom(com.google.pubsub.v1.PubsubMessage other) { } if (!other.getOrderingKey().isEmpty()) { orderingKey_ = other.orderingKey_; + bitField0_ |= 0x00000010; onChanged(); } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -873,32 +807,84 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.pubsub.v1.PubsubMessage parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + data_ = input.readBytes(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + com.google.protobuf.MapEntry attributes__ = + input.readMessage( + AttributesDefaultEntryHolder.defaultEntry.getParserForType(), + extensionRegistry); + internalGetMutableAttributes() + .getMutableMap() + .put(attributes__.getKey(), attributes__.getValue()); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: + { + messageId_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000004; + break; + } // case 26 + case 34: + { + input.readMessage( + internalGetPublishTimeFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000008; + break; + } // case 34 + case 42: + { + orderingKey_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000010; + break; + } // case 42 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.google.pubsub.v1.PubsubMessage) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } private int bitField0_; private com.google.protobuf.ByteString data_ = com.google.protobuf.ByteString.EMPTY; + /** * * *
    -     * The message data field. If this field is empty, the message must contain
    -     * at least one attribute.
    +     * Optional. The message data field. If this field is empty, the message must
    +     * contain at least one attribute.
          * 
    * - * bytes data = 1; + * bytes data = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @return The data. */ @@ -906,15 +892,16 @@ public Builder mergeFrom( public com.google.protobuf.ByteString getData() { return data_; } + /** * * *
    -     * The message data field. If this field is empty, the message must contain
    -     * at least one attribute.
    +     * Optional. The message data field. If this field is empty, the message must
    +     * contain at least one attribute.
          * 
    * - * bytes data = 1; + * bytes data = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @param value The data to set. * @return This builder for chaining. @@ -923,25 +910,26 @@ public Builder setData(com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } - data_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } + /** * * *
    -     * The message data field. If this field is empty, the message must contain
    -     * at least one attribute.
    +     * Optional. The message data field. If this field is empty, the message must
    +     * contain at least one attribute.
          * 
    * - * bytes data = 1; + * bytes data = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @return This builder for chaining. */ public Builder clearData() { - + bitField0_ = (bitField0_ & ~0x00000001); data_ = getDefaultInstance().getData(); onChanged(); return this; @@ -960,8 +948,6 @@ public Builder clearData() { private com.google.protobuf.MapField internalGetMutableAttributes() { - onChanged(); - ; if (attributes_ == null) { attributes_ = com.google.protobuf.MapField.newMapField(AttributesDefaultEntryHolder.defaultEntry); @@ -969,86 +955,99 @@ public Builder clearData() { if (!attributes_.isMutable()) { attributes_ = attributes_.copy(); } + bitField0_ |= 0x00000002; + onChanged(); return attributes_; } public int getAttributesCount() { return internalGetAttributes().getMap().size(); } + /** * * *
    -     * Attributes for this message. If this field is empty, the message must
    -     * contain non-empty data. This can be used to filter messages on the
    +     * Optional. Attributes for this message. If this field is empty, the message
    +     * must contain non-empty data. This can be used to filter messages on the
          * subscription.
          * 
    * - * map<string, string> attributes = 2; + * map<string, string> attributes = 2 [(.google.api.field_behavior) = OPTIONAL]; + * */ @java.lang.Override public boolean containsAttributes(java.lang.String key) { if (key == null) { - throw new java.lang.NullPointerException(); + throw new NullPointerException("map key"); } return internalGetAttributes().getMap().containsKey(key); } + /** Use {@link #getAttributesMap()} instead. */ @java.lang.Override @java.lang.Deprecated public java.util.Map getAttributes() { return getAttributesMap(); } + /** * * *
    -     * Attributes for this message. If this field is empty, the message must
    -     * contain non-empty data. This can be used to filter messages on the
    +     * Optional. Attributes for this message. If this field is empty, the message
    +     * must contain non-empty data. This can be used to filter messages on the
          * subscription.
          * 
    * - * map<string, string> attributes = 2; + * map<string, string> attributes = 2 [(.google.api.field_behavior) = OPTIONAL]; + * */ @java.lang.Override public java.util.Map getAttributesMap() { return internalGetAttributes().getMap(); } + /** * * *
    -     * Attributes for this message. If this field is empty, the message must
    -     * contain non-empty data. This can be used to filter messages on the
    +     * Optional. Attributes for this message. If this field is empty, the message
    +     * must contain non-empty data. This can be used to filter messages on the
          * subscription.
          * 
    * - * map<string, string> attributes = 2; + * map<string, string> attributes = 2 [(.google.api.field_behavior) = OPTIONAL]; + * */ @java.lang.Override - public java.lang.String getAttributesOrDefault( - java.lang.String key, java.lang.String defaultValue) { + public /* nullable */ java.lang.String getAttributesOrDefault( + java.lang.String key, + /* nullable */ + java.lang.String defaultValue) { if (key == null) { - throw new java.lang.NullPointerException(); + throw new NullPointerException("map key"); } java.util.Map map = internalGetAttributes().getMap(); return map.containsKey(key) ? map.get(key) : defaultValue; } + /** * * *
    -     * Attributes for this message. If this field is empty, the message must
    -     * contain non-empty data. This can be used to filter messages on the
    +     * Optional. Attributes for this message. If this field is empty, the message
    +     * must contain non-empty data. This can be used to filter messages on the
          * subscription.
          * 
    * - * map<string, string> attributes = 2; + * map<string, string> attributes = 2 [(.google.api.field_behavior) = OPTIONAL]; + * */ @java.lang.Override public java.lang.String getAttributesOrThrow(java.lang.String key) { if (key == null) { - throw new java.lang.NullPointerException(); + throw new NullPointerException("map key"); } java.util.Map map = internalGetAttributes().getMap(); if (!map.containsKey(key)) { @@ -1058,70 +1057,82 @@ public java.lang.String getAttributesOrThrow(java.lang.String key) { } public Builder clearAttributes() { + bitField0_ = (bitField0_ & ~0x00000002); internalGetMutableAttributes().getMutableMap().clear(); return this; } + /** * * *
    -     * Attributes for this message. If this field is empty, the message must
    -     * contain non-empty data. This can be used to filter messages on the
    +     * Optional. Attributes for this message. If this field is empty, the message
    +     * must contain non-empty data. This can be used to filter messages on the
          * subscription.
          * 
    * - * map<string, string> attributes = 2; + * map<string, string> attributes = 2 [(.google.api.field_behavior) = OPTIONAL]; + * */ public Builder removeAttributes(java.lang.String key) { if (key == null) { - throw new java.lang.NullPointerException(); + throw new NullPointerException("map key"); } internalGetMutableAttributes().getMutableMap().remove(key); return this; } + /** Use alternate mutation accessors instead. */ @java.lang.Deprecated public java.util.Map getMutableAttributes() { + bitField0_ |= 0x00000002; return internalGetMutableAttributes().getMutableMap(); } + /** * * *
    -     * Attributes for this message. If this field is empty, the message must
    -     * contain non-empty data. This can be used to filter messages on the
    +     * Optional. Attributes for this message. If this field is empty, the message
    +     * must contain non-empty data. This can be used to filter messages on the
          * subscription.
          * 
    * - * map<string, string> attributes = 2; + * map<string, string> attributes = 2 [(.google.api.field_behavior) = OPTIONAL]; + * */ public Builder putAttributes(java.lang.String key, java.lang.String value) { if (key == null) { - throw new java.lang.NullPointerException(); + throw new NullPointerException("map key"); } if (value == null) { - throw new java.lang.NullPointerException(); + throw new NullPointerException("map value"); } internalGetMutableAttributes().getMutableMap().put(key, value); + bitField0_ |= 0x00000002; return this; } + /** * * *
    -     * Attributes for this message. If this field is empty, the message must
    -     * contain non-empty data. This can be used to filter messages on the
    +     * Optional. Attributes for this message. If this field is empty, the message
    +     * must contain non-empty data. This can be used to filter messages on the
          * subscription.
          * 
    * - * map<string, string> attributes = 2; + * map<string, string> attributes = 2 [(.google.api.field_behavior) = OPTIONAL]; + * */ public Builder putAllAttributes(java.util.Map values) { internalGetMutableAttributes().getMutableMap().putAll(values); + bitField0_ |= 0x00000002; return this; } private java.lang.Object messageId_ = ""; + /** * * @@ -1147,6 +1158,7 @@ public java.lang.String getMessageId() { return (java.lang.String) ref; } } + /** * * @@ -1172,6 +1184,7 @@ public com.google.protobuf.ByteString getMessageIdBytes() { return (com.google.protobuf.ByteString) ref; } } + /** * * @@ -1191,11 +1204,12 @@ public Builder setMessageId(java.lang.String value) { if (value == null) { throw new NullPointerException(); } - messageId_ = value; + bitField0_ |= 0x00000004; onChanged(); return this; } + /** * * @@ -1211,11 +1225,12 @@ public Builder setMessageId(java.lang.String value) { * @return This builder for chaining. */ public Builder clearMessageId() { - messageId_ = getDefaultInstance().getMessageId(); + bitField0_ = (bitField0_ & ~0x00000004); onChanged(); return this; } + /** * * @@ -1236,18 +1251,19 @@ public Builder setMessageIdBytes(com.google.protobuf.ByteString value) { throw new NullPointerException(); } checkByteStringIsUtf8(value); - messageId_ = value; + bitField0_ |= 0x00000004; onChanged(); return this; } private com.google.protobuf.Timestamp publishTime_; - private com.google.protobuf.SingleFieldBuilderV3< + private com.google.protobuf.SingleFieldBuilder< com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder> publishTimeBuilder_; + /** * * @@ -1262,8 +1278,9 @@ public Builder setMessageIdBytes(com.google.protobuf.ByteString value) { * @return Whether the publishTime field is set. */ public boolean hasPublishTime() { - return publishTimeBuilder_ != null || publishTime_ != null; + return ((bitField0_ & 0x00000008) != 0); } + /** * * @@ -1286,6 +1303,7 @@ public com.google.protobuf.Timestamp getPublishTime() { return publishTimeBuilder_.getMessage(); } } + /** * * @@ -1303,13 +1321,14 @@ public Builder setPublishTime(com.google.protobuf.Timestamp value) { throw new NullPointerException(); } publishTime_ = value; - onChanged(); } else { publishTimeBuilder_.setMessage(value); } - + bitField0_ |= 0x00000008; + onChanged(); return this; } + /** * * @@ -1324,13 +1343,14 @@ public Builder setPublishTime(com.google.protobuf.Timestamp value) { public Builder setPublishTime(com.google.protobuf.Timestamp.Builder builderForValue) { if (publishTimeBuilder_ == null) { publishTime_ = builderForValue.build(); - onChanged(); } else { publishTimeBuilder_.setMessage(builderForValue.build()); } - + bitField0_ |= 0x00000008; + onChanged(); return this; } + /** * * @@ -1344,21 +1364,23 @@ public Builder setPublishTime(com.google.protobuf.Timestamp.Builder builderForVa */ public Builder mergePublishTime(com.google.protobuf.Timestamp value) { if (publishTimeBuilder_ == null) { - if (publishTime_ != null) { - publishTime_ = - com.google.protobuf.Timestamp.newBuilder(publishTime_) - .mergeFrom(value) - .buildPartial(); + if (((bitField0_ & 0x00000008) != 0) + && publishTime_ != null + && publishTime_ != com.google.protobuf.Timestamp.getDefaultInstance()) { + getPublishTimeBuilder().mergeFrom(value); } else { publishTime_ = value; } - onChanged(); } else { publishTimeBuilder_.mergeFrom(value); } - + if (publishTime_ != null) { + bitField0_ |= 0x00000008; + onChanged(); + } return this; } + /** * * @@ -1371,16 +1393,16 @@ public Builder mergePublishTime(com.google.protobuf.Timestamp value) { * .google.protobuf.Timestamp publish_time = 4; */ public Builder clearPublishTime() { - if (publishTimeBuilder_ == null) { - publishTime_ = null; - onChanged(); - } else { - publishTime_ = null; + bitField0_ = (bitField0_ & ~0x00000008); + publishTime_ = null; + if (publishTimeBuilder_ != null) { + publishTimeBuilder_.dispose(); publishTimeBuilder_ = null; } - + onChanged(); return this; } + /** * * @@ -1393,10 +1415,11 @@ public Builder clearPublishTime() { * .google.protobuf.Timestamp publish_time = 4; */ public com.google.protobuf.Timestamp.Builder getPublishTimeBuilder() { - + bitField0_ |= 0x00000008; onChanged(); - return getPublishTimeFieldBuilder().getBuilder(); + return internalGetPublishTimeFieldBuilder().getBuilder(); } + /** * * @@ -1417,6 +1440,7 @@ public com.google.protobuf.TimestampOrBuilder getPublishTimeOrBuilder() { : publishTime_; } } + /** * * @@ -1428,14 +1452,14 @@ public com.google.protobuf.TimestampOrBuilder getPublishTimeOrBuilder() { * * .google.protobuf.Timestamp publish_time = 4; */ - private com.google.protobuf.SingleFieldBuilderV3< + private com.google.protobuf.SingleFieldBuilder< com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder> - getPublishTimeFieldBuilder() { + internalGetPublishTimeFieldBuilder() { if (publishTimeBuilder_ == null) { publishTimeBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< + new com.google.protobuf.SingleFieldBuilder< com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder>( @@ -1446,19 +1470,22 @@ public com.google.protobuf.TimestampOrBuilder getPublishTimeOrBuilder() { } private java.lang.Object orderingKey_ = ""; + /** * * *
    -     * If non-empty, identifies related messages for which publish order should be
    -     * respected. If a `Subscription` has `enable_message_ordering` set to `true`,
    -     * messages published with the same non-empty `ordering_key` value will be
    -     * delivered to subscribers in the order in which they are received by the
    -     * Pub/Sub system. All `PubsubMessage`s published in a given `PublishRequest`
    -     * must specify the same `ordering_key` value.
    +     * Optional. If non-empty, identifies related messages for which publish order
    +     * should be respected. If a `Subscription` has `enable_message_ordering` set
    +     * to `true`, messages published with the same non-empty `ordering_key` value
    +     * will be delivered to subscribers in the order in which they are received by
    +     * the Pub/Sub system. All `PubsubMessage`s published in a given
    +     * `PublishRequest` must specify the same `ordering_key` value. For more
    +     * information, see [ordering
    +     * messages](https://cloud.google.com/pubsub/docs/ordering).
          * 
    * - * string ordering_key = 5; + * string ordering_key = 5 [(.google.api.field_behavior) = OPTIONAL]; * * @return The orderingKey. */ @@ -1473,19 +1500,22 @@ public java.lang.String getOrderingKey() { return (java.lang.String) ref; } } + /** * * *
    -     * If non-empty, identifies related messages for which publish order should be
    -     * respected. If a `Subscription` has `enable_message_ordering` set to `true`,
    -     * messages published with the same non-empty `ordering_key` value will be
    -     * delivered to subscribers in the order in which they are received by the
    -     * Pub/Sub system. All `PubsubMessage`s published in a given `PublishRequest`
    -     * must specify the same `ordering_key` value.
    +     * Optional. If non-empty, identifies related messages for which publish order
    +     * should be respected. If a `Subscription` has `enable_message_ordering` set
    +     * to `true`, messages published with the same non-empty `ordering_key` value
    +     * will be delivered to subscribers in the order in which they are received by
    +     * the Pub/Sub system. All `PubsubMessage`s published in a given
    +     * `PublishRequest` must specify the same `ordering_key` value. For more
    +     * information, see [ordering
    +     * messages](https://cloud.google.com/pubsub/docs/ordering).
          * 
    * - * string ordering_key = 5; + * string ordering_key = 5 [(.google.api.field_behavior) = OPTIONAL]; * * @return The bytes for orderingKey. */ @@ -1500,19 +1530,22 @@ public com.google.protobuf.ByteString getOrderingKeyBytes() { return (com.google.protobuf.ByteString) ref; } } + /** * * *
    -     * If non-empty, identifies related messages for which publish order should be
    -     * respected. If a `Subscription` has `enable_message_ordering` set to `true`,
    -     * messages published with the same non-empty `ordering_key` value will be
    -     * delivered to subscribers in the order in which they are received by the
    -     * Pub/Sub system. All `PubsubMessage`s published in a given `PublishRequest`
    -     * must specify the same `ordering_key` value.
    +     * Optional. If non-empty, identifies related messages for which publish order
    +     * should be respected. If a `Subscription` has `enable_message_ordering` set
    +     * to `true`, messages published with the same non-empty `ordering_key` value
    +     * will be delivered to subscribers in the order in which they are received by
    +     * the Pub/Sub system. All `PubsubMessage`s published in a given
    +     * `PublishRequest` must specify the same `ordering_key` value. For more
    +     * information, see [ordering
    +     * messages](https://cloud.google.com/pubsub/docs/ordering).
          * 
    * - * string ordering_key = 5; + * string ordering_key = 5 [(.google.api.field_behavior) = OPTIONAL]; * * @param value The orderingKey to set. * @return This builder for chaining. @@ -1521,46 +1554,52 @@ public Builder setOrderingKey(java.lang.String value) { if (value == null) { throw new NullPointerException(); } - orderingKey_ = value; + bitField0_ |= 0x00000010; onChanged(); return this; } + /** * * *
    -     * If non-empty, identifies related messages for which publish order should be
    -     * respected. If a `Subscription` has `enable_message_ordering` set to `true`,
    -     * messages published with the same non-empty `ordering_key` value will be
    -     * delivered to subscribers in the order in which they are received by the
    -     * Pub/Sub system. All `PubsubMessage`s published in a given `PublishRequest`
    -     * must specify the same `ordering_key` value.
    +     * Optional. If non-empty, identifies related messages for which publish order
    +     * should be respected. If a `Subscription` has `enable_message_ordering` set
    +     * to `true`, messages published with the same non-empty `ordering_key` value
    +     * will be delivered to subscribers in the order in which they are received by
    +     * the Pub/Sub system. All `PubsubMessage`s published in a given
    +     * `PublishRequest` must specify the same `ordering_key` value. For more
    +     * information, see [ordering
    +     * messages](https://cloud.google.com/pubsub/docs/ordering).
          * 
    * - * string ordering_key = 5; + * string ordering_key = 5 [(.google.api.field_behavior) = OPTIONAL]; * * @return This builder for chaining. */ public Builder clearOrderingKey() { - orderingKey_ = getDefaultInstance().getOrderingKey(); + bitField0_ = (bitField0_ & ~0x00000010); onChanged(); return this; } + /** * * *
    -     * If non-empty, identifies related messages for which publish order should be
    -     * respected. If a `Subscription` has `enable_message_ordering` set to `true`,
    -     * messages published with the same non-empty `ordering_key` value will be
    -     * delivered to subscribers in the order in which they are received by the
    -     * Pub/Sub system. All `PubsubMessage`s published in a given `PublishRequest`
    -     * must specify the same `ordering_key` value.
    +     * Optional. If non-empty, identifies related messages for which publish order
    +     * should be respected. If a `Subscription` has `enable_message_ordering` set
    +     * to `true`, messages published with the same non-empty `ordering_key` value
    +     * will be delivered to subscribers in the order in which they are received by
    +     * the Pub/Sub system. All `PubsubMessage`s published in a given
    +     * `PublishRequest` must specify the same `ordering_key` value. For more
    +     * information, see [ordering
    +     * messages](https://cloud.google.com/pubsub/docs/ordering).
          * 
    * - * string ordering_key = 5; + * string ordering_key = 5 [(.google.api.field_behavior) = OPTIONAL]; * * @param value The bytes for orderingKey to set. * @return This builder for chaining. @@ -1570,23 +1609,12 @@ public Builder setOrderingKeyBytes(com.google.protobuf.ByteString value) { throw new NullPointerException(); } checkByteStringIsUtf8(value); - orderingKey_ = value; + bitField0_ |= 0x00000010; onChanged(); return this; } - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - // @@protoc_insertion_point(builder_scope:google.pubsub.v1.PubsubMessage) } @@ -1608,7 +1636,18 @@ public PubsubMessage parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new PubsubMessage(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PubsubMessageOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PubsubMessageOrBuilder.java index a81cdd8e2..801741079 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PubsubMessageOrBuilder.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PubsubMessageOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; +@com.google.protobuf.Generated public interface PubsubMessageOrBuilder extends // @@protoc_insertion_point(interface_extends:google.pubsub.v1.PubsubMessage) @@ -27,11 +30,11 @@ public interface PubsubMessageOrBuilder * * *
    -   * The message data field. If this field is empty, the message must contain
    -   * at least one attribute.
    +   * Optional. The message data field. If this field is empty, the message must
    +   * contain at least one attribute.
        * 
    * - * bytes data = 1; + * bytes data = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @return The data. */ @@ -41,63 +44,77 @@ public interface PubsubMessageOrBuilder * * *
    -   * Attributes for this message. If this field is empty, the message must
    -   * contain non-empty data. This can be used to filter messages on the
    +   * Optional. Attributes for this message. If this field is empty, the message
    +   * must contain non-empty data. This can be used to filter messages on the
        * subscription.
        * 
    * - * map<string, string> attributes = 2; + * map<string, string> attributes = 2 [(.google.api.field_behavior) = OPTIONAL]; + * */ int getAttributesCount(); + /** * * *
    -   * Attributes for this message. If this field is empty, the message must
    -   * contain non-empty data. This can be used to filter messages on the
    +   * Optional. Attributes for this message. If this field is empty, the message
    +   * must contain non-empty data. This can be used to filter messages on the
        * subscription.
        * 
    * - * map<string, string> attributes = 2; + * map<string, string> attributes = 2 [(.google.api.field_behavior) = OPTIONAL]; + * */ boolean containsAttributes(java.lang.String key); + /** Use {@link #getAttributesMap()} instead. */ @java.lang.Deprecated java.util.Map getAttributes(); + /** * * *
    -   * Attributes for this message. If this field is empty, the message must
    -   * contain non-empty data. This can be used to filter messages on the
    +   * Optional. Attributes for this message. If this field is empty, the message
    +   * must contain non-empty data. This can be used to filter messages on the
        * subscription.
        * 
    * - * map<string, string> attributes = 2; + * map<string, string> attributes = 2 [(.google.api.field_behavior) = OPTIONAL]; + * */ java.util.Map getAttributesMap(); + /** * * *
    -   * Attributes for this message. If this field is empty, the message must
    -   * contain non-empty data. This can be used to filter messages on the
    +   * Optional. Attributes for this message. If this field is empty, the message
    +   * must contain non-empty data. This can be used to filter messages on the
        * subscription.
        * 
    * - * map<string, string> attributes = 2; + * map<string, string> attributes = 2 [(.google.api.field_behavior) = OPTIONAL]; + * */ - java.lang.String getAttributesOrDefault(java.lang.String key, java.lang.String defaultValue); + /* nullable */ + java.lang.String getAttributesOrDefault( + java.lang.String key, + /* nullable */ + java.lang.String defaultValue); + /** * * *
    -   * Attributes for this message. If this field is empty, the message must
    -   * contain non-empty data. This can be used to filter messages on the
    +   * Optional. Attributes for this message. If this field is empty, the message
    +   * must contain non-empty data. This can be used to filter messages on the
        * subscription.
        * 
    * - * map<string, string> attributes = 2; + * map<string, string> attributes = 2 [(.google.api.field_behavior) = OPTIONAL]; + * */ java.lang.String getAttributesOrThrow(java.lang.String key); @@ -116,6 +133,7 @@ public interface PubsubMessageOrBuilder * @return The messageId. */ java.lang.String getMessageId(); + /** * * @@ -146,6 +164,7 @@ public interface PubsubMessageOrBuilder * @return Whether the publishTime field is set. */ boolean hasPublishTime(); + /** * * @@ -160,6 +179,7 @@ public interface PubsubMessageOrBuilder * @return The publishTime. */ com.google.protobuf.Timestamp getPublishTime(); + /** * * @@ -177,32 +197,37 @@ public interface PubsubMessageOrBuilder * * *
    -   * If non-empty, identifies related messages for which publish order should be
    -   * respected. If a `Subscription` has `enable_message_ordering` set to `true`,
    -   * messages published with the same non-empty `ordering_key` value will be
    -   * delivered to subscribers in the order in which they are received by the
    -   * Pub/Sub system. All `PubsubMessage`s published in a given `PublishRequest`
    -   * must specify the same `ordering_key` value.
    +   * Optional. If non-empty, identifies related messages for which publish order
    +   * should be respected. If a `Subscription` has `enable_message_ordering` set
    +   * to `true`, messages published with the same non-empty `ordering_key` value
    +   * will be delivered to subscribers in the order in which they are received by
    +   * the Pub/Sub system. All `PubsubMessage`s published in a given
    +   * `PublishRequest` must specify the same `ordering_key` value. For more
    +   * information, see [ordering
    +   * messages](https://cloud.google.com/pubsub/docs/ordering).
        * 
    * - * string ordering_key = 5; + * string ordering_key = 5 [(.google.api.field_behavior) = OPTIONAL]; * * @return The orderingKey. */ java.lang.String getOrderingKey(); + /** * * *
    -   * If non-empty, identifies related messages for which publish order should be
    -   * respected. If a `Subscription` has `enable_message_ordering` set to `true`,
    -   * messages published with the same non-empty `ordering_key` value will be
    -   * delivered to subscribers in the order in which they are received by the
    -   * Pub/Sub system. All `PubsubMessage`s published in a given `PublishRequest`
    -   * must specify the same `ordering_key` value.
    +   * Optional. If non-empty, identifies related messages for which publish order
    +   * should be respected. If a `Subscription` has `enable_message_ordering` set
    +   * to `true`, messages published with the same non-empty `ordering_key` value
    +   * will be delivered to subscribers in the order in which they are received by
    +   * the Pub/Sub system. All `PubsubMessage`s published in a given
    +   * `PublishRequest` must specify the same `ordering_key` value. For more
    +   * information, see [ordering
    +   * messages](https://cloud.google.com/pubsub/docs/ordering).
        * 
    * - * string ordering_key = 5; + * string ordering_key = 5 [(.google.api.field_behavior) = OPTIONAL]; * * @return The bytes for orderingKey. */ 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 9ce64bc0c..10ab7cdd2 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 @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,13 +14,26 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; -public final class PubsubProto { +@com.google.protobuf.Generated +public final class PubsubProto extends com.google.protobuf.GeneratedFile { private PubsubProto() {} + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "PubsubProto"); + } + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistryLite registry) {} public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) { @@ -29,207 +42,359 @@ public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry r static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_MessageStoragePolicy_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_MessageStoragePolicy_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_SchemaSettings_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_SchemaSettings_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_pubsub_v1_IngestionDataSourceSettings_descriptor; + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_google_pubsub_v1_IngestionDataSourceSettings_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_pubsub_v1_IngestionDataSourceSettings_AwsKinesis_descriptor; + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_google_pubsub_v1_IngestionDataSourceSettings_AwsKinesis_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_pubsub_v1_IngestionDataSourceSettings_CloudStorage_descriptor; + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_google_pubsub_v1_IngestionDataSourceSettings_CloudStorage_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_pubsub_v1_IngestionDataSourceSettings_CloudStorage_TextFormat_descriptor; + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_google_pubsub_v1_IngestionDataSourceSettings_CloudStorage_TextFormat_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_pubsub_v1_IngestionDataSourceSettings_CloudStorage_AvroFormat_descriptor; + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_google_pubsub_v1_IngestionDataSourceSettings_CloudStorage_AvroFormat_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_pubsub_v1_IngestionDataSourceSettings_CloudStorage_PubSubAvroFormat_descriptor; + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_google_pubsub_v1_IngestionDataSourceSettings_CloudStorage_PubSubAvroFormat_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_pubsub_v1_IngestionDataSourceSettings_AzureEventHubs_descriptor; + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_google_pubsub_v1_IngestionDataSourceSettings_AzureEventHubs_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_pubsub_v1_IngestionDataSourceSettings_AwsMsk_descriptor; + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_google_pubsub_v1_IngestionDataSourceSettings_AwsMsk_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_pubsub_v1_IngestionDataSourceSettings_ConfluentCloud_descriptor; + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_google_pubsub_v1_IngestionDataSourceSettings_ConfluentCloud_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_pubsub_v1_PlatformLogsSettings_descriptor; + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_google_pubsub_v1_PlatformLogsSettings_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_pubsub_v1_IngestionFailureEvent_descriptor; + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_google_pubsub_v1_IngestionFailureEvent_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_pubsub_v1_IngestionFailureEvent_ApiViolationReason_descriptor; + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_google_pubsub_v1_IngestionFailureEvent_ApiViolationReason_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_pubsub_v1_IngestionFailureEvent_AvroFailureReason_descriptor; + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_google_pubsub_v1_IngestionFailureEvent_AvroFailureReason_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_pubsub_v1_IngestionFailureEvent_SchemaViolationReason_descriptor; + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_google_pubsub_v1_IngestionFailureEvent_SchemaViolationReason_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_pubsub_v1_IngestionFailureEvent_MessageTransformationFailureReason_descriptor; + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_google_pubsub_v1_IngestionFailureEvent_MessageTransformationFailureReason_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_pubsub_v1_IngestionFailureEvent_CloudStorageFailure_descriptor; + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_google_pubsub_v1_IngestionFailureEvent_CloudStorageFailure_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_pubsub_v1_IngestionFailureEvent_AwsMskFailureReason_descriptor; + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_google_pubsub_v1_IngestionFailureEvent_AwsMskFailureReason_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_pubsub_v1_IngestionFailureEvent_AzureEventHubsFailureReason_descriptor; + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_google_pubsub_v1_IngestionFailureEvent_AzureEventHubsFailureReason_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_pubsub_v1_IngestionFailureEvent_ConfluentCloudFailureReason_descriptor; + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_google_pubsub_v1_IngestionFailureEvent_ConfluentCloudFailureReason_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_pubsub_v1_IngestionFailureEvent_AwsKinesisFailureReason_descriptor; + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_google_pubsub_v1_IngestionFailureEvent_AwsKinesisFailureReason_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_pubsub_v1_JavaScriptUDF_descriptor; + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_google_pubsub_v1_JavaScriptUDF_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_pubsub_v1_AIInference_descriptor; + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_google_pubsub_v1_AIInference_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_pubsub_v1_AIInference_UnstructuredInference_descriptor; + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_google_pubsub_v1_AIInference_UnstructuredInference_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_pubsub_v1_MessageTransform_descriptor; + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_google_pubsub_v1_MessageTransform_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_Topic_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_Topic_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_Topic_LabelsEntry_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.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.GeneratedMessage.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 + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_PubsubMessage_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_PubsubMessage_AttributesEntry_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_PubsubMessage_AttributesEntry_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_GetTopicRequest_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_GetTopicRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_UpdateTopicRequest_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_UpdateTopicRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_PublishRequest_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_PublishRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_PublishResponse_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_PublishResponse_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_ListTopicsRequest_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_ListTopicsRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_ListTopicsResponse_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_ListTopicsResponse_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_ListTopicSubscriptionsRequest_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_ListTopicSubscriptionsRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_ListTopicSubscriptionsResponse_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_ListTopicSubscriptionsResponse_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_ListTopicSnapshotsRequest_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_ListTopicSnapshotsRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_ListTopicSnapshotsResponse_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_ListTopicSnapshotsResponse_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_DeleteTopicRequest_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_DeleteTopicRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_DetachSubscriptionRequest_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_DetachSubscriptionRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_DetachSubscriptionResponse_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_DetachSubscriptionResponse_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_Subscription_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_Subscription_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_pubsub_v1_Subscription_AnalyticsHubSubscriptionInfo_descriptor; + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_google_pubsub_v1_Subscription_AnalyticsHubSubscriptionInfo_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_Subscription_LabelsEntry_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.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.GeneratedMessage.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 + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_RetryPolicy_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_DeadLetterPolicy_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_DeadLetterPolicy_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_ExpirationPolicy_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_ExpirationPolicy_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_PushConfig_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_PushConfig_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_PushConfig_OidcToken_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_PushConfig_OidcToken_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_pubsub_v1_PushConfig_PubsubWrapper_descriptor; + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_google_pubsub_v1_PushConfig_PubsubWrapper_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_pubsub_v1_PushConfig_NoWrapper_descriptor; + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_google_pubsub_v1_PushConfig_NoWrapper_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_PushConfig_AttributesEntry_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_PushConfig_AttributesEntry_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_pubsub_v1_BigQueryConfig_descriptor; + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_google_pubsub_v1_BigQueryConfig_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_pubsub_v1_BigtableConfig_descriptor; + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_google_pubsub_v1_BigtableConfig_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_pubsub_v1_CloudStorageConfig_descriptor; + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_google_pubsub_v1_CloudStorageConfig_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_pubsub_v1_CloudStorageConfig_TextConfig_descriptor; + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_google_pubsub_v1_CloudStorageConfig_TextConfig_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_pubsub_v1_CloudStorageConfig_AvroConfig_descriptor; + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_google_pubsub_v1_CloudStorageConfig_AvroConfig_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_ReceivedMessage_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_ReceivedMessage_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_GetSubscriptionRequest_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_GetSubscriptionRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_UpdateSubscriptionRequest_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_UpdateSubscriptionRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_ListSubscriptionsRequest_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_ListSubscriptionsRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_ListSubscriptionsResponse_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_ListSubscriptionsResponse_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_DeleteSubscriptionRequest_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_DeleteSubscriptionRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_ModifyPushConfigRequest_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_ModifyPushConfigRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_PullRequest_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_PullRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_PullResponse_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_PullResponse_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_ModifyAckDeadlineRequest_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_ModifyAckDeadlineRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_AcknowledgeRequest_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_AcknowledgeRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_StreamingPullRequest_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_StreamingPullRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_StreamingPullResponse_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_StreamingPullResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_pubsub_v1_StreamingPullResponse_AcknowledgeConfirmation_descriptor; + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_google_pubsub_v1_StreamingPullResponse_AcknowledgeConfirmation_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_pubsub_v1_StreamingPullResponse_ModifyAckDeadlineConfirmation_descriptor; + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_google_pubsub_v1_StreamingPullResponse_ModifyAckDeadlineConfirmation_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_pubsub_v1_StreamingPullResponse_SubscriptionProperties_descriptor; + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_google_pubsub_v1_StreamingPullResponse_SubscriptionProperties_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_CreateSnapshotRequest_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_CreateSnapshotRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_CreateSnapshotRequest_LabelsEntry_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.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.GeneratedMessage.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 + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_UpdateSnapshotRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_Snapshot_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_Snapshot_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_Snapshot_LabelsEntry_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_Snapshot_LabelsEntry_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_GetSnapshotRequest_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_GetSnapshotRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_ListSnapshotsRequest_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_ListSnapshotsRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_ListSnapshotsResponse_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_ListSnapshotsResponse_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_DeleteSnapshotRequest_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_DeleteSnapshotRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_SeekRequest_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_SeekRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_SeekResponse_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_SeekResponse_fieldAccessorTable; public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { @@ -240,280 +405,708 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { static { java.lang.String[] descriptorData = { - "\n\035google/pubsub/v1/pubsub.proto\022\020google." + "\n" + + "\035google/pubsub/v1/pubsub.proto\022\020google." + "pubsub.v1\032\034google/api/annotations.proto\032" + "\027google/api/client.proto\032\037google/api/fie" + "ld_behavior.proto\032\031google/api/resource.p" - + "roto\032\036google/protobuf/duration.proto\032\033go" - + "ogle/protobuf/empty.proto\032 google/protob" - + "uf/field_mask.proto\032\037google/protobuf/tim" - + "estamp.proto\032\035google/pubsub/v1/schema.pr" - + "oto\";\n\024MessageStoragePolicy\022#\n\033allowed_p" - + "ersistence_regions\030\001 \003(\t\"t\n\016SchemaSettin" - + "gs\0224\n\006schema\030\001 \001(\tB$\340A\002\372A\036\n\034pubsub.googl" - + "eapis.com/Schema\022,\n\010encoding\030\002 \001(\0162\032.goo" - + "gle.pubsub.v1.Encoding\"\204\003\n\005Topic\022\021\n\004name" - + "\030\001 \001(\tB\003\340A\002\0223\n\006labels\030\002 \003(\0132#.google.pub" - + "sub.v1.Topic.LabelsEntry\022F\n\026message_stor" - + "age_policy\030\003 \001(\0132&.google.pubsub.v1.Mess" - + "ageStoragePolicy\022\024\n\014kms_key_name\030\005 \001(\t\0229" - + "\n\017schema_settings\030\006 \001(\0132 .google.pubsub." - + "v1.SchemaSettings\022\025\n\rsatisfies_pzs\030\007 \001(\010" - + "\032-\n\013LabelsEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 " - + "\001(\t:\0028\001:T\352AQ\n\033pubsub.googleapis.com/Topi" - + "c\022!projects/{project}/topics/{topic}\022\017_d" - + "eleted-topic_\"\361\001\n\rPubsubMessage\022\014\n\004data\030" - + "\001 \001(\014\022C\n\nattributes\030\002 \003(\0132/.google.pubsu" - + "b.v1.PubsubMessage.AttributesEntry\022\022\n\nme" - + "ssage_id\030\003 \001(\t\0220\n\014publish_time\030\004 \001(\0132\032.g" - + "oogle.protobuf.Timestamp\022\024\n\014ordering_key" - + "\030\005 \001(\t\0321\n\017AttributesEntry\022\013\n\003key\030\001 \001(\t\022\r" - + "\n\005value\030\002 \001(\t:\0028\001\"E\n\017GetTopicRequest\0222\n\005" - + "topic\030\001 \001(\tB#\340A\002\372A\035\n\033pubsub.googleapis.c" - + "om/Topic\"w\n\022UpdateTopicRequest\022+\n\005topic\030" - + "\001 \001(\0132\027.google.pubsub.v1.TopicB\003\340A\002\0224\n\013u" - + "pdate_mask\030\002 \001(\0132\032.google.protobuf.Field" - + "MaskB\003\340A\002\"|\n\016PublishRequest\0222\n\005topic\030\001 \001" - + "(\tB#\340A\002\372A\035\n\033pubsub.googleapis.com/Topic\022" - + "6\n\010messages\030\002 \003(\0132\037.google.pubsub.v1.Pub" - + "subMessageB\003\340A\002\"&\n\017PublishResponse\022\023\n\013me" - + "ssage_ids\030\001 \003(\t\"\200\001\n\021ListTopicsRequest\022D\n" - + "\007project\030\001 \001(\tB3\340A\002\372A-\n+cloudresourceman" - + "ager.googleapis.com/Project\022\021\n\tpage_size" - + "\030\002 \001(\005\022\022\n\npage_token\030\003 \001(\t\"V\n\022ListTopics" - + "Response\022\'\n\006topics\030\001 \003(\0132\027.google.pubsub" - + ".v1.Topic\022\027\n\017next_page_token\030\002 \001(\t\"z\n\035Li" - + "stTopicSubscriptionsRequest\0222\n\005topic\030\001 \001" - + "(\tB#\340A\002\372A\035\n\033pubsub.googleapis.com/Topic\022" - + "\021\n\tpage_size\030\002 \001(\005\022\022\n\npage_token\030\003 \001(\t\"y" - + "\n\036ListTopicSubscriptionsResponse\022>\n\rsubs" - + "criptions\030\001 \003(\tB\'\372A$\n\"pubsub.googleapis." - + "com/Subscription\022\027\n\017next_page_token\030\002 \001(" - + "\t\"v\n\031ListTopicSnapshotsRequest\0222\n\005topic\030" - + "\001 \001(\tB#\340A\002\372A\035\n\033pubsub.googleapis.com/Top" - + "ic\022\021\n\tpage_size\030\002 \001(\005\022\022\n\npage_token\030\003 \001(" - + "\t\"H\n\032ListTopicSnapshotsResponse\022\021\n\tsnaps" - + "hots\030\001 \003(\t\022\027\n\017next_page_token\030\002 \001(\t\"H\n\022D" - + "eleteTopicRequest\0222\n\005topic\030\001 \001(\tB#\340A\002\372A\035" - + "\n\033pubsub.googleapis.com/Topic\"]\n\031DetachS" - + "ubscriptionRequest\022@\n\014subscription\030\001 \001(\t" - + "B*\340A\002\372A$\n\"pubsub.googleapis.com/Subscrip" - + "tion\"\034\n\032DetachSubscriptionResponse\"\300\005\n\014S" - + "ubscription\022\021\n\004name\030\001 \001(\tB\003\340A\002\0222\n\005topic\030" - + "\002 \001(\tB#\340A\002\372A\035\n\033pubsub.googleapis.com/Top" - + "ic\0221\n\013push_config\030\004 \001(\0132\034.google.pubsub." - + "v1.PushConfig\022\034\n\024ack_deadline_seconds\030\005 " - + "\001(\005\022\035\n\025retain_acked_messages\030\007 \001(\010\022=\n\032me" - + "ssage_retention_duration\030\010 \001(\0132\031.google." - + "protobuf.Duration\022:\n\006labels\030\t \003(\0132*.goog" - + "le.pubsub.v1.Subscription.LabelsEntry\022\037\n" - + "\027enable_message_ordering\030\n \001(\010\022=\n\021expira" - + "tion_policy\030\013 \001(\0132\".google.pubsub.v1.Exp" - + "irationPolicy\022\016\n\006filter\030\014 \001(\t\022>\n\022dead_le" - + "tter_policy\030\r \001(\0132\".google.pubsub.v1.Dea" - + "dLetterPolicy\0223\n\014retry_policy\030\016 \001(\0132\035.go" - + "ogle.pubsub.v1.RetryPolicy\022\020\n\010detached\030\017" - + " \001(\010\032-\n\013LabelsEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005valu" - + "e\030\002 \001(\t:\0028\001:X\352AU\n\"pubsub.googleapis.com/" - + "Subscription\022/projects/{project}/subscri" - + "ptions/{subscription}\"u\n\013RetryPolicy\0222\n\017" - + "minimum_backoff\030\001 \001(\0132\031.google.protobuf." - + "Duration\0222\n\017maximum_backoff\030\002 \001(\0132\031.goog" - + "le.protobuf.Duration\"L\n\020DeadLetterPolicy" - + "\022\031\n\021dead_letter_topic\030\001 \001(\t\022\035\n\025max_deliv" - + "ery_attempts\030\002 \001(\005\":\n\020ExpirationPolicy\022&" - + "\n\003ttl\030\001 \001(\0132\031.google.protobuf.Duration\"\255" - + "\002\n\nPushConfig\022\025\n\rpush_endpoint\030\001 \001(\t\022@\n\n" - + "attributes\030\002 \003(\0132,.google.pubsub.v1.Push" - + "Config.AttributesEntry\022<\n\noidc_token\030\003 \001" - + "(\0132&.google.pubsub.v1.PushConfig.OidcTok" - + "enH\000\032<\n\tOidcToken\022\035\n\025service_account_ema" - + "il\030\001 \001(\t\022\020\n\010audience\030\002 \001(\t\0321\n\017Attributes" - + "Entry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001B\027\n" - + "\025authentication_method\"m\n\017ReceivedMessag" - + "e\022\016\n\006ack_id\030\001 \001(\t\0220\n\007message\030\002 \001(\0132\037.goo" - + "gle.pubsub.v1.PubsubMessage\022\030\n\020delivery_" - + "attempt\030\003 \001(\005\"Z\n\026GetSubscriptionRequest\022" - + "@\n\014subscription\030\001 \001(\tB*\340A\002\372A$\n\"pubsub.go" - + "ogleapis.com/Subscription\"\214\001\n\031UpdateSubs" - + "criptionRequest\0229\n\014subscription\030\001 \001(\0132\036." - + "google.pubsub.v1.SubscriptionB\003\340A\002\0224\n\013up" - + "date_mask\030\002 \001(\0132\032.google.protobuf.FieldM" - + "askB\003\340A\002\"\207\001\n\030ListSubscriptionsRequest\022D\n" - + "\007project\030\001 \001(\tB3\340A\002\372A-\n+cloudresourceman" - + "ager.googleapis.com/Project\022\021\n\tpage_size" - + "\030\002 \001(\005\022\022\n\npage_token\030\003 \001(\t\"k\n\031ListSubscr" - + "iptionsResponse\0225\n\rsubscriptions\030\001 \003(\0132\036" - + ".google.pubsub.v1.Subscription\022\027\n\017next_p" - + "age_token\030\002 \001(\t\"]\n\031DeleteSubscriptionReq" - + "uest\022@\n\014subscription\030\001 \001(\tB*\340A\002\372A$\n\"pubs" - + "ub.googleapis.com/Subscription\"\223\001\n\027Modif" - + "yPushConfigRequest\022@\n\014subscription\030\001 \001(\t" - + "B*\340A\002\372A$\n\"pubsub.googleapis.com/Subscrip" - + "tion\0226\n\013push_config\030\002 \001(\0132\034.google.pubsu" - + "b.v1.PushConfigB\003\340A\002\"\215\001\n\013PullRequest\022@\n\014" - + "subscription\030\001 \001(\tB*\340A\002\372A$\n\"pubsub.googl" - + "eapis.com/Subscription\022!\n\022return_immedia" - + "tely\030\002 \001(\010B\005\030\001\340A\001\022\031\n\014max_messages\030\003 \001(\005B" - + "\003\340A\002\"L\n\014PullResponse\022<\n\021received_message" - + "s\030\001 \003(\0132!.google.pubsub.v1.ReceivedMessa" - + "ge\"\225\001\n\030ModifyAckDeadlineRequest\022@\n\014subsc" + + "roto\032\036google/protobuf/duration.proto\032\033google/protobuf/empty.proto\032" + + " google/protobuf/field_mask.proto\032\034google/protobuf/str" + + "uct.proto\032\037google/protobuf/timestamp.proto\032\035google/pubsub/v1/schema.proto\"a\n" + + "\024MessageStoragePolicy\022(\n" + + "\033allowed_persistence_regions\030\001 \003(\tB\003\340A\001\022\037\n" + + "\022enforce_in_transit\030\002 \001(\010B\003\340A\001\"\270\001\n" + + "\016SchemaSettings\0224\n" + + "\006schema\030\001 \001(\tB$\340A\002\372A\036\n" + + "\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\"\350\027\n" + + "\033IngestionDataSourceSettings\022T\n" + + "\013aws_kinesis\030\001" + + " \001(\01328.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesisB\003\340A\001H\000\022X\n" + + "\r" + + "cloud_storage\030\002 \001(\0132:.google.pubsub.v1." + + "IngestionDataSourceSettings.CloudStorageB\003\340A\001H\000\022]\n" + + "\020azure_event_hubs\030\003 \001(\0132<.goog" + + "le.pubsub.v1.IngestionDataSourceSettings.AzureEventHubsB\003\340A\001H\000\022L\n" + + "\007aws_msk\030\005 \001(\0132" + + "4.google.pubsub.v1.IngestionDataSourceSettings.AwsMskB\003\340A\001H\000\022\\\n" + + "\017confluent_cloud\030\006" + + " \001(\0132<.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloudB\003\340A\001H\000\022K\n" + + "\026platform_logs_settings\030\004" + + " \001(\0132&.google.pubsub.v1.PlatformLogsSettingsB\003\340A\001\032\352\002\n\n" + + "AwsKinesis\022R\n" + + "\005state\030\001 \001(\0162>.google.pubsub.v1" + + ".IngestionDataSourceSettings.AwsKinesis.StateB\003\340A\003\022\027\n\n" + + "stream_arn\030\002 \001(\tB\003\340A\002\022\031\n" + + "\014consumer_arn\030\003 \001(\tB\003\340A\002\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\"\226\001\n" + + "\005State\022\025\n" + + "\021STATE_UNSPECIFIED\020\000\022\n\n" + + "\006ACTIVE\020\001\022\035\n" + + "\031KINESIS_PERMISSION_DENIED\020\002\022\035\n" + + "\031PUBLISH_PERMISSION_DENIED\020\003\022\024\n" + + "\020STREAM_NOT_FOUND\020\004\022\026\n" + + "\022CONSUMER_NOT_FOUND\020\005\032\225\006\n" + + "\014CloudStorage\022T\n" + + "\005state\030\001 \001(\0162@.google.pu" + + "bsub.v1.IngestionDataSourceSettings.CloudStorage.StateB\003\340A\003\022\023\n" + + "\006bucket\030\002 \001(\tB\003\340A\001\022a\n" + + "\013text_format\030\003 \001(\0132E.google.pubsub.v1" + + ".IngestionDataSourceSettings.CloudStorage.TextFormatB\003\340A\001H\000\022a\n" + + "\013avro_format\030\004 \001(\0132E.google.pubsub.v1.IngestionDataSourceS" + + "ettings.CloudStorage.AvroFormatB\003\340A\001H\000\022n\n" + + "\022pubsub_avro_format\030\005 \001(\0132K.google.pubs" + + "ub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormatB\003\340A\001H\000\022C\n" + + "\032minimum_object_create_time\030\006" + + " \001(\0132\032.google.protobuf.TimestampB\003\340A\001\022\027\n\n" + + "match_glob\030\t \001(\tB\003\340A\001\0327\n\n" + + "TextFormat\022\033\n" + + "\tdelimiter\030\001 \001(\tB\003\340A\001H\000\210\001\001B\014\n\n" + + "_delimiter\032\014\n\n" + + "AvroFormat\032\022\n" + + "\020PubSubAvroFormat\"\232\001\n" + + "\005State\022\025\n" + + "\021STATE_UNSPECIFIED\020\000\022\n\n" + + "\006ACTIVE\020\001\022#\n" + + "\037CLOUD_STORAGE_PERMISSION_DENIED\020\002\022\035\n" + + "\031PUBLISH_PERMISSION_DENIED\020\003\022\024\n" + + "\020BUCKET_NOT_FOUND\020\004\022\024\n" + + "\020TOO_MANY_OBJECTS\020\005B\016\n" + + "\014input_format\032\377\003\n" + + "\016AzureEventHubs\022V\n" + + "\005state\030\001 \001(\0162B.google.pubsub.v" + + "1.IngestionDataSourceSettings.AzureEventHubs.StateB\003\340A\003\022\033\n" + + "\016resource_group\030\002 \001(\tB\003\340A\001\022\026\n" + + "\tnamespace\030\003 \001(\tB\003\340A\001\022\026\n" + + "\tevent_hub\030\004 \001(\tB\003\340A\001\022\026\n" + + "\tclient_id\030\005 \001(\tB\003\340A\001\022\026\n" + + "\ttenant_id\030\006 \001(\tB\003\340A\001\022\034\n" + + "\017subscription_id\030\007 \001(\tB\003\340A\001\022 \n" + + "\023gcp_service_account\030\010 \001(\tB\003\340A\001\"\327\001\n" + + "\005State\022\025\n" + + "\021STATE_UNSPECIFIED\020\000\022\n\n" + + "\006ACTIVE\020\001\022 \n" + + "\034EVENT_HUBS_PERMISSION_DENIED\020\002\022\035\n" + + "\031PUBLISH_PERMISSION_DENIED\020\003\022\027\n" + + "\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\366\002\n" + + "\006AwsMsk\022N\n" + + "\005state\030\001" + + " \001(\0162:.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk.StateB\003\340A\003\022\030\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" + + "\021STATE_UNSPECIFIED\020\000\022\n\n" + + "\006ACTIVE\020\001\022\031\n" + + "\025MSK_PERMISSION_DENIED\020\002\022\035\n" + + "\031PUBLISH_PERMISSION_DENIED\020\003\022\025\n" + + "\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.goog" + + "le.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" + + "\020identity_pool_id\030\005 \001(\tB\003\340A\002\022 \n" + + "\023gcp_service_account\030\006 \001(\tB\003\340A\002\"\276\001\n" + + "\005State\022\025\n" + + "\021STATE_UNSPECIFIED\020\000\022\n\n" + + "\006ACTIVE\020\001\022%\n" + + "!CONFLUENT_CLOUD_PERMISSION_DENIED\020\002\022\035\n" + + "\031PUBLISH_PERMISSION_DENIED\020\003\022 \n" + + "\034UNREACHABLE_BOOTSTRAP_SERVER\020\004\022\025\n" + + "\021CLUSTER_NOT_FOUND\020\005\022\023\n" + + "\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\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\"\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;.goo" + + "gle.pubsub.v1.IngestionFailureEvent.AwsMskFailureReasonB\003\340A\001H\000\022l\n" + + "\030azure_event_hubs_failure\030\005 \001(\0132C.google.pubsub.v1.Inge" + + "stionFailureEvent.AzureEventHubsFailureReasonB\003\340A\001H\000\022k\n" + + "\027confluent_cloud_failure\030\006 \001(\0132C.google.pubsub.v1.IngestionFailur" + + "eEvent.ConfluentCloudFailureReasonB\003\340A\001H\000\022c\n" + + "\023aws_kinesis_failure\030\007 \001(\0132?.google." + + "pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReasonB\003\340A\001H\000\032\024\n" + + "\022ApiViolationReason\032\023\n" + + "\021AvroFailureReason\032\027\n" + + "\025SchemaViolationReason\032$\n" + + "\"MessageTransformationFailureReason\032\230\004\n" + + "\023CloudStorageFailure\022\023\n" + + "\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:.g" + + "oogle.pubsub.v1.IngestionFailureEvent.ApiViolationReasonB\003\340A\001H\000\022e\n" + + "\027schema_violation_reason\030\007 \001(\0132=.google.pubsub.v1.Inge" + + "stionFailureEvent.SchemaViolationReasonB\003\340A\001H\000\022\200\001\n" + + "%message_transformation_failure_reason\030\010 \001(\0132J.google.pubsub.v1.Ingest" + + "ionFailureEvent.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.pubsub.v1.IngestionFailureEvent.SchemaViolationReasonB\003\340A\001H\000\022\200\001\n" + + "%message_transformation_failure_reason\030\007 \001(\0132" + + "J.google.pubsub.v1.IngestionFailureEvent" + + ".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:.google.pubsub.v1.IngestionFailureEvent.ApiViolationReasonB\003\340A\001H\000\022e\n" + + "\027schema_violation_reason\030\006 \001(\0132=.google." + + "pubsub.v1.IngestionFailureEvent.SchemaViolationReasonB\003\340A\001H\000\022\200\001\n" + + "%message_transformation_failure_reason\030\007 \001(\0132J.google.pu" + + "bsub.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.pubsub.v1.IngestionFailureEvent.ApiViolationReasonB\003\340A\001H\000\022e\n" + + "\027schema_violation_reason\030\006 \001(\0132=.google.pubsub.v" + + "1.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.Ing" + + "estionFailureEvent.SchemaViolationReasonB\003\340A\001H\000\022\200\001\n" + + "%message_transformation_failure_reason\030\005 \001(\0132J.google.pubsub.v1.Inges" + + "tionFailureEvent.MessageTransformationFailureReasonB\003\340A\001H\000\022_\n" + + "\024api_violation_reason\030\006" + + " \001(\0132:.google.pubsub.v1.IngestionFailureEvent.ApiViolationReasonB\003\340A\001H\000B\010\n" + + "\006reasonB\t\n" + + "\007failure\">\n\r" + + "JavaScriptUDF\022\032\n\r" + + "function_name\030\001 \001(\tB\003\340A\002\022\021\n" + + "\004code\030\002 \001(\tB\003\340A\002\"\201\002\n" + + "\013AIInference\022\025\n" + + "\010endpoint\030\001 \001(\tB\003\340A\002\022Z\n" + + "\026unstructured_inference\030\002 \001(\01323.google" + + ".pubsub.v1.AIInference.UnstructuredInferenceB\003\340A\001H\000\022\"\n" + + "\025service_account_email\030\003 \001(\tB\003\340A\001\032I\n" + + "\025UnstructuredInference\0220\n\n" + + "parameters\030\001 \001(\0132\027.google.protobuf.StructB\003\340A\001B\020\n" + + "\016inference_mode\"\312\001\n" + + "\020MessageTransform\022>\n" + + "\016javascript_udf\030\002" + + " \001(\0132\037.google.pubsub.v1.JavaScriptUDFB\003\340A\001H\000\022:\n" + + "\014ai_inference\030\006" + + " \001(\0132\035.google.pubsub.v1.AIInferenceB\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\"\240\007\n" + + "\005Topic\022\024\n" + + "\004name\030\001 \001(\tB\006\340A\002\340A\010\0228\n" + + "\006labels\030\002 \003(\0132#.google.pubsub.v1.Topic.LabelsEntryB\003\340A\001\022K\n" + + "\026message_storage_policy\030\003" + + " \001(\0132&.google.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" + + "\032message_retention_duration\030\010" + + " \001(\0132\031.google.protobuf.DurationB\003\340A\001\0221\n" + + "\005state\030\t \001(\0162\035.google.pubsub.v1.Topic.StateB\003\340A\003\022Z\n" + + "\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\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!projects/{project}/topics/{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/.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" + + "\017AttributesEntry\022\013\n" + + "\003key\030\001 \001(\t\022\r\n" + + "\005value\030\002 \001(\t:\0028\001\"E\n" + + "\017GetTopicRequest\0222\n" + + "\005topic\030\001 \001(\tB#\340A\002\372A\035\n" + + "\033pubsub.googleapis.com/Topic\"w\n" + + "\022UpdateTopicRequest\022+\n" + + "\005topic\030\001 \001(\0132\027.google.pubsub.v1.TopicB\003\340A\002\0224\n" + + "\013update_mask\030\002 \001(\0132\032.google.protobuf.FieldMaskB\003\340A\002\"|\n" + + "\016PublishRequest\0222\n" + + "\005topic\030\001 \001(\tB#\340A\002\372A\035\n" + + "\033pubsub.googleapis.com/Topic\0226\n" + + "\010messages\030\002 \003(\0132\037.google.pubsub.v1.PubsubMessageB\003\340A\002\"+\n" + + "\017PublishResponse\022\030\n" + + "\013message_ids\030\001 \003(\tB\003\340A\001\"\212\001\n" + + "\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" + + "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" + + "\017next_page_token\030\002 \001(\tB\003\340A\001\"\204\001\n" + + "\035ListTopicSubscriptionsRequest\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\"\201\001\n" + + "\036ListTopicSubscriptionsResponse\022A\n\r" + + "subscriptions\030\001 \003(\tB*\340A\001\372A$\n" + + "\"pubsub.googleapis.com/Subscription\022\034\n" + + "\017next_page_token\030\002 \001(\tB\003\340A\001\"\200\001\n" + + "\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\"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" + + "\033pubsub.googleapis.com/Topic\"]\n" + + "\031DetachSubscriptionRequest\022@\n" + + "\014subscription\030\001 \001(\tB*\340A\002\372A$\n" + + "\"pubsub.googleapis.com/Subscription\"\034\n" + + "\032DetachSubscriptionResponse\"\350\014\n" + + "\014Subscription\022\024\n" + + "\004name\030\001 \001(\tB\006\340A\002\340A\010\0222\n" + + "\005topic\030\002 \001(\tB#\340A\002\372A\035\n" + + "\033pubsub.googleapis.com/Topic\0226\n" + + "\013push_config\030\004" + + " \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" + + "\017bigtable_config\030\033 \001(\0132" + + " .google.pubsub.v1.BigtableConfigB\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*.g" + + "oogle.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" + + " \001(\0132\".google.pubsub.v1.ExpirationPolicyB\003\340A\001\022\023\n" + + "\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" + + "\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.Su" + + "bscription.AnalyticsHubSubscriptionInfoB\003\340A\003\022C\n" + + "\022message_transforms\030\031" + + " \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.googleapi" + + "s.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>\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" + + "PushConfig\022\032\n\r" + + "push_endpoint\030\001 \001(\tB\003\340A\001\022E\n\n" + + "attributes\030\002 \003(\0132,.goog" + + "le.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*.google.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" + + "\025service_account_email\030\001 \001(\tB\003\340A\001\022\025\n" + + "\010audience\030\002 \001(\tB\003\340A\001\032\017\n\r" + + "PubsubWrapper\032(\n" + + "\tNoWrapper\022\033\n" + + "\016write_metadata\030\001 \001(\010B\003\340A\001\0321\n" + + "\017AttributesEntry\022\013\n" + + "\003key\030\001 \001(\t\022\r\n" + + "\005value\030\002 \001(\t:\0028\001B\027\n" + + "\025authentication_methodB\t\n" + + "\007wrapper\"\262\003\n" + + "\016BigQueryConfig\022\022\n" + + "\005table\030\001 \001(\tB\003\340A\001\022\035\n" + + "\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&.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\"\256\001\n" + + "\005State\022\025\n" + + "\021STATE_UNSPECIFIED\020\000\022\n\n" + + "\006ACTIVE\020\001\022\025\n" + + "\021PERMISSION_DENIED\020\002\022\r\n" + + "\tNOT_FOUND\020\003\022\023\n" + + "\017SCHEMA_MISMATCH\020\004\022#\n" + + "\037IN_TRANSIT_LOCATION_RESTRICTION\020\005\022\"\n" + + "\036VERTEX_AI_LOCATION_RESTRICTION\020\006\"\216\003\n" + + "\016BigtableConfig\022\022\n" + + "\005table\030\001 \001(\tB\003\340A\001\022\033\n" + + "\016app_profile_id\030\002 \001(\tB\003\340A\001\022\"\n" + + "\025service_account_email\030\003 \001(\tB\003\340A\001\022\033\n" + + "\016write_metadata\030\005 \001(\010B\003\340A\001\022:\n" + + "\005state\030\004" + + " \001(\0162&.google.pubsub.v1.BigtableConfig.StateB\003\340A\003\"\315\001\n" + + "\005State\022\025\n" + + "\021STATE_UNSPECIFIED\020\000\022\n\n" + + "\006ACTIVE\020\001\022\r\n" + + "\tNOT_FOUND\020\002\022\035\n" + + "\031APP_PROFILE_MISCONFIGURED\020\003\022\025\n" + + "\021PERMISSION_DENIED\020\004\022\023\n" + + "\017SCHEMA_MISMATCH\020\005\022#\n" + + "\037IN_TRANSIT_LOCATION_RESTRICTION\020\006\022\"\n" + + "\036VERTEX_AI_LOCATION_RESTRICTION\020\007\"\215\006\n" + + "\022CloudStorageConfig\022\023\n" + + "\006bucket\030\001 \001(\tB\003\340A\002\022\034\n" + + "\017filename_prefix\030\002 \001(\tB\003\340A\001\022\034\n" + + "\017filename_suffix\030\003 \001(\tB\003\340A\001\022%\n" + + "\030filename_datetime_format\030\n" + + " \001(\tB\003\340A\001\022K\n" + + "\013text_config\030\004 \001(\0132/.goog" + + "le.pubsub.v1.CloudStorageConfig.TextConfigB\003\340A\001H\000\022K\n" + + "\013avro_config\030\005 \001(\0132/.google." + + "pubsub.v1.CloudStorageConfig.AvroConfigB\003\340A\001H\000\0224\n" + + "\014max_duration\030\006" + + " \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" + + "\025service_account_email\030\013 \001(\tB\003\340A\001\032\014\n\n" + + "TextConfig\032H\n\n" + + "AvroConfig\022\033\n" + + "\016write_metadata\030\001 \001(\010B\003\340A\001\022\035\n" + + "\020use_topic_schema\030\002 \001(\010B\003\340A\001\"\256\001\n" + + "\005State\022\025\n" + + "\021STATE_UNSPECIFIED\020\000\022\n\n" + + "\006ACTIVE\020\001\022\025\n" + + "\021PERMISSION_DENIED\020\002\022\r\n" + + "\tNOT_FOUND\020\003\022#\n" + + "\037IN_TRANSIT_LOCATION_RESTRICTION\020\004\022\023\n" + + "\017SCHEMA_MISMATCH\020\005\022\"\n" + + "\036VERTEX_AI_LOCATION_RESTRICTION\020\006B\017\n\r" + + "output_format\"|\n" + + "\017ReceivedMessage\022\023\n" + + "\006ack_id\030\001 \001(\tB\003\340A\001\0225\n" + + "\007message\030\002" + + " \001(\0132\037.google.pubsub.v1.PubsubMessageB\003\340A\001\022\035\n" + + "\020delivery_attempt\030\003 \001(\005B\003\340A\001\"Z\n" + + "\026GetSubscriptionRequest\022@\n" + + "\014subscription\030\001 \001(\tB*\340A\002\372A$\n" + + "\"pubsub.googleapis.com/Subscription\"\214\001\n" + + "\031UpdateSubscriptionRequest\0229\n" + + "\014subscription\030\001 " + + "\001(\0132\036.google.pubsub.v1.SubscriptionB\003\340A\002\0224\n" + + "\013update_mask\030\002" + + " \001(\0132\032.google.protobuf.FieldMaskB\003\340A\002\"\221\001\n" + + "\030ListSubscriptionsRequest\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\"u\n" + + "\031ListSubscriptionsResponse\022:\n\r" + + "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" + + "\"pubsub.googleapis.com/Subscription\"\223\001\n" + + "\027ModifyPushConfigRequest\022@\n" + + "\014subscription\030\001 \001(\tB*\340A\002\372A$\n" + + "\"pubsub.googleapis.com/Subscription\0226\n" + + "\013push_config\030\002" + + " \001(\0132\034.google.pubsub.v1.PushConfigB\003\340A\002\"\215\001\n" + + "\013PullRequest\022@\n" + + "\014subscription\030\001 \001(\tB*\340A\002\372A$\n" + + "\"pubsub.googleapis.com/Subscription\022!\n" + + "\022return_immediately\030\002 \001(\010B\005\030\001\340A\001\022\031\n" + + "\014max_messages\030\003 \001(\005B\003\340A\002\"Q\n" + + "\014PullResponse\022A\n" + + "\021received_messages\030\001" + + " \003(\0132!.google.pubsub.v1.ReceivedMessageB\003\340A\001\"\225\001\n" + + "\030ModifyAckDeadlineRequest\022@\n" + + "\014subscription\030\001 \001(\tB*\340A\002\372A$\n" + + "\"pubsub.googleapis.com/Subscription\022\024\n" + + "\007ack_ids\030\004 \003(\tB\003\340A\002\022!\n" + + "\024ack_deadline_seconds\030\003 \001(\005B\003\340A\002\"l\n" + + "\022AcknowledgeRequest\022@\n" + + "\014subscription\030\001 \001(\tB*\340A\002\372A$\n" + + "\"pubsub.googleapis.com/Subscription\022\024\n" + + "\007ack_ids\030\002 \003(\tB\003\340A\002\"\346\002\n" + + "\024StreamingPullRequest\022@\n" + + "\014subscription\030\001 \001(\tB*\340A\002\372A$\n" + + "\"pubsub.googleapis.com/Subscription\022\024\n" + + "\007ack_ids\030\002 \003(\tB\003\340A\001\022$\n" + + "\027modify_deadline_seconds\030\003 \003(\005B\003\340A\001\022$\n" + + "\027modify_deadline_ack_ids\030\004 \003(\tB\003\340A\001\022(\n" + + "\033stream_ack_deadline_seconds\030\005 \001(\005B\003\340A\002\022\026\n" + + "\tclient_id\030\006 \001(\tB\003\340A\001\022%\n" + + "\030max_outstanding_messages\030\007 \001(\003B\003\340A\001\022\"\n" + + "\025max_outstanding_bytes\030\010 \001(\003B\003\340A\001\022\035\n" + + "\020protocol_version\030\n" + + " \001(\003B\003\340A\001\"\236\006\n" + + "\025StreamingPullResponse\022A\n" + + "\021received_messages\030\001" + + " \003(\0132!.google.pubsub.v1.ReceivedMessageB\003\340A\001\022f\n" + + "\030acknowl", + "edge_confirmation\030\005 \001(\0132?.google.pubsub." + + "v1.StreamingPullResponse.AcknowledgeConf" + + "irmationB\003\340A\001\022t\n modify_ack_deadline_con" + + "firmation\030\003 \001(\0132E.google.pubsub.v1.Strea" + + "mingPullResponse.ModifyAckDeadlineConfir" + + "mationB\003\340A\001\022d\n\027subscription_properties\030\004" + + " \001(\0132>.google.pubsub.v1.StreamingPullRes" + + "ponse.SubscriptionPropertiesB\003\340A\001\032\224\001\n\027Ac" + + "knowledgeConfirmation\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\021uno" + + "rdered_ack_ids\030\003 \003(\tB\003\340A\001\022%\n\030temporary_f" + + "ailed_ack_ids\030\004 \003(\tB\003\340A\001\032z\n\035ModifyAckDea" + + "dlineConfirmation\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%\n\030tempora" + + "ry_failed_ack_ids\030\003 \003(\tB\003\340A\001\032k\n\026Subscrip" + + "tionProperties\022*\n\035exactly_once_delivery_" + + "enabled\030\001 \001(\010B\003\340A\001\022%\n\030message_ordering_e" + + "nabled\030\002 \001(\010B\003\340A\001\"\201\003\n\025CreateSnapshotRequ" + + "est\0224\n\004name\030\001 \001(\tB&\340A\002\372A \n\036pubsub.google" + + "apis.com/Snapshot\022@\n\014subscription\030\002 \001(\tB" + + "*\340A\002\372A$\n\"pubsub.googleapis.com/Subscript" + + "ion\022H\n\006labels\030\003 \003(\01323.google.pubsub.v1.C" + + "reateSnapshotRequest.LabelsEntryB\003\340A\001\022J\n" + + "\004tags\030\004 \003(\01321.google.pubsub.v1.CreateSna" + + "pshotRequest.TagsEntryB\t\340A\004\340A\005\340A\001\032-\n\013Lab" + + "elsEntry\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\010snaps" + + "hot\030\001 \001(\0132\032.google.pubsub.v1.SnapshotB\003\340" + + "A\002\0224\n\013update_mask\030\002 \001(\0132\032.google.protobu" + + "f.FieldMaskB\003\340A\002\"\326\002\n\010Snapshot\022\021\n\004name\030\001 " + + "\001(\tB\003\340A\001\0222\n\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\006la" + + "bels\030\004 \003(\0132&.google.pubsub.v1.Snapshot.L" + + "abelsEntryB\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.goog" + + "leapis.com/Snapshot\022\'projects/{project}/" + + "snapshots/{snapshot}*\tsnapshots2\010snapsho" + + "t\"N\n\022GetSnapshotRequest\0228\n\010snapshot\030\001 \001(" + + "\tB&\340A\002\372A \n\036pubsub.googleapis.com/Snapsho" + + "t\"\215\001\n\024ListSnapshotsRequest\022D\n\007project\030\001 " + + "\001(\tB3\340A\002\372A-\n+cloudresourcemanager.google" + + "apis.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\025ListSnapsho" + + "tsResponse\0222\n\tsnapshots\030\001 \003(\0132\032.google.p" + + "ubsub.v1.SnapshotB\003\340A\001\022\034\n\017next_page_toke" + + "n\030\002 \001(\tB\003\340A\001\"Q\n\025DeleteSnapshotRequest\0228\n" + + "\010snapshot\030\001 \001(\tB&\340A\002\372A \n\036pubsub.googleap" + + "is.com/Snapshot\"\306\001\n\013SeekRequest\022@\n\014subsc" + "ription\030\001 \001(\tB*\340A\002\372A$\n\"pubsub.googleapis" - + ".com/Subscription\022\024\n\007ack_ids\030\004 \003(\tB\003\340A\002\022" - + "!\n\024ack_deadline_seconds\030\003 \001(\005B\003\340A\002\"l\n\022Ac" - + "knowledgeRequest\022@\n\014subscription\030\001 \001(\tB*" - + "\340A\002\372A$\n\"pubsub.googleapis.com/Subscripti" - + "on\022\024\n\007ack_ids\030\002 \003(\tB\003\340A\002\"\251\002\n\024StreamingPu" - + "llRequest\022@\n\014subscription\030\001 \001(\tB*\340A\002\372A$\n" - + "\"pubsub.googleapis.com/Subscription\022\017\n\007a" - + "ck_ids\030\002 \003(\t\022\037\n\027modify_deadline_seconds\030" - + "\003 \003(\005\022\037\n\027modify_deadline_ack_ids\030\004 \003(\t\022(" - + "\n\033stream_ack_deadline_seconds\030\005 \001(\005B\003\340A\002" - + "\022\021\n\tclient_id\030\006 \001(\t\022 \n\030max_outstanding_m" - + "essages\030\007 \001(\003\022\035\n\025max_outstanding_bytes\030\010" - + " \001(\003\"U\n\025StreamingPullResponse\022<\n\021receive" - + "d_messages\030\001 \003(\0132!.google.pubsub.v1.Rece" - + "ivedMessage\"\203\002\n\025CreateSnapshotRequest\0224\n" - + "\004name\030\001 \001(\tB&\340A\002\372A \n\036pubsub.googleapis.c" - + "om/Snapshot\022@\n\014subscription\030\002 \001(\tB*\340A\002\372A" - + "$\n\"pubsub.googleapis.com/Subscription\022C\n" - + "\006labels\030\003 \003(\01323.google.pubsub.v1.CreateS" - + "napshotRequest.LabelsEntry\032-\n\013LabelsEntr" - + "y\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001\"\200\001\n\025Up" - + "dateSnapshotRequest\0221\n\010snapshot\030\001 \001(\0132\032." - + "google.pubsub.v1.SnapshotB\003\340A\002\0224\n\013update" - + "_mask\030\002 \001(\0132\032.google.protobuf.FieldMaskB" - + "\003\340A\002\"\257\002\n\010Snapshot\022\014\n\004name\030\001 \001(\t\022/\n\005topic" - + "\030\002 \001(\tB \372A\035\n\033pubsub.googleapis.com/Topic" - + "\022/\n\013expire_time\030\003 \001(\0132\032.google.protobuf." - + "Timestamp\0226\n\006labels\030\004 \003(\0132&.google.pubsu" - + "b.v1.Snapshot.LabelsEntry\032-\n\013LabelsEntry" - + "\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001:L\352AI\n\036p" - + "ubsub.googleapis.com/Snapshot\022\'projects/" - + "{project}/snapshots/{snapshot}\"N\n\022GetSna" - + "pshotRequest\0228\n\010snapshot\030\001 \001(\tB&\340A\002\372A \n\036" - + "pubsub.googleapis.com/Snapshot\"\203\001\n\024ListS" - + "napshotsRequest\022D\n\007project\030\001 \001(\tB3\340A\002\372A-" - + "\n+cloudresourcemanager.googleapis.com/Pr" - + "oject\022\021\n\tpage_size\030\002 \001(\005\022\022\n\npage_token\030\003" - + " \001(\t\"_\n\025ListSnapshotsResponse\022-\n\tsnapsho" - + "ts\030\001 \003(\0132\032.google.pubsub.v1.Snapshot\022\027\n\017" - + "next_page_token\030\002 \001(\t\"Q\n\025DeleteSnapshotR" - + "equest\0228\n\010snapshot\030\001 \001(\tB&\340A\002\372A \n\036pubsub" - + ".googleapis.com/Snapshot\"\276\001\n\013SeekRequest" - + "\022@\n\014subscription\030\001 \001(\tB*\340A\002\372A$\n\"pubsub.g" - + "oogleapis.com/Subscription\022*\n\004time\030\002 \001(\013" - + "2\032.google.protobuf.TimestampH\000\0227\n\010snapsh" - + "ot\030\003 \001(\tB#\372A \n\036pubsub.googleapis.com/Sna" - + "pshotH\000B\010\n\006target\"\016\n\014SeekResponse2\243\013\n\tPu" - + "blisher\022q\n\013CreateTopic\022\027.google.pubsub.v" - + "1.Topic\032\027.google.pubsub.v1.Topic\"0\202\323\344\223\002#" - + "\032\036/v1/{name=projects/*/topics/*}:\001*\332A\004na" - + "me\022}\n\013UpdateTopic\022$.google.pubsub.v1.Upd" + + ".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/Snap" + + "shotH\000B\010\n\006target\"\016\n\014SeekResponse2\270\013\n\tPub" + + "lisher\022q\n\013CreateTopic\022\027.google.pubsub.v1" + + ".Topic\032\027.google.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.Upd" + "ateTopicRequest\032\027.google.pubsub.v1.Topic" - + "\"/\202\323\344\223\002)2$/v1/{topic.name=projects/*/top" - + "ics/*}:\001*\022\223\001\n\007Publish\022 .google.pubsub.v1" - + ".PublishRequest\032!.google.pubsub.v1.Publi" - + "shResponse\"C\202\323\344\223\002,\"\'/v1/{topic=projects/" - + "*/topics/*}:publish:\001*\332A\016topic,messages\022" - + "w\n\010GetTopic\022!.google.pubsub.v1.GetTopicR" - + "equest\032\027.google.pubsub.v1.Topic\"/\202\323\344\223\002!\022" - + "\037/v1/{topic=projects/*/topics/*}\332A\005topic" - + "\022\212\001\n\nListTopics\022#.google.pubsub.v1.ListT" - + "opicsRequest\032$.google.pubsub.v1.ListTopi" - + "csResponse\"1\202\323\344\223\002!\022\037/v1/{project=project" - + "s/*}/topics\332A\007project\022\272\001\n\026ListTopicSubsc" - + "riptions\022/.google.pubsub.v1.ListTopicSub" - + "scriptionsRequest\0320.google.pubsub.v1.Lis" - + "tTopicSubscriptionsResponse\"=\202\323\344\223\002/\022-/v1" - + "/{topic=projects/*/topics/*}/subscriptio" - + "ns\332A\005topic\022\252\001\n\022ListTopicSnapshots\022+.goog" - + "le.pubsub.v1.ListTopicSnapshotsRequest\032," - + ".google.pubsub.v1.ListTopicSnapshotsResp" - + "onse\"9\202\323\344\223\002+\022)/v1/{topic=projects/*/topi" - + "cs/*}/snapshots\332A\005topic\022|\n\013DeleteTopic\022$" - + ".google.pubsub.v1.DeleteTopicRequest\032\026.g" - + "oogle.protobuf.Empty\"/\202\323\344\223\002!*\037/v1/{topic" - + "=projects/*/topics/*}\332A\005topic\022\255\001\n\022Detach" - + "Subscription\022+.google.pubsub.v1.DetachSu" - + "bscriptionRequest\032,.google.pubsub.v1.Det" - + "achSubscriptionResponse\"<\202\323\344\223\0026\"4/v1/{su" - + "bscription=projects/*/subscriptions/*}:d" - + "etach\032p\312A\025pubsub.googleapis.com\322AUhttps:" - + "//www.googleapis.com/auth/cloud-platform" - + ",https://www.googleapis.com/auth/pubsub2" - + "\203\025\n\nSubscriber\022\264\001\n\022CreateSubscription\022\036." - + "google.pubsub.v1.Subscription\032\036.google.p" - + "ubsub.v1.Subscription\"^\202\323\344\223\002*\032%/v1/{name" - + "=projects/*/subscriptions/*}:\001*\332A+name,t" - + "opic,push_config,ack_deadline_seconds\022\241\001" - + "\n\017GetSubscription\022(.google.pubsub.v1.Get" - + "SubscriptionRequest\032\036.google.pubsub.v1.S" - + "ubscription\"D\202\323\344\223\002/\022-/v1/{subscription=p" - + "rojects/*/subscriptions/*}\332A\014subscriptio" - + "n\022\240\001\n\022UpdateSubscription\022+.google.pubsub" - + ".v1.UpdateSubscriptionRequest\032\036.google.p" - + "ubsub.v1.Subscription\"=\202\323\344\223\002722/v1/{subs" - + "cription.name=projects/*/subscriptions/*" - + "}:\001*\022\246\001\n\021ListSubscriptions\022*.google.pubs" - + "ub.v1.ListSubscriptionsRequest\032+.google." - + "pubsub.v1.ListSubscriptionsResponse\"8\202\323\344" - + "\223\002(\022&/v1/{project=projects/*}/subscripti" - + "ons\332A\007project\022\237\001\n\022DeleteSubscription\022+.g" - + "oogle.pubsub.v1.DeleteSubscriptionReques" - + "t\032\026.google.protobuf.Empty\"D\202\323\344\223\002/*-/v1/{" - + "subscription=projects/*/subscriptions/*}" - + "\332A\014subscription\022\317\001\n\021ModifyAckDeadline\022*." - + "google.pubsub.v1.ModifyAckDeadlineReques" - + "t\032\026.google.protobuf.Empty\"v\202\323\344\223\002D\"?/v1/{" - + "subscription=projects/*/subscriptions/*}" - + ":modifyAckDeadline:\001*\332A)subscription,ack" - + "_ids,ack_deadline_seconds\022\250\001\n\013Acknowledg" - + "e\022$.google.pubsub.v1.AcknowledgeRequest\032" - + "\026.google.protobuf.Empty\"[\202\323\344\223\002>\"9/v1/{su" - + "bscription=projects/*/subscriptions/*}:a" - + "cknowledge:\001*\332A\024subscription,ack_ids\022\263\001\n" - + "\004Pull\022\035.google.pubsub.v1.PullRequest\032\036.g" - + "oogle.pubsub.v1.PullResponse\"l\202\323\344\223\0027\"2/v" - + "1/{subscription=projects/*/subscriptions" - + "/*}:pull:\001*\332A,subscription,return_immedi" - + "ately,max_messages\022f\n\rStreamingPull\022&.go" - + "ogle.pubsub.v1.StreamingPullRequest\032\'.go" - + "ogle.pubsub.v1.StreamingPullResponse\"\000(\001" - + "0\001\022\273\001\n\020ModifyPushConfig\022).google.pubsub." - + "v1.ModifyPushConfigRequest\032\026.google.prot" - + "obuf.Empty\"d\202\323\344\223\002C\">/v1/{subscription=pr" - + "ojects/*/subscriptions/*}:modifyPushConf" - + "ig:\001*\332A\030subscription,push_config\022\211\001\n\013Get" - + "Snapshot\022$.google.pubsub.v1.GetSnapshotR" - + "equest\032\032.google.pubsub.v1.Snapshot\"8\202\323\344\223" - + "\002\'\022%/v1/{snapshot=projects/*/snapshots/*" - + "}\332A\010snapshot\022\226\001\n\rListSnapshots\022&.google." - + "pubsub.v1.ListSnapshotsRequest\032\'.google." - + "pubsub.v1.ListSnapshotsResponse\"4\202\323\344\223\002$\022" - + "\"/v1/{project=projects/*}/snapshots\332A\007pr" - + "oject\022\227\001\n\016CreateSnapshot\022\'.google.pubsub" - + ".v1.CreateSnapshotRequest\032\032.google.pubsu" - + "b.v1.Snapshot\"@\202\323\344\223\002&\032!/v1/{name=project" - + "s/*/snapshots/*}:\001*\332A\021name,subscription\022" - + "\214\001\n\016UpdateSnapshot\022\'.google.pubsub.v1.Up" - + "dateSnapshotRequest\032\032.google.pubsub.v1.S" - + "napshot\"5\202\323\344\223\002/2*/v1/{snapshot.name=proj" - + "ects/*/snapshots/*}:\001*\022\213\001\n\016DeleteSnapsho" - + "t\022\'.google.pubsub.v1.DeleteSnapshotReque" - + "st\032\026.google.protobuf.Empty\"8\202\323\344\223\002\'*%/v1/" - + "{snapshot=projects/*/snapshots/*}\332A\010snap" - + "shot\022\204\001\n\004Seek\022\035.google.pubsub.v1.SeekReq" - + "uest\032\036.google.pubsub.v1.SeekResponse\"=\202\323" - + "\344\223\0027\"2/v1/{subscription=projects/*/subsc" - + "riptions/*}:seek:\001*\032p\312A\025pubsub.googleapi" - + "s.com\322AUhttps://www.googleapis.com/auth/" - + "cloud-platform,https://www.googleapis.co" - + "m/auth/pubsubB\256\001\n\024com.google.pubsub.v1B\013" - + "PubsubProtoP\001Z6google.golang.org/genprot" - + "o/googleapis/pubsub/v1;pubsub\370\001\001\252\002\026Googl" - + "e.Cloud.PubSub.V1\312\002\026Google\\Cloud\\PubSub\\" - + "V1\352\002\031Google::Cloud::PubSub::V1b\006proto3" + + "\"C\332A\021topic,update_mask\202\323\344\223\002)2$/v1/{topic" + + ".name=projects/*/topics/*}:\001*\022\223\001\n\007Publis" + + "h\022 .google.pubsub.v1.PublishRequest\032!.go" + + "ogle.pubsub.v1.PublishResponse\"C\332A\016topic" + + ",messages\202\323\344\223\002,\"\'/v1/{topic=projects/*/t" + + "opics/*}:publish:\001*\022w\n\010GetTopic\022!.google" + + ".pubsub.v1.GetTopicRequest\032\027.google.pubs" + + "ub.v1.Topic\"/\332A\005topic\202\323\344\223\002!\022\037/v1/{topic=" + + "projects/*/topics/*}\022\212\001\n\nListTopics\022#.go" + + "ogle.pubsub.v1.ListTopicsRequest\032$.googl" + + "e.pubsub.v1.ListTopicsResponse\"1\332A\007proje" + + "ct\202\323\344\223\002!\022\037/v1/{project=projects/*}/topic" + + "s\022\272\001\n\026ListTopicSubscriptions\022/.google.pu" + + "bsub.v1.ListTopicSubscriptionsRequest\0320." + + "google.pubsub.v1.ListTopicSubscriptionsR" + + "esponse\"=\332A\005topic\202\323\344\223\002/\022-/v1/{topic=proj" + + "ects/*/topics/*}/subscriptions\022\252\001\n\022ListT" + + "opicSnapshots\022+.google.pubsub.v1.ListTop" + + "icSnapshotsRequest\032,.google.pubsub.v1.Li" + + "stTopicSnapshotsResponse\"9\332A\005topic\202\323\344\223\002+" + + "\022)/v1/{topic=projects/*/topics/*}/snapsh" + + "ots\022|\n\013DeleteTopic\022$.google.pubsub.v1.De" + + "leteTopicRequest\032\026.google.protobuf.Empty" + + "\"/\332A\005topic\202\323\344\223\002!*\037/v1/{topic=projects/*/" + + "topics/*}\022\255\001\n\022DetachSubscription\022+.googl" + + "e.pubsub.v1.DetachSubscriptionRequest\032,." + + "google.pubsub.v1.DetachSubscriptionRespo" + + "nse\"<\202\323\344\223\0026\"4/v1/{subscription=projects/" + + "*/subscriptions/*}:detach\032p\312A\025pubsub.goo" + + "gleapis.com\322AUhttps://www.googleapis.com" + + "/auth/cloud-platform,https://www.googlea" + + "pis.com/auth/pubsub2\322\025\n\nSubscriber\022\264\001\n\022C" + + "reateSubscription\022\036.google.pubsub.v1.Sub" + + "scription\032\036.google.pubsub.v1.Subscriptio" + + "n\"^\332A+name,topic,push_config,ack_deadlin" + + "e_seconds\202\323\344\223\002*\032%/v1/{name=projects/*/su" + + "bscriptions/*}:\001*\022\241\001\n\017GetSubscription\022(." + + "google.pubsub.v1.GetSubscriptionRequest\032" + + "\036.google.pubsub.v1.Subscription\"D\332A\014subs" + + "cription\202\323\344\223\002/\022-/v1/{subscription=projec" + + "ts/*/subscriptions/*}\022\273\001\n\022UpdateSubscrip" + + "tion\022+.google.pubsub.v1.UpdateSubscripti" + + "onRequest\032\036.google.pubsub.v1.Subscriptio" + + "n\"X\332A\030subscription,update_mask\202\323\344\223\002722/v" + + "1/{subscription.name=projects/*/subscrip" + + "tions/*}:\001*\022\246\001\n\021ListSubscriptions\022*.goog" + + "le.pubsub.v1.ListSubscriptionsRequest\032+." + + "google.pubsub.v1.ListSubscriptionsRespon" + + "se\"8\332A\007project\202\323\344\223\002(\022&/v1/{project=proje" + + "cts/*}/subscriptions\022\237\001\n\022DeleteSubscript" + + "ion\022+.google.pubsub.v1.DeleteSubscriptio" + + "nRequest\032\026.google.protobuf.Empty\"D\332A\014sub" + + "scription\202\323\344\223\002/*-/v1/{subscription=proje" + + "cts/*/subscriptions/*}\022\317\001\n\021ModifyAckDead" + + "line\022*.google.pubsub.v1.ModifyAckDeadlin" + + "eRequest\032\026.google.protobuf.Empty\"v\332A)sub" + + "scription,ack_ids,ack_deadline_seconds\202\323" + + "\344\223\002D\"?/v1/{subscription=projects/*/subsc" + + "riptions/*}:modifyAckDeadline:\001*\022\250\001\n\013Ack" + + "nowledge\022$.google.pubsub.v1.AcknowledgeR" + + "equest\032\026.google.protobuf.Empty\"[\332A\024subsc" + + "ription,ack_ids\202\323\344\223\002>\"9/v1/{subscription" + + "=projects/*/subscriptions/*}:acknowledge" + + ":\001*\022\320\001\n\004Pull\022\035.google.pubsub.v1.PullRequ" + + "est\032\036.google.pubsub.v1.PullResponse\"\210\001\332A" + + ",subscription,return_immediately,max_mes" + + "sages\332A\031subscription,max_messages\202\323\344\223\0027\"" + + "2/v1/{subscription=projects/*/subscripti" + + "ons/*}:pull:\001*\022f\n\rStreamingPull\022&.google" + + ".pubsub.v1.StreamingPullRequest\032\'.google" + + ".pubsub.v1.StreamingPullResponse\"\000(\0010\001\022\273" + + "\001\n\020ModifyPushConfig\022).google.pubsub.v1.M" + + "odifyPushConfigRequest\032\026.google.protobuf" + + ".Empty\"d\332A\030subscription,push_config\202\323\344\223\002" + + "C\">/v1/{subscription=projects/*/subscrip" + + "tions/*}:modifyPushConfig:\001*\022\211\001\n\013GetSnap" + + "shot\022$.google.pubsub.v1.GetSnapshotReque" + + "st\032\032.google.pubsub.v1.Snapshot\"8\332A\010snaps" + + "hot\202\323\344\223\002\'\022%/v1/{snapshot=projects/*/snap" + + "shots/*}\022\226\001\n\rListSnapshots\022&.google.pubs" + + "ub.v1.ListSnapshotsRequest\032\'.google.pubs" + + "ub.v1.ListSnapshotsResponse\"4\332A\007project\202" + + "\323\344\223\002$\022\"/v1/{project=projects/*}/snapshot" + + "s\022\227\001\n\016CreateSnapshot\022\'.google.pubsub.v1." + + "CreateSnapshotRequest\032\032.google.pubsub.v1" + + ".Snapshot\"@\332A\021name,subscription\202\323\344\223\002&\032!/" + + "v1/{name=projects/*/snapshots/*}:\001*\022\243\001\n\016" + + "UpdateSnapshot\022\'.google.pubsub.v1.Update" + + "SnapshotRequest\032\032.google.pubsub.v1.Snaps" + + "hot\"L\332A\024snapshot,update_mask\202\323\344\223\002/2*/v1/" + + "{snapshot.name=projects/*/snapshots/*}:\001" + + "*\022\213\001\n\016DeleteSnapshot\022\'.google.pubsub.v1." + + "DeleteSnapshotRequest\032\026.google.protobuf." + + "Empty\"8\332A\010snapshot\202\323\344\223\002\'*%/v1/{snapshot=" + + "projects/*/snapshots/*}\022\204\001\n\004Seek\022\035.googl" + + "e.pubsub.v1.SeekRequest\032\036.google.pubsub." + + "v1.SeekResponse\"=\202\323\344\223\0027\"2/v1/{subscripti" + + "on=projects/*/subscriptions/*}:seek:\001*\032p" + + "\312A\025pubsub.googleapis.com\322AUhttps://www.g" + + "oogleapis.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;p" + + "ubsubpb\252\002\026Google.Cloud.PubSub.V1\312\002\026Googl" + + "e\\Cloud\\PubSub\\V1\352\002\031Google::Cloud::PubSu" + + "b::V1\352Ax\n!cloudkms.googleapis.com/Crypto" + + "Key\022Sprojects/{project}/locations/{locat" + + "ion}/keyRings/{key_ring}/cryptoKeys/{cry" + + "pto_key}\352A\177\n#analyticshub.googleapis.com" + + "/Listing\022Xprojects/{project}/locations/{" + + "location}/dataExchanges/{data_exchange}/" + + "listings/{listing}b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( @@ -526,28 +1119,275 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { com.google.protobuf.DurationProto.getDescriptor(), com.google.protobuf.EmptyProto.getDescriptor(), com.google.protobuf.FieldMaskProto.getDescriptor(), + com.google.protobuf.StructProto.getDescriptor(), com.google.protobuf.TimestampProto.getDescriptor(), com.google.pubsub.v1.SchemaProto.getDescriptor(), }); internal_static_google_pubsub_v1_MessageStoragePolicy_descriptor = - getDescriptor().getMessageTypes().get(0); + getDescriptor().getMessageType(0); internal_static_google_pubsub_v1_MessageStoragePolicy_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_MessageStoragePolicy_descriptor, new java.lang.String[] { - "AllowedPersistenceRegions", + "AllowedPersistenceRegions", "EnforceInTransit", }); - internal_static_google_pubsub_v1_SchemaSettings_descriptor = - getDescriptor().getMessageTypes().get(1); + internal_static_google_pubsub_v1_SchemaSettings_descriptor = getDescriptor().getMessageType(1); internal_static_google_pubsub_v1_SchemaSettings_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_SchemaSettings_descriptor, new java.lang.String[] { - "Schema", "Encoding", + "Schema", "Encoding", "FirstRevisionId", "LastRevisionId", + }); + internal_static_google_pubsub_v1_IngestionDataSourceSettings_descriptor = + getDescriptor().getMessageType(2); + internal_static_google_pubsub_v1_IngestionDataSourceSettings_fieldAccessorTable = + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_google_pubsub_v1_IngestionDataSourceSettings_descriptor, + new java.lang.String[] { + "AwsKinesis", + "CloudStorage", + "AzureEventHubs", + "AwsMsk", + "ConfluentCloud", + "PlatformLogsSettings", + "Source", + }); + internal_static_google_pubsub_v1_IngestionDataSourceSettings_AwsKinesis_descriptor = + internal_static_google_pubsub_v1_IngestionDataSourceSettings_descriptor.getNestedType(0); + internal_static_google_pubsub_v1_IngestionDataSourceSettings_AwsKinesis_fieldAccessorTable = + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_google_pubsub_v1_IngestionDataSourceSettings_AwsKinesis_descriptor, + new java.lang.String[] { + "State", "StreamArn", "ConsumerArn", "AwsRoleArn", "GcpServiceAccount", + }); + internal_static_google_pubsub_v1_IngestionDataSourceSettings_CloudStorage_descriptor = + internal_static_google_pubsub_v1_IngestionDataSourceSettings_descriptor.getNestedType(1); + internal_static_google_pubsub_v1_IngestionDataSourceSettings_CloudStorage_fieldAccessorTable = + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_google_pubsub_v1_IngestionDataSourceSettings_CloudStorage_descriptor, + new java.lang.String[] { + "State", + "Bucket", + "TextFormat", + "AvroFormat", + "PubsubAvroFormat", + "MinimumObjectCreateTime", + "MatchGlob", + "InputFormat", + }); + internal_static_google_pubsub_v1_IngestionDataSourceSettings_CloudStorage_TextFormat_descriptor = + internal_static_google_pubsub_v1_IngestionDataSourceSettings_CloudStorage_descriptor + .getNestedType(0); + internal_static_google_pubsub_v1_IngestionDataSourceSettings_CloudStorage_TextFormat_fieldAccessorTable = + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_google_pubsub_v1_IngestionDataSourceSettings_CloudStorage_TextFormat_descriptor, + new java.lang.String[] { + "Delimiter", + }); + internal_static_google_pubsub_v1_IngestionDataSourceSettings_CloudStorage_AvroFormat_descriptor = + internal_static_google_pubsub_v1_IngestionDataSourceSettings_CloudStorage_descriptor + .getNestedType(1); + internal_static_google_pubsub_v1_IngestionDataSourceSettings_CloudStorage_AvroFormat_fieldAccessorTable = + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_google_pubsub_v1_IngestionDataSourceSettings_CloudStorage_AvroFormat_descriptor, + new java.lang.String[] {}); + internal_static_google_pubsub_v1_IngestionDataSourceSettings_CloudStorage_PubSubAvroFormat_descriptor = + internal_static_google_pubsub_v1_IngestionDataSourceSettings_CloudStorage_descriptor + .getNestedType(2); + internal_static_google_pubsub_v1_IngestionDataSourceSettings_CloudStorage_PubSubAvroFormat_fieldAccessorTable = + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_google_pubsub_v1_IngestionDataSourceSettings_CloudStorage_PubSubAvroFormat_descriptor, + new java.lang.String[] {}); + internal_static_google_pubsub_v1_IngestionDataSourceSettings_AzureEventHubs_descriptor = + internal_static_google_pubsub_v1_IngestionDataSourceSettings_descriptor.getNestedType(2); + internal_static_google_pubsub_v1_IngestionDataSourceSettings_AzureEventHubs_fieldAccessorTable = + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_google_pubsub_v1_IngestionDataSourceSettings_AzureEventHubs_descriptor, + new java.lang.String[] { + "State", + "ResourceGroup", + "Namespace", + "EventHub", + "ClientId", + "TenantId", + "SubscriptionId", + "GcpServiceAccount", + }); + internal_static_google_pubsub_v1_IngestionDataSourceSettings_AwsMsk_descriptor = + internal_static_google_pubsub_v1_IngestionDataSourceSettings_descriptor.getNestedType(3); + internal_static_google_pubsub_v1_IngestionDataSourceSettings_AwsMsk_fieldAccessorTable = + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_google_pubsub_v1_IngestionDataSourceSettings_AwsMsk_descriptor, + new java.lang.String[] { + "State", "ClusterArn", "Topic", "AwsRoleArn", "GcpServiceAccount", + }); + internal_static_google_pubsub_v1_IngestionDataSourceSettings_ConfluentCloud_descriptor = + internal_static_google_pubsub_v1_IngestionDataSourceSettings_descriptor.getNestedType(4); + internal_static_google_pubsub_v1_IngestionDataSourceSettings_ConfluentCloud_fieldAccessorTable = + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_google_pubsub_v1_IngestionDataSourceSettings_ConfluentCloud_descriptor, + new java.lang.String[] { + "State", + "BootstrapServer", + "ClusterId", + "Topic", + "IdentityPoolId", + "GcpServiceAccount", + }); + internal_static_google_pubsub_v1_PlatformLogsSettings_descriptor = + getDescriptor().getMessageType(3); + internal_static_google_pubsub_v1_PlatformLogsSettings_fieldAccessorTable = + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_google_pubsub_v1_PlatformLogsSettings_descriptor, + new java.lang.String[] { + "Severity", + }); + internal_static_google_pubsub_v1_IngestionFailureEvent_descriptor = + getDescriptor().getMessageType(4); + internal_static_google_pubsub_v1_IngestionFailureEvent_fieldAccessorTable = + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_google_pubsub_v1_IngestionFailureEvent_descriptor, + new java.lang.String[] { + "Topic", + "ErrorMessage", + "CloudStorageFailure", + "AwsMskFailure", + "AzureEventHubsFailure", + "ConfluentCloudFailure", + "AwsKinesisFailure", + "Failure", + }); + internal_static_google_pubsub_v1_IngestionFailureEvent_ApiViolationReason_descriptor = + internal_static_google_pubsub_v1_IngestionFailureEvent_descriptor.getNestedType(0); + internal_static_google_pubsub_v1_IngestionFailureEvent_ApiViolationReason_fieldAccessorTable = + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_google_pubsub_v1_IngestionFailureEvent_ApiViolationReason_descriptor, + new java.lang.String[] {}); + internal_static_google_pubsub_v1_IngestionFailureEvent_AvroFailureReason_descriptor = + internal_static_google_pubsub_v1_IngestionFailureEvent_descriptor.getNestedType(1); + internal_static_google_pubsub_v1_IngestionFailureEvent_AvroFailureReason_fieldAccessorTable = + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_google_pubsub_v1_IngestionFailureEvent_AvroFailureReason_descriptor, + new java.lang.String[] {}); + internal_static_google_pubsub_v1_IngestionFailureEvent_SchemaViolationReason_descriptor = + internal_static_google_pubsub_v1_IngestionFailureEvent_descriptor.getNestedType(2); + internal_static_google_pubsub_v1_IngestionFailureEvent_SchemaViolationReason_fieldAccessorTable = + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_google_pubsub_v1_IngestionFailureEvent_SchemaViolationReason_descriptor, + new java.lang.String[] {}); + internal_static_google_pubsub_v1_IngestionFailureEvent_MessageTransformationFailureReason_descriptor = + internal_static_google_pubsub_v1_IngestionFailureEvent_descriptor.getNestedType(3); + internal_static_google_pubsub_v1_IngestionFailureEvent_MessageTransformationFailureReason_fieldAccessorTable = + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_google_pubsub_v1_IngestionFailureEvent_MessageTransformationFailureReason_descriptor, + new java.lang.String[] {}); + internal_static_google_pubsub_v1_IngestionFailureEvent_CloudStorageFailure_descriptor = + internal_static_google_pubsub_v1_IngestionFailureEvent_descriptor.getNestedType(4); + internal_static_google_pubsub_v1_IngestionFailureEvent_CloudStorageFailure_fieldAccessorTable = + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_google_pubsub_v1_IngestionFailureEvent_CloudStorageFailure_descriptor, + new java.lang.String[] { + "Bucket", + "ObjectName", + "ObjectGeneration", + "AvroFailureReason", + "ApiViolationReason", + "SchemaViolationReason", + "MessageTransformationFailureReason", + "Reason", + }); + internal_static_google_pubsub_v1_IngestionFailureEvent_AwsMskFailureReason_descriptor = + internal_static_google_pubsub_v1_IngestionFailureEvent_descriptor.getNestedType(5); + internal_static_google_pubsub_v1_IngestionFailureEvent_AwsMskFailureReason_fieldAccessorTable = + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_google_pubsub_v1_IngestionFailureEvent_AwsMskFailureReason_descriptor, + new java.lang.String[] { + "ClusterArn", + "KafkaTopic", + "PartitionId", + "Offset", + "ApiViolationReason", + "SchemaViolationReason", + "MessageTransformationFailureReason", + "Reason", + }); + internal_static_google_pubsub_v1_IngestionFailureEvent_AzureEventHubsFailureReason_descriptor = + internal_static_google_pubsub_v1_IngestionFailureEvent_descriptor.getNestedType(6); + internal_static_google_pubsub_v1_IngestionFailureEvent_AzureEventHubsFailureReason_fieldAccessorTable = + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_google_pubsub_v1_IngestionFailureEvent_AzureEventHubsFailureReason_descriptor, + new java.lang.String[] { + "Namespace", + "EventHub", + "PartitionId", + "Offset", + "ApiViolationReason", + "SchemaViolationReason", + "MessageTransformationFailureReason", + "Reason", + }); + internal_static_google_pubsub_v1_IngestionFailureEvent_ConfluentCloudFailureReason_descriptor = + internal_static_google_pubsub_v1_IngestionFailureEvent_descriptor.getNestedType(7); + internal_static_google_pubsub_v1_IngestionFailureEvent_ConfluentCloudFailureReason_fieldAccessorTable = + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_google_pubsub_v1_IngestionFailureEvent_ConfluentCloudFailureReason_descriptor, + new java.lang.String[] { + "ClusterId", + "KafkaTopic", + "PartitionId", + "Offset", + "ApiViolationReason", + "SchemaViolationReason", + "MessageTransformationFailureReason", + "Reason", + }); + internal_static_google_pubsub_v1_IngestionFailureEvent_AwsKinesisFailureReason_descriptor = + internal_static_google_pubsub_v1_IngestionFailureEvent_descriptor.getNestedType(8); + internal_static_google_pubsub_v1_IngestionFailureEvent_AwsKinesisFailureReason_fieldAccessorTable = + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_google_pubsub_v1_IngestionFailureEvent_AwsKinesisFailureReason_descriptor, + new java.lang.String[] { + "StreamArn", + "PartitionKey", + "SequenceNumber", + "SchemaViolationReason", + "MessageTransformationFailureReason", + "ApiViolationReason", + "Reason", + }); + internal_static_google_pubsub_v1_JavaScriptUDF_descriptor = getDescriptor().getMessageType(5); + internal_static_google_pubsub_v1_JavaScriptUDF_fieldAccessorTable = + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_google_pubsub_v1_JavaScriptUDF_descriptor, + new java.lang.String[] { + "FunctionName", "Code", + }); + internal_static_google_pubsub_v1_AIInference_descriptor = getDescriptor().getMessageType(6); + internal_static_google_pubsub_v1_AIInference_fieldAccessorTable = + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_google_pubsub_v1_AIInference_descriptor, + new java.lang.String[] { + "Endpoint", "UnstructuredInference", "ServiceAccountEmail", "InferenceMode", + }); + internal_static_google_pubsub_v1_AIInference_UnstructuredInference_descriptor = + internal_static_google_pubsub_v1_AIInference_descriptor.getNestedType(0); + internal_static_google_pubsub_v1_AIInference_UnstructuredInference_fieldAccessorTable = + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_google_pubsub_v1_AIInference_UnstructuredInference_descriptor, + new java.lang.String[] { + "Parameters", }); - internal_static_google_pubsub_v1_Topic_descriptor = getDescriptor().getMessageTypes().get(2); + internal_static_google_pubsub_v1_MessageTransform_descriptor = + getDescriptor().getMessageType(7); + internal_static_google_pubsub_v1_MessageTransform_fieldAccessorTable = + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_google_pubsub_v1_MessageTransform_descriptor, + new java.lang.String[] { + "JavascriptUdf", "AiInference", "Enabled", "Disabled", "Transform", + }); + internal_static_google_pubsub_v1_Topic_descriptor = getDescriptor().getMessageType(8); internal_static_google_pubsub_v1_Topic_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_Topic_descriptor, new java.lang.String[] { "Name", @@ -556,142 +1396,155 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "KmsKeyName", "SchemaSettings", "SatisfiesPzs", + "MessageRetentionDuration", + "State", + "IngestionDataSourceSettings", + "MessageTransforms", + "Tags", }); internal_static_google_pubsub_v1_Topic_LabelsEntry_descriptor = - internal_static_google_pubsub_v1_Topic_descriptor.getNestedTypes().get(0); + internal_static_google_pubsub_v1_Topic_descriptor.getNestedType(0); internal_static_google_pubsub_v1_Topic_LabelsEntry_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_Topic_LabelsEntry_descriptor, new java.lang.String[] { "Key", "Value", }); - internal_static_google_pubsub_v1_PubsubMessage_descriptor = - getDescriptor().getMessageTypes().get(3); + internal_static_google_pubsub_v1_Topic_TagsEntry_descriptor = + internal_static_google_pubsub_v1_Topic_descriptor.getNestedType(1); + internal_static_google_pubsub_v1_Topic_TagsEntry_fieldAccessorTable = + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_google_pubsub_v1_Topic_TagsEntry_descriptor, + new java.lang.String[] { + "Key", "Value", + }); + internal_static_google_pubsub_v1_PubsubMessage_descriptor = getDescriptor().getMessageType(9); internal_static_google_pubsub_v1_PubsubMessage_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_PubsubMessage_descriptor, new java.lang.String[] { "Data", "Attributes", "MessageId", "PublishTime", "OrderingKey", }); internal_static_google_pubsub_v1_PubsubMessage_AttributesEntry_descriptor = - internal_static_google_pubsub_v1_PubsubMessage_descriptor.getNestedTypes().get(0); + internal_static_google_pubsub_v1_PubsubMessage_descriptor.getNestedType(0); internal_static_google_pubsub_v1_PubsubMessage_AttributesEntry_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_PubsubMessage_AttributesEntry_descriptor, new java.lang.String[] { "Key", "Value", }); internal_static_google_pubsub_v1_GetTopicRequest_descriptor = - getDescriptor().getMessageTypes().get(4); + getDescriptor().getMessageType(10); internal_static_google_pubsub_v1_GetTopicRequest_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_GetTopicRequest_descriptor, new java.lang.String[] { "Topic", }); internal_static_google_pubsub_v1_UpdateTopicRequest_descriptor = - getDescriptor().getMessageTypes().get(5); + getDescriptor().getMessageType(11); internal_static_google_pubsub_v1_UpdateTopicRequest_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_UpdateTopicRequest_descriptor, new java.lang.String[] { "Topic", "UpdateMask", }); - internal_static_google_pubsub_v1_PublishRequest_descriptor = - getDescriptor().getMessageTypes().get(6); + internal_static_google_pubsub_v1_PublishRequest_descriptor = getDescriptor().getMessageType(12); internal_static_google_pubsub_v1_PublishRequest_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_PublishRequest_descriptor, new java.lang.String[] { "Topic", "Messages", }); internal_static_google_pubsub_v1_PublishResponse_descriptor = - getDescriptor().getMessageTypes().get(7); + getDescriptor().getMessageType(13); internal_static_google_pubsub_v1_PublishResponse_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_PublishResponse_descriptor, new java.lang.String[] { "MessageIds", }); internal_static_google_pubsub_v1_ListTopicsRequest_descriptor = - getDescriptor().getMessageTypes().get(8); + getDescriptor().getMessageType(14); internal_static_google_pubsub_v1_ListTopicsRequest_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_ListTopicsRequest_descriptor, new java.lang.String[] { "Project", "PageSize", "PageToken", }); internal_static_google_pubsub_v1_ListTopicsResponse_descriptor = - getDescriptor().getMessageTypes().get(9); + getDescriptor().getMessageType(15); internal_static_google_pubsub_v1_ListTopicsResponse_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_ListTopicsResponse_descriptor, new java.lang.String[] { "Topics", "NextPageToken", }); internal_static_google_pubsub_v1_ListTopicSubscriptionsRequest_descriptor = - getDescriptor().getMessageTypes().get(10); + getDescriptor().getMessageType(16); internal_static_google_pubsub_v1_ListTopicSubscriptionsRequest_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_ListTopicSubscriptionsRequest_descriptor, new java.lang.String[] { "Topic", "PageSize", "PageToken", }); internal_static_google_pubsub_v1_ListTopicSubscriptionsResponse_descriptor = - getDescriptor().getMessageTypes().get(11); + getDescriptor().getMessageType(17); internal_static_google_pubsub_v1_ListTopicSubscriptionsResponse_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_ListTopicSubscriptionsResponse_descriptor, new java.lang.String[] { "Subscriptions", "NextPageToken", }); internal_static_google_pubsub_v1_ListTopicSnapshotsRequest_descriptor = - getDescriptor().getMessageTypes().get(12); + getDescriptor().getMessageType(18); internal_static_google_pubsub_v1_ListTopicSnapshotsRequest_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_ListTopicSnapshotsRequest_descriptor, new java.lang.String[] { "Topic", "PageSize", "PageToken", }); internal_static_google_pubsub_v1_ListTopicSnapshotsResponse_descriptor = - getDescriptor().getMessageTypes().get(13); + getDescriptor().getMessageType(19); internal_static_google_pubsub_v1_ListTopicSnapshotsResponse_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_ListTopicSnapshotsResponse_descriptor, new java.lang.String[] { "Snapshots", "NextPageToken", }); internal_static_google_pubsub_v1_DeleteTopicRequest_descriptor = - getDescriptor().getMessageTypes().get(14); + getDescriptor().getMessageType(20); internal_static_google_pubsub_v1_DeleteTopicRequest_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_DeleteTopicRequest_descriptor, new java.lang.String[] { "Topic", }); internal_static_google_pubsub_v1_DetachSubscriptionRequest_descriptor = - getDescriptor().getMessageTypes().get(15); + getDescriptor().getMessageType(21); internal_static_google_pubsub_v1_DetachSubscriptionRequest_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_DetachSubscriptionRequest_descriptor, new java.lang.String[] { "Subscription", }); internal_static_google_pubsub_v1_DetachSubscriptionResponse_descriptor = - getDescriptor().getMessageTypes().get(16); + getDescriptor().getMessageType(22); internal_static_google_pubsub_v1_DetachSubscriptionResponse_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_DetachSubscriptionResponse_descriptor, new java.lang.String[] {}); - internal_static_google_pubsub_v1_Subscription_descriptor = - getDescriptor().getMessageTypes().get(17); + internal_static_google_pubsub_v1_Subscription_descriptor = getDescriptor().getMessageType(23); internal_static_google_pubsub_v1_Subscription_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_Subscription_descriptor, new java.lang.String[] { "Name", "Topic", "PushConfig", + "BigqueryConfig", + "CloudStorageConfig", + "BigtableConfig", "AckDeadlineSeconds", "RetainAckedMessages", "MessageRetentionDuration", @@ -702,155 +1555,246 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "DeadLetterPolicy", "RetryPolicy", "Detached", + "EnableExactlyOnceDelivery", + "TopicMessageRetentionDuration", + "State", + "AnalyticsHubSubscriptionInfo", + "MessageTransforms", + "Tags", + }); + internal_static_google_pubsub_v1_Subscription_AnalyticsHubSubscriptionInfo_descriptor = + internal_static_google_pubsub_v1_Subscription_descriptor.getNestedType(0); + internal_static_google_pubsub_v1_Subscription_AnalyticsHubSubscriptionInfo_fieldAccessorTable = + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_google_pubsub_v1_Subscription_AnalyticsHubSubscriptionInfo_descriptor, + new java.lang.String[] { + "Listing", "Subscription", }); internal_static_google_pubsub_v1_Subscription_LabelsEntry_descriptor = - internal_static_google_pubsub_v1_Subscription_descriptor.getNestedTypes().get(0); + internal_static_google_pubsub_v1_Subscription_descriptor.getNestedType(1); internal_static_google_pubsub_v1_Subscription_LabelsEntry_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_Subscription_LabelsEntry_descriptor, new java.lang.String[] { "Key", "Value", }); - internal_static_google_pubsub_v1_RetryPolicy_descriptor = - getDescriptor().getMessageTypes().get(18); + internal_static_google_pubsub_v1_Subscription_TagsEntry_descriptor = + internal_static_google_pubsub_v1_Subscription_descriptor.getNestedType(2); + internal_static_google_pubsub_v1_Subscription_TagsEntry_fieldAccessorTable = + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_google_pubsub_v1_Subscription_TagsEntry_descriptor, + new java.lang.String[] { + "Key", "Value", + }); + internal_static_google_pubsub_v1_RetryPolicy_descriptor = getDescriptor().getMessageType(24); internal_static_google_pubsub_v1_RetryPolicy_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_RetryPolicy_descriptor, new java.lang.String[] { "MinimumBackoff", "MaximumBackoff", }); internal_static_google_pubsub_v1_DeadLetterPolicy_descriptor = - getDescriptor().getMessageTypes().get(19); + getDescriptor().getMessageType(25); internal_static_google_pubsub_v1_DeadLetterPolicy_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_DeadLetterPolicy_descriptor, new java.lang.String[] { "DeadLetterTopic", "MaxDeliveryAttempts", }); internal_static_google_pubsub_v1_ExpirationPolicy_descriptor = - getDescriptor().getMessageTypes().get(20); + getDescriptor().getMessageType(26); internal_static_google_pubsub_v1_ExpirationPolicy_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_ExpirationPolicy_descriptor, new java.lang.String[] { "Ttl", }); - internal_static_google_pubsub_v1_PushConfig_descriptor = - getDescriptor().getMessageTypes().get(21); + internal_static_google_pubsub_v1_PushConfig_descriptor = getDescriptor().getMessageType(27); internal_static_google_pubsub_v1_PushConfig_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_PushConfig_descriptor, new java.lang.String[] { - "PushEndpoint", "Attributes", "OidcToken", "AuthenticationMethod", + "PushEndpoint", + "Attributes", + "OidcToken", + "PubsubWrapper", + "NoWrapper", + "AuthenticationMethod", + "Wrapper", }); internal_static_google_pubsub_v1_PushConfig_OidcToken_descriptor = - internal_static_google_pubsub_v1_PushConfig_descriptor.getNestedTypes().get(0); + internal_static_google_pubsub_v1_PushConfig_descriptor.getNestedType(0); internal_static_google_pubsub_v1_PushConfig_OidcToken_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_PushConfig_OidcToken_descriptor, new java.lang.String[] { "ServiceAccountEmail", "Audience", }); + internal_static_google_pubsub_v1_PushConfig_PubsubWrapper_descriptor = + internal_static_google_pubsub_v1_PushConfig_descriptor.getNestedType(1); + internal_static_google_pubsub_v1_PushConfig_PubsubWrapper_fieldAccessorTable = + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_google_pubsub_v1_PushConfig_PubsubWrapper_descriptor, + new java.lang.String[] {}); + internal_static_google_pubsub_v1_PushConfig_NoWrapper_descriptor = + internal_static_google_pubsub_v1_PushConfig_descriptor.getNestedType(2); + internal_static_google_pubsub_v1_PushConfig_NoWrapper_fieldAccessorTable = + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_google_pubsub_v1_PushConfig_NoWrapper_descriptor, + new java.lang.String[] { + "WriteMetadata", + }); internal_static_google_pubsub_v1_PushConfig_AttributesEntry_descriptor = - internal_static_google_pubsub_v1_PushConfig_descriptor.getNestedTypes().get(1); + internal_static_google_pubsub_v1_PushConfig_descriptor.getNestedType(3); internal_static_google_pubsub_v1_PushConfig_AttributesEntry_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_PushConfig_AttributesEntry_descriptor, new java.lang.String[] { "Key", "Value", }); + internal_static_google_pubsub_v1_BigQueryConfig_descriptor = getDescriptor().getMessageType(28); + internal_static_google_pubsub_v1_BigQueryConfig_fieldAccessorTable = + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_google_pubsub_v1_BigQueryConfig_descriptor, + new java.lang.String[] { + "Table", + "UseTopicSchema", + "WriteMetadata", + "DropUnknownFields", + "State", + "UseTableSchema", + "ServiceAccountEmail", + }); + internal_static_google_pubsub_v1_BigtableConfig_descriptor = getDescriptor().getMessageType(29); + internal_static_google_pubsub_v1_BigtableConfig_fieldAccessorTable = + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_google_pubsub_v1_BigtableConfig_descriptor, + new java.lang.String[] { + "Table", "AppProfileId", "ServiceAccountEmail", "WriteMetadata", "State", + }); + internal_static_google_pubsub_v1_CloudStorageConfig_descriptor = + getDescriptor().getMessageType(30); + internal_static_google_pubsub_v1_CloudStorageConfig_fieldAccessorTable = + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_google_pubsub_v1_CloudStorageConfig_descriptor, + new java.lang.String[] { + "Bucket", + "FilenamePrefix", + "FilenameSuffix", + "FilenameDatetimeFormat", + "TextConfig", + "AvroConfig", + "MaxDuration", + "MaxBytes", + "MaxMessages", + "State", + "ServiceAccountEmail", + "OutputFormat", + }); + internal_static_google_pubsub_v1_CloudStorageConfig_TextConfig_descriptor = + internal_static_google_pubsub_v1_CloudStorageConfig_descriptor.getNestedType(0); + internal_static_google_pubsub_v1_CloudStorageConfig_TextConfig_fieldAccessorTable = + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_google_pubsub_v1_CloudStorageConfig_TextConfig_descriptor, + new java.lang.String[] {}); + internal_static_google_pubsub_v1_CloudStorageConfig_AvroConfig_descriptor = + internal_static_google_pubsub_v1_CloudStorageConfig_descriptor.getNestedType(1); + internal_static_google_pubsub_v1_CloudStorageConfig_AvroConfig_fieldAccessorTable = + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_google_pubsub_v1_CloudStorageConfig_AvroConfig_descriptor, + new java.lang.String[] { + "WriteMetadata", "UseTopicSchema", + }); internal_static_google_pubsub_v1_ReceivedMessage_descriptor = - getDescriptor().getMessageTypes().get(22); + getDescriptor().getMessageType(31); internal_static_google_pubsub_v1_ReceivedMessage_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_ReceivedMessage_descriptor, new java.lang.String[] { "AckId", "Message", "DeliveryAttempt", }); internal_static_google_pubsub_v1_GetSubscriptionRequest_descriptor = - getDescriptor().getMessageTypes().get(23); + getDescriptor().getMessageType(32); internal_static_google_pubsub_v1_GetSubscriptionRequest_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_GetSubscriptionRequest_descriptor, new java.lang.String[] { "Subscription", }); internal_static_google_pubsub_v1_UpdateSubscriptionRequest_descriptor = - getDescriptor().getMessageTypes().get(24); + getDescriptor().getMessageType(33); internal_static_google_pubsub_v1_UpdateSubscriptionRequest_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_UpdateSubscriptionRequest_descriptor, new java.lang.String[] { "Subscription", "UpdateMask", }); internal_static_google_pubsub_v1_ListSubscriptionsRequest_descriptor = - getDescriptor().getMessageTypes().get(25); + getDescriptor().getMessageType(34); internal_static_google_pubsub_v1_ListSubscriptionsRequest_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_ListSubscriptionsRequest_descriptor, new java.lang.String[] { "Project", "PageSize", "PageToken", }); internal_static_google_pubsub_v1_ListSubscriptionsResponse_descriptor = - getDescriptor().getMessageTypes().get(26); + getDescriptor().getMessageType(35); internal_static_google_pubsub_v1_ListSubscriptionsResponse_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_ListSubscriptionsResponse_descriptor, new java.lang.String[] { "Subscriptions", "NextPageToken", }); internal_static_google_pubsub_v1_DeleteSubscriptionRequest_descriptor = - getDescriptor().getMessageTypes().get(27); + getDescriptor().getMessageType(36); internal_static_google_pubsub_v1_DeleteSubscriptionRequest_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_DeleteSubscriptionRequest_descriptor, new java.lang.String[] { "Subscription", }); internal_static_google_pubsub_v1_ModifyPushConfigRequest_descriptor = - getDescriptor().getMessageTypes().get(28); + getDescriptor().getMessageType(37); internal_static_google_pubsub_v1_ModifyPushConfigRequest_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_ModifyPushConfigRequest_descriptor, new java.lang.String[] { "Subscription", "PushConfig", }); - internal_static_google_pubsub_v1_PullRequest_descriptor = - getDescriptor().getMessageTypes().get(29); + internal_static_google_pubsub_v1_PullRequest_descriptor = getDescriptor().getMessageType(38); internal_static_google_pubsub_v1_PullRequest_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_PullRequest_descriptor, new java.lang.String[] { "Subscription", "ReturnImmediately", "MaxMessages", }); - internal_static_google_pubsub_v1_PullResponse_descriptor = - getDescriptor().getMessageTypes().get(30); + internal_static_google_pubsub_v1_PullResponse_descriptor = getDescriptor().getMessageType(39); internal_static_google_pubsub_v1_PullResponse_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_PullResponse_descriptor, new java.lang.String[] { "ReceivedMessages", }); internal_static_google_pubsub_v1_ModifyAckDeadlineRequest_descriptor = - getDescriptor().getMessageTypes().get(31); + getDescriptor().getMessageType(40); internal_static_google_pubsub_v1_ModifyAckDeadlineRequest_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_ModifyAckDeadlineRequest_descriptor, new java.lang.String[] { "Subscription", "AckIds", "AckDeadlineSeconds", }); internal_static_google_pubsub_v1_AcknowledgeRequest_descriptor = - getDescriptor().getMessageTypes().get(32); + getDescriptor().getMessageType(41); internal_static_google_pubsub_v1_AcknowledgeRequest_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_AcknowledgeRequest_descriptor, new java.lang.String[] { "Subscription", "AckIds", }); internal_static_google_pubsub_v1_StreamingPullRequest_descriptor = - getDescriptor().getMessageTypes().get(33); + getDescriptor().getMessageType(42); internal_static_google_pubsub_v1_StreamingPullRequest_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_StreamingPullRequest_descriptor, new java.lang.String[] { "Subscription", @@ -861,100 +1805,144 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "ClientId", "MaxOutstandingMessages", "MaxOutstandingBytes", + "ProtocolVersion", }); internal_static_google_pubsub_v1_StreamingPullResponse_descriptor = - getDescriptor().getMessageTypes().get(34); + getDescriptor().getMessageType(43); internal_static_google_pubsub_v1_StreamingPullResponse_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_StreamingPullResponse_descriptor, new java.lang.String[] { "ReceivedMessages", + "AcknowledgeConfirmation", + "ModifyAckDeadlineConfirmation", + "SubscriptionProperties", + }); + internal_static_google_pubsub_v1_StreamingPullResponse_AcknowledgeConfirmation_descriptor = + internal_static_google_pubsub_v1_StreamingPullResponse_descriptor.getNestedType(0); + internal_static_google_pubsub_v1_StreamingPullResponse_AcknowledgeConfirmation_fieldAccessorTable = + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_google_pubsub_v1_StreamingPullResponse_AcknowledgeConfirmation_descriptor, + new java.lang.String[] { + "AckIds", "InvalidAckIds", "UnorderedAckIds", "TemporaryFailedAckIds", + }); + internal_static_google_pubsub_v1_StreamingPullResponse_ModifyAckDeadlineConfirmation_descriptor = + internal_static_google_pubsub_v1_StreamingPullResponse_descriptor.getNestedType(1); + internal_static_google_pubsub_v1_StreamingPullResponse_ModifyAckDeadlineConfirmation_fieldAccessorTable = + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_google_pubsub_v1_StreamingPullResponse_ModifyAckDeadlineConfirmation_descriptor, + new java.lang.String[] { + "AckIds", "InvalidAckIds", "TemporaryFailedAckIds", + }); + internal_static_google_pubsub_v1_StreamingPullResponse_SubscriptionProperties_descriptor = + internal_static_google_pubsub_v1_StreamingPullResponse_descriptor.getNestedType(2); + internal_static_google_pubsub_v1_StreamingPullResponse_SubscriptionProperties_fieldAccessorTable = + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_google_pubsub_v1_StreamingPullResponse_SubscriptionProperties_descriptor, + new java.lang.String[] { + "ExactlyOnceDeliveryEnabled", "MessageOrderingEnabled", }); internal_static_google_pubsub_v1_CreateSnapshotRequest_descriptor = - getDescriptor().getMessageTypes().get(35); + getDescriptor().getMessageType(44); internal_static_google_pubsub_v1_CreateSnapshotRequest_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.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); + internal_static_google_pubsub_v1_CreateSnapshotRequest_descriptor.getNestedType(0); internal_static_google_pubsub_v1_CreateSnapshotRequest_LabelsEntry_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_CreateSnapshotRequest_LabelsEntry_descriptor, new java.lang.String[] { "Key", "Value", }); + internal_static_google_pubsub_v1_CreateSnapshotRequest_TagsEntry_descriptor = + internal_static_google_pubsub_v1_CreateSnapshotRequest_descriptor.getNestedType(1); + internal_static_google_pubsub_v1_CreateSnapshotRequest_TagsEntry_fieldAccessorTable = + new com.google.protobuf.GeneratedMessage.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(36); + getDescriptor().getMessageType(45); internal_static_google_pubsub_v1_UpdateSnapshotRequest_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_UpdateSnapshotRequest_descriptor, new java.lang.String[] { "Snapshot", "UpdateMask", }); - internal_static_google_pubsub_v1_Snapshot_descriptor = - getDescriptor().getMessageTypes().get(37); + internal_static_google_pubsub_v1_Snapshot_descriptor = getDescriptor().getMessageType(46); internal_static_google_pubsub_v1_Snapshot_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_Snapshot_descriptor, new java.lang.String[] { "Name", "Topic", "ExpireTime", "Labels", }); internal_static_google_pubsub_v1_Snapshot_LabelsEntry_descriptor = - internal_static_google_pubsub_v1_Snapshot_descriptor.getNestedTypes().get(0); + internal_static_google_pubsub_v1_Snapshot_descriptor.getNestedType(0); internal_static_google_pubsub_v1_Snapshot_LabelsEntry_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_Snapshot_LabelsEntry_descriptor, new java.lang.String[] { "Key", "Value", }); internal_static_google_pubsub_v1_GetSnapshotRequest_descriptor = - getDescriptor().getMessageTypes().get(38); + getDescriptor().getMessageType(47); internal_static_google_pubsub_v1_GetSnapshotRequest_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_GetSnapshotRequest_descriptor, new java.lang.String[] { "Snapshot", }); internal_static_google_pubsub_v1_ListSnapshotsRequest_descriptor = - getDescriptor().getMessageTypes().get(39); + getDescriptor().getMessageType(48); internal_static_google_pubsub_v1_ListSnapshotsRequest_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_ListSnapshotsRequest_descriptor, new java.lang.String[] { "Project", "PageSize", "PageToken", }); internal_static_google_pubsub_v1_ListSnapshotsResponse_descriptor = - getDescriptor().getMessageTypes().get(40); + getDescriptor().getMessageType(49); internal_static_google_pubsub_v1_ListSnapshotsResponse_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_ListSnapshotsResponse_descriptor, new java.lang.String[] { "Snapshots", "NextPageToken", }); internal_static_google_pubsub_v1_DeleteSnapshotRequest_descriptor = - getDescriptor().getMessageTypes().get(41); + getDescriptor().getMessageType(50); internal_static_google_pubsub_v1_DeleteSnapshotRequest_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_DeleteSnapshotRequest_descriptor, new java.lang.String[] { "Snapshot", }); - internal_static_google_pubsub_v1_SeekRequest_descriptor = - getDescriptor().getMessageTypes().get(42); + internal_static_google_pubsub_v1_SeekRequest_descriptor = getDescriptor().getMessageType(51); internal_static_google_pubsub_v1_SeekRequest_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_SeekRequest_descriptor, new java.lang.String[] { "Subscription", "Time", "Snapshot", "Target", }); - internal_static_google_pubsub_v1_SeekResponse_descriptor = - getDescriptor().getMessageTypes().get(43); + internal_static_google_pubsub_v1_SeekResponse_descriptor = getDescriptor().getMessageType(52); internal_static_google_pubsub_v1_SeekResponse_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_SeekResponse_descriptor, new java.lang.String[] {}); + descriptor.resolveAllFeaturesImmutable(); + com.google.api.AnnotationsProto.getDescriptor(); + com.google.api.ClientProto.getDescriptor(); + com.google.api.FieldBehaviorProto.getDescriptor(); + com.google.api.ResourceProto.getDescriptor(); + com.google.protobuf.DurationProto.getDescriptor(); + com.google.protobuf.EmptyProto.getDescriptor(); + com.google.protobuf.FieldMaskProto.getDescriptor(); + com.google.protobuf.StructProto.getDescriptor(); + com.google.protobuf.TimestampProto.getDescriptor(); + com.google.pubsub.v1.SchemaProto.getDescriptor(); com.google.protobuf.ExtensionRegistry registry = com.google.protobuf.ExtensionRegistry.newInstance(); registry.add(com.google.api.ClientProto.defaultHost); @@ -963,18 +1951,10 @@ 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); - com.google.api.AnnotationsProto.getDescriptor(); - com.google.api.ClientProto.getDescriptor(); - com.google.api.FieldBehaviorProto.getDescriptor(); - com.google.api.ResourceProto.getDescriptor(); - com.google.protobuf.DurationProto.getDescriptor(); - com.google.protobuf.EmptyProto.getDescriptor(); - com.google.protobuf.FieldMaskProto.getDescriptor(); - com.google.protobuf.TimestampProto.getDescriptor(); - com.google.pubsub.v1.SchemaProto.getDescriptor(); } // @@protoc_insertion_point(outer_class_scope) 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 4c59e15a5..79c5b0775 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 @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; @@ -27,13 +29,25 @@ * * Protobuf type {@code google.pubsub.v1.PullRequest} */ -public final class PullRequest extends com.google.protobuf.GeneratedMessageV3 +@com.google.protobuf.Generated +public final class PullRequest extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:google.pubsub.v1.PullRequest) PullRequestOrBuilder { private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "PullRequest"); + } + // Use PullRequest.newBuilder() to construct. - private PullRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + private PullRequest(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); } @@ -41,77 +55,12 @@ private PullRequest() { subscription_ = ""; } - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new PullRequest(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - private PullRequest( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - java.lang.String s = input.readStringRequireUtf8(); - - subscription_ = s; - break; - } - case 16: - { - returnImmediately_ = input.readBool(); - break; - } - case 24: - { - maxMessages_ = input.readInt32(); - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.pubsub.v1.PubsubProto.internal_static_google_pubsub_v1_PullRequest_descriptor; } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_PullRequest_fieldAccessorTable @@ -120,7 +69,10 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } public static final int SUBSCRIPTION_FIELD_NUMBER = 1; - private volatile java.lang.Object subscription_; + + @SuppressWarnings("serial") + private volatile java.lang.Object subscription_ = ""; + /** * * @@ -147,6 +99,7 @@ public java.lang.String getSubscription() { return s; } } + /** * * @@ -175,7 +128,8 @@ public com.google.protobuf.ByteString getSubscriptionBytes() { } public static final int RETURN_IMMEDIATELY_FIELD_NUMBER = 2; - private boolean returnImmediately_; + private boolean returnImmediately_ = false; + /** * * @@ -192,6 +146,8 @@ public com.google.protobuf.ByteString getSubscriptionBytes() { * bool return_immediately = 2 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; * * + * @deprecated google.pubsub.v1.PullRequest.return_immediately is deprecated. See + * google/pubsub/v1/pubsub.proto;l=2180 * @return The returnImmediately. */ @java.lang.Override @@ -201,7 +157,8 @@ public boolean getReturnImmediately() { } public static final int MAX_MESSAGES_FIELD_NUMBER = 3; - private int maxMessages_; + private int maxMessages_ = 0; + /** * * @@ -234,8 +191,8 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!getSubscriptionBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, subscription_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(subscription_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, subscription_); } if (returnImmediately_ != false) { output.writeBool(2, returnImmediately_); @@ -243,7 +200,7 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io if (maxMessages_ != 0) { output.writeInt32(3, maxMessages_); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -252,8 +209,8 @@ public int getSerializedSize() { if (size != -1) return size; size = 0; - if (!getSubscriptionBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, subscription_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(subscription_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, subscription_); } if (returnImmediately_ != false) { size += com.google.protobuf.CodedOutputStream.computeBoolSize(2, returnImmediately_); @@ -261,7 +218,7 @@ public int getSerializedSize() { if (maxMessages_ != 0) { size += com.google.protobuf.CodedOutputStream.computeInt32Size(3, maxMessages_); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -279,7 +236,7 @@ public boolean equals(final java.lang.Object obj) { if (!getSubscription().equals(other.getSubscription())) return false; if (getReturnImmediately() != other.getReturnImmediately()) return false; if (getMaxMessages() != other.getMaxMessages()) return false; - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -296,7 +253,7 @@ public int hashCode() { hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getReturnImmediately()); hash = (37 * hash) + MAX_MESSAGES_FIELD_NUMBER; hash = (53 * hash) + getMaxMessages(); - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -337,38 +294,38 @@ public static com.google.pubsub.v1.PullRequest parseFrom( public static com.google.pubsub.v1.PullRequest parseFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.PullRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.PullRequest parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); } public static com.google.pubsub.v1.PullRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.PullRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.PullRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } @@ -391,10 +348,11 @@ public Builder toBuilder() { } @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** * * @@ -404,7 +362,7 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build * * Protobuf type {@code google.pubsub.v1.PullRequest} */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements // @@protoc_insertion_point(builder_implements:google.pubsub.v1.PullRequest) com.google.pubsub.v1.PullRequestOrBuilder { @@ -414,7 +372,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_PullRequest_fieldAccessorTable @@ -424,28 +382,19 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } // Construct using com.google.pubsub.v1.PullRequest.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } + private Builder() {} - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} } @java.lang.Override public Builder clear() { super.clear(); + bitField0_ = 0; subscription_ = ""; - returnImmediately_ = false; - maxMessages_ = 0; - return this; } @@ -472,44 +421,24 @@ public com.google.pubsub.v1.PullRequest build() { @java.lang.Override public com.google.pubsub.v1.PullRequest buildPartial() { com.google.pubsub.v1.PullRequest result = new com.google.pubsub.v1.PullRequest(this); - result.subscription_ = subscription_; - result.returnImmediately_ = returnImmediately_; - result.maxMessages_ = maxMessages_; + if (bitField0_ != 0) { + buildPartial0(result); + } onBuilt(); return result; } - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); + private void buildPartial0(com.google.pubsub.v1.PullRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.subscription_ = subscription_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.returnImmediately_ = returnImmediately_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.maxMessages_ = maxMessages_; + } } @java.lang.Override @@ -526,6 +455,7 @@ public Builder mergeFrom(com.google.pubsub.v1.PullRequest other) { if (other == com.google.pubsub.v1.PullRequest.getDefaultInstance()) return this; if (!other.getSubscription().isEmpty()) { subscription_ = other.subscription_; + bitField0_ |= 0x00000001; onChanged(); } if (other.getReturnImmediately() != false) { @@ -534,7 +464,7 @@ public Builder mergeFrom(com.google.pubsub.v1.PullRequest other) { if (other.getMaxMessages() != 0) { setMaxMessages(other.getMaxMessages()); } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -549,21 +479,56 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.pubsub.v1.PullRequest parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + subscription_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 16: + { + returnImmediately_ = input.readBool(); + bitField0_ |= 0x00000002; + break; + } // case 16 + case 24: + { + maxMessages_ = input.readInt32(); + bitField0_ |= 0x00000004; + break; + } // case 24 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.google.pubsub.v1.PullRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } + private int bitField0_; + private java.lang.Object subscription_ = ""; + /** * * @@ -589,6 +554,7 @@ public java.lang.String getSubscription() { return (java.lang.String) ref; } } + /** * * @@ -614,6 +580,7 @@ public com.google.protobuf.ByteString getSubscriptionBytes() { return (com.google.protobuf.ByteString) ref; } } + /** * * @@ -633,11 +600,12 @@ public Builder setSubscription(java.lang.String value) { if (value == null) { throw new NullPointerException(); } - subscription_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } + /** * * @@ -653,11 +621,12 @@ public Builder setSubscription(java.lang.String value) { * @return This builder for chaining. */ public Builder clearSubscription() { - subscription_ = getDefaultInstance().getSubscription(); + bitField0_ = (bitField0_ & ~0x00000001); onChanged(); return this; } + /** * * @@ -678,13 +647,14 @@ public Builder setSubscriptionBytes(com.google.protobuf.ByteString value) { throw new NullPointerException(); } checkByteStringIsUtf8(value); - subscription_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } private boolean returnImmediately_; + /** * * @@ -702,6 +672,8 @@ public Builder setSubscriptionBytes(com.google.protobuf.ByteString value) { * bool return_immediately = 2 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; * * + * @deprecated google.pubsub.v1.PullRequest.return_immediately is deprecated. See + * google/pubsub/v1/pubsub.proto;l=2180 * @return The returnImmediately. */ @java.lang.Override @@ -709,6 +681,7 @@ public Builder setSubscriptionBytes(com.google.protobuf.ByteString value) { public boolean getReturnImmediately() { return returnImmediately_; } + /** * * @@ -726,6 +699,8 @@ public boolean getReturnImmediately() { * bool return_immediately = 2 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; * * + * @deprecated google.pubsub.v1.PullRequest.return_immediately is deprecated. See + * google/pubsub/v1/pubsub.proto;l=2180 * @param value The returnImmediately to set. * @return This builder for chaining. */ @@ -733,9 +708,11 @@ public boolean getReturnImmediately() { public Builder setReturnImmediately(boolean value) { returnImmediately_ = value; + bitField0_ |= 0x00000002; onChanged(); return this; } + /** * * @@ -753,17 +730,20 @@ public Builder setReturnImmediately(boolean value) { * bool return_immediately = 2 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; * * + * @deprecated google.pubsub.v1.PullRequest.return_immediately is deprecated. See + * google/pubsub/v1/pubsub.proto;l=2180 * @return This builder for chaining. */ @java.lang.Deprecated public Builder clearReturnImmediately() { - + bitField0_ = (bitField0_ & ~0x00000002); returnImmediately_ = false; onChanged(); return this; } private int maxMessages_; + /** * * @@ -781,6 +761,7 @@ public Builder clearReturnImmediately() { public int getMaxMessages() { return maxMessages_; } + /** * * @@ -798,9 +779,11 @@ public int getMaxMessages() { public Builder setMaxMessages(int value) { maxMessages_ = value; + bitField0_ |= 0x00000004; onChanged(); return this; } + /** * * @@ -815,23 +798,12 @@ public Builder setMaxMessages(int value) { * @return This builder for chaining. */ public Builder clearMaxMessages() { - + bitField0_ = (bitField0_ & ~0x00000004); maxMessages_ = 0; onChanged(); return this; } - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - // @@protoc_insertion_point(builder_scope:google.pubsub.v1.PullRequest) } @@ -853,7 +825,18 @@ public PullRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new PullRequest(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; 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 eb88907a9..1346ad309 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 @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; +@com.google.protobuf.Generated public interface PullRequestOrBuilder extends // @@protoc_insertion_point(interface_extends:google.pubsub.v1.PullRequest) @@ -38,6 +41,7 @@ public interface PullRequestOrBuilder * @return The subscription. */ java.lang.String getSubscription(); + /** * * @@ -70,6 +74,8 @@ public interface PullRequestOrBuilder * bool return_immediately = 2 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; * * + * @deprecated google.pubsub.v1.PullRequest.return_immediately is deprecated. See + * google/pubsub/v1/pubsub.proto;l=2180 * @return The returnImmediately. */ @java.lang.Deprecated diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PullResponse.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PullResponse.java index bca433c65..cad6472f0 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PullResponse.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PullResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; @@ -27,13 +29,25 @@ * * Protobuf type {@code google.pubsub.v1.PullResponse} */ -public final class PullResponse extends com.google.protobuf.GeneratedMessageV3 +@com.google.protobuf.Generated +public final class PullResponse extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:google.pubsub.v1.PullResponse) PullResponseOrBuilder { private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "PullResponse"); + } + // Use PullResponse.newBuilder() to construct. - private PullResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + private PullResponse(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); } @@ -41,76 +55,13 @@ private PullResponse() { receivedMessages_ = java.util.Collections.emptyList(); } - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new PullResponse(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - private PullResponse( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - if (!((mutable_bitField0_ & 0x00000001) != 0)) { - receivedMessages_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000001; - } - receivedMessages_.add( - input.readMessage( - com.google.pubsub.v1.ReceivedMessage.parser(), extensionRegistry)); - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000001) != 0)) { - receivedMessages_ = java.util.Collections.unmodifiableList(receivedMessages_); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_PullResponse_descriptor; } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_PullResponse_fieldAccessorTable @@ -120,83 +71,105 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } public static final int RECEIVED_MESSAGES_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") private java.util.List receivedMessages_; + /** * * *
    -   * Received Pub/Sub messages. The list will be empty if there are no more
    -   * messages available in the backlog. For JSON, the response can be entirely
    +   * Optional. Received Pub/Sub messages. The list will be empty if there are no
    +   * more messages available in the backlog, or if no messages could be returned
    +   * before the request timeout. For JSON, the response can be entirely
        * empty. The Pub/Sub system may return fewer than the `maxMessages` requested
        * even if there are more messages available in the backlog.
        * 
    * - * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1; + * + * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ @java.lang.Override public java.util.List getReceivedMessagesList() { return receivedMessages_; } + /** * * *
    -   * Received Pub/Sub messages. The list will be empty if there are no more
    -   * messages available in the backlog. For JSON, the response can be entirely
    +   * Optional. Received Pub/Sub messages. The list will be empty if there are no
    +   * more messages available in the backlog, or if no messages could be returned
    +   * before the request timeout. For JSON, the response can be entirely
        * empty. The Pub/Sub system may return fewer than the `maxMessages` requested
        * even if there are more messages available in the backlog.
        * 
    * - * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1; + * + * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ @java.lang.Override public java.util.List getReceivedMessagesOrBuilderList() { return receivedMessages_; } + /** * * *
    -   * Received Pub/Sub messages. The list will be empty if there are no more
    -   * messages available in the backlog. For JSON, the response can be entirely
    +   * Optional. Received Pub/Sub messages. The list will be empty if there are no
    +   * more messages available in the backlog, or if no messages could be returned
    +   * before the request timeout. For JSON, the response can be entirely
        * empty. The Pub/Sub system may return fewer than the `maxMessages` requested
        * even if there are more messages available in the backlog.
        * 
    * - * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1; + * + * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ @java.lang.Override public int getReceivedMessagesCount() { return receivedMessages_.size(); } + /** * * *
    -   * Received Pub/Sub messages. The list will be empty if there are no more
    -   * messages available in the backlog. For JSON, the response can be entirely
    +   * Optional. Received Pub/Sub messages. The list will be empty if there are no
    +   * more messages available in the backlog, or if no messages could be returned
    +   * before the request timeout. For JSON, the response can be entirely
        * empty. The Pub/Sub system may return fewer than the `maxMessages` requested
        * even if there are more messages available in the backlog.
        * 
    * - * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1; + * + * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ @java.lang.Override public com.google.pubsub.v1.ReceivedMessage getReceivedMessages(int index) { return receivedMessages_.get(index); } + /** * * *
    -   * Received Pub/Sub messages. The list will be empty if there are no more
    -   * messages available in the backlog. For JSON, the response can be entirely
    +   * Optional. Received Pub/Sub messages. The list will be empty if there are no
    +   * more messages available in the backlog, or if no messages could be returned
    +   * before the request timeout. For JSON, the response can be entirely
        * empty. The Pub/Sub system may return fewer than the `maxMessages` requested
        * even if there are more messages available in the backlog.
        * 
    * - * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1; + * + * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ @java.lang.Override public com.google.pubsub.v1.ReceivedMessageOrBuilder getReceivedMessagesOrBuilder(int index) { @@ -220,7 +193,7 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io for (int i = 0; i < receivedMessages_.size(); i++) { output.writeMessage(1, receivedMessages_.get(i)); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -232,7 +205,7 @@ public int getSerializedSize() { for (int i = 0; i < receivedMessages_.size(); i++) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, receivedMessages_.get(i)); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -248,7 +221,7 @@ public boolean equals(final java.lang.Object obj) { com.google.pubsub.v1.PullResponse other = (com.google.pubsub.v1.PullResponse) obj; if (!getReceivedMessagesList().equals(other.getReceivedMessagesList())) return false; - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -263,7 +236,7 @@ public int hashCode() { hash = (37 * hash) + RECEIVED_MESSAGES_FIELD_NUMBER; hash = (53 * hash) + getReceivedMessagesList().hashCode(); } - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -304,38 +277,38 @@ public static com.google.pubsub.v1.PullResponse parseFrom( public static com.google.pubsub.v1.PullResponse parseFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.PullResponse parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.PullResponse parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); } public static com.google.pubsub.v1.PullResponse parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.PullResponse parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.PullResponse parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } @@ -358,10 +331,11 @@ public Builder toBuilder() { } @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** * * @@ -371,7 +345,7 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build * * Protobuf type {@code google.pubsub.v1.PullResponse} */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements // @@protoc_insertion_point(builder_implements:google.pubsub.v1.PullResponse) com.google.pubsub.v1.PullResponseOrBuilder { @@ -381,7 +355,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_PullResponse_fieldAccessorTable @@ -391,30 +365,23 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } // Construct using com.google.pubsub.v1.PullResponse.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } + private Builder() {} - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { - getReceivedMessagesFieldBuilder(); - } } @java.lang.Override public Builder clear() { super.clear(); + bitField0_ = 0; if (receivedMessagesBuilder_ == null) { receivedMessages_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); } else { + receivedMessages_ = null; receivedMessagesBuilder_.clear(); } + bitField0_ = (bitField0_ & ~0x00000001); return this; } @@ -441,7 +408,15 @@ public com.google.pubsub.v1.PullResponse build() { @java.lang.Override public com.google.pubsub.v1.PullResponse buildPartial() { com.google.pubsub.v1.PullResponse result = new com.google.pubsub.v1.PullResponse(this); - int from_bitField0_ = bitField0_; + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields(com.google.pubsub.v1.PullResponse result) { if (receivedMessagesBuilder_ == null) { if (((bitField0_ & 0x00000001) != 0)) { receivedMessages_ = java.util.Collections.unmodifiableList(receivedMessages_); @@ -451,41 +426,10 @@ public com.google.pubsub.v1.PullResponse buildPartial() { } else { result.receivedMessages_ = receivedMessagesBuilder_.build(); } - onBuilt(); - return result; - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); } - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); + private void buildPartial0(com.google.pubsub.v1.PullResponse result) { + int from_bitField0_ = bitField0_; } @java.lang.Override @@ -519,15 +463,15 @@ public Builder mergeFrom(com.google.pubsub.v1.PullResponse other) { receivedMessages_ = other.receivedMessages_; bitField0_ = (bitField0_ & ~0x00000001); receivedMessagesBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders - ? getReceivedMessagesFieldBuilder() + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders + ? internalGetReceivedMessagesFieldBuilder() : null; } else { receivedMessagesBuilder_.addAllMessages(other.receivedMessages_); } } } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -542,17 +486,44 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.pubsub.v1.PullResponse parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.pubsub.v1.ReceivedMessage m = + input.readMessage( + com.google.pubsub.v1.ReceivedMessage.parser(), extensionRegistry); + if (receivedMessagesBuilder_ == null) { + ensureReceivedMessagesIsMutable(); + receivedMessages_.add(m); + } else { + receivedMessagesBuilder_.addMessage(m); + } + break; + } // case 10 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.google.pubsub.v1.PullResponse) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } @@ -569,7 +540,7 @@ private void ensureReceivedMessagesIsMutable() { } } - private com.google.protobuf.RepeatedFieldBuilderV3< + private com.google.protobuf.RepeatedFieldBuilder< com.google.pubsub.v1.ReceivedMessage, com.google.pubsub.v1.ReceivedMessage.Builder, com.google.pubsub.v1.ReceivedMessageOrBuilder> @@ -579,13 +550,16 @@ private void ensureReceivedMessagesIsMutable() { * * *
    -     * Received Pub/Sub messages. The list will be empty if there are no more
    -     * messages available in the backlog. For JSON, the response can be entirely
    +     * Optional. Received Pub/Sub messages. The list will be empty if there are no
    +     * more messages available in the backlog, or if no messages could be returned
    +     * before the request timeout. For JSON, the response can be entirely
          * empty. The Pub/Sub system may return fewer than the `maxMessages` requested
          * even if there are more messages available in the backlog.
          * 
    * - * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1; + * + * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public java.util.List getReceivedMessagesList() { if (receivedMessagesBuilder_ == null) { @@ -594,17 +568,21 @@ public java.util.List getReceivedMessagesL return receivedMessagesBuilder_.getMessageList(); } } + /** * * *
    -     * Received Pub/Sub messages. The list will be empty if there are no more
    -     * messages available in the backlog. For JSON, the response can be entirely
    +     * Optional. Received Pub/Sub messages. The list will be empty if there are no
    +     * more messages available in the backlog, or if no messages could be returned
    +     * before the request timeout. For JSON, the response can be entirely
          * empty. The Pub/Sub system may return fewer than the `maxMessages` requested
          * even if there are more messages available in the backlog.
          * 
    * - * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1; + * + * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public int getReceivedMessagesCount() { if (receivedMessagesBuilder_ == null) { @@ -613,17 +591,21 @@ public int getReceivedMessagesCount() { return receivedMessagesBuilder_.getCount(); } } + /** * * *
    -     * Received Pub/Sub messages. The list will be empty if there are no more
    -     * messages available in the backlog. For JSON, the response can be entirely
    +     * Optional. Received Pub/Sub messages. The list will be empty if there are no
    +     * more messages available in the backlog, or if no messages could be returned
    +     * before the request timeout. For JSON, the response can be entirely
          * empty. The Pub/Sub system may return fewer than the `maxMessages` requested
          * even if there are more messages available in the backlog.
          * 
    * - * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1; + * + * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public com.google.pubsub.v1.ReceivedMessage getReceivedMessages(int index) { if (receivedMessagesBuilder_ == null) { @@ -632,17 +614,21 @@ public com.google.pubsub.v1.ReceivedMessage getReceivedMessages(int index) { return receivedMessagesBuilder_.getMessage(index); } } + /** * * *
    -     * Received Pub/Sub messages. The list will be empty if there are no more
    -     * messages available in the backlog. For JSON, the response can be entirely
    +     * Optional. Received Pub/Sub messages. The list will be empty if there are no
    +     * more messages available in the backlog, or if no messages could be returned
    +     * before the request timeout. For JSON, the response can be entirely
          * empty. The Pub/Sub system may return fewer than the `maxMessages` requested
          * even if there are more messages available in the backlog.
          * 
    * - * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1; + * + * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public Builder setReceivedMessages(int index, com.google.pubsub.v1.ReceivedMessage value) { if (receivedMessagesBuilder_ == null) { @@ -657,17 +643,21 @@ public Builder setReceivedMessages(int index, com.google.pubsub.v1.ReceivedMessa } return this; } + /** * * *
    -     * Received Pub/Sub messages. The list will be empty if there are no more
    -     * messages available in the backlog. For JSON, the response can be entirely
    +     * Optional. Received Pub/Sub messages. The list will be empty if there are no
    +     * more messages available in the backlog, or if no messages could be returned
    +     * before the request timeout. For JSON, the response can be entirely
          * empty. The Pub/Sub system may return fewer than the `maxMessages` requested
          * even if there are more messages available in the backlog.
          * 
    * - * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1; + * + * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public Builder setReceivedMessages( int index, com.google.pubsub.v1.ReceivedMessage.Builder builderForValue) { @@ -680,17 +670,21 @@ public Builder setReceivedMessages( } return this; } + /** * * *
    -     * Received Pub/Sub messages. The list will be empty if there are no more
    -     * messages available in the backlog. For JSON, the response can be entirely
    +     * Optional. Received Pub/Sub messages. The list will be empty if there are no
    +     * more messages available in the backlog, or if no messages could be returned
    +     * before the request timeout. For JSON, the response can be entirely
          * empty. The Pub/Sub system may return fewer than the `maxMessages` requested
          * even if there are more messages available in the backlog.
          * 
    * - * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1; + * + * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public Builder addReceivedMessages(com.google.pubsub.v1.ReceivedMessage value) { if (receivedMessagesBuilder_ == null) { @@ -705,17 +699,21 @@ public Builder addReceivedMessages(com.google.pubsub.v1.ReceivedMessage value) { } return this; } + /** * * *
    -     * Received Pub/Sub messages. The list will be empty if there are no more
    -     * messages available in the backlog. For JSON, the response can be entirely
    +     * Optional. Received Pub/Sub messages. The list will be empty if there are no
    +     * more messages available in the backlog, or if no messages could be returned
    +     * before the request timeout. For JSON, the response can be entirely
          * empty. The Pub/Sub system may return fewer than the `maxMessages` requested
          * even if there are more messages available in the backlog.
          * 
    * - * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1; + * + * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public Builder addReceivedMessages(int index, com.google.pubsub.v1.ReceivedMessage value) { if (receivedMessagesBuilder_ == null) { @@ -730,17 +728,21 @@ public Builder addReceivedMessages(int index, com.google.pubsub.v1.ReceivedMessa } return this; } + /** * * *
    -     * Received Pub/Sub messages. The list will be empty if there are no more
    -     * messages available in the backlog. For JSON, the response can be entirely
    +     * Optional. Received Pub/Sub messages. The list will be empty if there are no
    +     * more messages available in the backlog, or if no messages could be returned
    +     * before the request timeout. For JSON, the response can be entirely
          * empty. The Pub/Sub system may return fewer than the `maxMessages` requested
          * even if there are more messages available in the backlog.
          * 
    * - * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1; + * + * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public Builder addReceivedMessages( com.google.pubsub.v1.ReceivedMessage.Builder builderForValue) { @@ -753,17 +755,21 @@ public Builder addReceivedMessages( } return this; } + /** * * *
    -     * Received Pub/Sub messages. The list will be empty if there are no more
    -     * messages available in the backlog. For JSON, the response can be entirely
    +     * Optional. Received Pub/Sub messages. The list will be empty if there are no
    +     * more messages available in the backlog, or if no messages could be returned
    +     * before the request timeout. For JSON, the response can be entirely
          * empty. The Pub/Sub system may return fewer than the `maxMessages` requested
          * even if there are more messages available in the backlog.
          * 
    * - * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1; + * + * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public Builder addReceivedMessages( int index, com.google.pubsub.v1.ReceivedMessage.Builder builderForValue) { @@ -776,17 +782,21 @@ public Builder addReceivedMessages( } return this; } + /** * * *
    -     * Received Pub/Sub messages. The list will be empty if there are no more
    -     * messages available in the backlog. For JSON, the response can be entirely
    +     * Optional. Received Pub/Sub messages. The list will be empty if there are no
    +     * more messages available in the backlog, or if no messages could be returned
    +     * before the request timeout. For JSON, the response can be entirely
          * empty. The Pub/Sub system may return fewer than the `maxMessages` requested
          * even if there are more messages available in the backlog.
          * 
    * - * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1; + * + * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public Builder addAllReceivedMessages( java.lang.Iterable values) { @@ -799,17 +809,21 @@ public Builder addAllReceivedMessages( } return this; } + /** * * *
    -     * Received Pub/Sub messages. The list will be empty if there are no more
    -     * messages available in the backlog. For JSON, the response can be entirely
    +     * Optional. Received Pub/Sub messages. The list will be empty if there are no
    +     * more messages available in the backlog, or if no messages could be returned
    +     * before the request timeout. For JSON, the response can be entirely
          * empty. The Pub/Sub system may return fewer than the `maxMessages` requested
          * even if there are more messages available in the backlog.
          * 
    * - * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1; + * + * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public Builder clearReceivedMessages() { if (receivedMessagesBuilder_ == null) { @@ -821,17 +835,21 @@ public Builder clearReceivedMessages() { } return this; } + /** * * *
    -     * Received Pub/Sub messages. The list will be empty if there are no more
    -     * messages available in the backlog. For JSON, the response can be entirely
    +     * Optional. Received Pub/Sub messages. The list will be empty if there are no
    +     * more messages available in the backlog, or if no messages could be returned
    +     * before the request timeout. For JSON, the response can be entirely
          * empty. The Pub/Sub system may return fewer than the `maxMessages` requested
          * even if there are more messages available in the backlog.
          * 
    * - * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1; + * + * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public Builder removeReceivedMessages(int index) { if (receivedMessagesBuilder_ == null) { @@ -843,32 +861,40 @@ public Builder removeReceivedMessages(int index) { } return this; } + /** * * *
    -     * Received Pub/Sub messages. The list will be empty if there are no more
    -     * messages available in the backlog. For JSON, the response can be entirely
    +     * Optional. Received Pub/Sub messages. The list will be empty if there are no
    +     * more messages available in the backlog, or if no messages could be returned
    +     * before the request timeout. For JSON, the response can be entirely
          * empty. The Pub/Sub system may return fewer than the `maxMessages` requested
          * even if there are more messages available in the backlog.
          * 
    * - * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1; + * + * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public com.google.pubsub.v1.ReceivedMessage.Builder getReceivedMessagesBuilder(int index) { - return getReceivedMessagesFieldBuilder().getBuilder(index); + return internalGetReceivedMessagesFieldBuilder().getBuilder(index); } + /** * * *
    -     * Received Pub/Sub messages. The list will be empty if there are no more
    -     * messages available in the backlog. For JSON, the response can be entirely
    +     * Optional. Received Pub/Sub messages. The list will be empty if there are no
    +     * more messages available in the backlog, or if no messages could be returned
    +     * before the request timeout. For JSON, the response can be entirely
          * empty. The Pub/Sub system may return fewer than the `maxMessages` requested
          * even if there are more messages available in the backlog.
          * 
    * - * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1; + * + * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public com.google.pubsub.v1.ReceivedMessageOrBuilder getReceivedMessagesOrBuilder(int index) { if (receivedMessagesBuilder_ == null) { @@ -877,17 +903,21 @@ public com.google.pubsub.v1.ReceivedMessageOrBuilder getReceivedMessagesOrBuilde return receivedMessagesBuilder_.getMessageOrBuilder(index); } } + /** * * *
    -     * Received Pub/Sub messages. The list will be empty if there are no more
    -     * messages available in the backlog. For JSON, the response can be entirely
    +     * Optional. Received Pub/Sub messages. The list will be empty if there are no
    +     * more messages available in the backlog, or if no messages could be returned
    +     * before the request timeout. For JSON, the response can be entirely
          * empty. The Pub/Sub system may return fewer than the `maxMessages` requested
          * even if there are more messages available in the backlog.
          * 
    * - * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1; + * + * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public java.util.List getReceivedMessagesOrBuilderList() { @@ -897,63 +927,75 @@ public com.google.pubsub.v1.ReceivedMessageOrBuilder getReceivedMessagesOrBuilde return java.util.Collections.unmodifiableList(receivedMessages_); } } + /** * * *
    -     * Received Pub/Sub messages. The list will be empty if there are no more
    -     * messages available in the backlog. For JSON, the response can be entirely
    +     * Optional. Received Pub/Sub messages. The list will be empty if there are no
    +     * more messages available in the backlog, or if no messages could be returned
    +     * before the request timeout. For JSON, the response can be entirely
          * empty. The Pub/Sub system may return fewer than the `maxMessages` requested
          * even if there are more messages available in the backlog.
          * 
    * - * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1; + * + * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public com.google.pubsub.v1.ReceivedMessage.Builder addReceivedMessagesBuilder() { - return getReceivedMessagesFieldBuilder() + return internalGetReceivedMessagesFieldBuilder() .addBuilder(com.google.pubsub.v1.ReceivedMessage.getDefaultInstance()); } + /** * * *
    -     * Received Pub/Sub messages. The list will be empty if there are no more
    -     * messages available in the backlog. For JSON, the response can be entirely
    +     * Optional. Received Pub/Sub messages. The list will be empty if there are no
    +     * more messages available in the backlog, or if no messages could be returned
    +     * before the request timeout. For JSON, the response can be entirely
          * empty. The Pub/Sub system may return fewer than the `maxMessages` requested
          * even if there are more messages available in the backlog.
          * 
    * - * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1; + * + * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public com.google.pubsub.v1.ReceivedMessage.Builder addReceivedMessagesBuilder(int index) { - return getReceivedMessagesFieldBuilder() + return internalGetReceivedMessagesFieldBuilder() .addBuilder(index, com.google.pubsub.v1.ReceivedMessage.getDefaultInstance()); } + /** * * *
    -     * Received Pub/Sub messages. The list will be empty if there are no more
    -     * messages available in the backlog. For JSON, the response can be entirely
    +     * Optional. Received Pub/Sub messages. The list will be empty if there are no
    +     * more messages available in the backlog, or if no messages could be returned
    +     * before the request timeout. For JSON, the response can be entirely
          * empty. The Pub/Sub system may return fewer than the `maxMessages` requested
          * even if there are more messages available in the backlog.
          * 
    * - * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1; + * + * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public java.util.List getReceivedMessagesBuilderList() { - return getReceivedMessagesFieldBuilder().getBuilderList(); + return internalGetReceivedMessagesFieldBuilder().getBuilderList(); } - private com.google.protobuf.RepeatedFieldBuilderV3< + private com.google.protobuf.RepeatedFieldBuilder< com.google.pubsub.v1.ReceivedMessage, com.google.pubsub.v1.ReceivedMessage.Builder, com.google.pubsub.v1.ReceivedMessageOrBuilder> - getReceivedMessagesFieldBuilder() { + internalGetReceivedMessagesFieldBuilder() { if (receivedMessagesBuilder_ == null) { receivedMessagesBuilder_ = - new com.google.protobuf.RepeatedFieldBuilderV3< + new com.google.protobuf.RepeatedFieldBuilder< com.google.pubsub.v1.ReceivedMessage, com.google.pubsub.v1.ReceivedMessage.Builder, com.google.pubsub.v1.ReceivedMessageOrBuilder>( @@ -966,17 +1008,6 @@ public com.google.pubsub.v1.ReceivedMessage.Builder addReceivedMessagesBuilder(i return receivedMessagesBuilder_; } - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - // @@protoc_insertion_point(builder_scope:google.pubsub.v1.PullResponse) } @@ -998,7 +1029,18 @@ public PullResponse parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new PullResponse(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PullResponseOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PullResponseOrBuilder.java index f7843870e..98cb9ba32 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PullResponseOrBuilder.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PullResponseOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; +@com.google.protobuf.Generated public interface PullResponseOrBuilder extends // @@protoc_insertion_point(interface_extends:google.pubsub.v1.PullResponse) @@ -27,66 +30,85 @@ public interface PullResponseOrBuilder * * *
    -   * Received Pub/Sub messages. The list will be empty if there are no more
    -   * messages available in the backlog. For JSON, the response can be entirely
    +   * Optional. Received Pub/Sub messages. The list will be empty if there are no
    +   * more messages available in the backlog, or if no messages could be returned
    +   * before the request timeout. For JSON, the response can be entirely
        * empty. The Pub/Sub system may return fewer than the `maxMessages` requested
        * even if there are more messages available in the backlog.
        * 
    * - * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1; + * + * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ java.util.List getReceivedMessagesList(); + /** * * *
    -   * Received Pub/Sub messages. The list will be empty if there are no more
    -   * messages available in the backlog. For JSON, the response can be entirely
    +   * Optional. Received Pub/Sub messages. The list will be empty if there are no
    +   * more messages available in the backlog, or if no messages could be returned
    +   * before the request timeout. For JSON, the response can be entirely
        * empty. The Pub/Sub system may return fewer than the `maxMessages` requested
        * even if there are more messages available in the backlog.
        * 
    * - * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1; + * + * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ com.google.pubsub.v1.ReceivedMessage getReceivedMessages(int index); + /** * * *
    -   * Received Pub/Sub messages. The list will be empty if there are no more
    -   * messages available in the backlog. For JSON, the response can be entirely
    +   * Optional. Received Pub/Sub messages. The list will be empty if there are no
    +   * more messages available in the backlog, or if no messages could be returned
    +   * before the request timeout. For JSON, the response can be entirely
        * empty. The Pub/Sub system may return fewer than the `maxMessages` requested
        * even if there are more messages available in the backlog.
        * 
    * - * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1; + * + * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ int getReceivedMessagesCount(); + /** * * *
    -   * Received Pub/Sub messages. The list will be empty if there are no more
    -   * messages available in the backlog. For JSON, the response can be entirely
    +   * Optional. Received Pub/Sub messages. The list will be empty if there are no
    +   * more messages available in the backlog, or if no messages could be returned
    +   * before the request timeout. For JSON, the response can be entirely
        * empty. The Pub/Sub system may return fewer than the `maxMessages` requested
        * even if there are more messages available in the backlog.
        * 
    * - * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1; + * + * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ java.util.List getReceivedMessagesOrBuilderList(); + /** * * *
    -   * Received Pub/Sub messages. The list will be empty if there are no more
    -   * messages available in the backlog. For JSON, the response can be entirely
    +   * Optional. Received Pub/Sub messages. The list will be empty if there are no
    +   * more messages available in the backlog, or if no messages could be returned
    +   * before the request timeout. For JSON, the response can be entirely
        * empty. The Pub/Sub system may return fewer than the `maxMessages` requested
        * even if there are more messages available in the backlog.
        * 
    * - * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1; + * + * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ com.google.pubsub.v1.ReceivedMessageOrBuilder getReceivedMessagesOrBuilder(int index); } diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PushConfig.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PushConfig.java index 12614a75b..304cd75ab 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PushConfig.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PushConfig.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; @@ -27,13 +29,25 @@ * * Protobuf type {@code google.pubsub.v1.PushConfig} */ -public final class PushConfig extends com.google.protobuf.GeneratedMessageV3 +@com.google.protobuf.Generated +public final class PushConfig extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:google.pubsub.v1.PushConfig) PushConfigOrBuilder { private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "PushConfig"); + } + // Use PushConfig.newBuilder() to construct. - private PushConfig(com.google.protobuf.GeneratedMessageV3.Builder builder) { + private PushConfig(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); } @@ -41,102 +55,14 @@ private PushConfig() { pushEndpoint_ = ""; } - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new PushConfig(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - private PushConfig( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - java.lang.String s = input.readStringRequireUtf8(); - - pushEndpoint_ = s; - break; - } - case 18: - { - if (!((mutable_bitField0_ & 0x00000001) != 0)) { - attributes_ = - com.google.protobuf.MapField.newMapField( - AttributesDefaultEntryHolder.defaultEntry); - mutable_bitField0_ |= 0x00000001; - } - com.google.protobuf.MapEntry attributes__ = - input.readMessage( - AttributesDefaultEntryHolder.defaultEntry.getParserForType(), - extensionRegistry); - attributes_.getMutableMap().put(attributes__.getKey(), attributes__.getValue()); - break; - } - case 26: - { - com.google.pubsub.v1.PushConfig.OidcToken.Builder subBuilder = null; - if (authenticationMethodCase_ == 3) { - subBuilder = - ((com.google.pubsub.v1.PushConfig.OidcToken) authenticationMethod_).toBuilder(); - } - authenticationMethod_ = - input.readMessage( - com.google.pubsub.v1.PushConfig.OidcToken.parser(), extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom( - (com.google.pubsub.v1.PushConfig.OidcToken) authenticationMethod_); - authenticationMethod_ = subBuilder.buildPartial(); - } - authenticationMethodCase_ = 3; - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.pubsub.v1.PubsubProto.internal_static_google_pubsub_v1_PushConfig_descriptor; } @SuppressWarnings({"rawtypes"}) @java.lang.Override - protected com.google.protobuf.MapField internalGetMapField(int number) { + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldReflection( + int number) { switch (number) { case 2: return internalGetAttributes(); @@ -146,7 +72,7 @@ protected com.google.protobuf.MapField internalGetMapField(int number) { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_PushConfig_fieldAccessorTable @@ -163,30 +89,31 @@ public interface OidcTokenOrBuilder * * *
    -     * [Service account
    +     * Optional. [Service account
          * email](https://cloud.google.com/iam/docs/service-accounts)
    -     * to be used for generating the OIDC token. The caller (for
    -     * CreateSubscription, UpdateSubscription, and ModifyPushConfig RPCs) must
    -     * have the iam.serviceAccounts.actAs permission for the service account.
    +     * used for generating the OIDC token. For more information
    +     * on setting up authentication, see
    +     * [Push subscriptions](https://cloud.google.com/pubsub/docs/push).
          * 
    * - * string service_account_email = 1; + * string service_account_email = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @return The serviceAccountEmail. */ java.lang.String getServiceAccountEmail(); + /** * * *
    -     * [Service account
    +     * Optional. [Service account
          * email](https://cloud.google.com/iam/docs/service-accounts)
    -     * to be used for generating the OIDC token. The caller (for
    -     * CreateSubscription, UpdateSubscription, and ModifyPushConfig RPCs) must
    -     * have the iam.serviceAccounts.actAs permission for the service account.
    +     * used for generating the OIDC token. For more information
    +     * on setting up authentication, see
    +     * [Push subscriptions](https://cloud.google.com/pubsub/docs/push).
          * 
    * - * string service_account_email = 1; + * string service_account_email = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @return The bytes for serviceAccountEmail. */ @@ -196,37 +123,41 @@ public interface OidcTokenOrBuilder * * *
    -     * Audience to be used when generating OIDC token. The audience claim
    -     * identifies the recipients that the JWT is intended for. The audience
    -     * value is a single case-sensitive string. Having multiple values (array)
    -     * for the audience field is not supported. More info about the OIDC JWT
    -     * token audience here: https://tools.ietf.org/html/rfc7519#section-4.1.3
    -     * Note: if not specified, the Push endpoint URL will be used.
    +     * Optional. Audience to be used when generating OIDC token. The audience
    +     * claim identifies the recipients that the JWT is intended for. The
    +     * audience value is a single case-sensitive string. Having multiple values
    +     * (array) for the audience field is not supported. More info about the OIDC
    +     * JWT token audience here:
    +     * https://tools.ietf.org/html/rfc7519#section-4.1.3 Note: if not specified,
    +     * the Push endpoint URL will be used.
          * 
    * - * string audience = 2; + * string audience = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The audience. */ java.lang.String getAudience(); + /** * * *
    -     * Audience to be used when generating OIDC token. The audience claim
    -     * identifies the recipients that the JWT is intended for. The audience
    -     * value is a single case-sensitive string. Having multiple values (array)
    -     * for the audience field is not supported. More info about the OIDC JWT
    -     * token audience here: https://tools.ietf.org/html/rfc7519#section-4.1.3
    -     * Note: if not specified, the Push endpoint URL will be used.
    +     * Optional. Audience to be used when generating OIDC token. The audience
    +     * claim identifies the recipients that the JWT is intended for. The
    +     * audience value is a single case-sensitive string. Having multiple values
    +     * (array) for the audience field is not supported. More info about the OIDC
    +     * JWT token audience here:
    +     * https://tools.ietf.org/html/rfc7519#section-4.1.3 Note: if not specified,
    +     * the Push endpoint URL will be used.
          * 
    * - * string audience = 2; + * string audience = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The bytes for audience. */ com.google.protobuf.ByteString getAudienceBytes(); } + /** * * @@ -238,13 +169,24 @@ public interface OidcTokenOrBuilder * * Protobuf type {@code google.pubsub.v1.PushConfig.OidcToken} */ - public static final class OidcToken extends com.google.protobuf.GeneratedMessageV3 + public static final class OidcToken extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:google.pubsub.v1.PushConfig.OidcToken) OidcTokenOrBuilder { private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "OidcToken"); + } + // Use OidcToken.newBuilder() to construct. - private OidcToken(com.google.protobuf.GeneratedMessageV3.Builder builder) { + private OidcToken(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); } @@ -253,75 +195,13 @@ private OidcToken() { audience_ = ""; } - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new OidcToken(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - private OidcToken( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - java.lang.String s = input.readStringRequireUtf8(); - - serviceAccountEmail_ = s; - break; - } - case 18: - { - java.lang.String s = input.readStringRequireUtf8(); - - audience_ = s; - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_PushConfig_OidcToken_descriptor; } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_PushConfig_OidcToken_fieldAccessorTable @@ -331,19 +211,22 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } public static final int SERVICE_ACCOUNT_EMAIL_FIELD_NUMBER = 1; - private volatile java.lang.Object serviceAccountEmail_; + + @SuppressWarnings("serial") + private volatile java.lang.Object serviceAccountEmail_ = ""; + /** * * *
    -     * [Service account
    +     * Optional. [Service account
          * email](https://cloud.google.com/iam/docs/service-accounts)
    -     * to be used for generating the OIDC token. The caller (for
    -     * CreateSubscription, UpdateSubscription, and ModifyPushConfig RPCs) must
    -     * have the iam.serviceAccounts.actAs permission for the service account.
    +     * used for generating the OIDC token. For more information
    +     * on setting up authentication, see
    +     * [Push subscriptions](https://cloud.google.com/pubsub/docs/push).
          * 
    * - * string service_account_email = 1; + * string service_account_email = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @return The serviceAccountEmail. */ @@ -359,18 +242,19 @@ public java.lang.String getServiceAccountEmail() { return s; } } + /** * * *
    -     * [Service account
    +     * Optional. [Service account
          * email](https://cloud.google.com/iam/docs/service-accounts)
    -     * to be used for generating the OIDC token. The caller (for
    -     * CreateSubscription, UpdateSubscription, and ModifyPushConfig RPCs) must
    -     * have the iam.serviceAccounts.actAs permission for the service account.
    +     * used for generating the OIDC token. For more information
    +     * on setting up authentication, see
    +     * [Push subscriptions](https://cloud.google.com/pubsub/docs/push).
          * 
    * - * string service_account_email = 1; + * string service_account_email = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @return The bytes for serviceAccountEmail. */ @@ -388,20 +272,24 @@ public com.google.protobuf.ByteString getServiceAccountEmailBytes() { } public static final int AUDIENCE_FIELD_NUMBER = 2; - private volatile java.lang.Object audience_; + + @SuppressWarnings("serial") + private volatile java.lang.Object audience_ = ""; + /** * * *
    -     * Audience to be used when generating OIDC token. The audience claim
    -     * identifies the recipients that the JWT is intended for. The audience
    -     * value is a single case-sensitive string. Having multiple values (array)
    -     * for the audience field is not supported. More info about the OIDC JWT
    -     * token audience here: https://tools.ietf.org/html/rfc7519#section-4.1.3
    -     * Note: if not specified, the Push endpoint URL will be used.
    +     * Optional. Audience to be used when generating OIDC token. The audience
    +     * claim identifies the recipients that the JWT is intended for. The
    +     * audience value is a single case-sensitive string. Having multiple values
    +     * (array) for the audience field is not supported. More info about the OIDC
    +     * JWT token audience here:
    +     * https://tools.ietf.org/html/rfc7519#section-4.1.3 Note: if not specified,
    +     * the Push endpoint URL will be used.
          * 
    * - * string audience = 2; + * string audience = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The audience. */ @@ -417,19 +305,21 @@ public java.lang.String getAudience() { return s; } } + /** * * *
    -     * Audience to be used when generating OIDC token. The audience claim
    -     * identifies the recipients that the JWT is intended for. The audience
    -     * value is a single case-sensitive string. Having multiple values (array)
    -     * for the audience field is not supported. More info about the OIDC JWT
    -     * token audience here: https://tools.ietf.org/html/rfc7519#section-4.1.3
    -     * Note: if not specified, the Push endpoint URL will be used.
    +     * Optional. Audience to be used when generating OIDC token. The audience
    +     * claim identifies the recipients that the JWT is intended for. The
    +     * audience value is a single case-sensitive string. Having multiple values
    +     * (array) for the audience field is not supported. More info about the OIDC
    +     * JWT token audience here:
    +     * https://tools.ietf.org/html/rfc7519#section-4.1.3 Note: if not specified,
    +     * the Push endpoint URL will be used.
          * 
    * - * string audience = 2; + * string audience = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The bytes for audience. */ @@ -460,13 +350,13 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!getServiceAccountEmailBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, serviceAccountEmail_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(serviceAccountEmail_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, serviceAccountEmail_); } - if (!getAudienceBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 2, audience_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(audience_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, audience_); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -475,13 +365,13 @@ public int getSerializedSize() { if (size != -1) return size; size = 0; - if (!getServiceAccountEmailBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, serviceAccountEmail_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(serviceAccountEmail_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, serviceAccountEmail_); } - if (!getAudienceBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, audience_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(audience_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, audience_); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -499,7 +389,7 @@ public boolean equals(final java.lang.Object obj) { if (!getServiceAccountEmail().equals(other.getServiceAccountEmail())) return false; if (!getAudience().equals(other.getAudience())) return false; - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -514,7 +404,7 @@ public int hashCode() { hash = (53 * hash) + getServiceAccountEmail().hashCode(); hash = (37 * hash) + AUDIENCE_FIELD_NUMBER; hash = (53 * hash) + getAudience().hashCode(); - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -556,38 +446,38 @@ public static com.google.pubsub.v1.PushConfig.OidcToken parseFrom( public static com.google.pubsub.v1.PushConfig.OidcToken parseFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.PushConfig.OidcToken parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.PushConfig.OidcToken parseDelimitedFrom( java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); } public static com.google.pubsub.v1.PushConfig.OidcToken parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.PushConfig.OidcToken parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.PushConfig.OidcToken parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } @@ -610,11 +500,11 @@ public Builder toBuilder() { } @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** * * @@ -626,8 +516,7 @@ protected Builder newBuilderForType( * * Protobuf type {@code google.pubsub.v1.PushConfig.OidcToken} */ - public static final class Builder - extends com.google.protobuf.GeneratedMessageV3.Builder + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements // @@protoc_insertion_point(builder_implements:google.pubsub.v1.PushConfig.OidcToken) com.google.pubsub.v1.PushConfig.OidcTokenOrBuilder { @@ -637,7 +526,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_PushConfig_OidcToken_fieldAccessorTable @@ -647,26 +536,18 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } // Construct using com.google.pubsub.v1.PushConfig.OidcToken.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } + private Builder() {} - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} } @java.lang.Override public Builder clear() { super.clear(); + bitField0_ = 0; serviceAccountEmail_ = ""; - audience_ = ""; - return this; } @@ -694,45 +575,21 @@ public com.google.pubsub.v1.PushConfig.OidcToken build() { public com.google.pubsub.v1.PushConfig.OidcToken buildPartial() { com.google.pubsub.v1.PushConfig.OidcToken result = new com.google.pubsub.v1.PushConfig.OidcToken(this); - result.serviceAccountEmail_ = serviceAccountEmail_; - result.audience_ = audience_; + if (bitField0_ != 0) { + buildPartial0(result); + } onBuilt(); return result; } - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, - java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); + private void buildPartial0(com.google.pubsub.v1.PushConfig.OidcToken result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.serviceAccountEmail_ = serviceAccountEmail_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.audience_ = audience_; + } } @java.lang.Override @@ -749,13 +606,15 @@ public Builder mergeFrom(com.google.pubsub.v1.PushConfig.OidcToken other) { if (other == com.google.pubsub.v1.PushConfig.OidcToken.getDefaultInstance()) return this; if (!other.getServiceAccountEmail().isEmpty()) { serviceAccountEmail_ = other.serviceAccountEmail_; + bitField0_ |= 0x00000001; onChanged(); } if (!other.getAudience().isEmpty()) { audience_ = other.audience_; + bitField0_ |= 0x00000002; onChanged(); } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -770,33 +629,62 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.pubsub.v1.PushConfig.OidcToken parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + serviceAccountEmail_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + audience_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.google.pubsub.v1.PushConfig.OidcToken) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } + private int bitField0_; + private java.lang.Object serviceAccountEmail_ = ""; + /** * * *
    -       * [Service account
    +       * Optional. [Service account
            * email](https://cloud.google.com/iam/docs/service-accounts)
    -       * to be used for generating the OIDC token. The caller (for
    -       * CreateSubscription, UpdateSubscription, and ModifyPushConfig RPCs) must
    -       * have the iam.serviceAccounts.actAs permission for the service account.
    +       * used for generating the OIDC token. For more information
    +       * on setting up authentication, see
    +       * [Push subscriptions](https://cloud.google.com/pubsub/docs/push).
            * 
    * - * string service_account_email = 1; + * string service_account_email = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @return The serviceAccountEmail. */ @@ -811,18 +699,19 @@ public java.lang.String getServiceAccountEmail() { return (java.lang.String) ref; } } + /** * * *
    -       * [Service account
    +       * Optional. [Service account
            * email](https://cloud.google.com/iam/docs/service-accounts)
    -       * to be used for generating the OIDC token. The caller (for
    -       * CreateSubscription, UpdateSubscription, and ModifyPushConfig RPCs) must
    -       * have the iam.serviceAccounts.actAs permission for the service account.
    +       * used for generating the OIDC token. For more information
    +       * on setting up authentication, see
    +       * [Push subscriptions](https://cloud.google.com/pubsub/docs/push).
            * 
    * - * string service_account_email = 1; + * string service_account_email = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @return The bytes for serviceAccountEmail. */ @@ -837,18 +726,19 @@ public com.google.protobuf.ByteString getServiceAccountEmailBytes() { return (com.google.protobuf.ByteString) ref; } } + /** * * *
    -       * [Service account
    +       * Optional. [Service account
            * email](https://cloud.google.com/iam/docs/service-accounts)
    -       * to be used for generating the OIDC token. The caller (for
    -       * CreateSubscription, UpdateSubscription, and ModifyPushConfig RPCs) must
    -       * have the iam.serviceAccounts.actAs permission for the service account.
    +       * used for generating the OIDC token. For more information
    +       * on setting up authentication, see
    +       * [Push subscriptions](https://cloud.google.com/pubsub/docs/push).
            * 
    * - * string service_account_email = 1; + * string service_account_email = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @param value The serviceAccountEmail to set. * @return This builder for chaining. @@ -857,44 +747,46 @@ public Builder setServiceAccountEmail(java.lang.String value) { if (value == null) { throw new NullPointerException(); } - serviceAccountEmail_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } + /** * * *
    -       * [Service account
    +       * Optional. [Service account
            * email](https://cloud.google.com/iam/docs/service-accounts)
    -       * to be used for generating the OIDC token. The caller (for
    -       * CreateSubscription, UpdateSubscription, and ModifyPushConfig RPCs) must
    -       * have the iam.serviceAccounts.actAs permission for the service account.
    +       * used for generating the OIDC token. For more information
    +       * on setting up authentication, see
    +       * [Push subscriptions](https://cloud.google.com/pubsub/docs/push).
            * 
    * - * string service_account_email = 1; + * string service_account_email = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @return This builder for chaining. */ public Builder clearServiceAccountEmail() { - serviceAccountEmail_ = getDefaultInstance().getServiceAccountEmail(); + bitField0_ = (bitField0_ & ~0x00000001); onChanged(); return this; } + /** * * *
    -       * [Service account
    +       * Optional. [Service account
            * email](https://cloud.google.com/iam/docs/service-accounts)
    -       * to be used for generating the OIDC token. The caller (for
    -       * CreateSubscription, UpdateSubscription, and ModifyPushConfig RPCs) must
    -       * have the iam.serviceAccounts.actAs permission for the service account.
    +       * used for generating the OIDC token. For more information
    +       * on setting up authentication, see
    +       * [Push subscriptions](https://cloud.google.com/pubsub/docs/push).
            * 
    * - * string service_account_email = 1; + * string service_account_email = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @param value The bytes for serviceAccountEmail to set. * @return This builder for chaining. @@ -904,26 +796,28 @@ public Builder setServiceAccountEmailBytes(com.google.protobuf.ByteString value) throw new NullPointerException(); } checkByteStringIsUtf8(value); - serviceAccountEmail_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } private java.lang.Object audience_ = ""; + /** * * *
    -       * Audience to be used when generating OIDC token. The audience claim
    -       * identifies the recipients that the JWT is intended for. The audience
    -       * value is a single case-sensitive string. Having multiple values (array)
    -       * for the audience field is not supported. More info about the OIDC JWT
    -       * token audience here: https://tools.ietf.org/html/rfc7519#section-4.1.3
    -       * Note: if not specified, the Push endpoint URL will be used.
    +       * Optional. Audience to be used when generating OIDC token. The audience
    +       * claim identifies the recipients that the JWT is intended for. The
    +       * audience value is a single case-sensitive string. Having multiple values
    +       * (array) for the audience field is not supported. More info about the OIDC
    +       * JWT token audience here:
    +       * https://tools.ietf.org/html/rfc7519#section-4.1.3 Note: if not specified,
    +       * the Push endpoint URL will be used.
            * 
    * - * string audience = 2; + * string audience = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The audience. */ @@ -938,19 +832,21 @@ public java.lang.String getAudience() { return (java.lang.String) ref; } } + /** * * *
    -       * Audience to be used when generating OIDC token. The audience claim
    -       * identifies the recipients that the JWT is intended for. The audience
    -       * value is a single case-sensitive string. Having multiple values (array)
    -       * for the audience field is not supported. More info about the OIDC JWT
    -       * token audience here: https://tools.ietf.org/html/rfc7519#section-4.1.3
    -       * Note: if not specified, the Push endpoint URL will be used.
    +       * Optional. Audience to be used when generating OIDC token. The audience
    +       * claim identifies the recipients that the JWT is intended for. The
    +       * audience value is a single case-sensitive string. Having multiple values
    +       * (array) for the audience field is not supported. More info about the OIDC
    +       * JWT token audience here:
    +       * https://tools.ietf.org/html/rfc7519#section-4.1.3 Note: if not specified,
    +       * the Push endpoint URL will be used.
            * 
    * - * string audience = 2; + * string audience = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The bytes for audience. */ @@ -965,19 +861,21 @@ public com.google.protobuf.ByteString getAudienceBytes() { return (com.google.protobuf.ByteString) ref; } } + /** * * *
    -       * Audience to be used when generating OIDC token. The audience claim
    -       * identifies the recipients that the JWT is intended for. The audience
    -       * value is a single case-sensitive string. Having multiple values (array)
    -       * for the audience field is not supported. More info about the OIDC JWT
    -       * token audience here: https://tools.ietf.org/html/rfc7519#section-4.1.3
    -       * Note: if not specified, the Push endpoint URL will be used.
    +       * Optional. Audience to be used when generating OIDC token. The audience
    +       * claim identifies the recipients that the JWT is intended for. The
    +       * audience value is a single case-sensitive string. Having multiple values
    +       * (array) for the audience field is not supported. More info about the OIDC
    +       * JWT token audience here:
    +       * https://tools.ietf.org/html/rfc7519#section-4.1.3 Note: if not specified,
    +       * the Push endpoint URL will be used.
            * 
    * - * string audience = 2; + * string audience = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @param value The audience to set. * @return This builder for chaining. @@ -986,46 +884,50 @@ public Builder setAudience(java.lang.String value) { if (value == null) { throw new NullPointerException(); } - audience_ = value; + bitField0_ |= 0x00000002; onChanged(); return this; } + /** * * *
    -       * Audience to be used when generating OIDC token. The audience claim
    -       * identifies the recipients that the JWT is intended for. The audience
    -       * value is a single case-sensitive string. Having multiple values (array)
    -       * for the audience field is not supported. More info about the OIDC JWT
    -       * token audience here: https://tools.ietf.org/html/rfc7519#section-4.1.3
    -       * Note: if not specified, the Push endpoint URL will be used.
    +       * Optional. Audience to be used when generating OIDC token. The audience
    +       * claim identifies the recipients that the JWT is intended for. The
    +       * audience value is a single case-sensitive string. Having multiple values
    +       * (array) for the audience field is not supported. More info about the OIDC
    +       * JWT token audience here:
    +       * https://tools.ietf.org/html/rfc7519#section-4.1.3 Note: if not specified,
    +       * the Push endpoint URL will be used.
            * 
    * - * string audience = 2; + * string audience = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return This builder for chaining. */ public Builder clearAudience() { - audience_ = getDefaultInstance().getAudience(); + bitField0_ = (bitField0_ & ~0x00000002); onChanged(); return this; } + /** * * *
    -       * Audience to be used when generating OIDC token. The audience claim
    -       * identifies the recipients that the JWT is intended for. The audience
    -       * value is a single case-sensitive string. Having multiple values (array)
    -       * for the audience field is not supported. More info about the OIDC JWT
    -       * token audience here: https://tools.ietf.org/html/rfc7519#section-4.1.3
    -       * Note: if not specified, the Push endpoint URL will be used.
    +       * Optional. Audience to be used when generating OIDC token. The audience
    +       * claim identifies the recipients that the JWT is intended for. The
    +       * audience value is a single case-sensitive string. Having multiple values
    +       * (array) for the audience field is not supported. More info about the OIDC
    +       * JWT token audience here:
    +       * https://tools.ietf.org/html/rfc7519#section-4.1.3 Note: if not specified,
    +       * the Push endpoint URL will be used.
            * 
    * - * string audience = 2; + * string audience = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @param value The bytes for audience to set. * @return This builder for chaining. @@ -1035,24 +937,12 @@ public Builder setAudienceBytes(com.google.protobuf.ByteString value) { throw new NullPointerException(); } checkByteStringIsUtf8(value); - audience_ = value; + bitField0_ |= 0x00000002; onChanged(); return this; } - @java.lang.Override - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - // @@protoc_insertion_point(builder_scope:google.pubsub.v1.PushConfig.OidcToken) } @@ -1074,7 +964,19 @@ public OidcToken parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new OidcToken(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException() + .setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; @@ -1093,252 +995,1235 @@ public com.google.pubsub.v1.PushConfig.OidcToken getDefaultInstanceForType() { } } - private int authenticationMethodCase_ = 0; - private java.lang.Object authenticationMethod_; - - public enum AuthenticationMethodCase - implements - com.google.protobuf.Internal.EnumLite, - com.google.protobuf.AbstractMessage.InternalOneOfEnum { - OIDC_TOKEN(3), - AUTHENTICATIONMETHOD_NOT_SET(0); - private final int value; - - private AuthenticationMethodCase(int value) { - this.value = value; - } - /** - * @param value The number of the enum to look for. - * @return The enum associated with the given number. - * @deprecated Use {@link #forNumber(int)} instead. - */ - @java.lang.Deprecated - public static AuthenticationMethodCase valueOf(int value) { - return forNumber(value); - } - - public static AuthenticationMethodCase forNumber(int value) { - switch (value) { - case 3: - return OIDC_TOKEN; - case 0: - return AUTHENTICATIONMETHOD_NOT_SET; - default: - return null; - } - } - - public int getNumber() { - return this.value; - } - }; - - public AuthenticationMethodCase getAuthenticationMethodCase() { - return AuthenticationMethodCase.forNumber(authenticationMethodCase_); - } + public interface PubsubWrapperOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.pubsub.v1.PushConfig.PubsubWrapper) + com.google.protobuf.MessageOrBuilder {} - public static final int PUSH_ENDPOINT_FIELD_NUMBER = 1; - private volatile java.lang.Object pushEndpoint_; - /** - * - * - *
    -   * A URL locating the endpoint to which messages should be pushed.
    -   * For example, a Webhook endpoint might use `https://example.com/push`.
    -   * 
    - * - * string push_endpoint = 1; - * - * @return The pushEndpoint. - */ - @java.lang.Override - public java.lang.String getPushEndpoint() { - java.lang.Object ref = pushEndpoint_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - pushEndpoint_ = s; - return s; - } - } /** * * *
    -   * A URL locating the endpoint to which messages should be pushed.
    -   * For example, a Webhook endpoint might use `https://example.com/push`.
    +   * The payload to the push endpoint is in the form of the JSON representation
    +   * of a PubsubMessage
    +   * (https://cloud.google.com/pubsub/docs/reference/rpc/google.pubsub.v1#pubsubmessage).
        * 
    * - * string push_endpoint = 1; - * - * @return The bytes for pushEndpoint. + * Protobuf type {@code google.pubsub.v1.PushConfig.PubsubWrapper} */ - @java.lang.Override - public com.google.protobuf.ByteString getPushEndpointBytes() { - java.lang.Object ref = pushEndpoint_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - pushEndpoint_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; + public static final class PubsubWrapper extends com.google.protobuf.GeneratedMessage + implements + // @@protoc_insertion_point(message_implements:google.pubsub.v1.PushConfig.PubsubWrapper) + PubsubWrapperOrBuilder { + private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "PubsubWrapper"); } - } - public static final int ATTRIBUTES_FIELD_NUMBER = 2; + // Use PubsubWrapper.newBuilder() to construct. + private PubsubWrapper(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } - private static final class AttributesDefaultEntryHolder { - static final com.google.protobuf.MapEntry defaultEntry = - com.google.protobuf.MapEntry.newDefaultInstance( - com.google.pubsub.v1.PubsubProto - .internal_static_google_pubsub_v1_PushConfig_AttributesEntry_descriptor, - com.google.protobuf.WireFormat.FieldType.STRING, - "", - com.google.protobuf.WireFormat.FieldType.STRING, - ""); - } + private PubsubWrapper() {} - private com.google.protobuf.MapField attributes_; + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_PushConfig_PubsubWrapper_descriptor; + } - private com.google.protobuf.MapField internalGetAttributes() { - if (attributes_ == null) { - return com.google.protobuf.MapField.emptyMapField(AttributesDefaultEntryHolder.defaultEntry); + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_PushConfig_PubsubWrapper_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.PushConfig.PubsubWrapper.class, + com.google.pubsub.v1.PushConfig.PubsubWrapper.Builder.class); } - return attributes_; - } - public int getAttributesCount() { - return internalGetAttributes().getMap().size(); - } - /** - * - * - *
    -   * Endpoint configuration attributes that can be used to control different
    -   * aspects of the message delivery.
    -   * The only currently supported attribute is `x-goog-version`, which you can
    -   * use to change the format of the pushed message. This attribute
    +    private byte memoizedIsInitialized = -1;
    +
    +    @java.lang.Override
    +    public final boolean isInitialized() {
    +      byte isInitialized = memoizedIsInitialized;
    +      if (isInitialized == 1) return true;
    +      if (isInitialized == 0) return false;
    +
    +      memoizedIsInitialized = 1;
    +      return true;
    +    }
    +
    +    @java.lang.Override
    +    public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
    +      getUnknownFields().writeTo(output);
    +    }
    +
    +    @java.lang.Override
    +    public int getSerializedSize() {
    +      int size = memoizedSize;
    +      if (size != -1) return size;
    +
    +      size = 0;
    +      size += getUnknownFields().getSerializedSize();
    +      memoizedSize = size;
    +      return size;
    +    }
    +
    +    @java.lang.Override
    +    public boolean equals(final java.lang.Object obj) {
    +      if (obj == this) {
    +        return true;
    +      }
    +      if (!(obj instanceof com.google.pubsub.v1.PushConfig.PubsubWrapper)) {
    +        return super.equals(obj);
    +      }
    +      com.google.pubsub.v1.PushConfig.PubsubWrapper other =
    +          (com.google.pubsub.v1.PushConfig.PubsubWrapper) obj;
    +
    +      if (!getUnknownFields().equals(other.getUnknownFields())) return false;
    +      return true;
    +    }
    +
    +    @java.lang.Override
    +    public int hashCode() {
    +      if (memoizedHashCode != 0) {
    +        return memoizedHashCode;
    +      }
    +      int hash = 41;
    +      hash = (19 * hash) + getDescriptor().hashCode();
    +      hash = (29 * hash) + getUnknownFields().hashCode();
    +      memoizedHashCode = hash;
    +      return hash;
    +    }
    +
    +    public static com.google.pubsub.v1.PushConfig.PubsubWrapper parseFrom(java.nio.ByteBuffer data)
    +        throws com.google.protobuf.InvalidProtocolBufferException {
    +      return PARSER.parseFrom(data);
    +    }
    +
    +    public static com.google.pubsub.v1.PushConfig.PubsubWrapper parseFrom(
    +        java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
    +        throws com.google.protobuf.InvalidProtocolBufferException {
    +      return PARSER.parseFrom(data, extensionRegistry);
    +    }
    +
    +    public static com.google.pubsub.v1.PushConfig.PubsubWrapper parseFrom(
    +        com.google.protobuf.ByteString data)
    +        throws com.google.protobuf.InvalidProtocolBufferException {
    +      return PARSER.parseFrom(data);
    +    }
    +
    +    public static com.google.pubsub.v1.PushConfig.PubsubWrapper parseFrom(
    +        com.google.protobuf.ByteString data,
    +        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
    +        throws com.google.protobuf.InvalidProtocolBufferException {
    +      return PARSER.parseFrom(data, extensionRegistry);
    +    }
    +
    +    public static com.google.pubsub.v1.PushConfig.PubsubWrapper parseFrom(byte[] data)
    +        throws com.google.protobuf.InvalidProtocolBufferException {
    +      return PARSER.parseFrom(data);
    +    }
    +
    +    public static com.google.pubsub.v1.PushConfig.PubsubWrapper parseFrom(
    +        byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
    +        throws com.google.protobuf.InvalidProtocolBufferException {
    +      return PARSER.parseFrom(data, extensionRegistry);
    +    }
    +
    +    public static com.google.pubsub.v1.PushConfig.PubsubWrapper parseFrom(java.io.InputStream input)
    +        throws java.io.IOException {
    +      return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input);
    +    }
    +
    +    public static com.google.pubsub.v1.PushConfig.PubsubWrapper parseFrom(
    +        java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
    +        throws java.io.IOException {
    +      return com.google.protobuf.GeneratedMessage.parseWithIOException(
    +          PARSER, input, extensionRegistry);
    +    }
    +
    +    public static com.google.pubsub.v1.PushConfig.PubsubWrapper parseDelimitedFrom(
    +        java.io.InputStream input) throws java.io.IOException {
    +      return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input);
    +    }
    +
    +    public static com.google.pubsub.v1.PushConfig.PubsubWrapper parseDelimitedFrom(
    +        java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
    +        throws java.io.IOException {
    +      return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(
    +          PARSER, input, extensionRegistry);
    +    }
    +
    +    public static com.google.pubsub.v1.PushConfig.PubsubWrapper parseFrom(
    +        com.google.protobuf.CodedInputStream input) throws java.io.IOException {
    +      return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input);
    +    }
    +
    +    public static com.google.pubsub.v1.PushConfig.PubsubWrapper parseFrom(
    +        com.google.protobuf.CodedInputStream input,
    +        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
    +        throws java.io.IOException {
    +      return com.google.protobuf.GeneratedMessage.parseWithIOException(
    +          PARSER, input, extensionRegistry);
    +    }
    +
    +    @java.lang.Override
    +    public Builder newBuilderForType() {
    +      return newBuilder();
    +    }
    +
    +    public static Builder newBuilder() {
    +      return DEFAULT_INSTANCE.toBuilder();
    +    }
    +
    +    public static Builder newBuilder(com.google.pubsub.v1.PushConfig.PubsubWrapper prototype) {
    +      return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
    +    }
    +
    +    @java.lang.Override
    +    public Builder toBuilder() {
    +      return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
    +    }
    +
    +    @java.lang.Override
    +    protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) {
    +      Builder builder = new Builder(parent);
    +      return builder;
    +    }
    +
    +    /**
    +     *
    +     *
    +     * 
    +     * The payload to the push endpoint is in the form of the JSON representation
    +     * of a PubsubMessage
    +     * (https://cloud.google.com/pubsub/docs/reference/rpc/google.pubsub.v1#pubsubmessage).
    +     * 
    + * + * Protobuf type {@code google.pubsub.v1.PushConfig.PubsubWrapper} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder + implements + // @@protoc_insertion_point(builder_implements:google.pubsub.v1.PushConfig.PubsubWrapper) + com.google.pubsub.v1.PushConfig.PubsubWrapperOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_PushConfig_PubsubWrapper_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_PushConfig_PubsubWrapper_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.PushConfig.PubsubWrapper.class, + com.google.pubsub.v1.PushConfig.PubsubWrapper.Builder.class); + } + + // Construct using com.google.pubsub.v1.PushConfig.PubsubWrapper.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_PushConfig_PubsubWrapper_descriptor; + } + + @java.lang.Override + public com.google.pubsub.v1.PushConfig.PubsubWrapper getDefaultInstanceForType() { + return com.google.pubsub.v1.PushConfig.PubsubWrapper.getDefaultInstance(); + } + + @java.lang.Override + public com.google.pubsub.v1.PushConfig.PubsubWrapper build() { + com.google.pubsub.v1.PushConfig.PubsubWrapper result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.pubsub.v1.PushConfig.PubsubWrapper buildPartial() { + com.google.pubsub.v1.PushConfig.PubsubWrapper result = + new com.google.pubsub.v1.PushConfig.PubsubWrapper(this); + onBuilt(); + return result; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.pubsub.v1.PushConfig.PubsubWrapper) { + return mergeFrom((com.google.pubsub.v1.PushConfig.PubsubWrapper) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.pubsub.v1.PushConfig.PubsubWrapper other) { + if (other == com.google.pubsub.v1.PushConfig.PubsubWrapper.getDefaultInstance()) + return this; + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + // @@protoc_insertion_point(builder_scope:google.pubsub.v1.PushConfig.PubsubWrapper) + } + + // @@protoc_insertion_point(class_scope:google.pubsub.v1.PushConfig.PubsubWrapper) + private static final com.google.pubsub.v1.PushConfig.PubsubWrapper DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.pubsub.v1.PushConfig.PubsubWrapper(); + } + + public static com.google.pubsub.v1.PushConfig.PubsubWrapper getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public PubsubWrapper parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException() + .setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.pubsub.v1.PushConfig.PubsubWrapper getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public interface NoWrapperOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.pubsub.v1.PushConfig.NoWrapper) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
    +     * Optional. When true, writes the Pub/Sub message metadata to
    +     * `x-goog-pubsub-<KEY>:<VAL>` headers of the HTTP request. Writes the
    +     * Pub/Sub message attributes to `<KEY>:<VAL>` headers of the HTTP request.
    +     * 
    + * + * bool write_metadata = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The writeMetadata. + */ + boolean getWriteMetadata(); + } + + /** + * + * + *
    +   * Sets the `data` field as the HTTP body for delivery.
    +   * 
    + * + * Protobuf type {@code google.pubsub.v1.PushConfig.NoWrapper} + */ + public static final class NoWrapper extends com.google.protobuf.GeneratedMessage + implements + // @@protoc_insertion_point(message_implements:google.pubsub.v1.PushConfig.NoWrapper) + NoWrapperOrBuilder { + private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "NoWrapper"); + } + + // Use NoWrapper.newBuilder() to construct. + private NoWrapper(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + + private NoWrapper() {} + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_PushConfig_NoWrapper_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_PushConfig_NoWrapper_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.PushConfig.NoWrapper.class, + com.google.pubsub.v1.PushConfig.NoWrapper.Builder.class); + } + + public static final int WRITE_METADATA_FIELD_NUMBER = 1; + private boolean writeMetadata_ = false; + + /** + * + * + *
    +     * Optional. When true, writes the Pub/Sub message metadata to
    +     * `x-goog-pubsub-<KEY>:<VAL>` headers of the HTTP request. Writes the
    +     * Pub/Sub message attributes to `<KEY>:<VAL>` headers of the HTTP request.
    +     * 
    + * + * bool write_metadata = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The writeMetadata. + */ + @java.lang.Override + public boolean getWriteMetadata() { + return writeMetadata_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (writeMetadata_ != false) { + output.writeBool(1, writeMetadata_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (writeMetadata_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(1, writeMetadata_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.pubsub.v1.PushConfig.NoWrapper)) { + return super.equals(obj); + } + com.google.pubsub.v1.PushConfig.NoWrapper other = + (com.google.pubsub.v1.PushConfig.NoWrapper) obj; + + if (getWriteMetadata() != other.getWriteMetadata()) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + WRITE_METADATA_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getWriteMetadata()); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.pubsub.v1.PushConfig.NoWrapper parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.PushConfig.NoWrapper parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.PushConfig.NoWrapper parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.PushConfig.NoWrapper parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.PushConfig.NoWrapper parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.PushConfig.NoWrapper parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.PushConfig.NoWrapper parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.PushConfig.NoWrapper parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.PushConfig.NoWrapper parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.PushConfig.NoWrapper parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.PushConfig.NoWrapper parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.PushConfig.NoWrapper parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.pubsub.v1.PushConfig.NoWrapper prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + + /** + * + * + *
    +     * Sets the `data` field as the HTTP body for delivery.
    +     * 
    + * + * Protobuf type {@code google.pubsub.v1.PushConfig.NoWrapper} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder + implements + // @@protoc_insertion_point(builder_implements:google.pubsub.v1.PushConfig.NoWrapper) + com.google.pubsub.v1.PushConfig.NoWrapperOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_PushConfig_NoWrapper_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_PushConfig_NoWrapper_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.PushConfig.NoWrapper.class, + com.google.pubsub.v1.PushConfig.NoWrapper.Builder.class); + } + + // Construct using com.google.pubsub.v1.PushConfig.NoWrapper.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + writeMetadata_ = false; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_PushConfig_NoWrapper_descriptor; + } + + @java.lang.Override + public com.google.pubsub.v1.PushConfig.NoWrapper getDefaultInstanceForType() { + return com.google.pubsub.v1.PushConfig.NoWrapper.getDefaultInstance(); + } + + @java.lang.Override + public com.google.pubsub.v1.PushConfig.NoWrapper build() { + com.google.pubsub.v1.PushConfig.NoWrapper result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.pubsub.v1.PushConfig.NoWrapper buildPartial() { + com.google.pubsub.v1.PushConfig.NoWrapper result = + new com.google.pubsub.v1.PushConfig.NoWrapper(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.pubsub.v1.PushConfig.NoWrapper result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.writeMetadata_ = writeMetadata_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.pubsub.v1.PushConfig.NoWrapper) { + return mergeFrom((com.google.pubsub.v1.PushConfig.NoWrapper) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.pubsub.v1.PushConfig.NoWrapper other) { + if (other == com.google.pubsub.v1.PushConfig.NoWrapper.getDefaultInstance()) return this; + if (other.getWriteMetadata() != false) { + setWriteMetadata(other.getWriteMetadata()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: + { + writeMetadata_ = input.readBool(); + bitField0_ |= 0x00000001; + break; + } // case 8 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private boolean writeMetadata_; + + /** + * + * + *
    +       * Optional. When true, writes the Pub/Sub message metadata to
    +       * `x-goog-pubsub-<KEY>:<VAL>` headers of the HTTP request. Writes the
    +       * Pub/Sub message attributes to `<KEY>:<VAL>` headers of the HTTP request.
    +       * 
    + * + * bool write_metadata = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The writeMetadata. + */ + @java.lang.Override + public boolean getWriteMetadata() { + return writeMetadata_; + } + + /** + * + * + *
    +       * Optional. When true, writes the Pub/Sub message metadata to
    +       * `x-goog-pubsub-<KEY>:<VAL>` headers of the HTTP request. Writes the
    +       * Pub/Sub message attributes to `<KEY>:<VAL>` headers of the HTTP request.
    +       * 
    + * + * bool write_metadata = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The writeMetadata to set. + * @return This builder for chaining. + */ + public Builder setWriteMetadata(boolean value) { + + writeMetadata_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. When true, writes the Pub/Sub message metadata to
    +       * `x-goog-pubsub-<KEY>:<VAL>` headers of the HTTP request. Writes the
    +       * Pub/Sub message attributes to `<KEY>:<VAL>` headers of the HTTP request.
    +       * 
    + * + * bool write_metadata = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearWriteMetadata() { + bitField0_ = (bitField0_ & ~0x00000001); + writeMetadata_ = false; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:google.pubsub.v1.PushConfig.NoWrapper) + } + + // @@protoc_insertion_point(class_scope:google.pubsub.v1.PushConfig.NoWrapper) + private static final com.google.pubsub.v1.PushConfig.NoWrapper DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.pubsub.v1.PushConfig.NoWrapper(); + } + + public static com.google.pubsub.v1.PushConfig.NoWrapper getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public NoWrapper parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException() + .setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.pubsub.v1.PushConfig.NoWrapper getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + private int authenticationMethodCase_ = 0; + + @SuppressWarnings("serial") + private java.lang.Object authenticationMethod_; + + public enum AuthenticationMethodCase + implements + com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + OIDC_TOKEN(3), + AUTHENTICATIONMETHOD_NOT_SET(0); + private final int value; + + private AuthenticationMethodCase(int value) { + this.value = value; + } + + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static AuthenticationMethodCase valueOf(int value) { + return forNumber(value); + } + + public static AuthenticationMethodCase forNumber(int value) { + switch (value) { + case 3: + return OIDC_TOKEN; + case 0: + return AUTHENTICATIONMETHOD_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public AuthenticationMethodCase getAuthenticationMethodCase() { + return AuthenticationMethodCase.forNumber(authenticationMethodCase_); + } + + private int wrapperCase_ = 0; + + @SuppressWarnings("serial") + private java.lang.Object wrapper_; + + public enum WrapperCase + implements + com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + PUBSUB_WRAPPER(4), + NO_WRAPPER(5), + WRAPPER_NOT_SET(0); + private final int value; + + private WrapperCase(int value) { + this.value = value; + } + + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static WrapperCase valueOf(int value) { + return forNumber(value); + } + + public static WrapperCase forNumber(int value) { + switch (value) { + case 4: + return PUBSUB_WRAPPER; + case 5: + return NO_WRAPPER; + case 0: + return WRAPPER_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public WrapperCase getWrapperCase() { + return WrapperCase.forNumber(wrapperCase_); + } + + public static final int PUSH_ENDPOINT_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object pushEndpoint_ = ""; + + /** + * + * + *
    +   * Optional. A URL locating the endpoint to which messages should be pushed.
    +   * For example, a Webhook endpoint might use `https://example.com/push`.
    +   * 
    + * + * string push_endpoint = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pushEndpoint. + */ + @java.lang.Override + public java.lang.String getPushEndpoint() { + java.lang.Object ref = pushEndpoint_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pushEndpoint_ = s; + return s; + } + } + + /** + * + * + *
    +   * Optional. A URL locating the endpoint to which messages should be pushed.
    +   * For example, a Webhook endpoint might use `https://example.com/push`.
    +   * 
    + * + * string push_endpoint = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for pushEndpoint. + */ + @java.lang.Override + public com.google.protobuf.ByteString getPushEndpointBytes() { + java.lang.Object ref = pushEndpoint_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pushEndpoint_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int ATTRIBUTES_FIELD_NUMBER = 2; + + private static final class AttributesDefaultEntryHolder { + static final com.google.protobuf.MapEntry defaultEntry = + com.google.protobuf.MapEntry.newDefaultInstance( + com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_PushConfig_AttributesEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.STRING, + ""); + } + + @SuppressWarnings("serial") + private com.google.protobuf.MapField attributes_; + + private com.google.protobuf.MapField internalGetAttributes() { + if (attributes_ == null) { + return com.google.protobuf.MapField.emptyMapField(AttributesDefaultEntryHolder.defaultEntry); + } + return attributes_; + } + + public int getAttributesCount() { + return internalGetAttributes().getMap().size(); + } + + /** + * + * + *
    +   * Optional. Endpoint configuration attributes that can be used to control
    +   * different aspects of the message delivery.
    +   *
    +   * The only currently supported attribute is `x-goog-version`, which you can
    +   * use to change the format of the pushed message. This attribute
        * indicates the version of the data expected by the endpoint. This
        * controls the shape of the pushed message (i.e., its fields and metadata).
    +   *
        * If not present during the `CreateSubscription` call, it will default to
        * the version of the Pub/Sub API used to make such call. If not present in a
        * `ModifyPushConfig` call, its value will not be changed. `GetSubscription`
        * calls will always return a valid version, even if the subscription was
        * created without this attribute.
    +   *
        * The only supported values for the `x-goog-version` attribute are:
    +   *
        * * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API.
        * * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API.
    +   *
        * For example:
    -   * <pre><code>attributes { "x-goog-version": "v1" } </code></pre>
    +   * `attributes { "x-goog-version": "v1" }`
        * 
    * - * map<string, string> attributes = 2; + * map<string, string> attributes = 2 [(.google.api.field_behavior) = OPTIONAL]; + * */ @java.lang.Override public boolean containsAttributes(java.lang.String key) { if (key == null) { - throw new java.lang.NullPointerException(); + throw new NullPointerException("map key"); } return internalGetAttributes().getMap().containsKey(key); } + /** Use {@link #getAttributesMap()} instead. */ @java.lang.Override @java.lang.Deprecated public java.util.Map getAttributes() { return getAttributesMap(); } + /** * * *
    -   * Endpoint configuration attributes that can be used to control different
    -   * aspects of the message delivery.
    +   * Optional. Endpoint configuration attributes that can be used to control
    +   * different aspects of the message delivery.
    +   *
        * The only currently supported attribute is `x-goog-version`, which you can
        * use to change the format of the pushed message. This attribute
        * indicates the version of the data expected by the endpoint. This
        * controls the shape of the pushed message (i.e., its fields and metadata).
    +   *
        * If not present during the `CreateSubscription` call, it will default to
        * the version of the Pub/Sub API used to make such call. If not present in a
        * `ModifyPushConfig` call, its value will not be changed. `GetSubscription`
        * calls will always return a valid version, even if the subscription was
        * created without this attribute.
    +   *
        * The only supported values for the `x-goog-version` attribute are:
    +   *
        * * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API.
        * * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API.
    +   *
        * For example:
    -   * <pre><code>attributes { "x-goog-version": "v1" } </code></pre>
    +   * `attributes { "x-goog-version": "v1" }`
        * 
    * - * map<string, string> attributes = 2; + * map<string, string> attributes = 2 [(.google.api.field_behavior) = OPTIONAL]; + * */ @java.lang.Override public java.util.Map getAttributesMap() { return internalGetAttributes().getMap(); } + /** * * *
    -   * Endpoint configuration attributes that can be used to control different
    -   * aspects of the message delivery.
    +   * Optional. Endpoint configuration attributes that can be used to control
    +   * different aspects of the message delivery.
    +   *
        * The only currently supported attribute is `x-goog-version`, which you can
        * use to change the format of the pushed message. This attribute
        * indicates the version of the data expected by the endpoint. This
        * controls the shape of the pushed message (i.e., its fields and metadata).
    +   *
        * If not present during the `CreateSubscription` call, it will default to
        * the version of the Pub/Sub API used to make such call. If not present in a
        * `ModifyPushConfig` call, its value will not be changed. `GetSubscription`
        * calls will always return a valid version, even if the subscription was
        * created without this attribute.
    +   *
        * The only supported values for the `x-goog-version` attribute are:
    +   *
        * * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API.
        * * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API.
    +   *
        * For example:
    -   * <pre><code>attributes { "x-goog-version": "v1" } </code></pre>
    +   * `attributes { "x-goog-version": "v1" }`
        * 
    * - * map<string, string> attributes = 2; + * map<string, string> attributes = 2 [(.google.api.field_behavior) = OPTIONAL]; + * */ @java.lang.Override - public java.lang.String getAttributesOrDefault( - java.lang.String key, java.lang.String defaultValue) { + public /* nullable */ java.lang.String getAttributesOrDefault( + java.lang.String key, + /* nullable */ + java.lang.String defaultValue) { if (key == null) { - throw new java.lang.NullPointerException(); + throw new NullPointerException("map key"); } java.util.Map map = internalGetAttributes().getMap(); return map.containsKey(key) ? map.get(key) : defaultValue; } + /** * * *
    -   * Endpoint configuration attributes that can be used to control different
    -   * aspects of the message delivery.
    +   * Optional. Endpoint configuration attributes that can be used to control
    +   * different aspects of the message delivery.
    +   *
        * The only currently supported attribute is `x-goog-version`, which you can
        * use to change the format of the pushed message. This attribute
        * indicates the version of the data expected by the endpoint. This
        * controls the shape of the pushed message (i.e., its fields and metadata).
    +   *
        * If not present during the `CreateSubscription` call, it will default to
        * the version of the Pub/Sub API used to make such call. If not present in a
        * `ModifyPushConfig` call, its value will not be changed. `GetSubscription`
        * calls will always return a valid version, even if the subscription was
        * created without this attribute.
    +   *
        * The only supported values for the `x-goog-version` attribute are:
    +   *
        * * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API.
        * * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API.
    +   *
        * For example:
    -   * <pre><code>attributes { "x-goog-version": "v1" } </code></pre>
    +   * `attributes { "x-goog-version": "v1" }`
        * 
    * - * map<string, string> attributes = 2; + * map<string, string> attributes = 2 [(.google.api.field_behavior) = OPTIONAL]; + * */ @java.lang.Override public java.lang.String getAttributesOrThrow(java.lang.String key) { if (key == null) { - throw new java.lang.NullPointerException(); + throw new NullPointerException("map key"); } java.util.Map map = internalGetAttributes().getMap(); if (!map.containsKey(key)) { @@ -1348,15 +2233,19 @@ public java.lang.String getAttributesOrThrow(java.lang.String key) { } public static final int OIDC_TOKEN_FIELD_NUMBER = 3; + /** * * *
    -   * If specified, Pub/Sub will generate and attach an OIDC JWT token as an
    -   * `Authorization` header in the HTTP request for every pushed message.
    +   * Optional. If specified, Pub/Sub will generate and attach an OIDC JWT
    +   * token as an `Authorization` header in the HTTP request for every pushed
    +   * message.
        * 
    * - * .google.pubsub.v1.PushConfig.OidcToken oidc_token = 3; + * + * .google.pubsub.v1.PushConfig.OidcToken oidc_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return Whether the oidcToken field is set. */ @@ -1364,15 +2253,19 @@ public java.lang.String getAttributesOrThrow(java.lang.String key) { public boolean hasOidcToken() { return authenticationMethodCase_ == 3; } + /** * * *
    -   * If specified, Pub/Sub will generate and attach an OIDC JWT token as an
    -   * `Authorization` header in the HTTP request for every pushed message.
    +   * Optional. If specified, Pub/Sub will generate and attach an OIDC JWT
    +   * token as an `Authorization` header in the HTTP request for every pushed
    +   * message.
        * 
    * - * .google.pubsub.v1.PushConfig.OidcToken oidc_token = 3; + * + * .google.pubsub.v1.PushConfig.OidcToken oidc_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return The oidcToken. */ @@ -1383,15 +2276,19 @@ public com.google.pubsub.v1.PushConfig.OidcToken getOidcToken() { } return com.google.pubsub.v1.PushConfig.OidcToken.getDefaultInstance(); } + /** * * *
    -   * If specified, Pub/Sub will generate and attach an OIDC JWT token as an
    -   * `Authorization` header in the HTTP request for every pushed message.
    +   * Optional. If specified, Pub/Sub will generate and attach an OIDC JWT
    +   * token as an `Authorization` header in the HTTP request for every pushed
    +   * message.
        * 
    * - * .google.pubsub.v1.PushConfig.OidcToken oidc_token = 3; + * + * .google.pubsub.v1.PushConfig.OidcToken oidc_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * */ @java.lang.Override public com.google.pubsub.v1.PushConfig.OidcTokenOrBuilder getOidcTokenOrBuilder() { @@ -1401,6 +2298,132 @@ public com.google.pubsub.v1.PushConfig.OidcTokenOrBuilder getOidcTokenOrBuilder( return com.google.pubsub.v1.PushConfig.OidcToken.getDefaultInstance(); } + public static final int PUBSUB_WRAPPER_FIELD_NUMBER = 4; + + /** + * + * + *
    +   * Optional. When set, the payload to the push endpoint is in the form of
    +   * the JSON representation of a PubsubMessage
    +   * (https://cloud.google.com/pubsub/docs/reference/rpc/google.pubsub.v1#pubsubmessage).
    +   * 
    + * + * + * .google.pubsub.v1.PushConfig.PubsubWrapper pubsub_wrapper = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the pubsubWrapper field is set. + */ + @java.lang.Override + public boolean hasPubsubWrapper() { + return wrapperCase_ == 4; + } + + /** + * + * + *
    +   * Optional. When set, the payload to the push endpoint is in the form of
    +   * the JSON representation of a PubsubMessage
    +   * (https://cloud.google.com/pubsub/docs/reference/rpc/google.pubsub.v1#pubsubmessage).
    +   * 
    + * + * + * .google.pubsub.v1.PushConfig.PubsubWrapper pubsub_wrapper = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The pubsubWrapper. + */ + @java.lang.Override + public com.google.pubsub.v1.PushConfig.PubsubWrapper getPubsubWrapper() { + if (wrapperCase_ == 4) { + return (com.google.pubsub.v1.PushConfig.PubsubWrapper) wrapper_; + } + return com.google.pubsub.v1.PushConfig.PubsubWrapper.getDefaultInstance(); + } + + /** + * + * + *
    +   * Optional. When set, the payload to the push endpoint is in the form of
    +   * the JSON representation of a PubsubMessage
    +   * (https://cloud.google.com/pubsub/docs/reference/rpc/google.pubsub.v1#pubsubmessage).
    +   * 
    + * + * + * .google.pubsub.v1.PushConfig.PubsubWrapper pubsub_wrapper = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.PushConfig.PubsubWrapperOrBuilder getPubsubWrapperOrBuilder() { + if (wrapperCase_ == 4) { + return (com.google.pubsub.v1.PushConfig.PubsubWrapper) wrapper_; + } + return com.google.pubsub.v1.PushConfig.PubsubWrapper.getDefaultInstance(); + } + + public static final int NO_WRAPPER_FIELD_NUMBER = 5; + + /** + * + * + *
    +   * Optional. When set, the payload to the push endpoint is not wrapped.
    +   * 
    + * + * + * .google.pubsub.v1.PushConfig.NoWrapper no_wrapper = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the noWrapper field is set. + */ + @java.lang.Override + public boolean hasNoWrapper() { + return wrapperCase_ == 5; + } + + /** + * + * + *
    +   * Optional. When set, the payload to the push endpoint is not wrapped.
    +   * 
    + * + * + * .google.pubsub.v1.PushConfig.NoWrapper no_wrapper = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The noWrapper. + */ + @java.lang.Override + public com.google.pubsub.v1.PushConfig.NoWrapper getNoWrapper() { + if (wrapperCase_ == 5) { + return (com.google.pubsub.v1.PushConfig.NoWrapper) wrapper_; + } + return com.google.pubsub.v1.PushConfig.NoWrapper.getDefaultInstance(); + } + + /** + * + * + *
    +   * Optional. When set, the payload to the push endpoint is not wrapped.
    +   * 
    + * + * + * .google.pubsub.v1.PushConfig.NoWrapper no_wrapper = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.PushConfig.NoWrapperOrBuilder getNoWrapperOrBuilder() { + if (wrapperCase_ == 5) { + return (com.google.pubsub.v1.PushConfig.NoWrapper) wrapper_; + } + return com.google.pubsub.v1.PushConfig.NoWrapper.getDefaultInstance(); + } + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -1415,15 +2438,21 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!getPushEndpointBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, pushEndpoint_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(pushEndpoint_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, pushEndpoint_); } - com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( + com.google.protobuf.GeneratedMessage.serializeStringMapTo( output, internalGetAttributes(), AttributesDefaultEntryHolder.defaultEntry, 2); if (authenticationMethodCase_ == 3) { output.writeMessage(3, (com.google.pubsub.v1.PushConfig.OidcToken) authenticationMethod_); } - unknownFields.writeTo(output); + if (wrapperCase_ == 4) { + output.writeMessage(4, (com.google.pubsub.v1.PushConfig.PubsubWrapper) wrapper_); + } + if (wrapperCase_ == 5) { + output.writeMessage(5, (com.google.pubsub.v1.PushConfig.NoWrapper) wrapper_); + } + getUnknownFields().writeTo(output); } @java.lang.Override @@ -1432,8 +2461,8 @@ public int getSerializedSize() { if (size != -1) return size; size = 0; - if (!getPushEndpointBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, pushEndpoint_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(pushEndpoint_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, pushEndpoint_); } for (java.util.Map.Entry entry : internalGetAttributes().getMap().entrySet()) { @@ -1450,7 +2479,17 @@ public int getSerializedSize() { com.google.protobuf.CodedOutputStream.computeMessageSize( 3, (com.google.pubsub.v1.PushConfig.OidcToken) authenticationMethod_); } - size += unknownFields.getSerializedSize(); + if (wrapperCase_ == 4) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 4, (com.google.pubsub.v1.PushConfig.PubsubWrapper) wrapper_); + } + if (wrapperCase_ == 5) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 5, (com.google.pubsub.v1.PushConfig.NoWrapper) wrapper_); + } + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -1475,7 +2514,18 @@ public boolean equals(final java.lang.Object obj) { case 0: default: } - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getWrapperCase().equals(other.getWrapperCase())) return false; + switch (wrapperCase_) { + case 4: + if (!getPubsubWrapper().equals(other.getPubsubWrapper())) return false; + break; + case 5: + if (!getNoWrapper().equals(other.getNoWrapper())) return false; + break; + case 0: + default: + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -1500,7 +2550,19 @@ public int hashCode() { case 0: default: } - hash = (29 * hash) + unknownFields.hashCode(); + switch (wrapperCase_) { + case 4: + hash = (37 * hash) + PUBSUB_WRAPPER_FIELD_NUMBER; + hash = (53 * hash) + getPubsubWrapper().hashCode(); + break; + case 5: + hash = (37 * hash) + NO_WRAPPER_FIELD_NUMBER; + hash = (53 * hash) + getNoWrapper().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -1541,38 +2603,38 @@ public static com.google.pubsub.v1.PushConfig parseFrom( public static com.google.pubsub.v1.PushConfig parseFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.PushConfig parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.PushConfig parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); } public static com.google.pubsub.v1.PushConfig parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.PushConfig parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.PushConfig parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } @@ -1595,10 +2657,11 @@ public Builder toBuilder() { } @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** * * @@ -1608,7 +2671,7 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build * * Protobuf type {@code google.pubsub.v1.PushConfig} */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements // @@protoc_insertion_point(builder_implements:google.pubsub.v1.PushConfig) com.google.pubsub.v1.PushConfigOrBuilder { @@ -1618,7 +2681,8 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @SuppressWarnings({"rawtypes"}) - protected com.google.protobuf.MapField internalGetMapField(int number) { + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldReflection( + int number) { switch (number) { case 2: return internalGetAttributes(); @@ -1628,7 +2692,8 @@ protected com.google.protobuf.MapField internalGetMapField(int number) { } @SuppressWarnings({"rawtypes"}) - protected com.google.protobuf.MapField internalGetMutableMapField(int number) { + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMutableMapFieldReflection( + int number) { switch (number) { case 2: return internalGetMutableAttributes(); @@ -1638,7 +2703,7 @@ protected com.google.protobuf.MapField internalGetMutableMapField(int number) { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_PushConfig_fieldAccessorTable @@ -1647,27 +2712,31 @@ protected com.google.protobuf.MapField internalGetMutableMapField(int number) { } // Construct using com.google.pubsub.v1.PushConfig.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } + private Builder() {} - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} } @java.lang.Override public Builder clear() { super.clear(); + bitField0_ = 0; pushEndpoint_ = ""; - internalGetMutableAttributes().clear(); + if (oidcTokenBuilder_ != null) { + oidcTokenBuilder_.clear(); + } + if (pubsubWrapperBuilder_ != null) { + pubsubWrapperBuilder_.clear(); + } + if (noWrapperBuilder_ != null) { + noWrapperBuilder_.clear(); + } authenticationMethodCase_ = 0; authenticationMethod_ = null; + wrapperCase_ = 0; + wrapper_ = null; return this; } @@ -1694,731 +2763,1378 @@ public com.google.pubsub.v1.PushConfig build() { @java.lang.Override public com.google.pubsub.v1.PushConfig buildPartial() { com.google.pubsub.v1.PushConfig result = new com.google.pubsub.v1.PushConfig(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + buildPartialOneofs(result); + onBuilt(); + return result; + } + + private void buildPartial0(com.google.pubsub.v1.PushConfig result) { int from_bitField0_ = bitField0_; - result.pushEndpoint_ = pushEndpoint_; - result.attributes_ = internalGetAttributes(); - result.attributes_.makeImmutable(); - if (authenticationMethodCase_ == 3) { - if (oidcTokenBuilder_ == null) { - result.authenticationMethod_ = authenticationMethod_; - } else { - result.authenticationMethod_ = oidcTokenBuilder_.build(); - } + if (((from_bitField0_ & 0x00000001) != 0)) { + result.pushEndpoint_ = pushEndpoint_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.attributes_ = internalGetAttributes(); + result.attributes_.makeImmutable(); + } + } + + private void buildPartialOneofs(com.google.pubsub.v1.PushConfig result) { + result.authenticationMethodCase_ = authenticationMethodCase_; + result.authenticationMethod_ = this.authenticationMethod_; + if (authenticationMethodCase_ == 3 && oidcTokenBuilder_ != null) { + result.authenticationMethod_ = oidcTokenBuilder_.build(); + } + result.wrapperCase_ = wrapperCase_; + result.wrapper_ = this.wrapper_; + if (wrapperCase_ == 4 && pubsubWrapperBuilder_ != null) { + result.wrapper_ = pubsubWrapperBuilder_.build(); + } + if (wrapperCase_ == 5 && noWrapperBuilder_ != null) { + result.wrapper_ = noWrapperBuilder_.build(); + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.pubsub.v1.PushConfig) { + return mergeFrom((com.google.pubsub.v1.PushConfig) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.pubsub.v1.PushConfig other) { + if (other == com.google.pubsub.v1.PushConfig.getDefaultInstance()) return this; + if (!other.getPushEndpoint().isEmpty()) { + pushEndpoint_ = other.pushEndpoint_; + bitField0_ |= 0x00000001; + onChanged(); + } + internalGetMutableAttributes().mergeFrom(other.internalGetAttributes()); + bitField0_ |= 0x00000002; + switch (other.getAuthenticationMethodCase()) { + case OIDC_TOKEN: + { + mergeOidcToken(other.getOidcToken()); + break; + } + case AUTHENTICATIONMETHOD_NOT_SET: + { + break; + } + } + switch (other.getWrapperCase()) { + case PUBSUB_WRAPPER: + { + mergePubsubWrapper(other.getPubsubWrapper()); + break; + } + case NO_WRAPPER: + { + mergeNoWrapper(other.getNoWrapper()); + break; + } + case WRAPPER_NOT_SET: + { + break; + } + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + pushEndpoint_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + com.google.protobuf.MapEntry attributes__ = + input.readMessage( + AttributesDefaultEntryHolder.defaultEntry.getParserForType(), + extensionRegistry); + internalGetMutableAttributes() + .getMutableMap() + .put(attributes__.getKey(), attributes__.getValue()); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: + { + input.readMessage( + internalGetOidcTokenFieldBuilder().getBuilder(), extensionRegistry); + authenticationMethodCase_ = 3; + break; + } // case 26 + case 34: + { + input.readMessage( + internalGetPubsubWrapperFieldBuilder().getBuilder(), extensionRegistry); + wrapperCase_ = 4; + break; + } // case 34 + case 42: + { + input.readMessage( + internalGetNoWrapperFieldBuilder().getBuilder(), extensionRegistry); + wrapperCase_ = 5; + break; + } // case 42 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int authenticationMethodCase_ = 0; + private java.lang.Object authenticationMethod_; + + public AuthenticationMethodCase getAuthenticationMethodCase() { + return AuthenticationMethodCase.forNumber(authenticationMethodCase_); + } + + public Builder clearAuthenticationMethod() { + authenticationMethodCase_ = 0; + authenticationMethod_ = null; + onChanged(); + return this; + } + + private int wrapperCase_ = 0; + private java.lang.Object wrapper_; + + public WrapperCase getWrapperCase() { + return WrapperCase.forNumber(wrapperCase_); + } + + public Builder clearWrapper() { + wrapperCase_ = 0; + wrapper_ = null; + onChanged(); + return this; + } + + private int bitField0_; + + private java.lang.Object pushEndpoint_ = ""; + + /** + * + * + *
    +     * Optional. A URL locating the endpoint to which messages should be pushed.
    +     * For example, a Webhook endpoint might use `https://example.com/push`.
    +     * 
    + * + * string push_endpoint = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pushEndpoint. + */ + public java.lang.String getPushEndpoint() { + java.lang.Object ref = pushEndpoint_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pushEndpoint_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +     * Optional. A URL locating the endpoint to which messages should be pushed.
    +     * For example, a Webhook endpoint might use `https://example.com/push`.
    +     * 
    + * + * string push_endpoint = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for pushEndpoint. + */ + public com.google.protobuf.ByteString getPushEndpointBytes() { + java.lang.Object ref = pushEndpoint_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pushEndpoint_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +     * Optional. A URL locating the endpoint to which messages should be pushed.
    +     * For example, a Webhook endpoint might use `https://example.com/push`.
    +     * 
    + * + * string push_endpoint = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The pushEndpoint to set. + * @return This builder for chaining. + */ + public Builder setPushEndpoint(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + pushEndpoint_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Optional. A URL locating the endpoint to which messages should be pushed.
    +     * For example, a Webhook endpoint might use `https://example.com/push`.
    +     * 
    + * + * string push_endpoint = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearPushEndpoint() { + pushEndpoint_ = getDefaultInstance().getPushEndpoint(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + + /** + * + * + *
    +     * Optional. A URL locating the endpoint to which messages should be pushed.
    +     * For example, a Webhook endpoint might use `https://example.com/push`.
    +     * 
    + * + * string push_endpoint = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for pushEndpoint to set. + * @return This builder for chaining. + */ + public Builder setPushEndpointBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + pushEndpoint_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private com.google.protobuf.MapField attributes_; + + private com.google.protobuf.MapField + internalGetAttributes() { + if (attributes_ == null) { + return com.google.protobuf.MapField.emptyMapField( + AttributesDefaultEntryHolder.defaultEntry); + } + return attributes_; + } + + private com.google.protobuf.MapField + internalGetMutableAttributes() { + if (attributes_ == null) { + attributes_ = + com.google.protobuf.MapField.newMapField(AttributesDefaultEntryHolder.defaultEntry); } - result.authenticationMethodCase_ = authenticationMethodCase_; - onBuilt(); - return result; + if (!attributes_.isMutable()) { + attributes_ = attributes_.copy(); + } + bitField0_ |= 0x00000002; + onChanged(); + return attributes_; } - @java.lang.Override - public Builder clone() { - return super.clone(); + public int getAttributesCount() { + return internalGetAttributes().getMap().size(); } + /** + * + * + *
    +     * Optional. Endpoint configuration attributes that can be used to control
    +     * different aspects of the message delivery.
    +     *
    +     * The only currently supported attribute is `x-goog-version`, which you can
    +     * use to change the format of the pushed message. This attribute
    +     * indicates the version of the data expected by the endpoint. This
    +     * controls the shape of the pushed message (i.e., its fields and metadata).
    +     *
    +     * If not present during the `CreateSubscription` call, it will default to
    +     * the version of the Pub/Sub API used to make such call. If not present in a
    +     * `ModifyPushConfig` call, its value will not be changed. `GetSubscription`
    +     * calls will always return a valid version, even if the subscription was
    +     * created without this attribute.
    +     *
    +     * The only supported values for the `x-goog-version` attribute are:
    +     *
    +     * * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API.
    +     * * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API.
    +     *
    +     * For example:
    +     * `attributes { "x-goog-version": "v1" }`
    +     * 
    + * + * map<string, string> attributes = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); + public boolean containsAttributes(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetAttributes().getMap().containsKey(key); } + /** Use {@link #getAttributesMap()} instead. */ @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); + @java.lang.Deprecated + public java.util.Map getAttributes() { + return getAttributesMap(); } + /** + * + * + *
    +     * Optional. Endpoint configuration attributes that can be used to control
    +     * different aspects of the message delivery.
    +     *
    +     * The only currently supported attribute is `x-goog-version`, which you can
    +     * use to change the format of the pushed message. This attribute
    +     * indicates the version of the data expected by the endpoint. This
    +     * controls the shape of the pushed message (i.e., its fields and metadata).
    +     *
    +     * If not present during the `CreateSubscription` call, it will default to
    +     * the version of the Pub/Sub API used to make such call. If not present in a
    +     * `ModifyPushConfig` call, its value will not be changed. `GetSubscription`
    +     * calls will always return a valid version, even if the subscription was
    +     * created without this attribute.
    +     *
    +     * The only supported values for the `x-goog-version` attribute are:
    +     *
    +     * * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API.
    +     * * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API.
    +     *
    +     * For example:
    +     * `attributes { "x-goog-version": "v1" }`
    +     * 
    + * + * map<string, string> attributes = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); + public java.util.Map getAttributesMap() { + return internalGetAttributes().getMap(); } + /** + * + * + *
    +     * Optional. Endpoint configuration attributes that can be used to control
    +     * different aspects of the message delivery.
    +     *
    +     * The only currently supported attribute is `x-goog-version`, which you can
    +     * use to change the format of the pushed message. This attribute
    +     * indicates the version of the data expected by the endpoint. This
    +     * controls the shape of the pushed message (i.e., its fields and metadata).
    +     *
    +     * If not present during the `CreateSubscription` call, it will default to
    +     * the version of the Pub/Sub API used to make such call. If not present in a
    +     * `ModifyPushConfig` call, its value will not be changed. `GetSubscription`
    +     * calls will always return a valid version, even if the subscription was
    +     * created without this attribute.
    +     *
    +     * The only supported values for the `x-goog-version` attribute are:
    +     *
    +     * * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API.
    +     * * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API.
    +     *
    +     * For example:
    +     * `attributes { "x-goog-version": "v1" }`
    +     * 
    + * + * map<string, string> attributes = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); + public /* nullable */ java.lang.String getAttributesOrDefault( + java.lang.String key, + /* nullable */ + java.lang.String defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetAttributes().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; } + /** + * + * + *
    +     * Optional. Endpoint configuration attributes that can be used to control
    +     * different aspects of the message delivery.
    +     *
    +     * The only currently supported attribute is `x-goog-version`, which you can
    +     * use to change the format of the pushed message. This attribute
    +     * indicates the version of the data expected by the endpoint. This
    +     * controls the shape of the pushed message (i.e., its fields and metadata).
    +     *
    +     * If not present during the `CreateSubscription` call, it will default to
    +     * the version of the Pub/Sub API used to make such call. If not present in a
    +     * `ModifyPushConfig` call, its value will not be changed. `GetSubscription`
    +     * calls will always return a valid version, even if the subscription was
    +     * created without this attribute.
    +     *
    +     * The only supported values for the `x-goog-version` attribute are:
    +     *
    +     * * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API.
    +     * * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API.
    +     *
    +     * For example:
    +     * `attributes { "x-goog-version": "v1" }`
    +     * 
    + * + * map<string, string> attributes = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); + public java.lang.String getAttributesOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetAttributes().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); } - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.google.pubsub.v1.PushConfig) { - return mergeFrom((com.google.pubsub.v1.PushConfig) other); - } else { - super.mergeFrom(other); - return this; - } + public Builder clearAttributes() { + bitField0_ = (bitField0_ & ~0x00000002); + internalGetMutableAttributes().getMutableMap().clear(); + return this; } - public Builder mergeFrom(com.google.pubsub.v1.PushConfig other) { - if (other == com.google.pubsub.v1.PushConfig.getDefaultInstance()) return this; - if (!other.getPushEndpoint().isEmpty()) { - pushEndpoint_ = other.pushEndpoint_; - onChanged(); - } - internalGetMutableAttributes().mergeFrom(other.internalGetAttributes()); - switch (other.getAuthenticationMethodCase()) { - case OIDC_TOKEN: - { - mergeOidcToken(other.getOidcToken()); - break; - } - case AUTHENTICATIONMETHOD_NOT_SET: - { - break; - } + /** + * + * + *
    +     * Optional. Endpoint configuration attributes that can be used to control
    +     * different aspects of the message delivery.
    +     *
    +     * The only currently supported attribute is `x-goog-version`, which you can
    +     * use to change the format of the pushed message. This attribute
    +     * indicates the version of the data expected by the endpoint. This
    +     * controls the shape of the pushed message (i.e., its fields and metadata).
    +     *
    +     * If not present during the `CreateSubscription` call, it will default to
    +     * the version of the Pub/Sub API used to make such call. If not present in a
    +     * `ModifyPushConfig` call, its value will not be changed. `GetSubscription`
    +     * calls will always return a valid version, even if the subscription was
    +     * created without this attribute.
    +     *
    +     * The only supported values for the `x-goog-version` attribute are:
    +     *
    +     * * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API.
    +     * * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API.
    +     *
    +     * For example:
    +     * `attributes { "x-goog-version": "v1" }`
    +     * 
    + * + * map<string, string> attributes = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder removeAttributes(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); } - this.mergeUnknownFields(other.unknownFields); - onChanged(); + internalGetMutableAttributes().getMutableMap().remove(key); return this; } - @java.lang.Override - public final boolean isInitialized() { - return true; + /** Use alternate mutation accessors instead. */ + @java.lang.Deprecated + public java.util.Map getMutableAttributes() { + bitField0_ |= 0x00000002; + return internalGetMutableAttributes().getMutableMap(); } - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.pubsub.v1.PushConfig parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.google.pubsub.v1.PushConfig) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } + /** + * + * + *
    +     * Optional. Endpoint configuration attributes that can be used to control
    +     * different aspects of the message delivery.
    +     *
    +     * The only currently supported attribute is `x-goog-version`, which you can
    +     * use to change the format of the pushed message. This attribute
    +     * indicates the version of the data expected by the endpoint. This
    +     * controls the shape of the pushed message (i.e., its fields and metadata).
    +     *
    +     * If not present during the `CreateSubscription` call, it will default to
    +     * the version of the Pub/Sub API used to make such call. If not present in a
    +     * `ModifyPushConfig` call, its value will not be changed. `GetSubscription`
    +     * calls will always return a valid version, even if the subscription was
    +     * created without this attribute.
    +     *
    +     * The only supported values for the `x-goog-version` attribute are:
    +     *
    +     * * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API.
    +     * * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API.
    +     *
    +     * For example:
    +     * `attributes { "x-goog-version": "v1" }`
    +     * 
    + * + * map<string, string> attributes = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder putAttributes(java.lang.String key, java.lang.String value) { + if (key == null) { + throw new NullPointerException("map key"); } + if (value == null) { + throw new NullPointerException("map value"); + } + internalGetMutableAttributes().getMutableMap().put(key, value); + bitField0_ |= 0x00000002; + return this; + } + + /** + * + * + *
    +     * Optional. Endpoint configuration attributes that can be used to control
    +     * different aspects of the message delivery.
    +     *
    +     * The only currently supported attribute is `x-goog-version`, which you can
    +     * use to change the format of the pushed message. This attribute
    +     * indicates the version of the data expected by the endpoint. This
    +     * controls the shape of the pushed message (i.e., its fields and metadata).
    +     *
    +     * If not present during the `CreateSubscription` call, it will default to
    +     * the version of the Pub/Sub API used to make such call. If not present in a
    +     * `ModifyPushConfig` call, its value will not be changed. `GetSubscription`
    +     * calls will always return a valid version, even if the subscription was
    +     * created without this attribute.
    +     *
    +     * The only supported values for the `x-goog-version` attribute are:
    +     *
    +     * * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API.
    +     * * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API.
    +     *
    +     * For example:
    +     * `attributes { "x-goog-version": "v1" }`
    +     * 
    + * + * map<string, string> attributes = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder putAllAttributes(java.util.Map values) { + internalGetMutableAttributes().getMutableMap().putAll(values); + bitField0_ |= 0x00000002; return this; } - private int authenticationMethodCase_ = 0; - private java.lang.Object authenticationMethod_; - - public AuthenticationMethodCase getAuthenticationMethodCase() { - return AuthenticationMethodCase.forNumber(authenticationMethodCase_); - } + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.PushConfig.OidcToken, + com.google.pubsub.v1.PushConfig.OidcToken.Builder, + com.google.pubsub.v1.PushConfig.OidcTokenOrBuilder> + oidcTokenBuilder_; - public Builder clearAuthenticationMethod() { - authenticationMethodCase_ = 0; - authenticationMethod_ = null; - onChanged(); - return this; + /** + * + * + *
    +     * Optional. If specified, Pub/Sub will generate and attach an OIDC JWT
    +     * token as an `Authorization` header in the HTTP request for every pushed
    +     * message.
    +     * 
    + * + * + * .google.pubsub.v1.PushConfig.OidcToken oidc_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the oidcToken field is set. + */ + @java.lang.Override + public boolean hasOidcToken() { + return authenticationMethodCase_ == 3; } - private int bitField0_; - - private java.lang.Object pushEndpoint_ = ""; /** * * *
    -     * A URL locating the endpoint to which messages should be pushed.
    -     * For example, a Webhook endpoint might use `https://example.com/push`.
    +     * Optional. If specified, Pub/Sub will generate and attach an OIDC JWT
    +     * token as an `Authorization` header in the HTTP request for every pushed
    +     * message.
          * 
    * - * string push_endpoint = 1; + * + * .google.pubsub.v1.PushConfig.OidcToken oidc_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * * - * @return The pushEndpoint. + * @return The oidcToken. */ - public java.lang.String getPushEndpoint() { - java.lang.Object ref = pushEndpoint_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - pushEndpoint_ = s; - return s; + @java.lang.Override + public com.google.pubsub.v1.PushConfig.OidcToken getOidcToken() { + if (oidcTokenBuilder_ == null) { + if (authenticationMethodCase_ == 3) { + return (com.google.pubsub.v1.PushConfig.OidcToken) authenticationMethod_; + } + return com.google.pubsub.v1.PushConfig.OidcToken.getDefaultInstance(); } else { - return (java.lang.String) ref; + if (authenticationMethodCase_ == 3) { + return oidcTokenBuilder_.getMessage(); + } + return com.google.pubsub.v1.PushConfig.OidcToken.getDefaultInstance(); } } + /** * * *
    -     * A URL locating the endpoint to which messages should be pushed.
    -     * For example, a Webhook endpoint might use `https://example.com/push`.
    +     * Optional. If specified, Pub/Sub will generate and attach an OIDC JWT
    +     * token as an `Authorization` header in the HTTP request for every pushed
    +     * message.
          * 
    * - * string push_endpoint = 1; - * - * @return The bytes for pushEndpoint. + * + * .google.pubsub.v1.PushConfig.OidcToken oidc_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public com.google.protobuf.ByteString getPushEndpointBytes() { - java.lang.Object ref = pushEndpoint_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - pushEndpoint_ = b; - return b; + public Builder setOidcToken(com.google.pubsub.v1.PushConfig.OidcToken value) { + if (oidcTokenBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + authenticationMethod_ = value; + onChanged(); } else { - return (com.google.protobuf.ByteString) ref; + oidcTokenBuilder_.setMessage(value); } + authenticationMethodCase_ = 3; + return this; } + /** * * *
    -     * A URL locating the endpoint to which messages should be pushed.
    -     * For example, a Webhook endpoint might use `https://example.com/push`.
    +     * Optional. If specified, Pub/Sub will generate and attach an OIDC JWT
    +     * token as an `Authorization` header in the HTTP request for every pushed
    +     * message.
          * 
    * - * string push_endpoint = 1; - * - * @param value The pushEndpoint to set. - * @return This builder for chaining. + * + * .google.pubsub.v1.PushConfig.OidcToken oidc_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public Builder setPushEndpoint(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); + public Builder setOidcToken(com.google.pubsub.v1.PushConfig.OidcToken.Builder builderForValue) { + if (oidcTokenBuilder_ == null) { + authenticationMethod_ = builderForValue.build(); + onChanged(); + } else { + oidcTokenBuilder_.setMessage(builderForValue.build()); } - - pushEndpoint_ = value; - onChanged(); + authenticationMethodCase_ = 3; return this; } + /** * * *
    -     * A URL locating the endpoint to which messages should be pushed.
    -     * For example, a Webhook endpoint might use `https://example.com/push`.
    +     * Optional. If specified, Pub/Sub will generate and attach an OIDC JWT
    +     * token as an `Authorization` header in the HTTP request for every pushed
    +     * message.
          * 
    * - * string push_endpoint = 1; - * - * @return This builder for chaining. + * + * .google.pubsub.v1.PushConfig.OidcToken oidc_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public Builder clearPushEndpoint() { - - pushEndpoint_ = getDefaultInstance().getPushEndpoint(); - onChanged(); + public Builder mergeOidcToken(com.google.pubsub.v1.PushConfig.OidcToken value) { + if (oidcTokenBuilder_ == null) { + if (authenticationMethodCase_ == 3 + && authenticationMethod_ + != com.google.pubsub.v1.PushConfig.OidcToken.getDefaultInstance()) { + authenticationMethod_ = + com.google.pubsub.v1.PushConfig.OidcToken.newBuilder( + (com.google.pubsub.v1.PushConfig.OidcToken) authenticationMethod_) + .mergeFrom(value) + .buildPartial(); + } else { + authenticationMethod_ = value; + } + onChanged(); + } else { + if (authenticationMethodCase_ == 3) { + oidcTokenBuilder_.mergeFrom(value); + } else { + oidcTokenBuilder_.setMessage(value); + } + } + authenticationMethodCase_ = 3; return this; } + /** * * *
    -     * A URL locating the endpoint to which messages should be pushed.
    -     * For example, a Webhook endpoint might use `https://example.com/push`.
    +     * Optional. If specified, Pub/Sub will generate and attach an OIDC JWT
    +     * token as an `Authorization` header in the HTTP request for every pushed
    +     * message.
          * 
    * - * string push_endpoint = 1; - * - * @param value The bytes for pushEndpoint to set. - * @return This builder for chaining. + * + * .google.pubsub.v1.PushConfig.OidcToken oidc_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public Builder setPushEndpointBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); + public Builder clearOidcToken() { + if (oidcTokenBuilder_ == null) { + if (authenticationMethodCase_ == 3) { + authenticationMethodCase_ = 0; + authenticationMethod_ = null; + onChanged(); + } + } else { + if (authenticationMethodCase_ == 3) { + authenticationMethodCase_ = 0; + authenticationMethod_ = null; + } + oidcTokenBuilder_.clear(); } - checkByteStringIsUtf8(value); - - pushEndpoint_ = value; - onChanged(); return this; } - private com.google.protobuf.MapField attributes_; - - private com.google.protobuf.MapField - internalGetAttributes() { - if (attributes_ == null) { - return com.google.protobuf.MapField.emptyMapField( - AttributesDefaultEntryHolder.defaultEntry); - } - return attributes_; + /** + * + * + *
    +     * Optional. If specified, Pub/Sub will generate and attach an OIDC JWT
    +     * token as an `Authorization` header in the HTTP request for every pushed
    +     * message.
    +     * 
    + * + * + * .google.pubsub.v1.PushConfig.OidcToken oidc_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.PushConfig.OidcToken.Builder getOidcTokenBuilder() { + return internalGetOidcTokenFieldBuilder().getBuilder(); } - private com.google.protobuf.MapField - internalGetMutableAttributes() { - onChanged(); - ; - if (attributes_ == null) { - attributes_ = - com.google.protobuf.MapField.newMapField(AttributesDefaultEntryHolder.defaultEntry); - } - if (!attributes_.isMutable()) { - attributes_ = attributes_.copy(); + /** + * + * + *
    +     * Optional. If specified, Pub/Sub will generate and attach an OIDC JWT
    +     * token as an `Authorization` header in the HTTP request for every pushed
    +     * message.
    +     * 
    + * + * + * .google.pubsub.v1.PushConfig.OidcToken oidc_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.PushConfig.OidcTokenOrBuilder getOidcTokenOrBuilder() { + if ((authenticationMethodCase_ == 3) && (oidcTokenBuilder_ != null)) { + return oidcTokenBuilder_.getMessageOrBuilder(); + } else { + if (authenticationMethodCase_ == 3) { + return (com.google.pubsub.v1.PushConfig.OidcToken) authenticationMethod_; + } + return com.google.pubsub.v1.PushConfig.OidcToken.getDefaultInstance(); } - return attributes_; } - public int getAttributesCount() { - return internalGetAttributes().getMap().size(); - } /** * * *
    -     * Endpoint configuration attributes that can be used to control different
    -     * aspects of the message delivery.
    -     * The only currently supported attribute is `x-goog-version`, which you can
    -     * use to change the format of the pushed message. This attribute
    -     * indicates the version of the data expected by the endpoint. This
    -     * controls the shape of the pushed message (i.e., its fields and metadata).
    -     * If not present during the `CreateSubscription` call, it will default to
    -     * the version of the Pub/Sub API used to make such call. If not present in a
    -     * `ModifyPushConfig` call, its value will not be changed. `GetSubscription`
    -     * calls will always return a valid version, even if the subscription was
    -     * created without this attribute.
    -     * The only supported values for the `x-goog-version` attribute are:
    -     * * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API.
    -     * * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API.
    -     * For example:
    -     * <pre><code>attributes { "x-goog-version": "v1" } </code></pre>
    +     * Optional. If specified, Pub/Sub will generate and attach an OIDC JWT
    +     * token as an `Authorization` header in the HTTP request for every pushed
    +     * message.
          * 
    * - * map<string, string> attributes = 2; + * + * .google.pubsub.v1.PushConfig.OidcToken oidc_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * */ - @java.lang.Override - public boolean containsAttributes(java.lang.String key) { - if (key == null) { - throw new java.lang.NullPointerException(); + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.PushConfig.OidcToken, + com.google.pubsub.v1.PushConfig.OidcToken.Builder, + com.google.pubsub.v1.PushConfig.OidcTokenOrBuilder> + internalGetOidcTokenFieldBuilder() { + if (oidcTokenBuilder_ == null) { + if (!(authenticationMethodCase_ == 3)) { + authenticationMethod_ = com.google.pubsub.v1.PushConfig.OidcToken.getDefaultInstance(); + } + oidcTokenBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.PushConfig.OidcToken, + com.google.pubsub.v1.PushConfig.OidcToken.Builder, + com.google.pubsub.v1.PushConfig.OidcTokenOrBuilder>( + (com.google.pubsub.v1.PushConfig.OidcToken) authenticationMethod_, + getParentForChildren(), + isClean()); + authenticationMethod_ = null; } - return internalGetAttributes().getMap().containsKey(key); + authenticationMethodCase_ = 3; + onChanged(); + return oidcTokenBuilder_; } - /** Use {@link #getAttributesMap()} instead. */ + + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.PushConfig.PubsubWrapper, + com.google.pubsub.v1.PushConfig.PubsubWrapper.Builder, + com.google.pubsub.v1.PushConfig.PubsubWrapperOrBuilder> + pubsubWrapperBuilder_; + + /** + * + * + *
    +     * Optional. When set, the payload to the push endpoint is in the form of
    +     * the JSON representation of a PubsubMessage
    +     * (https://cloud.google.com/pubsub/docs/reference/rpc/google.pubsub.v1#pubsubmessage).
    +     * 
    + * + * + * .google.pubsub.v1.PushConfig.PubsubWrapper pubsub_wrapper = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the pubsubWrapper field is set. + */ @java.lang.Override - @java.lang.Deprecated - public java.util.Map getAttributes() { - return getAttributesMap(); + public boolean hasPubsubWrapper() { + return wrapperCase_ == 4; } + /** * * *
    -     * Endpoint configuration attributes that can be used to control different
    -     * aspects of the message delivery.
    -     * The only currently supported attribute is `x-goog-version`, which you can
    -     * use to change the format of the pushed message. This attribute
    -     * indicates the version of the data expected by the endpoint. This
    -     * controls the shape of the pushed message (i.e., its fields and metadata).
    -     * If not present during the `CreateSubscription` call, it will default to
    -     * the version of the Pub/Sub API used to make such call. If not present in a
    -     * `ModifyPushConfig` call, its value will not be changed. `GetSubscription`
    -     * calls will always return a valid version, even if the subscription was
    -     * created without this attribute.
    -     * The only supported values for the `x-goog-version` attribute are:
    -     * * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API.
    -     * * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API.
    -     * For example:
    -     * <pre><code>attributes { "x-goog-version": "v1" } </code></pre>
    +     * Optional. When set, the payload to the push endpoint is in the form of
    +     * the JSON representation of a PubsubMessage
    +     * (https://cloud.google.com/pubsub/docs/reference/rpc/google.pubsub.v1#pubsubmessage).
          * 
    * - * map<string, string> attributes = 2; + * + * .google.pubsub.v1.PushConfig.PubsubWrapper pubsub_wrapper = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The pubsubWrapper. */ @java.lang.Override - public java.util.Map getAttributesMap() { - return internalGetAttributes().getMap(); + public com.google.pubsub.v1.PushConfig.PubsubWrapper getPubsubWrapper() { + if (pubsubWrapperBuilder_ == null) { + if (wrapperCase_ == 4) { + return (com.google.pubsub.v1.PushConfig.PubsubWrapper) wrapper_; + } + return com.google.pubsub.v1.PushConfig.PubsubWrapper.getDefaultInstance(); + } else { + if (wrapperCase_ == 4) { + return pubsubWrapperBuilder_.getMessage(); + } + return com.google.pubsub.v1.PushConfig.PubsubWrapper.getDefaultInstance(); + } } + /** * * *
    -     * Endpoint configuration attributes that can be used to control different
    -     * aspects of the message delivery.
    -     * The only currently supported attribute is `x-goog-version`, which you can
    -     * use to change the format of the pushed message. This attribute
    -     * indicates the version of the data expected by the endpoint. This
    -     * controls the shape of the pushed message (i.e., its fields and metadata).
    -     * If not present during the `CreateSubscription` call, it will default to
    -     * the version of the Pub/Sub API used to make such call. If not present in a
    -     * `ModifyPushConfig` call, its value will not be changed. `GetSubscription`
    -     * calls will always return a valid version, even if the subscription was
    -     * created without this attribute.
    -     * The only supported values for the `x-goog-version` attribute are:
    -     * * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API.
    -     * * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API.
    -     * For example:
    -     * <pre><code>attributes { "x-goog-version": "v1" } </code></pre>
    +     * Optional. When set, the payload to the push endpoint is in the form of
    +     * the JSON representation of a PubsubMessage
    +     * (https://cloud.google.com/pubsub/docs/reference/rpc/google.pubsub.v1#pubsubmessage).
          * 
    * - * map<string, string> attributes = 2; + * + * .google.pubsub.v1.PushConfig.PubsubWrapper pubsub_wrapper = 4 [(.google.api.field_behavior) = OPTIONAL]; + * */ - @java.lang.Override - public java.lang.String getAttributesOrDefault( - java.lang.String key, java.lang.String defaultValue) { - if (key == null) { - throw new java.lang.NullPointerException(); + public Builder setPubsubWrapper(com.google.pubsub.v1.PushConfig.PubsubWrapper value) { + if (pubsubWrapperBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + wrapper_ = value; + onChanged(); + } else { + pubsubWrapperBuilder_.setMessage(value); } - java.util.Map map = internalGetAttributes().getMap(); - return map.containsKey(key) ? map.get(key) : defaultValue; + wrapperCase_ = 4; + return this; } + /** * * *
    -     * Endpoint configuration attributes that can be used to control different
    -     * aspects of the message delivery.
    -     * The only currently supported attribute is `x-goog-version`, which you can
    -     * use to change the format of the pushed message. This attribute
    -     * indicates the version of the data expected by the endpoint. This
    -     * controls the shape of the pushed message (i.e., its fields and metadata).
    -     * If not present during the `CreateSubscription` call, it will default to
    -     * the version of the Pub/Sub API used to make such call. If not present in a
    -     * `ModifyPushConfig` call, its value will not be changed. `GetSubscription`
    -     * calls will always return a valid version, even if the subscription was
    -     * created without this attribute.
    -     * The only supported values for the `x-goog-version` attribute are:
    -     * * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API.
    -     * * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API.
    -     * For example:
    -     * <pre><code>attributes { "x-goog-version": "v1" } </code></pre>
    +     * Optional. When set, the payload to the push endpoint is in the form of
    +     * the JSON representation of a PubsubMessage
    +     * (https://cloud.google.com/pubsub/docs/reference/rpc/google.pubsub.v1#pubsubmessage).
          * 
    * - * map<string, string> attributes = 2; + * + * .google.pubsub.v1.PushConfig.PubsubWrapper pubsub_wrapper = 4 [(.google.api.field_behavior) = OPTIONAL]; + * */ - @java.lang.Override - public java.lang.String getAttributesOrThrow(java.lang.String key) { - if (key == null) { - throw new java.lang.NullPointerException(); - } - java.util.Map map = internalGetAttributes().getMap(); - if (!map.containsKey(key)) { - throw new java.lang.IllegalArgumentException(); + public Builder setPubsubWrapper( + com.google.pubsub.v1.PushConfig.PubsubWrapper.Builder builderForValue) { + if (pubsubWrapperBuilder_ == null) { + wrapper_ = builderForValue.build(); + onChanged(); + } else { + pubsubWrapperBuilder_.setMessage(builderForValue.build()); } - return map.get(key); + wrapperCase_ = 4; + return this; } - public Builder clearAttributes() { - internalGetMutableAttributes().getMutableMap().clear(); + /** + * + * + *
    +     * Optional. When set, the payload to the push endpoint is in the form of
    +     * the JSON representation of a PubsubMessage
    +     * (https://cloud.google.com/pubsub/docs/reference/rpc/google.pubsub.v1#pubsubmessage).
    +     * 
    + * + * + * .google.pubsub.v1.PushConfig.PubsubWrapper pubsub_wrapper = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergePubsubWrapper(com.google.pubsub.v1.PushConfig.PubsubWrapper value) { + if (pubsubWrapperBuilder_ == null) { + if (wrapperCase_ == 4 + && wrapper_ != com.google.pubsub.v1.PushConfig.PubsubWrapper.getDefaultInstance()) { + wrapper_ = + com.google.pubsub.v1.PushConfig.PubsubWrapper.newBuilder( + (com.google.pubsub.v1.PushConfig.PubsubWrapper) wrapper_) + .mergeFrom(value) + .buildPartial(); + } else { + wrapper_ = value; + } + onChanged(); + } else { + if (wrapperCase_ == 4) { + pubsubWrapperBuilder_.mergeFrom(value); + } else { + pubsubWrapperBuilder_.setMessage(value); + } + } + wrapperCase_ = 4; return this; } + /** * * *
    -     * Endpoint configuration attributes that can be used to control different
    -     * aspects of the message delivery.
    -     * The only currently supported attribute is `x-goog-version`, which you can
    -     * use to change the format of the pushed message. This attribute
    -     * indicates the version of the data expected by the endpoint. This
    -     * controls the shape of the pushed message (i.e., its fields and metadata).
    -     * If not present during the `CreateSubscription` call, it will default to
    -     * the version of the Pub/Sub API used to make such call. If not present in a
    -     * `ModifyPushConfig` call, its value will not be changed. `GetSubscription`
    -     * calls will always return a valid version, even if the subscription was
    -     * created without this attribute.
    -     * The only supported values for the `x-goog-version` attribute are:
    -     * * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API.
    -     * * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API.
    -     * For example:
    -     * <pre><code>attributes { "x-goog-version": "v1" } </code></pre>
    +     * Optional. When set, the payload to the push endpoint is in the form of
    +     * the JSON representation of a PubsubMessage
    +     * (https://cloud.google.com/pubsub/docs/reference/rpc/google.pubsub.v1#pubsubmessage).
          * 
    * - * map<string, string> attributes = 2; + * + * .google.pubsub.v1.PushConfig.PubsubWrapper pubsub_wrapper = 4 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public Builder removeAttributes(java.lang.String key) { - if (key == null) { - throw new java.lang.NullPointerException(); + public Builder clearPubsubWrapper() { + if (pubsubWrapperBuilder_ == null) { + if (wrapperCase_ == 4) { + wrapperCase_ = 0; + wrapper_ = null; + onChanged(); + } + } else { + if (wrapperCase_ == 4) { + wrapperCase_ = 0; + wrapper_ = null; + } + pubsubWrapperBuilder_.clear(); } - internalGetMutableAttributes().getMutableMap().remove(key); return this; } - /** Use alternate mutation accessors instead. */ - @java.lang.Deprecated - public java.util.Map getMutableAttributes() { - return internalGetMutableAttributes().getMutableMap(); + + /** + * + * + *
    +     * Optional. When set, the payload to the push endpoint is in the form of
    +     * the JSON representation of a PubsubMessage
    +     * (https://cloud.google.com/pubsub/docs/reference/rpc/google.pubsub.v1#pubsubmessage).
    +     * 
    + * + * + * .google.pubsub.v1.PushConfig.PubsubWrapper pubsub_wrapper = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.PushConfig.PubsubWrapper.Builder getPubsubWrapperBuilder() { + return internalGetPubsubWrapperFieldBuilder().getBuilder(); } + /** * * *
    -     * Endpoint configuration attributes that can be used to control different
    -     * aspects of the message delivery.
    -     * The only currently supported attribute is `x-goog-version`, which you can
    -     * use to change the format of the pushed message. This attribute
    -     * indicates the version of the data expected by the endpoint. This
    -     * controls the shape of the pushed message (i.e., its fields and metadata).
    -     * If not present during the `CreateSubscription` call, it will default to
    -     * the version of the Pub/Sub API used to make such call. If not present in a
    -     * `ModifyPushConfig` call, its value will not be changed. `GetSubscription`
    -     * calls will always return a valid version, even if the subscription was
    -     * created without this attribute.
    -     * The only supported values for the `x-goog-version` attribute are:
    -     * * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API.
    -     * * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API.
    -     * For example:
    -     * <pre><code>attributes { "x-goog-version": "v1" } </code></pre>
    +     * Optional. When set, the payload to the push endpoint is in the form of
    +     * the JSON representation of a PubsubMessage
    +     * (https://cloud.google.com/pubsub/docs/reference/rpc/google.pubsub.v1#pubsubmessage).
          * 
    * - * map<string, string> attributes = 2; + * + * .google.pubsub.v1.PushConfig.PubsubWrapper pubsub_wrapper = 4 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public Builder putAttributes(java.lang.String key, java.lang.String value) { - if (key == null) { - throw new java.lang.NullPointerException(); - } - if (value == null) { - throw new java.lang.NullPointerException(); + @java.lang.Override + public com.google.pubsub.v1.PushConfig.PubsubWrapperOrBuilder getPubsubWrapperOrBuilder() { + if ((wrapperCase_ == 4) && (pubsubWrapperBuilder_ != null)) { + return pubsubWrapperBuilder_.getMessageOrBuilder(); + } else { + if (wrapperCase_ == 4) { + return (com.google.pubsub.v1.PushConfig.PubsubWrapper) wrapper_; + } + return com.google.pubsub.v1.PushConfig.PubsubWrapper.getDefaultInstance(); } - internalGetMutableAttributes().getMutableMap().put(key, value); - return this; } + /** * * *
    -     * Endpoint configuration attributes that can be used to control different
    -     * aspects of the message delivery.
    -     * The only currently supported attribute is `x-goog-version`, which you can
    -     * use to change the format of the pushed message. This attribute
    -     * indicates the version of the data expected by the endpoint. This
    -     * controls the shape of the pushed message (i.e., its fields and metadata).
    -     * If not present during the `CreateSubscription` call, it will default to
    -     * the version of the Pub/Sub API used to make such call. If not present in a
    -     * `ModifyPushConfig` call, its value will not be changed. `GetSubscription`
    -     * calls will always return a valid version, even if the subscription was
    -     * created without this attribute.
    -     * The only supported values for the `x-goog-version` attribute are:
    -     * * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API.
    -     * * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API.
    -     * For example:
    -     * <pre><code>attributes { "x-goog-version": "v1" } </code></pre>
    +     * Optional. When set, the payload to the push endpoint is in the form of
    +     * the JSON representation of a PubsubMessage
    +     * (https://cloud.google.com/pubsub/docs/reference/rpc/google.pubsub.v1#pubsubmessage).
          * 
    * - * map<string, string> attributes = 2; + * + * .google.pubsub.v1.PushConfig.PubsubWrapper pubsub_wrapper = 4 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public Builder putAllAttributes(java.util.Map values) { - internalGetMutableAttributes().getMutableMap().putAll(values); - return this; + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.PushConfig.PubsubWrapper, + com.google.pubsub.v1.PushConfig.PubsubWrapper.Builder, + com.google.pubsub.v1.PushConfig.PubsubWrapperOrBuilder> + internalGetPubsubWrapperFieldBuilder() { + if (pubsubWrapperBuilder_ == null) { + if (!(wrapperCase_ == 4)) { + wrapper_ = com.google.pubsub.v1.PushConfig.PubsubWrapper.getDefaultInstance(); + } + pubsubWrapperBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.PushConfig.PubsubWrapper, + com.google.pubsub.v1.PushConfig.PubsubWrapper.Builder, + com.google.pubsub.v1.PushConfig.PubsubWrapperOrBuilder>( + (com.google.pubsub.v1.PushConfig.PubsubWrapper) wrapper_, + getParentForChildren(), + isClean()); + wrapper_ = null; + } + wrapperCase_ = 4; + onChanged(); + return pubsubWrapperBuilder_; } - private com.google.protobuf.SingleFieldBuilderV3< - com.google.pubsub.v1.PushConfig.OidcToken, - com.google.pubsub.v1.PushConfig.OidcToken.Builder, - com.google.pubsub.v1.PushConfig.OidcTokenOrBuilder> - oidcTokenBuilder_; + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.PushConfig.NoWrapper, + com.google.pubsub.v1.PushConfig.NoWrapper.Builder, + com.google.pubsub.v1.PushConfig.NoWrapperOrBuilder> + noWrapperBuilder_; + /** * * *
    -     * If specified, Pub/Sub will generate and attach an OIDC JWT token as an
    -     * `Authorization` header in the HTTP request for every pushed message.
    +     * Optional. When set, the payload to the push endpoint is not wrapped.
          * 
    * - * .google.pubsub.v1.PushConfig.OidcToken oidc_token = 3; + * + * .google.pubsub.v1.PushConfig.NoWrapper no_wrapper = 5 [(.google.api.field_behavior) = OPTIONAL]; + * * - * @return Whether the oidcToken field is set. + * @return Whether the noWrapper field is set. */ @java.lang.Override - public boolean hasOidcToken() { - return authenticationMethodCase_ == 3; + public boolean hasNoWrapper() { + return wrapperCase_ == 5; } + /** * * *
    -     * If specified, Pub/Sub will generate and attach an OIDC JWT token as an
    -     * `Authorization` header in the HTTP request for every pushed message.
    +     * Optional. When set, the payload to the push endpoint is not wrapped.
          * 
    * - * .google.pubsub.v1.PushConfig.OidcToken oidc_token = 3; + * + * .google.pubsub.v1.PushConfig.NoWrapper no_wrapper = 5 [(.google.api.field_behavior) = OPTIONAL]; + * * - * @return The oidcToken. + * @return The noWrapper. */ @java.lang.Override - public com.google.pubsub.v1.PushConfig.OidcToken getOidcToken() { - if (oidcTokenBuilder_ == null) { - if (authenticationMethodCase_ == 3) { - return (com.google.pubsub.v1.PushConfig.OidcToken) authenticationMethod_; + public com.google.pubsub.v1.PushConfig.NoWrapper getNoWrapper() { + if (noWrapperBuilder_ == null) { + if (wrapperCase_ == 5) { + return (com.google.pubsub.v1.PushConfig.NoWrapper) wrapper_; } - return com.google.pubsub.v1.PushConfig.OidcToken.getDefaultInstance(); + return com.google.pubsub.v1.PushConfig.NoWrapper.getDefaultInstance(); } else { - if (authenticationMethodCase_ == 3) { - return oidcTokenBuilder_.getMessage(); + if (wrapperCase_ == 5) { + return noWrapperBuilder_.getMessage(); } - return com.google.pubsub.v1.PushConfig.OidcToken.getDefaultInstance(); + return com.google.pubsub.v1.PushConfig.NoWrapper.getDefaultInstance(); } } + /** * * *
    -     * If specified, Pub/Sub will generate and attach an OIDC JWT token as an
    -     * `Authorization` header in the HTTP request for every pushed message.
    +     * Optional. When set, the payload to the push endpoint is not wrapped.
          * 
    * - * .google.pubsub.v1.PushConfig.OidcToken oidc_token = 3; + * + * .google.pubsub.v1.PushConfig.NoWrapper no_wrapper = 5 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public Builder setOidcToken(com.google.pubsub.v1.PushConfig.OidcToken value) { - if (oidcTokenBuilder_ == null) { + public Builder setNoWrapper(com.google.pubsub.v1.PushConfig.NoWrapper value) { + if (noWrapperBuilder_ == null) { if (value == null) { throw new NullPointerException(); } - authenticationMethod_ = value; + wrapper_ = value; onChanged(); } else { - oidcTokenBuilder_.setMessage(value); + noWrapperBuilder_.setMessage(value); } - authenticationMethodCase_ = 3; + wrapperCase_ = 5; return this; } + /** * * *
    -     * If specified, Pub/Sub will generate and attach an OIDC JWT token as an
    -     * `Authorization` header in the HTTP request for every pushed message.
    +     * Optional. When set, the payload to the push endpoint is not wrapped.
          * 
    * - * .google.pubsub.v1.PushConfig.OidcToken oidc_token = 3; + * + * .google.pubsub.v1.PushConfig.NoWrapper no_wrapper = 5 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public Builder setOidcToken(com.google.pubsub.v1.PushConfig.OidcToken.Builder builderForValue) { - if (oidcTokenBuilder_ == null) { - authenticationMethod_ = builderForValue.build(); + public Builder setNoWrapper(com.google.pubsub.v1.PushConfig.NoWrapper.Builder builderForValue) { + if (noWrapperBuilder_ == null) { + wrapper_ = builderForValue.build(); onChanged(); } else { - oidcTokenBuilder_.setMessage(builderForValue.build()); + noWrapperBuilder_.setMessage(builderForValue.build()); } - authenticationMethodCase_ = 3; + wrapperCase_ = 5; return this; } + /** * * *
    -     * If specified, Pub/Sub will generate and attach an OIDC JWT token as an
    -     * `Authorization` header in the HTTP request for every pushed message.
    +     * Optional. When set, the payload to the push endpoint is not wrapped.
          * 
    * - * .google.pubsub.v1.PushConfig.OidcToken oidc_token = 3; + * + * .google.pubsub.v1.PushConfig.NoWrapper no_wrapper = 5 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public Builder mergeOidcToken(com.google.pubsub.v1.PushConfig.OidcToken value) { - if (oidcTokenBuilder_ == null) { - if (authenticationMethodCase_ == 3 - && authenticationMethod_ - != com.google.pubsub.v1.PushConfig.OidcToken.getDefaultInstance()) { - authenticationMethod_ = - com.google.pubsub.v1.PushConfig.OidcToken.newBuilder( - (com.google.pubsub.v1.PushConfig.OidcToken) authenticationMethod_) + public Builder mergeNoWrapper(com.google.pubsub.v1.PushConfig.NoWrapper value) { + if (noWrapperBuilder_ == null) { + if (wrapperCase_ == 5 + && wrapper_ != com.google.pubsub.v1.PushConfig.NoWrapper.getDefaultInstance()) { + wrapper_ = + com.google.pubsub.v1.PushConfig.NoWrapper.newBuilder( + (com.google.pubsub.v1.PushConfig.NoWrapper) wrapper_) .mergeFrom(value) .buildPartial(); } else { - authenticationMethod_ = value; + wrapper_ = value; } onChanged(); } else { - if (authenticationMethodCase_ == 3) { - oidcTokenBuilder_.mergeFrom(value); + if (wrapperCase_ == 5) { + noWrapperBuilder_.mergeFrom(value); + } else { + noWrapperBuilder_.setMessage(value); } - oidcTokenBuilder_.setMessage(value); } - authenticationMethodCase_ = 3; + wrapperCase_ = 5; return this; } + /** * * *
    -     * If specified, Pub/Sub will generate and attach an OIDC JWT token as an
    -     * `Authorization` header in the HTTP request for every pushed message.
    +     * Optional. When set, the payload to the push endpoint is not wrapped.
          * 
    * - * .google.pubsub.v1.PushConfig.OidcToken oidc_token = 3; + * + * .google.pubsub.v1.PushConfig.NoWrapper no_wrapper = 5 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public Builder clearOidcToken() { - if (oidcTokenBuilder_ == null) { - if (authenticationMethodCase_ == 3) { - authenticationMethodCase_ = 0; - authenticationMethod_ = null; + public Builder clearNoWrapper() { + if (noWrapperBuilder_ == null) { + if (wrapperCase_ == 5) { + wrapperCase_ = 0; + wrapper_ = null; onChanged(); } } else { - if (authenticationMethodCase_ == 3) { - authenticationMethodCase_ = 0; - authenticationMethod_ = null; + if (wrapperCase_ == 5) { + wrapperCase_ = 0; + wrapper_ = null; } - oidcTokenBuilder_.clear(); + noWrapperBuilder_.clear(); } return this; } + /** * * *
    -     * If specified, Pub/Sub will generate and attach an OIDC JWT token as an
    -     * `Authorization` header in the HTTP request for every pushed message.
    +     * Optional. When set, the payload to the push endpoint is not wrapped.
          * 
    * - * .google.pubsub.v1.PushConfig.OidcToken oidc_token = 3; + * + * .google.pubsub.v1.PushConfig.NoWrapper no_wrapper = 5 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public com.google.pubsub.v1.PushConfig.OidcToken.Builder getOidcTokenBuilder() { - return getOidcTokenFieldBuilder().getBuilder(); + public com.google.pubsub.v1.PushConfig.NoWrapper.Builder getNoWrapperBuilder() { + return internalGetNoWrapperFieldBuilder().getBuilder(); } + /** * * *
    -     * If specified, Pub/Sub will generate and attach an OIDC JWT token as an
    -     * `Authorization` header in the HTTP request for every pushed message.
    +     * Optional. When set, the payload to the push endpoint is not wrapped.
          * 
    * - * .google.pubsub.v1.PushConfig.OidcToken oidc_token = 3; + * + * .google.pubsub.v1.PushConfig.NoWrapper no_wrapper = 5 [(.google.api.field_behavior) = OPTIONAL]; + * */ @java.lang.Override - public com.google.pubsub.v1.PushConfig.OidcTokenOrBuilder getOidcTokenOrBuilder() { - if ((authenticationMethodCase_ == 3) && (oidcTokenBuilder_ != null)) { - return oidcTokenBuilder_.getMessageOrBuilder(); + public com.google.pubsub.v1.PushConfig.NoWrapperOrBuilder getNoWrapperOrBuilder() { + if ((wrapperCase_ == 5) && (noWrapperBuilder_ != null)) { + return noWrapperBuilder_.getMessageOrBuilder(); } else { - if (authenticationMethodCase_ == 3) { - return (com.google.pubsub.v1.PushConfig.OidcToken) authenticationMethod_; + if (wrapperCase_ == 5) { + return (com.google.pubsub.v1.PushConfig.NoWrapper) wrapper_; } - return com.google.pubsub.v1.PushConfig.OidcToken.getDefaultInstance(); + return com.google.pubsub.v1.PushConfig.NoWrapper.getDefaultInstance(); } } + /** * * *
    -     * If specified, Pub/Sub will generate and attach an OIDC JWT token as an
    -     * `Authorization` header in the HTTP request for every pushed message.
    +     * Optional. When set, the payload to the push endpoint is not wrapped.
          * 
    * - * .google.pubsub.v1.PushConfig.OidcToken oidc_token = 3; + * + * .google.pubsub.v1.PushConfig.NoWrapper no_wrapper = 5 [(.google.api.field_behavior) = OPTIONAL]; + * */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.pubsub.v1.PushConfig.OidcToken, - com.google.pubsub.v1.PushConfig.OidcToken.Builder, - com.google.pubsub.v1.PushConfig.OidcTokenOrBuilder> - getOidcTokenFieldBuilder() { - if (oidcTokenBuilder_ == null) { - if (!(authenticationMethodCase_ == 3)) { - authenticationMethod_ = com.google.pubsub.v1.PushConfig.OidcToken.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.PushConfig.NoWrapper, + com.google.pubsub.v1.PushConfig.NoWrapper.Builder, + com.google.pubsub.v1.PushConfig.NoWrapperOrBuilder> + internalGetNoWrapperFieldBuilder() { + if (noWrapperBuilder_ == null) { + if (!(wrapperCase_ == 5)) { + wrapper_ = com.google.pubsub.v1.PushConfig.NoWrapper.getDefaultInstance(); } - oidcTokenBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - com.google.pubsub.v1.PushConfig.OidcToken, - com.google.pubsub.v1.PushConfig.OidcToken.Builder, - com.google.pubsub.v1.PushConfig.OidcTokenOrBuilder>( - (com.google.pubsub.v1.PushConfig.OidcToken) authenticationMethod_, + noWrapperBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.PushConfig.NoWrapper, + com.google.pubsub.v1.PushConfig.NoWrapper.Builder, + com.google.pubsub.v1.PushConfig.NoWrapperOrBuilder>( + (com.google.pubsub.v1.PushConfig.NoWrapper) wrapper_, getParentForChildren(), isClean()); - authenticationMethod_ = null; + wrapper_ = null; } - authenticationMethodCase_ = 3; + wrapperCase_ = 5; onChanged(); - ; - return oidcTokenBuilder_; - } - - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); + return noWrapperBuilder_; } // @@protoc_insertion_point(builder_scope:google.pubsub.v1.PushConfig) @@ -2442,7 +4158,18 @@ public PushConfig parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new PushConfig(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PushConfigOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PushConfigOrBuilder.java index 091a066f9..c789fff48 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PushConfigOrBuilder.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PushConfigOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; +@com.google.protobuf.Generated public interface PushConfigOrBuilder extends // @@protoc_insertion_point(interface_extends:google.pubsub.v1.PushConfig) @@ -27,24 +30,25 @@ public interface PushConfigOrBuilder * * *
    -   * A URL locating the endpoint to which messages should be pushed.
    +   * Optional. A URL locating the endpoint to which messages should be pushed.
        * For example, a Webhook endpoint might use `https://example.com/push`.
        * 
    * - * string push_endpoint = 1; + * string push_endpoint = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @return The pushEndpoint. */ java.lang.String getPushEndpoint(); + /** * * *
    -   * A URL locating the endpoint to which messages should be pushed.
    +   * Optional. A URL locating the endpoint to which messages should be pushed.
        * For example, a Webhook endpoint might use `https://example.com/push`.
        * 
    * - * string push_endpoint = 1; + * string push_endpoint = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @return The bytes for pushEndpoint. */ @@ -54,128 +58,167 @@ public interface PushConfigOrBuilder * * *
    -   * Endpoint configuration attributes that can be used to control different
    -   * aspects of the message delivery.
    +   * Optional. Endpoint configuration attributes that can be used to control
    +   * different aspects of the message delivery.
    +   *
        * The only currently supported attribute is `x-goog-version`, which you can
        * use to change the format of the pushed message. This attribute
        * indicates the version of the data expected by the endpoint. This
        * controls the shape of the pushed message (i.e., its fields and metadata).
    +   *
        * If not present during the `CreateSubscription` call, it will default to
        * the version of the Pub/Sub API used to make such call. If not present in a
        * `ModifyPushConfig` call, its value will not be changed. `GetSubscription`
        * calls will always return a valid version, even if the subscription was
        * created without this attribute.
    +   *
        * The only supported values for the `x-goog-version` attribute are:
    +   *
        * * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API.
        * * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API.
    +   *
        * For example:
    -   * <pre><code>attributes { "x-goog-version": "v1" } </code></pre>
    +   * `attributes { "x-goog-version": "v1" }`
        * 
    * - * map<string, string> attributes = 2; + * map<string, string> attributes = 2 [(.google.api.field_behavior) = OPTIONAL]; + * */ int getAttributesCount(); + /** * * *
    -   * Endpoint configuration attributes that can be used to control different
    -   * aspects of the message delivery.
    +   * Optional. Endpoint configuration attributes that can be used to control
    +   * different aspects of the message delivery.
    +   *
        * The only currently supported attribute is `x-goog-version`, which you can
        * use to change the format of the pushed message. This attribute
        * indicates the version of the data expected by the endpoint. This
        * controls the shape of the pushed message (i.e., its fields and metadata).
    +   *
        * If not present during the `CreateSubscription` call, it will default to
        * the version of the Pub/Sub API used to make such call. If not present in a
        * `ModifyPushConfig` call, its value will not be changed. `GetSubscription`
        * calls will always return a valid version, even if the subscription was
        * created without this attribute.
    +   *
        * The only supported values for the `x-goog-version` attribute are:
    +   *
        * * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API.
        * * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API.
    +   *
        * For example:
    -   * <pre><code>attributes { "x-goog-version": "v1" } </code></pre>
    +   * `attributes { "x-goog-version": "v1" }`
        * 
    * - * map<string, string> attributes = 2; + * map<string, string> attributes = 2 [(.google.api.field_behavior) = OPTIONAL]; + * */ boolean containsAttributes(java.lang.String key); + /** Use {@link #getAttributesMap()} instead. */ @java.lang.Deprecated java.util.Map getAttributes(); + /** * * *
    -   * Endpoint configuration attributes that can be used to control different
    -   * aspects of the message delivery.
    +   * Optional. Endpoint configuration attributes that can be used to control
    +   * different aspects of the message delivery.
    +   *
        * The only currently supported attribute is `x-goog-version`, which you can
        * use to change the format of the pushed message. This attribute
        * indicates the version of the data expected by the endpoint. This
        * controls the shape of the pushed message (i.e., its fields and metadata).
    +   *
        * If not present during the `CreateSubscription` call, it will default to
        * the version of the Pub/Sub API used to make such call. If not present in a
        * `ModifyPushConfig` call, its value will not be changed. `GetSubscription`
        * calls will always return a valid version, even if the subscription was
        * created without this attribute.
    +   *
        * The only supported values for the `x-goog-version` attribute are:
    +   *
        * * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API.
        * * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API.
    +   *
        * For example:
    -   * <pre><code>attributes { "x-goog-version": "v1" } </code></pre>
    +   * `attributes { "x-goog-version": "v1" }`
        * 
    * - * map<string, string> attributes = 2; + * map<string, string> attributes = 2 [(.google.api.field_behavior) = OPTIONAL]; + * */ java.util.Map getAttributesMap(); + /** * * *
    -   * Endpoint configuration attributes that can be used to control different
    -   * aspects of the message delivery.
    +   * Optional. Endpoint configuration attributes that can be used to control
    +   * different aspects of the message delivery.
    +   *
        * The only currently supported attribute is `x-goog-version`, which you can
        * use to change the format of the pushed message. This attribute
        * indicates the version of the data expected by the endpoint. This
        * controls the shape of the pushed message (i.e., its fields and metadata).
    +   *
        * If not present during the `CreateSubscription` call, it will default to
        * the version of the Pub/Sub API used to make such call. If not present in a
        * `ModifyPushConfig` call, its value will not be changed. `GetSubscription`
        * calls will always return a valid version, even if the subscription was
        * created without this attribute.
    +   *
        * The only supported values for the `x-goog-version` attribute are:
    +   *
        * * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API.
        * * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API.
    +   *
        * For example:
    -   * <pre><code>attributes { "x-goog-version": "v1" } </code></pre>
    +   * `attributes { "x-goog-version": "v1" }`
        * 
    * - * map<string, string> attributes = 2; + * map<string, string> attributes = 2 [(.google.api.field_behavior) = OPTIONAL]; + * */ - java.lang.String getAttributesOrDefault(java.lang.String key, java.lang.String defaultValue); + /* nullable */ + java.lang.String getAttributesOrDefault( + java.lang.String key, + /* nullable */ + java.lang.String defaultValue); + /** * * *
    -   * Endpoint configuration attributes that can be used to control different
    -   * aspects of the message delivery.
    +   * Optional. Endpoint configuration attributes that can be used to control
    +   * different aspects of the message delivery.
    +   *
        * The only currently supported attribute is `x-goog-version`, which you can
        * use to change the format of the pushed message. This attribute
        * indicates the version of the data expected by the endpoint. This
        * controls the shape of the pushed message (i.e., its fields and metadata).
    +   *
        * If not present during the `CreateSubscription` call, it will default to
        * the version of the Pub/Sub API used to make such call. If not present in a
        * `ModifyPushConfig` call, its value will not be changed. `GetSubscription`
        * calls will always return a valid version, even if the subscription was
        * created without this attribute.
    +   *
        * The only supported values for the `x-goog-version` attribute are:
    +   *
        * * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API.
        * * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API.
    +   *
        * For example:
    -   * <pre><code>attributes { "x-goog-version": "v1" } </code></pre>
    +   * `attributes { "x-goog-version": "v1" }`
        * 
    * - * map<string, string> attributes = 2; + * map<string, string> attributes = 2 [(.google.api.field_behavior) = OPTIONAL]; + * */ java.lang.String getAttributesOrThrow(java.lang.String key); @@ -183,39 +226,144 @@ public interface PushConfigOrBuilder * * *
    -   * If specified, Pub/Sub will generate and attach an OIDC JWT token as an
    -   * `Authorization` header in the HTTP request for every pushed message.
    +   * Optional. If specified, Pub/Sub will generate and attach an OIDC JWT
    +   * token as an `Authorization` header in the HTTP request for every pushed
    +   * message.
        * 
    * - * .google.pubsub.v1.PushConfig.OidcToken oidc_token = 3; + * + * .google.pubsub.v1.PushConfig.OidcToken oidc_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return Whether the oidcToken field is set. */ boolean hasOidcToken(); + /** * * *
    -   * If specified, Pub/Sub will generate and attach an OIDC JWT token as an
    -   * `Authorization` header in the HTTP request for every pushed message.
    +   * Optional. If specified, Pub/Sub will generate and attach an OIDC JWT
    +   * token as an `Authorization` header in the HTTP request for every pushed
    +   * message.
        * 
    * - * .google.pubsub.v1.PushConfig.OidcToken oidc_token = 3; + * + * .google.pubsub.v1.PushConfig.OidcToken oidc_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return The oidcToken. */ com.google.pubsub.v1.PushConfig.OidcToken getOidcToken(); + /** * * *
    -   * If specified, Pub/Sub will generate and attach an OIDC JWT token as an
    -   * `Authorization` header in the HTTP request for every pushed message.
    +   * Optional. If specified, Pub/Sub will generate and attach an OIDC JWT
    +   * token as an `Authorization` header in the HTTP request for every pushed
    +   * message.
        * 
    * - * .google.pubsub.v1.PushConfig.OidcToken oidc_token = 3; + * + * .google.pubsub.v1.PushConfig.OidcToken oidc_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * */ com.google.pubsub.v1.PushConfig.OidcTokenOrBuilder getOidcTokenOrBuilder(); - public com.google.pubsub.v1.PushConfig.AuthenticationMethodCase getAuthenticationMethodCase(); + /** + * + * + *
    +   * Optional. When set, the payload to the push endpoint is in the form of
    +   * the JSON representation of a PubsubMessage
    +   * (https://cloud.google.com/pubsub/docs/reference/rpc/google.pubsub.v1#pubsubmessage).
    +   * 
    + * + * + * .google.pubsub.v1.PushConfig.PubsubWrapper pubsub_wrapper = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the pubsubWrapper field is set. + */ + boolean hasPubsubWrapper(); + + /** + * + * + *
    +   * Optional. When set, the payload to the push endpoint is in the form of
    +   * the JSON representation of a PubsubMessage
    +   * (https://cloud.google.com/pubsub/docs/reference/rpc/google.pubsub.v1#pubsubmessage).
    +   * 
    + * + * + * .google.pubsub.v1.PushConfig.PubsubWrapper pubsub_wrapper = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The pubsubWrapper. + */ + com.google.pubsub.v1.PushConfig.PubsubWrapper getPubsubWrapper(); + + /** + * + * + *
    +   * Optional. When set, the payload to the push endpoint is in the form of
    +   * the JSON representation of a PubsubMessage
    +   * (https://cloud.google.com/pubsub/docs/reference/rpc/google.pubsub.v1#pubsubmessage).
    +   * 
    + * + * + * .google.pubsub.v1.PushConfig.PubsubWrapper pubsub_wrapper = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.pubsub.v1.PushConfig.PubsubWrapperOrBuilder getPubsubWrapperOrBuilder(); + + /** + * + * + *
    +   * Optional. When set, the payload to the push endpoint is not wrapped.
    +   * 
    + * + * + * .google.pubsub.v1.PushConfig.NoWrapper no_wrapper = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the noWrapper field is set. + */ + boolean hasNoWrapper(); + + /** + * + * + *
    +   * Optional. When set, the payload to the push endpoint is not wrapped.
    +   * 
    + * + * + * .google.pubsub.v1.PushConfig.NoWrapper no_wrapper = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The noWrapper. + */ + com.google.pubsub.v1.PushConfig.NoWrapper getNoWrapper(); + + /** + * + * + *
    +   * Optional. When set, the payload to the push endpoint is not wrapped.
    +   * 
    + * + * + * .google.pubsub.v1.PushConfig.NoWrapper no_wrapper = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.pubsub.v1.PushConfig.NoWrapperOrBuilder getNoWrapperOrBuilder(); + + com.google.pubsub.v1.PushConfig.AuthenticationMethodCase getAuthenticationMethodCase(); + + com.google.pubsub.v1.PushConfig.WrapperCase getWrapperCase(); } diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ReceivedMessage.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ReceivedMessage.java index 38e472e7a..116667ae5 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ReceivedMessage.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ReceivedMessage.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; @@ -27,13 +29,25 @@ * * Protobuf type {@code google.pubsub.v1.ReceivedMessage} */ -public final class ReceivedMessage extends com.google.protobuf.GeneratedMessageV3 +@com.google.protobuf.Generated +public final class ReceivedMessage extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:google.pubsub.v1.ReceivedMessage) ReceivedMessageOrBuilder { private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "ReceivedMessage"); + } + // Use ReceivedMessage.newBuilder() to construct. - private ReceivedMessage(com.google.protobuf.GeneratedMessageV3.Builder builder) { + private ReceivedMessage(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); } @@ -41,88 +55,13 @@ private ReceivedMessage() { ackId_ = ""; } - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new ReceivedMessage(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - private ReceivedMessage( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - java.lang.String s = input.readStringRequireUtf8(); - - ackId_ = s; - break; - } - case 18: - { - com.google.pubsub.v1.PubsubMessage.Builder subBuilder = null; - if (message_ != null) { - subBuilder = message_.toBuilder(); - } - message_ = - input.readMessage(com.google.pubsub.v1.PubsubMessage.parser(), extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(message_); - message_ = subBuilder.buildPartial(); - } - - break; - } - case 24: - { - deliveryAttempt_ = input.readInt32(); - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_ReceivedMessage_descriptor; } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_ReceivedMessage_fieldAccessorTable @@ -131,16 +70,20 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { com.google.pubsub.v1.ReceivedMessage.Builder.class); } + private int bitField0_; public static final int ACK_ID_FIELD_NUMBER = 1; - private volatile java.lang.Object ackId_; + + @SuppressWarnings("serial") + private volatile java.lang.Object ackId_ = ""; + /** * * *
    -   * This ID can be used to acknowledge the received message.
    +   * Optional. This ID can be used to acknowledge the received message.
        * 
    * - * string ack_id = 1; + * string ack_id = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @return The ackId. */ @@ -156,14 +99,15 @@ public java.lang.String getAckId() { return s; } } + /** * * *
    -   * This ID can be used to acknowledge the received message.
    +   * Optional. This ID can be used to acknowledge the received message.
        * 
    * - * string ack_id = 1; + * string ack_id = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @return The bytes for ackId. */ @@ -182,29 +126,33 @@ public com.google.protobuf.ByteString getAckIdBytes() { public static final int MESSAGE_FIELD_NUMBER = 2; private com.google.pubsub.v1.PubsubMessage message_; + /** * * *
    -   * The message.
    +   * Optional. The message.
        * 
    * - * .google.pubsub.v1.PubsubMessage message = 2; + * .google.pubsub.v1.PubsubMessage message = 2 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return Whether the message field is set. */ @java.lang.Override public boolean hasMessage() { - return message_ != null; + return ((bitField0_ & 0x00000001) != 0); } + /** * * *
    -   * The message.
    +   * Optional. The message.
        * 
    * - * .google.pubsub.v1.PubsubMessage message = 2; + * .google.pubsub.v1.PubsubMessage message = 2 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return The message. */ @@ -212,41 +160,48 @@ public boolean hasMessage() { public com.google.pubsub.v1.PubsubMessage getMessage() { return message_ == null ? com.google.pubsub.v1.PubsubMessage.getDefaultInstance() : message_; } + /** * * *
    -   * The message.
    +   * Optional. The message.
        * 
    * - * .google.pubsub.v1.PubsubMessage message = 2; + * .google.pubsub.v1.PubsubMessage message = 2 [(.google.api.field_behavior) = OPTIONAL]; + * */ @java.lang.Override public com.google.pubsub.v1.PubsubMessageOrBuilder getMessageOrBuilder() { - return getMessage(); + return message_ == null ? com.google.pubsub.v1.PubsubMessage.getDefaultInstance() : message_; } public static final int DELIVERY_ATTEMPT_FIELD_NUMBER = 3; - private int deliveryAttempt_; + private int deliveryAttempt_ = 0; + /** * * *
    -   * The approximate number of times that Cloud Pub/Sub has attempted to deliver
    -   * the associated message to a subscriber.
    +   * Optional. The approximate number of times that Pub/Sub has attempted to
    +   * deliver the associated message to a subscriber.
    +   *
        * More precisely, this is 1 + (number of NACKs) +
        * (number of ack_deadline exceeds) for this message.
    +   *
        * A NACK is any call to ModifyAckDeadline with a 0 deadline. An ack_deadline
        * exceeds event is whenever a message is not acknowledged within
        * ack_deadline. Note that ack_deadline is initially
        * Subscription.ackDeadlineSeconds, but may get extended automatically by
        * the client library.
    +   *
        * Upon the first delivery of a given message, `delivery_attempt` will have a
        * value of 1. The value is calculated at best effort and is approximate.
    +   *
        * If a DeadLetterPolicy is not set on the subscription, this will be 0.
        * 
    * - * int32 delivery_attempt = 3; + * int32 delivery_attempt = 3 [(.google.api.field_behavior) = OPTIONAL]; * * @return The deliveryAttempt. */ @@ -269,16 +224,16 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!getAckIdBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, ackId_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(ackId_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, ackId_); } - if (message_ != null) { + if (((bitField0_ & 0x00000001) != 0)) { output.writeMessage(2, getMessage()); } if (deliveryAttempt_ != 0) { output.writeInt32(3, deliveryAttempt_); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -287,16 +242,16 @@ public int getSerializedSize() { if (size != -1) return size; size = 0; - if (!getAckIdBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, ackId_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(ackId_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, ackId_); } - if (message_ != null) { + if (((bitField0_ & 0x00000001) != 0)) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getMessage()); } if (deliveryAttempt_ != 0) { size += com.google.protobuf.CodedOutputStream.computeInt32Size(3, deliveryAttempt_); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -317,7 +272,7 @@ public boolean equals(final java.lang.Object obj) { if (!getMessage().equals(other.getMessage())) return false; } if (getDeliveryAttempt() != other.getDeliveryAttempt()) return false; - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -336,7 +291,7 @@ public int hashCode() { } hash = (37 * hash) + DELIVERY_ATTEMPT_FIELD_NUMBER; hash = (53 * hash) + getDeliveryAttempt(); - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -377,38 +332,38 @@ public static com.google.pubsub.v1.ReceivedMessage parseFrom( public static com.google.pubsub.v1.ReceivedMessage parseFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.ReceivedMessage parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.ReceivedMessage parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); } public static com.google.pubsub.v1.ReceivedMessage parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.ReceivedMessage parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.ReceivedMessage parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } @@ -431,10 +386,11 @@ public Builder toBuilder() { } @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** * * @@ -444,7 +400,7 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build * * Protobuf type {@code google.pubsub.v1.ReceivedMessage} */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements // @@protoc_insertion_point(builder_implements:google.pubsub.v1.ReceivedMessage) com.google.pubsub.v1.ReceivedMessageOrBuilder { @@ -454,7 +410,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_ReceivedMessage_fieldAccessorTable @@ -468,28 +424,28 @@ private Builder() { maybeForceBuilderInitialization(); } - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + internalGetMessageFieldBuilder(); + } } @java.lang.Override public Builder clear() { super.clear(); + bitField0_ = 0; ackId_ = ""; - - if (messageBuilder_ == null) { - message_ = null; - } else { - message_ = null; + message_ = null; + if (messageBuilder_ != null) { + messageBuilder_.dispose(); messageBuilder_ = null; } deliveryAttempt_ = 0; - return this; } @@ -516,48 +472,27 @@ public com.google.pubsub.v1.ReceivedMessage build() { @java.lang.Override public com.google.pubsub.v1.ReceivedMessage buildPartial() { com.google.pubsub.v1.ReceivedMessage result = new com.google.pubsub.v1.ReceivedMessage(this); - result.ackId_ = ackId_; - if (messageBuilder_ == null) { - result.message_ = message_; - } else { - result.message_ = messageBuilder_.build(); + if (bitField0_ != 0) { + buildPartial0(result); } - result.deliveryAttempt_ = deliveryAttempt_; onBuilt(); return result; } - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); + private void buildPartial0(com.google.pubsub.v1.ReceivedMessage result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.ackId_ = ackId_; + } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000002) != 0)) { + result.message_ = messageBuilder_ == null ? message_ : messageBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.deliveryAttempt_ = deliveryAttempt_; + } + result.bitField0_ |= to_bitField0_; } @java.lang.Override @@ -574,6 +509,7 @@ public Builder mergeFrom(com.google.pubsub.v1.ReceivedMessage other) { if (other == com.google.pubsub.v1.ReceivedMessage.getDefaultInstance()) return this; if (!other.getAckId().isEmpty()) { ackId_ = other.ackId_; + bitField0_ |= 0x00000001; onChanged(); } if (other.hasMessage()) { @@ -582,7 +518,7 @@ public Builder mergeFrom(com.google.pubsub.v1.ReceivedMessage other) { if (other.getDeliveryAttempt() != 0) { setDeliveryAttempt(other.getDeliveryAttempt()); } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -597,29 +533,64 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.pubsub.v1.ReceivedMessage parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + ackId_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + input.readMessage(internalGetMessageFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 24: + { + deliveryAttempt_ = input.readInt32(); + bitField0_ |= 0x00000004; + break; + } // case 24 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.google.pubsub.v1.ReceivedMessage) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } + private int bitField0_; + private java.lang.Object ackId_ = ""; + /** * * *
    -     * This ID can be used to acknowledge the received message.
    +     * Optional. This ID can be used to acknowledge the received message.
          * 
    * - * string ack_id = 1; + * string ack_id = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @return The ackId. */ @@ -634,14 +605,15 @@ public java.lang.String getAckId() { return (java.lang.String) ref; } } + /** * * *
    -     * This ID can be used to acknowledge the received message.
    +     * Optional. This ID can be used to acknowledge the received message.
          * 
    * - * string ack_id = 1; + * string ack_id = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @return The bytes for ackId. */ @@ -656,14 +628,15 @@ public com.google.protobuf.ByteString getAckIdBytes() { return (com.google.protobuf.ByteString) ref; } } + /** * * *
    -     * This ID can be used to acknowledge the received message.
    +     * Optional. This ID can be used to acknowledge the received message.
          * 
    * - * string ack_id = 1; + * string ack_id = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @param value The ackId to set. * @return This builder for chaining. @@ -672,36 +645,38 @@ public Builder setAckId(java.lang.String value) { if (value == null) { throw new NullPointerException(); } - ackId_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } + /** * * *
    -     * This ID can be used to acknowledge the received message.
    +     * Optional. This ID can be used to acknowledge the received message.
          * 
    * - * string ack_id = 1; + * string ack_id = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @return This builder for chaining. */ public Builder clearAckId() { - ackId_ = getDefaultInstance().getAckId(); + bitField0_ = (bitField0_ & ~0x00000001); onChanged(); return this; } + /** * * *
    -     * This ID can be used to acknowledge the received message.
    +     * Optional. This ID can be used to acknowledge the received message.
          * 
    * - * string ack_id = 1; + * string ack_id = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @param value The bytes for ackId to set. * @return This builder for chaining. @@ -711,40 +686,44 @@ public Builder setAckIdBytes(com.google.protobuf.ByteString value) { throw new NullPointerException(); } checkByteStringIsUtf8(value); - ackId_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } private com.google.pubsub.v1.PubsubMessage message_; - private com.google.protobuf.SingleFieldBuilderV3< + private com.google.protobuf.SingleFieldBuilder< com.google.pubsub.v1.PubsubMessage, com.google.pubsub.v1.PubsubMessage.Builder, com.google.pubsub.v1.PubsubMessageOrBuilder> messageBuilder_; + /** * * *
    -     * The message.
    +     * Optional. The message.
          * 
    * - * .google.pubsub.v1.PubsubMessage message = 2; + * .google.pubsub.v1.PubsubMessage message = 2 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return Whether the message field is set. */ public boolean hasMessage() { - return messageBuilder_ != null || message_ != null; + return ((bitField0_ & 0x00000002) != 0); } + /** * * *
    -     * The message.
    +     * Optional. The message.
          * 
    * - * .google.pubsub.v1.PubsubMessage message = 2; + * .google.pubsub.v1.PubsubMessage message = 2 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return The message. */ @@ -757,14 +736,16 @@ public com.google.pubsub.v1.PubsubMessage getMessage() { return messageBuilder_.getMessage(); } } + /** * * *
    -     * The message.
    +     * Optional. The message.
          * 
    * - * .google.pubsub.v1.PubsubMessage message = 2; + * .google.pubsub.v1.PubsubMessage message = 2 [(.google.api.field_behavior) = OPTIONAL]; + * */ public Builder setMessage(com.google.pubsub.v1.PubsubMessage value) { if (messageBuilder_ == null) { @@ -772,100 +753,110 @@ public Builder setMessage(com.google.pubsub.v1.PubsubMessage value) { throw new NullPointerException(); } message_ = value; - onChanged(); } else { messageBuilder_.setMessage(value); } - + bitField0_ |= 0x00000002; + onChanged(); return this; } + /** * * *
    -     * The message.
    +     * Optional. The message.
          * 
    * - * .google.pubsub.v1.PubsubMessage message = 2; + * .google.pubsub.v1.PubsubMessage message = 2 [(.google.api.field_behavior) = OPTIONAL]; + * */ public Builder setMessage(com.google.pubsub.v1.PubsubMessage.Builder builderForValue) { if (messageBuilder_ == null) { message_ = builderForValue.build(); - onChanged(); } else { messageBuilder_.setMessage(builderForValue.build()); } - + bitField0_ |= 0x00000002; + onChanged(); return this; } + /** * * *
    -     * The message.
    +     * Optional. The message.
          * 
    * - * .google.pubsub.v1.PubsubMessage message = 2; + * .google.pubsub.v1.PubsubMessage message = 2 [(.google.api.field_behavior) = OPTIONAL]; + * */ public Builder mergeMessage(com.google.pubsub.v1.PubsubMessage value) { if (messageBuilder_ == null) { - if (message_ != null) { - message_ = - com.google.pubsub.v1.PubsubMessage.newBuilder(message_) - .mergeFrom(value) - .buildPartial(); + if (((bitField0_ & 0x00000002) != 0) + && message_ != null + && message_ != com.google.pubsub.v1.PubsubMessage.getDefaultInstance()) { + getMessageBuilder().mergeFrom(value); } else { message_ = value; } - onChanged(); } else { messageBuilder_.mergeFrom(value); } - + if (message_ != null) { + bitField0_ |= 0x00000002; + onChanged(); + } return this; } + /** * * *
    -     * The message.
    +     * Optional. The message.
          * 
    * - * .google.pubsub.v1.PubsubMessage message = 2; + * .google.pubsub.v1.PubsubMessage message = 2 [(.google.api.field_behavior) = OPTIONAL]; + * */ public Builder clearMessage() { - if (messageBuilder_ == null) { - message_ = null; - onChanged(); - } else { - message_ = null; + bitField0_ = (bitField0_ & ~0x00000002); + message_ = null; + if (messageBuilder_ != null) { + messageBuilder_.dispose(); messageBuilder_ = null; } - + onChanged(); return this; } + /** * * *
    -     * The message.
    +     * Optional. The message.
          * 
    * - * .google.pubsub.v1.PubsubMessage message = 2; + * .google.pubsub.v1.PubsubMessage message = 2 [(.google.api.field_behavior) = OPTIONAL]; + * */ public com.google.pubsub.v1.PubsubMessage.Builder getMessageBuilder() { - + bitField0_ |= 0x00000002; onChanged(); - return getMessageFieldBuilder().getBuilder(); + return internalGetMessageFieldBuilder().getBuilder(); } + /** * * *
    -     * The message.
    +     * Optional. The message.
          * 
    * - * .google.pubsub.v1.PubsubMessage message = 2; + * .google.pubsub.v1.PubsubMessage message = 2 [(.google.api.field_behavior) = OPTIONAL]; + * */ public com.google.pubsub.v1.PubsubMessageOrBuilder getMessageOrBuilder() { if (messageBuilder_ != null) { @@ -876,23 +867,25 @@ public com.google.pubsub.v1.PubsubMessageOrBuilder getMessageOrBuilder() { : message_; } } + /** * * *
    -     * The message.
    +     * Optional. The message.
          * 
    * - * .google.pubsub.v1.PubsubMessage message = 2; + * .google.pubsub.v1.PubsubMessage message = 2 [(.google.api.field_behavior) = OPTIONAL]; + * */ - private com.google.protobuf.SingleFieldBuilderV3< + private com.google.protobuf.SingleFieldBuilder< com.google.pubsub.v1.PubsubMessage, com.google.pubsub.v1.PubsubMessage.Builder, com.google.pubsub.v1.PubsubMessageOrBuilder> - getMessageFieldBuilder() { + internalGetMessageFieldBuilder() { if (messageBuilder_ == null) { messageBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< + new com.google.protobuf.SingleFieldBuilder< com.google.pubsub.v1.PubsubMessage, com.google.pubsub.v1.PubsubMessage.Builder, com.google.pubsub.v1.PubsubMessageOrBuilder>( @@ -903,25 +896,30 @@ public com.google.pubsub.v1.PubsubMessageOrBuilder getMessageOrBuilder() { } private int deliveryAttempt_; + /** * * *
    -     * The approximate number of times that Cloud Pub/Sub has attempted to deliver
    -     * the associated message to a subscriber.
    +     * Optional. The approximate number of times that Pub/Sub has attempted to
    +     * deliver the associated message to a subscriber.
    +     *
          * More precisely, this is 1 + (number of NACKs) +
          * (number of ack_deadline exceeds) for this message.
    +     *
          * A NACK is any call to ModifyAckDeadline with a 0 deadline. An ack_deadline
          * exceeds event is whenever a message is not acknowledged within
          * ack_deadline. Note that ack_deadline is initially
          * Subscription.ackDeadlineSeconds, but may get extended automatically by
          * the client library.
    +     *
          * Upon the first delivery of a given message, `delivery_attempt` will have a
          * value of 1. The value is calculated at best effort and is approximate.
    +     *
          * If a DeadLetterPolicy is not set on the subscription, this will be 0.
          * 
    * - * int32 delivery_attempt = 3; + * int32 delivery_attempt = 3 [(.google.api.field_behavior) = OPTIONAL]; * * @return The deliveryAttempt. */ @@ -929,25 +927,30 @@ public com.google.pubsub.v1.PubsubMessageOrBuilder getMessageOrBuilder() { public int getDeliveryAttempt() { return deliveryAttempt_; } + /** * * *
    -     * The approximate number of times that Cloud Pub/Sub has attempted to deliver
    -     * the associated message to a subscriber.
    +     * Optional. The approximate number of times that Pub/Sub has attempted to
    +     * deliver the associated message to a subscriber.
    +     *
          * More precisely, this is 1 + (number of NACKs) +
          * (number of ack_deadline exceeds) for this message.
    +     *
          * A NACK is any call to ModifyAckDeadline with a 0 deadline. An ack_deadline
          * exceeds event is whenever a message is not acknowledged within
          * ack_deadline. Note that ack_deadline is initially
          * Subscription.ackDeadlineSeconds, but may get extended automatically by
          * the client library.
    +     *
          * Upon the first delivery of a given message, `delivery_attempt` will have a
          * value of 1. The value is calculated at best effort and is approximate.
    +     *
          * If a DeadLetterPolicy is not set on the subscription, this will be 0.
          * 
    * - * int32 delivery_attempt = 3; + * int32 delivery_attempt = 3 [(.google.api.field_behavior) = OPTIONAL]; * * @param value The deliveryAttempt to set. * @return This builder for chaining. @@ -955,49 +958,44 @@ public int getDeliveryAttempt() { public Builder setDeliveryAttempt(int value) { deliveryAttempt_ = value; + bitField0_ |= 0x00000004; onChanged(); return this; } + /** * * *
    -     * The approximate number of times that Cloud Pub/Sub has attempted to deliver
    -     * the associated message to a subscriber.
    +     * Optional. The approximate number of times that Pub/Sub has attempted to
    +     * deliver the associated message to a subscriber.
    +     *
          * More precisely, this is 1 + (number of NACKs) +
          * (number of ack_deadline exceeds) for this message.
    +     *
          * A NACK is any call to ModifyAckDeadline with a 0 deadline. An ack_deadline
          * exceeds event is whenever a message is not acknowledged within
          * ack_deadline. Note that ack_deadline is initially
          * Subscription.ackDeadlineSeconds, but may get extended automatically by
          * the client library.
    +     *
          * Upon the first delivery of a given message, `delivery_attempt` will have a
          * value of 1. The value is calculated at best effort and is approximate.
    +     *
          * If a DeadLetterPolicy is not set on the subscription, this will be 0.
          * 
    * - * int32 delivery_attempt = 3; + * int32 delivery_attempt = 3 [(.google.api.field_behavior) = OPTIONAL]; * * @return This builder for chaining. */ public Builder clearDeliveryAttempt() { - + bitField0_ = (bitField0_ & ~0x00000004); deliveryAttempt_ = 0; onChanged(); return this; } - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - // @@protoc_insertion_point(builder_scope:google.pubsub.v1.ReceivedMessage) } @@ -1019,7 +1017,18 @@ public ReceivedMessage parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new ReceivedMessage(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ReceivedMessageOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ReceivedMessageOrBuilder.java index 805690b39..c5acfe765 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ReceivedMessageOrBuilder.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ReceivedMessageOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; +@com.google.protobuf.Generated public interface ReceivedMessageOrBuilder extends // @@protoc_insertion_point(interface_extends:google.pubsub.v1.ReceivedMessage) @@ -27,22 +30,23 @@ public interface ReceivedMessageOrBuilder * * *
    -   * This ID can be used to acknowledge the received message.
    +   * Optional. This ID can be used to acknowledge the received message.
        * 
    * - * string ack_id = 1; + * string ack_id = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @return The ackId. */ java.lang.String getAckId(); + /** * * *
    -   * This ID can be used to acknowledge the received message.
    +   * Optional. This ID can be used to acknowledge the received message.
        * 
    * - * string ack_id = 1; + * string ack_id = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @return The bytes for ackId. */ @@ -52,34 +56,39 @@ public interface ReceivedMessageOrBuilder * * *
    -   * The message.
    +   * Optional. The message.
        * 
    * - * .google.pubsub.v1.PubsubMessage message = 2; + * .google.pubsub.v1.PubsubMessage message = 2 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return Whether the message field is set. */ boolean hasMessage(); + /** * * *
    -   * The message.
    +   * Optional. The message.
        * 
    * - * .google.pubsub.v1.PubsubMessage message = 2; + * .google.pubsub.v1.PubsubMessage message = 2 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return The message. */ com.google.pubsub.v1.PubsubMessage getMessage(); + /** * * *
    -   * The message.
    +   * Optional. The message.
        * 
    * - * .google.pubsub.v1.PubsubMessage message = 2; + * .google.pubsub.v1.PubsubMessage message = 2 [(.google.api.field_behavior) = OPTIONAL]; + * */ com.google.pubsub.v1.PubsubMessageOrBuilder getMessageOrBuilder(); @@ -87,21 +96,25 @@ public interface ReceivedMessageOrBuilder * * *
    -   * The approximate number of times that Cloud Pub/Sub has attempted to deliver
    -   * the associated message to a subscriber.
    +   * Optional. The approximate number of times that Pub/Sub has attempted to
    +   * deliver the associated message to a subscriber.
    +   *
        * More precisely, this is 1 + (number of NACKs) +
        * (number of ack_deadline exceeds) for this message.
    +   *
        * A NACK is any call to ModifyAckDeadline with a 0 deadline. An ack_deadline
        * exceeds event is whenever a message is not acknowledged within
        * ack_deadline. Note that ack_deadline is initially
        * Subscription.ackDeadlineSeconds, but may get extended automatically by
        * the client library.
    +   *
        * Upon the first delivery of a given message, `delivery_attempt` will have a
        * value of 1. The value is calculated at best effort and is approximate.
    +   *
        * If a DeadLetterPolicy is not set on the subscription, this will be 0.
        * 
    * - * int32 delivery_attempt = 3; + * int32 delivery_attempt = 3 [(.google.api.field_behavior) = OPTIONAL]; * * @return The deliveryAttempt. */ diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/RetryPolicy.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/RetryPolicy.java index 4b6a1934e..bc68bddfc 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/RetryPolicy.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/RetryPolicy.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; @@ -22,11 +24,14 @@ * * *
    - * A policy that specifies how Cloud Pub/Sub retries message delivery.
    + * A policy that specifies how Pub/Sub retries message delivery.
    + *
      * Retry delay will be exponential based on provided minimum and maximum
      * backoffs. https://en.wikipedia.org/wiki/Exponential_backoff.
    - * RetryPolicy will be triggered on NACKs or acknowledgement deadline exceeded
    + *
    + * RetryPolicy will be triggered on NACKs or acknowledgment deadline exceeded
      * events for a given message.
    + *
      * Retry Policy is implemented on a best effort basis. At times, the delay
      * between consecutive deliveries may not match the configuration. That is,
      * delay can be more or less than configured backoff.
    @@ -34,102 +39,36 @@
      *
      * Protobuf type {@code google.pubsub.v1.RetryPolicy}
      */
    -public final class RetryPolicy extends com.google.protobuf.GeneratedMessageV3
    +@com.google.protobuf.Generated
    +public final class RetryPolicy extends com.google.protobuf.GeneratedMessage
         implements
         // @@protoc_insertion_point(message_implements:google.pubsub.v1.RetryPolicy)
         RetryPolicyOrBuilder {
       private static final long serialVersionUID = 0L;
    -  // Use RetryPolicy.newBuilder() to construct.
    -  private RetryPolicy(com.google.protobuf.GeneratedMessageV3.Builder builder) {
    -    super(builder);
    -  }
    -
    -  private RetryPolicy() {}
     
    -  @java.lang.Override
    -  @SuppressWarnings({"unused"})
    -  protected java.lang.Object newInstance(UnusedPrivateParameter unused) {
    -    return new RetryPolicy();
    +  static {
    +    com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion(
    +        com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC,
    +        /* major= */ 4,
    +        /* minor= */ 33,
    +        /* patch= */ 2,
    +        /* suffix= */ "",
    +        "RetryPolicy");
       }
     
    -  @java.lang.Override
    -  public final com.google.protobuf.UnknownFieldSet getUnknownFields() {
    -    return this.unknownFields;
    +  // Use RetryPolicy.newBuilder() to construct.
    +  private RetryPolicy(com.google.protobuf.GeneratedMessage.Builder builder) {
    +    super(builder);
       }
     
    -  private RetryPolicy(
    -      com.google.protobuf.CodedInputStream input,
    -      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
    -      throws com.google.protobuf.InvalidProtocolBufferException {
    -    this();
    -    if (extensionRegistry == null) {
    -      throw new java.lang.NullPointerException();
    -    }
    -    com.google.protobuf.UnknownFieldSet.Builder unknownFields =
    -        com.google.protobuf.UnknownFieldSet.newBuilder();
    -    try {
    -      boolean done = false;
    -      while (!done) {
    -        int tag = input.readTag();
    -        switch (tag) {
    -          case 0:
    -            done = true;
    -            break;
    -          case 10:
    -            {
    -              com.google.protobuf.Duration.Builder subBuilder = null;
    -              if (minimumBackoff_ != null) {
    -                subBuilder = minimumBackoff_.toBuilder();
    -              }
    -              minimumBackoff_ =
    -                  input.readMessage(com.google.protobuf.Duration.parser(), extensionRegistry);
    -              if (subBuilder != null) {
    -                subBuilder.mergeFrom(minimumBackoff_);
    -                minimumBackoff_ = subBuilder.buildPartial();
    -              }
    -
    -              break;
    -            }
    -          case 18:
    -            {
    -              com.google.protobuf.Duration.Builder subBuilder = null;
    -              if (maximumBackoff_ != null) {
    -                subBuilder = maximumBackoff_.toBuilder();
    -              }
    -              maximumBackoff_ =
    -                  input.readMessage(com.google.protobuf.Duration.parser(), extensionRegistry);
    -              if (subBuilder != null) {
    -                subBuilder.mergeFrom(maximumBackoff_);
    -                maximumBackoff_ = subBuilder.buildPartial();
    -              }
    -
    -              break;
    -            }
    -          default:
    -            {
    -              if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) {
    -                done = true;
    -              }
    -              break;
    -            }
    -        }
    -      }
    -    } catch (com.google.protobuf.InvalidProtocolBufferException e) {
    -      throw e.setUnfinishedMessage(this);
    -    } catch (java.io.IOException e) {
    -      throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this);
    -    } finally {
    -      this.unknownFields = unknownFields.build();
    -      makeExtensionsImmutable();
    -    }
    -  }
    +  private RetryPolicy() {}
     
       public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
         return com.google.pubsub.v1.PubsubProto.internal_static_google_pubsub_v1_RetryPolicy_descriptor;
       }
     
       @java.lang.Override
    -  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
    +  protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
           internalGetFieldAccessorTable() {
         return com.google.pubsub.v1.PubsubProto
             .internal_static_google_pubsub_v1_RetryPolicy_fieldAccessorTable
    @@ -137,33 +76,38 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
                 com.google.pubsub.v1.RetryPolicy.class, com.google.pubsub.v1.RetryPolicy.Builder.class);
       }
     
    +  private int bitField0_;
       public static final int MINIMUM_BACKOFF_FIELD_NUMBER = 1;
       private com.google.protobuf.Duration minimumBackoff_;
    +
       /**
        *
        *
        * 
    -   * The minimum delay between consecutive deliveries of a given message.
    -   * Value should be between 0 and 600 seconds. Defaults to 10 seconds.
    +   * Optional. The minimum delay between consecutive deliveries of a given
    +   * message. Value should be between 0 and 600 seconds. Defaults to 10 seconds.
        * 
    * - * .google.protobuf.Duration minimum_backoff = 1; + * .google.protobuf.Duration minimum_backoff = 1 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return Whether the minimumBackoff field is set. */ @java.lang.Override public boolean hasMinimumBackoff() { - return minimumBackoff_ != null; + return ((bitField0_ & 0x00000001) != 0); } + /** * * *
    -   * The minimum delay between consecutive deliveries of a given message.
    -   * Value should be between 0 and 600 seconds. Defaults to 10 seconds.
    +   * Optional. The minimum delay between consecutive deliveries of a given
    +   * message. Value should be between 0 and 600 seconds. Defaults to 10 seconds.
        * 
    * - * .google.protobuf.Duration minimum_backoff = 1; + * .google.protobuf.Duration minimum_backoff = 1 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return The minimumBackoff. */ @@ -173,48 +117,58 @@ public com.google.protobuf.Duration getMinimumBackoff() { ? com.google.protobuf.Duration.getDefaultInstance() : minimumBackoff_; } + /** * * *
    -   * The minimum delay between consecutive deliveries of a given message.
    -   * Value should be between 0 and 600 seconds. Defaults to 10 seconds.
    +   * Optional. The minimum delay between consecutive deliveries of a given
    +   * message. Value should be between 0 and 600 seconds. Defaults to 10 seconds.
        * 
    * - * .google.protobuf.Duration minimum_backoff = 1; + * .google.protobuf.Duration minimum_backoff = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ @java.lang.Override public com.google.protobuf.DurationOrBuilder getMinimumBackoffOrBuilder() { - return getMinimumBackoff(); + return minimumBackoff_ == null + ? com.google.protobuf.Duration.getDefaultInstance() + : minimumBackoff_; } public static final int MAXIMUM_BACKOFF_FIELD_NUMBER = 2; private com.google.protobuf.Duration maximumBackoff_; + /** * * *
    -   * The maximum delay between consecutive deliveries of a given message.
    -   * Value should be between 0 and 600 seconds. Defaults to 600 seconds.
    +   * Optional. The maximum delay between consecutive deliveries of a given
    +   * message. Value should be between 0 and 600 seconds. Defaults to 600
    +   * seconds.
        * 
    * - * .google.protobuf.Duration maximum_backoff = 2; + * .google.protobuf.Duration maximum_backoff = 2 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return Whether the maximumBackoff field is set. */ @java.lang.Override public boolean hasMaximumBackoff() { - return maximumBackoff_ != null; + return ((bitField0_ & 0x00000002) != 0); } + /** * * *
    -   * The maximum delay between consecutive deliveries of a given message.
    -   * Value should be between 0 and 600 seconds. Defaults to 600 seconds.
    +   * Optional. The maximum delay between consecutive deliveries of a given
    +   * message. Value should be between 0 and 600 seconds. Defaults to 600
    +   * seconds.
        * 
    * - * .google.protobuf.Duration maximum_backoff = 2; + * .google.protobuf.Duration maximum_backoff = 2 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return The maximumBackoff. */ @@ -224,19 +178,24 @@ public com.google.protobuf.Duration getMaximumBackoff() { ? com.google.protobuf.Duration.getDefaultInstance() : maximumBackoff_; } + /** * * *
    -   * The maximum delay between consecutive deliveries of a given message.
    -   * Value should be between 0 and 600 seconds. Defaults to 600 seconds.
    +   * Optional. The maximum delay between consecutive deliveries of a given
    +   * message. Value should be between 0 and 600 seconds. Defaults to 600
    +   * seconds.
        * 
    * - * .google.protobuf.Duration maximum_backoff = 2; + * .google.protobuf.Duration maximum_backoff = 2 [(.google.api.field_behavior) = OPTIONAL]; + * */ @java.lang.Override public com.google.protobuf.DurationOrBuilder getMaximumBackoffOrBuilder() { - return getMaximumBackoff(); + return maximumBackoff_ == null + ? com.google.protobuf.Duration.getDefaultInstance() + : maximumBackoff_; } private byte memoizedIsInitialized = -1; @@ -253,13 +212,13 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (minimumBackoff_ != null) { + if (((bitField0_ & 0x00000001) != 0)) { output.writeMessage(1, getMinimumBackoff()); } - if (maximumBackoff_ != null) { + if (((bitField0_ & 0x00000002) != 0)) { output.writeMessage(2, getMaximumBackoff()); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -268,13 +227,13 @@ public int getSerializedSize() { if (size != -1) return size; size = 0; - if (minimumBackoff_ != null) { + if (((bitField0_ & 0x00000001) != 0)) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getMinimumBackoff()); } - if (maximumBackoff_ != null) { + if (((bitField0_ & 0x00000002) != 0)) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getMaximumBackoff()); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -297,7 +256,7 @@ public boolean equals(final java.lang.Object obj) { if (hasMaximumBackoff()) { if (!getMaximumBackoff().equals(other.getMaximumBackoff())) return false; } - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -316,7 +275,7 @@ public int hashCode() { hash = (37 * hash) + MAXIMUM_BACKOFF_FIELD_NUMBER; hash = (53 * hash) + getMaximumBackoff().hashCode(); } - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -357,38 +316,38 @@ public static com.google.pubsub.v1.RetryPolicy parseFrom( public static com.google.pubsub.v1.RetryPolicy parseFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.RetryPolicy parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.RetryPolicy parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); } public static com.google.pubsub.v1.RetryPolicy parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.RetryPolicy parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.RetryPolicy parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } @@ -411,19 +370,23 @@ public Builder toBuilder() { } @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** * * *
    -   * A policy that specifies how Cloud Pub/Sub retries message delivery.
    +   * A policy that specifies how Pub/Sub retries message delivery.
    +   *
        * Retry delay will be exponential based on provided minimum and maximum
        * backoffs. https://en.wikipedia.org/wiki/Exponential_backoff.
    -   * RetryPolicy will be triggered on NACKs or acknowledgement deadline exceeded
    +   *
    +   * RetryPolicy will be triggered on NACKs or acknowledgment deadline exceeded
        * events for a given message.
    +   *
        * Retry Policy is implemented on a best effort basis. At times, the delay
        * between consecutive deliveries may not match the configuration. That is,
        * delay can be more or less than configured backoff.
    @@ -431,7 +394,7 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build
        *
        * Protobuf type {@code google.pubsub.v1.RetryPolicy}
        */
    -  public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder
    +  public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder
           implements
           // @@protoc_insertion_point(builder_implements:google.pubsub.v1.RetryPolicy)
           com.google.pubsub.v1.RetryPolicyOrBuilder {
    @@ -441,7 +404,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
         }
     
         @java.lang.Override
    -    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
    +    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
             internalGetFieldAccessorTable() {
           return com.google.pubsub.v1.PubsubProto
               .internal_static_google_pubsub_v1_RetryPolicy_fieldAccessorTable
    @@ -455,28 +418,30 @@ private Builder() {
           maybeForceBuilderInitialization();
         }
     
    -    private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
    +    private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) {
           super(parent);
           maybeForceBuilderInitialization();
         }
     
         private void maybeForceBuilderInitialization() {
    -      if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {}
    +      if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
    +        internalGetMinimumBackoffFieldBuilder();
    +        internalGetMaximumBackoffFieldBuilder();
    +      }
         }
     
         @java.lang.Override
         public Builder clear() {
           super.clear();
    -      if (minimumBackoffBuilder_ == null) {
    -        minimumBackoff_ = null;
    -      } else {
    -        minimumBackoff_ = null;
    +      bitField0_ = 0;
    +      minimumBackoff_ = null;
    +      if (minimumBackoffBuilder_ != null) {
    +        minimumBackoffBuilder_.dispose();
             minimumBackoffBuilder_ = null;
           }
    -      if (maximumBackoffBuilder_ == null) {
    -        maximumBackoff_ = null;
    -      } else {
    -        maximumBackoff_ = null;
    +      maximumBackoff_ = null;
    +      if (maximumBackoffBuilder_ != null) {
    +        maximumBackoffBuilder_.dispose();
             maximumBackoffBuilder_ = null;
           }
           return this;
    @@ -505,51 +470,27 @@ public com.google.pubsub.v1.RetryPolicy build() {
         @java.lang.Override
         public com.google.pubsub.v1.RetryPolicy buildPartial() {
           com.google.pubsub.v1.RetryPolicy result = new com.google.pubsub.v1.RetryPolicy(this);
    -      if (minimumBackoffBuilder_ == null) {
    -        result.minimumBackoff_ = minimumBackoff_;
    -      } else {
    -        result.minimumBackoff_ = minimumBackoffBuilder_.build();
    -      }
    -      if (maximumBackoffBuilder_ == null) {
    -        result.maximumBackoff_ = maximumBackoff_;
    -      } else {
    -        result.maximumBackoff_ = maximumBackoffBuilder_.build();
    +      if (bitField0_ != 0) {
    +        buildPartial0(result);
           }
           onBuilt();
           return result;
         }
     
    -    @java.lang.Override
    -    public Builder clone() {
    -      return super.clone();
    -    }
    -
    -    @java.lang.Override
    -    public Builder setField(
    -        com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
    -      return super.setField(field, value);
    -    }
    -
    -    @java.lang.Override
    -    public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) {
    -      return super.clearField(field);
    -    }
    -
    -    @java.lang.Override
    -    public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) {
    -      return super.clearOneof(oneof);
    -    }
    -
    -    @java.lang.Override
    -    public Builder setRepeatedField(
    -        com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) {
    -      return super.setRepeatedField(field, index, value);
    -    }
    -
    -    @java.lang.Override
    -    public Builder addRepeatedField(
    -        com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
    -      return super.addRepeatedField(field, value);
    +    private void buildPartial0(com.google.pubsub.v1.RetryPolicy result) {
    +      int from_bitField0_ = bitField0_;
    +      int to_bitField0_ = 0;
    +      if (((from_bitField0_ & 0x00000001) != 0)) {
    +        result.minimumBackoff_ =
    +            minimumBackoffBuilder_ == null ? minimumBackoff_ : minimumBackoffBuilder_.build();
    +        to_bitField0_ |= 0x00000001;
    +      }
    +      if (((from_bitField0_ & 0x00000002) != 0)) {
    +        result.maximumBackoff_ =
    +            maximumBackoffBuilder_ == null ? maximumBackoff_ : maximumBackoffBuilder_.build();
    +        to_bitField0_ |= 0x00000002;
    +      }
    +      result.bitField0_ |= to_bitField0_;
         }
     
         @java.lang.Override
    @@ -570,7 +511,7 @@ public Builder mergeFrom(com.google.pubsub.v1.RetryPolicy other) {
           if (other.hasMaximumBackoff()) {
             mergeMaximumBackoff(other.getMaximumBackoff());
           }
    -      this.mergeUnknownFields(other.unknownFields);
    +      this.mergeUnknownFields(other.getUnknownFields());
           onChanged();
           return this;
         }
    @@ -585,50 +526,86 @@ public Builder mergeFrom(
             com.google.protobuf.CodedInputStream input,
             com.google.protobuf.ExtensionRegistryLite extensionRegistry)
             throws java.io.IOException {
    -      com.google.pubsub.v1.RetryPolicy parsedMessage = null;
    +      if (extensionRegistry == null) {
    +        throw new java.lang.NullPointerException();
    +      }
           try {
    -        parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
    +        boolean done = false;
    +        while (!done) {
    +          int tag = input.readTag();
    +          switch (tag) {
    +            case 0:
    +              done = true;
    +              break;
    +            case 10:
    +              {
    +                input.readMessage(
    +                    internalGetMinimumBackoffFieldBuilder().getBuilder(), extensionRegistry);
    +                bitField0_ |= 0x00000001;
    +                break;
    +              } // case 10
    +            case 18:
    +              {
    +                input.readMessage(
    +                    internalGetMaximumBackoffFieldBuilder().getBuilder(), extensionRegistry);
    +                bitField0_ |= 0x00000002;
    +                break;
    +              } // case 18
    +            default:
    +              {
    +                if (!super.parseUnknownField(input, extensionRegistry, tag)) {
    +                  done = true; // was an endgroup tag
    +                }
    +                break;
    +              } // default:
    +          } // switch (tag)
    +        } // while (!done)
           } catch (com.google.protobuf.InvalidProtocolBufferException e) {
    -        parsedMessage = (com.google.pubsub.v1.RetryPolicy) e.getUnfinishedMessage();
             throw e.unwrapIOException();
           } finally {
    -        if (parsedMessage != null) {
    -          mergeFrom(parsedMessage);
    -        }
    -      }
    +        onChanged();
    +      } // finally
           return this;
         }
     
    +    private int bitField0_;
    +
         private com.google.protobuf.Duration minimumBackoff_;
    -    private com.google.protobuf.SingleFieldBuilderV3<
    +    private com.google.protobuf.SingleFieldBuilder<
                 com.google.protobuf.Duration,
                 com.google.protobuf.Duration.Builder,
                 com.google.protobuf.DurationOrBuilder>
             minimumBackoffBuilder_;
    +
         /**
          *
          *
          * 
    -     * The minimum delay between consecutive deliveries of a given message.
    -     * Value should be between 0 and 600 seconds. Defaults to 10 seconds.
    +     * Optional. The minimum delay between consecutive deliveries of a given
    +     * message. Value should be between 0 and 600 seconds. Defaults to 10 seconds.
          * 
    * - * .google.protobuf.Duration minimum_backoff = 1; + * + * .google.protobuf.Duration minimum_backoff = 1 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return Whether the minimumBackoff field is set. */ public boolean hasMinimumBackoff() { - return minimumBackoffBuilder_ != null || minimumBackoff_ != null; + return ((bitField0_ & 0x00000001) != 0); } + /** * * *
    -     * The minimum delay between consecutive deliveries of a given message.
    -     * Value should be between 0 and 600 seconds. Defaults to 10 seconds.
    +     * Optional. The minimum delay between consecutive deliveries of a given
    +     * message. Value should be between 0 and 600 seconds. Defaults to 10 seconds.
          * 
    * - * .google.protobuf.Duration minimum_backoff = 1; + * + * .google.protobuf.Duration minimum_backoff = 1 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return The minimumBackoff. */ @@ -641,15 +618,18 @@ public com.google.protobuf.Duration getMinimumBackoff() { return minimumBackoffBuilder_.getMessage(); } } + /** * * *
    -     * The minimum delay between consecutive deliveries of a given message.
    -     * Value should be between 0 and 600 seconds. Defaults to 10 seconds.
    +     * Optional. The minimum delay between consecutive deliveries of a given
    +     * message. Value should be between 0 and 600 seconds. Defaults to 10 seconds.
          * 
    * - * .google.protobuf.Duration minimum_backoff = 1; + * + * .google.protobuf.Duration minimum_backoff = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public Builder setMinimumBackoff(com.google.protobuf.Duration value) { if (minimumBackoffBuilder_ == null) { @@ -657,105 +637,120 @@ public Builder setMinimumBackoff(com.google.protobuf.Duration value) { throw new NullPointerException(); } minimumBackoff_ = value; - onChanged(); } else { minimumBackoffBuilder_.setMessage(value); } - + bitField0_ |= 0x00000001; + onChanged(); return this; } + /** * * *
    -     * The minimum delay between consecutive deliveries of a given message.
    -     * Value should be between 0 and 600 seconds. Defaults to 10 seconds.
    +     * Optional. The minimum delay between consecutive deliveries of a given
    +     * message. Value should be between 0 and 600 seconds. Defaults to 10 seconds.
          * 
    * - * .google.protobuf.Duration minimum_backoff = 1; + * + * .google.protobuf.Duration minimum_backoff = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public Builder setMinimumBackoff(com.google.protobuf.Duration.Builder builderForValue) { if (minimumBackoffBuilder_ == null) { minimumBackoff_ = builderForValue.build(); - onChanged(); } else { minimumBackoffBuilder_.setMessage(builderForValue.build()); } - + bitField0_ |= 0x00000001; + onChanged(); return this; } + /** * * *
    -     * The minimum delay between consecutive deliveries of a given message.
    -     * Value should be between 0 and 600 seconds. Defaults to 10 seconds.
    +     * Optional. The minimum delay between consecutive deliveries of a given
    +     * message. Value should be between 0 and 600 seconds. Defaults to 10 seconds.
          * 
    * - * .google.protobuf.Duration minimum_backoff = 1; + * + * .google.protobuf.Duration minimum_backoff = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public Builder mergeMinimumBackoff(com.google.protobuf.Duration value) { if (minimumBackoffBuilder_ == null) { - if (minimumBackoff_ != null) { - minimumBackoff_ = - com.google.protobuf.Duration.newBuilder(minimumBackoff_) - .mergeFrom(value) - .buildPartial(); + if (((bitField0_ & 0x00000001) != 0) + && minimumBackoff_ != null + && minimumBackoff_ != com.google.protobuf.Duration.getDefaultInstance()) { + getMinimumBackoffBuilder().mergeFrom(value); } else { minimumBackoff_ = value; } - onChanged(); } else { minimumBackoffBuilder_.mergeFrom(value); } - + if (minimumBackoff_ != null) { + bitField0_ |= 0x00000001; + onChanged(); + } return this; } + /** * * *
    -     * The minimum delay between consecutive deliveries of a given message.
    -     * Value should be between 0 and 600 seconds. Defaults to 10 seconds.
    +     * Optional. The minimum delay between consecutive deliveries of a given
    +     * message. Value should be between 0 and 600 seconds. Defaults to 10 seconds.
          * 
    * - * .google.protobuf.Duration minimum_backoff = 1; + * + * .google.protobuf.Duration minimum_backoff = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public Builder clearMinimumBackoff() { - if (minimumBackoffBuilder_ == null) { - minimumBackoff_ = null; - onChanged(); - } else { - minimumBackoff_ = null; + bitField0_ = (bitField0_ & ~0x00000001); + minimumBackoff_ = null; + if (minimumBackoffBuilder_ != null) { + minimumBackoffBuilder_.dispose(); minimumBackoffBuilder_ = null; } - + onChanged(); return this; } + /** * * *
    -     * The minimum delay between consecutive deliveries of a given message.
    -     * Value should be between 0 and 600 seconds. Defaults to 10 seconds.
    +     * Optional. The minimum delay between consecutive deliveries of a given
    +     * message. Value should be between 0 and 600 seconds. Defaults to 10 seconds.
          * 
    * - * .google.protobuf.Duration minimum_backoff = 1; + * + * .google.protobuf.Duration minimum_backoff = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public com.google.protobuf.Duration.Builder getMinimumBackoffBuilder() { - + bitField0_ |= 0x00000001; onChanged(); - return getMinimumBackoffFieldBuilder().getBuilder(); + return internalGetMinimumBackoffFieldBuilder().getBuilder(); } + /** * * *
    -     * The minimum delay between consecutive deliveries of a given message.
    -     * Value should be between 0 and 600 seconds. Defaults to 10 seconds.
    +     * Optional. The minimum delay between consecutive deliveries of a given
    +     * message. Value should be between 0 and 600 seconds. Defaults to 10 seconds.
          * 
    * - * .google.protobuf.Duration minimum_backoff = 1; + * + * .google.protobuf.Duration minimum_backoff = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ public com.google.protobuf.DurationOrBuilder getMinimumBackoffOrBuilder() { if (minimumBackoffBuilder_ != null) { @@ -766,24 +761,27 @@ public com.google.protobuf.DurationOrBuilder getMinimumBackoffOrBuilder() { : minimumBackoff_; } } + /** * * *
    -     * The minimum delay between consecutive deliveries of a given message.
    -     * Value should be between 0 and 600 seconds. Defaults to 10 seconds.
    +     * Optional. The minimum delay between consecutive deliveries of a given
    +     * message. Value should be between 0 and 600 seconds. Defaults to 10 seconds.
          * 
    * - * .google.protobuf.Duration minimum_backoff = 1; + * + * .google.protobuf.Duration minimum_backoff = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ - private com.google.protobuf.SingleFieldBuilderV3< + private com.google.protobuf.SingleFieldBuilder< com.google.protobuf.Duration, com.google.protobuf.Duration.Builder, com.google.protobuf.DurationOrBuilder> - getMinimumBackoffFieldBuilder() { + internalGetMinimumBackoffFieldBuilder() { if (minimumBackoffBuilder_ == null) { minimumBackoffBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< + new com.google.protobuf.SingleFieldBuilder< com.google.protobuf.Duration, com.google.protobuf.Duration.Builder, com.google.protobuf.DurationOrBuilder>( @@ -794,35 +792,43 @@ public com.google.protobuf.DurationOrBuilder getMinimumBackoffOrBuilder() { } private com.google.protobuf.Duration maximumBackoff_; - private com.google.protobuf.SingleFieldBuilderV3< + private com.google.protobuf.SingleFieldBuilder< com.google.protobuf.Duration, com.google.protobuf.Duration.Builder, com.google.protobuf.DurationOrBuilder> maximumBackoffBuilder_; + /** * * *
    -     * The maximum delay between consecutive deliveries of a given message.
    -     * Value should be between 0 and 600 seconds. Defaults to 600 seconds.
    +     * Optional. The maximum delay between consecutive deliveries of a given
    +     * message. Value should be between 0 and 600 seconds. Defaults to 600
    +     * seconds.
          * 
    * - * .google.protobuf.Duration maximum_backoff = 2; + * + * .google.protobuf.Duration maximum_backoff = 2 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return Whether the maximumBackoff field is set. */ public boolean hasMaximumBackoff() { - return maximumBackoffBuilder_ != null || maximumBackoff_ != null; + return ((bitField0_ & 0x00000002) != 0); } + /** * * *
    -     * The maximum delay between consecutive deliveries of a given message.
    -     * Value should be between 0 and 600 seconds. Defaults to 600 seconds.
    +     * Optional. The maximum delay between consecutive deliveries of a given
    +     * message. Value should be between 0 and 600 seconds. Defaults to 600
    +     * seconds.
          * 
    * - * .google.protobuf.Duration maximum_backoff = 2; + * + * .google.protobuf.Duration maximum_backoff = 2 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return The maximumBackoff. */ @@ -835,15 +841,19 @@ public com.google.protobuf.Duration getMaximumBackoff() { return maximumBackoffBuilder_.getMessage(); } } + /** * * *
    -     * The maximum delay between consecutive deliveries of a given message.
    -     * Value should be between 0 and 600 seconds. Defaults to 600 seconds.
    +     * Optional. The maximum delay between consecutive deliveries of a given
    +     * message. Value should be between 0 and 600 seconds. Defaults to 600
    +     * seconds.
          * 
    * - * .google.protobuf.Duration maximum_backoff = 2; + * + * .google.protobuf.Duration maximum_backoff = 2 [(.google.api.field_behavior) = OPTIONAL]; + * */ public Builder setMaximumBackoff(com.google.protobuf.Duration value) { if (maximumBackoffBuilder_ == null) { @@ -851,105 +861,125 @@ public Builder setMaximumBackoff(com.google.protobuf.Duration value) { throw new NullPointerException(); } maximumBackoff_ = value; - onChanged(); } else { maximumBackoffBuilder_.setMessage(value); } - + bitField0_ |= 0x00000002; + onChanged(); return this; } + /** * * *
    -     * The maximum delay between consecutive deliveries of a given message.
    -     * Value should be between 0 and 600 seconds. Defaults to 600 seconds.
    +     * Optional. The maximum delay between consecutive deliveries of a given
    +     * message. Value should be between 0 and 600 seconds. Defaults to 600
    +     * seconds.
          * 
    * - * .google.protobuf.Duration maximum_backoff = 2; + * + * .google.protobuf.Duration maximum_backoff = 2 [(.google.api.field_behavior) = OPTIONAL]; + * */ public Builder setMaximumBackoff(com.google.protobuf.Duration.Builder builderForValue) { if (maximumBackoffBuilder_ == null) { maximumBackoff_ = builderForValue.build(); - onChanged(); } else { maximumBackoffBuilder_.setMessage(builderForValue.build()); } - + bitField0_ |= 0x00000002; + onChanged(); return this; } + /** * * *
    -     * The maximum delay between consecutive deliveries of a given message.
    -     * Value should be between 0 and 600 seconds. Defaults to 600 seconds.
    +     * Optional. The maximum delay between consecutive deliveries of a given
    +     * message. Value should be between 0 and 600 seconds. Defaults to 600
    +     * seconds.
          * 
    * - * .google.protobuf.Duration maximum_backoff = 2; + * + * .google.protobuf.Duration maximum_backoff = 2 [(.google.api.field_behavior) = OPTIONAL]; + * */ public Builder mergeMaximumBackoff(com.google.protobuf.Duration value) { if (maximumBackoffBuilder_ == null) { - if (maximumBackoff_ != null) { - maximumBackoff_ = - com.google.protobuf.Duration.newBuilder(maximumBackoff_) - .mergeFrom(value) - .buildPartial(); + if (((bitField0_ & 0x00000002) != 0) + && maximumBackoff_ != null + && maximumBackoff_ != com.google.protobuf.Duration.getDefaultInstance()) { + getMaximumBackoffBuilder().mergeFrom(value); } else { maximumBackoff_ = value; } - onChanged(); } else { maximumBackoffBuilder_.mergeFrom(value); } - + if (maximumBackoff_ != null) { + bitField0_ |= 0x00000002; + onChanged(); + } return this; } + /** * * *
    -     * The maximum delay between consecutive deliveries of a given message.
    -     * Value should be between 0 and 600 seconds. Defaults to 600 seconds.
    +     * Optional. The maximum delay between consecutive deliveries of a given
    +     * message. Value should be between 0 and 600 seconds. Defaults to 600
    +     * seconds.
          * 
    * - * .google.protobuf.Duration maximum_backoff = 2; + * + * .google.protobuf.Duration maximum_backoff = 2 [(.google.api.field_behavior) = OPTIONAL]; + * */ public Builder clearMaximumBackoff() { - if (maximumBackoffBuilder_ == null) { - maximumBackoff_ = null; - onChanged(); - } else { - maximumBackoff_ = null; + bitField0_ = (bitField0_ & ~0x00000002); + maximumBackoff_ = null; + if (maximumBackoffBuilder_ != null) { + maximumBackoffBuilder_.dispose(); maximumBackoffBuilder_ = null; } - + onChanged(); return this; } + /** * * *
    -     * The maximum delay between consecutive deliveries of a given message.
    -     * Value should be between 0 and 600 seconds. Defaults to 600 seconds.
    +     * Optional. The maximum delay between consecutive deliveries of a given
    +     * message. Value should be between 0 and 600 seconds. Defaults to 600
    +     * seconds.
          * 
    * - * .google.protobuf.Duration maximum_backoff = 2; + * + * .google.protobuf.Duration maximum_backoff = 2 [(.google.api.field_behavior) = OPTIONAL]; + * */ public com.google.protobuf.Duration.Builder getMaximumBackoffBuilder() { - + bitField0_ |= 0x00000002; onChanged(); - return getMaximumBackoffFieldBuilder().getBuilder(); + return internalGetMaximumBackoffFieldBuilder().getBuilder(); } + /** * * *
    -     * The maximum delay between consecutive deliveries of a given message.
    -     * Value should be between 0 and 600 seconds. Defaults to 600 seconds.
    +     * Optional. The maximum delay between consecutive deliveries of a given
    +     * message. Value should be between 0 and 600 seconds. Defaults to 600
    +     * seconds.
          * 
    * - * .google.protobuf.Duration maximum_backoff = 2; + * + * .google.protobuf.Duration maximum_backoff = 2 [(.google.api.field_behavior) = OPTIONAL]; + * */ public com.google.protobuf.DurationOrBuilder getMaximumBackoffOrBuilder() { if (maximumBackoffBuilder_ != null) { @@ -960,24 +990,28 @@ public com.google.protobuf.DurationOrBuilder getMaximumBackoffOrBuilder() { : maximumBackoff_; } } + /** * * *
    -     * The maximum delay between consecutive deliveries of a given message.
    -     * Value should be between 0 and 600 seconds. Defaults to 600 seconds.
    +     * Optional. The maximum delay between consecutive deliveries of a given
    +     * message. Value should be between 0 and 600 seconds. Defaults to 600
    +     * seconds.
          * 
    * - * .google.protobuf.Duration maximum_backoff = 2; + * + * .google.protobuf.Duration maximum_backoff = 2 [(.google.api.field_behavior) = OPTIONAL]; + * */ - private com.google.protobuf.SingleFieldBuilderV3< + private com.google.protobuf.SingleFieldBuilder< com.google.protobuf.Duration, com.google.protobuf.Duration.Builder, com.google.protobuf.DurationOrBuilder> - getMaximumBackoffFieldBuilder() { + internalGetMaximumBackoffFieldBuilder() { if (maximumBackoffBuilder_ == null) { maximumBackoffBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< + new com.google.protobuf.SingleFieldBuilder< com.google.protobuf.Duration, com.google.protobuf.Duration.Builder, com.google.protobuf.DurationOrBuilder>( @@ -987,17 +1021,6 @@ public com.google.protobuf.DurationOrBuilder getMaximumBackoffOrBuilder() { return maximumBackoffBuilder_; } - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - // @@protoc_insertion_point(builder_scope:google.pubsub.v1.RetryPolicy) } @@ -1019,7 +1042,18 @@ public RetryPolicy parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new RetryPolicy(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/RetryPolicyOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/RetryPolicyOrBuilder.java index e3ace44c0..1d4583231 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/RetryPolicyOrBuilder.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/RetryPolicyOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; +@com.google.protobuf.Generated public interface RetryPolicyOrBuilder extends // @@protoc_insertion_point(interface_extends:google.pubsub.v1.RetryPolicy) @@ -27,37 +30,42 @@ public interface RetryPolicyOrBuilder * * *
    -   * The minimum delay between consecutive deliveries of a given message.
    -   * Value should be between 0 and 600 seconds. Defaults to 10 seconds.
    +   * Optional. The minimum delay between consecutive deliveries of a given
    +   * message. Value should be between 0 and 600 seconds. Defaults to 10 seconds.
        * 
    * - * .google.protobuf.Duration minimum_backoff = 1; + * .google.protobuf.Duration minimum_backoff = 1 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return Whether the minimumBackoff field is set. */ boolean hasMinimumBackoff(); + /** * * *
    -   * The minimum delay between consecutive deliveries of a given message.
    -   * Value should be between 0 and 600 seconds. Defaults to 10 seconds.
    +   * Optional. The minimum delay between consecutive deliveries of a given
    +   * message. Value should be between 0 and 600 seconds. Defaults to 10 seconds.
        * 
    * - * .google.protobuf.Duration minimum_backoff = 1; + * .google.protobuf.Duration minimum_backoff = 1 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return The minimumBackoff. */ com.google.protobuf.Duration getMinimumBackoff(); + /** * * *
    -   * The minimum delay between consecutive deliveries of a given message.
    -   * Value should be between 0 and 600 seconds. Defaults to 10 seconds.
    +   * Optional. The minimum delay between consecutive deliveries of a given
    +   * message. Value should be between 0 and 600 seconds. Defaults to 10 seconds.
        * 
    * - * .google.protobuf.Duration minimum_backoff = 1; + * .google.protobuf.Duration minimum_backoff = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ com.google.protobuf.DurationOrBuilder getMinimumBackoffOrBuilder(); @@ -65,37 +73,45 @@ public interface RetryPolicyOrBuilder * * *
    -   * The maximum delay between consecutive deliveries of a given message.
    -   * Value should be between 0 and 600 seconds. Defaults to 600 seconds.
    +   * Optional. The maximum delay between consecutive deliveries of a given
    +   * message. Value should be between 0 and 600 seconds. Defaults to 600
    +   * seconds.
        * 
    * - * .google.protobuf.Duration maximum_backoff = 2; + * .google.protobuf.Duration maximum_backoff = 2 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return Whether the maximumBackoff field is set. */ boolean hasMaximumBackoff(); + /** * * *
    -   * The maximum delay between consecutive deliveries of a given message.
    -   * Value should be between 0 and 600 seconds. Defaults to 600 seconds.
    +   * Optional. The maximum delay between consecutive deliveries of a given
    +   * message. Value should be between 0 and 600 seconds. Defaults to 600
    +   * seconds.
        * 
    * - * .google.protobuf.Duration maximum_backoff = 2; + * .google.protobuf.Duration maximum_backoff = 2 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return The maximumBackoff. */ com.google.protobuf.Duration getMaximumBackoff(); + /** * * *
    -   * The maximum delay between consecutive deliveries of a given message.
    -   * Value should be between 0 and 600 seconds. Defaults to 600 seconds.
    +   * Optional. The maximum delay between consecutive deliveries of a given
    +   * message. Value should be between 0 and 600 seconds. Defaults to 600
    +   * seconds.
        * 
    * - * .google.protobuf.Duration maximum_backoff = 2; + * .google.protobuf.Duration maximum_backoff = 2 [(.google.api.field_behavior) = OPTIONAL]; + * */ com.google.protobuf.DurationOrBuilder getMaximumBackoffOrBuilder(); } diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/RollbackSchemaRequest.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/RollbackSchemaRequest.java new file mode 100644 index 000000000..651e58a5a --- /dev/null +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/RollbackSchemaRequest.java @@ -0,0 +1,819 @@ +/* + * Copyright 2026 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: google/pubsub/v1/schema.proto +// Protobuf Java Version: 4.33.2 + +package com.google.pubsub.v1; + +/** + * + * + *
    + * Request for the `RollbackSchema` method.
    + * 
    + * + * Protobuf type {@code google.pubsub.v1.RollbackSchemaRequest} + */ +@com.google.protobuf.Generated +public final class RollbackSchemaRequest extends com.google.protobuf.GeneratedMessage + implements + // @@protoc_insertion_point(message_implements:google.pubsub.v1.RollbackSchemaRequest) + RollbackSchemaRequestOrBuilder { + private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "RollbackSchemaRequest"); + } + + // Use RollbackSchemaRequest.newBuilder() to construct. + private RollbackSchemaRequest(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + + private RollbackSchemaRequest() { + name_ = ""; + revisionId_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.SchemaProto + .internal_static_google_pubsub_v1_RollbackSchemaRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.SchemaProto + .internal_static_google_pubsub_v1_RollbackSchemaRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.RollbackSchemaRequest.class, + com.google.pubsub.v1.RollbackSchemaRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; + + /** + * + * + *
    +   * Required. The schema being rolled back with revision id.
    +   * 
    + * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + + /** + * + * + *
    +   * Required. The schema being rolled back with revision id.
    +   * 
    + * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int REVISION_ID_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private volatile java.lang.Object revisionId_ = ""; + + /** + * + * + *
    +   * Required. The revision ID to roll back to.
    +   * It must be a revision of the same schema.
    +   *
    +   * Example: c7cfa2a8
    +   * 
    + * + * string revision_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The revisionId. + */ + @java.lang.Override + public java.lang.String getRevisionId() { + java.lang.Object ref = revisionId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + revisionId_ = s; + return s; + } + } + + /** + * + * + *
    +   * Required. The revision ID to roll back to.
    +   * It must be a revision of the same schema.
    +   *
    +   * Example: c7cfa2a8
    +   * 
    + * + * string revision_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for revisionId. + */ + @java.lang.Override + public com.google.protobuf.ByteString getRevisionIdBytes() { + java.lang.Object ref = revisionId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + revisionId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, name_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(revisionId_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, revisionId_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, name_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(revisionId_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, revisionId_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.pubsub.v1.RollbackSchemaRequest)) { + return super.equals(obj); + } + com.google.pubsub.v1.RollbackSchemaRequest other = + (com.google.pubsub.v1.RollbackSchemaRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (!getRevisionId().equals(other.getRevisionId())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + REVISION_ID_FIELD_NUMBER; + hash = (53 * hash) + getRevisionId().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.pubsub.v1.RollbackSchemaRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.RollbackSchemaRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.RollbackSchemaRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.RollbackSchemaRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.RollbackSchemaRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.RollbackSchemaRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.RollbackSchemaRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.RollbackSchemaRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.RollbackSchemaRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.RollbackSchemaRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.RollbackSchemaRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.RollbackSchemaRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.pubsub.v1.RollbackSchemaRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + + /** + * + * + *
    +   * Request for the `RollbackSchema` method.
    +   * 
    + * + * Protobuf type {@code google.pubsub.v1.RollbackSchemaRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder + implements + // @@protoc_insertion_point(builder_implements:google.pubsub.v1.RollbackSchemaRequest) + com.google.pubsub.v1.RollbackSchemaRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.SchemaProto + .internal_static_google_pubsub_v1_RollbackSchemaRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.SchemaProto + .internal_static_google_pubsub_v1_RollbackSchemaRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.RollbackSchemaRequest.class, + com.google.pubsub.v1.RollbackSchemaRequest.Builder.class); + } + + // Construct using com.google.pubsub.v1.RollbackSchemaRequest.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + name_ = ""; + revisionId_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.pubsub.v1.SchemaProto + .internal_static_google_pubsub_v1_RollbackSchemaRequest_descriptor; + } + + @java.lang.Override + public com.google.pubsub.v1.RollbackSchemaRequest getDefaultInstanceForType() { + return com.google.pubsub.v1.RollbackSchemaRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.pubsub.v1.RollbackSchemaRequest build() { + com.google.pubsub.v1.RollbackSchemaRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.pubsub.v1.RollbackSchemaRequest buildPartial() { + com.google.pubsub.v1.RollbackSchemaRequest result = + new com.google.pubsub.v1.RollbackSchemaRequest(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.pubsub.v1.RollbackSchemaRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.name_ = name_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.revisionId_ = revisionId_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.pubsub.v1.RollbackSchemaRequest) { + return mergeFrom((com.google.pubsub.v1.RollbackSchemaRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.pubsub.v1.RollbackSchemaRequest other) { + if (other == com.google.pubsub.v1.RollbackSchemaRequest.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getRevisionId().isEmpty()) { + revisionId_ = other.revisionId_; + bitField0_ |= 0x00000002; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + name_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + revisionId_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.lang.Object name_ = ""; + + /** + * + * + *
    +     * Required. The schema being rolled back with revision id.
    +     * 
    + * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +     * Required. The schema being rolled back with revision id.
    +     * 
    + * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +     * Required. The schema being rolled back with revision id.
    +     * 
    + * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Required. The schema being rolled back with revision id.
    +     * 
    + * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + + /** + * + * + *
    +     * Required. The schema being rolled back with revision id.
    +     * 
    + * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object revisionId_ = ""; + + /** + * + * + *
    +     * Required. The revision ID to roll back to.
    +     * It must be a revision of the same schema.
    +     *
    +     * Example: c7cfa2a8
    +     * 
    + * + * string revision_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The revisionId. + */ + public java.lang.String getRevisionId() { + java.lang.Object ref = revisionId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + revisionId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +     * Required. The revision ID to roll back to.
    +     * It must be a revision of the same schema.
    +     *
    +     * Example: c7cfa2a8
    +     * 
    + * + * string revision_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for revisionId. + */ + public com.google.protobuf.ByteString getRevisionIdBytes() { + java.lang.Object ref = revisionId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + revisionId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +     * Required. The revision ID to roll back to.
    +     * It must be a revision of the same schema.
    +     *
    +     * Example: c7cfa2a8
    +     * 
    + * + * string revision_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The revisionId to set. + * @return This builder for chaining. + */ + public Builder setRevisionId(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + revisionId_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Required. The revision ID to roll back to.
    +     * It must be a revision of the same schema.
    +     *
    +     * Example: c7cfa2a8
    +     * 
    + * + * string revision_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearRevisionId() { + revisionId_ = getDefaultInstance().getRevisionId(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + + /** + * + * + *
    +     * Required. The revision ID to roll back to.
    +     * It must be a revision of the same schema.
    +     *
    +     * Example: c7cfa2a8
    +     * 
    + * + * string revision_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for revisionId to set. + * @return This builder for chaining. + */ + public Builder setRevisionIdBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + revisionId_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:google.pubsub.v1.RollbackSchemaRequest) + } + + // @@protoc_insertion_point(class_scope:google.pubsub.v1.RollbackSchemaRequest) + private static final com.google.pubsub.v1.RollbackSchemaRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.pubsub.v1.RollbackSchemaRequest(); + } + + public static com.google.pubsub.v1.RollbackSchemaRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public RollbackSchemaRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.pubsub.v1.RollbackSchemaRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/RollbackSchemaRequestOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/RollbackSchemaRequestOrBuilder.java new file mode 100644 index 000000000..3a99e5b04 --- /dev/null +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/RollbackSchemaRequestOrBuilder.java @@ -0,0 +1,90 @@ +/* + * Copyright 2026 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: google/pubsub/v1/schema.proto +// Protobuf Java Version: 4.33.2 + +package com.google.pubsub.v1; + +@com.google.protobuf.Generated +public interface RollbackSchemaRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.pubsub.v1.RollbackSchemaRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
    +   * Required. The schema being rolled back with revision id.
    +   * 
    + * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + + /** + * + * + *
    +   * Required. The schema being rolled back with revision id.
    +   * 
    + * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
    +   * Required. The revision ID to roll back to.
    +   * It must be a revision of the same schema.
    +   *
    +   * Example: c7cfa2a8
    +   * 
    + * + * string revision_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The revisionId. + */ + java.lang.String getRevisionId(); + + /** + * + * + *
    +   * Required. The revision ID to roll back to.
    +   * It must be a revision of the same schema.
    +   *
    +   * Example: c7cfa2a8
    +   * 
    + * + * string revision_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for revisionId. + */ + com.google.protobuf.ByteString getRevisionIdBytes(); +} diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/Schema.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/Schema.java index cd8adc77b..c5cf382ad 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/Schema.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/Schema.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/schema.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; @@ -27,13 +29,25 @@ * * Protobuf type {@code google.pubsub.v1.Schema} */ -public final class Schema extends com.google.protobuf.GeneratedMessageV3 +@com.google.protobuf.Generated +public final class Schema extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:google.pubsub.v1.Schema) SchemaOrBuilder { private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "Schema"); + } + // Use Schema.newBuilder() to construct. - private Schema(com.google.protobuf.GeneratedMessageV3.Builder builder) { + private Schema(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); } @@ -41,75 +55,7 @@ private Schema() { name_ = ""; type_ = 0; definition_ = ""; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new Schema(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - private Schema( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - java.lang.String s = input.readStringRequireUtf8(); - - name_ = s; - break; - } - case 16: - { - int rawValue = input.readEnum(); - - type_ = rawValue; - break; - } - case 26: - { - java.lang.String s = input.readStringRequireUtf8(); - - definition_ = s; - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } + revisionId_ = ""; } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { @@ -117,7 +63,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.SchemaProto .internal_static_google_pubsub_v1_Schema_fieldAccessorTable @@ -168,6 +114,16 @@ public enum Type implements com.google.protobuf.ProtocolMessageEnum { UNRECOGNIZED(-1), ; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "Type"); + } + /** * * @@ -178,6 +134,7 @@ public enum Type implements com.google.protobuf.ProtocolMessageEnum { * TYPE_UNSPECIFIED = 0; */ public static final int TYPE_UNSPECIFIED_VALUE = 0; + /** * * @@ -188,6 +145,7 @@ public enum Type implements com.google.protobuf.ProtocolMessageEnum { * PROTOCOL_BUFFER = 1; */ public static final int PROTOCOL_BUFFER_VALUE = 1; + /** * * @@ -257,7 +215,7 @@ public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType return getDescriptor(); } - public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + public static com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { return com.google.pubsub.v1.Schema.getDescriptor().getEnumTypes().get(0); } @@ -282,8 +240,12 @@ private Type(int value) { // @@protoc_insertion_point(enum_scope:google.pubsub.v1.Schema.Type) } + private int bitField0_; public static final int NAME_FIELD_NUMBER = 1; - private volatile java.lang.Object name_; + + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; + /** * * @@ -308,6 +270,7 @@ public java.lang.String getName() { return s; } } + /** * * @@ -334,7 +297,8 @@ public com.google.protobuf.ByteString getNameBytes() { } public static final int TYPE_FIELD_NUMBER = 2; - private int type_; + private int type_ = 0; + /** * * @@ -350,6 +314,7 @@ public com.google.protobuf.ByteString getNameBytes() { public int getTypeValue() { return type_; } + /** * * @@ -363,13 +328,15 @@ public int getTypeValue() { */ @java.lang.Override public com.google.pubsub.v1.Schema.Type getType() { - @SuppressWarnings("deprecation") - com.google.pubsub.v1.Schema.Type result = com.google.pubsub.v1.Schema.Type.valueOf(type_); + com.google.pubsub.v1.Schema.Type result = com.google.pubsub.v1.Schema.Type.forNumber(type_); return result == null ? com.google.pubsub.v1.Schema.Type.UNRECOGNIZED : result; } public static final int DEFINITION_FIELD_NUMBER = 3; - private volatile java.lang.Object definition_; + + @SuppressWarnings("serial") + private volatile java.lang.Object definition_ = ""; + /** * * @@ -395,6 +362,7 @@ public java.lang.String getDefinition() { return s; } } + /** * * @@ -421,6 +389,122 @@ public com.google.protobuf.ByteString getDefinitionBytes() { } } + public static final int REVISION_ID_FIELD_NUMBER = 4; + + @SuppressWarnings("serial") + private volatile java.lang.Object revisionId_ = ""; + + /** + * + * + *
    +   * Output only. Immutable. The revision ID of the schema.
    +   * 
    + * + * + * string revision_id = 4 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The revisionId. + */ + @java.lang.Override + public java.lang.String getRevisionId() { + java.lang.Object ref = revisionId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + revisionId_ = s; + return s; + } + } + + /** + * + * + *
    +   * Output only. Immutable. The revision ID of the schema.
    +   * 
    + * + * + * string revision_id = 4 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The bytes for revisionId. + */ + @java.lang.Override + public com.google.protobuf.ByteString getRevisionIdBytes() { + java.lang.Object ref = revisionId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + revisionId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int REVISION_CREATE_TIME_FIELD_NUMBER = 6; + private com.google.protobuf.Timestamp revisionCreateTime_; + + /** + * + * + *
    +   * Output only. The timestamp that the revision was created.
    +   * 
    + * + * + * .google.protobuf.Timestamp revision_create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the revisionCreateTime field is set. + */ + @java.lang.Override + public boolean hasRevisionCreateTime() { + return ((bitField0_ & 0x00000001) != 0); + } + + /** + * + * + *
    +   * Output only. The timestamp that the revision was created.
    +   * 
    + * + * + * .google.protobuf.Timestamp revision_create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The revisionCreateTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getRevisionCreateTime() { + return revisionCreateTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : revisionCreateTime_; + } + + /** + * + * + *
    +   * Output only. The timestamp that the revision was created.
    +   * 
    + * + * + * .google.protobuf.Timestamp revision_create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getRevisionCreateTimeOrBuilder() { + return revisionCreateTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : revisionCreateTime_; + } + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -435,16 +519,22 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!getNameBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, name_); } if (type_ != com.google.pubsub.v1.Schema.Type.TYPE_UNSPECIFIED.getNumber()) { output.writeEnum(2, type_); } - if (!getDefinitionBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 3, definition_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(definition_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 3, definition_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(revisionId_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 4, revisionId_); + } + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(6, getRevisionCreateTime()); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -453,16 +543,22 @@ public int getSerializedSize() { if (size != -1) return size; size = 0; - if (!getNameBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, name_); } if (type_ != com.google.pubsub.v1.Schema.Type.TYPE_UNSPECIFIED.getNumber()) { size += com.google.protobuf.CodedOutputStream.computeEnumSize(2, type_); } - if (!getDefinitionBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, definition_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(definition_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(3, definition_); } - size += unknownFields.getSerializedSize(); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(revisionId_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(4, revisionId_); + } + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(6, getRevisionCreateTime()); + } + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -480,7 +576,12 @@ public boolean equals(final java.lang.Object obj) { if (!getName().equals(other.getName())) return false; if (type_ != other.type_) return false; if (!getDefinition().equals(other.getDefinition())) return false; - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getRevisionId().equals(other.getRevisionId())) return false; + if (hasRevisionCreateTime() != other.hasRevisionCreateTime()) return false; + if (hasRevisionCreateTime()) { + if (!getRevisionCreateTime().equals(other.getRevisionCreateTime())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -497,7 +598,13 @@ public int hashCode() { hash = (53 * hash) + type_; hash = (37 * hash) + DEFINITION_FIELD_NUMBER; hash = (53 * hash) + getDefinition().hashCode(); - hash = (29 * hash) + unknownFields.hashCode(); + hash = (37 * hash) + REVISION_ID_FIELD_NUMBER; + hash = (53 * hash) + getRevisionId().hashCode(); + if (hasRevisionCreateTime()) { + hash = (37 * hash) + REVISION_CREATE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getRevisionCreateTime().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -538,38 +645,38 @@ public static com.google.pubsub.v1.Schema parseFrom( public static com.google.pubsub.v1.Schema parseFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.Schema parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.Schema parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); } public static com.google.pubsub.v1.Schema parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.Schema parseFrom(com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.Schema parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } @@ -592,10 +699,11 @@ public Builder toBuilder() { } @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** * * @@ -605,7 +713,7 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build * * Protobuf type {@code google.pubsub.v1.Schema} */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements // @@protoc_insertion_point(builder_implements:google.pubsub.v1.Schema) com.google.pubsub.v1.SchemaOrBuilder { @@ -614,7 +722,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.SchemaProto .internal_static_google_pubsub_v1_Schema_fieldAccessorTable @@ -627,24 +735,30 @@ private Builder() { maybeForceBuilderInitialization(); } - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + internalGetRevisionCreateTimeFieldBuilder(); + } } @java.lang.Override public Builder clear() { super.clear(); + bitField0_ = 0; name_ = ""; - type_ = 0; - definition_ = ""; - + revisionId_ = ""; + revisionCreateTime_ = null; + if (revisionCreateTimeBuilder_ != null) { + revisionCreateTimeBuilder_.dispose(); + revisionCreateTimeBuilder_ = null; + } return this; } @@ -670,44 +784,36 @@ public com.google.pubsub.v1.Schema build() { @java.lang.Override public com.google.pubsub.v1.Schema buildPartial() { com.google.pubsub.v1.Schema result = new com.google.pubsub.v1.Schema(this); - result.name_ = name_; - result.type_ = type_; - result.definition_ = definition_; + if (bitField0_ != 0) { + buildPartial0(result); + } onBuilt(); return result; } - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); + private void buildPartial0(com.google.pubsub.v1.Schema result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.name_ = name_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.type_ = type_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.definition_ = definition_; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.revisionId_ = revisionId_; + } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000010) != 0)) { + result.revisionCreateTime_ = + revisionCreateTimeBuilder_ == null + ? revisionCreateTime_ + : revisionCreateTimeBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + result.bitField0_ |= to_bitField0_; } @java.lang.Override @@ -724,6 +830,7 @@ public Builder mergeFrom(com.google.pubsub.v1.Schema other) { if (other == com.google.pubsub.v1.Schema.getDefaultInstance()) return this; if (!other.getName().isEmpty()) { name_ = other.name_; + bitField0_ |= 0x00000001; onChanged(); } if (other.type_ != 0) { @@ -731,9 +838,18 @@ public Builder mergeFrom(com.google.pubsub.v1.Schema other) { } if (!other.getDefinition().isEmpty()) { definition_ = other.definition_; + bitField0_ |= 0x00000004; + onChanged(); + } + if (!other.getRevisionId().isEmpty()) { + revisionId_ = other.revisionId_; + bitField0_ |= 0x00000008; onChanged(); } - this.mergeUnknownFields(other.unknownFields); + if (other.hasRevisionCreateTime()) { + mergeRevisionCreateTime(other.getRevisionCreateTime()); + } + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -748,21 +864,69 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.pubsub.v1.Schema parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + name_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 16: + { + type_ = input.readEnum(); + bitField0_ |= 0x00000002; + break; + } // case 16 + case 26: + { + definition_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000004; + break; + } // case 26 + case 34: + { + revisionId_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000008; + break; + } // case 34 + case 50: + { + input.readMessage( + internalGetRevisionCreateTimeFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000010; + break; + } // case 50 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.google.pubsub.v1.Schema) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } + private int bitField0_; + private java.lang.Object name_ = ""; + /** * * @@ -786,6 +950,7 @@ public java.lang.String getName() { return (java.lang.String) ref; } } + /** * * @@ -809,6 +974,7 @@ public com.google.protobuf.ByteString getNameBytes() { return (com.google.protobuf.ByteString) ref; } } + /** * * @@ -826,11 +992,12 @@ public Builder setName(java.lang.String value) { if (value == null) { throw new NullPointerException(); } - name_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } + /** * * @@ -844,11 +1011,12 @@ public Builder setName(java.lang.String value) { * @return This builder for chaining. */ public Builder clearName() { - name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000001); onChanged(); return this; } + /** * * @@ -867,13 +1035,14 @@ public Builder setNameBytes(com.google.protobuf.ByteString value) { throw new NullPointerException(); } checkByteStringIsUtf8(value); - name_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } private int type_ = 0; + /** * * @@ -889,6 +1058,7 @@ public Builder setNameBytes(com.google.protobuf.ByteString value) { public int getTypeValue() { return type_; } + /** * * @@ -902,11 +1072,12 @@ public int getTypeValue() { * @return This builder for chaining. */ public Builder setTypeValue(int value) { - type_ = value; + bitField0_ |= 0x00000002; onChanged(); return this; } + /** * * @@ -920,10 +1091,10 @@ public Builder setTypeValue(int value) { */ @java.lang.Override public com.google.pubsub.v1.Schema.Type getType() { - @SuppressWarnings("deprecation") - com.google.pubsub.v1.Schema.Type result = com.google.pubsub.v1.Schema.Type.valueOf(type_); + com.google.pubsub.v1.Schema.Type result = com.google.pubsub.v1.Schema.Type.forNumber(type_); return result == null ? com.google.pubsub.v1.Schema.Type.UNRECOGNIZED : result; } + /** * * @@ -940,11 +1111,12 @@ public Builder setType(com.google.pubsub.v1.Schema.Type value) { if (value == null) { throw new NullPointerException(); } - + bitField0_ |= 0x00000002; type_ = value.getNumber(); onChanged(); return this; } + /** * * @@ -957,13 +1129,14 @@ public Builder setType(com.google.pubsub.v1.Schema.Type value) { * @return This builder for chaining. */ public Builder clearType() { - + bitField0_ = (bitField0_ & ~0x00000002); type_ = 0; onChanged(); return this; } private java.lang.Object definition_ = ""; + /** * * @@ -988,6 +1161,7 @@ public java.lang.String getDefinition() { return (java.lang.String) ref; } } + /** * * @@ -1012,6 +1186,7 @@ public com.google.protobuf.ByteString getDefinitionBytes() { return (com.google.protobuf.ByteString) ref; } } + /** * * @@ -1030,11 +1205,12 @@ public Builder setDefinition(java.lang.String value) { if (value == null) { throw new NullPointerException(); } - definition_ = value; + bitField0_ |= 0x00000004; onChanged(); return this; } + /** * * @@ -1049,11 +1225,12 @@ public Builder setDefinition(java.lang.String value) { * @return This builder for chaining. */ public Builder clearDefinition() { - definition_ = getDefaultInstance().getDefinition(); + bitField0_ = (bitField0_ & ~0x00000004); onChanged(); return this; } + /** * * @@ -1073,21 +1250,343 @@ public Builder setDefinitionBytes(com.google.protobuf.ByteString value) { throw new NullPointerException(); } checkByteStringIsUtf8(value); - definition_ = value; + bitField0_ |= 0x00000004; onChanged(); return this; } - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); + private java.lang.Object revisionId_ = ""; + + /** + * + * + *
    +     * Output only. Immutable. The revision ID of the schema.
    +     * 
    + * + * + * string revision_id = 4 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The revisionId. + */ + public java.lang.String getRevisionId() { + java.lang.Object ref = revisionId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + revisionId_ = s; + return s; + } else { + return (java.lang.String) ref; + } } - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); + /** + * + * + *
    +     * Output only. Immutable. The revision ID of the schema.
    +     * 
    + * + * + * string revision_id = 4 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The bytes for revisionId. + */ + public com.google.protobuf.ByteString getRevisionIdBytes() { + java.lang.Object ref = revisionId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + revisionId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +     * Output only. Immutable. The revision ID of the schema.
    +     * 
    + * + * + * string revision_id = 4 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The revisionId to set. + * @return This builder for chaining. + */ + public Builder setRevisionId(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + revisionId_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Output only. Immutable. The revision ID of the schema.
    +     * 
    + * + * + * string revision_id = 4 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return This builder for chaining. + */ + public Builder clearRevisionId() { + revisionId_ = getDefaultInstance().getRevisionId(); + bitField0_ = (bitField0_ & ~0x00000008); + onChanged(); + return this; + } + + /** + * + * + *
    +     * Output only. Immutable. The revision ID of the schema.
    +     * 
    + * + * + * string revision_id = 4 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The bytes for revisionId to set. + * @return This builder for chaining. + */ + public Builder setRevisionIdBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + revisionId_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + + private com.google.protobuf.Timestamp revisionCreateTime_; + private com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + revisionCreateTimeBuilder_; + + /** + * + * + *
    +     * Output only. The timestamp that the revision was created.
    +     * 
    + * + * + * .google.protobuf.Timestamp revision_create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the revisionCreateTime field is set. + */ + public boolean hasRevisionCreateTime() { + return ((bitField0_ & 0x00000010) != 0); + } + + /** + * + * + *
    +     * Output only. The timestamp that the revision was created.
    +     * 
    + * + * + * .google.protobuf.Timestamp revision_create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The revisionCreateTime. + */ + public com.google.protobuf.Timestamp getRevisionCreateTime() { + if (revisionCreateTimeBuilder_ == null) { + return revisionCreateTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : revisionCreateTime_; + } else { + return revisionCreateTimeBuilder_.getMessage(); + } + } + + /** + * + * + *
    +     * Output only. The timestamp that the revision was created.
    +     * 
    + * + * + * .google.protobuf.Timestamp revision_create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setRevisionCreateTime(com.google.protobuf.Timestamp value) { + if (revisionCreateTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + revisionCreateTime_ = value; + } else { + revisionCreateTimeBuilder_.setMessage(value); + } + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Output only. The timestamp that the revision was created.
    +     * 
    + * + * + * .google.protobuf.Timestamp revision_create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setRevisionCreateTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (revisionCreateTimeBuilder_ == null) { + revisionCreateTime_ = builderForValue.build(); + } else { + revisionCreateTimeBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Output only. The timestamp that the revision was created.
    +     * 
    + * + * + * .google.protobuf.Timestamp revision_create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeRevisionCreateTime(com.google.protobuf.Timestamp value) { + if (revisionCreateTimeBuilder_ == null) { + if (((bitField0_ & 0x00000010) != 0) + && revisionCreateTime_ != null + && revisionCreateTime_ != com.google.protobuf.Timestamp.getDefaultInstance()) { + getRevisionCreateTimeBuilder().mergeFrom(value); + } else { + revisionCreateTime_ = value; + } + } else { + revisionCreateTimeBuilder_.mergeFrom(value); + } + if (revisionCreateTime_ != null) { + bitField0_ |= 0x00000010; + onChanged(); + } + return this; + } + + /** + * + * + *
    +     * Output only. The timestamp that the revision was created.
    +     * 
    + * + * + * .google.protobuf.Timestamp revision_create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearRevisionCreateTime() { + bitField0_ = (bitField0_ & ~0x00000010); + revisionCreateTime_ = null; + if (revisionCreateTimeBuilder_ != null) { + revisionCreateTimeBuilder_.dispose(); + revisionCreateTimeBuilder_ = null; + } + onChanged(); + return this; + } + + /** + * + * + *
    +     * Output only. The timestamp that the revision was created.
    +     * 
    + * + * + * .google.protobuf.Timestamp revision_create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp.Builder getRevisionCreateTimeBuilder() { + bitField0_ |= 0x00000010; + onChanged(); + return internalGetRevisionCreateTimeFieldBuilder().getBuilder(); + } + + /** + * + * + *
    +     * Output only. The timestamp that the revision was created.
    +     * 
    + * + * + * .google.protobuf.Timestamp revision_create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.TimestampOrBuilder getRevisionCreateTimeOrBuilder() { + if (revisionCreateTimeBuilder_ != null) { + return revisionCreateTimeBuilder_.getMessageOrBuilder(); + } else { + return revisionCreateTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : revisionCreateTime_; + } + } + + /** + * + * + *
    +     * Output only. The timestamp that the revision was created.
    +     * 
    + * + * + * .google.protobuf.Timestamp revision_create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + internalGetRevisionCreateTimeFieldBuilder() { + if (revisionCreateTimeBuilder_ == null) { + revisionCreateTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getRevisionCreateTime(), getParentForChildren(), isClean()); + revisionCreateTime_ = null; + } + return revisionCreateTimeBuilder_; } // @@protoc_insertion_point(builder_scope:google.pubsub.v1.Schema) @@ -1111,7 +1610,18 @@ public Schema parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new Schema(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SchemaName.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SchemaName.java index 658f517c0..b3eaa772f 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SchemaName.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SchemaName.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 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 + * 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, @@ -23,19 +23,29 @@ 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 */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class SchemaName implements ResourceName { - - private static final PathTemplate PATH_TEMPLATE = + private static final PathTemplate PROJECT_SCHEMA = PathTemplate.createWithoutUrlEncoding("projects/{project}/schemas/{schema}"); - private volatile Map fieldValuesMap; - private final String project; private final String schema; + @Deprecated + protected SchemaName() { + project = null; + schema = null; + } + + private SchemaName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + schema = Preconditions.checkNotNull(builder.getSchema()); + } + public String getProject() { return project; } @@ -52,11 +62,6 @@ public Builder toBuilder() { return new Builder(this); } - private SchemaName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - schema = Preconditions.checkNotNull(builder.getSchema()); - } - public static SchemaName of(String project, String schema) { return newBuilder().setProject(project).setSchema(schema).build(); } @@ -70,7 +75,7 @@ public static SchemaName parse(String formattedString) { return null; } Map matchMap = - PATH_TEMPLATE.validatedMatch( + PROJECT_SCHEMA.validatedMatch( formattedString, "SchemaName.parse: formattedString not in valid format"); return of(matchMap.get("project"), matchMap.get("schema")); } @@ -84,7 +89,7 @@ public static List parseList(List formattedStrings) { } public static List toStringList(List values) { - List list = new ArrayList(values.size()); + List list = new ArrayList<>(values.size()); for (SchemaName value : values) { if (value == null) { list.add(""); @@ -96,16 +101,21 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PATH_TEMPLATE.matches(formattedString); + return PROJECT_SCHEMA.matches(formattedString); } + @Override public Map getFieldValuesMap() { if (fieldValuesMap == null) { synchronized (this) { if (fieldValuesMap == null) { ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); - fieldMapBuilder.put("project", project); - fieldMapBuilder.put("schema", schema); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (schema != null) { + fieldMapBuilder.put("schema", schema); + } fieldValuesMap = fieldMapBuilder.build(); } } @@ -119,15 +129,38 @@ public String getFieldValue(String fieldName) { @Override public String toString() { - return PATH_TEMPLATE.instantiate("project", project, "schema", schema); + return PROJECT_SCHEMA.instantiate("project", project, "schema", schema); } - /** Builder for SchemaName. */ - public static class Builder { + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null && getClass() == o.getClass()) { + SchemaName that = ((SchemaName) o); + return Objects.equals(this.project, that.project) && Objects.equals(this.schema, that.schema); + } + return false; + } + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(schema); + return h; + } + + /** Builder for projects/{project}/schemas/{schema}. */ + public static class Builder { private String project; private String schema; + protected Builder() {} + public String getProject() { return project; } @@ -146,37 +179,13 @@ public Builder setSchema(String schema) { return this; } - private Builder() {} - private Builder(SchemaName schemaName) { - project = schemaName.project; - schema = schemaName.schema; + this.project = schemaName.project; + this.schema = schemaName.schema; } public SchemaName build() { return new SchemaName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o instanceof SchemaName) { - SchemaName that = (SchemaName) o; - return (this.project.equals(that.project)) && (this.schema.equals(that.schema)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= project.hashCode(); - h *= 1000003; - h ^= schema.hashCode(); - return h; - } } diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SchemaOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SchemaOrBuilder.java index 30c88d8aa..07b9739b1 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SchemaOrBuilder.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SchemaOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/schema.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; +@com.google.protobuf.Generated public interface SchemaOrBuilder extends // @@protoc_insertion_point(interface_extends:google.pubsub.v1.Schema) @@ -36,6 +39,7 @@ public interface SchemaOrBuilder * @return The name. */ java.lang.String getName(); + /** * * @@ -62,6 +66,7 @@ public interface SchemaOrBuilder * @return The enum numeric value on the wire for type. */ int getTypeValue(); + /** * * @@ -89,6 +94,7 @@ public interface SchemaOrBuilder * @return The definition. */ java.lang.String getDefinition(); + /** * * @@ -103,4 +109,77 @@ public interface SchemaOrBuilder * @return The bytes for definition. */ com.google.protobuf.ByteString getDefinitionBytes(); + + /** + * + * + *
    +   * Output only. Immutable. The revision ID of the schema.
    +   * 
    + * + * + * string revision_id = 4 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The revisionId. + */ + java.lang.String getRevisionId(); + + /** + * + * + *
    +   * Output only. Immutable. The revision ID of the schema.
    +   * 
    + * + * + * string revision_id = 4 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The bytes for revisionId. + */ + com.google.protobuf.ByteString getRevisionIdBytes(); + + /** + * + * + *
    +   * Output only. The timestamp that the revision was created.
    +   * 
    + * + * + * .google.protobuf.Timestamp revision_create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the revisionCreateTime field is set. + */ + boolean hasRevisionCreateTime(); + + /** + * + * + *
    +   * Output only. The timestamp that the revision was created.
    +   * 
    + * + * + * .google.protobuf.Timestamp revision_create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The revisionCreateTime. + */ + com.google.protobuf.Timestamp getRevisionCreateTime(); + + /** + * + * + *
    +   * Output only. The timestamp that the revision was created.
    +   * 
    + * + * + * .google.protobuf.Timestamp revision_create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.protobuf.TimestampOrBuilder getRevisionCreateTimeOrBuilder(); } diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SchemaProto.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SchemaProto.java index f692cb891..6964d4e1d 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SchemaProto.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SchemaProto.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,13 +14,26 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/schema.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; -public final class SchemaProto { +@com.google.protobuf.Generated +public final class SchemaProto extends com.google.protobuf.GeneratedFile { private SchemaProto() {} + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "SchemaProto"); + } + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistryLite registry) {} public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) { @@ -29,43 +42,63 @@ public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry r static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_Schema_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_Schema_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_CreateSchemaRequest_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_CreateSchemaRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_GetSchemaRequest_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_GetSchemaRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_ListSchemasRequest_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_ListSchemasRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_ListSchemasResponse_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_ListSchemasResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_pubsub_v1_ListSchemaRevisionsRequest_descriptor; + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_google_pubsub_v1_ListSchemaRevisionsRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_pubsub_v1_ListSchemaRevisionsResponse_descriptor; + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_google_pubsub_v1_ListSchemaRevisionsResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_pubsub_v1_CommitSchemaRequest_descriptor; + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_google_pubsub_v1_CommitSchemaRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_pubsub_v1_RollbackSchemaRequest_descriptor; + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_google_pubsub_v1_RollbackSchemaRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_pubsub_v1_DeleteSchemaRevisionRequest_descriptor; + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_google_pubsub_v1_DeleteSchemaRevisionRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_DeleteSchemaRequest_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_DeleteSchemaRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_ValidateSchemaRequest_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_ValidateSchemaRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_ValidateSchemaResponse_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_ValidateSchemaResponse_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_ValidateMessageRequest_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_ValidateMessageRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_pubsub_v1_ValidateMessageResponse_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_google_pubsub_v1_ValidateMessageResponse_fieldAccessorTable; public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { @@ -80,73 +113,107 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "pubsub.v1\032\034google/api/annotations.proto\032" + "\027google/api/client.proto\032\037google/api/fie" + "ld_behavior.proto\032\031google/api/resource.p" - + "roto\032\033google/protobuf/empty.proto\"\341\001\n\006Sc" - + "hema\022\021\n\004name\030\001 \001(\tB\003\340A\002\022+\n\004type\030\002 \001(\0162\035." - + "google.pubsub.v1.Schema.Type\022\022\n\ndefiniti" - + "on\030\003 \001(\t\";\n\004Type\022\024\n\020TYPE_UNSPECIFIED\020\000\022\023" - + "\n\017PROTOCOL_BUFFER\020\001\022\010\n\004AVRO\020\002:F\352AC\n\034pubs" - + "ub.googleapis.com/Schema\022#projects/{proj" - + "ect}/schemas/{schema}\"\215\001\n\023CreateSchemaRe" - + "quest\0224\n\006parent\030\001 \001(\tB$\340A\002\372A\036\022\034pubsub.go" - + "ogleapis.com/Schema\022-\n\006schema\030\002 \001(\0132\030.go" - + "ogle.pubsub.v1.SchemaB\003\340A\002\022\021\n\tschema_id\030" - + "\003 \001(\t\"r\n\020GetSchemaRequest\0222\n\004name\030\001 \001(\tB" - + "$\340A\002\372A\036\n\034pubsub.googleapis.com/Schema\022*\n" - + "\004view\030\002 \001(\0162\034.google.pubsub.v1.SchemaVie" - + "w\"\254\001\n\022ListSchemasRequest\022C\n\006parent\030\001 \001(\t" - + "B3\340A\002\372A-\n+cloudresourcemanager.googleapi" - + "s.com/Project\022*\n\004view\030\002 \001(\0162\034.google.pub" - + "sub.v1.SchemaView\022\021\n\tpage_size\030\003 \001(\005\022\022\n\n" - + "page_token\030\004 \001(\t\"Y\n\023ListSchemasResponse\022" - + ")\n\007schemas\030\001 \003(\0132\030.google.pubsub.v1.Sche" - + "ma\022\027\n\017next_page_token\030\002 \001(\t\"I\n\023DeleteSch" - + "emaRequest\0222\n\004name\030\001 \001(\tB$\340A\002\372A\036\n\034pubsub" - + ".googleapis.com/Schema\"\213\001\n\025ValidateSchem" - + "aRequest\022C\n\006parent\030\001 \001(\tB3\340A\002\372A-\n+cloudr" - + "esourcemanager.googleapis.com/Project\022-\n" - + "\006schema\030\002 \001(\0132\030.google.pubsub.v1.SchemaB" - + "\003\340A\002\"\030\n\026ValidateSchemaResponse\"\212\002\n\026Valid" - + "ateMessageRequest\022C\n\006parent\030\001 \001(\tB3\340A\002\372A" - + "-\n+cloudresourcemanager.googleapis.com/P" - + "roject\0221\n\004name\030\002 \001(\tB!\372A\036\n\034pubsub.google" - + "apis.com/SchemaH\000\022*\n\006schema\030\003 \001(\0132\030.goog" - + "le.pubsub.v1.SchemaH\000\022\017\n\007message\030\004 \001(\014\022," - + "\n\010encoding\030\005 \001(\0162\032.google.pubsub.v1.Enco" - + "dingB\r\n\013schema_spec\"\031\n\027ValidateMessageRe" - + "sponse*>\n\nSchemaView\022\033\n\027SCHEMA_VIEW_UNSP" - + "ECIFIED\020\000\022\t\n\005BASIC\020\001\022\010\n\004FULL\020\002*:\n\010Encodi" - + "ng\022\030\n\024ENCODING_UNSPECIFIED\020\000\022\010\n\004JSON\020\001\022\n" - + "\n\006BINARY\020\0022\367\007\n\rSchemaService\022\232\001\n\014CreateS" - + "chema\022%.google.pubsub.v1.CreateSchemaReq" - + "uest\032\030.google.pubsub.v1.Schema\"I\202\323\344\223\002)\"\037" - + "/v1/{parent=projects/*}/schemas:\006schema\332" - + "A\027parent,schema,schema_id\022y\n\tGetSchema\022\"" - + ".google.pubsub.v1.GetSchemaRequest\032\030.goo" - + "gle.pubsub.v1.Schema\".\202\323\344\223\002!\022\037/v1/{name=" - + "projects/*/schemas/*}\332A\004name\022\214\001\n\013ListSch" - + "emas\022$.google.pubsub.v1.ListSchemasReque" - + "st\032%.google.pubsub.v1.ListSchemasRespons" - + "e\"0\202\323\344\223\002!\022\037/v1/{parent=projects/*}/schem" - + "as\332A\006parent\022}\n\014DeleteSchema\022%.google.pub" - + "sub.v1.DeleteSchemaRequest\032\026.google.prot" - + "obuf.Empty\".\202\323\344\223\002!*\037/v1/{name=projects/*" - + "/schemas/*}\332A\004name\022\250\001\n\016ValidateSchema\022\'." - + "google.pubsub.v1.ValidateSchemaRequest\032(" - + ".google.pubsub.v1.ValidateSchemaResponse" - + "\"C\202\323\344\223\002-\"(/v1/{parent=projects/*}/schema" - + "s:validate:\001*\332A\rparent,schema\022\242\001\n\017Valida" - + "teMessage\022(.google.pubsub.v1.ValidateMes" - + "sageRequest\032).google.pubsub.v1.ValidateM" - + "essageResponse\":\202\323\344\223\0024\"//v1/{parent=proj" - + "ects/*}/schemas:validateMessage:\001*\032p\312A\025p" - + "ubsub.googleapis.com\322AUhttps://www.googl" - + "eapis.com/auth/cloud-platform,https://ww" - + "w.googleapis.com/auth/pubsubB\256\001\n\024com.goo" - + "gle.pubsub.v1B\013SchemaProtoP\001Z6google.gol" - + "ang.org/genproto/googleapis/pubsub/v1;pu" - + "bsub\370\001\001\252\002\026Google.Cloud.PubSub.V1\312\002\026Googl" - + "e\\Cloud\\PubSub\\V1\352\002\031Google::Cloud::PubSu" - + "b::V1b\006proto3" + + "roto\032\033google/protobuf/empty.proto\032\037googl" + + "e/protobuf/timestamp.proto\"\275\002\n\006Schema\022\021\n" + + "\004name\030\001 \001(\tB\003\340A\002\022+\n\004type\030\002 \001(\0162\035.google." + + "pubsub.v1.Schema.Type\022\022\n\ndefinition\030\003 \001(" + + "\t\022\033\n\013revision_id\030\004 \001(\tB\006\340A\005\340A\003\022=\n\024revisi" + + "on_create_time\030\006 \001(\0132\032.google.protobuf.T" + + "imestampB\003\340A\003\";\n\004Type\022\024\n\020TYPE_UNSPECIFIE" + + "D\020\000\022\023\n\017PROTOCOL_BUFFER\020\001\022\010\n\004AVRO\020\002:F\352AC\n" + + "\034pubsub.googleapis.com/Schema\022#projects/" + + "{project}/schemas/{schema}\"\215\001\n\023CreateSch" + + "emaRequest\0224\n\006parent\030\001 \001(\tB$\340A\002\372A\036\022\034pubs" + + "ub.googleapis.com/Schema\022-\n\006schema\030\002 \001(\013" + + "2\030.google.pubsub.v1.SchemaB\003\340A\002\022\021\n\tschem" + + "a_id\030\003 \001(\t\"r\n\020GetSchemaRequest\0222\n\004name\030\001" + + " \001(\tB$\340A\002\372A\036\n\034pubsub.googleapis.com/Sche" + + "ma\022*\n\004view\030\002 \001(\0162\034.google.pubsub.v1.Sche" + + "maView\"\254\001\n\022ListSchemasRequest\022C\n\006parent\030" + + "\001 \001(\tB3\340A\002\372A-\n+cloudresourcemanager.goog" + + "leapis.com/Project\022*\n\004view\030\002 \001(\0162\034.googl" + + "e.pubsub.v1.SchemaView\022\021\n\tpage_size\030\003 \001(" + + "\005\022\022\n\npage_token\030\004 \001(\t\"Y\n\023ListSchemasResp" + + "onse\022)\n\007schemas\030\001 \003(\0132\030.google.pubsub.v1" + + ".Schema\022\027\n\017next_page_token\030\002 \001(\t\"\243\001\n\032Lis" + + "tSchemaRevisionsRequest\0222\n\004name\030\001 \001(\tB$\340" + + "A\002\372A\036\n\034pubsub.googleapis.com/Schema\022*\n\004v" + + "iew\030\002 \001(\0162\034.google.pubsub.v1.SchemaView\022" + + "\021\n\tpage_size\030\003 \001(\005\022\022\n\npage_token\030\004 \001(\t\"a" + + "\n\033ListSchemaRevisionsResponse\022)\n\007schemas" + + "\030\001 \003(\0132\030.google.pubsub.v1.Schema\022\027\n\017next" + + "_page_token\030\002 \001(\t\"x\n\023CommitSchemaRequest" + + "\0222\n\004name\030\001 \001(\tB$\340A\002\372A\036\n\034pubsub.googleapi" + + "s.com/Schema\022-\n\006schema\030\002 \001(\0132\030.google.pu" + + "bsub.v1.SchemaB\003\340A\002\"e\n\025RollbackSchemaReq" + + "uest\0222\n\004name\030\001 \001(\tB$\340A\002\372A\036\n\034pubsub.googl" + + "eapis.com/Schema\022\030\n\013revision_id\030\002 \001(\tB\003\340" + + "A\002\"m\n\033DeleteSchemaRevisionRequest\0222\n\004nam" + + "e\030\001 \001(\tB$\340A\002\372A\036\n\034pubsub.googleapis.com/S" + + "chema\022\032\n\013revision_id\030\002 \001(\tB\005\030\001\340A\001\"I\n\023Del" + + "eteSchemaRequest\0222\n\004name\030\001 \001(\tB$\340A\002\372A\036\n\034" + + "pubsub.googleapis.com/Schema\"\213\001\n\025Validat" + + "eSchemaRequest\022C\n\006parent\030\001 \001(\tB3\340A\002\372A-\n+" + + "cloudresourcemanager.googleapis.com/Proj" + + "ect\022-\n\006schema\030\002 \001(\0132\030.google.pubsub.v1.S" + + "chemaB\003\340A\002\"\030\n\026ValidateSchemaResponse\"\212\002\n" + + "\026ValidateMessageRequest\022C\n\006parent\030\001 \001(\tB" + + "3\340A\002\372A-\n+cloudresourcemanager.googleapis" + + ".com/Project\0221\n\004name\030\002 \001(\tB!\372A\036\n\034pubsub." + + "googleapis.com/SchemaH\000\022*\n\006schema\030\003 \001(\0132" + + "\030.google.pubsub.v1.SchemaH\000\022\017\n\007message\030\004" + + " \001(\014\022,\n\010encoding\030\005 \001(\0162\032.google.pubsub.v" + + "1.EncodingB\r\n\013schema_spec\"\031\n\027ValidateMes" + + "sageResponse*>\n\nSchemaView\022\033\n\027SCHEMA_VIE" + + "W_UNSPECIFIED\020\000\022\t\n\005BASIC\020\001\022\010\n\004FULL\020\002*:\n\010" + + "Encoding\022\030\n\024ENCODING_UNSPECIFIED\020\000\022\010\n\004JS" + + "ON\020\001\022\n\n\006BINARY\020\0022\210\r\n\rSchemaService\022\232\001\n\014C" + + "reateSchema\022%.google.pubsub.v1.CreateSch" + + "emaRequest\032\030.google.pubsub.v1.Schema\"I\332A" + + "\027parent,schema,schema_id\202\323\344\223\002)\"\037/v1/{par" + + "ent=projects/*}/schemas:\006schema\022y\n\tGetSc" + + "hema\022\".google.pubsub.v1.GetSchemaRequest" + + "\032\030.google.pubsub.v1.Schema\".\332A\004name\202\323\344\223\002" + + "!\022\037/v1/{name=projects/*/schemas/*}\022\214\001\n\013L" + + "istSchemas\022$.google.pubsub.v1.ListSchema" + + "sRequest\032%.google.pubsub.v1.ListSchemasR" + + "esponse\"0\332A\006parent\202\323\344\223\002!\022\037/v1/{parent=pr" + + "ojects/*}/schemas\022\260\001\n\023ListSchemaRevision" + + "s\022,.google.pubsub.v1.ListSchemaRevisions" + + "Request\032-.google.pubsub.v1.ListSchemaRev" + + "isionsResponse\"<\332A\004name\202\323\344\223\002/\022-/v1/{name" + + "=projects/*/schemas/*}:listRevisions\022\220\001\n" + + "\014CommitSchema\022%.google.pubsub.v1.CommitS" + + "chemaRequest\032\030.google.pubsub.v1.Schema\"?" + + "\332A\013name,schema\202\323\344\223\002+\"&/v1/{name=projects" + + "/*/schemas/*}:commit:\001*\022\233\001\n\016RollbackSche" + + "ma\022\'.google.pubsub.v1.RollbackSchemaRequ" + + "est\032\030.google.pubsub.v1.Schema\"F\332A\020name,r" + + "evision_id\202\323\344\223\002-\"(/v1/{name=projects/*/s" + + "chemas/*}:rollback:\001*\022\252\001\n\024DeleteSchemaRe" + + "vision\022-.google.pubsub.v1.DeleteSchemaRe" + + "visionRequest\032\030.google.pubsub.v1.Schema\"" + + "I\332A\020name,revision_id\202\323\344\223\0020*./v1/{name=pr" + + "ojects/*/schemas/*}:deleteRevision\022}\n\014De" + + "leteSchema\022%.google.pubsub.v1.DeleteSche" + + "maRequest\032\026.google.protobuf.Empty\".\332A\004na" + + "me\202\323\344\223\002!*\037/v1/{name=projects/*/schemas/*" + + "}\022\250\001\n\016ValidateSchema\022\'.google.pubsub.v1." + + "ValidateSchemaRequest\032(.google.pubsub.v1" + + ".ValidateSchemaResponse\"C\332A\rparent,schem" + + "a\202\323\344\223\002-\"(/v1/{parent=projects/*}/schemas" + + ":validate:\001*\022\242\001\n\017ValidateMessage\022(.googl" + + "e.pubsub.v1.ValidateMessageRequest\032).goo" + + "gle.pubsub.v1.ValidateMessageResponse\":\202" + + "\323\344\223\0024\"//v1/{parent=projects/*}/schemas:v" + + "alidateMessage:\001*\032p\312A\025pubsub.googleapis." + + "com\322AUhttps://www.googleapis.com/auth/cl" + + "oud-platform,https://www.googleapis.com/" + + "auth/pubsubB\252\001\n\024com.google.pubsub.v1B\013Sc" + + "hemaProtoP\001Z5cloud.google.com/go/pubsub/" + + "v2/apiv1/pubsubpb;pubsubpb\252\002\026Google.Clou" + + "d.PubSub.V1\312\002\026Google\\Cloud\\PubSub\\V1\352\002\031G" + + "oogle::Cloud::PubSub::V1b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( @@ -157,82 +224,130 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { com.google.api.FieldBehaviorProto.getDescriptor(), com.google.api.ResourceProto.getDescriptor(), com.google.protobuf.EmptyProto.getDescriptor(), + com.google.protobuf.TimestampProto.getDescriptor(), }); - internal_static_google_pubsub_v1_Schema_descriptor = getDescriptor().getMessageTypes().get(0); + internal_static_google_pubsub_v1_Schema_descriptor = getDescriptor().getMessageType(0); internal_static_google_pubsub_v1_Schema_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_Schema_descriptor, new java.lang.String[] { - "Name", "Type", "Definition", + "Name", "Type", "Definition", "RevisionId", "RevisionCreateTime", }); internal_static_google_pubsub_v1_CreateSchemaRequest_descriptor = - getDescriptor().getMessageTypes().get(1); + getDescriptor().getMessageType(1); internal_static_google_pubsub_v1_CreateSchemaRequest_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_CreateSchemaRequest_descriptor, new java.lang.String[] { "Parent", "Schema", "SchemaId", }); internal_static_google_pubsub_v1_GetSchemaRequest_descriptor = - getDescriptor().getMessageTypes().get(2); + getDescriptor().getMessageType(2); internal_static_google_pubsub_v1_GetSchemaRequest_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_GetSchemaRequest_descriptor, new java.lang.String[] { "Name", "View", }); internal_static_google_pubsub_v1_ListSchemasRequest_descriptor = - getDescriptor().getMessageTypes().get(3); + getDescriptor().getMessageType(3); internal_static_google_pubsub_v1_ListSchemasRequest_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_ListSchemasRequest_descriptor, new java.lang.String[] { "Parent", "View", "PageSize", "PageToken", }); internal_static_google_pubsub_v1_ListSchemasResponse_descriptor = - getDescriptor().getMessageTypes().get(4); + getDescriptor().getMessageType(4); internal_static_google_pubsub_v1_ListSchemasResponse_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_ListSchemasResponse_descriptor, new java.lang.String[] { "Schemas", "NextPageToken", }); + internal_static_google_pubsub_v1_ListSchemaRevisionsRequest_descriptor = + getDescriptor().getMessageType(5); + internal_static_google_pubsub_v1_ListSchemaRevisionsRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_google_pubsub_v1_ListSchemaRevisionsRequest_descriptor, + new java.lang.String[] { + "Name", "View", "PageSize", "PageToken", + }); + internal_static_google_pubsub_v1_ListSchemaRevisionsResponse_descriptor = + getDescriptor().getMessageType(6); + internal_static_google_pubsub_v1_ListSchemaRevisionsResponse_fieldAccessorTable = + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_google_pubsub_v1_ListSchemaRevisionsResponse_descriptor, + new java.lang.String[] { + "Schemas", "NextPageToken", + }); + internal_static_google_pubsub_v1_CommitSchemaRequest_descriptor = + getDescriptor().getMessageType(7); + internal_static_google_pubsub_v1_CommitSchemaRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_google_pubsub_v1_CommitSchemaRequest_descriptor, + new java.lang.String[] { + "Name", "Schema", + }); + internal_static_google_pubsub_v1_RollbackSchemaRequest_descriptor = + getDescriptor().getMessageType(8); + internal_static_google_pubsub_v1_RollbackSchemaRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_google_pubsub_v1_RollbackSchemaRequest_descriptor, + new java.lang.String[] { + "Name", "RevisionId", + }); + internal_static_google_pubsub_v1_DeleteSchemaRevisionRequest_descriptor = + getDescriptor().getMessageType(9); + internal_static_google_pubsub_v1_DeleteSchemaRevisionRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_google_pubsub_v1_DeleteSchemaRevisionRequest_descriptor, + new java.lang.String[] { + "Name", "RevisionId", + }); internal_static_google_pubsub_v1_DeleteSchemaRequest_descriptor = - getDescriptor().getMessageTypes().get(5); + getDescriptor().getMessageType(10); internal_static_google_pubsub_v1_DeleteSchemaRequest_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_DeleteSchemaRequest_descriptor, new java.lang.String[] { "Name", }); internal_static_google_pubsub_v1_ValidateSchemaRequest_descriptor = - getDescriptor().getMessageTypes().get(6); + getDescriptor().getMessageType(11); internal_static_google_pubsub_v1_ValidateSchemaRequest_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_ValidateSchemaRequest_descriptor, new java.lang.String[] { "Parent", "Schema", }); internal_static_google_pubsub_v1_ValidateSchemaResponse_descriptor = - getDescriptor().getMessageTypes().get(7); + getDescriptor().getMessageType(12); internal_static_google_pubsub_v1_ValidateSchemaResponse_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_ValidateSchemaResponse_descriptor, new java.lang.String[] {}); internal_static_google_pubsub_v1_ValidateMessageRequest_descriptor = - getDescriptor().getMessageTypes().get(8); + getDescriptor().getMessageType(13); internal_static_google_pubsub_v1_ValidateMessageRequest_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_ValidateMessageRequest_descriptor, new java.lang.String[] { "Parent", "Name", "Schema", "Message", "Encoding", "SchemaSpec", }); internal_static_google_pubsub_v1_ValidateMessageResponse_descriptor = - getDescriptor().getMessageTypes().get(9); + getDescriptor().getMessageType(14); internal_static_google_pubsub_v1_ValidateMessageResponse_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_google_pubsub_v1_ValidateMessageResponse_descriptor, new java.lang.String[] {}); + descriptor.resolveAllFeaturesImmutable(); + com.google.api.AnnotationsProto.getDescriptor(); + com.google.api.ClientProto.getDescriptor(); + com.google.api.FieldBehaviorProto.getDescriptor(); + com.google.api.ResourceProto.getDescriptor(); + com.google.protobuf.EmptyProto.getDescriptor(); + com.google.protobuf.TimestampProto.getDescriptor(); com.google.protobuf.ExtensionRegistry registry = com.google.protobuf.ExtensionRegistry.newInstance(); registry.add(com.google.api.ClientProto.defaultHost); @@ -244,11 +359,6 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { registry.add(com.google.api.ResourceProto.resourceReference); com.google.protobuf.Descriptors.FileDescriptor.internalUpdateFileDescriptor( descriptor, registry); - com.google.api.AnnotationsProto.getDescriptor(); - com.google.api.ClientProto.getDescriptor(); - com.google.api.FieldBehaviorProto.getDescriptor(); - com.google.api.ResourceProto.getDescriptor(); - com.google.protobuf.EmptyProto.getDescriptor(); } // @@protoc_insertion_point(outer_class_scope) diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SchemaSettings.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SchemaSettings.java index bca71d432..b7f4a37ae 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SchemaSettings.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SchemaSettings.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; @@ -27,81 +29,33 @@ * * Protobuf type {@code google.pubsub.v1.SchemaSettings} */ -public final class SchemaSettings extends com.google.protobuf.GeneratedMessageV3 +@com.google.protobuf.Generated +public final class SchemaSettings extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:google.pubsub.v1.SchemaSettings) SchemaSettingsOrBuilder { private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "SchemaSettings"); + } + // Use SchemaSettings.newBuilder() to construct. - private SchemaSettings(com.google.protobuf.GeneratedMessageV3.Builder builder) { + private SchemaSettings(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); } private SchemaSettings() { schema_ = ""; encoding_ = 0; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new SchemaSettings(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - private SchemaSettings( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - java.lang.String s = input.readStringRequireUtf8(); - - schema_ = s; - break; - } - case 16: - { - int rawValue = input.readEnum(); - - encoding_ = rawValue; - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } + firstRevisionId_ = ""; + lastRevisionId_ = ""; } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { @@ -110,7 +64,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_SchemaSettings_fieldAccessorTable @@ -120,7 +74,10 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } public static final int SCHEMA_FIELD_NUMBER = 1; - private volatile java.lang.Object schema_; + + @SuppressWarnings("serial") + private volatile java.lang.Object schema_ = ""; + /** * * @@ -149,6 +106,7 @@ public java.lang.String getSchema() { return s; } } + /** * * @@ -179,15 +137,16 @@ public com.google.protobuf.ByteString getSchemaBytes() { } public static final int ENCODING_FIELD_NUMBER = 2; - private int encoding_; + private int encoding_ = 0; + /** * * *
    -   * The encoding of messages validated against `schema`.
    +   * Optional. The encoding of messages validated against `schema`.
        * 
    * - * .google.pubsub.v1.Encoding encoding = 2; + * .google.pubsub.v1.Encoding encoding = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The enum numeric value on the wire for encoding. */ @@ -195,24 +154,138 @@ public com.google.protobuf.ByteString getSchemaBytes() { public int getEncodingValue() { return encoding_; } + /** * * *
    -   * The encoding of messages validated against `schema`.
    +   * Optional. The encoding of messages validated against `schema`.
        * 
    * - * .google.pubsub.v1.Encoding encoding = 2; + * .google.pubsub.v1.Encoding encoding = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The encoding. */ @java.lang.Override public com.google.pubsub.v1.Encoding getEncoding() { - @SuppressWarnings("deprecation") - com.google.pubsub.v1.Encoding result = com.google.pubsub.v1.Encoding.valueOf(encoding_); + com.google.pubsub.v1.Encoding result = com.google.pubsub.v1.Encoding.forNumber(encoding_); return result == null ? com.google.pubsub.v1.Encoding.UNRECOGNIZED : result; } + public static final int FIRST_REVISION_ID_FIELD_NUMBER = 3; + + @SuppressWarnings("serial") + private volatile java.lang.Object firstRevisionId_ = ""; + + /** + * + * + *
    +   * Optional. The minimum (inclusive) revision allowed for validating messages.
    +   * If empty or not present, allow any revision to be validated against
    +   * last_revision or any revision created before.
    +   * 
    + * + * string first_revision_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The firstRevisionId. + */ + @java.lang.Override + public java.lang.String getFirstRevisionId() { + java.lang.Object ref = firstRevisionId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + firstRevisionId_ = s; + return s; + } + } + + /** + * + * + *
    +   * Optional. The minimum (inclusive) revision allowed for validating messages.
    +   * If empty or not present, allow any revision to be validated against
    +   * last_revision or any revision created before.
    +   * 
    + * + * string first_revision_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for firstRevisionId. + */ + @java.lang.Override + public com.google.protobuf.ByteString getFirstRevisionIdBytes() { + java.lang.Object ref = firstRevisionId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + firstRevisionId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int LAST_REVISION_ID_FIELD_NUMBER = 4; + + @SuppressWarnings("serial") + private volatile java.lang.Object lastRevisionId_ = ""; + + /** + * + * + *
    +   * Optional. The maximum (inclusive) revision allowed for validating messages.
    +   * If empty or not present, allow any revision to be validated against
    +   * first_revision or any revision created after.
    +   * 
    + * + * string last_revision_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The lastRevisionId. + */ + @java.lang.Override + public java.lang.String getLastRevisionId() { + java.lang.Object ref = lastRevisionId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + lastRevisionId_ = s; + return s; + } + } + + /** + * + * + *
    +   * Optional. The maximum (inclusive) revision allowed for validating messages.
    +   * If empty or not present, allow any revision to be validated against
    +   * first_revision or any revision created after.
    +   * 
    + * + * string last_revision_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for lastRevisionId. + */ + @java.lang.Override + public com.google.protobuf.ByteString getLastRevisionIdBytes() { + java.lang.Object ref = lastRevisionId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + lastRevisionId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -227,13 +300,19 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!getSchemaBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, schema_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(schema_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, schema_); } if (encoding_ != com.google.pubsub.v1.Encoding.ENCODING_UNSPECIFIED.getNumber()) { output.writeEnum(2, encoding_); } - unknownFields.writeTo(output); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(firstRevisionId_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 3, firstRevisionId_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(lastRevisionId_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 4, lastRevisionId_); + } + getUnknownFields().writeTo(output); } @java.lang.Override @@ -242,13 +321,19 @@ public int getSerializedSize() { if (size != -1) return size; size = 0; - if (!getSchemaBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, schema_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(schema_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, schema_); } if (encoding_ != com.google.pubsub.v1.Encoding.ENCODING_UNSPECIFIED.getNumber()) { size += com.google.protobuf.CodedOutputStream.computeEnumSize(2, encoding_); } - size += unknownFields.getSerializedSize(); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(firstRevisionId_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(3, firstRevisionId_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(lastRevisionId_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(4, lastRevisionId_); + } + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -265,7 +350,9 @@ public boolean equals(final java.lang.Object obj) { if (!getSchema().equals(other.getSchema())) return false; if (encoding_ != other.encoding_) return false; - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getFirstRevisionId().equals(other.getFirstRevisionId())) return false; + if (!getLastRevisionId().equals(other.getLastRevisionId())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -280,7 +367,11 @@ public int hashCode() { hash = (53 * hash) + getSchema().hashCode(); hash = (37 * hash) + ENCODING_FIELD_NUMBER; hash = (53 * hash) + encoding_; - hash = (29 * hash) + unknownFields.hashCode(); + hash = (37 * hash) + FIRST_REVISION_ID_FIELD_NUMBER; + hash = (53 * hash) + getFirstRevisionId().hashCode(); + hash = (37 * hash) + LAST_REVISION_ID_FIELD_NUMBER; + hash = (53 * hash) + getLastRevisionId().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -321,38 +412,38 @@ public static com.google.pubsub.v1.SchemaSettings parseFrom( public static com.google.pubsub.v1.SchemaSettings parseFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.SchemaSettings parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.SchemaSettings parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); } public static com.google.pubsub.v1.SchemaSettings parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.SchemaSettings parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.SchemaSettings parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } @@ -375,10 +466,11 @@ public Builder toBuilder() { } @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** * * @@ -388,7 +480,7 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build * * Protobuf type {@code google.pubsub.v1.SchemaSettings} */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements // @@protoc_insertion_point(builder_implements:google.pubsub.v1.SchemaSettings) com.google.pubsub.v1.SchemaSettingsOrBuilder { @@ -398,7 +490,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_SchemaSettings_fieldAccessorTable @@ -408,26 +500,20 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } // Construct using com.google.pubsub.v1.SchemaSettings.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } + private Builder() {} - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} } @java.lang.Override public Builder clear() { super.clear(); + bitField0_ = 0; schema_ = ""; - encoding_ = 0; - + firstRevisionId_ = ""; + lastRevisionId_ = ""; return this; } @@ -454,43 +540,27 @@ public com.google.pubsub.v1.SchemaSettings build() { @java.lang.Override public com.google.pubsub.v1.SchemaSettings buildPartial() { com.google.pubsub.v1.SchemaSettings result = new com.google.pubsub.v1.SchemaSettings(this); - result.schema_ = schema_; - result.encoding_ = encoding_; + if (bitField0_ != 0) { + buildPartial0(result); + } onBuilt(); return result; } - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); + private void buildPartial0(com.google.pubsub.v1.SchemaSettings result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.schema_ = schema_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.encoding_ = encoding_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.firstRevisionId_ = firstRevisionId_; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.lastRevisionId_ = lastRevisionId_; + } } @java.lang.Override @@ -507,12 +577,23 @@ public Builder mergeFrom(com.google.pubsub.v1.SchemaSettings other) { if (other == com.google.pubsub.v1.SchemaSettings.getDefaultInstance()) return this; if (!other.getSchema().isEmpty()) { schema_ = other.schema_; + bitField0_ |= 0x00000001; onChanged(); } if (other.encoding_ != 0) { setEncodingValue(other.getEncodingValue()); } - this.mergeUnknownFields(other.unknownFields); + if (!other.getFirstRevisionId().isEmpty()) { + firstRevisionId_ = other.firstRevisionId_; + bitField0_ |= 0x00000004; + onChanged(); + } + if (!other.getLastRevisionId().isEmpty()) { + lastRevisionId_ = other.lastRevisionId_; + bitField0_ |= 0x00000008; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -527,21 +608,62 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.pubsub.v1.SchemaSettings parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + schema_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 16: + { + encoding_ = input.readEnum(); + bitField0_ |= 0x00000002; + break; + } // case 16 + case 26: + { + firstRevisionId_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000004; + break; + } // case 26 + case 34: + { + lastRevisionId_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000008; + break; + } // case 34 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.google.pubsub.v1.SchemaSettings) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } + private int bitField0_; + private java.lang.Object schema_ = ""; + /** * * @@ -569,6 +691,7 @@ public java.lang.String getSchema() { return (java.lang.String) ref; } } + /** * * @@ -596,6 +719,7 @@ public com.google.protobuf.ByteString getSchemaBytes() { return (com.google.protobuf.ByteString) ref; } } + /** * * @@ -617,11 +741,12 @@ public Builder setSchema(java.lang.String value) { if (value == null) { throw new NullPointerException(); } - schema_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } + /** * * @@ -639,11 +764,12 @@ public Builder setSchema(java.lang.String value) { * @return This builder for chaining. */ public Builder clearSchema() { - schema_ = getDefaultInstance().getSchema(); + bitField0_ = (bitField0_ & ~0x00000001); onChanged(); return this; } + /** * * @@ -666,21 +792,23 @@ public Builder setSchemaBytes(com.google.protobuf.ByteString value) { throw new NullPointerException(); } checkByteStringIsUtf8(value); - schema_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } private int encoding_ = 0; + /** * * *
    -     * The encoding of messages validated against `schema`.
    +     * Optional. The encoding of messages validated against `schema`.
          * 
    * - * .google.pubsub.v1.Encoding encoding = 2; + * .google.pubsub.v1.Encoding encoding = 2 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return The enum numeric value on the wire for encoding. */ @@ -688,49 +816,54 @@ public Builder setSchemaBytes(com.google.protobuf.ByteString value) { public int getEncodingValue() { return encoding_; } + /** * * *
    -     * The encoding of messages validated against `schema`.
    +     * Optional. The encoding of messages validated against `schema`.
          * 
    * - * .google.pubsub.v1.Encoding encoding = 2; + * .google.pubsub.v1.Encoding encoding = 2 [(.google.api.field_behavior) = OPTIONAL]; + * * * @param value The enum numeric value on the wire for encoding to set. * @return This builder for chaining. */ public Builder setEncodingValue(int value) { - encoding_ = value; + bitField0_ |= 0x00000002; onChanged(); return this; } + /** * * *
    -     * The encoding of messages validated against `schema`.
    +     * Optional. The encoding of messages validated against `schema`.
          * 
    * - * .google.pubsub.v1.Encoding encoding = 2; + * .google.pubsub.v1.Encoding encoding = 2 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return The encoding. */ @java.lang.Override public com.google.pubsub.v1.Encoding getEncoding() { - @SuppressWarnings("deprecation") - com.google.pubsub.v1.Encoding result = com.google.pubsub.v1.Encoding.valueOf(encoding_); + com.google.pubsub.v1.Encoding result = com.google.pubsub.v1.Encoding.forNumber(encoding_); return result == null ? com.google.pubsub.v1.Encoding.UNRECOGNIZED : result; } + /** * * *
    -     * The encoding of messages validated against `schema`.
    +     * Optional. The encoding of messages validated against `schema`.
          * 
    * - * .google.pubsub.v1.Encoding encoding = 2; + * .google.pubsub.v1.Encoding encoding = 2 [(.google.api.field_behavior) = OPTIONAL]; + * * * @param value The encoding to set. * @return This builder for chaining. @@ -739,38 +872,271 @@ public Builder setEncoding(com.google.pubsub.v1.Encoding value) { if (value == null) { throw new NullPointerException(); } - + bitField0_ |= 0x00000002; encoding_ = value.getNumber(); onChanged(); return this; } + /** * * *
    -     * The encoding of messages validated against `schema`.
    +     * Optional. The encoding of messages validated against `schema`.
          * 
    * - * .google.pubsub.v1.Encoding encoding = 2; + * .google.pubsub.v1.Encoding encoding = 2 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return This builder for chaining. */ public Builder clearEncoding() { - + bitField0_ = (bitField0_ & ~0x00000002); encoding_ = 0; onChanged(); return this; } - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); + private java.lang.Object firstRevisionId_ = ""; + + /** + * + * + *
    +     * Optional. The minimum (inclusive) revision allowed for validating messages.
    +     * If empty or not present, allow any revision to be validated against
    +     * last_revision or any revision created before.
    +     * 
    + * + * string first_revision_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The firstRevisionId. + */ + public java.lang.String getFirstRevisionId() { + java.lang.Object ref = firstRevisionId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + firstRevisionId_ = s; + return s; + } else { + return (java.lang.String) ref; + } } - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); + /** + * + * + *
    +     * Optional. The minimum (inclusive) revision allowed for validating messages.
    +     * If empty or not present, allow any revision to be validated against
    +     * last_revision or any revision created before.
    +     * 
    + * + * string first_revision_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for firstRevisionId. + */ + public com.google.protobuf.ByteString getFirstRevisionIdBytes() { + java.lang.Object ref = firstRevisionId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + firstRevisionId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +     * Optional. The minimum (inclusive) revision allowed for validating messages.
    +     * If empty or not present, allow any revision to be validated against
    +     * last_revision or any revision created before.
    +     * 
    + * + * string first_revision_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The firstRevisionId to set. + * @return This builder for chaining. + */ + public Builder setFirstRevisionId(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + firstRevisionId_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Optional. The minimum (inclusive) revision allowed for validating messages.
    +     * If empty or not present, allow any revision to be validated against
    +     * last_revision or any revision created before.
    +     * 
    + * + * string first_revision_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearFirstRevisionId() { + firstRevisionId_ = getDefaultInstance().getFirstRevisionId(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + + /** + * + * + *
    +     * Optional. The minimum (inclusive) revision allowed for validating messages.
    +     * If empty or not present, allow any revision to be validated against
    +     * last_revision or any revision created before.
    +     * 
    + * + * string first_revision_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for firstRevisionId to set. + * @return This builder for chaining. + */ + public Builder setFirstRevisionIdBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + firstRevisionId_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + private java.lang.Object lastRevisionId_ = ""; + + /** + * + * + *
    +     * Optional. The maximum (inclusive) revision allowed for validating messages.
    +     * If empty or not present, allow any revision to be validated against
    +     * first_revision or any revision created after.
    +     * 
    + * + * string last_revision_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The lastRevisionId. + */ + public java.lang.String getLastRevisionId() { + java.lang.Object ref = lastRevisionId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + lastRevisionId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +     * Optional. The maximum (inclusive) revision allowed for validating messages.
    +     * If empty or not present, allow any revision to be validated against
    +     * first_revision or any revision created after.
    +     * 
    + * + * string last_revision_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for lastRevisionId. + */ + public com.google.protobuf.ByteString getLastRevisionIdBytes() { + java.lang.Object ref = lastRevisionId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + lastRevisionId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +     * Optional. The maximum (inclusive) revision allowed for validating messages.
    +     * If empty or not present, allow any revision to be validated against
    +     * first_revision or any revision created after.
    +     * 
    + * + * string last_revision_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The lastRevisionId to set. + * @return This builder for chaining. + */ + public Builder setLastRevisionId(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + lastRevisionId_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Optional. The maximum (inclusive) revision allowed for validating messages.
    +     * If empty or not present, allow any revision to be validated against
    +     * first_revision or any revision created after.
    +     * 
    + * + * string last_revision_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearLastRevisionId() { + lastRevisionId_ = getDefaultInstance().getLastRevisionId(); + bitField0_ = (bitField0_ & ~0x00000008); + onChanged(); + return this; + } + + /** + * + * + *
    +     * Optional. The maximum (inclusive) revision allowed for validating messages.
    +     * If empty or not present, allow any revision to be validated against
    +     * first_revision or any revision created after.
    +     * 
    + * + * string last_revision_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for lastRevisionId to set. + * @return This builder for chaining. + */ + public Builder setLastRevisionIdBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + lastRevisionId_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; } // @@protoc_insertion_point(builder_scope:google.pubsub.v1.SchemaSettings) @@ -794,7 +1160,18 @@ public SchemaSettings parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new SchemaSettings(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SchemaSettingsOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SchemaSettingsOrBuilder.java index f44178d47..a5f003482 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SchemaSettingsOrBuilder.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SchemaSettingsOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; +@com.google.protobuf.Generated public interface SchemaSettingsOrBuilder extends // @@protoc_insertion_point(interface_extends:google.pubsub.v1.SchemaSettings) @@ -40,6 +43,7 @@ public interface SchemaSettingsOrBuilder * @return The schema. */ java.lang.String getSchema(); + /** * * @@ -62,24 +66,85 @@ public interface SchemaSettingsOrBuilder * * *
    -   * The encoding of messages validated against `schema`.
    +   * Optional. The encoding of messages validated against `schema`.
        * 
    * - * .google.pubsub.v1.Encoding encoding = 2; + * .google.pubsub.v1.Encoding encoding = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The enum numeric value on the wire for encoding. */ int getEncodingValue(); + /** * * *
    -   * The encoding of messages validated against `schema`.
    +   * Optional. The encoding of messages validated against `schema`.
        * 
    * - * .google.pubsub.v1.Encoding encoding = 2; + * .google.pubsub.v1.Encoding encoding = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The encoding. */ com.google.pubsub.v1.Encoding getEncoding(); + + /** + * + * + *
    +   * Optional. The minimum (inclusive) revision allowed for validating messages.
    +   * If empty or not present, allow any revision to be validated against
    +   * last_revision or any revision created before.
    +   * 
    + * + * string first_revision_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The firstRevisionId. + */ + java.lang.String getFirstRevisionId(); + + /** + * + * + *
    +   * Optional. The minimum (inclusive) revision allowed for validating messages.
    +   * If empty or not present, allow any revision to be validated against
    +   * last_revision or any revision created before.
    +   * 
    + * + * string first_revision_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for firstRevisionId. + */ + com.google.protobuf.ByteString getFirstRevisionIdBytes(); + + /** + * + * + *
    +   * Optional. The maximum (inclusive) revision allowed for validating messages.
    +   * If empty or not present, allow any revision to be validated against
    +   * first_revision or any revision created after.
    +   * 
    + * + * string last_revision_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The lastRevisionId. + */ + java.lang.String getLastRevisionId(); + + /** + * + * + *
    +   * Optional. The maximum (inclusive) revision allowed for validating messages.
    +   * If empty or not present, allow any revision to be validated against
    +   * first_revision or any revision created after.
    +   * 
    + * + * string last_revision_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for lastRevisionId. + */ + com.google.protobuf.ByteString getLastRevisionIdBytes(); } diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SchemaView.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SchemaView.java index 2d9433fd1..4a9a82324 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SchemaView.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SchemaView.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/schema.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; @@ -27,6 +29,7 @@ * * Protobuf enum {@code google.pubsub.v1.SchemaView} */ +@com.google.protobuf.Generated public enum SchemaView implements com.google.protobuf.ProtocolMessageEnum { /** * @@ -62,6 +65,16 @@ public enum SchemaView implements com.google.protobuf.ProtocolMessageEnum { UNRECOGNIZED(-1), ; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "SchemaView"); + } + /** * * @@ -73,6 +86,7 @@ public enum SchemaView implements com.google.protobuf.ProtocolMessageEnum { * SCHEMA_VIEW_UNSPECIFIED = 0; */ public static final int SCHEMA_VIEW_UNSPECIFIED_VALUE = 0; + /** * * @@ -83,6 +97,7 @@ public enum SchemaView implements com.google.protobuf.ProtocolMessageEnum { * BASIC = 1; */ public static final int BASIC_VALUE = 1; + /** * * @@ -152,7 +167,7 @@ public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType return getDescriptor(); } - public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + public static com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { return com.google.pubsub.v1.SchemaProto.getDescriptor().getEnumTypes().get(0); } diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SeekRequest.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SeekRequest.java index f9d6cc75d..da4217b2f 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SeekRequest.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SeekRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; @@ -27,13 +29,25 @@ * * Protobuf type {@code google.pubsub.v1.SeekRequest} */ -public final class SeekRequest extends com.google.protobuf.GeneratedMessageV3 +@com.google.protobuf.Generated +public final class SeekRequest extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:google.pubsub.v1.SeekRequest) SeekRequestOrBuilder { private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "SeekRequest"); + } + // Use SeekRequest.newBuilder() to construct. - private SeekRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + private SeekRequest(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); } @@ -41,89 +55,12 @@ private SeekRequest() { subscription_ = ""; } - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new SeekRequest(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - private SeekRequest( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - java.lang.String s = input.readStringRequireUtf8(); - - subscription_ = s; - break; - } - case 18: - { - com.google.protobuf.Timestamp.Builder subBuilder = null; - if (targetCase_ == 2) { - subBuilder = ((com.google.protobuf.Timestamp) target_).toBuilder(); - } - target_ = - input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom((com.google.protobuf.Timestamp) target_); - target_ = subBuilder.buildPartial(); - } - targetCase_ = 2; - break; - } - case 26: - { - java.lang.String s = input.readStringRequireUtf8(); - targetCase_ = 3; - target_ = s; - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.pubsub.v1.PubsubProto.internal_static_google_pubsub_v1_SeekRequest_descriptor; } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_SeekRequest_fieldAccessorTable @@ -132,6 +69,8 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } private int targetCase_ = 0; + + @SuppressWarnings("serial") private java.lang.Object target_; public enum TargetCase @@ -146,6 +85,7 @@ public enum TargetCase private TargetCase(int value) { this.value = value; } + /** * @param value The number of the enum to look for. * @return The enum associated with the given number. @@ -179,7 +119,10 @@ public TargetCase getTargetCase() { } public static final int SUBSCRIPTION_FIELD_NUMBER = 1; - private volatile java.lang.Object subscription_; + + @SuppressWarnings("serial") + private volatile java.lang.Object subscription_ = ""; + /** * * @@ -205,6 +148,7 @@ public java.lang.String getSubscription() { return s; } } + /** * * @@ -232,11 +176,12 @@ public com.google.protobuf.ByteString getSubscriptionBytes() { } public static final int TIME_FIELD_NUMBER = 2; + /** * * *
    -   * The time to seek to.
    +   * Optional. The time to seek to.
        * Messages retained in the subscription that were published before this
        * time are marked as acknowledged, and messages retained in the
        * subscription that were published after this time are marked as
    @@ -249,7 +194,7 @@ public com.google.protobuf.ByteString getSubscriptionBytes() {
        * and already-expunged messages will not be restored.
        * 
    * - * .google.protobuf.Timestamp time = 2; + * .google.protobuf.Timestamp time = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return Whether the time field is set. */ @@ -257,11 +202,12 @@ public com.google.protobuf.ByteString getSubscriptionBytes() { public boolean hasTime() { return targetCase_ == 2; } + /** * * *
    -   * The time to seek to.
    +   * Optional. The time to seek to.
        * Messages retained in the subscription that were published before this
        * time are marked as acknowledged, and messages retained in the
        * subscription that were published after this time are marked as
    @@ -274,7 +220,7 @@ public boolean hasTime() {
        * and already-expunged messages will not be restored.
        * 
    * - * .google.protobuf.Timestamp time = 2; + * .google.protobuf.Timestamp time = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The time. */ @@ -285,11 +231,12 @@ public com.google.protobuf.Timestamp getTime() { } return com.google.protobuf.Timestamp.getDefaultInstance(); } + /** * * *
    -   * The time to seek to.
    +   * Optional. The time to seek to.
        * Messages retained in the subscription that were published before this
        * time are marked as acknowledged, and messages retained in the
        * subscription that were published after this time are marked as
    @@ -302,7 +249,7 @@ public com.google.protobuf.Timestamp getTime() {
        * and already-expunged messages will not be restored.
        * 
    * - * .google.protobuf.Timestamp time = 2; + * .google.protobuf.Timestamp time = 2 [(.google.api.field_behavior) = OPTIONAL]; */ @java.lang.Override public com.google.protobuf.TimestampOrBuilder getTimeOrBuilder() { @@ -313,32 +260,38 @@ public com.google.protobuf.TimestampOrBuilder getTimeOrBuilder() { } public static final int SNAPSHOT_FIELD_NUMBER = 3; + /** * * *
    -   * The snapshot to seek to. The snapshot's topic must be the same as that of
    -   * the provided subscription.
    -   * Format is `projects/{project}/snapshots/{snap}`.
    +   * Optional. The snapshot to seek to. The snapshot's topic must be the same
    +   * as that of the provided subscription. Format is
    +   * `projects/{project}/snapshots/{snap}`.
        * 
    * - * string snapshot = 3 [(.google.api.resource_reference) = { ... } + * + * string snapshot = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return Whether the snapshot field is set. */ public boolean hasSnapshot() { return targetCase_ == 3; } + /** * * *
    -   * The snapshot to seek to. The snapshot's topic must be the same as that of
    -   * the provided subscription.
    -   * Format is `projects/{project}/snapshots/{snap}`.
    +   * Optional. The snapshot to seek to. The snapshot's topic must be the same
    +   * as that of the provided subscription. Format is
    +   * `projects/{project}/snapshots/{snap}`.
        * 
    * - * string snapshot = 3 [(.google.api.resource_reference) = { ... } + * + * string snapshot = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return The snapshot. */ @@ -358,16 +311,19 @@ public java.lang.String getSnapshot() { return s; } } + /** * * *
    -   * The snapshot to seek to. The snapshot's topic must be the same as that of
    -   * the provided subscription.
    -   * Format is `projects/{project}/snapshots/{snap}`.
    +   * Optional. The snapshot to seek to. The snapshot's topic must be the same
    +   * as that of the provided subscription. Format is
    +   * `projects/{project}/snapshots/{snap}`.
        * 
    * - * string snapshot = 3 [(.google.api.resource_reference) = { ... } + * + * string snapshot = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return The bytes for snapshot. */ @@ -402,16 +358,16 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!getSubscriptionBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, subscription_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(subscription_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, subscription_); } if (targetCase_ == 2) { output.writeMessage(2, (com.google.protobuf.Timestamp) target_); } if (targetCase_ == 3) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 3, target_); + com.google.protobuf.GeneratedMessage.writeString(output, 3, target_); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -420,8 +376,8 @@ public int getSerializedSize() { if (size != -1) return size; size = 0; - if (!getSubscriptionBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, subscription_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(subscription_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, subscription_); } if (targetCase_ == 2) { size += @@ -429,9 +385,9 @@ public int getSerializedSize() { 2, (com.google.protobuf.Timestamp) target_); } if (targetCase_ == 3) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, target_); + size += com.google.protobuf.GeneratedMessage.computeStringSize(3, target_); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -458,7 +414,7 @@ public boolean equals(final java.lang.Object obj) { case 0: default: } - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -483,7 +439,7 @@ public int hashCode() { case 0: default: } - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -524,38 +480,38 @@ public static com.google.pubsub.v1.SeekRequest parseFrom( public static com.google.pubsub.v1.SeekRequest parseFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.SeekRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.SeekRequest parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); } public static com.google.pubsub.v1.SeekRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.SeekRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.SeekRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } @@ -578,10 +534,11 @@ public Builder toBuilder() { } @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** * * @@ -591,7 +548,7 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build * * Protobuf type {@code google.pubsub.v1.SeekRequest} */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements // @@protoc_insertion_point(builder_implements:google.pubsub.v1.SeekRequest) com.google.pubsub.v1.SeekRequestOrBuilder { @@ -601,7 +558,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_SeekRequest_fieldAccessorTable @@ -611,24 +568,20 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } // Construct using com.google.pubsub.v1.SeekRequest.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } + private Builder() {} - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} } @java.lang.Override public Builder clear() { super.clear(); + bitField0_ = 0; subscription_ = ""; - + if (timeBuilder_ != null) { + timeBuilder_.clear(); + } targetCase_ = 0; target_ = null; return this; @@ -657,53 +610,27 @@ public com.google.pubsub.v1.SeekRequest build() { @java.lang.Override public com.google.pubsub.v1.SeekRequest buildPartial() { com.google.pubsub.v1.SeekRequest result = new com.google.pubsub.v1.SeekRequest(this); - result.subscription_ = subscription_; - if (targetCase_ == 2) { - if (timeBuilder_ == null) { - result.target_ = target_; - } else { - result.target_ = timeBuilder_.build(); - } - } - if (targetCase_ == 3) { - result.target_ = target_; + if (bitField0_ != 0) { + buildPartial0(result); } - result.targetCase_ = targetCase_; + buildPartialOneofs(result); onBuilt(); return result; } - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); + private void buildPartial0(com.google.pubsub.v1.SeekRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.subscription_ = subscription_; + } } - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); + private void buildPartialOneofs(com.google.pubsub.v1.SeekRequest result) { + result.targetCase_ = targetCase_; + result.target_ = this.target_; + if (targetCase_ == 2 && timeBuilder_ != null) { + result.target_ = timeBuilder_.build(); + } } @java.lang.Override @@ -720,6 +647,7 @@ public Builder mergeFrom(com.google.pubsub.v1.SeekRequest other) { if (other == com.google.pubsub.v1.SeekRequest.getDefaultInstance()) return this; if (!other.getSubscription().isEmpty()) { subscription_ = other.subscription_; + bitField0_ |= 0x00000001; onChanged(); } switch (other.getTargetCase()) { @@ -740,7 +668,7 @@ public Builder mergeFrom(com.google.pubsub.v1.SeekRequest other) { break; } } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -755,17 +683,50 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.pubsub.v1.SeekRequest parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + subscription_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + input.readMessage(internalGetTimeFieldBuilder().getBuilder(), extensionRegistry); + targetCase_ = 2; + break; + } // case 18 + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + targetCase_ = 3; + target_ = s; + break; + } // case 26 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.google.pubsub.v1.SeekRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } @@ -783,7 +744,10 @@ public Builder clearTarget() { return this; } + private int bitField0_; + private java.lang.Object subscription_ = ""; + /** * * @@ -808,6 +772,7 @@ public java.lang.String getSubscription() { return (java.lang.String) ref; } } + /** * * @@ -832,6 +797,7 @@ public com.google.protobuf.ByteString getSubscriptionBytes() { return (com.google.protobuf.ByteString) ref; } } + /** * * @@ -850,11 +816,12 @@ public Builder setSubscription(java.lang.String value) { if (value == null) { throw new NullPointerException(); } - subscription_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } + /** * * @@ -869,11 +836,12 @@ public Builder setSubscription(java.lang.String value) { * @return This builder for chaining. */ public Builder clearSubscription() { - subscription_ = getDefaultInstance().getSubscription(); + bitField0_ = (bitField0_ & ~0x00000001); onChanged(); return this; } + /** * * @@ -893,22 +861,23 @@ public Builder setSubscriptionBytes(com.google.protobuf.ByteString value) { throw new NullPointerException(); } checkByteStringIsUtf8(value); - subscription_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } - private com.google.protobuf.SingleFieldBuilderV3< + private com.google.protobuf.SingleFieldBuilder< com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder> timeBuilder_; + /** * * *
    -     * The time to seek to.
    +     * Optional. The time to seek to.
          * Messages retained in the subscription that were published before this
          * time are marked as acknowledged, and messages retained in the
          * subscription that were published after this time are marked as
    @@ -921,7 +890,7 @@ public Builder setSubscriptionBytes(com.google.protobuf.ByteString value) {
          * and already-expunged messages will not be restored.
          * 
    * - * .google.protobuf.Timestamp time = 2; + * .google.protobuf.Timestamp time = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return Whether the time field is set. */ @@ -929,11 +898,12 @@ public Builder setSubscriptionBytes(com.google.protobuf.ByteString value) { public boolean hasTime() { return targetCase_ == 2; } + /** * * *
    -     * The time to seek to.
    +     * Optional. The time to seek to.
          * Messages retained in the subscription that were published before this
          * time are marked as acknowledged, and messages retained in the
          * subscription that were published after this time are marked as
    @@ -946,7 +916,7 @@ public boolean hasTime() {
          * and already-expunged messages will not be restored.
          * 
    * - * .google.protobuf.Timestamp time = 2; + * .google.protobuf.Timestamp time = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The time. */ @@ -964,11 +934,12 @@ public com.google.protobuf.Timestamp getTime() { return com.google.protobuf.Timestamp.getDefaultInstance(); } } + /** * * *
    -     * The time to seek to.
    +     * Optional. The time to seek to.
          * Messages retained in the subscription that were published before this
          * time are marked as acknowledged, and messages retained in the
          * subscription that were published after this time are marked as
    @@ -981,7 +952,7 @@ public com.google.protobuf.Timestamp getTime() {
          * and already-expunged messages will not be restored.
          * 
    * - * .google.protobuf.Timestamp time = 2; + * .google.protobuf.Timestamp time = 2 [(.google.api.field_behavior) = OPTIONAL]; */ public Builder setTime(com.google.protobuf.Timestamp value) { if (timeBuilder_ == null) { @@ -996,11 +967,12 @@ public Builder setTime(com.google.protobuf.Timestamp value) { targetCase_ = 2; return this; } + /** * * *
    -     * The time to seek to.
    +     * Optional. The time to seek to.
          * Messages retained in the subscription that were published before this
          * time are marked as acknowledged, and messages retained in the
          * subscription that were published after this time are marked as
    @@ -1013,7 +985,7 @@ public Builder setTime(com.google.protobuf.Timestamp value) {
          * and already-expunged messages will not be restored.
          * 
    * - * .google.protobuf.Timestamp time = 2; + * .google.protobuf.Timestamp time = 2 [(.google.api.field_behavior) = OPTIONAL]; */ public Builder setTime(com.google.protobuf.Timestamp.Builder builderForValue) { if (timeBuilder_ == null) { @@ -1025,11 +997,12 @@ public Builder setTime(com.google.protobuf.Timestamp.Builder builderForValue) { targetCase_ = 2; return this; } + /** * * *
    -     * The time to seek to.
    +     * Optional. The time to seek to.
          * Messages retained in the subscription that were published before this
          * time are marked as acknowledged, and messages retained in the
          * subscription that were published after this time are marked as
    @@ -1042,7 +1015,7 @@ public Builder setTime(com.google.protobuf.Timestamp.Builder builderForValue) {
          * and already-expunged messages will not be restored.
          * 
    * - * .google.protobuf.Timestamp time = 2; + * .google.protobuf.Timestamp time = 2 [(.google.api.field_behavior) = OPTIONAL]; */ public Builder mergeTime(com.google.protobuf.Timestamp value) { if (timeBuilder_ == null) { @@ -1058,17 +1031,19 @@ public Builder mergeTime(com.google.protobuf.Timestamp value) { } else { if (targetCase_ == 2) { timeBuilder_.mergeFrom(value); + } else { + timeBuilder_.setMessage(value); } - timeBuilder_.setMessage(value); } targetCase_ = 2; return this; } + /** * * *
    -     * The time to seek to.
    +     * Optional. The time to seek to.
          * Messages retained in the subscription that were published before this
          * time are marked as acknowledged, and messages retained in the
          * subscription that were published after this time are marked as
    @@ -1081,7 +1056,7 @@ public Builder mergeTime(com.google.protobuf.Timestamp value) {
          * and already-expunged messages will not be restored.
          * 
    * - * .google.protobuf.Timestamp time = 2; + * .google.protobuf.Timestamp time = 2 [(.google.api.field_behavior) = OPTIONAL]; */ public Builder clearTime() { if (timeBuilder_ == null) { @@ -1099,11 +1074,12 @@ public Builder clearTime() { } return this; } + /** * * *
    -     * The time to seek to.
    +     * Optional. The time to seek to.
          * Messages retained in the subscription that were published before this
          * time are marked as acknowledged, and messages retained in the
          * subscription that were published after this time are marked as
    @@ -1116,16 +1092,17 @@ public Builder clearTime() {
          * and already-expunged messages will not be restored.
          * 
    * - * .google.protobuf.Timestamp time = 2; + * .google.protobuf.Timestamp time = 2 [(.google.api.field_behavior) = OPTIONAL]; */ public com.google.protobuf.Timestamp.Builder getTimeBuilder() { - return getTimeFieldBuilder().getBuilder(); + return internalGetTimeFieldBuilder().getBuilder(); } + /** * * *
    -     * The time to seek to.
    +     * Optional. The time to seek to.
          * Messages retained in the subscription that were published before this
          * time are marked as acknowledged, and messages retained in the
          * subscription that were published after this time are marked as
    @@ -1138,7 +1115,7 @@ public com.google.protobuf.Timestamp.Builder getTimeBuilder() {
          * and already-expunged messages will not be restored.
          * 
    * - * .google.protobuf.Timestamp time = 2; + * .google.protobuf.Timestamp time = 2 [(.google.api.field_behavior) = OPTIONAL]; */ @java.lang.Override public com.google.protobuf.TimestampOrBuilder getTimeOrBuilder() { @@ -1151,11 +1128,12 @@ public com.google.protobuf.TimestampOrBuilder getTimeOrBuilder() { return com.google.protobuf.Timestamp.getDefaultInstance(); } } + /** * * *
    -     * The time to seek to.
    +     * Optional. The time to seek to.
          * Messages retained in the subscription that were published before this
          * time are marked as acknowledged, and messages retained in the
          * subscription that were published after this time are marked as
    @@ -1168,19 +1146,19 @@ public com.google.protobuf.TimestampOrBuilder getTimeOrBuilder() {
          * and already-expunged messages will not be restored.
          * 
    * - * .google.protobuf.Timestamp time = 2; + * .google.protobuf.Timestamp time = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private com.google.protobuf.SingleFieldBuilderV3< + private com.google.protobuf.SingleFieldBuilder< com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder> - getTimeFieldBuilder() { + internalGetTimeFieldBuilder() { if (timeBuilder_ == null) { if (!(targetCase_ == 2)) { target_ = com.google.protobuf.Timestamp.getDefaultInstance(); } timeBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< + new com.google.protobuf.SingleFieldBuilder< com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder>( @@ -1189,7 +1167,6 @@ public com.google.protobuf.TimestampOrBuilder getTimeOrBuilder() { } targetCase_ = 2; onChanged(); - ; return timeBuilder_; } @@ -1197,12 +1174,14 @@ public com.google.protobuf.TimestampOrBuilder getTimeOrBuilder() { * * *
    -     * The snapshot to seek to. The snapshot's topic must be the same as that of
    -     * the provided subscription.
    -     * Format is `projects/{project}/snapshots/{snap}`.
    +     * Optional. The snapshot to seek to. The snapshot's topic must be the same
    +     * as that of the provided subscription. Format is
    +     * `projects/{project}/snapshots/{snap}`.
          * 
    * - * string snapshot = 3 [(.google.api.resource_reference) = { ... } + * + * string snapshot = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return Whether the snapshot field is set. */ @@ -1210,16 +1189,19 @@ public com.google.protobuf.TimestampOrBuilder getTimeOrBuilder() { public boolean hasSnapshot() { return targetCase_ == 3; } + /** * * *
    -     * The snapshot to seek to. The snapshot's topic must be the same as that of
    -     * the provided subscription.
    -     * Format is `projects/{project}/snapshots/{snap}`.
    +     * Optional. The snapshot to seek to. The snapshot's topic must be the same
    +     * as that of the provided subscription. Format is
    +     * `projects/{project}/snapshots/{snap}`.
          * 
    * - * string snapshot = 3 [(.google.api.resource_reference) = { ... } + * + * string snapshot = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return The snapshot. */ @@ -1240,16 +1222,19 @@ public java.lang.String getSnapshot() { return (java.lang.String) ref; } } + /** * * *
    -     * The snapshot to seek to. The snapshot's topic must be the same as that of
    -     * the provided subscription.
    -     * Format is `projects/{project}/snapshots/{snap}`.
    +     * Optional. The snapshot to seek to. The snapshot's topic must be the same
    +     * as that of the provided subscription. Format is
    +     * `projects/{project}/snapshots/{snap}`.
          * 
    * - * string snapshot = 3 [(.google.api.resource_reference) = { ... } + * + * string snapshot = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return The bytes for snapshot. */ @@ -1270,16 +1255,19 @@ public com.google.protobuf.ByteString getSnapshotBytes() { return (com.google.protobuf.ByteString) ref; } } + /** * * *
    -     * The snapshot to seek to. The snapshot's topic must be the same as that of
    -     * the provided subscription.
    -     * Format is `projects/{project}/snapshots/{snap}`.
    +     * Optional. The snapshot to seek to. The snapshot's topic must be the same
    +     * as that of the provided subscription. Format is
    +     * `projects/{project}/snapshots/{snap}`.
          * 
    * - * string snapshot = 3 [(.google.api.resource_reference) = { ... } + * + * string snapshot = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @param value The snapshot to set. * @return This builder for chaining. @@ -1293,16 +1281,19 @@ public Builder setSnapshot(java.lang.String value) { onChanged(); return this; } + /** * * *
    -     * The snapshot to seek to. The snapshot's topic must be the same as that of
    -     * the provided subscription.
    -     * Format is `projects/{project}/snapshots/{snap}`.
    +     * Optional. The snapshot to seek to. The snapshot's topic must be the same
    +     * as that of the provided subscription. Format is
    +     * `projects/{project}/snapshots/{snap}`.
          * 
    * - * string snapshot = 3 [(.google.api.resource_reference) = { ... } + * + * string snapshot = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return This builder for chaining. */ @@ -1314,16 +1305,19 @@ public Builder clearSnapshot() { } return this; } + /** * * *
    -     * The snapshot to seek to. The snapshot's topic must be the same as that of
    -     * the provided subscription.
    -     * Format is `projects/{project}/snapshots/{snap}`.
    +     * Optional. The snapshot to seek to. The snapshot's topic must be the same
    +     * as that of the provided subscription. Format is
    +     * `projects/{project}/snapshots/{snap}`.
          * 
    * - * string snapshot = 3 [(.google.api.resource_reference) = { ... } + * + * string snapshot = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @param value The bytes for snapshot to set. * @return This builder for chaining. @@ -1339,17 +1333,6 @@ public Builder setSnapshotBytes(com.google.protobuf.ByteString value) { return this; } - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - // @@protoc_insertion_point(builder_scope:google.pubsub.v1.SeekRequest) } @@ -1371,7 +1354,18 @@ public SeekRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new SeekRequest(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SeekRequestOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SeekRequestOrBuilder.java index b82800a00..e597f2c52 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SeekRequestOrBuilder.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SeekRequestOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; +@com.google.protobuf.Generated public interface SeekRequestOrBuilder extends // @@protoc_insertion_point(interface_extends:google.pubsub.v1.SeekRequest) @@ -37,6 +40,7 @@ public interface SeekRequestOrBuilder * @return The subscription. */ java.lang.String getSubscription(); + /** * * @@ -56,7 +60,7 @@ public interface SeekRequestOrBuilder * * *
    -   * The time to seek to.
    +   * Optional. The time to seek to.
        * Messages retained in the subscription that were published before this
        * time are marked as acknowledged, and messages retained in the
        * subscription that were published after this time are marked as
    @@ -69,16 +73,17 @@ public interface SeekRequestOrBuilder
        * and already-expunged messages will not be restored.
        * 
    * - * .google.protobuf.Timestamp time = 2; + * .google.protobuf.Timestamp time = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return Whether the time field is set. */ boolean hasTime(); + /** * * *
    -   * The time to seek to.
    +   * Optional. The time to seek to.
        * Messages retained in the subscription that were published before this
        * time are marked as acknowledged, and messages retained in the
        * subscription that were published after this time are marked as
    @@ -91,16 +96,17 @@ public interface SeekRequestOrBuilder
        * and already-expunged messages will not be restored.
        * 
    * - * .google.protobuf.Timestamp time = 2; + * .google.protobuf.Timestamp time = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The time. */ com.google.protobuf.Timestamp getTime(); + /** * * *
    -   * The time to seek to.
    +   * Optional. The time to seek to.
        * Messages retained in the subscription that were published before this
        * time are marked as acknowledged, and messages retained in the
        * subscription that were published after this time are marked as
    @@ -113,7 +119,7 @@ public interface SeekRequestOrBuilder
        * and already-expunged messages will not be restored.
        * 
    * - * .google.protobuf.Timestamp time = 2; + * .google.protobuf.Timestamp time = 2 [(.google.api.field_behavior) = OPTIONAL]; */ com.google.protobuf.TimestampOrBuilder getTimeOrBuilder(); @@ -121,44 +127,52 @@ public interface SeekRequestOrBuilder * * *
    -   * The snapshot to seek to. The snapshot's topic must be the same as that of
    -   * the provided subscription.
    -   * Format is `projects/{project}/snapshots/{snap}`.
    +   * Optional. The snapshot to seek to. The snapshot's topic must be the same
    +   * as that of the provided subscription. Format is
    +   * `projects/{project}/snapshots/{snap}`.
        * 
    * - * string snapshot = 3 [(.google.api.resource_reference) = { ... } + * + * string snapshot = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return Whether the snapshot field is set. */ boolean hasSnapshot(); + /** * * *
    -   * The snapshot to seek to. The snapshot's topic must be the same as that of
    -   * the provided subscription.
    -   * Format is `projects/{project}/snapshots/{snap}`.
    +   * Optional. The snapshot to seek to. The snapshot's topic must be the same
    +   * as that of the provided subscription. Format is
    +   * `projects/{project}/snapshots/{snap}`.
        * 
    * - * string snapshot = 3 [(.google.api.resource_reference) = { ... } + * + * string snapshot = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return The snapshot. */ java.lang.String getSnapshot(); + /** * * *
    -   * The snapshot to seek to. The snapshot's topic must be the same as that of
    -   * the provided subscription.
    -   * Format is `projects/{project}/snapshots/{snap}`.
    +   * Optional. The snapshot to seek to. The snapshot's topic must be the same
    +   * as that of the provided subscription. Format is
    +   * `projects/{project}/snapshots/{snap}`.
        * 
    * - * string snapshot = 3 [(.google.api.resource_reference) = { ... } + * + * string snapshot = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return The bytes for snapshot. */ com.google.protobuf.ByteString getSnapshotBytes(); - public com.google.pubsub.v1.SeekRequest.TargetCase getTargetCase(); + com.google.pubsub.v1.SeekRequest.TargetCase getTargetCase(); } diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SeekResponse.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SeekResponse.java index 3ced96f97..882eb143a 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SeekResponse.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SeekResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; @@ -27,65 +29,29 @@ * * Protobuf type {@code google.pubsub.v1.SeekResponse} */ -public final class SeekResponse extends com.google.protobuf.GeneratedMessageV3 +@com.google.protobuf.Generated +public final class SeekResponse extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:google.pubsub.v1.SeekResponse) SeekResponseOrBuilder { private static final long serialVersionUID = 0L; - // Use SeekResponse.newBuilder() to construct. - private SeekResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - private SeekResponse() {} - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new SeekResponse(); + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "SeekResponse"); } - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; + // Use SeekResponse.newBuilder() to construct. + private SeekResponse(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); } - private SeekResponse( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } + private SeekResponse() {} public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.pubsub.v1.PubsubProto @@ -93,7 +59,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_SeekResponse_fieldAccessorTable @@ -116,7 +82,7 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -125,7 +91,7 @@ public int getSerializedSize() { if (size != -1) return size; size = 0; - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -140,7 +106,7 @@ public boolean equals(final java.lang.Object obj) { } com.google.pubsub.v1.SeekResponse other = (com.google.pubsub.v1.SeekResponse) obj; - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -151,7 +117,7 @@ public int hashCode() { } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -192,38 +158,38 @@ public static com.google.pubsub.v1.SeekResponse parseFrom( public static com.google.pubsub.v1.SeekResponse parseFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.SeekResponse parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.SeekResponse parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); } public static com.google.pubsub.v1.SeekResponse parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.SeekResponse parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.SeekResponse parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } @@ -246,10 +212,11 @@ public Builder toBuilder() { } @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** * * @@ -259,7 +226,7 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build * * Protobuf type {@code google.pubsub.v1.SeekResponse} */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements // @@protoc_insertion_point(builder_implements:google.pubsub.v1.SeekResponse) com.google.pubsub.v1.SeekResponseOrBuilder { @@ -269,7 +236,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_SeekResponse_fieldAccessorTable @@ -279,17 +246,10 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } // Construct using com.google.pubsub.v1.SeekResponse.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } + private Builder() {} - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} } @java.lang.Override @@ -325,39 +285,6 @@ public com.google.pubsub.v1.SeekResponse buildPartial() { return result; } - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); - } - @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.google.pubsub.v1.SeekResponse) { @@ -370,7 +297,7 @@ public Builder mergeFrom(com.google.protobuf.Message other) { public Builder mergeFrom(com.google.pubsub.v1.SeekResponse other) { if (other == com.google.pubsub.v1.SeekResponse.getDefaultInstance()) return this; - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -385,31 +312,34 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.pubsub.v1.SeekResponse parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.google.pubsub.v1.SeekResponse) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - // @@protoc_insertion_point(builder_scope:google.pubsub.v1.SeekResponse) } @@ -431,7 +361,18 @@ public SeekResponse parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new SeekResponse(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SeekResponseOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SeekResponseOrBuilder.java index 5cdd14219..9d214afc7 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SeekResponseOrBuilder.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SeekResponseOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; +@com.google.protobuf.Generated public interface SeekResponseOrBuilder extends // @@protoc_insertion_point(interface_extends:google.pubsub.v1.SeekResponse) diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/Snapshot.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/Snapshot.java index 7097a40b5..b9179a725 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/Snapshot.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/Snapshot.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; @@ -31,13 +33,25 @@ * * Protobuf type {@code google.pubsub.v1.Snapshot} */ -public final class Snapshot extends com.google.protobuf.GeneratedMessageV3 +@com.google.protobuf.Generated +public final class Snapshot extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:google.pubsub.v1.Snapshot) SnapshotOrBuilder { private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "Snapshot"); + } + // Use Snapshot.newBuilder() to construct. - private Snapshot(com.google.protobuf.GeneratedMessageV3.Builder builder) { + private Snapshot(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); } @@ -46,104 +60,14 @@ private Snapshot() { topic_ = ""; } - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new Snapshot(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - private Snapshot( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - java.lang.String s = input.readStringRequireUtf8(); - - name_ = s; - break; - } - case 18: - { - java.lang.String s = input.readStringRequireUtf8(); - - topic_ = s; - break; - } - case 26: - { - com.google.protobuf.Timestamp.Builder subBuilder = null; - if (expireTime_ != null) { - subBuilder = expireTime_.toBuilder(); - } - expireTime_ = - input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(expireTime_); - expireTime_ = subBuilder.buildPartial(); - } - - break; - } - case 34: - { - if (!((mutable_bitField0_ & 0x00000001) != 0)) { - labels_ = - com.google.protobuf.MapField.newMapField(LabelsDefaultEntryHolder.defaultEntry); - mutable_bitField0_ |= 0x00000001; - } - com.google.protobuf.MapEntry labels__ = - input.readMessage( - LabelsDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry); - labels_.getMutableMap().put(labels__.getKey(), labels__.getValue()); - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.pubsub.v1.PubsubProto.internal_static_google_pubsub_v1_Snapshot_descriptor; } @SuppressWarnings({"rawtypes"}) @java.lang.Override - protected com.google.protobuf.MapField internalGetMapField(int number) { + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldReflection( + int number) { switch (number) { case 4: return internalGetLabels(); @@ -153,7 +77,7 @@ protected com.google.protobuf.MapField internalGetMapField(int number) { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_Snapshot_fieldAccessorTable @@ -161,16 +85,20 @@ protected com.google.protobuf.MapField internalGetMapField(int number) { com.google.pubsub.v1.Snapshot.class, com.google.pubsub.v1.Snapshot.Builder.class); } + private int bitField0_; public static final int NAME_FIELD_NUMBER = 1; - private volatile java.lang.Object name_; + + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; + /** * * *
    -   * The name of the snapshot.
    +   * Optional. The name of the snapshot.
        * 
    * - * string name = 1; + * string name = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @return The name. */ @@ -186,14 +114,15 @@ public java.lang.String getName() { return s; } } + /** * * *
    -   * The name of the snapshot.
    +   * Optional. The name of the snapshot.
        * 
    * - * string name = 1; + * string name = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @return The bytes for name. */ @@ -211,15 +140,21 @@ public com.google.protobuf.ByteString getNameBytes() { } public static final int TOPIC_FIELD_NUMBER = 2; - private volatile java.lang.Object topic_; + + @SuppressWarnings("serial") + private volatile java.lang.Object topic_ = ""; + /** * * *
    -   * The name of the topic from which this snapshot is retaining messages.
    +   * Optional. The name of the topic from which this snapshot is retaining
    +   * messages.
        * 
    * - * string topic = 2 [(.google.api.resource_reference) = { ... } + * + * string topic = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return The topic. */ @@ -235,14 +170,18 @@ public java.lang.String getTopic() { return s; } } + /** * * *
    -   * The name of the topic from which this snapshot is retaining messages.
    +   * Optional. The name of the topic from which this snapshot is retaining
    +   * messages.
        * 
    * - * string topic = 2 [(.google.api.resource_reference) = { ... } + * + * string topic = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return The bytes for topic. */ @@ -261,11 +200,12 @@ public com.google.protobuf.ByteString getTopicBytes() { public static final int EXPIRE_TIME_FIELD_NUMBER = 3; private com.google.protobuf.Timestamp expireTime_; + /** * * *
    -   * The snapshot is guaranteed to exist up until this time.
    +   * Optional. The snapshot is guaranteed to exist up until this time.
        * A newly-created snapshot expires no later than 7 days from the time of its
        * creation. Its exact lifetime is determined at creation by the existing
        * backlog in the source subscription. Specifically, the lifetime of the
    @@ -277,19 +217,21 @@ public com.google.protobuf.ByteString getTopicBytes() {
        * snapshot that would expire in less than 1 hour after creation.
        * 
    * - * .google.protobuf.Timestamp expire_time = 3; + * .google.protobuf.Timestamp expire_time = 3 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return Whether the expireTime field is set. */ @java.lang.Override public boolean hasExpireTime() { - return expireTime_ != null; + return ((bitField0_ & 0x00000001) != 0); } + /** * * *
    -   * The snapshot is guaranteed to exist up until this time.
    +   * Optional. The snapshot is guaranteed to exist up until this time.
        * A newly-created snapshot expires no later than 7 days from the time of its
        * creation. Its exact lifetime is determined at creation by the existing
        * backlog in the source subscription. Specifically, the lifetime of the
    @@ -301,7 +243,8 @@ public boolean hasExpireTime() {
        * snapshot that would expire in less than 1 hour after creation.
        * 
    * - * .google.protobuf.Timestamp expire_time = 3; + * .google.protobuf.Timestamp expire_time = 3 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return The expireTime. */ @@ -309,11 +252,12 @@ public boolean hasExpireTime() { public com.google.protobuf.Timestamp getExpireTime() { return expireTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : expireTime_; } + /** * * *
    -   * The snapshot is guaranteed to exist up until this time.
    +   * Optional. The snapshot is guaranteed to exist up until this time.
        * A newly-created snapshot expires no later than 7 days from the time of its
        * creation. Its exact lifetime is determined at creation by the existing
        * backlog in the source subscription. Specifically, the lifetime of the
    @@ -325,11 +269,12 @@ public com.google.protobuf.Timestamp getExpireTime() {
        * snapshot that would expire in less than 1 hour after creation.
        * 
    * - * .google.protobuf.Timestamp expire_time = 3; + * .google.protobuf.Timestamp expire_time = 3 [(.google.api.field_behavior) = OPTIONAL]; + * */ @java.lang.Override public com.google.protobuf.TimestampOrBuilder getExpireTimeOrBuilder() { - return getExpireTime(); + return expireTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : expireTime_; } public static final int LABELS_FIELD_NUMBER = 4; @@ -345,6 +290,7 @@ private static final class LabelsDefaultEntryHolder { ""); } + @SuppressWarnings("serial") private com.google.protobuf.MapField labels_; private com.google.protobuf.MapField internalGetLabels() { @@ -357,75 +303,83 @@ private com.google.protobuf.MapField interna public int getLabelsCount() { return internalGetLabels().getMap().size(); } + /** * * *
    -   * See [Creating and managing labels]
    +   * Optional. See [Creating and managing labels]
        * (https://cloud.google.com/pubsub/docs/labels).
        * 
    * - * map<string, string> labels = 4; + * map<string, string> labels = 4 [(.google.api.field_behavior) = OPTIONAL]; */ @java.lang.Override public boolean containsLabels(java.lang.String key) { if (key == null) { - throw new java.lang.NullPointerException(); + throw new NullPointerException("map key"); } return internalGetLabels().getMap().containsKey(key); } + /** Use {@link #getLabelsMap()} instead. */ @java.lang.Override @java.lang.Deprecated public java.util.Map getLabels() { return getLabelsMap(); } + /** * * *
    -   * See [Creating and managing labels]
    +   * Optional. See [Creating and managing labels]
        * (https://cloud.google.com/pubsub/docs/labels).
        * 
    * - * map<string, string> labels = 4; + * map<string, string> labels = 4 [(.google.api.field_behavior) = OPTIONAL]; */ @java.lang.Override public java.util.Map getLabelsMap() { return internalGetLabels().getMap(); } + /** * * *
    -   * See [Creating and managing labels]
    +   * Optional. See [Creating and managing labels]
        * (https://cloud.google.com/pubsub/docs/labels).
        * 
    * - * map<string, string> labels = 4; + * map<string, string> labels = 4 [(.google.api.field_behavior) = OPTIONAL]; */ @java.lang.Override - public java.lang.String getLabelsOrDefault(java.lang.String key, java.lang.String defaultValue) { + public /* nullable */ java.lang.String getLabelsOrDefault( + java.lang.String key, + /* nullable */ + java.lang.String defaultValue) { if (key == null) { - throw new java.lang.NullPointerException(); + throw new NullPointerException("map key"); } java.util.Map map = internalGetLabels().getMap(); return map.containsKey(key) ? map.get(key) : defaultValue; } + /** * * *
    -   * See [Creating and managing labels]
    +   * Optional. See [Creating and managing labels]
        * (https://cloud.google.com/pubsub/docs/labels).
        * 
    * - * map<string, string> labels = 4; + * map<string, string> labels = 4 [(.google.api.field_behavior) = OPTIONAL]; */ @java.lang.Override public java.lang.String getLabelsOrThrow(java.lang.String key) { if (key == null) { - throw new java.lang.NullPointerException(); + throw new NullPointerException("map key"); } java.util.Map map = internalGetLabels().getMap(); if (!map.containsKey(key)) { @@ -448,18 +402,18 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!getNameBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, name_); } - if (!getTopicBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 2, topic_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(topic_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, topic_); } - if (expireTime_ != null) { + if (((bitField0_ & 0x00000001) != 0)) { output.writeMessage(3, getExpireTime()); } - com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( + com.google.protobuf.GeneratedMessage.serializeStringMapTo( output, internalGetLabels(), LabelsDefaultEntryHolder.defaultEntry, 4); - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -468,13 +422,13 @@ public int getSerializedSize() { if (size != -1) return size; size = 0; - if (!getNameBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, name_); } - if (!getTopicBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, topic_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(topic_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, topic_); } - if (expireTime_ != null) { + if (((bitField0_ & 0x00000001) != 0)) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getExpireTime()); } for (java.util.Map.Entry entry : @@ -487,7 +441,7 @@ public int getSerializedSize() { .build(); size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, labels__); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -509,7 +463,7 @@ public boolean equals(final java.lang.Object obj) { if (!getExpireTime().equals(other.getExpireTime())) return false; } if (!internalGetLabels().equals(other.internalGetLabels())) return false; - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -532,7 +486,7 @@ public int hashCode() { hash = (37 * hash) + LABELS_FIELD_NUMBER; hash = (53 * hash) + internalGetLabels().hashCode(); } - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -573,38 +527,38 @@ public static com.google.pubsub.v1.Snapshot parseFrom( public static com.google.pubsub.v1.Snapshot parseFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.Snapshot parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.Snapshot parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); } public static com.google.pubsub.v1.Snapshot parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.Snapshot parseFrom(com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.Snapshot parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } @@ -627,10 +581,11 @@ public Builder toBuilder() { } @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** * * @@ -644,7 +599,7 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build * * Protobuf type {@code google.pubsub.v1.Snapshot} */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements // @@protoc_insertion_point(builder_implements:google.pubsub.v1.Snapshot) com.google.pubsub.v1.SnapshotOrBuilder { @@ -653,7 +608,8 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @SuppressWarnings({"rawtypes"}) - protected com.google.protobuf.MapField internalGetMapField(int number) { + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldReflection( + int number) { switch (number) { case 4: return internalGetLabels(); @@ -663,7 +619,8 @@ protected com.google.protobuf.MapField internalGetMapField(int number) { } @SuppressWarnings({"rawtypes"}) - protected com.google.protobuf.MapField internalGetMutableMapField(int number) { + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMutableMapFieldReflection( + int number) { switch (number) { case 4: return internalGetMutableLabels(); @@ -673,7 +630,7 @@ protected com.google.protobuf.MapField internalGetMutableMapField(int number) { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_Snapshot_fieldAccessorTable @@ -686,26 +643,26 @@ private Builder() { maybeForceBuilderInitialization(); } - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + internalGetExpireTimeFieldBuilder(); + } } @java.lang.Override public Builder clear() { super.clear(); + bitField0_ = 0; name_ = ""; - topic_ = ""; - - if (expireTimeBuilder_ == null) { - expireTime_ = null; - } else { - expireTime_ = null; + expireTime_ = null; + if (expireTimeBuilder_ != null) { + expireTimeBuilder_.dispose(); expireTimeBuilder_ = null; } internalGetMutableLabels().clear(); @@ -734,51 +691,31 @@ public com.google.pubsub.v1.Snapshot build() { @java.lang.Override public com.google.pubsub.v1.Snapshot buildPartial() { com.google.pubsub.v1.Snapshot result = new com.google.pubsub.v1.Snapshot(this); - int from_bitField0_ = bitField0_; - result.name_ = name_; - result.topic_ = topic_; - if (expireTimeBuilder_ == null) { - result.expireTime_ = expireTime_; - } else { - result.expireTime_ = expireTimeBuilder_.build(); + if (bitField0_ != 0) { + buildPartial0(result); } - result.labels_ = internalGetLabels(); - result.labels_.makeImmutable(); onBuilt(); return result; } - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); + private void buildPartial0(com.google.pubsub.v1.Snapshot result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.name_ = name_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.topic_ = topic_; + } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000004) != 0)) { + result.expireTime_ = expireTimeBuilder_ == null ? expireTime_ : expireTimeBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.labels_ = internalGetLabels(); + result.labels_.makeImmutable(); + } + result.bitField0_ |= to_bitField0_; } @java.lang.Override @@ -795,17 +732,20 @@ public Builder mergeFrom(com.google.pubsub.v1.Snapshot other) { if (other == com.google.pubsub.v1.Snapshot.getDefaultInstance()) return this; if (!other.getName().isEmpty()) { name_ = other.name_; + bitField0_ |= 0x00000001; onChanged(); } if (!other.getTopic().isEmpty()) { topic_ = other.topic_; + bitField0_ |= 0x00000002; onChanged(); } if (other.hasExpireTime()) { mergeExpireTime(other.getExpireTime()); } internalGetMutableLabels().mergeFrom(other.internalGetLabels()); - this.mergeUnknownFields(other.unknownFields); + bitField0_ |= 0x00000008; + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -820,31 +760,77 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.pubsub.v1.Snapshot parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + name_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + topic_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: + { + input.readMessage( + internalGetExpireTimeFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000004; + break; + } // case 26 + case 34: + { + com.google.protobuf.MapEntry labels__ = + input.readMessage( + LabelsDefaultEntryHolder.defaultEntry.getParserForType(), + extensionRegistry); + internalGetMutableLabels() + .getMutableMap() + .put(labels__.getKey(), labels__.getValue()); + bitField0_ |= 0x00000008; + break; + } // case 34 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.google.pubsub.v1.Snapshot) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } private int bitField0_; private java.lang.Object name_ = ""; + /** * * *
    -     * The name of the snapshot.
    +     * Optional. The name of the snapshot.
          * 
    * - * string name = 1; + * string name = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @return The name. */ @@ -859,14 +845,15 @@ public java.lang.String getName() { return (java.lang.String) ref; } } + /** * * *
    -     * The name of the snapshot.
    +     * Optional. The name of the snapshot.
          * 
    * - * string name = 1; + * string name = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @return The bytes for name. */ @@ -881,14 +868,15 @@ public com.google.protobuf.ByteString getNameBytes() { return (com.google.protobuf.ByteString) ref; } } + /** * * *
    -     * The name of the snapshot.
    +     * Optional. The name of the snapshot.
          * 
    * - * string name = 1; + * string name = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @param value The name to set. * @return This builder for chaining. @@ -897,36 +885,38 @@ public Builder setName(java.lang.String value) { if (value == null) { throw new NullPointerException(); } - name_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } + /** * * *
    -     * The name of the snapshot.
    +     * Optional. The name of the snapshot.
          * 
    * - * string name = 1; + * string name = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @return This builder for chaining. */ public Builder clearName() { - name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000001); onChanged(); return this; } + /** * * *
    -     * The name of the snapshot.
    +     * Optional. The name of the snapshot.
          * 
    * - * string name = 1; + * string name = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @param value The bytes for name to set. * @return This builder for chaining. @@ -936,21 +926,25 @@ public Builder setNameBytes(com.google.protobuf.ByteString value) { throw new NullPointerException(); } checkByteStringIsUtf8(value); - name_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } private java.lang.Object topic_ = ""; + /** * * *
    -     * The name of the topic from which this snapshot is retaining messages.
    +     * Optional. The name of the topic from which this snapshot is retaining
    +     * messages.
          * 
    * - * string topic = 2 [(.google.api.resource_reference) = { ... } + * + * string topic = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return The topic. */ @@ -965,14 +959,18 @@ public java.lang.String getTopic() { return (java.lang.String) ref; } } + /** * * *
    -     * The name of the topic from which this snapshot is retaining messages.
    +     * Optional. The name of the topic from which this snapshot is retaining
    +     * messages.
          * 
    * - * string topic = 2 [(.google.api.resource_reference) = { ... } + * + * string topic = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return The bytes for topic. */ @@ -987,14 +985,18 @@ public com.google.protobuf.ByteString getTopicBytes() { return (com.google.protobuf.ByteString) ref; } } + /** * * *
    -     * The name of the topic from which this snapshot is retaining messages.
    +     * Optional. The name of the topic from which this snapshot is retaining
    +     * messages.
          * 
    * - * string topic = 2 [(.google.api.resource_reference) = { ... } + * + * string topic = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @param value The topic to set. * @return This builder for chaining. @@ -1003,36 +1005,44 @@ public Builder setTopic(java.lang.String value) { if (value == null) { throw new NullPointerException(); } - topic_ = value; + bitField0_ |= 0x00000002; onChanged(); return this; } + /** * * *
    -     * The name of the topic from which this snapshot is retaining messages.
    +     * Optional. The name of the topic from which this snapshot is retaining
    +     * messages.
          * 
    * - * string topic = 2 [(.google.api.resource_reference) = { ... } + * + * string topic = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return This builder for chaining. */ public Builder clearTopic() { - topic_ = getDefaultInstance().getTopic(); + bitField0_ = (bitField0_ & ~0x00000002); onChanged(); return this; } + /** * * *
    -     * The name of the topic from which this snapshot is retaining messages.
    +     * Optional. The name of the topic from which this snapshot is retaining
    +     * messages.
          * 
    * - * string topic = 2 [(.google.api.resource_reference) = { ... } + * + * string topic = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @param value The bytes for topic to set. * @return This builder for chaining. @@ -1042,23 +1052,24 @@ public Builder setTopicBytes(com.google.protobuf.ByteString value) { throw new NullPointerException(); } checkByteStringIsUtf8(value); - topic_ = value; + bitField0_ |= 0x00000002; onChanged(); return this; } private com.google.protobuf.Timestamp expireTime_; - private com.google.protobuf.SingleFieldBuilderV3< + private com.google.protobuf.SingleFieldBuilder< com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder> expireTimeBuilder_; + /** * * *
    -     * The snapshot is guaranteed to exist up until this time.
    +     * Optional. The snapshot is guaranteed to exist up until this time.
          * A newly-created snapshot expires no later than 7 days from the time of its
          * creation. Its exact lifetime is determined at creation by the existing
          * backlog in the source subscription. Specifically, the lifetime of the
    @@ -1070,18 +1081,20 @@ public Builder setTopicBytes(com.google.protobuf.ByteString value) {
          * snapshot that would expire in less than 1 hour after creation.
          * 
    * - * .google.protobuf.Timestamp expire_time = 3; + * .google.protobuf.Timestamp expire_time = 3 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return Whether the expireTime field is set. */ public boolean hasExpireTime() { - return expireTimeBuilder_ != null || expireTime_ != null; + return ((bitField0_ & 0x00000004) != 0); } + /** * * *
    -     * The snapshot is guaranteed to exist up until this time.
    +     * Optional. The snapshot is guaranteed to exist up until this time.
          * A newly-created snapshot expires no later than 7 days from the time of its
          * creation. Its exact lifetime is determined at creation by the existing
          * backlog in the source subscription. Specifically, the lifetime of the
    @@ -1093,7 +1106,8 @@ public boolean hasExpireTime() {
          * snapshot that would expire in less than 1 hour after creation.
          * 
    * - * .google.protobuf.Timestamp expire_time = 3; + * .google.protobuf.Timestamp expire_time = 3 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return The expireTime. */ @@ -1106,11 +1120,12 @@ public com.google.protobuf.Timestamp getExpireTime() { return expireTimeBuilder_.getMessage(); } } + /** * * *
    -     * The snapshot is guaranteed to exist up until this time.
    +     * Optional. The snapshot is guaranteed to exist up until this time.
          * A newly-created snapshot expires no later than 7 days from the time of its
          * creation. Its exact lifetime is determined at creation by the existing
          * backlog in the source subscription. Specifically, the lifetime of the
    @@ -1122,7 +1137,8 @@ public com.google.protobuf.Timestamp getExpireTime() {
          * snapshot that would expire in less than 1 hour after creation.
          * 
    * - * .google.protobuf.Timestamp expire_time = 3; + * .google.protobuf.Timestamp expire_time = 3 [(.google.api.field_behavior) = OPTIONAL]; + * */ public Builder setExpireTime(com.google.protobuf.Timestamp value) { if (expireTimeBuilder_ == null) { @@ -1130,18 +1146,19 @@ public Builder setExpireTime(com.google.protobuf.Timestamp value) { throw new NullPointerException(); } expireTime_ = value; - onChanged(); } else { expireTimeBuilder_.setMessage(value); } - + bitField0_ |= 0x00000004; + onChanged(); return this; } + /** * * *
    -     * The snapshot is guaranteed to exist up until this time.
    +     * Optional. The snapshot is guaranteed to exist up until this time.
          * A newly-created snapshot expires no later than 7 days from the time of its
          * creation. Its exact lifetime is determined at creation by the existing
          * backlog in the source subscription. Specifically, the lifetime of the
    @@ -1153,23 +1170,25 @@ public Builder setExpireTime(com.google.protobuf.Timestamp value) {
          * snapshot that would expire in less than 1 hour after creation.
          * 
    * - * .google.protobuf.Timestamp expire_time = 3; + * .google.protobuf.Timestamp expire_time = 3 [(.google.api.field_behavior) = OPTIONAL]; + * */ public Builder setExpireTime(com.google.protobuf.Timestamp.Builder builderForValue) { if (expireTimeBuilder_ == null) { expireTime_ = builderForValue.build(); - onChanged(); } else { expireTimeBuilder_.setMessage(builderForValue.build()); } - + bitField0_ |= 0x00000004; + onChanged(); return this; } + /** * * *
    -     * The snapshot is guaranteed to exist up until this time.
    +     * Optional. The snapshot is guaranteed to exist up until this time.
          * A newly-created snapshot expires no later than 7 days from the time of its
          * creation. Its exact lifetime is determined at creation by the existing
          * backlog in the source subscription. Specifically, the lifetime of the
    @@ -1181,28 +1200,33 @@ public Builder setExpireTime(com.google.protobuf.Timestamp.Builder builderForVal
          * snapshot that would expire in less than 1 hour after creation.
          * 
    * - * .google.protobuf.Timestamp expire_time = 3; + * .google.protobuf.Timestamp expire_time = 3 [(.google.api.field_behavior) = OPTIONAL]; + * */ public Builder mergeExpireTime(com.google.protobuf.Timestamp value) { if (expireTimeBuilder_ == null) { - if (expireTime_ != null) { - expireTime_ = - com.google.protobuf.Timestamp.newBuilder(expireTime_).mergeFrom(value).buildPartial(); + if (((bitField0_ & 0x00000004) != 0) + && expireTime_ != null + && expireTime_ != com.google.protobuf.Timestamp.getDefaultInstance()) { + getExpireTimeBuilder().mergeFrom(value); } else { expireTime_ = value; } - onChanged(); } else { expireTimeBuilder_.mergeFrom(value); } - + if (expireTime_ != null) { + bitField0_ |= 0x00000004; + onChanged(); + } return this; } + /** * * *
    -     * The snapshot is guaranteed to exist up until this time.
    +     * Optional. The snapshot is guaranteed to exist up until this time.
          * A newly-created snapshot expires no later than 7 days from the time of its
          * creation. Its exact lifetime is determined at creation by the existing
          * backlog in the source subscription. Specifically, the lifetime of the
    @@ -1214,24 +1238,25 @@ public Builder mergeExpireTime(com.google.protobuf.Timestamp value) {
          * snapshot that would expire in less than 1 hour after creation.
          * 
    * - * .google.protobuf.Timestamp expire_time = 3; + * .google.protobuf.Timestamp expire_time = 3 [(.google.api.field_behavior) = OPTIONAL]; + * */ public Builder clearExpireTime() { - if (expireTimeBuilder_ == null) { - expireTime_ = null; - onChanged(); - } else { - expireTime_ = null; + bitField0_ = (bitField0_ & ~0x00000004); + expireTime_ = null; + if (expireTimeBuilder_ != null) { + expireTimeBuilder_.dispose(); expireTimeBuilder_ = null; } - + onChanged(); return this; } + /** * * *
    -     * The snapshot is guaranteed to exist up until this time.
    +     * Optional. The snapshot is guaranteed to exist up until this time.
          * A newly-created snapshot expires no later than 7 days from the time of its
          * creation. Its exact lifetime is determined at creation by the existing
          * backlog in the source subscription. Specifically, the lifetime of the
    @@ -1243,18 +1268,20 @@ public Builder clearExpireTime() {
          * snapshot that would expire in less than 1 hour after creation.
          * 
    * - * .google.protobuf.Timestamp expire_time = 3; + * .google.protobuf.Timestamp expire_time = 3 [(.google.api.field_behavior) = OPTIONAL]; + * */ public com.google.protobuf.Timestamp.Builder getExpireTimeBuilder() { - + bitField0_ |= 0x00000004; onChanged(); - return getExpireTimeFieldBuilder().getBuilder(); + return internalGetExpireTimeFieldBuilder().getBuilder(); } + /** * * *
    -     * The snapshot is guaranteed to exist up until this time.
    +     * Optional. The snapshot is guaranteed to exist up until this time.
          * A newly-created snapshot expires no later than 7 days from the time of its
          * creation. Its exact lifetime is determined at creation by the existing
          * backlog in the source subscription. Specifically, the lifetime of the
    @@ -1266,7 +1293,8 @@ public com.google.protobuf.Timestamp.Builder getExpireTimeBuilder() {
          * snapshot that would expire in less than 1 hour after creation.
          * 
    * - * .google.protobuf.Timestamp expire_time = 3; + * .google.protobuf.Timestamp expire_time = 3 [(.google.api.field_behavior) = OPTIONAL]; + * */ public com.google.protobuf.TimestampOrBuilder getExpireTimeOrBuilder() { if (expireTimeBuilder_ != null) { @@ -1277,11 +1305,12 @@ public com.google.protobuf.TimestampOrBuilder getExpireTimeOrBuilder() { : expireTime_; } } + /** * * *
    -     * The snapshot is guaranteed to exist up until this time.
    +     * Optional. The snapshot is guaranteed to exist up until this time.
          * A newly-created snapshot expires no later than 7 days from the time of its
          * creation. Its exact lifetime is determined at creation by the existing
          * backlog in the source subscription. Specifically, the lifetime of the
    @@ -1293,16 +1322,17 @@ public com.google.protobuf.TimestampOrBuilder getExpireTimeOrBuilder() {
          * snapshot that would expire in less than 1 hour after creation.
          * 
    * - * .google.protobuf.Timestamp expire_time = 3; + * .google.protobuf.Timestamp expire_time = 3 [(.google.api.field_behavior) = OPTIONAL]; + * */ - private com.google.protobuf.SingleFieldBuilderV3< + private com.google.protobuf.SingleFieldBuilder< com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder> - getExpireTimeFieldBuilder() { + internalGetExpireTimeFieldBuilder() { if (expireTimeBuilder_ == null) { expireTimeBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< + new com.google.protobuf.SingleFieldBuilder< com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder>( @@ -1323,90 +1353,97 @@ private com.google.protobuf.MapField interna private com.google.protobuf.MapField internalGetMutableLabels() { - onChanged(); - ; if (labels_ == null) { labels_ = com.google.protobuf.MapField.newMapField(LabelsDefaultEntryHolder.defaultEntry); } if (!labels_.isMutable()) { labels_ = labels_.copy(); } + bitField0_ |= 0x00000008; + onChanged(); return labels_; } public int getLabelsCount() { return internalGetLabels().getMap().size(); } + /** * * *
    -     * See [Creating and managing labels]
    +     * Optional. See [Creating and managing labels]
          * (https://cloud.google.com/pubsub/docs/labels).
          * 
    * - * map<string, string> labels = 4; + * map<string, string> labels = 4 [(.google.api.field_behavior) = OPTIONAL]; */ @java.lang.Override public boolean containsLabels(java.lang.String key) { if (key == null) { - throw new java.lang.NullPointerException(); + throw new NullPointerException("map key"); } return internalGetLabels().getMap().containsKey(key); } + /** Use {@link #getLabelsMap()} instead. */ @java.lang.Override @java.lang.Deprecated public java.util.Map getLabels() { return getLabelsMap(); } + /** * * *
    -     * See [Creating and managing labels]
    +     * Optional. See [Creating and managing labels]
          * (https://cloud.google.com/pubsub/docs/labels).
          * 
    * - * map<string, string> labels = 4; + * map<string, string> labels = 4 [(.google.api.field_behavior) = OPTIONAL]; */ @java.lang.Override public java.util.Map getLabelsMap() { return internalGetLabels().getMap(); } + /** * * *
    -     * See [Creating and managing labels]
    +     * Optional. See [Creating and managing labels]
          * (https://cloud.google.com/pubsub/docs/labels).
          * 
    * - * map<string, string> labels = 4; + * map<string, string> labels = 4 [(.google.api.field_behavior) = OPTIONAL]; */ @java.lang.Override - public java.lang.String getLabelsOrDefault( - java.lang.String key, java.lang.String defaultValue) { + public /* nullable */ java.lang.String getLabelsOrDefault( + java.lang.String key, + /* nullable */ + java.lang.String defaultValue) { if (key == null) { - throw new java.lang.NullPointerException(); + throw new NullPointerException("map key"); } java.util.Map map = internalGetLabels().getMap(); return map.containsKey(key) ? map.get(key) : defaultValue; } + /** * * *
    -     * See [Creating and managing labels]
    +     * Optional. See [Creating and managing labels]
          * (https://cloud.google.com/pubsub/docs/labels).
          * 
    * - * map<string, string> labels = 4; + * map<string, string> labels = 4 [(.google.api.field_behavior) = OPTIONAL]; */ @java.lang.Override public java.lang.String getLabelsOrThrow(java.lang.String key) { if (key == null) { - throw new java.lang.NullPointerException(); + throw new NullPointerException("map key"); } java.util.Map map = internalGetLabels().getMap(); if (!map.containsKey(key)) { @@ -1416,77 +1453,74 @@ public java.lang.String getLabelsOrThrow(java.lang.String key) { } public Builder clearLabels() { + bitField0_ = (bitField0_ & ~0x00000008); internalGetMutableLabels().getMutableMap().clear(); return this; } + /** * * *
    -     * See [Creating and managing labels]
    +     * Optional. See [Creating and managing labels]
          * (https://cloud.google.com/pubsub/docs/labels).
          * 
    * - * map<string, string> labels = 4; + * map<string, string> labels = 4 [(.google.api.field_behavior) = OPTIONAL]; */ public Builder removeLabels(java.lang.String key) { if (key == null) { - throw new java.lang.NullPointerException(); + throw new NullPointerException("map key"); } internalGetMutableLabels().getMutableMap().remove(key); return this; } + /** Use alternate mutation accessors instead. */ @java.lang.Deprecated public java.util.Map getMutableLabels() { + bitField0_ |= 0x00000008; return internalGetMutableLabels().getMutableMap(); } + /** * * *
    -     * See [Creating and managing labels]
    +     * Optional. See [Creating and managing labels]
          * (https://cloud.google.com/pubsub/docs/labels).
          * 
    * - * map<string, string> labels = 4; + * map<string, string> labels = 4 [(.google.api.field_behavior) = OPTIONAL]; */ public Builder putLabels(java.lang.String key, java.lang.String value) { if (key == null) { - throw new java.lang.NullPointerException(); + throw new NullPointerException("map key"); } if (value == null) { - throw new java.lang.NullPointerException(); + throw new NullPointerException("map value"); } internalGetMutableLabels().getMutableMap().put(key, value); + bitField0_ |= 0x00000008; return this; } + /** * * *
    -     * See [Creating and managing labels]
    +     * Optional. See [Creating and managing labels]
          * (https://cloud.google.com/pubsub/docs/labels).
          * 
    * - * map<string, string> labels = 4; + * map<string, string> labels = 4 [(.google.api.field_behavior) = OPTIONAL]; */ public Builder putAllLabels(java.util.Map values) { internalGetMutableLabels().getMutableMap().putAll(values); + bitField0_ |= 0x00000008; return this; } - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - // @@protoc_insertion_point(builder_scope:google.pubsub.v1.Snapshot) } @@ -1508,7 +1542,18 @@ public Snapshot parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new Snapshot(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SnapshotName.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SnapshotName.java new file mode 100644 index 000000000..a3a234239 --- /dev/null +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SnapshotName.java @@ -0,0 +1,192 @@ +/* + * Copyright 2026 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 SnapshotName implements ResourceName { + private static final PathTemplate PROJECT_SNAPSHOT = + PathTemplate.createWithoutUrlEncoding("projects/{project}/snapshots/{snapshot}"); + private volatile Map fieldValuesMap; + private final String project; + private final String snapshot; + + @Deprecated + protected SnapshotName() { + project = null; + snapshot = null; + } + + private SnapshotName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + snapshot = Preconditions.checkNotNull(builder.getSnapshot()); + } + + public String getProject() { + return project; + } + + public String getSnapshot() { + return snapshot; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + public static SnapshotName of(String project, String snapshot) { + return newBuilder().setProject(project).setSnapshot(snapshot).build(); + } + + public static String format(String project, String snapshot) { + return newBuilder().setProject(project).setSnapshot(snapshot).build().toString(); + } + + public static SnapshotName parse(String formattedString) { + if (formattedString.isEmpty()) { + return null; + } + Map matchMap = + PROJECT_SNAPSHOT.validatedMatch( + formattedString, "SnapshotName.parse: formattedString not in valid format"); + return of(matchMap.get("project"), matchMap.get("snapshot")); + } + + 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 (SnapshotName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return PROJECT_SNAPSHOT.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 (snapshot != null) { + fieldMapBuilder.put("snapshot", snapshot); + } + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + @Override + public String toString() { + return PROJECT_SNAPSHOT.instantiate("project", project, "snapshot", snapshot); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null && getClass() == o.getClass()) { + SnapshotName that = ((SnapshotName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.snapshot, that.snapshot); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(snapshot); + return h; + } + + /** Builder for projects/{project}/snapshots/{snapshot}. */ + public static class Builder { + private String project; + private String snapshot; + + protected Builder() {} + + public String getProject() { + return project; + } + + public String getSnapshot() { + return snapshot; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setSnapshot(String snapshot) { + this.snapshot = snapshot; + return this; + } + + private Builder(SnapshotName snapshotName) { + this.project = snapshotName.project; + this.snapshot = snapshotName.snapshot; + } + + public SnapshotName build() { + return new SnapshotName(this); + } + } +} diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SnapshotOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SnapshotOrBuilder.java index c8d3ed3ad..c84e5b505 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SnapshotOrBuilder.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SnapshotOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; +@com.google.protobuf.Generated public interface SnapshotOrBuilder extends // @@protoc_insertion_point(interface_extends:google.pubsub.v1.Snapshot) @@ -27,22 +30,23 @@ public interface SnapshotOrBuilder * * *
    -   * The name of the snapshot.
    +   * Optional. The name of the snapshot.
        * 
    * - * string name = 1; + * string name = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @return The name. */ java.lang.String getName(); + /** * * *
    -   * The name of the snapshot.
    +   * Optional. The name of the snapshot.
        * 
    * - * string name = 1; + * string name = 1 [(.google.api.field_behavior) = OPTIONAL]; * * @return The bytes for name. */ @@ -52,22 +56,29 @@ public interface SnapshotOrBuilder * * *
    -   * The name of the topic from which this snapshot is retaining messages.
    +   * Optional. The name of the topic from which this snapshot is retaining
    +   * messages.
        * 
    * - * string topic = 2 [(.google.api.resource_reference) = { ... } + * + * string topic = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return The topic. */ java.lang.String getTopic(); + /** * * *
    -   * The name of the topic from which this snapshot is retaining messages.
    +   * Optional. The name of the topic from which this snapshot is retaining
    +   * messages.
        * 
    * - * string topic = 2 [(.google.api.resource_reference) = { ... } + * + * string topic = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return The bytes for topic. */ @@ -77,7 +88,7 @@ public interface SnapshotOrBuilder * * *
    -   * The snapshot is guaranteed to exist up until this time.
    +   * Optional. The snapshot is guaranteed to exist up until this time.
        * A newly-created snapshot expires no later than 7 days from the time of its
        * creation. Its exact lifetime is determined at creation by the existing
        * backlog in the source subscription. Specifically, the lifetime of the
    @@ -89,16 +100,18 @@ public interface SnapshotOrBuilder
        * snapshot that would expire in less than 1 hour after creation.
        * 
    * - * .google.protobuf.Timestamp expire_time = 3; + * .google.protobuf.Timestamp expire_time = 3 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return Whether the expireTime field is set. */ boolean hasExpireTime(); + /** * * *
    -   * The snapshot is guaranteed to exist up until this time.
    +   * Optional. The snapshot is guaranteed to exist up until this time.
        * A newly-created snapshot expires no later than 7 days from the time of its
        * creation. Its exact lifetime is determined at creation by the existing
        * backlog in the source subscription. Specifically, the lifetime of the
    @@ -110,16 +123,18 @@ public interface SnapshotOrBuilder
        * snapshot that would expire in less than 1 hour after creation.
        * 
    * - * .google.protobuf.Timestamp expire_time = 3; + * .google.protobuf.Timestamp expire_time = 3 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return The expireTime. */ com.google.protobuf.Timestamp getExpireTime(); + /** * * *
    -   * The snapshot is guaranteed to exist up until this time.
    +   * Optional. The snapshot is guaranteed to exist up until this time.
        * A newly-created snapshot expires no later than 7 days from the time of its
        * creation. Its exact lifetime is determined at creation by the existing
        * backlog in the source subscription. Specifically, the lifetime of the
    @@ -131,7 +146,8 @@ public interface SnapshotOrBuilder
        * snapshot that would expire in less than 1 hour after creation.
        * 
    * - * .google.protobuf.Timestamp expire_time = 3; + * .google.protobuf.Timestamp expire_time = 3 [(.google.api.field_behavior) = OPTIONAL]; + * */ com.google.protobuf.TimestampOrBuilder getExpireTimeOrBuilder(); @@ -139,58 +155,67 @@ public interface SnapshotOrBuilder * * *
    -   * See [Creating and managing labels]
    +   * Optional. See [Creating and managing labels]
        * (https://cloud.google.com/pubsub/docs/labels).
        * 
    * - * map<string, string> labels = 4; + * map<string, string> labels = 4 [(.google.api.field_behavior) = OPTIONAL]; */ int getLabelsCount(); + /** * * *
    -   * See [Creating and managing labels]
    +   * Optional. See [Creating and managing labels]
        * (https://cloud.google.com/pubsub/docs/labels).
        * 
    * - * map<string, string> labels = 4; + * map<string, string> labels = 4 [(.google.api.field_behavior) = OPTIONAL]; */ boolean containsLabels(java.lang.String key); + /** Use {@link #getLabelsMap()} instead. */ @java.lang.Deprecated java.util.Map getLabels(); + /** * * *
    -   * See [Creating and managing labels]
    +   * Optional. See [Creating and managing labels]
        * (https://cloud.google.com/pubsub/docs/labels).
        * 
    * - * map<string, string> labels = 4; + * map<string, string> labels = 4 [(.google.api.field_behavior) = OPTIONAL]; */ java.util.Map getLabelsMap(); + /** * * *
    -   * See [Creating and managing labels]
    +   * Optional. See [Creating and managing labels]
        * (https://cloud.google.com/pubsub/docs/labels).
        * 
    * - * map<string, string> labels = 4; + * map<string, string> labels = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - java.lang.String getLabelsOrDefault(java.lang.String key, java.lang.String defaultValue); + /* nullable */ + java.lang.String getLabelsOrDefault( + java.lang.String key, + /* nullable */ + java.lang.String defaultValue); + /** * * *
    -   * See [Creating and managing labels]
    +   * Optional. See [Creating and managing labels]
        * (https://cloud.google.com/pubsub/docs/labels).
        * 
    * - * map<string, string> labels = 4; + * map<string, string> labels = 4 [(.google.api.field_behavior) = OPTIONAL]; */ java.lang.String getLabelsOrThrow(java.lang.String key); } diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/StreamingPullRequest.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/StreamingPullRequest.java index d0c8d9a3f..6187f41a0 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/StreamingPullRequest.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/StreamingPullRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; @@ -23,167 +25,49 @@ * *
      * Request for the `StreamingPull` streaming RPC method. This request is used to
    - * establish the initial stream as well as to stream acknowledgements and ack
    + * establish the initial stream as well as to stream acknowledgments and ack
      * deadline modifications from the client to the server.
      * 
    * * Protobuf type {@code google.pubsub.v1.StreamingPullRequest} */ -public final class StreamingPullRequest extends com.google.protobuf.GeneratedMessageV3 +@com.google.protobuf.Generated +public final class StreamingPullRequest extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:google.pubsub.v1.StreamingPullRequest) StreamingPullRequestOrBuilder { private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "StreamingPullRequest"); + } + // Use StreamingPullRequest.newBuilder() to construct. - private StreamingPullRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + private StreamingPullRequest(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); } private StreamingPullRequest() { subscription_ = ""; - ackIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; + ackIds_ = com.google.protobuf.LazyStringArrayList.emptyList(); modifyDeadlineSeconds_ = emptyIntList(); - modifyDeadlineAckIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; + modifyDeadlineAckIds_ = com.google.protobuf.LazyStringArrayList.emptyList(); clientId_ = ""; } - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new StreamingPullRequest(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - private StreamingPullRequest( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - java.lang.String s = input.readStringRequireUtf8(); - - subscription_ = s; - break; - } - case 18: - { - java.lang.String s = input.readStringRequireUtf8(); - if (!((mutable_bitField0_ & 0x00000001) != 0)) { - ackIds_ = new com.google.protobuf.LazyStringArrayList(); - mutable_bitField0_ |= 0x00000001; - } - ackIds_.add(s); - break; - } - case 24: - { - if (!((mutable_bitField0_ & 0x00000002) != 0)) { - modifyDeadlineSeconds_ = newIntList(); - mutable_bitField0_ |= 0x00000002; - } - modifyDeadlineSeconds_.addInt(input.readInt32()); - break; - } - case 26: - { - int length = input.readRawVarint32(); - int limit = input.pushLimit(length); - if (!((mutable_bitField0_ & 0x00000002) != 0) && input.getBytesUntilLimit() > 0) { - modifyDeadlineSeconds_ = newIntList(); - mutable_bitField0_ |= 0x00000002; - } - while (input.getBytesUntilLimit() > 0) { - modifyDeadlineSeconds_.addInt(input.readInt32()); - } - input.popLimit(limit); - break; - } - case 34: - { - java.lang.String s = input.readStringRequireUtf8(); - if (!((mutable_bitField0_ & 0x00000004) != 0)) { - modifyDeadlineAckIds_ = new com.google.protobuf.LazyStringArrayList(); - mutable_bitField0_ |= 0x00000004; - } - modifyDeadlineAckIds_.add(s); - break; - } - case 40: - { - streamAckDeadlineSeconds_ = input.readInt32(); - break; - } - case 50: - { - java.lang.String s = input.readStringRequireUtf8(); - - clientId_ = s; - break; - } - case 56: - { - maxOutstandingMessages_ = input.readInt64(); - break; - } - case 64: - { - maxOutstandingBytes_ = input.readInt64(); - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000001) != 0)) { - ackIds_ = ackIds_.getUnmodifiableView(); - } - if (((mutable_bitField0_ & 0x00000002) != 0)) { - modifyDeadlineSeconds_.makeImmutable(); // C - } - if (((mutable_bitField0_ & 0x00000004) != 0)) { - modifyDeadlineAckIds_ = modifyDeadlineAckIds_.getUnmodifiableView(); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_StreamingPullRequest_descriptor; } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_StreamingPullRequest_fieldAccessorTable @@ -193,7 +77,10 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } public static final int SUBSCRIPTION_FIELD_NUMBER = 1; - private volatile java.lang.Object subscription_; + + @SuppressWarnings("serial") + private volatile java.lang.Object subscription_ = ""; + /** * * @@ -222,6 +109,7 @@ public java.lang.String getSubscription() { return s; } } + /** * * @@ -252,55 +140,61 @@ public com.google.protobuf.ByteString getSubscriptionBytes() { } public static final int ACK_IDS_FIELD_NUMBER = 2; - private com.google.protobuf.LazyStringList ackIds_; + + @SuppressWarnings("serial") + private com.google.protobuf.LazyStringArrayList ackIds_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + /** * * *
    -   * List of acknowledgement IDs for acknowledging previously received messages
    -   * (received on this stream or a different stream). If an ack ID has expired,
    -   * the corresponding message may be redelivered later. Acknowledging a message
    -   * more than once will not result in an error. If the acknowledgement ID is
    -   * malformed, the stream will be aborted with status `INVALID_ARGUMENT`.
    +   * Optional. List of acknowledgment IDs for acknowledging previously received
    +   * messages (received on this stream or a different stream). If an ack ID has
    +   * expired, the corresponding message may be redelivered later. Acknowledging
    +   * a message more than once will not result in an error. If the acknowledgment
    +   * ID is malformed, the stream will be aborted with status `INVALID_ARGUMENT`.
        * 
    * - * repeated string ack_ids = 2; + * repeated string ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return A list containing the ackIds. */ public com.google.protobuf.ProtocolStringList getAckIdsList() { return ackIds_; } + /** * * *
    -   * List of acknowledgement IDs for acknowledging previously received messages
    -   * (received on this stream or a different stream). If an ack ID has expired,
    -   * the corresponding message may be redelivered later. Acknowledging a message
    -   * more than once will not result in an error. If the acknowledgement ID is
    -   * malformed, the stream will be aborted with status `INVALID_ARGUMENT`.
    +   * Optional. List of acknowledgment IDs for acknowledging previously received
    +   * messages (received on this stream or a different stream). If an ack ID has
    +   * expired, the corresponding message may be redelivered later. Acknowledging
    +   * a message more than once will not result in an error. If the acknowledgment
    +   * ID is malformed, the stream will be aborted with status `INVALID_ARGUMENT`.
        * 
    * - * repeated string ack_ids = 2; + * repeated string ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The count of ackIds. */ public int getAckIdsCount() { return ackIds_.size(); } + /** * * *
    -   * List of acknowledgement IDs for acknowledging previously received messages
    -   * (received on this stream or a different stream). If an ack ID has expired,
    -   * the corresponding message may be redelivered later. Acknowledging a message
    -   * more than once will not result in an error. If the acknowledgement ID is
    -   * malformed, the stream will be aborted with status `INVALID_ARGUMENT`.
    +   * Optional. List of acknowledgment IDs for acknowledging previously received
    +   * messages (received on this stream or a different stream). If an ack ID has
    +   * expired, the corresponding message may be redelivered later. Acknowledging
    +   * a message more than once will not result in an error. If the acknowledgment
    +   * ID is malformed, the stream will be aborted with status `INVALID_ARGUMENT`.
        * 
    * - * repeated string ack_ids = 2; + * repeated string ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @param index The index of the element to return. * @return The ackIds at the given index. @@ -308,18 +202,19 @@ public int getAckIdsCount() { public java.lang.String getAckIds(int index) { return ackIds_.get(index); } + /** * * *
    -   * List of acknowledgement IDs for acknowledging previously received messages
    -   * (received on this stream or a different stream). If an ack ID has expired,
    -   * the corresponding message may be redelivered later. Acknowledging a message
    -   * more than once will not result in an error. If the acknowledgement ID is
    -   * malformed, the stream will be aborted with status `INVALID_ARGUMENT`.
    +   * Optional. List of acknowledgment IDs for acknowledging previously received
    +   * messages (received on this stream or a different stream). If an ack ID has
    +   * expired, the corresponding message may be redelivered later. Acknowledging
    +   * a message more than once will not result in an error. If the acknowledgment
    +   * ID is malformed, the stream will be aborted with status `INVALID_ARGUMENT`.
        * 
    * - * repeated string ack_ids = 2; + * repeated string ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @param index The index of the value to return. * @return The bytes of the ackIds at the given index. @@ -329,12 +224,15 @@ public com.google.protobuf.ByteString getAckIdsBytes(int index) { } public static final int MODIFY_DEADLINE_SECONDS_FIELD_NUMBER = 3; - private com.google.protobuf.Internal.IntList modifyDeadlineSeconds_; + + @SuppressWarnings("serial") + private com.google.protobuf.Internal.IntList modifyDeadlineSeconds_ = emptyIntList(); + /** * * *
    -   * The list of new ack deadlines for the IDs listed in
    +   * Optional. The list of new ack deadlines for the IDs listed in
        * `modify_deadline_ack_ids`. The size of this list must be the same as the
        * size of `modify_deadline_ack_ids`. If it differs the stream will be aborted
        * with `INVALID_ARGUMENT`. Each element in this list is applied to the
    @@ -347,7 +245,8 @@ public com.google.protobuf.ByteString getAckIdsBytes(int index) {
        * be aborted with status `INVALID_ARGUMENT`.
        * 
    * - * repeated int32 modify_deadline_seconds = 3; + * repeated int32 modify_deadline_seconds = 3 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return A list containing the modifyDeadlineSeconds. */ @@ -355,11 +254,12 @@ public com.google.protobuf.ByteString getAckIdsBytes(int index) { public java.util.List getModifyDeadlineSecondsList() { return modifyDeadlineSeconds_; } + /** * * *
    -   * The list of new ack deadlines for the IDs listed in
    +   * Optional. The list of new ack deadlines for the IDs listed in
        * `modify_deadline_ack_ids`. The size of this list must be the same as the
        * size of `modify_deadline_ack_ids`. If it differs the stream will be aborted
        * with `INVALID_ARGUMENT`. Each element in this list is applied to the
    @@ -372,18 +272,20 @@ public java.util.List getModifyDeadlineSecondsList() {
        * be aborted with status `INVALID_ARGUMENT`.
        * 
    * - * repeated int32 modify_deadline_seconds = 3; + * repeated int32 modify_deadline_seconds = 3 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return The count of modifyDeadlineSeconds. */ public int getModifyDeadlineSecondsCount() { return modifyDeadlineSeconds_.size(); } + /** * * *
    -   * The list of new ack deadlines for the IDs listed in
    +   * Optional. The list of new ack deadlines for the IDs listed in
        * `modify_deadline_ack_ids`. The size of this list must be the same as the
        * size of `modify_deadline_ack_ids`. If it differs the stream will be aborted
        * with `INVALID_ARGUMENT`. Each element in this list is applied to the
    @@ -396,7 +298,8 @@ public int getModifyDeadlineSecondsCount() {
        * be aborted with status `INVALID_ARGUMENT`.
        * 
    * - * repeated int32 modify_deadline_seconds = 3; + * repeated int32 modify_deadline_seconds = 3 [(.google.api.field_behavior) = OPTIONAL]; + * * * @param index The index of the element to return. * @return The modifyDeadlineSeconds at the given index. @@ -408,55 +311,64 @@ public int getModifyDeadlineSeconds(int index) { private int modifyDeadlineSecondsMemoizedSerializedSize = -1; public static final int MODIFY_DEADLINE_ACK_IDS_FIELD_NUMBER = 4; - private com.google.protobuf.LazyStringList modifyDeadlineAckIds_; + + @SuppressWarnings("serial") + private com.google.protobuf.LazyStringArrayList modifyDeadlineAckIds_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + /** * * *
    -   * List of acknowledgement IDs whose deadline will be modified based on the
    -   * corresponding element in `modify_deadline_seconds`. This field can be used
    -   * to indicate that more time is needed to process a message by the
    +   * Optional. List of acknowledgment IDs whose deadline will be modified based
    +   * on the corresponding element in `modify_deadline_seconds`. This field can
    +   * be used to indicate that more time is needed to process a message by the
        * subscriber, or to make the message available for redelivery if the
        * processing was interrupted.
        * 
    * - * repeated string modify_deadline_ack_ids = 4; + * repeated string modify_deadline_ack_ids = 4 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return A list containing the modifyDeadlineAckIds. */ public com.google.protobuf.ProtocolStringList getModifyDeadlineAckIdsList() { return modifyDeadlineAckIds_; } + /** * * *
    -   * List of acknowledgement IDs whose deadline will be modified based on the
    -   * corresponding element in `modify_deadline_seconds`. This field can be used
    -   * to indicate that more time is needed to process a message by the
    +   * Optional. List of acknowledgment IDs whose deadline will be modified based
    +   * on the corresponding element in `modify_deadline_seconds`. This field can
    +   * be used to indicate that more time is needed to process a message by the
        * subscriber, or to make the message available for redelivery if the
        * processing was interrupted.
        * 
    * - * repeated string modify_deadline_ack_ids = 4; + * repeated string modify_deadline_ack_ids = 4 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return The count of modifyDeadlineAckIds. */ public int getModifyDeadlineAckIdsCount() { return modifyDeadlineAckIds_.size(); } + /** * * *
    -   * List of acknowledgement IDs whose deadline will be modified based on the
    -   * corresponding element in `modify_deadline_seconds`. This field can be used
    -   * to indicate that more time is needed to process a message by the
    +   * Optional. List of acknowledgment IDs whose deadline will be modified based
    +   * on the corresponding element in `modify_deadline_seconds`. This field can
    +   * be used to indicate that more time is needed to process a message by the
        * subscriber, or to make the message available for redelivery if the
        * processing was interrupted.
        * 
    * - * repeated string modify_deadline_ack_ids = 4; + * repeated string modify_deadline_ack_ids = 4 [(.google.api.field_behavior) = OPTIONAL]; + * * * @param index The index of the element to return. * @return The modifyDeadlineAckIds at the given index. @@ -464,18 +376,20 @@ public int getModifyDeadlineAckIdsCount() { public java.lang.String getModifyDeadlineAckIds(int index) { return modifyDeadlineAckIds_.get(index); } + /** * * *
    -   * List of acknowledgement IDs whose deadline will be modified based on the
    -   * corresponding element in `modify_deadline_seconds`. This field can be used
    -   * to indicate that more time is needed to process a message by the
    +   * Optional. List of acknowledgment IDs whose deadline will be modified based
    +   * on the corresponding element in `modify_deadline_seconds`. This field can
    +   * be used to indicate that more time is needed to process a message by the
        * subscriber, or to make the message available for redelivery if the
        * processing was interrupted.
        * 
    * - * repeated string modify_deadline_ack_ids = 4; + * repeated string modify_deadline_ack_ids = 4 [(.google.api.field_behavior) = OPTIONAL]; + * * * @param index The index of the value to return. * @return The bytes of the modifyDeadlineAckIds at the given index. @@ -485,7 +399,8 @@ public com.google.protobuf.ByteString getModifyDeadlineAckIdsBytes(int index) { } public static final int STREAM_ACK_DEADLINE_SECONDS_FIELD_NUMBER = 5; - private int streamAckDeadlineSeconds_; + private int streamAckDeadlineSeconds_ = 0; + /** * * @@ -506,20 +421,23 @@ public int getStreamAckDeadlineSeconds() { } public static final int CLIENT_ID_FIELD_NUMBER = 6; - private volatile java.lang.Object clientId_; + + @SuppressWarnings("serial") + private volatile java.lang.Object clientId_ = ""; + /** * * *
    -   * A unique identifier that is used to distinguish client instances from each
    -   * other. Only needs to be provided on the initial request. When a stream
    -   * disconnects and reconnects for the same stream, the client_id should be set
    -   * to the same value so that state associated with the old stream can be
    -   * transferred to the new stream. The same client_id should not be used for
    +   * Optional. A unique identifier that is used to distinguish client instances
    +   * from each other. Only needs to be provided on the initial request. When a
    +   * stream disconnects and reconnects for the same stream, the client_id should
    +   * be set to the same value so that state associated with the old stream can
    +   * be transferred to the new stream. The same client_id should not be used for
        * different client instances.
        * 
    * - * string client_id = 6; + * string client_id = 6 [(.google.api.field_behavior) = OPTIONAL]; * * @return The clientId. */ @@ -535,19 +453,20 @@ public java.lang.String getClientId() { return s; } } + /** * * *
    -   * A unique identifier that is used to distinguish client instances from each
    -   * other. Only needs to be provided on the initial request. When a stream
    -   * disconnects and reconnects for the same stream, the client_id should be set
    -   * to the same value so that state associated with the old stream can be
    -   * transferred to the new stream. The same client_id should not be used for
    +   * Optional. A unique identifier that is used to distinguish client instances
    +   * from each other. Only needs to be provided on the initial request. When a
    +   * stream disconnects and reconnects for the same stream, the client_id should
    +   * be set to the same value so that state associated with the old stream can
    +   * be transferred to the new stream. The same client_id should not be used for
        * different client instances.
        * 
    * - * string client_id = 6; + * string client_id = 6 [(.google.api.field_behavior) = OPTIONAL]; * * @return The bytes for clientId. */ @@ -565,13 +484,14 @@ public com.google.protobuf.ByteString getClientIdBytes() { } public static final int MAX_OUTSTANDING_MESSAGES_FIELD_NUMBER = 7; - private long maxOutstandingMessages_; + private long maxOutstandingMessages_ = 0L; + /** * * *
    -   * Flow control settings for the maximum number of outstanding messages. When
    -   * there are `max_outstanding_messages` or more currently sent to the
    +   * Optional. Flow control settings for the maximum number of outstanding
    +   * messages. When there are `max_outstanding_messages` currently sent to the
        * streaming pull client that have not yet been acked or nacked, the server
        * stops sending more messages. The sending of messages resumes once the
        * number of outstanding messages is less than this value. If the value is
    @@ -581,7 +501,7 @@ public com.google.protobuf.ByteString getClientIdBytes() {
        * `INVALID_ARGUMENT`.
        * 
    * - * int64 max_outstanding_messages = 7; + * int64 max_outstanding_messages = 7 [(.google.api.field_behavior) = OPTIONAL]; * * @return The maxOutstandingMessages. */ @@ -591,23 +511,24 @@ public long getMaxOutstandingMessages() { } public static final int MAX_OUTSTANDING_BYTES_FIELD_NUMBER = 8; - private long maxOutstandingBytes_; + private long maxOutstandingBytes_ = 0L; + /** * * *
    -   * Flow control settings for the maximum number of outstanding bytes. When
    -   * there are `max_outstanding_bytes` or more worth of messages currently sent
    -   * to the streaming pull client that have not yet been acked or nacked, the
    -   * server will stop sending more messages. The sending of messages resumes
    -   * once the number of outstanding bytes is less than this value. If the value
    -   * is <= 0, there is no limit to the number of outstanding bytes. This
    -   * property can only be set on the initial StreamingPullRequest. If it is set
    -   * on a subsequent request, the stream will be aborted with status
    +   * Optional. Flow control settings for the maximum number of outstanding
    +   * bytes. When there are `max_outstanding_bytes` or more worth of messages
    +   * currently sent to the streaming pull client that have not yet been acked or
    +   * nacked, the server will stop sending more messages. The sending of messages
    +   * resumes once the number of outstanding bytes is less than this value. If
    +   * the value is <= 0, there is no limit to the number of outstanding bytes.
    +   * This property can only be set on the initial StreamingPullRequest. If it is
    +   * set on a subsequent request, the stream will be aborted with status
        * `INVALID_ARGUMENT`.
        * 
    * - * int64 max_outstanding_bytes = 8; + * int64 max_outstanding_bytes = 8 [(.google.api.field_behavior) = OPTIONAL]; * * @return The maxOutstandingBytes. */ @@ -616,6 +537,27 @@ public long getMaxOutstandingBytes() { return maxOutstandingBytes_; } + public static final int PROTOCOL_VERSION_FIELD_NUMBER = 10; + private long protocolVersion_ = 0L; + + /** + * + * + *
    +   * Optional. The protocol version used by the client. This property can only
    +   * be set on the initial StreamingPullRequest. If it is set on a subsequent
    +   * request, the stream will be aborted with status `INVALID_ARGUMENT`.
    +   * 
    + * + * int64 protocol_version = 10 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The protocolVersion. + */ + @java.lang.Override + public long getProtocolVersion() { + return protocolVersion_; + } + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -631,11 +573,11 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); - if (!getSubscriptionBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, subscription_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(subscription_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, subscription_); } for (int i = 0; i < ackIds_.size(); i++) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 2, ackIds_.getRaw(i)); + com.google.protobuf.GeneratedMessage.writeString(output, 2, ackIds_.getRaw(i)); } if (getModifyDeadlineSecondsList().size() > 0) { output.writeUInt32NoTag(26); @@ -645,14 +587,13 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io output.writeInt32NoTag(modifyDeadlineSeconds_.getInt(i)); } for (int i = 0; i < modifyDeadlineAckIds_.size(); i++) { - com.google.protobuf.GeneratedMessageV3.writeString( - output, 4, modifyDeadlineAckIds_.getRaw(i)); + com.google.protobuf.GeneratedMessage.writeString(output, 4, modifyDeadlineAckIds_.getRaw(i)); } if (streamAckDeadlineSeconds_ != 0) { output.writeInt32(5, streamAckDeadlineSeconds_); } - if (!getClientIdBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 6, clientId_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(clientId_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 6, clientId_); } if (maxOutstandingMessages_ != 0L) { output.writeInt64(7, maxOutstandingMessages_); @@ -660,7 +601,10 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io if (maxOutstandingBytes_ != 0L) { output.writeInt64(8, maxOutstandingBytes_); } - unknownFields.writeTo(output); + if (protocolVersion_ != 0L) { + output.writeInt64(10, protocolVersion_); + } + getUnknownFields().writeTo(output); } @java.lang.Override @@ -669,8 +613,8 @@ public int getSerializedSize() { if (size != -1) return size; size = 0; - if (!getSubscriptionBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, subscription_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(subscription_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, subscription_); } { int dataSize = 0; @@ -705,8 +649,8 @@ public int getSerializedSize() { if (streamAckDeadlineSeconds_ != 0) { size += com.google.protobuf.CodedOutputStream.computeInt32Size(5, streamAckDeadlineSeconds_); } - if (!getClientIdBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(6, clientId_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(clientId_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(6, clientId_); } if (maxOutstandingMessages_ != 0L) { size += com.google.protobuf.CodedOutputStream.computeInt64Size(7, maxOutstandingMessages_); @@ -714,7 +658,10 @@ public int getSerializedSize() { if (maxOutstandingBytes_ != 0L) { size += com.google.protobuf.CodedOutputStream.computeInt64Size(8, maxOutstandingBytes_); } - size += unknownFields.getSerializedSize(); + if (protocolVersion_ != 0L) { + size += com.google.protobuf.CodedOutputStream.computeInt64Size(10, protocolVersion_); + } + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -738,7 +685,8 @@ public boolean equals(final java.lang.Object obj) { if (!getClientId().equals(other.getClientId())) return false; if (getMaxOutstandingMessages() != other.getMaxOutstandingMessages()) return false; if (getMaxOutstandingBytes() != other.getMaxOutstandingBytes()) return false; - if (!unknownFields.equals(other.unknownFields)) return false; + if (getProtocolVersion() != other.getProtocolVersion()) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -771,7 +719,9 @@ public int hashCode() { hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getMaxOutstandingMessages()); hash = (37 * hash) + MAX_OUTSTANDING_BYTES_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getMaxOutstandingBytes()); - hash = (29 * hash) + unknownFields.hashCode(); + hash = (37 * hash) + PROTOCOL_VERSION_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getProtocolVersion()); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -813,38 +763,38 @@ public static com.google.pubsub.v1.StreamingPullRequest parseFrom( public static com.google.pubsub.v1.StreamingPullRequest parseFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.StreamingPullRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.StreamingPullRequest parseDelimitedFrom( java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); } public static com.google.pubsub.v1.StreamingPullRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.StreamingPullRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.StreamingPullRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } @@ -867,22 +817,23 @@ public Builder toBuilder() { } @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** * * *
        * Request for the `StreamingPull` streaming RPC method. This request is used to
    -   * establish the initial stream as well as to stream acknowledgements and ack
    +   * establish the initial stream as well as to stream acknowledgments and ack
        * deadline modifications from the client to the server.
        * 
    * * Protobuf type {@code google.pubsub.v1.StreamingPullRequest} */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements // @@protoc_insertion_point(builder_implements:google.pubsub.v1.StreamingPullRequest) com.google.pubsub.v1.StreamingPullRequestOrBuilder { @@ -892,7 +843,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_StreamingPullRequest_fieldAccessorTable @@ -902,38 +853,25 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } // Construct using com.google.pubsub.v1.StreamingPullRequest.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } + private Builder() {} - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} } @java.lang.Override public Builder clear() { super.clear(); + bitField0_ = 0; subscription_ = ""; - - ackIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; - bitField0_ = (bitField0_ & ~0x00000001); + ackIds_ = com.google.protobuf.LazyStringArrayList.emptyList(); modifyDeadlineSeconds_ = emptyIntList(); - bitField0_ = (bitField0_ & ~0x00000002); - modifyDeadlineAckIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; - bitField0_ = (bitField0_ & ~0x00000004); + modifyDeadlineAckIds_ = com.google.protobuf.LazyStringArrayList.emptyList(); streamAckDeadlineSeconds_ = 0; - clientId_ = ""; - maxOutstandingMessages_ = 0L; - maxOutstandingBytes_ = 0L; - + protocolVersion_ = 0L; return this; } @@ -961,62 +899,45 @@ public com.google.pubsub.v1.StreamingPullRequest build() { public com.google.pubsub.v1.StreamingPullRequest buildPartial() { com.google.pubsub.v1.StreamingPullRequest result = new com.google.pubsub.v1.StreamingPullRequest(this); - int from_bitField0_ = bitField0_; - result.subscription_ = subscription_; - if (((bitField0_ & 0x00000001) != 0)) { - ackIds_ = ackIds_.getUnmodifiableView(); - bitField0_ = (bitField0_ & ~0x00000001); - } - result.ackIds_ = ackIds_; - if (((bitField0_ & 0x00000002) != 0)) { - modifyDeadlineSeconds_.makeImmutable(); - bitField0_ = (bitField0_ & ~0x00000002); + if (bitField0_ != 0) { + buildPartial0(result); } - result.modifyDeadlineSeconds_ = modifyDeadlineSeconds_; - if (((bitField0_ & 0x00000004) != 0)) { - modifyDeadlineAckIds_ = modifyDeadlineAckIds_.getUnmodifiableView(); - bitField0_ = (bitField0_ & ~0x00000004); - } - result.modifyDeadlineAckIds_ = modifyDeadlineAckIds_; - result.streamAckDeadlineSeconds_ = streamAckDeadlineSeconds_; - result.clientId_ = clientId_; - result.maxOutstandingMessages_ = maxOutstandingMessages_; - result.maxOutstandingBytes_ = maxOutstandingBytes_; onBuilt(); return result; } - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); + private void buildPartial0(com.google.pubsub.v1.StreamingPullRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.subscription_ = subscription_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + ackIds_.makeImmutable(); + result.ackIds_ = ackIds_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + modifyDeadlineSeconds_.makeImmutable(); + result.modifyDeadlineSeconds_ = modifyDeadlineSeconds_; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + modifyDeadlineAckIds_.makeImmutable(); + result.modifyDeadlineAckIds_ = modifyDeadlineAckIds_; + } + if (((from_bitField0_ & 0x00000010) != 0)) { + result.streamAckDeadlineSeconds_ = streamAckDeadlineSeconds_; + } + if (((from_bitField0_ & 0x00000020) != 0)) { + result.clientId_ = clientId_; + } + if (((from_bitField0_ & 0x00000040) != 0)) { + result.maxOutstandingMessages_ = maxOutstandingMessages_; + } + if (((from_bitField0_ & 0x00000080) != 0)) { + result.maxOutstandingBytes_ = maxOutstandingBytes_; + } + if (((from_bitField0_ & 0x00000100) != 0)) { + result.protocolVersion_ = protocolVersion_; + } } @java.lang.Override @@ -1033,12 +954,13 @@ public Builder mergeFrom(com.google.pubsub.v1.StreamingPullRequest other) { if (other == com.google.pubsub.v1.StreamingPullRequest.getDefaultInstance()) return this; if (!other.getSubscription().isEmpty()) { subscription_ = other.subscription_; + bitField0_ |= 0x00000001; onChanged(); } if (!other.ackIds_.isEmpty()) { if (ackIds_.isEmpty()) { ackIds_ = other.ackIds_; - bitField0_ = (bitField0_ & ~0x00000001); + bitField0_ |= 0x00000002; } else { ensureAckIdsIsMutable(); ackIds_.addAll(other.ackIds_); @@ -1048,7 +970,8 @@ public Builder mergeFrom(com.google.pubsub.v1.StreamingPullRequest other) { if (!other.modifyDeadlineSeconds_.isEmpty()) { if (modifyDeadlineSeconds_.isEmpty()) { modifyDeadlineSeconds_ = other.modifyDeadlineSeconds_; - bitField0_ = (bitField0_ & ~0x00000002); + modifyDeadlineSeconds_.makeImmutable(); + bitField0_ |= 0x00000004; } else { ensureModifyDeadlineSecondsIsMutable(); modifyDeadlineSeconds_.addAll(other.modifyDeadlineSeconds_); @@ -1058,7 +981,7 @@ public Builder mergeFrom(com.google.pubsub.v1.StreamingPullRequest other) { if (!other.modifyDeadlineAckIds_.isEmpty()) { if (modifyDeadlineAckIds_.isEmpty()) { modifyDeadlineAckIds_ = other.modifyDeadlineAckIds_; - bitField0_ = (bitField0_ & ~0x00000004); + bitField0_ |= 0x00000008; } else { ensureModifyDeadlineAckIdsIsMutable(); modifyDeadlineAckIds_.addAll(other.modifyDeadlineAckIds_); @@ -1070,6 +993,7 @@ public Builder mergeFrom(com.google.pubsub.v1.StreamingPullRequest other) { } if (!other.getClientId().isEmpty()) { clientId_ = other.clientId_; + bitField0_ |= 0x00000020; onChanged(); } if (other.getMaxOutstandingMessages() != 0L) { @@ -1078,7 +1002,10 @@ public Builder mergeFrom(com.google.pubsub.v1.StreamingPullRequest other) { if (other.getMaxOutstandingBytes() != 0L) { setMaxOutstandingBytes(other.getMaxOutstandingBytes()); } - this.mergeUnknownFields(other.unknownFields); + if (other.getProtocolVersion() != 0L) { + setProtocolVersion(other.getProtocolVersion()); + } + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -1093,23 +1020,106 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.pubsub.v1.StreamingPullRequest parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + subscription_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + ensureAckIdsIsMutable(); + ackIds_.add(s); + break; + } // case 18 + case 24: + { + int v = input.readInt32(); + ensureModifyDeadlineSecondsIsMutable(); + modifyDeadlineSeconds_.addInt(v); + break; + } // case 24 + case 26: + { + int length = input.readRawVarint32(); + int limit = input.pushLimit(length); + ensureModifyDeadlineSecondsIsMutable(); + while (input.getBytesUntilLimit() > 0) { + modifyDeadlineSeconds_.addInt(input.readInt32()); + } + input.popLimit(limit); + break; + } // case 26 + case 34: + { + java.lang.String s = input.readStringRequireUtf8(); + ensureModifyDeadlineAckIdsIsMutable(); + modifyDeadlineAckIds_.add(s); + break; + } // case 34 + case 40: + { + streamAckDeadlineSeconds_ = input.readInt32(); + bitField0_ |= 0x00000010; + break; + } // case 40 + case 50: + { + clientId_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000020; + break; + } // case 50 + case 56: + { + maxOutstandingMessages_ = input.readInt64(); + bitField0_ |= 0x00000040; + break; + } // case 56 + case 64: + { + maxOutstandingBytes_ = input.readInt64(); + bitField0_ |= 0x00000080; + break; + } // case 64 + case 80: + { + protocolVersion_ = input.readInt64(); + bitField0_ |= 0x00000100; + break; + } // case 80 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.google.pubsub.v1.StreamingPullRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } private int bitField0_; private java.lang.Object subscription_ = ""; + /** * * @@ -1137,6 +1147,7 @@ public java.lang.String getSubscription() { return (java.lang.String) ref; } } + /** * * @@ -1164,6 +1175,7 @@ public com.google.protobuf.ByteString getSubscriptionBytes() { return (com.google.protobuf.ByteString) ref; } } + /** * * @@ -1185,11 +1197,12 @@ public Builder setSubscription(java.lang.String value) { if (value == null) { throw new NullPointerException(); } - subscription_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } + /** * * @@ -1207,11 +1220,12 @@ public Builder setSubscription(java.lang.String value) { * @return This builder for chaining. */ public Builder clearSubscription() { - subscription_ = getDefaultInstance().getSubscription(); + bitField0_ = (bitField0_ & ~0x00000001); onChanged(); return this; } + /** * * @@ -1234,69 +1248,73 @@ public Builder setSubscriptionBytes(com.google.protobuf.ByteString value) { throw new NullPointerException(); } checkByteStringIsUtf8(value); - subscription_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } - private com.google.protobuf.LazyStringList ackIds_ = - com.google.protobuf.LazyStringArrayList.EMPTY; + private com.google.protobuf.LazyStringArrayList ackIds_ = + com.google.protobuf.LazyStringArrayList.emptyList(); private void ensureAckIdsIsMutable() { - if (!((bitField0_ & 0x00000001) != 0)) { + if (!ackIds_.isModifiable()) { ackIds_ = new com.google.protobuf.LazyStringArrayList(ackIds_); - bitField0_ |= 0x00000001; } + bitField0_ |= 0x00000002; } + /** * * *
    -     * List of acknowledgement IDs for acknowledging previously received messages
    -     * (received on this stream or a different stream). If an ack ID has expired,
    -     * the corresponding message may be redelivered later. Acknowledging a message
    -     * more than once will not result in an error. If the acknowledgement ID is
    -     * malformed, the stream will be aborted with status `INVALID_ARGUMENT`.
    +     * Optional. List of acknowledgment IDs for acknowledging previously received
    +     * messages (received on this stream or a different stream). If an ack ID has
    +     * expired, the corresponding message may be redelivered later. Acknowledging
    +     * a message more than once will not result in an error. If the acknowledgment
    +     * ID is malformed, the stream will be aborted with status `INVALID_ARGUMENT`.
          * 
    * - * repeated string ack_ids = 2; + * repeated string ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return A list containing the ackIds. */ public com.google.protobuf.ProtocolStringList getAckIdsList() { - return ackIds_.getUnmodifiableView(); + ackIds_.makeImmutable(); + return ackIds_; } + /** * * *
    -     * List of acknowledgement IDs for acknowledging previously received messages
    -     * (received on this stream or a different stream). If an ack ID has expired,
    -     * the corresponding message may be redelivered later. Acknowledging a message
    -     * more than once will not result in an error. If the acknowledgement ID is
    -     * malformed, the stream will be aborted with status `INVALID_ARGUMENT`.
    +     * Optional. List of acknowledgment IDs for acknowledging previously received
    +     * messages (received on this stream or a different stream). If an ack ID has
    +     * expired, the corresponding message may be redelivered later. Acknowledging
    +     * a message more than once will not result in an error. If the acknowledgment
    +     * ID is malformed, the stream will be aborted with status `INVALID_ARGUMENT`.
          * 
    * - * repeated string ack_ids = 2; + * repeated string ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The count of ackIds. */ public int getAckIdsCount() { return ackIds_.size(); } + /** * * *
    -     * List of acknowledgement IDs for acknowledging previously received messages
    -     * (received on this stream or a different stream). If an ack ID has expired,
    -     * the corresponding message may be redelivered later. Acknowledging a message
    -     * more than once will not result in an error. If the acknowledgement ID is
    -     * malformed, the stream will be aborted with status `INVALID_ARGUMENT`.
    +     * Optional. List of acknowledgment IDs for acknowledging previously received
    +     * messages (received on this stream or a different stream). If an ack ID has
    +     * expired, the corresponding message may be redelivered later. Acknowledging
    +     * a message more than once will not result in an error. If the acknowledgment
    +     * ID is malformed, the stream will be aborted with status `INVALID_ARGUMENT`.
          * 
    * - * repeated string ack_ids = 2; + * repeated string ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @param index The index of the element to return. * @return The ackIds at the given index. @@ -1304,18 +1322,19 @@ public int getAckIdsCount() { public java.lang.String getAckIds(int index) { return ackIds_.get(index); } + /** * * *
    -     * List of acknowledgement IDs for acknowledging previously received messages
    -     * (received on this stream or a different stream). If an ack ID has expired,
    -     * the corresponding message may be redelivered later. Acknowledging a message
    -     * more than once will not result in an error. If the acknowledgement ID is
    -     * malformed, the stream will be aborted with status `INVALID_ARGUMENT`.
    +     * Optional. List of acknowledgment IDs for acknowledging previously received
    +     * messages (received on this stream or a different stream). If an ack ID has
    +     * expired, the corresponding message may be redelivered later. Acknowledging
    +     * a message more than once will not result in an error. If the acknowledgment
    +     * ID is malformed, the stream will be aborted with status `INVALID_ARGUMENT`.
          * 
    * - * repeated string ack_ids = 2; + * repeated string ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @param index The index of the value to return. * @return The bytes of the ackIds at the given index. @@ -1323,18 +1342,19 @@ public java.lang.String getAckIds(int index) { public com.google.protobuf.ByteString getAckIdsBytes(int index) { return ackIds_.getByteString(index); } + /** * * *
    -     * List of acknowledgement IDs for acknowledging previously received messages
    -     * (received on this stream or a different stream). If an ack ID has expired,
    -     * the corresponding message may be redelivered later. Acknowledging a message
    -     * more than once will not result in an error. If the acknowledgement ID is
    -     * malformed, the stream will be aborted with status `INVALID_ARGUMENT`.
    +     * Optional. List of acknowledgment IDs for acknowledging previously received
    +     * messages (received on this stream or a different stream). If an ack ID has
    +     * expired, the corresponding message may be redelivered later. Acknowledging
    +     * a message more than once will not result in an error. If the acknowledgment
    +     * ID is malformed, the stream will be aborted with status `INVALID_ARGUMENT`.
          * 
    * - * repeated string ack_ids = 2; + * repeated string ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @param index The index to set the value at. * @param value The ackIds to set. @@ -1346,21 +1366,23 @@ public Builder setAckIds(int index, java.lang.String value) { } ensureAckIdsIsMutable(); ackIds_.set(index, value); + bitField0_ |= 0x00000002; onChanged(); return this; } + /** * * *
    -     * List of acknowledgement IDs for acknowledging previously received messages
    -     * (received on this stream or a different stream). If an ack ID has expired,
    -     * the corresponding message may be redelivered later. Acknowledging a message
    -     * more than once will not result in an error. If the acknowledgement ID is
    -     * malformed, the stream will be aborted with status `INVALID_ARGUMENT`.
    +     * Optional. List of acknowledgment IDs for acknowledging previously received
    +     * messages (received on this stream or a different stream). If an ack ID has
    +     * expired, the corresponding message may be redelivered later. Acknowledging
    +     * a message more than once will not result in an error. If the acknowledgment
    +     * ID is malformed, the stream will be aborted with status `INVALID_ARGUMENT`.
          * 
    * - * repeated string ack_ids = 2; + * repeated string ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @param value The ackIds to add. * @return This builder for chaining. @@ -1371,21 +1393,23 @@ public Builder addAckIds(java.lang.String value) { } ensureAckIdsIsMutable(); ackIds_.add(value); + bitField0_ |= 0x00000002; onChanged(); return this; } + /** * * *
    -     * List of acknowledgement IDs for acknowledging previously received messages
    -     * (received on this stream or a different stream). If an ack ID has expired,
    -     * the corresponding message may be redelivered later. Acknowledging a message
    -     * more than once will not result in an error. If the acknowledgement ID is
    -     * malformed, the stream will be aborted with status `INVALID_ARGUMENT`.
    +     * Optional. List of acknowledgment IDs for acknowledging previously received
    +     * messages (received on this stream or a different stream). If an ack ID has
    +     * expired, the corresponding message may be redelivered later. Acknowledging
    +     * a message more than once will not result in an error. If the acknowledgment
    +     * ID is malformed, the stream will be aborted with status `INVALID_ARGUMENT`.
          * 
    * - * repeated string ack_ids = 2; + * repeated string ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @param values The ackIds to add. * @return This builder for chaining. @@ -1393,42 +1417,46 @@ public Builder addAckIds(java.lang.String value) { public Builder addAllAckIds(java.lang.Iterable values) { ensureAckIdsIsMutable(); com.google.protobuf.AbstractMessageLite.Builder.addAll(values, ackIds_); + bitField0_ |= 0x00000002; onChanged(); return this; } + /** * * *
    -     * List of acknowledgement IDs for acknowledging previously received messages
    -     * (received on this stream or a different stream). If an ack ID has expired,
    -     * the corresponding message may be redelivered later. Acknowledging a message
    -     * more than once will not result in an error. If the acknowledgement ID is
    -     * malformed, the stream will be aborted with status `INVALID_ARGUMENT`.
    +     * Optional. List of acknowledgment IDs for acknowledging previously received
    +     * messages (received on this stream or a different stream). If an ack ID has
    +     * expired, the corresponding message may be redelivered later. Acknowledging
    +     * a message more than once will not result in an error. If the acknowledgment
    +     * ID is malformed, the stream will be aborted with status `INVALID_ARGUMENT`.
          * 
    * - * repeated string ack_ids = 2; + * repeated string ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return This builder for chaining. */ public Builder clearAckIds() { - ackIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; - bitField0_ = (bitField0_ & ~0x00000001); + ackIds_ = com.google.protobuf.LazyStringArrayList.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + ; onChanged(); return this; } + /** * * *
    -     * List of acknowledgement IDs for acknowledging previously received messages
    -     * (received on this stream or a different stream). If an ack ID has expired,
    -     * the corresponding message may be redelivered later. Acknowledging a message
    -     * more than once will not result in an error. If the acknowledgement ID is
    -     * malformed, the stream will be aborted with status `INVALID_ARGUMENT`.
    +     * Optional. List of acknowledgment IDs for acknowledging previously received
    +     * messages (received on this stream or a different stream). If an ack ID has
    +     * expired, the corresponding message may be redelivered later. Acknowledging
    +     * a message more than once will not result in an error. If the acknowledgment
    +     * ID is malformed, the stream will be aborted with status `INVALID_ARGUMENT`.
          * 
    * - * repeated string ack_ids = 2; + * repeated string ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @param value The bytes of the ackIds to add. * @return This builder for chaining. @@ -1440,6 +1468,7 @@ public Builder addAckIdsBytes(com.google.protobuf.ByteString value) { checkByteStringIsUtf8(value); ensureAckIdsIsMutable(); ackIds_.add(value); + bitField0_ |= 0x00000002; onChanged(); return this; } @@ -1447,16 +1476,17 @@ public Builder addAckIdsBytes(com.google.protobuf.ByteString value) { private com.google.protobuf.Internal.IntList modifyDeadlineSeconds_ = emptyIntList(); private void ensureModifyDeadlineSecondsIsMutable() { - if (!((bitField0_ & 0x00000002) != 0)) { - modifyDeadlineSeconds_ = mutableCopy(modifyDeadlineSeconds_); - bitField0_ |= 0x00000002; + if (!modifyDeadlineSeconds_.isModifiable()) { + modifyDeadlineSeconds_ = makeMutableCopy(modifyDeadlineSeconds_); } + bitField0_ |= 0x00000004; } + /** * * *
    -     * The list of new ack deadlines for the IDs listed in
    +     * Optional. The list of new ack deadlines for the IDs listed in
          * `modify_deadline_ack_ids`. The size of this list must be the same as the
          * size of `modify_deadline_ack_ids`. If it differs the stream will be aborted
          * with `INVALID_ARGUMENT`. Each element in this list is applied to the
    @@ -1469,20 +1499,21 @@ private void ensureModifyDeadlineSecondsIsMutable() {
          * be aborted with status `INVALID_ARGUMENT`.
          * 
    * - * repeated int32 modify_deadline_seconds = 3; + * repeated int32 modify_deadline_seconds = 3 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return A list containing the modifyDeadlineSeconds. */ public java.util.List getModifyDeadlineSecondsList() { - return ((bitField0_ & 0x00000002) != 0) - ? java.util.Collections.unmodifiableList(modifyDeadlineSeconds_) - : modifyDeadlineSeconds_; + modifyDeadlineSeconds_.makeImmutable(); + return modifyDeadlineSeconds_; } + /** * * *
    -     * The list of new ack deadlines for the IDs listed in
    +     * Optional. The list of new ack deadlines for the IDs listed in
          * `modify_deadline_ack_ids`. The size of this list must be the same as the
          * size of `modify_deadline_ack_ids`. If it differs the stream will be aborted
          * with `INVALID_ARGUMENT`. Each element in this list is applied to the
    @@ -1495,18 +1526,20 @@ public java.util.List getModifyDeadlineSecondsList() {
          * be aborted with status `INVALID_ARGUMENT`.
          * 
    * - * repeated int32 modify_deadline_seconds = 3; + * repeated int32 modify_deadline_seconds = 3 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return The count of modifyDeadlineSeconds. */ public int getModifyDeadlineSecondsCount() { return modifyDeadlineSeconds_.size(); } + /** * * *
    -     * The list of new ack deadlines for the IDs listed in
    +     * Optional. The list of new ack deadlines for the IDs listed in
          * `modify_deadline_ack_ids`. The size of this list must be the same as the
          * size of `modify_deadline_ack_ids`. If it differs the stream will be aborted
          * with `INVALID_ARGUMENT`. Each element in this list is applied to the
    @@ -1519,7 +1552,8 @@ public int getModifyDeadlineSecondsCount() {
          * be aborted with status `INVALID_ARGUMENT`.
          * 
    * - * repeated int32 modify_deadline_seconds = 3; + * repeated int32 modify_deadline_seconds = 3 [(.google.api.field_behavior) = OPTIONAL]; + * * * @param index The index of the element to return. * @return The modifyDeadlineSeconds at the given index. @@ -1527,11 +1561,12 @@ public int getModifyDeadlineSecondsCount() { public int getModifyDeadlineSeconds(int index) { return modifyDeadlineSeconds_.getInt(index); } + /** * * *
    -     * The list of new ack deadlines for the IDs listed in
    +     * Optional. The list of new ack deadlines for the IDs listed in
          * `modify_deadline_ack_ids`. The size of this list must be the same as the
          * size of `modify_deadline_ack_ids`. If it differs the stream will be aborted
          * with `INVALID_ARGUMENT`. Each element in this list is applied to the
    @@ -1544,23 +1579,27 @@ public int getModifyDeadlineSeconds(int index) {
          * be aborted with status `INVALID_ARGUMENT`.
          * 
    * - * repeated int32 modify_deadline_seconds = 3; + * repeated int32 modify_deadline_seconds = 3 [(.google.api.field_behavior) = OPTIONAL]; + * * * @param index The index to set the value at. * @param value The modifyDeadlineSeconds to set. * @return This builder for chaining. */ public Builder setModifyDeadlineSeconds(int index, int value) { + ensureModifyDeadlineSecondsIsMutable(); modifyDeadlineSeconds_.setInt(index, value); + bitField0_ |= 0x00000004; onChanged(); return this; } + /** * * *
    -     * The list of new ack deadlines for the IDs listed in
    +     * Optional. The list of new ack deadlines for the IDs listed in
          * `modify_deadline_ack_ids`. The size of this list must be the same as the
          * size of `modify_deadline_ack_ids`. If it differs the stream will be aborted
          * with `INVALID_ARGUMENT`. Each element in this list is applied to the
    @@ -1573,22 +1612,26 @@ public Builder setModifyDeadlineSeconds(int index, int value) {
          * be aborted with status `INVALID_ARGUMENT`.
          * 
    * - * repeated int32 modify_deadline_seconds = 3; + * repeated int32 modify_deadline_seconds = 3 [(.google.api.field_behavior) = OPTIONAL]; + * * * @param value The modifyDeadlineSeconds to add. * @return This builder for chaining. */ public Builder addModifyDeadlineSeconds(int value) { + ensureModifyDeadlineSecondsIsMutable(); modifyDeadlineSeconds_.addInt(value); + bitField0_ |= 0x00000004; onChanged(); return this; } + /** * * *
    -     * The list of new ack deadlines for the IDs listed in
    +     * Optional. The list of new ack deadlines for the IDs listed in
          * `modify_deadline_ack_ids`. The size of this list must be the same as the
          * size of `modify_deadline_ack_ids`. If it differs the stream will be aborted
          * with `INVALID_ARGUMENT`. Each element in this list is applied to the
    @@ -1601,7 +1644,8 @@ public Builder addModifyDeadlineSeconds(int value) {
          * be aborted with status `INVALID_ARGUMENT`.
          * 
    * - * repeated int32 modify_deadline_seconds = 3; + * repeated int32 modify_deadline_seconds = 3 [(.google.api.field_behavior) = OPTIONAL]; + * * * @param values The modifyDeadlineSeconds to add. * @return This builder for chaining. @@ -1610,14 +1654,16 @@ public Builder addAllModifyDeadlineSeconds( java.lang.Iterable values) { ensureModifyDeadlineSecondsIsMutable(); com.google.protobuf.AbstractMessageLite.Builder.addAll(values, modifyDeadlineSeconds_); + bitField0_ |= 0x00000004; onChanged(); return this; } + /** * * *
    -     * The list of new ack deadlines for the IDs listed in
    +     * Optional. The list of new ack deadlines for the IDs listed in
          * `modify_deadline_ack_ids`. The size of this list must be the same as the
          * size of `modify_deadline_ack_ids`. If it differs the stream will be aborted
          * with `INVALID_ARGUMENT`. Each element in this list is applied to the
    @@ -1630,74 +1676,82 @@ public Builder addAllModifyDeadlineSeconds(
          * be aborted with status `INVALID_ARGUMENT`.
          * 
    * - * repeated int32 modify_deadline_seconds = 3; + * repeated int32 modify_deadline_seconds = 3 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return This builder for chaining. */ public Builder clearModifyDeadlineSeconds() { modifyDeadlineSeconds_ = emptyIntList(); - bitField0_ = (bitField0_ & ~0x00000002); + bitField0_ = (bitField0_ & ~0x00000004); onChanged(); return this; } - private com.google.protobuf.LazyStringList modifyDeadlineAckIds_ = - com.google.protobuf.LazyStringArrayList.EMPTY; + private com.google.protobuf.LazyStringArrayList modifyDeadlineAckIds_ = + com.google.protobuf.LazyStringArrayList.emptyList(); private void ensureModifyDeadlineAckIdsIsMutable() { - if (!((bitField0_ & 0x00000004) != 0)) { + if (!modifyDeadlineAckIds_.isModifiable()) { modifyDeadlineAckIds_ = new com.google.protobuf.LazyStringArrayList(modifyDeadlineAckIds_); - bitField0_ |= 0x00000004; } + bitField0_ |= 0x00000008; } + /** * * *
    -     * List of acknowledgement IDs whose deadline will be modified based on the
    -     * corresponding element in `modify_deadline_seconds`. This field can be used
    -     * to indicate that more time is needed to process a message by the
    +     * Optional. List of acknowledgment IDs whose deadline will be modified based
    +     * on the corresponding element in `modify_deadline_seconds`. This field can
    +     * be used to indicate that more time is needed to process a message by the
          * subscriber, or to make the message available for redelivery if the
          * processing was interrupted.
          * 
    * - * repeated string modify_deadline_ack_ids = 4; + * repeated string modify_deadline_ack_ids = 4 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return A list containing the modifyDeadlineAckIds. */ public com.google.protobuf.ProtocolStringList getModifyDeadlineAckIdsList() { - return modifyDeadlineAckIds_.getUnmodifiableView(); + modifyDeadlineAckIds_.makeImmutable(); + return modifyDeadlineAckIds_; } + /** * * *
    -     * List of acknowledgement IDs whose deadline will be modified based on the
    -     * corresponding element in `modify_deadline_seconds`. This field can be used
    -     * to indicate that more time is needed to process a message by the
    +     * Optional. List of acknowledgment IDs whose deadline will be modified based
    +     * on the corresponding element in `modify_deadline_seconds`. This field can
    +     * be used to indicate that more time is needed to process a message by the
          * subscriber, or to make the message available for redelivery if the
          * processing was interrupted.
          * 
    * - * repeated string modify_deadline_ack_ids = 4; + * repeated string modify_deadline_ack_ids = 4 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return The count of modifyDeadlineAckIds. */ public int getModifyDeadlineAckIdsCount() { return modifyDeadlineAckIds_.size(); } + /** * * *
    -     * List of acknowledgement IDs whose deadline will be modified based on the
    -     * corresponding element in `modify_deadline_seconds`. This field can be used
    -     * to indicate that more time is needed to process a message by the
    +     * Optional. List of acknowledgment IDs whose deadline will be modified based
    +     * on the corresponding element in `modify_deadline_seconds`. This field can
    +     * be used to indicate that more time is needed to process a message by the
          * subscriber, or to make the message available for redelivery if the
          * processing was interrupted.
          * 
    * - * repeated string modify_deadline_ack_ids = 4; + * repeated string modify_deadline_ack_ids = 4 [(.google.api.field_behavior) = OPTIONAL]; + * * * @param index The index of the element to return. * @return The modifyDeadlineAckIds at the given index. @@ -1705,18 +1759,20 @@ public int getModifyDeadlineAckIdsCount() { public java.lang.String getModifyDeadlineAckIds(int index) { return modifyDeadlineAckIds_.get(index); } + /** * * *
    -     * List of acknowledgement IDs whose deadline will be modified based on the
    -     * corresponding element in `modify_deadline_seconds`. This field can be used
    -     * to indicate that more time is needed to process a message by the
    +     * Optional. List of acknowledgment IDs whose deadline will be modified based
    +     * on the corresponding element in `modify_deadline_seconds`. This field can
    +     * be used to indicate that more time is needed to process a message by the
          * subscriber, or to make the message available for redelivery if the
          * processing was interrupted.
          * 
    * - * repeated string modify_deadline_ack_ids = 4; + * repeated string modify_deadline_ack_ids = 4 [(.google.api.field_behavior) = OPTIONAL]; + * * * @param index The index of the value to return. * @return The bytes of the modifyDeadlineAckIds at the given index. @@ -1724,18 +1780,20 @@ public java.lang.String getModifyDeadlineAckIds(int index) { public com.google.protobuf.ByteString getModifyDeadlineAckIdsBytes(int index) { return modifyDeadlineAckIds_.getByteString(index); } + /** * * *
    -     * List of acknowledgement IDs whose deadline will be modified based on the
    -     * corresponding element in `modify_deadline_seconds`. This field can be used
    -     * to indicate that more time is needed to process a message by the
    +     * Optional. List of acknowledgment IDs whose deadline will be modified based
    +     * on the corresponding element in `modify_deadline_seconds`. This field can
    +     * be used to indicate that more time is needed to process a message by the
          * subscriber, or to make the message available for redelivery if the
          * processing was interrupted.
          * 
    * - * repeated string modify_deadline_ack_ids = 4; + * repeated string modify_deadline_ack_ids = 4 [(.google.api.field_behavior) = OPTIONAL]; + * * * @param index The index to set the value at. * @param value The modifyDeadlineAckIds to set. @@ -1747,21 +1805,24 @@ public Builder setModifyDeadlineAckIds(int index, java.lang.String value) { } ensureModifyDeadlineAckIdsIsMutable(); modifyDeadlineAckIds_.set(index, value); + bitField0_ |= 0x00000008; onChanged(); return this; } + /** * * *
    -     * List of acknowledgement IDs whose deadline will be modified based on the
    -     * corresponding element in `modify_deadline_seconds`. This field can be used
    -     * to indicate that more time is needed to process a message by the
    +     * Optional. List of acknowledgment IDs whose deadline will be modified based
    +     * on the corresponding element in `modify_deadline_seconds`. This field can
    +     * be used to indicate that more time is needed to process a message by the
          * subscriber, or to make the message available for redelivery if the
          * processing was interrupted.
          * 
    * - * repeated string modify_deadline_ack_ids = 4; + * repeated string modify_deadline_ack_ids = 4 [(.google.api.field_behavior) = OPTIONAL]; + * * * @param value The modifyDeadlineAckIds to add. * @return This builder for chaining. @@ -1772,21 +1833,24 @@ public Builder addModifyDeadlineAckIds(java.lang.String value) { } ensureModifyDeadlineAckIdsIsMutable(); modifyDeadlineAckIds_.add(value); + bitField0_ |= 0x00000008; onChanged(); return this; } + /** * * *
    -     * List of acknowledgement IDs whose deadline will be modified based on the
    -     * corresponding element in `modify_deadline_seconds`. This field can be used
    -     * to indicate that more time is needed to process a message by the
    +     * Optional. List of acknowledgment IDs whose deadline will be modified based
    +     * on the corresponding element in `modify_deadline_seconds`. This field can
    +     * be used to indicate that more time is needed to process a message by the
          * subscriber, or to make the message available for redelivery if the
          * processing was interrupted.
          * 
    * - * repeated string modify_deadline_ack_ids = 4; + * repeated string modify_deadline_ack_ids = 4 [(.google.api.field_behavior) = OPTIONAL]; + * * * @param values The modifyDeadlineAckIds to add. * @return This builder for chaining. @@ -1794,42 +1858,48 @@ public Builder addModifyDeadlineAckIds(java.lang.String value) { public Builder addAllModifyDeadlineAckIds(java.lang.Iterable values) { ensureModifyDeadlineAckIdsIsMutable(); com.google.protobuf.AbstractMessageLite.Builder.addAll(values, modifyDeadlineAckIds_); + bitField0_ |= 0x00000008; onChanged(); return this; } + /** * * *
    -     * List of acknowledgement IDs whose deadline will be modified based on the
    -     * corresponding element in `modify_deadline_seconds`. This field can be used
    -     * to indicate that more time is needed to process a message by the
    +     * Optional. List of acknowledgment IDs whose deadline will be modified based
    +     * on the corresponding element in `modify_deadline_seconds`. This field can
    +     * be used to indicate that more time is needed to process a message by the
          * subscriber, or to make the message available for redelivery if the
          * processing was interrupted.
          * 
    * - * repeated string modify_deadline_ack_ids = 4; + * repeated string modify_deadline_ack_ids = 4 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return This builder for chaining. */ public Builder clearModifyDeadlineAckIds() { - modifyDeadlineAckIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; - bitField0_ = (bitField0_ & ~0x00000004); + modifyDeadlineAckIds_ = com.google.protobuf.LazyStringArrayList.emptyList(); + bitField0_ = (bitField0_ & ~0x00000008); + ; onChanged(); return this; } + /** * * *
    -     * List of acknowledgement IDs whose deadline will be modified based on the
    -     * corresponding element in `modify_deadline_seconds`. This field can be used
    -     * to indicate that more time is needed to process a message by the
    +     * Optional. List of acknowledgment IDs whose deadline will be modified based
    +     * on the corresponding element in `modify_deadline_seconds`. This field can
    +     * be used to indicate that more time is needed to process a message by the
          * subscriber, or to make the message available for redelivery if the
          * processing was interrupted.
          * 
    * - * repeated string modify_deadline_ack_ids = 4; + * repeated string modify_deadline_ack_ids = 4 [(.google.api.field_behavior) = OPTIONAL]; + * * * @param value The bytes of the modifyDeadlineAckIds to add. * @return This builder for chaining. @@ -1841,11 +1911,13 @@ public Builder addModifyDeadlineAckIdsBytes(com.google.protobuf.ByteString value checkByteStringIsUtf8(value); ensureModifyDeadlineAckIdsIsMutable(); modifyDeadlineAckIds_.add(value); + bitField0_ |= 0x00000008; onChanged(); return this; } private int streamAckDeadlineSeconds_; + /** * * @@ -1864,6 +1936,7 @@ public Builder addModifyDeadlineAckIdsBytes(com.google.protobuf.ByteString value public int getStreamAckDeadlineSeconds() { return streamAckDeadlineSeconds_; } + /** * * @@ -1882,9 +1955,11 @@ public int getStreamAckDeadlineSeconds() { public Builder setStreamAckDeadlineSeconds(int value) { streamAckDeadlineSeconds_ = value; + bitField0_ |= 0x00000010; onChanged(); return this; } + /** * * @@ -1900,26 +1975,27 @@ public Builder setStreamAckDeadlineSeconds(int value) { * @return This builder for chaining. */ public Builder clearStreamAckDeadlineSeconds() { - + bitField0_ = (bitField0_ & ~0x00000010); streamAckDeadlineSeconds_ = 0; onChanged(); return this; } private java.lang.Object clientId_ = ""; + /** * * *
    -     * A unique identifier that is used to distinguish client instances from each
    -     * other. Only needs to be provided on the initial request. When a stream
    -     * disconnects and reconnects for the same stream, the client_id should be set
    -     * to the same value so that state associated with the old stream can be
    -     * transferred to the new stream. The same client_id should not be used for
    +     * Optional. A unique identifier that is used to distinguish client instances
    +     * from each other. Only needs to be provided on the initial request. When a
    +     * stream disconnects and reconnects for the same stream, the client_id should
    +     * be set to the same value so that state associated with the old stream can
    +     * be transferred to the new stream. The same client_id should not be used for
          * different client instances.
          * 
    * - * string client_id = 6; + * string client_id = 6 [(.google.api.field_behavior) = OPTIONAL]; * * @return The clientId. */ @@ -1934,19 +2010,20 @@ public java.lang.String getClientId() { return (java.lang.String) ref; } } + /** * * *
    -     * A unique identifier that is used to distinguish client instances from each
    -     * other. Only needs to be provided on the initial request. When a stream
    -     * disconnects and reconnects for the same stream, the client_id should be set
    -     * to the same value so that state associated with the old stream can be
    -     * transferred to the new stream. The same client_id should not be used for
    +     * Optional. A unique identifier that is used to distinguish client instances
    +     * from each other. Only needs to be provided on the initial request. When a
    +     * stream disconnects and reconnects for the same stream, the client_id should
    +     * be set to the same value so that state associated with the old stream can
    +     * be transferred to the new stream. The same client_id should not be used for
          * different client instances.
          * 
    * - * string client_id = 6; + * string client_id = 6 [(.google.api.field_behavior) = OPTIONAL]; * * @return The bytes for clientId. */ @@ -1961,19 +2038,20 @@ public com.google.protobuf.ByteString getClientIdBytes() { return (com.google.protobuf.ByteString) ref; } } + /** * * *
    -     * A unique identifier that is used to distinguish client instances from each
    -     * other. Only needs to be provided on the initial request. When a stream
    -     * disconnects and reconnects for the same stream, the client_id should be set
    -     * to the same value so that state associated with the old stream can be
    -     * transferred to the new stream. The same client_id should not be used for
    +     * Optional. A unique identifier that is used to distinguish client instances
    +     * from each other. Only needs to be provided on the initial request. When a
    +     * stream disconnects and reconnects for the same stream, the client_id should
    +     * be set to the same value so that state associated with the old stream can
    +     * be transferred to the new stream. The same client_id should not be used for
          * different client instances.
          * 
    * - * string client_id = 6; + * string client_id = 6 [(.google.api.field_behavior) = OPTIONAL]; * * @param value The clientId to set. * @return This builder for chaining. @@ -1982,46 +2060,48 @@ public Builder setClientId(java.lang.String value) { if (value == null) { throw new NullPointerException(); } - clientId_ = value; + bitField0_ |= 0x00000020; onChanged(); return this; } + /** * * *
    -     * A unique identifier that is used to distinguish client instances from each
    -     * other. Only needs to be provided on the initial request. When a stream
    -     * disconnects and reconnects for the same stream, the client_id should be set
    -     * to the same value so that state associated with the old stream can be
    -     * transferred to the new stream. The same client_id should not be used for
    +     * Optional. A unique identifier that is used to distinguish client instances
    +     * from each other. Only needs to be provided on the initial request. When a
    +     * stream disconnects and reconnects for the same stream, the client_id should
    +     * be set to the same value so that state associated with the old stream can
    +     * be transferred to the new stream. The same client_id should not be used for
          * different client instances.
          * 
    * - * string client_id = 6; + * string client_id = 6 [(.google.api.field_behavior) = OPTIONAL]; * * @return This builder for chaining. */ public Builder clearClientId() { - clientId_ = getDefaultInstance().getClientId(); + bitField0_ = (bitField0_ & ~0x00000020); onChanged(); return this; } + /** * * *
    -     * A unique identifier that is used to distinguish client instances from each
    -     * other. Only needs to be provided on the initial request. When a stream
    -     * disconnects and reconnects for the same stream, the client_id should be set
    -     * to the same value so that state associated with the old stream can be
    -     * transferred to the new stream. The same client_id should not be used for
    +     * Optional. A unique identifier that is used to distinguish client instances
    +     * from each other. Only needs to be provided on the initial request. When a
    +     * stream disconnects and reconnects for the same stream, the client_id should
    +     * be set to the same value so that state associated with the old stream can
    +     * be transferred to the new stream. The same client_id should not be used for
          * different client instances.
          * 
    * - * string client_id = 6; + * string client_id = 6 [(.google.api.field_behavior) = OPTIONAL]; * * @param value The bytes for clientId to set. * @return This builder for chaining. @@ -2031,19 +2111,20 @@ public Builder setClientIdBytes(com.google.protobuf.ByteString value) { throw new NullPointerException(); } checkByteStringIsUtf8(value); - clientId_ = value; + bitField0_ |= 0x00000020; onChanged(); return this; } private long maxOutstandingMessages_; + /** * * *
    -     * Flow control settings for the maximum number of outstanding messages. When
    -     * there are `max_outstanding_messages` or more currently sent to the
    +     * Optional. Flow control settings for the maximum number of outstanding
    +     * messages. When there are `max_outstanding_messages` currently sent to the
          * streaming pull client that have not yet been acked or nacked, the server
          * stops sending more messages. The sending of messages resumes once the
          * number of outstanding messages is less than this value. If the value is
    @@ -2053,7 +2134,7 @@ public Builder setClientIdBytes(com.google.protobuf.ByteString value) {
          * `INVALID_ARGUMENT`.
          * 
    * - * int64 max_outstanding_messages = 7; + * int64 max_outstanding_messages = 7 [(.google.api.field_behavior) = OPTIONAL]; * * @return The maxOutstandingMessages. */ @@ -2061,12 +2142,13 @@ public Builder setClientIdBytes(com.google.protobuf.ByteString value) { public long getMaxOutstandingMessages() { return maxOutstandingMessages_; } + /** * * *
    -     * Flow control settings for the maximum number of outstanding messages. When
    -     * there are `max_outstanding_messages` or more currently sent to the
    +     * Optional. Flow control settings for the maximum number of outstanding
    +     * messages. When there are `max_outstanding_messages` currently sent to the
          * streaming pull client that have not yet been acked or nacked, the server
          * stops sending more messages. The sending of messages resumes once the
          * number of outstanding messages is less than this value. If the value is
    @@ -2076,7 +2158,7 @@ public long getMaxOutstandingMessages() {
          * `INVALID_ARGUMENT`.
          * 
    * - * int64 max_outstanding_messages = 7; + * int64 max_outstanding_messages = 7 [(.google.api.field_behavior) = OPTIONAL]; * * @param value The maxOutstandingMessages to set. * @return This builder for chaining. @@ -2084,15 +2166,17 @@ public long getMaxOutstandingMessages() { public Builder setMaxOutstandingMessages(long value) { maxOutstandingMessages_ = value; + bitField0_ |= 0x00000040; onChanged(); return this; } + /** * * *
    -     * Flow control settings for the maximum number of outstanding messages. When
    -     * there are `max_outstanding_messages` or more currently sent to the
    +     * Optional. Flow control settings for the maximum number of outstanding
    +     * messages. When there are `max_outstanding_messages` currently sent to the
          * streaming pull client that have not yet been acked or nacked, the server
          * stops sending more messages. The sending of messages resumes once the
          * number of outstanding messages is less than this value. If the value is
    @@ -2102,34 +2186,35 @@ public Builder setMaxOutstandingMessages(long value) {
          * `INVALID_ARGUMENT`.
          * 
    * - * int64 max_outstanding_messages = 7; + * int64 max_outstanding_messages = 7 [(.google.api.field_behavior) = OPTIONAL]; * * @return This builder for chaining. */ public Builder clearMaxOutstandingMessages() { - + bitField0_ = (bitField0_ & ~0x00000040); maxOutstandingMessages_ = 0L; onChanged(); return this; } private long maxOutstandingBytes_; + /** * * *
    -     * Flow control settings for the maximum number of outstanding bytes. When
    -     * there are `max_outstanding_bytes` or more worth of messages currently sent
    -     * to the streaming pull client that have not yet been acked or nacked, the
    -     * server will stop sending more messages. The sending of messages resumes
    -     * once the number of outstanding bytes is less than this value. If the value
    -     * is <= 0, there is no limit to the number of outstanding bytes. This
    -     * property can only be set on the initial StreamingPullRequest. If it is set
    -     * on a subsequent request, the stream will be aborted with status
    +     * Optional. Flow control settings for the maximum number of outstanding
    +     * bytes. When there are `max_outstanding_bytes` or more worth of messages
    +     * currently sent to the streaming pull client that have not yet been acked or
    +     * nacked, the server will stop sending more messages. The sending of messages
    +     * resumes once the number of outstanding bytes is less than this value. If
    +     * the value is <= 0, there is no limit to the number of outstanding bytes.
    +     * This property can only be set on the initial StreamingPullRequest. If it is
    +     * set on a subsequent request, the stream will be aborted with status
          * `INVALID_ARGUMENT`.
          * 
    * - * int64 max_outstanding_bytes = 8; + * int64 max_outstanding_bytes = 8 [(.google.api.field_behavior) = OPTIONAL]; * * @return The maxOutstandingBytes. */ @@ -2137,22 +2222,23 @@ public Builder clearMaxOutstandingMessages() { public long getMaxOutstandingBytes() { return maxOutstandingBytes_; } + /** * * *
    -     * Flow control settings for the maximum number of outstanding bytes. When
    -     * there are `max_outstanding_bytes` or more worth of messages currently sent
    -     * to the streaming pull client that have not yet been acked or nacked, the
    -     * server will stop sending more messages. The sending of messages resumes
    -     * once the number of outstanding bytes is less than this value. If the value
    -     * is <= 0, there is no limit to the number of outstanding bytes. This
    -     * property can only be set on the initial StreamingPullRequest. If it is set
    -     * on a subsequent request, the stream will be aborted with status
    +     * Optional. Flow control settings for the maximum number of outstanding
    +     * bytes. When there are `max_outstanding_bytes` or more worth of messages
    +     * currently sent to the streaming pull client that have not yet been acked or
    +     * nacked, the server will stop sending more messages. The sending of messages
    +     * resumes once the number of outstanding bytes is less than this value. If
    +     * the value is <= 0, there is no limit to the number of outstanding bytes.
    +     * This property can only be set on the initial StreamingPullRequest. If it is
    +     * set on a subsequent request, the stream will be aborted with status
          * `INVALID_ARGUMENT`.
          * 
    * - * int64 max_outstanding_bytes = 8; + * int64 max_outstanding_bytes = 8 [(.google.api.field_behavior) = OPTIONAL]; * * @param value The maxOutstandingBytes to set. * @return This builder for chaining. @@ -2160,44 +2246,97 @@ public long getMaxOutstandingBytes() { public Builder setMaxOutstandingBytes(long value) { maxOutstandingBytes_ = value; + bitField0_ |= 0x00000080; onChanged(); return this; } + /** * * *
    -     * Flow control settings for the maximum number of outstanding bytes. When
    -     * there are `max_outstanding_bytes` or more worth of messages currently sent
    -     * to the streaming pull client that have not yet been acked or nacked, the
    -     * server will stop sending more messages. The sending of messages resumes
    -     * once the number of outstanding bytes is less than this value. If the value
    -     * is <= 0, there is no limit to the number of outstanding bytes. This
    -     * property can only be set on the initial StreamingPullRequest. If it is set
    -     * on a subsequent request, the stream will be aborted with status
    +     * Optional. Flow control settings for the maximum number of outstanding
    +     * bytes. When there are `max_outstanding_bytes` or more worth of messages
    +     * currently sent to the streaming pull client that have not yet been acked or
    +     * nacked, the server will stop sending more messages. The sending of messages
    +     * resumes once the number of outstanding bytes is less than this value. If
    +     * the value is <= 0, there is no limit to the number of outstanding bytes.
    +     * This property can only be set on the initial StreamingPullRequest. If it is
    +     * set on a subsequent request, the stream will be aborted with status
          * `INVALID_ARGUMENT`.
          * 
    * - * int64 max_outstanding_bytes = 8; + * int64 max_outstanding_bytes = 8 [(.google.api.field_behavior) = OPTIONAL]; * * @return This builder for chaining. */ public Builder clearMaxOutstandingBytes() { - + bitField0_ = (bitField0_ & ~0x00000080); maxOutstandingBytes_ = 0L; onChanged(); return this; } + private long protocolVersion_; + + /** + * + * + *
    +     * Optional. The protocol version used by the client. This property can only
    +     * be set on the initial StreamingPullRequest. If it is set on a subsequent
    +     * request, the stream will be aborted with status `INVALID_ARGUMENT`.
    +     * 
    + * + * int64 protocol_version = 10 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The protocolVersion. + */ @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); + public long getProtocolVersion() { + return protocolVersion_; } - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); + /** + * + * + *
    +     * Optional. The protocol version used by the client. This property can only
    +     * be set on the initial StreamingPullRequest. If it is set on a subsequent
    +     * request, the stream will be aborted with status `INVALID_ARGUMENT`.
    +     * 
    + * + * int64 protocol_version = 10 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The protocolVersion to set. + * @return This builder for chaining. + */ + public Builder setProtocolVersion(long value) { + + protocolVersion_ = value; + bitField0_ |= 0x00000100; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Optional. The protocol version used by the client. This property can only
    +     * be set on the initial StreamingPullRequest. If it is set on a subsequent
    +     * request, the stream will be aborted with status `INVALID_ARGUMENT`.
    +     * 
    + * + * int64 protocol_version = 10 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearProtocolVersion() { + bitField0_ = (bitField0_ & ~0x00000100); + protocolVersion_ = 0L; + onChanged(); + return this; } // @@protoc_insertion_point(builder_scope:google.pubsub.v1.StreamingPullRequest) @@ -2221,7 +2360,18 @@ public StreamingPullRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new StreamingPullRequest(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/StreamingPullRequestOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/StreamingPullRequestOrBuilder.java index eca392820..6f4d94bcb 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/StreamingPullRequestOrBuilder.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/StreamingPullRequestOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; +@com.google.protobuf.Generated public interface StreamingPullRequestOrBuilder extends // @@protoc_insertion_point(interface_extends:google.pubsub.v1.StreamingPullRequest) @@ -40,6 +43,7 @@ public interface StreamingPullRequestOrBuilder * @return The subscription. */ java.lang.String getSubscription(); + /** * * @@ -62,63 +66,66 @@ public interface StreamingPullRequestOrBuilder * * *
    -   * List of acknowledgement IDs for acknowledging previously received messages
    -   * (received on this stream or a different stream). If an ack ID has expired,
    -   * the corresponding message may be redelivered later. Acknowledging a message
    -   * more than once will not result in an error. If the acknowledgement ID is
    -   * malformed, the stream will be aborted with status `INVALID_ARGUMENT`.
    +   * Optional. List of acknowledgment IDs for acknowledging previously received
    +   * messages (received on this stream or a different stream). If an ack ID has
    +   * expired, the corresponding message may be redelivered later. Acknowledging
    +   * a message more than once will not result in an error. If the acknowledgment
    +   * ID is malformed, the stream will be aborted with status `INVALID_ARGUMENT`.
        * 
    * - * repeated string ack_ids = 2; + * repeated string ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return A list containing the ackIds. */ java.util.List getAckIdsList(); + /** * * *
    -   * List of acknowledgement IDs for acknowledging previously received messages
    -   * (received on this stream or a different stream). If an ack ID has expired,
    -   * the corresponding message may be redelivered later. Acknowledging a message
    -   * more than once will not result in an error. If the acknowledgement ID is
    -   * malformed, the stream will be aborted with status `INVALID_ARGUMENT`.
    +   * Optional. List of acknowledgment IDs for acknowledging previously received
    +   * messages (received on this stream or a different stream). If an ack ID has
    +   * expired, the corresponding message may be redelivered later. Acknowledging
    +   * a message more than once will not result in an error. If the acknowledgment
    +   * ID is malformed, the stream will be aborted with status `INVALID_ARGUMENT`.
        * 
    * - * repeated string ack_ids = 2; + * repeated string ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @return The count of ackIds. */ int getAckIdsCount(); + /** * * *
    -   * List of acknowledgement IDs for acknowledging previously received messages
    -   * (received on this stream or a different stream). If an ack ID has expired,
    -   * the corresponding message may be redelivered later. Acknowledging a message
    -   * more than once will not result in an error. If the acknowledgement ID is
    -   * malformed, the stream will be aborted with status `INVALID_ARGUMENT`.
    +   * Optional. List of acknowledgment IDs for acknowledging previously received
    +   * messages (received on this stream or a different stream). If an ack ID has
    +   * expired, the corresponding message may be redelivered later. Acknowledging
    +   * a message more than once will not result in an error. If the acknowledgment
    +   * ID is malformed, the stream will be aborted with status `INVALID_ARGUMENT`.
        * 
    * - * repeated string ack_ids = 2; + * repeated string ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @param index The index of the element to return. * @return The ackIds at the given index. */ java.lang.String getAckIds(int index); + /** * * *
    -   * List of acknowledgement IDs for acknowledging previously received messages
    -   * (received on this stream or a different stream). If an ack ID has expired,
    -   * the corresponding message may be redelivered later. Acknowledging a message
    -   * more than once will not result in an error. If the acknowledgement ID is
    -   * malformed, the stream will be aborted with status `INVALID_ARGUMENT`.
    +   * Optional. List of acknowledgment IDs for acknowledging previously received
    +   * messages (received on this stream or a different stream). If an ack ID has
    +   * expired, the corresponding message may be redelivered later. Acknowledging
    +   * a message more than once will not result in an error. If the acknowledgment
    +   * ID is malformed, the stream will be aborted with status `INVALID_ARGUMENT`.
        * 
    * - * repeated string ack_ids = 2; + * repeated string ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; * * @param index The index of the value to return. * @return The bytes of the ackIds at the given index. @@ -129,7 +136,7 @@ public interface StreamingPullRequestOrBuilder * * *
    -   * The list of new ack deadlines for the IDs listed in
    +   * Optional. The list of new ack deadlines for the IDs listed in
        * `modify_deadline_ack_ids`. The size of this list must be the same as the
        * size of `modify_deadline_ack_ids`. If it differs the stream will be aborted
        * with `INVALID_ARGUMENT`. Each element in this list is applied to the
    @@ -142,16 +149,18 @@ public interface StreamingPullRequestOrBuilder
        * be aborted with status `INVALID_ARGUMENT`.
        * 
    * - * repeated int32 modify_deadline_seconds = 3; + * repeated int32 modify_deadline_seconds = 3 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return A list containing the modifyDeadlineSeconds. */ java.util.List getModifyDeadlineSecondsList(); + /** * * *
    -   * The list of new ack deadlines for the IDs listed in
    +   * Optional. The list of new ack deadlines for the IDs listed in
        * `modify_deadline_ack_ids`. The size of this list must be the same as the
        * size of `modify_deadline_ack_ids`. If it differs the stream will be aborted
        * with `INVALID_ARGUMENT`. Each element in this list is applied to the
    @@ -164,16 +173,18 @@ public interface StreamingPullRequestOrBuilder
        * be aborted with status `INVALID_ARGUMENT`.
        * 
    * - * repeated int32 modify_deadline_seconds = 3; + * repeated int32 modify_deadline_seconds = 3 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return The count of modifyDeadlineSeconds. */ int getModifyDeadlineSecondsCount(); + /** * * *
    -   * The list of new ack deadlines for the IDs listed in
    +   * Optional. The list of new ack deadlines for the IDs listed in
        * `modify_deadline_ack_ids`. The size of this list must be the same as the
        * size of `modify_deadline_ack_ids`. If it differs the stream will be aborted
        * with `INVALID_ARGUMENT`. Each element in this list is applied to the
    @@ -186,7 +197,8 @@ public interface StreamingPullRequestOrBuilder
        * be aborted with status `INVALID_ARGUMENT`.
        * 
    * - * repeated int32 modify_deadline_seconds = 3; + * repeated int32 modify_deadline_seconds = 3 [(.google.api.field_behavior) = OPTIONAL]; + * * * @param index The index of the element to return. * @return The modifyDeadlineSeconds at the given index. @@ -197,63 +209,70 @@ public interface StreamingPullRequestOrBuilder * * *
    -   * List of acknowledgement IDs whose deadline will be modified based on the
    -   * corresponding element in `modify_deadline_seconds`. This field can be used
    -   * to indicate that more time is needed to process a message by the
    +   * Optional. List of acknowledgment IDs whose deadline will be modified based
    +   * on the corresponding element in `modify_deadline_seconds`. This field can
    +   * be used to indicate that more time is needed to process a message by the
        * subscriber, or to make the message available for redelivery if the
        * processing was interrupted.
        * 
    * - * repeated string modify_deadline_ack_ids = 4; + * repeated string modify_deadline_ack_ids = 4 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return A list containing the modifyDeadlineAckIds. */ java.util.List getModifyDeadlineAckIdsList(); + /** * * *
    -   * List of acknowledgement IDs whose deadline will be modified based on the
    -   * corresponding element in `modify_deadline_seconds`. This field can be used
    -   * to indicate that more time is needed to process a message by the
    +   * Optional. List of acknowledgment IDs whose deadline will be modified based
    +   * on the corresponding element in `modify_deadline_seconds`. This field can
    +   * be used to indicate that more time is needed to process a message by the
        * subscriber, or to make the message available for redelivery if the
        * processing was interrupted.
        * 
    * - * repeated string modify_deadline_ack_ids = 4; + * repeated string modify_deadline_ack_ids = 4 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return The count of modifyDeadlineAckIds. */ int getModifyDeadlineAckIdsCount(); + /** * * *
    -   * List of acknowledgement IDs whose deadline will be modified based on the
    -   * corresponding element in `modify_deadline_seconds`. This field can be used
    -   * to indicate that more time is needed to process a message by the
    +   * Optional. List of acknowledgment IDs whose deadline will be modified based
    +   * on the corresponding element in `modify_deadline_seconds`. This field can
    +   * be used to indicate that more time is needed to process a message by the
        * subscriber, or to make the message available for redelivery if the
        * processing was interrupted.
        * 
    * - * repeated string modify_deadline_ack_ids = 4; + * repeated string modify_deadline_ack_ids = 4 [(.google.api.field_behavior) = OPTIONAL]; + * * * @param index The index of the element to return. * @return The modifyDeadlineAckIds at the given index. */ java.lang.String getModifyDeadlineAckIds(int index); + /** * * *
    -   * List of acknowledgement IDs whose deadline will be modified based on the
    -   * corresponding element in `modify_deadline_seconds`. This field can be used
    -   * to indicate that more time is needed to process a message by the
    +   * Optional. List of acknowledgment IDs whose deadline will be modified based
    +   * on the corresponding element in `modify_deadline_seconds`. This field can
    +   * be used to indicate that more time is needed to process a message by the
        * subscriber, or to make the message available for redelivery if the
        * processing was interrupted.
        * 
    * - * repeated string modify_deadline_ack_ids = 4; + * repeated string modify_deadline_ack_ids = 4 [(.google.api.field_behavior) = OPTIONAL]; + * * * @param index The index of the value to return. * @return The bytes of the modifyDeadlineAckIds at the given index. @@ -280,32 +299,33 @@ public interface StreamingPullRequestOrBuilder * * *
    -   * A unique identifier that is used to distinguish client instances from each
    -   * other. Only needs to be provided on the initial request. When a stream
    -   * disconnects and reconnects for the same stream, the client_id should be set
    -   * to the same value so that state associated with the old stream can be
    -   * transferred to the new stream. The same client_id should not be used for
    +   * Optional. A unique identifier that is used to distinguish client instances
    +   * from each other. Only needs to be provided on the initial request. When a
    +   * stream disconnects and reconnects for the same stream, the client_id should
    +   * be set to the same value so that state associated with the old stream can
    +   * be transferred to the new stream. The same client_id should not be used for
        * different client instances.
        * 
    * - * string client_id = 6; + * string client_id = 6 [(.google.api.field_behavior) = OPTIONAL]; * * @return The clientId. */ java.lang.String getClientId(); + /** * * *
    -   * A unique identifier that is used to distinguish client instances from each
    -   * other. Only needs to be provided on the initial request. When a stream
    -   * disconnects and reconnects for the same stream, the client_id should be set
    -   * to the same value so that state associated with the old stream can be
    -   * transferred to the new stream. The same client_id should not be used for
    +   * Optional. A unique identifier that is used to distinguish client instances
    +   * from each other. Only needs to be provided on the initial request. When a
    +   * stream disconnects and reconnects for the same stream, the client_id should
    +   * be set to the same value so that state associated with the old stream can
    +   * be transferred to the new stream. The same client_id should not be used for
        * different client instances.
        * 
    * - * string client_id = 6; + * string client_id = 6 [(.google.api.field_behavior) = OPTIONAL]; * * @return The bytes for clientId. */ @@ -315,8 +335,8 @@ public interface StreamingPullRequestOrBuilder * * *
    -   * Flow control settings for the maximum number of outstanding messages. When
    -   * there are `max_outstanding_messages` or more currently sent to the
    +   * Optional. Flow control settings for the maximum number of outstanding
    +   * messages. When there are `max_outstanding_messages` currently sent to the
        * streaming pull client that have not yet been acked or nacked, the server
        * stops sending more messages. The sending of messages resumes once the
        * number of outstanding messages is less than this value. If the value is
    @@ -326,7 +346,7 @@ public interface StreamingPullRequestOrBuilder
        * `INVALID_ARGUMENT`.
        * 
    * - * int64 max_outstanding_messages = 7; + * int64 max_outstanding_messages = 7 [(.google.api.field_behavior) = OPTIONAL]; * * @return The maxOutstandingMessages. */ @@ -336,20 +356,35 @@ public interface StreamingPullRequestOrBuilder * * *
    -   * Flow control settings for the maximum number of outstanding bytes. When
    -   * there are `max_outstanding_bytes` or more worth of messages currently sent
    -   * to the streaming pull client that have not yet been acked or nacked, the
    -   * server will stop sending more messages. The sending of messages resumes
    -   * once the number of outstanding bytes is less than this value. If the value
    -   * is <= 0, there is no limit to the number of outstanding bytes. This
    -   * property can only be set on the initial StreamingPullRequest. If it is set
    -   * on a subsequent request, the stream will be aborted with status
    +   * Optional. Flow control settings for the maximum number of outstanding
    +   * bytes. When there are `max_outstanding_bytes` or more worth of messages
    +   * currently sent to the streaming pull client that have not yet been acked or
    +   * nacked, the server will stop sending more messages. The sending of messages
    +   * resumes once the number of outstanding bytes is less than this value. If
    +   * the value is <= 0, there is no limit to the number of outstanding bytes.
    +   * This property can only be set on the initial StreamingPullRequest. If it is
    +   * set on a subsequent request, the stream will be aborted with status
        * `INVALID_ARGUMENT`.
        * 
    * - * int64 max_outstanding_bytes = 8; + * int64 max_outstanding_bytes = 8 [(.google.api.field_behavior) = OPTIONAL]; * * @return The maxOutstandingBytes. */ long getMaxOutstandingBytes(); + + /** + * + * + *
    +   * Optional. The protocol version used by the client. This property can only
    +   * be set on the initial StreamingPullRequest. If it is set on a subsequent
    +   * request, the stream will be aborted with status `INVALID_ARGUMENT`.
    +   * 
    + * + * int64 protocol_version = 10 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The protocolVersion. + */ + long getProtocolVersion(); } 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 8b5c0a1ad..2ec1bf15c 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 @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; @@ -28,13 +30,25 @@ * * Protobuf type {@code google.pubsub.v1.StreamingPullResponse} */ -public final class StreamingPullResponse extends com.google.protobuf.GeneratedMessageV3 +@com.google.protobuf.Generated +public final class StreamingPullResponse extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:google.pubsub.v1.StreamingPullResponse) StreamingPullResponseOrBuilder { private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "StreamingPullResponse"); + } + // Use StreamingPullResponse.newBuilder() to construct. - private StreamingPullResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + private StreamingPullResponse(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); } @@ -42,76 +56,13 @@ private StreamingPullResponse() { receivedMessages_ = java.util.Collections.emptyList(); } - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new StreamingPullResponse(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - private StreamingPullResponse( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - if (!((mutable_bitField0_ & 0x00000001) != 0)) { - receivedMessages_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000001; - } - receivedMessages_.add( - input.readMessage( - com.google.pubsub.v1.ReceivedMessage.parser(), extensionRegistry)); - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000001) != 0)) { - receivedMessages_ = java.util.Collections.unmodifiableList(receivedMessages_); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_StreamingPullResponse_descriptor; } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_StreamingPullResponse_fieldAccessorTable @@ -120,797 +71,5869 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { com.google.pubsub.v1.StreamingPullResponse.Builder.class); } - public static final int RECEIVED_MESSAGES_FIELD_NUMBER = 1; - private java.util.List receivedMessages_; - /** - * - * - *
    -   * Received Pub/Sub messages. This will not be empty.
    -   * 
    - * - * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1; - */ - @java.lang.Override - public java.util.List getReceivedMessagesList() { - return receivedMessages_; - } - /** - * - * - *
    -   * Received Pub/Sub messages. This will not be empty.
    -   * 
    - * - * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1; - */ - @java.lang.Override - public java.util.List - getReceivedMessagesOrBuilderList() { - return receivedMessages_; - } - /** - * - * - *
    -   * Received Pub/Sub messages. This will not be empty.
    -   * 
    - * - * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1; - */ - @java.lang.Override - public int getReceivedMessagesCount() { - return receivedMessages_.size(); - } - /** - * - * - *
    -   * Received Pub/Sub messages. This will not be empty.
    -   * 
    - * - * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1; - */ - @java.lang.Override - public com.google.pubsub.v1.ReceivedMessage getReceivedMessages(int index) { - return receivedMessages_.get(index); + public interface AcknowledgeConfirmationOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
    +     * Optional. Successfully processed acknowledgment IDs.
    +     * 
    + * + * repeated string ack_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return A list containing the ackIds. + */ + java.util.List getAckIdsList(); + + /** + * + * + *
    +     * Optional. Successfully processed acknowledgment IDs.
    +     * 
    + * + * repeated string ack_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The count of ackIds. + */ + int getAckIdsCount(); + + /** + * + * + *
    +     * Optional. Successfully processed acknowledgment IDs.
    +     * 
    + * + * repeated string ack_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the element to return. + * @return The ackIds at the given index. + */ + java.lang.String getAckIds(int index); + + /** + * + * + *
    +     * Optional. Successfully processed acknowledgment IDs.
    +     * 
    + * + * repeated string ack_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the value to return. + * @return The bytes of the ackIds at the given index. + */ + com.google.protobuf.ByteString getAckIdsBytes(int index); + + /** + * + * + *
    +     * Optional. List of acknowledgment IDs that were malformed or whose
    +     * acknowledgment deadline has expired.
    +     * 
    + * + * repeated string invalid_ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return A list containing the invalidAckIds. + */ + java.util.List getInvalidAckIdsList(); + + /** + * + * + *
    +     * Optional. List of acknowledgment IDs that were malformed or whose
    +     * acknowledgment deadline has expired.
    +     * 
    + * + * repeated string invalid_ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The count of invalidAckIds. + */ + int getInvalidAckIdsCount(); + + /** + * + * + *
    +     * Optional. List of acknowledgment IDs that were malformed or whose
    +     * acknowledgment deadline has expired.
    +     * 
    + * + * repeated string invalid_ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the element to return. + * @return The invalidAckIds at the given index. + */ + java.lang.String getInvalidAckIds(int index); + + /** + * + * + *
    +     * Optional. List of acknowledgment IDs that were malformed or whose
    +     * acknowledgment deadline has expired.
    +     * 
    + * + * repeated string invalid_ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the value to return. + * @return The bytes of the invalidAckIds at the given index. + */ + com.google.protobuf.ByteString getInvalidAckIdsBytes(int index); + + /** + * + * + *
    +     * Optional. List of acknowledgment IDs that were out of order.
    +     * 
    + * + * repeated string unordered_ack_ids = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return A list containing the unorderedAckIds. + */ + java.util.List getUnorderedAckIdsList(); + + /** + * + * + *
    +     * Optional. List of acknowledgment IDs that were out of order.
    +     * 
    + * + * repeated string unordered_ack_ids = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The count of unorderedAckIds. + */ + int getUnorderedAckIdsCount(); + + /** + * + * + *
    +     * Optional. List of acknowledgment IDs that were out of order.
    +     * 
    + * + * repeated string unordered_ack_ids = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the element to return. + * @return The unorderedAckIds at the given index. + */ + java.lang.String getUnorderedAckIds(int index); + + /** + * + * + *
    +     * Optional. List of acknowledgment IDs that were out of order.
    +     * 
    + * + * repeated string unordered_ack_ids = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the value to return. + * @return The bytes of the unorderedAckIds at the given index. + */ + com.google.protobuf.ByteString getUnorderedAckIdsBytes(int index); + + /** + * + * + *
    +     * Optional. List of acknowledgment IDs that failed processing with
    +     * temporary issues.
    +     * 
    + * + * repeated string temporary_failed_ack_ids = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return A list containing the temporaryFailedAckIds. + */ + java.util.List getTemporaryFailedAckIdsList(); + + /** + * + * + *
    +     * Optional. List of acknowledgment IDs that failed processing with
    +     * temporary issues.
    +     * 
    + * + * repeated string temporary_failed_ack_ids = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The count of temporaryFailedAckIds. + */ + int getTemporaryFailedAckIdsCount(); + + /** + * + * + *
    +     * Optional. List of acknowledgment IDs that failed processing with
    +     * temporary issues.
    +     * 
    + * + * repeated string temporary_failed_ack_ids = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param index The index of the element to return. + * @return The temporaryFailedAckIds at the given index. + */ + java.lang.String getTemporaryFailedAckIds(int index); + + /** + * + * + *
    +     * Optional. List of acknowledgment IDs that failed processing with
    +     * temporary issues.
    +     * 
    + * + * repeated string temporary_failed_ack_ids = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param index The index of the value to return. + * @return The bytes of the temporaryFailedAckIds at the given index. + */ + com.google.protobuf.ByteString getTemporaryFailedAckIdsBytes(int index); } + /** * * *
    -   * Received Pub/Sub messages. This will not be empty.
    +   * Acknowledgment IDs sent in one or more previous requests to acknowledge a
    +   * previously received message.
        * 
    * - * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1; + * Protobuf type {@code google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation} */ - @java.lang.Override - public com.google.pubsub.v1.ReceivedMessageOrBuilder getReceivedMessagesOrBuilder(int index) { - return receivedMessages_.get(index); - } - - private byte memoizedIsInitialized = -1; + public static final class AcknowledgeConfirmation extends com.google.protobuf.GeneratedMessage + implements + // @@protoc_insertion_point(message_implements:google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation) + AcknowledgeConfirmationOrBuilder { + private static final long serialVersionUID = 0L; - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "AcknowledgeConfirmation"); + } - memoizedIsInitialized = 1; - return true; - } + // Use AcknowledgeConfirmation.newBuilder() to construct. + private AcknowledgeConfirmation(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - for (int i = 0; i < receivedMessages_.size(); i++) { - output.writeMessage(1, receivedMessages_.get(i)); + private AcknowledgeConfirmation() { + ackIds_ = com.google.protobuf.LazyStringArrayList.emptyList(); + invalidAckIds_ = com.google.protobuf.LazyStringArrayList.emptyList(); + unorderedAckIds_ = com.google.protobuf.LazyStringArrayList.emptyList(); + temporaryFailedAckIds_ = com.google.protobuf.LazyStringArrayList.emptyList(); } - unknownFields.writeTo(output); - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_StreamingPullResponse_AcknowledgeConfirmation_descriptor; + } - size = 0; - for (int i = 0; i < receivedMessages_.size(); i++) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, receivedMessages_.get(i)); + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_StreamingPullResponse_AcknowledgeConfirmation_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation.class, + com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation.Builder.class); } - size += unknownFields.getSerializedSize(); - memoizedSize = size; - return size; - } - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.pubsub.v1.StreamingPullResponse)) { - return super.equals(obj); + public static final int ACK_IDS_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private com.google.protobuf.LazyStringArrayList ackIds_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + + /** + * + * + *
    +     * Optional. Successfully processed acknowledgment IDs.
    +     * 
    + * + * repeated string ack_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return A list containing the ackIds. + */ + public com.google.protobuf.ProtocolStringList getAckIdsList() { + return ackIds_; } - com.google.pubsub.v1.StreamingPullResponse other = - (com.google.pubsub.v1.StreamingPullResponse) obj; - if (!getReceivedMessagesList().equals(other.getReceivedMessagesList())) return false; - if (!unknownFields.equals(other.unknownFields)) return false; - return true; - } + /** + * + * + *
    +     * Optional. Successfully processed acknowledgment IDs.
    +     * 
    + * + * repeated string ack_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The count of ackIds. + */ + public int getAckIdsCount() { + return ackIds_.size(); + } - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; + /** + * + * + *
    +     * Optional. Successfully processed acknowledgment IDs.
    +     * 
    + * + * repeated string ack_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the element to return. + * @return The ackIds at the given index. + */ + public java.lang.String getAckIds(int index) { + return ackIds_.get(index); } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - if (getReceivedMessagesCount() > 0) { - hash = (37 * hash) + RECEIVED_MESSAGES_FIELD_NUMBER; - hash = (53 * hash) + getReceivedMessagesList().hashCode(); + + /** + * + * + *
    +     * Optional. Successfully processed acknowledgment IDs.
    +     * 
    + * + * repeated string ack_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the value to return. + * @return The bytes of the ackIds at the given index. + */ + public com.google.protobuf.ByteString getAckIdsBytes(int index) { + return ackIds_.getByteString(index); } - hash = (29 * hash) + unknownFields.hashCode(); - memoizedHashCode = hash; - return hash; - } - public static com.google.pubsub.v1.StreamingPullResponse parseFrom(java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } + public static final int INVALID_ACK_IDS_FIELD_NUMBER = 2; - public static com.google.pubsub.v1.StreamingPullResponse parseFrom( - java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } + @SuppressWarnings("serial") + private com.google.protobuf.LazyStringArrayList invalidAckIds_ = + com.google.protobuf.LazyStringArrayList.emptyList(); - public static com.google.pubsub.v1.StreamingPullResponse parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } + /** + * + * + *
    +     * Optional. List of acknowledgment IDs that were malformed or whose
    +     * acknowledgment deadline has expired.
    +     * 
    + * + * repeated string invalid_ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return A list containing the invalidAckIds. + */ + public com.google.protobuf.ProtocolStringList getInvalidAckIdsList() { + return invalidAckIds_; + } - public static com.google.pubsub.v1.StreamingPullResponse parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } + /** + * + * + *
    +     * Optional. List of acknowledgment IDs that were malformed or whose
    +     * acknowledgment deadline has expired.
    +     * 
    + * + * repeated string invalid_ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The count of invalidAckIds. + */ + public int getInvalidAckIdsCount() { + return invalidAckIds_.size(); + } - public static com.google.pubsub.v1.StreamingPullResponse parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } + /** + * + * + *
    +     * Optional. List of acknowledgment IDs that were malformed or whose
    +     * acknowledgment deadline has expired.
    +     * 
    + * + * repeated string invalid_ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the element to return. + * @return The invalidAckIds at the given index. + */ + public java.lang.String getInvalidAckIds(int index) { + return invalidAckIds_.get(index); + } - public static com.google.pubsub.v1.StreamingPullResponse parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } + /** + * + * + *
    +     * Optional. List of acknowledgment IDs that were malformed or whose
    +     * acknowledgment deadline has expired.
    +     * 
    + * + * repeated string invalid_ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the value to return. + * @return The bytes of the invalidAckIds at the given index. + */ + public com.google.protobuf.ByteString getInvalidAckIdsBytes(int index) { + return invalidAckIds_.getByteString(index); + } - public static com.google.pubsub.v1.StreamingPullResponse parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } + public static final int UNORDERED_ACK_IDS_FIELD_NUMBER = 3; - public static com.google.pubsub.v1.StreamingPullResponse parseFrom( - java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( - PARSER, input, extensionRegistry); - } + @SuppressWarnings("serial") + private com.google.protobuf.LazyStringArrayList unorderedAckIds_ = + com.google.protobuf.LazyStringArrayList.emptyList(); - public static com.google.pubsub.v1.StreamingPullResponse parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } + /** + * + * + *
    +     * Optional. List of acknowledgment IDs that were out of order.
    +     * 
    + * + * repeated string unordered_ack_ids = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return A list containing the unorderedAckIds. + */ + public com.google.protobuf.ProtocolStringList getUnorderedAckIdsList() { + return unorderedAckIds_; + } - public static com.google.pubsub.v1.StreamingPullResponse parseDelimitedFrom( - java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( - PARSER, input, extensionRegistry); - } + /** + * + * + *
    +     * Optional. List of acknowledgment IDs that were out of order.
    +     * 
    + * + * repeated string unordered_ack_ids = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The count of unorderedAckIds. + */ + public int getUnorderedAckIdsCount() { + return unorderedAckIds_.size(); + } - public static com.google.pubsub.v1.StreamingPullResponse parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } + /** + * + * + *
    +     * Optional. List of acknowledgment IDs that were out of order.
    +     * 
    + * + * repeated string unordered_ack_ids = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the element to return. + * @return The unorderedAckIds at the given index. + */ + public java.lang.String getUnorderedAckIds(int index) { + return unorderedAckIds_.get(index); + } - public static com.google.pubsub.v1.StreamingPullResponse parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( - PARSER, input, extensionRegistry); - } + /** + * + * + *
    +     * Optional. List of acknowledgment IDs that were out of order.
    +     * 
    + * + * repeated string unordered_ack_ids = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the value to return. + * @return The bytes of the unorderedAckIds at the given index. + */ + public com.google.protobuf.ByteString getUnorderedAckIdsBytes(int index) { + return unorderedAckIds_.getByteString(index); + } - @java.lang.Override - public Builder newBuilderForType() { - return newBuilder(); - } + public static final int TEMPORARY_FAILED_ACK_IDS_FIELD_NUMBER = 4; - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } + @SuppressWarnings("serial") + private com.google.protobuf.LazyStringArrayList temporaryFailedAckIds_ = + com.google.protobuf.LazyStringArrayList.emptyList(); - public static Builder newBuilder(com.google.pubsub.v1.StreamingPullResponse prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } + /** + * + * + *
    +     * Optional. List of acknowledgment IDs that failed processing with
    +     * temporary issues.
    +     * 
    + * + * repeated string temporary_failed_ack_ids = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return A list containing the temporaryFailedAckIds. + */ + public com.google.protobuf.ProtocolStringList getTemporaryFailedAckIdsList() { + return temporaryFailedAckIds_; + } - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } + /** + * + * + *
    +     * Optional. List of acknowledgment IDs that failed processing with
    +     * temporary issues.
    +     * 
    + * + * repeated string temporary_failed_ack_ids = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The count of temporaryFailedAckIds. + */ + public int getTemporaryFailedAckIdsCount() { + return temporaryFailedAckIds_.size(); + } - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * - * - *
    -   * Response for the `StreamingPull` method. This response is used to stream
    -   * messages from the server to the client.
    -   * 
    - * - * Protobuf type {@code google.pubsub.v1.StreamingPullResponse} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.pubsub.v1.StreamingPullResponse) - com.google.pubsub.v1.StreamingPullResponseOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.pubsub.v1.PubsubProto - .internal_static_google_pubsub_v1_StreamingPullResponse_descriptor; + /** + * + * + *
    +     * Optional. List of acknowledgment IDs that failed processing with
    +     * temporary issues.
    +     * 
    + * + * repeated string temporary_failed_ack_ids = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param index The index of the element to return. + * @return The temporaryFailedAckIds at the given index. + */ + public java.lang.String getTemporaryFailedAckIds(int index) { + return temporaryFailedAckIds_.get(index); + } + + /** + * + * + *
    +     * Optional. List of acknowledgment IDs that failed processing with
    +     * temporary issues.
    +     * 
    + * + * repeated string temporary_failed_ack_ids = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param index The index of the value to return. + * @return The bytes of the temporaryFailedAckIds at the given index. + */ + public com.google.protobuf.ByteString getTemporaryFailedAckIdsBytes(int index) { + return temporaryFailedAckIds_.getByteString(index); } + private byte memoizedIsInitialized = -1; + @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < ackIds_.size(); i++) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, ackIds_.getRaw(i)); + } + for (int i = 0; i < invalidAckIds_.size(); i++) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, invalidAckIds_.getRaw(i)); + } + for (int i = 0; i < unorderedAckIds_.size(); i++) { + com.google.protobuf.GeneratedMessage.writeString(output, 3, unorderedAckIds_.getRaw(i)); + } + for (int i = 0; i < temporaryFailedAckIds_.size(); i++) { + com.google.protobuf.GeneratedMessage.writeString( + output, 4, temporaryFailedAckIds_.getRaw(i)); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + { + int dataSize = 0; + for (int i = 0; i < ackIds_.size(); i++) { + dataSize += computeStringSizeNoTag(ackIds_.getRaw(i)); + } + size += dataSize; + size += 1 * getAckIdsList().size(); + } + { + int dataSize = 0; + for (int i = 0; i < invalidAckIds_.size(); i++) { + dataSize += computeStringSizeNoTag(invalidAckIds_.getRaw(i)); + } + size += dataSize; + size += 1 * getInvalidAckIdsList().size(); + } + { + int dataSize = 0; + for (int i = 0; i < unorderedAckIds_.size(); i++) { + dataSize += computeStringSizeNoTag(unorderedAckIds_.getRaw(i)); + } + size += dataSize; + size += 1 * getUnorderedAckIdsList().size(); + } + { + int dataSize = 0; + for (int i = 0; i < temporaryFailedAckIds_.size(); i++) { + dataSize += computeStringSizeNoTag(temporaryFailedAckIds_.getRaw(i)); + } + size += dataSize; + size += 1 * getTemporaryFailedAckIdsList().size(); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation)) { + return super.equals(obj); + } + com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation other = + (com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation) obj; + + if (!getAckIdsList().equals(other.getAckIdsList())) return false; + if (!getInvalidAckIdsList().equals(other.getInvalidAckIdsList())) return false; + if (!getUnorderedAckIdsList().equals(other.getUnorderedAckIdsList())) return false; + if (!getTemporaryFailedAckIdsList().equals(other.getTemporaryFailedAckIdsList())) + return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getAckIdsCount() > 0) { + hash = (37 * hash) + ACK_IDS_FIELD_NUMBER; + hash = (53 * hash) + getAckIdsList().hashCode(); + } + if (getInvalidAckIdsCount() > 0) { + hash = (37 * hash) + INVALID_ACK_IDS_FIELD_NUMBER; + hash = (53 * hash) + getInvalidAckIdsList().hashCode(); + } + if (getUnorderedAckIdsCount() > 0) { + hash = (37 * hash) + UNORDERED_ACK_IDS_FIELD_NUMBER; + hash = (53 * hash) + getUnorderedAckIdsList().hashCode(); + } + if (getTemporaryFailedAckIdsCount() > 0) { + hash = (37 * hash) + TEMPORARY_FAILED_ACK_IDS_FIELD_NUMBER; + hash = (53 * hash) + getTemporaryFailedAckIdsList().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation parseFrom( + byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation + parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation + parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + + /** + * + * + *
    +     * Acknowledgment IDs sent in one or more previous requests to acknowledge a
    +     * previously received message.
    +     * 
    + * + * Protobuf type {@code google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder + implements + // @@protoc_insertion_point(builder_implements:google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation) + com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmationOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_StreamingPullResponse_AcknowledgeConfirmation_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_StreamingPullResponse_AcknowledgeConfirmation_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation.class, + com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation.Builder.class); + } + + // Construct using + // com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + ackIds_ = com.google.protobuf.LazyStringArrayList.emptyList(); + invalidAckIds_ = com.google.protobuf.LazyStringArrayList.emptyList(); + unorderedAckIds_ = com.google.protobuf.LazyStringArrayList.emptyList(); + temporaryFailedAckIds_ = com.google.protobuf.LazyStringArrayList.emptyList(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_StreamingPullResponse_AcknowledgeConfirmation_descriptor; + } + + @java.lang.Override + public com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation + getDefaultInstanceForType() { + return com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation + .getDefaultInstance(); + } + + @java.lang.Override + public com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation build() { + com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation buildPartial() { + com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation result = + new com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0( + com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + ackIds_.makeImmutable(); + result.ackIds_ = ackIds_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + invalidAckIds_.makeImmutable(); + result.invalidAckIds_ = invalidAckIds_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + unorderedAckIds_.makeImmutable(); + result.unorderedAckIds_ = unorderedAckIds_; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + temporaryFailedAckIds_.makeImmutable(); + result.temporaryFailedAckIds_ = temporaryFailedAckIds_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation) { + return mergeFrom( + (com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation other) { + if (other + == com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation + .getDefaultInstance()) return this; + if (!other.ackIds_.isEmpty()) { + if (ackIds_.isEmpty()) { + ackIds_ = other.ackIds_; + bitField0_ |= 0x00000001; + } else { + ensureAckIdsIsMutable(); + ackIds_.addAll(other.ackIds_); + } + onChanged(); + } + if (!other.invalidAckIds_.isEmpty()) { + if (invalidAckIds_.isEmpty()) { + invalidAckIds_ = other.invalidAckIds_; + bitField0_ |= 0x00000002; + } else { + ensureInvalidAckIdsIsMutable(); + invalidAckIds_.addAll(other.invalidAckIds_); + } + onChanged(); + } + if (!other.unorderedAckIds_.isEmpty()) { + if (unorderedAckIds_.isEmpty()) { + unorderedAckIds_ = other.unorderedAckIds_; + bitField0_ |= 0x00000004; + } else { + ensureUnorderedAckIdsIsMutable(); + unorderedAckIds_.addAll(other.unorderedAckIds_); + } + onChanged(); + } + if (!other.temporaryFailedAckIds_.isEmpty()) { + if (temporaryFailedAckIds_.isEmpty()) { + temporaryFailedAckIds_ = other.temporaryFailedAckIds_; + bitField0_ |= 0x00000008; + } else { + ensureTemporaryFailedAckIdsIsMutable(); + temporaryFailedAckIds_.addAll(other.temporaryFailedAckIds_); + } + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + ensureAckIdsIsMutable(); + ackIds_.add(s); + break; + } // case 10 + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + ensureInvalidAckIdsIsMutable(); + invalidAckIds_.add(s); + break; + } // case 18 + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + ensureUnorderedAckIdsIsMutable(); + unorderedAckIds_.add(s); + break; + } // case 26 + case 34: + { + java.lang.String s = input.readStringRequireUtf8(); + ensureTemporaryFailedAckIdsIsMutable(); + temporaryFailedAckIds_.add(s); + break; + } // case 34 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private com.google.protobuf.LazyStringArrayList ackIds_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + + private void ensureAckIdsIsMutable() { + if (!ackIds_.isModifiable()) { + ackIds_ = new com.google.protobuf.LazyStringArrayList(ackIds_); + } + bitField0_ |= 0x00000001; + } + + /** + * + * + *
    +       * Optional. Successfully processed acknowledgment IDs.
    +       * 
    + * + * repeated string ack_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return A list containing the ackIds. + */ + public com.google.protobuf.ProtocolStringList getAckIdsList() { + ackIds_.makeImmutable(); + return ackIds_; + } + + /** + * + * + *
    +       * Optional. Successfully processed acknowledgment IDs.
    +       * 
    + * + * repeated string ack_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The count of ackIds. + */ + public int getAckIdsCount() { + return ackIds_.size(); + } + + /** + * + * + *
    +       * Optional. Successfully processed acknowledgment IDs.
    +       * 
    + * + * repeated string ack_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the element to return. + * @return The ackIds at the given index. + */ + public java.lang.String getAckIds(int index) { + return ackIds_.get(index); + } + + /** + * + * + *
    +       * Optional. Successfully processed acknowledgment IDs.
    +       * 
    + * + * repeated string ack_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the value to return. + * @return The bytes of the ackIds at the given index. + */ + public com.google.protobuf.ByteString getAckIdsBytes(int index) { + return ackIds_.getByteString(index); + } + + /** + * + * + *
    +       * Optional. Successfully processed acknowledgment IDs.
    +       * 
    + * + * repeated string ack_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index to set the value at. + * @param value The ackIds to set. + * @return This builder for chaining. + */ + public Builder setAckIds(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureAckIdsIsMutable(); + ackIds_.set(index, value); + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. Successfully processed acknowledgment IDs.
    +       * 
    + * + * repeated string ack_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The ackIds to add. + * @return This builder for chaining. + */ + public Builder addAckIds(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureAckIdsIsMutable(); + ackIds_.add(value); + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. Successfully processed acknowledgment IDs.
    +       * 
    + * + * repeated string ack_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param values The ackIds to add. + * @return This builder for chaining. + */ + public Builder addAllAckIds(java.lang.Iterable values) { + ensureAckIdsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, ackIds_); + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. Successfully processed acknowledgment IDs.
    +       * 
    + * + * repeated string ack_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearAckIds() { + ackIds_ = com.google.protobuf.LazyStringArrayList.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + ; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. Successfully processed acknowledgment IDs.
    +       * 
    + * + * repeated string ack_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes of the ackIds to add. + * @return This builder for chaining. + */ + public Builder addAckIdsBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureAckIdsIsMutable(); + ackIds_.add(value); + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringArrayList invalidAckIds_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + + private void ensureInvalidAckIdsIsMutable() { + if (!invalidAckIds_.isModifiable()) { + invalidAckIds_ = new com.google.protobuf.LazyStringArrayList(invalidAckIds_); + } + bitField0_ |= 0x00000002; + } + + /** + * + * + *
    +       * Optional. List of acknowledgment IDs that were malformed or whose
    +       * acknowledgment deadline has expired.
    +       * 
    + * + * repeated string invalid_ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return A list containing the invalidAckIds. + */ + public com.google.protobuf.ProtocolStringList getInvalidAckIdsList() { + invalidAckIds_.makeImmutable(); + return invalidAckIds_; + } + + /** + * + * + *
    +       * Optional. List of acknowledgment IDs that were malformed or whose
    +       * acknowledgment deadline has expired.
    +       * 
    + * + * repeated string invalid_ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The count of invalidAckIds. + */ + public int getInvalidAckIdsCount() { + return invalidAckIds_.size(); + } + + /** + * + * + *
    +       * Optional. List of acknowledgment IDs that were malformed or whose
    +       * acknowledgment deadline has expired.
    +       * 
    + * + * repeated string invalid_ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the element to return. + * @return The invalidAckIds at the given index. + */ + public java.lang.String getInvalidAckIds(int index) { + return invalidAckIds_.get(index); + } + + /** + * + * + *
    +       * Optional. List of acknowledgment IDs that were malformed or whose
    +       * acknowledgment deadline has expired.
    +       * 
    + * + * repeated string invalid_ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the value to return. + * @return The bytes of the invalidAckIds at the given index. + */ + public com.google.protobuf.ByteString getInvalidAckIdsBytes(int index) { + return invalidAckIds_.getByteString(index); + } + + /** + * + * + *
    +       * Optional. List of acknowledgment IDs that were malformed or whose
    +       * acknowledgment deadline has expired.
    +       * 
    + * + * repeated string invalid_ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index to set the value at. + * @param value The invalidAckIds to set. + * @return This builder for chaining. + */ + public Builder setInvalidAckIds(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureInvalidAckIdsIsMutable(); + invalidAckIds_.set(index, value); + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. List of acknowledgment IDs that were malformed or whose
    +       * acknowledgment deadline has expired.
    +       * 
    + * + * repeated string invalid_ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The invalidAckIds to add. + * @return This builder for chaining. + */ + public Builder addInvalidAckIds(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureInvalidAckIdsIsMutable(); + invalidAckIds_.add(value); + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. List of acknowledgment IDs that were malformed or whose
    +       * acknowledgment deadline has expired.
    +       * 
    + * + * repeated string invalid_ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param values The invalidAckIds to add. + * @return This builder for chaining. + */ + public Builder addAllInvalidAckIds(java.lang.Iterable values) { + ensureInvalidAckIdsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, invalidAckIds_); + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. List of acknowledgment IDs that were malformed or whose
    +       * acknowledgment deadline has expired.
    +       * 
    + * + * repeated string invalid_ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearInvalidAckIds() { + invalidAckIds_ = com.google.protobuf.LazyStringArrayList.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + ; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. List of acknowledgment IDs that were malformed or whose
    +       * acknowledgment deadline has expired.
    +       * 
    + * + * repeated string invalid_ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes of the invalidAckIds to add. + * @return This builder for chaining. + */ + public Builder addInvalidAckIdsBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureInvalidAckIdsIsMutable(); + invalidAckIds_.add(value); + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringArrayList unorderedAckIds_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + + private void ensureUnorderedAckIdsIsMutable() { + if (!unorderedAckIds_.isModifiable()) { + unorderedAckIds_ = new com.google.protobuf.LazyStringArrayList(unorderedAckIds_); + } + bitField0_ |= 0x00000004; + } + + /** + * + * + *
    +       * Optional. List of acknowledgment IDs that were out of order.
    +       * 
    + * + * repeated string unordered_ack_ids = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return A list containing the unorderedAckIds. + */ + public com.google.protobuf.ProtocolStringList getUnorderedAckIdsList() { + unorderedAckIds_.makeImmutable(); + return unorderedAckIds_; + } + + /** + * + * + *
    +       * Optional. List of acknowledgment IDs that were out of order.
    +       * 
    + * + * repeated string unordered_ack_ids = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The count of unorderedAckIds. + */ + public int getUnorderedAckIdsCount() { + return unorderedAckIds_.size(); + } + + /** + * + * + *
    +       * Optional. List of acknowledgment IDs that were out of order.
    +       * 
    + * + * repeated string unordered_ack_ids = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param index The index of the element to return. + * @return The unorderedAckIds at the given index. + */ + public java.lang.String getUnorderedAckIds(int index) { + return unorderedAckIds_.get(index); + } + + /** + * + * + *
    +       * Optional. List of acknowledgment IDs that were out of order.
    +       * 
    + * + * repeated string unordered_ack_ids = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param index The index of the value to return. + * @return The bytes of the unorderedAckIds at the given index. + */ + public com.google.protobuf.ByteString getUnorderedAckIdsBytes(int index) { + return unorderedAckIds_.getByteString(index); + } + + /** + * + * + *
    +       * Optional. List of acknowledgment IDs that were out of order.
    +       * 
    + * + * repeated string unordered_ack_ids = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param index The index to set the value at. + * @param value The unorderedAckIds to set. + * @return This builder for chaining. + */ + public Builder setUnorderedAckIds(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureUnorderedAckIdsIsMutable(); + unorderedAckIds_.set(index, value); + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. List of acknowledgment IDs that were out of order.
    +       * 
    + * + * repeated string unordered_ack_ids = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param value The unorderedAckIds to add. + * @return This builder for chaining. + */ + public Builder addUnorderedAckIds(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureUnorderedAckIdsIsMutable(); + unorderedAckIds_.add(value); + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. List of acknowledgment IDs that were out of order.
    +       * 
    + * + * repeated string unordered_ack_ids = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param values The unorderedAckIds to add. + * @return This builder for chaining. + */ + public Builder addAllUnorderedAckIds(java.lang.Iterable values) { + ensureUnorderedAckIdsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, unorderedAckIds_); + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. List of acknowledgment IDs that were out of order.
    +       * 
    + * + * repeated string unordered_ack_ids = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return This builder for chaining. + */ + public Builder clearUnorderedAckIds() { + unorderedAckIds_ = com.google.protobuf.LazyStringArrayList.emptyList(); + bitField0_ = (bitField0_ & ~0x00000004); + ; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. List of acknowledgment IDs that were out of order.
    +       * 
    + * + * repeated string unordered_ack_ids = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param value The bytes of the unorderedAckIds to add. + * @return This builder for chaining. + */ + public Builder addUnorderedAckIdsBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureUnorderedAckIdsIsMutable(); + unorderedAckIds_.add(value); + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringArrayList temporaryFailedAckIds_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + + private void ensureTemporaryFailedAckIdsIsMutable() { + if (!temporaryFailedAckIds_.isModifiable()) { + temporaryFailedAckIds_ = + new com.google.protobuf.LazyStringArrayList(temporaryFailedAckIds_); + } + bitField0_ |= 0x00000008; + } + + /** + * + * + *
    +       * Optional. List of acknowledgment IDs that failed processing with
    +       * temporary issues.
    +       * 
    + * + * + * repeated string temporary_failed_ack_ids = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return A list containing the temporaryFailedAckIds. + */ + public com.google.protobuf.ProtocolStringList getTemporaryFailedAckIdsList() { + temporaryFailedAckIds_.makeImmutable(); + return temporaryFailedAckIds_; + } + + /** + * + * + *
    +       * Optional. List of acknowledgment IDs that failed processing with
    +       * temporary issues.
    +       * 
    + * + * + * repeated string temporary_failed_ack_ids = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The count of temporaryFailedAckIds. + */ + public int getTemporaryFailedAckIdsCount() { + return temporaryFailedAckIds_.size(); + } + + /** + * + * + *
    +       * Optional. List of acknowledgment IDs that failed processing with
    +       * temporary issues.
    +       * 
    + * + * + * repeated string temporary_failed_ack_ids = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param index The index of the element to return. + * @return The temporaryFailedAckIds at the given index. + */ + public java.lang.String getTemporaryFailedAckIds(int index) { + return temporaryFailedAckIds_.get(index); + } + + /** + * + * + *
    +       * Optional. List of acknowledgment IDs that failed processing with
    +       * temporary issues.
    +       * 
    + * + * + * repeated string temporary_failed_ack_ids = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param index The index of the value to return. + * @return The bytes of the temporaryFailedAckIds at the given index. + */ + public com.google.protobuf.ByteString getTemporaryFailedAckIdsBytes(int index) { + return temporaryFailedAckIds_.getByteString(index); + } + + /** + * + * + *
    +       * Optional. List of acknowledgment IDs that failed processing with
    +       * temporary issues.
    +       * 
    + * + * + * repeated string temporary_failed_ack_ids = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param index The index to set the value at. + * @param value The temporaryFailedAckIds to set. + * @return This builder for chaining. + */ + public Builder setTemporaryFailedAckIds(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureTemporaryFailedAckIdsIsMutable(); + temporaryFailedAckIds_.set(index, value); + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. List of acknowledgment IDs that failed processing with
    +       * temporary issues.
    +       * 
    + * + * + * repeated string temporary_failed_ack_ids = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param value The temporaryFailedAckIds to add. + * @return This builder for chaining. + */ + public Builder addTemporaryFailedAckIds(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureTemporaryFailedAckIdsIsMutable(); + temporaryFailedAckIds_.add(value); + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. List of acknowledgment IDs that failed processing with
    +       * temporary issues.
    +       * 
    + * + * + * repeated string temporary_failed_ack_ids = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param values The temporaryFailedAckIds to add. + * @return This builder for chaining. + */ + public Builder addAllTemporaryFailedAckIds(java.lang.Iterable values) { + ensureTemporaryFailedAckIdsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, temporaryFailedAckIds_); + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. List of acknowledgment IDs that failed processing with
    +       * temporary issues.
    +       * 
    + * + * + * repeated string temporary_failed_ack_ids = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return This builder for chaining. + */ + public Builder clearTemporaryFailedAckIds() { + temporaryFailedAckIds_ = com.google.protobuf.LazyStringArrayList.emptyList(); + bitField0_ = (bitField0_ & ~0x00000008); + ; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. List of acknowledgment IDs that failed processing with
    +       * temporary issues.
    +       * 
    + * + * + * repeated string temporary_failed_ack_ids = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param value The bytes of the temporaryFailedAckIds to add. + * @return This builder for chaining. + */ + public Builder addTemporaryFailedAckIdsBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureTemporaryFailedAckIdsIsMutable(); + temporaryFailedAckIds_.add(value); + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation) + } + + // @@protoc_insertion_point(class_scope:google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation) + private static final com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation(); + } + + public static com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AcknowledgeConfirmation parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException() + .setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public interface ModifyAckDeadlineConfirmationOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
    +     * Optional. Successfully processed acknowledgment IDs.
    +     * 
    + * + * repeated string ack_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return A list containing the ackIds. + */ + java.util.List getAckIdsList(); + + /** + * + * + *
    +     * Optional. Successfully processed acknowledgment IDs.
    +     * 
    + * + * repeated string ack_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The count of ackIds. + */ + int getAckIdsCount(); + + /** + * + * + *
    +     * Optional. Successfully processed acknowledgment IDs.
    +     * 
    + * + * repeated string ack_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the element to return. + * @return The ackIds at the given index. + */ + java.lang.String getAckIds(int index); + + /** + * + * + *
    +     * Optional. Successfully processed acknowledgment IDs.
    +     * 
    + * + * repeated string ack_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the value to return. + * @return The bytes of the ackIds at the given index. + */ + com.google.protobuf.ByteString getAckIdsBytes(int index); + + /** + * + * + *
    +     * Optional. List of acknowledgment IDs that were malformed or whose
    +     * acknowledgment deadline has expired.
    +     * 
    + * + * repeated string invalid_ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return A list containing the invalidAckIds. + */ + java.util.List getInvalidAckIdsList(); + + /** + * + * + *
    +     * Optional. List of acknowledgment IDs that were malformed or whose
    +     * acknowledgment deadline has expired.
    +     * 
    + * + * repeated string invalid_ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The count of invalidAckIds. + */ + int getInvalidAckIdsCount(); + + /** + * + * + *
    +     * Optional. List of acknowledgment IDs that were malformed or whose
    +     * acknowledgment deadline has expired.
    +     * 
    + * + * repeated string invalid_ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the element to return. + * @return The invalidAckIds at the given index. + */ + java.lang.String getInvalidAckIds(int index); + + /** + * + * + *
    +     * Optional. List of acknowledgment IDs that were malformed or whose
    +     * acknowledgment deadline has expired.
    +     * 
    + * + * repeated string invalid_ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the value to return. + * @return The bytes of the invalidAckIds at the given index. + */ + com.google.protobuf.ByteString getInvalidAckIdsBytes(int index); + + /** + * + * + *
    +     * Optional. List of acknowledgment IDs that failed processing with
    +     * temporary issues.
    +     * 
    + * + * repeated string temporary_failed_ack_ids = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return A list containing the temporaryFailedAckIds. + */ + java.util.List getTemporaryFailedAckIdsList(); + + /** + * + * + *
    +     * Optional. List of acknowledgment IDs that failed processing with
    +     * temporary issues.
    +     * 
    + * + * repeated string temporary_failed_ack_ids = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The count of temporaryFailedAckIds. + */ + int getTemporaryFailedAckIdsCount(); + + /** + * + * + *
    +     * Optional. List of acknowledgment IDs that failed processing with
    +     * temporary issues.
    +     * 
    + * + * repeated string temporary_failed_ack_ids = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param index The index of the element to return. + * @return The temporaryFailedAckIds at the given index. + */ + java.lang.String getTemporaryFailedAckIds(int index); + + /** + * + * + *
    +     * Optional. List of acknowledgment IDs that failed processing with
    +     * temporary issues.
    +     * 
    + * + * repeated string temporary_failed_ack_ids = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param index The index of the value to return. + * @return The bytes of the temporaryFailedAckIds at the given index. + */ + com.google.protobuf.ByteString getTemporaryFailedAckIdsBytes(int index); + } + + /** + * + * + *
    +   * Acknowledgment IDs sent in one or more previous requests to modify the
    +   * deadline for a specific message.
    +   * 
    + * + * Protobuf type {@code google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation} + */ + public static final class ModifyAckDeadlineConfirmation + extends com.google.protobuf.GeneratedMessage + implements + // @@protoc_insertion_point(message_implements:google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation) + ModifyAckDeadlineConfirmationOrBuilder { + private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "ModifyAckDeadlineConfirmation"); + } + + // Use ModifyAckDeadlineConfirmation.newBuilder() to construct. + private ModifyAckDeadlineConfirmation(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + + private ModifyAckDeadlineConfirmation() { + ackIds_ = com.google.protobuf.LazyStringArrayList.emptyList(); + invalidAckIds_ = com.google.protobuf.LazyStringArrayList.emptyList(); + temporaryFailedAckIds_ = com.google.protobuf.LazyStringArrayList.emptyList(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_StreamingPullResponse_ModifyAckDeadlineConfirmation_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_StreamingPullResponse_ModifyAckDeadlineConfirmation_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation.class, + com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation.Builder + .class); + } + + public static final int ACK_IDS_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private com.google.protobuf.LazyStringArrayList ackIds_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + + /** + * + * + *
    +     * Optional. Successfully processed acknowledgment IDs.
    +     * 
    + * + * repeated string ack_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return A list containing the ackIds. + */ + public com.google.protobuf.ProtocolStringList getAckIdsList() { + return ackIds_; + } + + /** + * + * + *
    +     * Optional. Successfully processed acknowledgment IDs.
    +     * 
    + * + * repeated string ack_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The count of ackIds. + */ + public int getAckIdsCount() { + return ackIds_.size(); + } + + /** + * + * + *
    +     * Optional. Successfully processed acknowledgment IDs.
    +     * 
    + * + * repeated string ack_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the element to return. + * @return The ackIds at the given index. + */ + public java.lang.String getAckIds(int index) { + return ackIds_.get(index); + } + + /** + * + * + *
    +     * Optional. Successfully processed acknowledgment IDs.
    +     * 
    + * + * repeated string ack_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the value to return. + * @return The bytes of the ackIds at the given index. + */ + public com.google.protobuf.ByteString getAckIdsBytes(int index) { + return ackIds_.getByteString(index); + } + + public static final int INVALID_ACK_IDS_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private com.google.protobuf.LazyStringArrayList invalidAckIds_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + + /** + * + * + *
    +     * Optional. List of acknowledgment IDs that were malformed or whose
    +     * acknowledgment deadline has expired.
    +     * 
    + * + * repeated string invalid_ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return A list containing the invalidAckIds. + */ + public com.google.protobuf.ProtocolStringList getInvalidAckIdsList() { + return invalidAckIds_; + } + + /** + * + * + *
    +     * Optional. List of acknowledgment IDs that were malformed or whose
    +     * acknowledgment deadline has expired.
    +     * 
    + * + * repeated string invalid_ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The count of invalidAckIds. + */ + public int getInvalidAckIdsCount() { + return invalidAckIds_.size(); + } + + /** + * + * + *
    +     * Optional. List of acknowledgment IDs that were malformed or whose
    +     * acknowledgment deadline has expired.
    +     * 
    + * + * repeated string invalid_ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the element to return. + * @return The invalidAckIds at the given index. + */ + public java.lang.String getInvalidAckIds(int index) { + return invalidAckIds_.get(index); + } + + /** + * + * + *
    +     * Optional. List of acknowledgment IDs that were malformed or whose
    +     * acknowledgment deadline has expired.
    +     * 
    + * + * repeated string invalid_ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the value to return. + * @return The bytes of the invalidAckIds at the given index. + */ + public com.google.protobuf.ByteString getInvalidAckIdsBytes(int index) { + return invalidAckIds_.getByteString(index); + } + + public static final int TEMPORARY_FAILED_ACK_IDS_FIELD_NUMBER = 3; + + @SuppressWarnings("serial") + private com.google.protobuf.LazyStringArrayList temporaryFailedAckIds_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + + /** + * + * + *
    +     * Optional. List of acknowledgment IDs that failed processing with
    +     * temporary issues.
    +     * 
    + * + * repeated string temporary_failed_ack_ids = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return A list containing the temporaryFailedAckIds. + */ + public com.google.protobuf.ProtocolStringList getTemporaryFailedAckIdsList() { + return temporaryFailedAckIds_; + } + + /** + * + * + *
    +     * Optional. List of acknowledgment IDs that failed processing with
    +     * temporary issues.
    +     * 
    + * + * repeated string temporary_failed_ack_ids = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The count of temporaryFailedAckIds. + */ + public int getTemporaryFailedAckIdsCount() { + return temporaryFailedAckIds_.size(); + } + + /** + * + * + *
    +     * Optional. List of acknowledgment IDs that failed processing with
    +     * temporary issues.
    +     * 
    + * + * repeated string temporary_failed_ack_ids = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param index The index of the element to return. + * @return The temporaryFailedAckIds at the given index. + */ + public java.lang.String getTemporaryFailedAckIds(int index) { + return temporaryFailedAckIds_.get(index); + } + + /** + * + * + *
    +     * Optional. List of acknowledgment IDs that failed processing with
    +     * temporary issues.
    +     * 
    + * + * repeated string temporary_failed_ack_ids = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param index The index of the value to return. + * @return The bytes of the temporaryFailedAckIds at the given index. + */ + public com.google.protobuf.ByteString getTemporaryFailedAckIdsBytes(int index) { + return temporaryFailedAckIds_.getByteString(index); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < ackIds_.size(); i++) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, ackIds_.getRaw(i)); + } + for (int i = 0; i < invalidAckIds_.size(); i++) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, invalidAckIds_.getRaw(i)); + } + for (int i = 0; i < temporaryFailedAckIds_.size(); i++) { + com.google.protobuf.GeneratedMessage.writeString( + output, 3, temporaryFailedAckIds_.getRaw(i)); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + { + int dataSize = 0; + for (int i = 0; i < ackIds_.size(); i++) { + dataSize += computeStringSizeNoTag(ackIds_.getRaw(i)); + } + size += dataSize; + size += 1 * getAckIdsList().size(); + } + { + int dataSize = 0; + for (int i = 0; i < invalidAckIds_.size(); i++) { + dataSize += computeStringSizeNoTag(invalidAckIds_.getRaw(i)); + } + size += dataSize; + size += 1 * getInvalidAckIdsList().size(); + } + { + int dataSize = 0; + for (int i = 0; i < temporaryFailedAckIds_.size(); i++) { + dataSize += computeStringSizeNoTag(temporaryFailedAckIds_.getRaw(i)); + } + size += dataSize; + size += 1 * getTemporaryFailedAckIdsList().size(); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj + instanceof com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation)) { + return super.equals(obj); + } + com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation other = + (com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation) obj; + + if (!getAckIdsList().equals(other.getAckIdsList())) return false; + if (!getInvalidAckIdsList().equals(other.getInvalidAckIdsList())) return false; + if (!getTemporaryFailedAckIdsList().equals(other.getTemporaryFailedAckIdsList())) + return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getAckIdsCount() > 0) { + hash = (37 * hash) + ACK_IDS_FIELD_NUMBER; + hash = (53 * hash) + getAckIdsList().hashCode(); + } + if (getInvalidAckIdsCount() > 0) { + hash = (37 * hash) + INVALID_ACK_IDS_FIELD_NUMBER; + hash = (53 * hash) + getInvalidAckIdsList().hashCode(); + } + if (getTemporaryFailedAckIdsCount() > 0) { + hash = (37 * hash) + TEMPORARY_FAILED_ACK_IDS_FIELD_NUMBER; + hash = (53 * hash) + getTemporaryFailedAckIdsList().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation + parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation + parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation + parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation + parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation + parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation + parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation + parseFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation + parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation + parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation + parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation + parseFrom(com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation + parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + + /** + * + * + *
    +     * Acknowledgment IDs sent in one or more previous requests to modify the
    +     * deadline for a specific message.
    +     * 
    + * + * Protobuf type {@code google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder + implements + // @@protoc_insertion_point(builder_implements:google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation) + com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmationOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_StreamingPullResponse_ModifyAckDeadlineConfirmation_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_StreamingPullResponse_ModifyAckDeadlineConfirmation_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation.class, + com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation.Builder + .class); + } + + // Construct using + // com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + ackIds_ = com.google.protobuf.LazyStringArrayList.emptyList(); + invalidAckIds_ = com.google.protobuf.LazyStringArrayList.emptyList(); + temporaryFailedAckIds_ = com.google.protobuf.LazyStringArrayList.emptyList(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_StreamingPullResponse_ModifyAckDeadlineConfirmation_descriptor; + } + + @java.lang.Override + public com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation + getDefaultInstanceForType() { + return com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation + .getDefaultInstance(); + } + + @java.lang.Override + public com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation build() { + com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation result = + buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation + buildPartial() { + com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation result = + new com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0( + com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + ackIds_.makeImmutable(); + result.ackIds_ = ackIds_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + invalidAckIds_.makeImmutable(); + result.invalidAckIds_ = invalidAckIds_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + temporaryFailedAckIds_.makeImmutable(); + result.temporaryFailedAckIds_ = temporaryFailedAckIds_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other + instanceof com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation) { + return mergeFrom( + (com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation other) { + if (other + == com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation + .getDefaultInstance()) return this; + if (!other.ackIds_.isEmpty()) { + if (ackIds_.isEmpty()) { + ackIds_ = other.ackIds_; + bitField0_ |= 0x00000001; + } else { + ensureAckIdsIsMutable(); + ackIds_.addAll(other.ackIds_); + } + onChanged(); + } + if (!other.invalidAckIds_.isEmpty()) { + if (invalidAckIds_.isEmpty()) { + invalidAckIds_ = other.invalidAckIds_; + bitField0_ |= 0x00000002; + } else { + ensureInvalidAckIdsIsMutable(); + invalidAckIds_.addAll(other.invalidAckIds_); + } + onChanged(); + } + if (!other.temporaryFailedAckIds_.isEmpty()) { + if (temporaryFailedAckIds_.isEmpty()) { + temporaryFailedAckIds_ = other.temporaryFailedAckIds_; + bitField0_ |= 0x00000004; + } else { + ensureTemporaryFailedAckIdsIsMutable(); + temporaryFailedAckIds_.addAll(other.temporaryFailedAckIds_); + } + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + ensureAckIdsIsMutable(); + ackIds_.add(s); + break; + } // case 10 + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + ensureInvalidAckIdsIsMutable(); + invalidAckIds_.add(s); + break; + } // case 18 + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + ensureTemporaryFailedAckIdsIsMutable(); + temporaryFailedAckIds_.add(s); + break; + } // case 26 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private com.google.protobuf.LazyStringArrayList ackIds_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + + private void ensureAckIdsIsMutable() { + if (!ackIds_.isModifiable()) { + ackIds_ = new com.google.protobuf.LazyStringArrayList(ackIds_); + } + bitField0_ |= 0x00000001; + } + + /** + * + * + *
    +       * Optional. Successfully processed acknowledgment IDs.
    +       * 
    + * + * repeated string ack_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return A list containing the ackIds. + */ + public com.google.protobuf.ProtocolStringList getAckIdsList() { + ackIds_.makeImmutable(); + return ackIds_; + } + + /** + * + * + *
    +       * Optional. Successfully processed acknowledgment IDs.
    +       * 
    + * + * repeated string ack_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The count of ackIds. + */ + public int getAckIdsCount() { + return ackIds_.size(); + } + + /** + * + * + *
    +       * Optional. Successfully processed acknowledgment IDs.
    +       * 
    + * + * repeated string ack_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the element to return. + * @return The ackIds at the given index. + */ + public java.lang.String getAckIds(int index) { + return ackIds_.get(index); + } + + /** + * + * + *
    +       * Optional. Successfully processed acknowledgment IDs.
    +       * 
    + * + * repeated string ack_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the value to return. + * @return The bytes of the ackIds at the given index. + */ + public com.google.protobuf.ByteString getAckIdsBytes(int index) { + return ackIds_.getByteString(index); + } + + /** + * + * + *
    +       * Optional. Successfully processed acknowledgment IDs.
    +       * 
    + * + * repeated string ack_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index to set the value at. + * @param value The ackIds to set. + * @return This builder for chaining. + */ + public Builder setAckIds(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureAckIdsIsMutable(); + ackIds_.set(index, value); + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. Successfully processed acknowledgment IDs.
    +       * 
    + * + * repeated string ack_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The ackIds to add. + * @return This builder for chaining. + */ + public Builder addAckIds(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureAckIdsIsMutable(); + ackIds_.add(value); + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. Successfully processed acknowledgment IDs.
    +       * 
    + * + * repeated string ack_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param values The ackIds to add. + * @return This builder for chaining. + */ + public Builder addAllAckIds(java.lang.Iterable values) { + ensureAckIdsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, ackIds_); + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. Successfully processed acknowledgment IDs.
    +       * 
    + * + * repeated string ack_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearAckIds() { + ackIds_ = com.google.protobuf.LazyStringArrayList.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + ; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. Successfully processed acknowledgment IDs.
    +       * 
    + * + * repeated string ack_ids = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes of the ackIds to add. + * @return This builder for chaining. + */ + public Builder addAckIdsBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureAckIdsIsMutable(); + ackIds_.add(value); + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringArrayList invalidAckIds_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + + private void ensureInvalidAckIdsIsMutable() { + if (!invalidAckIds_.isModifiable()) { + invalidAckIds_ = new com.google.protobuf.LazyStringArrayList(invalidAckIds_); + } + bitField0_ |= 0x00000002; + } + + /** + * + * + *
    +       * Optional. List of acknowledgment IDs that were malformed or whose
    +       * acknowledgment deadline has expired.
    +       * 
    + * + * repeated string invalid_ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return A list containing the invalidAckIds. + */ + public com.google.protobuf.ProtocolStringList getInvalidAckIdsList() { + invalidAckIds_.makeImmutable(); + return invalidAckIds_; + } + + /** + * + * + *
    +       * Optional. List of acknowledgment IDs that were malformed or whose
    +       * acknowledgment deadline has expired.
    +       * 
    + * + * repeated string invalid_ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The count of invalidAckIds. + */ + public int getInvalidAckIdsCount() { + return invalidAckIds_.size(); + } + + /** + * + * + *
    +       * Optional. List of acknowledgment IDs that were malformed or whose
    +       * acknowledgment deadline has expired.
    +       * 
    + * + * repeated string invalid_ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the element to return. + * @return The invalidAckIds at the given index. + */ + public java.lang.String getInvalidAckIds(int index) { + return invalidAckIds_.get(index); + } + + /** + * + * + *
    +       * Optional. List of acknowledgment IDs that were malformed or whose
    +       * acknowledgment deadline has expired.
    +       * 
    + * + * repeated string invalid_ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the value to return. + * @return The bytes of the invalidAckIds at the given index. + */ + public com.google.protobuf.ByteString getInvalidAckIdsBytes(int index) { + return invalidAckIds_.getByteString(index); + } + + /** + * + * + *
    +       * Optional. List of acknowledgment IDs that were malformed or whose
    +       * acknowledgment deadline has expired.
    +       * 
    + * + * repeated string invalid_ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index to set the value at. + * @param value The invalidAckIds to set. + * @return This builder for chaining. + */ + public Builder setInvalidAckIds(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureInvalidAckIdsIsMutable(); + invalidAckIds_.set(index, value); + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. List of acknowledgment IDs that were malformed or whose
    +       * acknowledgment deadline has expired.
    +       * 
    + * + * repeated string invalid_ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The invalidAckIds to add. + * @return This builder for chaining. + */ + public Builder addInvalidAckIds(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureInvalidAckIdsIsMutable(); + invalidAckIds_.add(value); + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. List of acknowledgment IDs that were malformed or whose
    +       * acknowledgment deadline has expired.
    +       * 
    + * + * repeated string invalid_ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param values The invalidAckIds to add. + * @return This builder for chaining. + */ + public Builder addAllInvalidAckIds(java.lang.Iterable values) { + ensureInvalidAckIdsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, invalidAckIds_); + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. List of acknowledgment IDs that were malformed or whose
    +       * acknowledgment deadline has expired.
    +       * 
    + * + * repeated string invalid_ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearInvalidAckIds() { + invalidAckIds_ = com.google.protobuf.LazyStringArrayList.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + ; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. List of acknowledgment IDs that were malformed or whose
    +       * acknowledgment deadline has expired.
    +       * 
    + * + * repeated string invalid_ack_ids = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes of the invalidAckIds to add. + * @return This builder for chaining. + */ + public Builder addInvalidAckIdsBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureInvalidAckIdsIsMutable(); + invalidAckIds_.add(value); + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringArrayList temporaryFailedAckIds_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + + private void ensureTemporaryFailedAckIdsIsMutable() { + if (!temporaryFailedAckIds_.isModifiable()) { + temporaryFailedAckIds_ = + new com.google.protobuf.LazyStringArrayList(temporaryFailedAckIds_); + } + bitField0_ |= 0x00000004; + } + + /** + * + * + *
    +       * Optional. List of acknowledgment IDs that failed processing with
    +       * temporary issues.
    +       * 
    + * + * + * repeated string temporary_failed_ack_ids = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return A list containing the temporaryFailedAckIds. + */ + public com.google.protobuf.ProtocolStringList getTemporaryFailedAckIdsList() { + temporaryFailedAckIds_.makeImmutable(); + return temporaryFailedAckIds_; + } + + /** + * + * + *
    +       * Optional. List of acknowledgment IDs that failed processing with
    +       * temporary issues.
    +       * 
    + * + * + * repeated string temporary_failed_ack_ids = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The count of temporaryFailedAckIds. + */ + public int getTemporaryFailedAckIdsCount() { + return temporaryFailedAckIds_.size(); + } + + /** + * + * + *
    +       * Optional. List of acknowledgment IDs that failed processing with
    +       * temporary issues.
    +       * 
    + * + * + * repeated string temporary_failed_ack_ids = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param index The index of the element to return. + * @return The temporaryFailedAckIds at the given index. + */ + public java.lang.String getTemporaryFailedAckIds(int index) { + return temporaryFailedAckIds_.get(index); + } + + /** + * + * + *
    +       * Optional. List of acknowledgment IDs that failed processing with
    +       * temporary issues.
    +       * 
    + * + * + * repeated string temporary_failed_ack_ids = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param index The index of the value to return. + * @return The bytes of the temporaryFailedAckIds at the given index. + */ + public com.google.protobuf.ByteString getTemporaryFailedAckIdsBytes(int index) { + return temporaryFailedAckIds_.getByteString(index); + } + + /** + * + * + *
    +       * Optional. List of acknowledgment IDs that failed processing with
    +       * temporary issues.
    +       * 
    + * + * + * repeated string temporary_failed_ack_ids = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param index The index to set the value at. + * @param value The temporaryFailedAckIds to set. + * @return This builder for chaining. + */ + public Builder setTemporaryFailedAckIds(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureTemporaryFailedAckIdsIsMutable(); + temporaryFailedAckIds_.set(index, value); + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. List of acknowledgment IDs that failed processing with
    +       * temporary issues.
    +       * 
    + * + * + * repeated string temporary_failed_ack_ids = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param value The temporaryFailedAckIds to add. + * @return This builder for chaining. + */ + public Builder addTemporaryFailedAckIds(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureTemporaryFailedAckIdsIsMutable(); + temporaryFailedAckIds_.add(value); + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. List of acknowledgment IDs that failed processing with
    +       * temporary issues.
    +       * 
    + * + * + * repeated string temporary_failed_ack_ids = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param values The temporaryFailedAckIds to add. + * @return This builder for chaining. + */ + public Builder addAllTemporaryFailedAckIds(java.lang.Iterable values) { + ensureTemporaryFailedAckIdsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, temporaryFailedAckIds_); + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. List of acknowledgment IDs that failed processing with
    +       * temporary issues.
    +       * 
    + * + * + * repeated string temporary_failed_ack_ids = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return This builder for chaining. + */ + public Builder clearTemporaryFailedAckIds() { + temporaryFailedAckIds_ = com.google.protobuf.LazyStringArrayList.emptyList(); + bitField0_ = (bitField0_ & ~0x00000004); + ; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. List of acknowledgment IDs that failed processing with
    +       * temporary issues.
    +       * 
    + * + * + * repeated string temporary_failed_ack_ids = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param value The bytes of the temporaryFailedAckIds to add. + * @return This builder for chaining. + */ + public Builder addTemporaryFailedAckIdsBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureTemporaryFailedAckIdsIsMutable(); + temporaryFailedAckIds_.add(value); + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation) + } + + // @@protoc_insertion_point(class_scope:google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation) + private static final com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = + new com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation(); + } + + public static com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ModifyAckDeadlineConfirmation parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException() + .setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public interface SubscriptionPropertiesOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.pubsub.v1.StreamingPullResponse.SubscriptionProperties) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
    +     * Optional. True iff exactly once delivery is enabled for this
    +     * subscription.
    +     * 
    + * + * bool exactly_once_delivery_enabled = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The exactlyOnceDeliveryEnabled. + */ + boolean getExactlyOnceDeliveryEnabled(); + + /** + * + * + *
    +     * Optional. True iff message ordering is enabled for this subscription.
    +     * 
    + * + * bool message_ordering_enabled = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The messageOrderingEnabled. + */ + boolean getMessageOrderingEnabled(); + } + + /** + * + * + *
    +   * Subscription properties sent as part of the response.
    +   * 
    + * + * Protobuf type {@code google.pubsub.v1.StreamingPullResponse.SubscriptionProperties} + */ + public static final class SubscriptionProperties extends com.google.protobuf.GeneratedMessage + implements + // @@protoc_insertion_point(message_implements:google.pubsub.v1.StreamingPullResponse.SubscriptionProperties) + SubscriptionPropertiesOrBuilder { + private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "SubscriptionProperties"); + } + + // Use SubscriptionProperties.newBuilder() to construct. + private SubscriptionProperties(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + + private SubscriptionProperties() {} + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_StreamingPullResponse_SubscriptionProperties_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_StreamingPullResponse_SubscriptionProperties_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties.class, + com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties.Builder.class); + } + + public static final int EXACTLY_ONCE_DELIVERY_ENABLED_FIELD_NUMBER = 1; + private boolean exactlyOnceDeliveryEnabled_ = false; + + /** + * + * + *
    +     * Optional. True iff exactly once delivery is enabled for this
    +     * subscription.
    +     * 
    + * + * bool exactly_once_delivery_enabled = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The exactlyOnceDeliveryEnabled. + */ + @java.lang.Override + public boolean getExactlyOnceDeliveryEnabled() { + return exactlyOnceDeliveryEnabled_; + } + + public static final int MESSAGE_ORDERING_ENABLED_FIELD_NUMBER = 2; + private boolean messageOrderingEnabled_ = false; + + /** + * + * + *
    +     * Optional. True iff message ordering is enabled for this subscription.
    +     * 
    + * + * bool message_ordering_enabled = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The messageOrderingEnabled. + */ + @java.lang.Override + public boolean getMessageOrderingEnabled() { + return messageOrderingEnabled_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (exactlyOnceDeliveryEnabled_ != false) { + output.writeBool(1, exactlyOnceDeliveryEnabled_); + } + if (messageOrderingEnabled_ != false) { + output.writeBool(2, messageOrderingEnabled_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (exactlyOnceDeliveryEnabled_ != false) { + size += + com.google.protobuf.CodedOutputStream.computeBoolSize(1, exactlyOnceDeliveryEnabled_); + } + if (messageOrderingEnabled_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(2, messageOrderingEnabled_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties)) { + return super.equals(obj); + } + com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties other = + (com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties) obj; + + if (getExactlyOnceDeliveryEnabled() != other.getExactlyOnceDeliveryEnabled()) return false; + if (getMessageOrderingEnabled() != other.getMessageOrderingEnabled()) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + EXACTLY_ONCE_DELIVERY_ENABLED_FIELD_NUMBER; + hash = + (53 * hash) + com.google.protobuf.Internal.hashBoolean(getExactlyOnceDeliveryEnabled()); + hash = (37 * hash) + MESSAGE_ORDERING_ENABLED_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getMessageOrderingEnabled()); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties parseFrom( + byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties + parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties + parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + + /** + * + * + *
    +     * Subscription properties sent as part of the response.
    +     * 
    + * + * Protobuf type {@code google.pubsub.v1.StreamingPullResponse.SubscriptionProperties} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder + implements + // @@protoc_insertion_point(builder_implements:google.pubsub.v1.StreamingPullResponse.SubscriptionProperties) + com.google.pubsub.v1.StreamingPullResponse.SubscriptionPropertiesOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_StreamingPullResponse_SubscriptionProperties_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_StreamingPullResponse_SubscriptionProperties_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties.class, + com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties.Builder.class); + } + + // Construct using + // com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + exactlyOnceDeliveryEnabled_ = false; + messageOrderingEnabled_ = false; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_StreamingPullResponse_SubscriptionProperties_descriptor; + } + + @java.lang.Override + public com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties + getDefaultInstanceForType() { + return com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties + .getDefaultInstance(); + } + + @java.lang.Override + public com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties build() { + com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties buildPartial() { + com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties result = + new com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0( + com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.exactlyOnceDeliveryEnabled_ = exactlyOnceDeliveryEnabled_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.messageOrderingEnabled_ = messageOrderingEnabled_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties) { + return mergeFrom( + (com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties other) { + if (other + == com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties + .getDefaultInstance()) return this; + if (other.getExactlyOnceDeliveryEnabled() != false) { + setExactlyOnceDeliveryEnabled(other.getExactlyOnceDeliveryEnabled()); + } + if (other.getMessageOrderingEnabled() != false) { + setMessageOrderingEnabled(other.getMessageOrderingEnabled()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: + { + exactlyOnceDeliveryEnabled_ = input.readBool(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 16: + { + messageOrderingEnabled_ = input.readBool(); + bitField0_ |= 0x00000002; + break; + } // case 16 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private boolean exactlyOnceDeliveryEnabled_; + + /** + * + * + *
    +       * Optional. True iff exactly once delivery is enabled for this
    +       * subscription.
    +       * 
    + * + * bool exactly_once_delivery_enabled = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The exactlyOnceDeliveryEnabled. + */ + @java.lang.Override + public boolean getExactlyOnceDeliveryEnabled() { + return exactlyOnceDeliveryEnabled_; + } + + /** + * + * + *
    +       * Optional. True iff exactly once delivery is enabled for this
    +       * subscription.
    +       * 
    + * + * bool exactly_once_delivery_enabled = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param value The exactlyOnceDeliveryEnabled to set. + * @return This builder for chaining. + */ + public Builder setExactlyOnceDeliveryEnabled(boolean value) { + + exactlyOnceDeliveryEnabled_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. True iff exactly once delivery is enabled for this
    +       * subscription.
    +       * 
    + * + * bool exactly_once_delivery_enabled = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return This builder for chaining. + */ + public Builder clearExactlyOnceDeliveryEnabled() { + bitField0_ = (bitField0_ & ~0x00000001); + exactlyOnceDeliveryEnabled_ = false; + onChanged(); + return this; + } + + private boolean messageOrderingEnabled_; + + /** + * + * + *
    +       * Optional. True iff message ordering is enabled for this subscription.
    +       * 
    + * + * bool message_ordering_enabled = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The messageOrderingEnabled. + */ + @java.lang.Override + public boolean getMessageOrderingEnabled() { + return messageOrderingEnabled_; + } + + /** + * + * + *
    +       * Optional. True iff message ordering is enabled for this subscription.
    +       * 
    + * + * bool message_ordering_enabled = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The messageOrderingEnabled to set. + * @return This builder for chaining. + */ + public Builder setMessageOrderingEnabled(boolean value) { + + messageOrderingEnabled_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. True iff message ordering is enabled for this subscription.
    +       * 
    + * + * bool message_ordering_enabled = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearMessageOrderingEnabled() { + bitField0_ = (bitField0_ & ~0x00000002); + messageOrderingEnabled_ = false; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:google.pubsub.v1.StreamingPullResponse.SubscriptionProperties) + } + + // @@protoc_insertion_point(class_scope:google.pubsub.v1.StreamingPullResponse.SubscriptionProperties) + private static final com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties(); + } + + public static com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public SubscriptionProperties parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException() + .setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + private int bitField0_; + public static final int RECEIVED_MESSAGES_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private java.util.List receivedMessages_; + + /** + * + * + *
    +   * Optional. Received Pub/Sub messages.
    +   * 
    + * + * + * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public java.util.List getReceivedMessagesList() { + return receivedMessages_; + } + + /** + * + * + *
    +   * Optional. Received Pub/Sub messages.
    +   * 
    + * + * + * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public java.util.List + getReceivedMessagesOrBuilderList() { + return receivedMessages_; + } + + /** + * + * + *
    +   * Optional. Received Pub/Sub messages.
    +   * 
    + * + * + * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public int getReceivedMessagesCount() { + return receivedMessages_.size(); + } + + /** + * + * + *
    +   * Optional. Received Pub/Sub messages.
    +   * 
    + * + * + * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.ReceivedMessage getReceivedMessages(int index) { + return receivedMessages_.get(index); + } + + /** + * + * + *
    +   * Optional. Received Pub/Sub messages.
    +   * 
    + * + * + * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.ReceivedMessageOrBuilder getReceivedMessagesOrBuilder(int index) { + return receivedMessages_.get(index); + } + + public static final int ACKNOWLEDGE_CONFIRMATION_FIELD_NUMBER = 5; + private com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation + acknowledgeConfirmation_; + + /** + * + * + *
    +   * Optional. This field will only be set if `enable_exactly_once_delivery` is
    +   * set to `true` and is not guaranteed to be populated.
    +   * 
    + * + * + * .google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation acknowledge_confirmation = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the acknowledgeConfirmation field is set. + */ + @java.lang.Override + public boolean hasAcknowledgeConfirmation() { + return ((bitField0_ & 0x00000001) != 0); + } + + /** + * + * + *
    +   * Optional. This field will only be set if `enable_exactly_once_delivery` is
    +   * set to `true` and is not guaranteed to be populated.
    +   * 
    + * + * + * .google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation acknowledge_confirmation = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The acknowledgeConfirmation. + */ + @java.lang.Override + public com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation + getAcknowledgeConfirmation() { + return acknowledgeConfirmation_ == null + ? com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation.getDefaultInstance() + : acknowledgeConfirmation_; + } + + /** + * + * + *
    +   * Optional. This field will only be set if `enable_exactly_once_delivery` is
    +   * set to `true` and is not guaranteed to be populated.
    +   * 
    + * + * + * .google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation acknowledge_confirmation = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmationOrBuilder + getAcknowledgeConfirmationOrBuilder() { + return acknowledgeConfirmation_ == null + ? com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation.getDefaultInstance() + : acknowledgeConfirmation_; + } + + public static final int MODIFY_ACK_DEADLINE_CONFIRMATION_FIELD_NUMBER = 3; + private com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation + modifyAckDeadlineConfirmation_; + + /** + * + * + *
    +   * Optional. This field will only be set if `enable_exactly_once_delivery` is
    +   * set to `true` and is not guaranteed to be populated.
    +   * 
    + * + * + * .google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation modify_ack_deadline_confirmation = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the modifyAckDeadlineConfirmation field is set. + */ + @java.lang.Override + public boolean hasModifyAckDeadlineConfirmation() { + return ((bitField0_ & 0x00000002) != 0); + } + + /** + * + * + *
    +   * Optional. This field will only be set if `enable_exactly_once_delivery` is
    +   * set to `true` and is not guaranteed to be populated.
    +   * 
    + * + * + * .google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation modify_ack_deadline_confirmation = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The modifyAckDeadlineConfirmation. + */ + @java.lang.Override + public com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation + getModifyAckDeadlineConfirmation() { + return modifyAckDeadlineConfirmation_ == null + ? com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation + .getDefaultInstance() + : modifyAckDeadlineConfirmation_; + } + + /** + * + * + *
    +   * Optional. This field will only be set if `enable_exactly_once_delivery` is
    +   * set to `true` and is not guaranteed to be populated.
    +   * 
    + * + * + * .google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation modify_ack_deadline_confirmation = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmationOrBuilder + getModifyAckDeadlineConfirmationOrBuilder() { + return modifyAckDeadlineConfirmation_ == null + ? com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation + .getDefaultInstance() + : modifyAckDeadlineConfirmation_; + } + + public static final int SUBSCRIPTION_PROPERTIES_FIELD_NUMBER = 4; + private com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties subscriptionProperties_; + + /** + * + * + *
    +   * Optional. Properties associated with this subscription.
    +   * 
    + * + * + * .google.pubsub.v1.StreamingPullResponse.SubscriptionProperties subscription_properties = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the subscriptionProperties field is set. + */ + @java.lang.Override + public boolean hasSubscriptionProperties() { + return ((bitField0_ & 0x00000004) != 0); + } + + /** + * + * + *
    +   * Optional. Properties associated with this subscription.
    +   * 
    + * + * + * .google.pubsub.v1.StreamingPullResponse.SubscriptionProperties subscription_properties = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The subscriptionProperties. + */ + @java.lang.Override + public com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties + getSubscriptionProperties() { + return subscriptionProperties_ == null + ? com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties.getDefaultInstance() + : subscriptionProperties_; + } + + /** + * + * + *
    +   * Optional. Properties associated with this subscription.
    +   * 
    + * + * + * .google.pubsub.v1.StreamingPullResponse.SubscriptionProperties subscription_properties = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.StreamingPullResponse.SubscriptionPropertiesOrBuilder + getSubscriptionPropertiesOrBuilder() { + return subscriptionProperties_ == null + ? com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties.getDefaultInstance() + : subscriptionProperties_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < receivedMessages_.size(); i++) { + output.writeMessage(1, receivedMessages_.get(i)); + } + if (((bitField0_ & 0x00000002) != 0)) { + output.writeMessage(3, getModifyAckDeadlineConfirmation()); + } + if (((bitField0_ & 0x00000004) != 0)) { + output.writeMessage(4, getSubscriptionProperties()); + } + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(5, getAcknowledgeConfirmation()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < receivedMessages_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, receivedMessages_.get(i)); + } + if (((bitField0_ & 0x00000002) != 0)) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 3, getModifyAckDeadlineConfirmation()); + } + if (((bitField0_ & 0x00000004) != 0)) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize(4, getSubscriptionProperties()); + } + if (((bitField0_ & 0x00000001) != 0)) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize(5, getAcknowledgeConfirmation()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.pubsub.v1.StreamingPullResponse)) { + return super.equals(obj); + } + com.google.pubsub.v1.StreamingPullResponse other = + (com.google.pubsub.v1.StreamingPullResponse) obj; + + if (!getReceivedMessagesList().equals(other.getReceivedMessagesList())) return false; + if (hasAcknowledgeConfirmation() != other.hasAcknowledgeConfirmation()) return false; + if (hasAcknowledgeConfirmation()) { + if (!getAcknowledgeConfirmation().equals(other.getAcknowledgeConfirmation())) return false; + } + if (hasModifyAckDeadlineConfirmation() != other.hasModifyAckDeadlineConfirmation()) + return false; + if (hasModifyAckDeadlineConfirmation()) { + if (!getModifyAckDeadlineConfirmation().equals(other.getModifyAckDeadlineConfirmation())) + return false; + } + if (hasSubscriptionProperties() != other.hasSubscriptionProperties()) return false; + if (hasSubscriptionProperties()) { + if (!getSubscriptionProperties().equals(other.getSubscriptionProperties())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getReceivedMessagesCount() > 0) { + hash = (37 * hash) + RECEIVED_MESSAGES_FIELD_NUMBER; + hash = (53 * hash) + getReceivedMessagesList().hashCode(); + } + if (hasAcknowledgeConfirmation()) { + hash = (37 * hash) + ACKNOWLEDGE_CONFIRMATION_FIELD_NUMBER; + hash = (53 * hash) + getAcknowledgeConfirmation().hashCode(); + } + if (hasModifyAckDeadlineConfirmation()) { + hash = (37 * hash) + MODIFY_ACK_DEADLINE_CONFIRMATION_FIELD_NUMBER; + hash = (53 * hash) + getModifyAckDeadlineConfirmation().hashCode(); + } + if (hasSubscriptionProperties()) { + hash = (37 * hash) + SUBSCRIPTION_PROPERTIES_FIELD_NUMBER; + hash = (53 * hash) + getSubscriptionProperties().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.pubsub.v1.StreamingPullResponse parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.StreamingPullResponse parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.StreamingPullResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.StreamingPullResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.StreamingPullResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.StreamingPullResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.StreamingPullResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.StreamingPullResponse parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.StreamingPullResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.StreamingPullResponse parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.StreamingPullResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.StreamingPullResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.pubsub.v1.StreamingPullResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + + /** + * + * + *
    +   * Response for the `StreamingPull` method. This response is used to stream
    +   * messages from the server to the client.
    +   * 
    + * + * Protobuf type {@code google.pubsub.v1.StreamingPullResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder + implements + // @@protoc_insertion_point(builder_implements:google.pubsub.v1.StreamingPullResponse) + com.google.pubsub.v1.StreamingPullResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_StreamingPullResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_StreamingPullResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.StreamingPullResponse.class, + com.google.pubsub.v1.StreamingPullResponse.Builder.class); + } + + // Construct using com.google.pubsub.v1.StreamingPullResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + internalGetReceivedMessagesFieldBuilder(); + internalGetAcknowledgeConfirmationFieldBuilder(); + internalGetModifyAckDeadlineConfirmationFieldBuilder(); + internalGetSubscriptionPropertiesFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + if (receivedMessagesBuilder_ == null) { + receivedMessages_ = java.util.Collections.emptyList(); + } else { + receivedMessages_ = null; + receivedMessagesBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + acknowledgeConfirmation_ = null; + if (acknowledgeConfirmationBuilder_ != null) { + acknowledgeConfirmationBuilder_.dispose(); + acknowledgeConfirmationBuilder_ = null; + } + modifyAckDeadlineConfirmation_ = null; + if (modifyAckDeadlineConfirmationBuilder_ != null) { + modifyAckDeadlineConfirmationBuilder_.dispose(); + modifyAckDeadlineConfirmationBuilder_ = null; + } + subscriptionProperties_ = null; + if (subscriptionPropertiesBuilder_ != null) { + subscriptionPropertiesBuilder_.dispose(); + subscriptionPropertiesBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return com.google.pubsub.v1.PubsubProto - .internal_static_google_pubsub_v1_StreamingPullResponse_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.pubsub.v1.StreamingPullResponse.class, - com.google.pubsub.v1.StreamingPullResponse.Builder.class); + .internal_static_google_pubsub_v1_StreamingPullResponse_descriptor; + } + + @java.lang.Override + public com.google.pubsub.v1.StreamingPullResponse getDefaultInstanceForType() { + return com.google.pubsub.v1.StreamingPullResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.pubsub.v1.StreamingPullResponse build() { + com.google.pubsub.v1.StreamingPullResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.pubsub.v1.StreamingPullResponse buildPartial() { + com.google.pubsub.v1.StreamingPullResponse result = + new com.google.pubsub.v1.StreamingPullResponse(this); + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields(com.google.pubsub.v1.StreamingPullResponse result) { + if (receivedMessagesBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + receivedMessages_ = java.util.Collections.unmodifiableList(receivedMessages_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.receivedMessages_ = receivedMessages_; + } else { + result.receivedMessages_ = receivedMessagesBuilder_.build(); + } + } + + private void buildPartial0(com.google.pubsub.v1.StreamingPullResponse result) { + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000002) != 0)) { + result.acknowledgeConfirmation_ = + acknowledgeConfirmationBuilder_ == null + ? acknowledgeConfirmation_ + : acknowledgeConfirmationBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.modifyAckDeadlineConfirmation_ = + modifyAckDeadlineConfirmationBuilder_ == null + ? modifyAckDeadlineConfirmation_ + : modifyAckDeadlineConfirmationBuilder_.build(); + to_bitField0_ |= 0x00000002; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.subscriptionProperties_ = + subscriptionPropertiesBuilder_ == null + ? subscriptionProperties_ + : subscriptionPropertiesBuilder_.build(); + to_bitField0_ |= 0x00000004; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.pubsub.v1.StreamingPullResponse) { + return mergeFrom((com.google.pubsub.v1.StreamingPullResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.pubsub.v1.StreamingPullResponse other) { + if (other == com.google.pubsub.v1.StreamingPullResponse.getDefaultInstance()) return this; + if (receivedMessagesBuilder_ == null) { + if (!other.receivedMessages_.isEmpty()) { + if (receivedMessages_.isEmpty()) { + receivedMessages_ = other.receivedMessages_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureReceivedMessagesIsMutable(); + receivedMessages_.addAll(other.receivedMessages_); + } + onChanged(); + } + } else { + if (!other.receivedMessages_.isEmpty()) { + if (receivedMessagesBuilder_.isEmpty()) { + receivedMessagesBuilder_.dispose(); + receivedMessagesBuilder_ = null; + receivedMessages_ = other.receivedMessages_; + bitField0_ = (bitField0_ & ~0x00000001); + receivedMessagesBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders + ? internalGetReceivedMessagesFieldBuilder() + : null; + } else { + receivedMessagesBuilder_.addAllMessages(other.receivedMessages_); + } + } + } + if (other.hasAcknowledgeConfirmation()) { + mergeAcknowledgeConfirmation(other.getAcknowledgeConfirmation()); + } + if (other.hasModifyAckDeadlineConfirmation()) { + mergeModifyAckDeadlineConfirmation(other.getModifyAckDeadlineConfirmation()); + } + if (other.hasSubscriptionProperties()) { + mergeSubscriptionProperties(other.getSubscriptionProperties()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.pubsub.v1.ReceivedMessage m = + input.readMessage( + com.google.pubsub.v1.ReceivedMessage.parser(), extensionRegistry); + if (receivedMessagesBuilder_ == null) { + ensureReceivedMessagesIsMutable(); + receivedMessages_.add(m); + } else { + receivedMessagesBuilder_.addMessage(m); + } + break; + } // case 10 + case 26: + { + input.readMessage( + internalGetModifyAckDeadlineConfirmationFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000004; + break; + } // case 26 + case 34: + { + input.readMessage( + internalGetSubscriptionPropertiesFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000008; + break; + } // case 34 + case 42: + { + input.readMessage( + internalGetAcknowledgeConfirmationFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000002; + break; + } // case 42 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.util.List receivedMessages_ = + java.util.Collections.emptyList(); + + private void ensureReceivedMessagesIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + receivedMessages_ = + new java.util.ArrayList(receivedMessages_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + com.google.pubsub.v1.ReceivedMessage, + com.google.pubsub.v1.ReceivedMessage.Builder, + com.google.pubsub.v1.ReceivedMessageOrBuilder> + receivedMessagesBuilder_; + + /** + * + * + *
    +     * Optional. Received Pub/Sub messages.
    +     * 
    + * + * + * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public java.util.List getReceivedMessagesList() { + if (receivedMessagesBuilder_ == null) { + return java.util.Collections.unmodifiableList(receivedMessages_); + } else { + return receivedMessagesBuilder_.getMessageList(); + } + } + + /** + * + * + *
    +     * Optional. Received Pub/Sub messages.
    +     * 
    + * + * + * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public int getReceivedMessagesCount() { + if (receivedMessagesBuilder_ == null) { + return receivedMessages_.size(); + } else { + return receivedMessagesBuilder_.getCount(); + } + } + + /** + * + * + *
    +     * Optional. Received Pub/Sub messages.
    +     * 
    + * + * + * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.ReceivedMessage getReceivedMessages(int index) { + if (receivedMessagesBuilder_ == null) { + return receivedMessages_.get(index); + } else { + return receivedMessagesBuilder_.getMessage(index); + } + } + + /** + * + * + *
    +     * Optional. Received Pub/Sub messages.
    +     * 
    + * + * + * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setReceivedMessages(int index, com.google.pubsub.v1.ReceivedMessage value) { + if (receivedMessagesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureReceivedMessagesIsMutable(); + receivedMessages_.set(index, value); + onChanged(); + } else { + receivedMessagesBuilder_.setMessage(index, value); + } + return this; + } + + /** + * + * + *
    +     * Optional. Received Pub/Sub messages.
    +     * 
    + * + * + * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setReceivedMessages( + int index, com.google.pubsub.v1.ReceivedMessage.Builder builderForValue) { + if (receivedMessagesBuilder_ == null) { + ensureReceivedMessagesIsMutable(); + receivedMessages_.set(index, builderForValue.build()); + onChanged(); + } else { + receivedMessagesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + + /** + * + * + *
    +     * Optional. Received Pub/Sub messages.
    +     * 
    + * + * + * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder addReceivedMessages(com.google.pubsub.v1.ReceivedMessage value) { + if (receivedMessagesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureReceivedMessagesIsMutable(); + receivedMessages_.add(value); + onChanged(); + } else { + receivedMessagesBuilder_.addMessage(value); + } + return this; + } + + /** + * + * + *
    +     * Optional. Received Pub/Sub messages.
    +     * 
    + * + * + * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder addReceivedMessages(int index, com.google.pubsub.v1.ReceivedMessage value) { + if (receivedMessagesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureReceivedMessagesIsMutable(); + receivedMessages_.add(index, value); + onChanged(); + } else { + receivedMessagesBuilder_.addMessage(index, value); + } + return this; } - // Construct using com.google.pubsub.v1.StreamingPullResponse.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); + /** + * + * + *
    +     * Optional. Received Pub/Sub messages.
    +     * 
    + * + * + * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder addReceivedMessages( + com.google.pubsub.v1.ReceivedMessage.Builder builderForValue) { + if (receivedMessagesBuilder_ == null) { + ensureReceivedMessagesIsMutable(); + receivedMessages_.add(builderForValue.build()); + onChanged(); + } else { + receivedMessagesBuilder_.addMessage(builderForValue.build()); + } + return this; } - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); + /** + * + * + *
    +     * Optional. Received Pub/Sub messages.
    +     * 
    + * + * + * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder addReceivedMessages( + int index, com.google.pubsub.v1.ReceivedMessage.Builder builderForValue) { + if (receivedMessagesBuilder_ == null) { + ensureReceivedMessagesIsMutable(); + receivedMessages_.add(index, builderForValue.build()); + onChanged(); + } else { + receivedMessagesBuilder_.addMessage(index, builderForValue.build()); + } + return this; } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { - getReceivedMessagesFieldBuilder(); + /** + * + * + *
    +     * Optional. Received Pub/Sub messages.
    +     * 
    + * + * + * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder addAllReceivedMessages( + java.lang.Iterable values) { + if (receivedMessagesBuilder_ == null) { + ensureReceivedMessagesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, receivedMessages_); + onChanged(); + } else { + receivedMessagesBuilder_.addAllMessages(values); } + return this; } - @java.lang.Override - public Builder clear() { - super.clear(); + /** + * + * + *
    +     * Optional. Received Pub/Sub messages.
    +     * 
    + * + * + * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearReceivedMessages() { if (receivedMessagesBuilder_ == null) { receivedMessages_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); } else { receivedMessagesBuilder_.clear(); } return this; } - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.pubsub.v1.PubsubProto - .internal_static_google_pubsub_v1_StreamingPullResponse_descriptor; + /** + * + * + *
    +     * Optional. Received Pub/Sub messages.
    +     * 
    + * + * + * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder removeReceivedMessages(int index) { + if (receivedMessagesBuilder_ == null) { + ensureReceivedMessagesIsMutable(); + receivedMessages_.remove(index); + onChanged(); + } else { + receivedMessagesBuilder_.remove(index); + } + return this; } - @java.lang.Override - public com.google.pubsub.v1.StreamingPullResponse getDefaultInstanceForType() { - return com.google.pubsub.v1.StreamingPullResponse.getDefaultInstance(); + /** + * + * + *
    +     * Optional. Received Pub/Sub messages.
    +     * 
    + * + * + * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.ReceivedMessage.Builder getReceivedMessagesBuilder(int index) { + return internalGetReceivedMessagesFieldBuilder().getBuilder(index); } - @java.lang.Override - public com.google.pubsub.v1.StreamingPullResponse build() { - com.google.pubsub.v1.StreamingPullResponse result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); + /** + * + * + *
    +     * Optional. Received Pub/Sub messages.
    +     * 
    + * + * + * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.ReceivedMessageOrBuilder getReceivedMessagesOrBuilder(int index) { + if (receivedMessagesBuilder_ == null) { + return receivedMessages_.get(index); + } else { + return receivedMessagesBuilder_.getMessageOrBuilder(index); } - return result; } - @java.lang.Override - public com.google.pubsub.v1.StreamingPullResponse buildPartial() { - com.google.pubsub.v1.StreamingPullResponse result = - new com.google.pubsub.v1.StreamingPullResponse(this); - int from_bitField0_ = bitField0_; - if (receivedMessagesBuilder_ == null) { - if (((bitField0_ & 0x00000001) != 0)) { - receivedMessages_ = java.util.Collections.unmodifiableList(receivedMessages_); - bitField0_ = (bitField0_ & ~0x00000001); - } - result.receivedMessages_ = receivedMessages_; + /** + * + * + *
    +     * Optional. Received Pub/Sub messages.
    +     * 
    + * + * + * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public java.util.List + getReceivedMessagesOrBuilderList() { + if (receivedMessagesBuilder_ != null) { + return receivedMessagesBuilder_.getMessageOrBuilderList(); } else { - result.receivedMessages_ = receivedMessagesBuilder_.build(); + return java.util.Collections.unmodifiableList(receivedMessages_); } - onBuilt(); - return result; } - @java.lang.Override - public Builder clone() { - return super.clone(); + /** + * + * + *
    +     * Optional. Received Pub/Sub messages.
    +     * 
    + * + * + * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.ReceivedMessage.Builder addReceivedMessagesBuilder() { + return internalGetReceivedMessagesFieldBuilder() + .addBuilder(com.google.pubsub.v1.ReceivedMessage.getDefaultInstance()); } - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); + /** + * + * + *
    +     * Optional. Received Pub/Sub messages.
    +     * 
    + * + * + * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.ReceivedMessage.Builder addReceivedMessagesBuilder(int index) { + return internalGetReceivedMessagesFieldBuilder() + .addBuilder(index, com.google.pubsub.v1.ReceivedMessage.getDefaultInstance()); } - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); + /** + * + * + *
    +     * Optional. Received Pub/Sub messages.
    +     * 
    + * + * + * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public java.util.List + getReceivedMessagesBuilderList() { + return internalGetReceivedMessagesFieldBuilder().getBuilderList(); } - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); + private com.google.protobuf.RepeatedFieldBuilder< + com.google.pubsub.v1.ReceivedMessage, + com.google.pubsub.v1.ReceivedMessage.Builder, + com.google.pubsub.v1.ReceivedMessageOrBuilder> + internalGetReceivedMessagesFieldBuilder() { + if (receivedMessagesBuilder_ == null) { + receivedMessagesBuilder_ = + new com.google.protobuf.RepeatedFieldBuilder< + com.google.pubsub.v1.ReceivedMessage, + com.google.pubsub.v1.ReceivedMessage.Builder, + com.google.pubsub.v1.ReceivedMessageOrBuilder>( + receivedMessages_, + ((bitField0_ & 0x00000001) != 0), + getParentForChildren(), + isClean()); + receivedMessages_ = null; + } + return receivedMessagesBuilder_; } - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } + private com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation + acknowledgeConfirmation_; + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation, + com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation.Builder, + com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmationOrBuilder> + acknowledgeConfirmationBuilder_; - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); + /** + * + * + *
    +     * Optional. This field will only be set if `enable_exactly_once_delivery` is
    +     * set to `true` and is not guaranteed to be populated.
    +     * 
    + * + * + * .google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation acknowledge_confirmation = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the acknowledgeConfirmation field is set. + */ + public boolean hasAcknowledgeConfirmation() { + return ((bitField0_ & 0x00000002) != 0); } - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.google.pubsub.v1.StreamingPullResponse) { - return mergeFrom((com.google.pubsub.v1.StreamingPullResponse) other); + /** + * + * + *
    +     * Optional. This field will only be set if `enable_exactly_once_delivery` is
    +     * set to `true` and is not guaranteed to be populated.
    +     * 
    + * + * + * .google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation acknowledge_confirmation = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The acknowledgeConfirmation. + */ + public com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation + getAcknowledgeConfirmation() { + if (acknowledgeConfirmationBuilder_ == null) { + return acknowledgeConfirmation_ == null + ? com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation + .getDefaultInstance() + : acknowledgeConfirmation_; } else { - super.mergeFrom(other); - return this; + return acknowledgeConfirmationBuilder_.getMessage(); } } - public Builder mergeFrom(com.google.pubsub.v1.StreamingPullResponse other) { - if (other == com.google.pubsub.v1.StreamingPullResponse.getDefaultInstance()) return this; - if (receivedMessagesBuilder_ == null) { - if (!other.receivedMessages_.isEmpty()) { - if (receivedMessages_.isEmpty()) { - receivedMessages_ = other.receivedMessages_; - bitField0_ = (bitField0_ & ~0x00000001); - } else { - ensureReceivedMessagesIsMutable(); - receivedMessages_.addAll(other.receivedMessages_); - } - onChanged(); - } - } else { - if (!other.receivedMessages_.isEmpty()) { - if (receivedMessagesBuilder_.isEmpty()) { - receivedMessagesBuilder_.dispose(); - receivedMessagesBuilder_ = null; - receivedMessages_ = other.receivedMessages_; - bitField0_ = (bitField0_ & ~0x00000001); - receivedMessagesBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders - ? getReceivedMessagesFieldBuilder() - : null; - } else { - receivedMessagesBuilder_.addAllMessages(other.receivedMessages_); - } + /** + * + * + *
    +     * Optional. This field will only be set if `enable_exactly_once_delivery` is
    +     * set to `true` and is not guaranteed to be populated.
    +     * 
    + * + * + * .google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation acknowledge_confirmation = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setAcknowledgeConfirmation( + com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation value) { + if (acknowledgeConfirmationBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); } + acknowledgeConfirmation_ = value; + } else { + acknowledgeConfirmationBuilder_.setMessage(value); } - this.mergeUnknownFields(other.unknownFields); + bitField0_ |= 0x00000002; onChanged(); return this; } - @java.lang.Override - public final boolean isInitialized() { - return true; + /** + * + * + *
    +     * Optional. This field will only be set if `enable_exactly_once_delivery` is
    +     * set to `true` and is not guaranteed to be populated.
    +     * 
    + * + * + * .google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation acknowledge_confirmation = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setAcknowledgeConfirmation( + com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation.Builder + builderForValue) { + if (acknowledgeConfirmationBuilder_ == null) { + acknowledgeConfirmation_ = builderForValue.build(); + } else { + acknowledgeConfirmationBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; } - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.pubsub.v1.StreamingPullResponse parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.google.pubsub.v1.StreamingPullResponse) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); + /** + * + * + *
    +     * Optional. This field will only be set if `enable_exactly_once_delivery` is
    +     * set to `true` and is not guaranteed to be populated.
    +     * 
    + * + * + * .google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation acknowledge_confirmation = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeAcknowledgeConfirmation( + com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation value) { + if (acknowledgeConfirmationBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0) + && acknowledgeConfirmation_ != null + && acknowledgeConfirmation_ + != com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation + .getDefaultInstance()) { + getAcknowledgeConfirmationBuilder().mergeFrom(value); + } else { + acknowledgeConfirmation_ = value; } + } else { + acknowledgeConfirmationBuilder_.mergeFrom(value); + } + if (acknowledgeConfirmation_ != null) { + bitField0_ |= 0x00000002; + onChanged(); } return this; } - private int bitField0_; - - private java.util.List receivedMessages_ = - java.util.Collections.emptyList(); - - private void ensureReceivedMessagesIsMutable() { - if (!((bitField0_ & 0x00000001) != 0)) { - receivedMessages_ = - new java.util.ArrayList(receivedMessages_); - bitField0_ |= 0x00000001; + /** + * + * + *
    +     * Optional. This field will only be set if `enable_exactly_once_delivery` is
    +     * set to `true` and is not guaranteed to be populated.
    +     * 
    + * + * + * .google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation acknowledge_confirmation = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearAcknowledgeConfirmation() { + bitField0_ = (bitField0_ & ~0x00000002); + acknowledgeConfirmation_ = null; + if (acknowledgeConfirmationBuilder_ != null) { + acknowledgeConfirmationBuilder_.dispose(); + acknowledgeConfirmationBuilder_ = null; } + onChanged(); + return this; } - private com.google.protobuf.RepeatedFieldBuilderV3< - com.google.pubsub.v1.ReceivedMessage, - com.google.pubsub.v1.ReceivedMessage.Builder, - com.google.pubsub.v1.ReceivedMessageOrBuilder> - receivedMessagesBuilder_; + /** + * + * + *
    +     * Optional. This field will only be set if `enable_exactly_once_delivery` is
    +     * set to `true` and is not guaranteed to be populated.
    +     * 
    + * + * + * .google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation acknowledge_confirmation = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation.Builder + getAcknowledgeConfirmationBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return internalGetAcknowledgeConfirmationFieldBuilder().getBuilder(); + } /** * * *
    -     * Received Pub/Sub messages. This will not be empty.
    +     * Optional. This field will only be set if `enable_exactly_once_delivery` is
    +     * set to `true` and is not guaranteed to be populated.
          * 
    * - * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1; + * + * .google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation acknowledge_confirmation = 5 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public java.util.List getReceivedMessagesList() { - if (receivedMessagesBuilder_ == null) { - return java.util.Collections.unmodifiableList(receivedMessages_); + public com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmationOrBuilder + getAcknowledgeConfirmationOrBuilder() { + if (acknowledgeConfirmationBuilder_ != null) { + return acknowledgeConfirmationBuilder_.getMessageOrBuilder(); } else { - return receivedMessagesBuilder_.getMessageList(); + return acknowledgeConfirmation_ == null + ? com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation + .getDefaultInstance() + : acknowledgeConfirmation_; } } + /** * * *
    -     * Received Pub/Sub messages. This will not be empty.
    +     * Optional. This field will only be set if `enable_exactly_once_delivery` is
    +     * set to `true` and is not guaranteed to be populated.
          * 
    * - * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1; + * + * .google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation acknowledge_confirmation = 5 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public int getReceivedMessagesCount() { - if (receivedMessagesBuilder_ == null) { - return receivedMessages_.size(); - } else { - return receivedMessagesBuilder_.getCount(); + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation, + com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation.Builder, + com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmationOrBuilder> + internalGetAcknowledgeConfirmationFieldBuilder() { + if (acknowledgeConfirmationBuilder_ == null) { + acknowledgeConfirmationBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation, + com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation.Builder, + com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmationOrBuilder>( + getAcknowledgeConfirmation(), getParentForChildren(), isClean()); + acknowledgeConfirmation_ = null; } + return acknowledgeConfirmationBuilder_; + } + + private com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation + modifyAckDeadlineConfirmation_; + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation, + com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation.Builder, + com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmationOrBuilder> + modifyAckDeadlineConfirmationBuilder_; + + /** + * + * + *
    +     * Optional. This field will only be set if `enable_exactly_once_delivery` is
    +     * set to `true` and is not guaranteed to be populated.
    +     * 
    + * + * + * .google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation modify_ack_deadline_confirmation = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the modifyAckDeadlineConfirmation field is set. + */ + public boolean hasModifyAckDeadlineConfirmation() { + return ((bitField0_ & 0x00000004) != 0); } + /** * * *
    -     * Received Pub/Sub messages. This will not be empty.
    +     * Optional. This field will only be set if `enable_exactly_once_delivery` is
    +     * set to `true` and is not guaranteed to be populated.
          * 
    * - * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1; + * + * .google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation modify_ack_deadline_confirmation = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The modifyAckDeadlineConfirmation. */ - public com.google.pubsub.v1.ReceivedMessage getReceivedMessages(int index) { - if (receivedMessagesBuilder_ == null) { - return receivedMessages_.get(index); + public com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation + getModifyAckDeadlineConfirmation() { + if (modifyAckDeadlineConfirmationBuilder_ == null) { + return modifyAckDeadlineConfirmation_ == null + ? com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation + .getDefaultInstance() + : modifyAckDeadlineConfirmation_; } else { - return receivedMessagesBuilder_.getMessage(index); + return modifyAckDeadlineConfirmationBuilder_.getMessage(); } } + /** * * *
    -     * Received Pub/Sub messages. This will not be empty.
    +     * Optional. This field will only be set if `enable_exactly_once_delivery` is
    +     * set to `true` and is not guaranteed to be populated.
          * 
    * - * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1; + * + * .google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation modify_ack_deadline_confirmation = 3 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public Builder setReceivedMessages(int index, com.google.pubsub.v1.ReceivedMessage value) { - if (receivedMessagesBuilder_ == null) { + public Builder setModifyAckDeadlineConfirmation( + com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation value) { + if (modifyAckDeadlineConfirmationBuilder_ == null) { if (value == null) { throw new NullPointerException(); } - ensureReceivedMessagesIsMutable(); - receivedMessages_.set(index, value); - onChanged(); + modifyAckDeadlineConfirmation_ = value; } else { - receivedMessagesBuilder_.setMessage(index, value); + modifyAckDeadlineConfirmationBuilder_.setMessage(value); } + bitField0_ |= 0x00000004; + onChanged(); return this; } + /** * * *
    -     * Received Pub/Sub messages. This will not be empty.
    +     * Optional. This field will only be set if `enable_exactly_once_delivery` is
    +     * set to `true` and is not guaranteed to be populated.
          * 
    * - * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1; + * + * .google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation modify_ack_deadline_confirmation = 3 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public Builder setReceivedMessages( - int index, com.google.pubsub.v1.ReceivedMessage.Builder builderForValue) { - if (receivedMessagesBuilder_ == null) { - ensureReceivedMessagesIsMutable(); - receivedMessages_.set(index, builderForValue.build()); - onChanged(); + public Builder setModifyAckDeadlineConfirmation( + com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation.Builder + builderForValue) { + if (modifyAckDeadlineConfirmationBuilder_ == null) { + modifyAckDeadlineConfirmation_ = builderForValue.build(); } else { - receivedMessagesBuilder_.setMessage(index, builderForValue.build()); + modifyAckDeadlineConfirmationBuilder_.setMessage(builderForValue.build()); } + bitField0_ |= 0x00000004; + onChanged(); return this; } + /** * * *
    -     * Received Pub/Sub messages. This will not be empty.
    +     * Optional. This field will only be set if `enable_exactly_once_delivery` is
    +     * set to `true` and is not guaranteed to be populated.
          * 
    * - * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1; + * + * .google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation modify_ack_deadline_confirmation = 3 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public Builder addReceivedMessages(com.google.pubsub.v1.ReceivedMessage value) { - if (receivedMessagesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); + public Builder mergeModifyAckDeadlineConfirmation( + com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation value) { + if (modifyAckDeadlineConfirmationBuilder_ == null) { + if (((bitField0_ & 0x00000004) != 0) + && modifyAckDeadlineConfirmation_ != null + && modifyAckDeadlineConfirmation_ + != com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation + .getDefaultInstance()) { + getModifyAckDeadlineConfirmationBuilder().mergeFrom(value); + } else { + modifyAckDeadlineConfirmation_ = value; } - ensureReceivedMessagesIsMutable(); - receivedMessages_.add(value); - onChanged(); } else { - receivedMessagesBuilder_.addMessage(value); + modifyAckDeadlineConfirmationBuilder_.mergeFrom(value); + } + if (modifyAckDeadlineConfirmation_ != null) { + bitField0_ |= 0x00000004; + onChanged(); } return this; } + /** * * *
    -     * Received Pub/Sub messages. This will not be empty.
    +     * Optional. This field will only be set if `enable_exactly_once_delivery` is
    +     * set to `true` and is not guaranteed to be populated.
          * 
    * - * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1; + * + * .google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation modify_ack_deadline_confirmation = 3 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public Builder addReceivedMessages(int index, com.google.pubsub.v1.ReceivedMessage value) { - if (receivedMessagesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureReceivedMessagesIsMutable(); - receivedMessages_.add(index, value); - onChanged(); - } else { - receivedMessagesBuilder_.addMessage(index, value); + public Builder clearModifyAckDeadlineConfirmation() { + bitField0_ = (bitField0_ & ~0x00000004); + modifyAckDeadlineConfirmation_ = null; + if (modifyAckDeadlineConfirmationBuilder_ != null) { + modifyAckDeadlineConfirmationBuilder_.dispose(); + modifyAckDeadlineConfirmationBuilder_ = null; } + onChanged(); return this; } + /** * * *
    -     * Received Pub/Sub messages. This will not be empty.
    +     * Optional. This field will only be set if `enable_exactly_once_delivery` is
    +     * set to `true` and is not guaranteed to be populated.
          * 
    * - * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1; + * + * .google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation modify_ack_deadline_confirmation = 3 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public Builder addReceivedMessages( - com.google.pubsub.v1.ReceivedMessage.Builder builderForValue) { - if (receivedMessagesBuilder_ == null) { - ensureReceivedMessagesIsMutable(); - receivedMessages_.add(builderForValue.build()); - onChanged(); - } else { - receivedMessagesBuilder_.addMessage(builderForValue.build()); - } - return this; + public com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation.Builder + getModifyAckDeadlineConfirmationBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return internalGetModifyAckDeadlineConfirmationFieldBuilder().getBuilder(); } + /** * * *
    -     * Received Pub/Sub messages. This will not be empty.
    +     * Optional. This field will only be set if `enable_exactly_once_delivery` is
    +     * set to `true` and is not guaranteed to be populated.
          * 
    * - * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1; + * + * .google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation modify_ack_deadline_confirmation = 3 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public Builder addReceivedMessages( - int index, com.google.pubsub.v1.ReceivedMessage.Builder builderForValue) { - if (receivedMessagesBuilder_ == null) { - ensureReceivedMessagesIsMutable(); - receivedMessages_.add(index, builderForValue.build()); - onChanged(); + public com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmationOrBuilder + getModifyAckDeadlineConfirmationOrBuilder() { + if (modifyAckDeadlineConfirmationBuilder_ != null) { + return modifyAckDeadlineConfirmationBuilder_.getMessageOrBuilder(); } else { - receivedMessagesBuilder_.addMessage(index, builderForValue.build()); + return modifyAckDeadlineConfirmation_ == null + ? com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation + .getDefaultInstance() + : modifyAckDeadlineConfirmation_; } - return this; } + /** * * *
    -     * Received Pub/Sub messages. This will not be empty.
    +     * Optional. This field will only be set if `enable_exactly_once_delivery` is
    +     * set to `true` and is not guaranteed to be populated.
          * 
    * - * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1; + * + * .google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation modify_ack_deadline_confirmation = 3 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public Builder addAllReceivedMessages( - java.lang.Iterable values) { - if (receivedMessagesBuilder_ == null) { - ensureReceivedMessagesIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll(values, receivedMessages_); - onChanged(); - } else { - receivedMessagesBuilder_.addAllMessages(values); + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation, + com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation.Builder, + com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmationOrBuilder> + internalGetModifyAckDeadlineConfirmationFieldBuilder() { + if (modifyAckDeadlineConfirmationBuilder_ == null) { + modifyAckDeadlineConfirmationBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation, + com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation.Builder, + com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmationOrBuilder>( + getModifyAckDeadlineConfirmation(), getParentForChildren(), isClean()); + modifyAckDeadlineConfirmation_ = null; } - return this; + return modifyAckDeadlineConfirmationBuilder_; } + + private com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties + subscriptionProperties_; + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties, + com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties.Builder, + com.google.pubsub.v1.StreamingPullResponse.SubscriptionPropertiesOrBuilder> + subscriptionPropertiesBuilder_; + /** * * *
    -     * Received Pub/Sub messages. This will not be empty.
    +     * Optional. Properties associated with this subscription.
          * 
    * - * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1; + * + * .google.pubsub.v1.StreamingPullResponse.SubscriptionProperties subscription_properties = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the subscriptionProperties field is set. */ - public Builder clearReceivedMessages() { - if (receivedMessagesBuilder_ == null) { - receivedMessages_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); - onChanged(); - } else { - receivedMessagesBuilder_.clear(); - } - return this; + public boolean hasSubscriptionProperties() { + return ((bitField0_ & 0x00000008) != 0); } + /** * * *
    -     * Received Pub/Sub messages. This will not be empty.
    +     * Optional. Properties associated with this subscription.
          * 
    * - * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1; + * + * .google.pubsub.v1.StreamingPullResponse.SubscriptionProperties subscription_properties = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The subscriptionProperties. */ - public Builder removeReceivedMessages(int index) { - if (receivedMessagesBuilder_ == null) { - ensureReceivedMessagesIsMutable(); - receivedMessages_.remove(index); - onChanged(); + public com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties + getSubscriptionProperties() { + if (subscriptionPropertiesBuilder_ == null) { + return subscriptionProperties_ == null + ? com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties.getDefaultInstance() + : subscriptionProperties_; } else { - receivedMessagesBuilder_.remove(index); + return subscriptionPropertiesBuilder_.getMessage(); } - return this; } + /** * * *
    -     * Received Pub/Sub messages. This will not be empty.
    +     * Optional. Properties associated with this subscription.
          * 
    * - * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1; + * + * .google.pubsub.v1.StreamingPullResponse.SubscriptionProperties subscription_properties = 4 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public com.google.pubsub.v1.ReceivedMessage.Builder getReceivedMessagesBuilder(int index) { - return getReceivedMessagesFieldBuilder().getBuilder(index); + public Builder setSubscriptionProperties( + com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties value) { + if (subscriptionPropertiesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + subscriptionProperties_ = value; + } else { + subscriptionPropertiesBuilder_.setMessage(value); + } + bitField0_ |= 0x00000008; + onChanged(); + return this; } + /** * * *
    -     * Received Pub/Sub messages. This will not be empty.
    +     * Optional. Properties associated with this subscription.
          * 
    * - * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1; + * + * .google.pubsub.v1.StreamingPullResponse.SubscriptionProperties subscription_properties = 4 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public com.google.pubsub.v1.ReceivedMessageOrBuilder getReceivedMessagesOrBuilder(int index) { - if (receivedMessagesBuilder_ == null) { - return receivedMessages_.get(index); + public Builder setSubscriptionProperties( + com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties.Builder builderForValue) { + if (subscriptionPropertiesBuilder_ == null) { + subscriptionProperties_ = builderForValue.build(); } else { - return receivedMessagesBuilder_.getMessageOrBuilder(index); + subscriptionPropertiesBuilder_.setMessage(builderForValue.build()); } + bitField0_ |= 0x00000008; + onChanged(); + return this; } + /** * * *
    -     * Received Pub/Sub messages. This will not be empty.
    +     * Optional. Properties associated with this subscription.
          * 
    * - * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1; + * + * .google.pubsub.v1.StreamingPullResponse.SubscriptionProperties subscription_properties = 4 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public java.util.List - getReceivedMessagesOrBuilderList() { - if (receivedMessagesBuilder_ != null) { - return receivedMessagesBuilder_.getMessageOrBuilderList(); + public Builder mergeSubscriptionProperties( + com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties value) { + if (subscriptionPropertiesBuilder_ == null) { + if (((bitField0_ & 0x00000008) != 0) + && subscriptionProperties_ != null + && subscriptionProperties_ + != com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties + .getDefaultInstance()) { + getSubscriptionPropertiesBuilder().mergeFrom(value); + } else { + subscriptionProperties_ = value; + } } else { - return java.util.Collections.unmodifiableList(receivedMessages_); + subscriptionPropertiesBuilder_.mergeFrom(value); + } + if (subscriptionProperties_ != null) { + bitField0_ |= 0x00000008; + onChanged(); } + return this; } + /** * * *
    -     * Received Pub/Sub messages. This will not be empty.
    +     * Optional. Properties associated with this subscription.
          * 
    * - * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1; + * + * .google.pubsub.v1.StreamingPullResponse.SubscriptionProperties subscription_properties = 4 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public com.google.pubsub.v1.ReceivedMessage.Builder addReceivedMessagesBuilder() { - return getReceivedMessagesFieldBuilder() - .addBuilder(com.google.pubsub.v1.ReceivedMessage.getDefaultInstance()); + public Builder clearSubscriptionProperties() { + bitField0_ = (bitField0_ & ~0x00000008); + subscriptionProperties_ = null; + if (subscriptionPropertiesBuilder_ != null) { + subscriptionPropertiesBuilder_.dispose(); + subscriptionPropertiesBuilder_ = null; + } + onChanged(); + return this; } + /** * * *
    -     * Received Pub/Sub messages. This will not be empty.
    +     * Optional. Properties associated with this subscription.
          * 
    * - * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1; + * + * .google.pubsub.v1.StreamingPullResponse.SubscriptionProperties subscription_properties = 4 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public com.google.pubsub.v1.ReceivedMessage.Builder addReceivedMessagesBuilder(int index) { - return getReceivedMessagesFieldBuilder() - .addBuilder(index, com.google.pubsub.v1.ReceivedMessage.getDefaultInstance()); + public com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties.Builder + getSubscriptionPropertiesBuilder() { + bitField0_ |= 0x00000008; + onChanged(); + return internalGetSubscriptionPropertiesFieldBuilder().getBuilder(); } + /** * * *
    -     * Received Pub/Sub messages. This will not be empty.
    +     * Optional. Properties associated with this subscription.
          * 
    * - * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1; + * + * .google.pubsub.v1.StreamingPullResponse.SubscriptionProperties subscription_properties = 4 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public java.util.List - getReceivedMessagesBuilderList() { - return getReceivedMessagesFieldBuilder().getBuilderList(); - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.google.pubsub.v1.ReceivedMessage, - com.google.pubsub.v1.ReceivedMessage.Builder, - com.google.pubsub.v1.ReceivedMessageOrBuilder> - getReceivedMessagesFieldBuilder() { - if (receivedMessagesBuilder_ == null) { - receivedMessagesBuilder_ = - new com.google.protobuf.RepeatedFieldBuilderV3< - com.google.pubsub.v1.ReceivedMessage, - com.google.pubsub.v1.ReceivedMessage.Builder, - com.google.pubsub.v1.ReceivedMessageOrBuilder>( - receivedMessages_, - ((bitField0_ & 0x00000001) != 0), - getParentForChildren(), - isClean()); - receivedMessages_ = null; + public com.google.pubsub.v1.StreamingPullResponse.SubscriptionPropertiesOrBuilder + getSubscriptionPropertiesOrBuilder() { + if (subscriptionPropertiesBuilder_ != null) { + return subscriptionPropertiesBuilder_.getMessageOrBuilder(); + } else { + return subscriptionProperties_ == null + ? com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties.getDefaultInstance() + : subscriptionProperties_; } - return receivedMessagesBuilder_; - } - - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); } - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); + /** + * + * + *
    +     * Optional. Properties associated with this subscription.
    +     * 
    + * + * + * .google.pubsub.v1.StreamingPullResponse.SubscriptionProperties subscription_properties = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties, + com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties.Builder, + com.google.pubsub.v1.StreamingPullResponse.SubscriptionPropertiesOrBuilder> + internalGetSubscriptionPropertiesFieldBuilder() { + if (subscriptionPropertiesBuilder_ == null) { + subscriptionPropertiesBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties, + com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties.Builder, + com.google.pubsub.v1.StreamingPullResponse.SubscriptionPropertiesOrBuilder>( + getSubscriptionProperties(), getParentForChildren(), isClean()); + subscriptionProperties_ = null; + } + return subscriptionPropertiesBuilder_; } // @@protoc_insertion_point(builder_scope:google.pubsub.v1.StreamingPullResponse) @@ -934,7 +5957,18 @@ public StreamingPullResponse parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new StreamingPullResponse(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; 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 1bed73f42..6705ad05d 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 @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; +@com.google.protobuf.Generated public interface StreamingPullResponseOrBuilder extends // @@protoc_insertion_point(interface_extends:google.pubsub.v1.StreamingPullResponse) @@ -27,51 +30,204 @@ public interface StreamingPullResponseOrBuilder * * *
    -   * Received Pub/Sub messages. This will not be empty.
    +   * Optional. Received Pub/Sub messages.
        * 
    * - * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1; + * + * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ java.util.List getReceivedMessagesList(); + /** * * *
    -   * Received Pub/Sub messages. This will not be empty.
    +   * Optional. Received Pub/Sub messages.
        * 
    * - * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1; + * + * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ com.google.pubsub.v1.ReceivedMessage getReceivedMessages(int index); + /** * * *
    -   * Received Pub/Sub messages. This will not be empty.
    +   * Optional. Received Pub/Sub messages.
        * 
    * - * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1; + * + * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ int getReceivedMessagesCount(); + /** * * *
    -   * Received Pub/Sub messages. This will not be empty.
    +   * Optional. Received Pub/Sub messages.
        * 
    * - * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1; + * + * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ java.util.List getReceivedMessagesOrBuilderList(); + /** * * *
    -   * Received Pub/Sub messages. This will not be empty.
    +   * Optional. Received Pub/Sub messages.
        * 
    * - * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1; + * + * repeated .google.pubsub.v1.ReceivedMessage received_messages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * */ com.google.pubsub.v1.ReceivedMessageOrBuilder getReceivedMessagesOrBuilder(int index); + + /** + * + * + *
    +   * Optional. This field will only be set if `enable_exactly_once_delivery` is
    +   * set to `true` and is not guaranteed to be populated.
    +   * 
    + * + * + * .google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation acknowledge_confirmation = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the acknowledgeConfirmation field is set. + */ + boolean hasAcknowledgeConfirmation(); + + /** + * + * + *
    +   * Optional. This field will only be set if `enable_exactly_once_delivery` is
    +   * set to `true` and is not guaranteed to be populated.
    +   * 
    + * + * + * .google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation acknowledge_confirmation = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The acknowledgeConfirmation. + */ + com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation getAcknowledgeConfirmation(); + + /** + * + * + *
    +   * Optional. This field will only be set if `enable_exactly_once_delivery` is
    +   * set to `true` and is not guaranteed to be populated.
    +   * 
    + * + * + * .google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation acknowledge_confirmation = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmationOrBuilder + getAcknowledgeConfirmationOrBuilder(); + + /** + * + * + *
    +   * Optional. This field will only be set if `enable_exactly_once_delivery` is
    +   * set to `true` and is not guaranteed to be populated.
    +   * 
    + * + * + * .google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation modify_ack_deadline_confirmation = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the modifyAckDeadlineConfirmation field is set. + */ + boolean hasModifyAckDeadlineConfirmation(); + + /** + * + * + *
    +   * Optional. This field will only be set if `enable_exactly_once_delivery` is
    +   * set to `true` and is not guaranteed to be populated.
    +   * 
    + * + * + * .google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation modify_ack_deadline_confirmation = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The modifyAckDeadlineConfirmation. + */ + com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation + getModifyAckDeadlineConfirmation(); + + /** + * + * + *
    +   * Optional. This field will only be set if `enable_exactly_once_delivery` is
    +   * set to `true` and is not guaranteed to be populated.
    +   * 
    + * + * + * .google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation modify_ack_deadline_confirmation = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmationOrBuilder + getModifyAckDeadlineConfirmationOrBuilder(); + + /** + * + * + *
    +   * Optional. Properties associated with this subscription.
    +   * 
    + * + * + * .google.pubsub.v1.StreamingPullResponse.SubscriptionProperties subscription_properties = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the subscriptionProperties field is set. + */ + boolean hasSubscriptionProperties(); + + /** + * + * + *
    +   * Optional. Properties associated with this subscription.
    +   * 
    + * + * + * .google.pubsub.v1.StreamingPullResponse.SubscriptionProperties subscription_properties = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The subscriptionProperties. + */ + com.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties getSubscriptionProperties(); + + /** + * + * + *
    +   * Optional. Properties associated with this subscription.
    +   * 
    + * + * + * .google.pubsub.v1.StreamingPullResponse.SubscriptionProperties subscription_properties = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.pubsub.v1.StreamingPullResponse.SubscriptionPropertiesOrBuilder + getSubscriptionPropertiesOrBuilder(); } 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 3b1afd152..ab7ef789d 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 @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; @@ -22,18 +24,32 @@ * * *
    - * A subscription resource.
    + * A subscription resource. If none of `push_config`, `bigquery_config`, or
    + * `cloud_storage_config` is set, then the subscriber will pull and ack messages
    + * using API methods. At most one of these fields may be set.
      * 
    * * Protobuf type {@code google.pubsub.v1.Subscription} */ -public final class Subscription extends com.google.protobuf.GeneratedMessageV3 +@com.google.protobuf.Generated +public final class Subscription extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:google.pubsub.v1.Subscription) SubscriptionOrBuilder { private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "Subscription"); + } + // Use Subscription.newBuilder() to construct. - private Subscription(com.google.protobuf.GeneratedMessageV3.Builder builder) { + private Subscription(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); } @@ -41,186 +57,8 @@ private Subscription() { name_ = ""; topic_ = ""; filter_ = ""; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new Subscription(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - private Subscription( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - java.lang.String s = input.readStringRequireUtf8(); - - name_ = s; - break; - } - case 18: - { - java.lang.String s = input.readStringRequireUtf8(); - - topic_ = s; - break; - } - case 34: - { - com.google.pubsub.v1.PushConfig.Builder subBuilder = null; - if (pushConfig_ != null) { - subBuilder = pushConfig_.toBuilder(); - } - pushConfig_ = - input.readMessage(com.google.pubsub.v1.PushConfig.parser(), extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(pushConfig_); - pushConfig_ = subBuilder.buildPartial(); - } - - break; - } - case 40: - { - ackDeadlineSeconds_ = input.readInt32(); - break; - } - case 56: - { - retainAckedMessages_ = input.readBool(); - break; - } - case 66: - { - com.google.protobuf.Duration.Builder subBuilder = null; - if (messageRetentionDuration_ != null) { - subBuilder = messageRetentionDuration_.toBuilder(); - } - messageRetentionDuration_ = - input.readMessage(com.google.protobuf.Duration.parser(), extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(messageRetentionDuration_); - messageRetentionDuration_ = subBuilder.buildPartial(); - } - - break; - } - case 74: - { - if (!((mutable_bitField0_ & 0x00000001) != 0)) { - labels_ = - com.google.protobuf.MapField.newMapField(LabelsDefaultEntryHolder.defaultEntry); - mutable_bitField0_ |= 0x00000001; - } - com.google.protobuf.MapEntry labels__ = - input.readMessage( - LabelsDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry); - labels_.getMutableMap().put(labels__.getKey(), labels__.getValue()); - break; - } - case 80: - { - enableMessageOrdering_ = input.readBool(); - break; - } - case 90: - { - com.google.pubsub.v1.ExpirationPolicy.Builder subBuilder = null; - if (expirationPolicy_ != null) { - subBuilder = expirationPolicy_.toBuilder(); - } - expirationPolicy_ = - input.readMessage( - com.google.pubsub.v1.ExpirationPolicy.parser(), extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(expirationPolicy_); - expirationPolicy_ = subBuilder.buildPartial(); - } - - break; - } - case 98: - { - java.lang.String s = input.readStringRequireUtf8(); - - filter_ = s; - break; - } - case 106: - { - com.google.pubsub.v1.DeadLetterPolicy.Builder subBuilder = null; - if (deadLetterPolicy_ != null) { - subBuilder = deadLetterPolicy_.toBuilder(); - } - deadLetterPolicy_ = - input.readMessage( - com.google.pubsub.v1.DeadLetterPolicy.parser(), extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(deadLetterPolicy_); - deadLetterPolicy_ = subBuilder.buildPartial(); - } - - break; - } - case 114: - { - com.google.pubsub.v1.RetryPolicy.Builder subBuilder = null; - if (retryPolicy_ != null) { - subBuilder = retryPolicy_.toBuilder(); - } - retryPolicy_ = - input.readMessage(com.google.pubsub.v1.RetryPolicy.parser(), extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(retryPolicy_); - retryPolicy_ = subBuilder.buildPartial(); - } - - break; - } - case 120: - { - detached_ = input.readBool(); - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } + state_ = 0; + messageTransforms_ = java.util.Collections.emptyList(); } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { @@ -230,17 +68,20 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { @SuppressWarnings({"rawtypes"}) @java.lang.Override - protected com.google.protobuf.MapField internalGetMapField(int number) { + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldReflection( + int number) { switch (number) { case 9: return internalGetLabels(); + case 26: + return internalGetTags(); default: throw new RuntimeException("Invalid map field number: " + number); } } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_Subscription_fieldAccessorTable @@ -249,3260 +90,7669 @@ protected com.google.protobuf.MapField internalGetMapField(int number) { com.google.pubsub.v1.Subscription.Builder.class); } - public static final int NAME_FIELD_NUMBER = 1; - private volatile java.lang.Object name_; /** * * *
    -   * Required. The name of the subscription. It must have the format
    -   * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must
    -   * start with a letter, and contain only letters (`[A-Za-z]`), numbers
    -   * (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`),
    -   * plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters
    -   * in length, and it must not start with `"goog"`.
    +   * Possible states for a subscription.
        * 
    * - * string name = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * @return The name. + * Protobuf enum {@code google.pubsub.v1.Subscription.State} */ - @java.lang.Override - public java.lang.String getName() { - java.lang.Object ref = name_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - name_ = s; - return s; + public enum State implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
    +     * Default value. This value is unused.
    +     * 
    + * + * STATE_UNSPECIFIED = 0; + */ + STATE_UNSPECIFIED(0), + /** + * + * + *
    +     * The subscription can actively receive messages
    +     * 
    + * + * ACTIVE = 1; + */ + ACTIVE(1), + /** + * + * + *
    +     * The subscription cannot receive messages because of an error with the
    +     * resource to which it pushes messages. See the more detailed error state
    +     * in the corresponding configuration.
    +     * 
    + * + * RESOURCE_ERROR = 2; + */ + RESOURCE_ERROR(2), + UNRECOGNIZED(-1), + ; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "State"); } - } - /** - * - * - *
    -   * Required. The name of the subscription. It must have the format
    -   * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must
    -   * start with a letter, and contain only letters (`[A-Za-z]`), numbers
    -   * (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`),
    -   * plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters
    -   * in length, and it must not start with `"goog"`.
    -   * 
    - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * @return The bytes for name. - */ - @java.lang.Override - public com.google.protobuf.ByteString getNameBytes() { - java.lang.Object ref = name_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - name_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; + + /** + * + * + *
    +     * Default value. This value is unused.
    +     * 
    + * + * STATE_UNSPECIFIED = 0; + */ + public static final int STATE_UNSPECIFIED_VALUE = 0; + + /** + * + * + *
    +     * The subscription can actively receive messages
    +     * 
    + * + * ACTIVE = 1; + */ + public static final int ACTIVE_VALUE = 1; + + /** + * + * + *
    +     * The subscription cannot receive messages because of an error with the
    +     * resource to which it pushes messages. See the more detailed error state
    +     * in the corresponding configuration.
    +     * 
    + * + * RESOURCE_ERROR = 2; + */ + public static final int RESOURCE_ERROR_VALUE = 2; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; } - } - public static final int TOPIC_FIELD_NUMBER = 2; - private volatile java.lang.Object topic_; - /** - * - * - *
    -   * Required. The name of the topic from which this subscription is receiving
    -   * messages. Format is `projects/{project}/topics/{topic}`. The value of this
    -   * field will be `_deleted-topic_` if the topic has been deleted.
    -   * 
    - * - * - * string topic = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The topic. - */ - @java.lang.Override - public java.lang.String getTopic() { - java.lang.Object ref = topic_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - topic_ = s; - return s; + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static State valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static State forNumber(int value) { + switch (value) { + case 0: + return STATE_UNSPECIFIED; + case 1: + return ACTIVE; + case 2: + return RESOURCE_ERROR; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public State findValueByNumber(int number) { + return State.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.pubsub.v1.Subscription.getDescriptor().getEnumTypes().get(0); + } + + private static final State[] VALUES = values(); + + public static State valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; } + + private final int value; + + private State(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.pubsub.v1.Subscription.State) + } + + public interface AnalyticsHubSubscriptionInfoOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
    +     * 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, (.google.api.resource_reference) = { ... } + * + * + * @return The listing. + */ + java.lang.String getListing(); + + /** + * + * + *
    +     * 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, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for listing. + */ + com.google.protobuf.ByteString getListingBytes(); + + /** + * + * + *
    +     * Optional. The name of the associated Analytics Hub subscription resource.
    +     * Pattern:
    +     * "projects/{project}/locations/{location}/subscriptions/{subscription}"
    +     * 
    + * + * string subscription = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The subscription. + */ + java.lang.String getSubscription(); + + /** + * + * + *
    +     * Optional. The name of the associated Analytics Hub subscription resource.
    +     * Pattern:
    +     * "projects/{project}/locations/{location}/subscriptions/{subscription}"
    +     * 
    + * + * string subscription = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for subscription. + */ + com.google.protobuf.ByteString getSubscriptionBytes(); } + /** * * *
    -   * Required. The name of the topic from which this subscription is receiving
    -   * messages. Format is `projects/{project}/topics/{topic}`. The value of this
    -   * field will be `_deleted-topic_` if the topic has been deleted.
    +   * Information about an associated [Analytics Hub
    +   * subscription](https://cloud.google.com/bigquery/docs/analytics-hub-manage-subscriptions).
        * 
    * - * - * string topic = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The bytes for topic. + * Protobuf type {@code google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo} */ - @java.lang.Override - public com.google.protobuf.ByteString getTopicBytes() { - java.lang.Object ref = topic_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - topic_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } + public static final class AnalyticsHubSubscriptionInfo + extends com.google.protobuf.GeneratedMessage + implements + // @@protoc_insertion_point(message_implements:google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo) + AnalyticsHubSubscriptionInfoOrBuilder { + private static final long serialVersionUID = 0L; - public static final int PUSH_CONFIG_FIELD_NUMBER = 4; - private com.google.pubsub.v1.PushConfig pushConfig_; - /** - * - * - *
    -   * If push delivery is used with this subscription, this field is
    -   * used to configure it. An empty `pushConfig` signifies that the subscriber
    -   * will pull and ack messages using API methods.
    -   * 
    - * - * .google.pubsub.v1.PushConfig push_config = 4; - * - * @return Whether the pushConfig field is set. - */ - @java.lang.Override - public boolean hasPushConfig() { - return pushConfig_ != null; - } - /** - * - * - *
    -   * If push delivery is used with this subscription, this field is
    -   * used to configure it. An empty `pushConfig` signifies that the subscriber
    -   * will pull and ack messages using API methods.
    -   * 
    - * - * .google.pubsub.v1.PushConfig push_config = 4; - * - * @return The pushConfig. - */ - @java.lang.Override - public com.google.pubsub.v1.PushConfig getPushConfig() { - return pushConfig_ == null ? com.google.pubsub.v1.PushConfig.getDefaultInstance() : pushConfig_; - } - /** - * - * - *
    -   * If push delivery is used with this subscription, this field is
    -   * used to configure it. An empty `pushConfig` signifies that the subscriber
    -   * will pull and ack messages using API methods.
    -   * 
    - * - * .google.pubsub.v1.PushConfig push_config = 4; - */ - @java.lang.Override - public com.google.pubsub.v1.PushConfigOrBuilder getPushConfigOrBuilder() { - return getPushConfig(); - } + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "AnalyticsHubSubscriptionInfo"); + } - public static final int ACK_DEADLINE_SECONDS_FIELD_NUMBER = 5; - private int ackDeadlineSeconds_; - /** - * - * - *
    -   * The approximate amount of time (on a best-effort basis) Pub/Sub waits for
    -   * the subscriber to acknowledge receipt before resending the message. In the
    -   * interval after the message is delivered and before it is acknowledged, it
    -   * is considered to be <i>outstanding</i>. During that time period, the
    -   * message will not be redelivered (on a best-effort basis).
    -   * For pull subscriptions, this value is used as the initial value for the ack
    -   * deadline. To override this value for a given message, call
    -   * `ModifyAckDeadline` with the corresponding `ack_id` if using
    -   * non-streaming pull or send the `ack_id` in a
    -   * `StreamingModifyAckDeadlineRequest` if using streaming pull.
    -   * The minimum custom deadline you can specify is 10 seconds.
    -   * The maximum custom deadline you can specify is 600 seconds (10 minutes).
    -   * If this parameter is 0, a default value of 10 seconds is used.
    -   * For push delivery, this value is also used to set the request timeout for
    -   * the call to the push endpoint.
    -   * If the subscriber never acknowledges the message, the Pub/Sub
    -   * system will eventually redeliver the message.
    -   * 
    - * - * int32 ack_deadline_seconds = 5; - * - * @return The ackDeadlineSeconds. - */ - @java.lang.Override - public int getAckDeadlineSeconds() { - return ackDeadlineSeconds_; - } + // Use AnalyticsHubSubscriptionInfo.newBuilder() to construct. + private AnalyticsHubSubscriptionInfo(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } - public static final int RETAIN_ACKED_MESSAGES_FIELD_NUMBER = 7; - private boolean retainAckedMessages_; - /** - * - * - *
    -   * Indicates whether to retain acknowledged messages. If true, then
    -   * messages are not expunged from the subscription's backlog, even if they are
    -   * acknowledged, until they fall out of the `message_retention_duration`
    -   * window. This must be true if you would like to [Seek to a timestamp]
    -   * (https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time).
    -   * 
    - * - * bool retain_acked_messages = 7; - * - * @return The retainAckedMessages. - */ - @java.lang.Override - public boolean getRetainAckedMessages() { - return retainAckedMessages_; - } + private AnalyticsHubSubscriptionInfo() { + listing_ = ""; + subscription_ = ""; + } - public static final int MESSAGE_RETENTION_DURATION_FIELD_NUMBER = 8; - private com.google.protobuf.Duration messageRetentionDuration_; - /** - * - * - *
    -   * How long to retain unacknowledged messages in the subscription's backlog,
    -   * from the moment a message is published.
    -   * If `retain_acked_messages` is true, then this also configures the retention
    -   * of acknowledged messages, and thus configures how far back in time a `Seek`
    -   * can be done. Defaults to 7 days. Cannot be more than 7 days or less than 10
    -   * minutes.
    -   * 
    - * - * .google.protobuf.Duration message_retention_duration = 8; - * - * @return Whether the messageRetentionDuration field is set. - */ - @java.lang.Override - public boolean hasMessageRetentionDuration() { - return messageRetentionDuration_ != null; - } - /** - * - * - *
    -   * How long to retain unacknowledged messages in the subscription's backlog,
    -   * from the moment a message is published.
    -   * If `retain_acked_messages` is true, then this also configures the retention
    -   * of acknowledged messages, and thus configures how far back in time a `Seek`
    -   * can be done. Defaults to 7 days. Cannot be more than 7 days or less than 10
    -   * minutes.
    -   * 
    - * - * .google.protobuf.Duration message_retention_duration = 8; - * - * @return The messageRetentionDuration. - */ - @java.lang.Override - public com.google.protobuf.Duration getMessageRetentionDuration() { - return messageRetentionDuration_ == null - ? com.google.protobuf.Duration.getDefaultInstance() - : messageRetentionDuration_; - } - /** - * - * - *
    -   * How long to retain unacknowledged messages in the subscription's backlog,
    -   * from the moment a message is published.
    -   * If `retain_acked_messages` is true, then this also configures the retention
    -   * of acknowledged messages, and thus configures how far back in time a `Seek`
    -   * can be done. Defaults to 7 days. Cannot be more than 7 days or less than 10
    -   * minutes.
    -   * 
    - * - * .google.protobuf.Duration message_retention_duration = 8; - */ - @java.lang.Override - public com.google.protobuf.DurationOrBuilder getMessageRetentionDurationOrBuilder() { - return getMessageRetentionDuration(); - } + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_Subscription_AnalyticsHubSubscriptionInfo_descriptor; + } - public static final int LABELS_FIELD_NUMBER = 9; + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_Subscription_AnalyticsHubSubscriptionInfo_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo.class, + com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo.Builder.class); + } - private static final class LabelsDefaultEntryHolder { - static final com.google.protobuf.MapEntry defaultEntry = - com.google.protobuf.MapEntry.newDefaultInstance( - com.google.pubsub.v1.PubsubProto - .internal_static_google_pubsub_v1_Subscription_LabelsEntry_descriptor, - com.google.protobuf.WireFormat.FieldType.STRING, - "", - com.google.protobuf.WireFormat.FieldType.STRING, - ""); - } + public static final int LISTING_FIELD_NUMBER = 1; - private com.google.protobuf.MapField labels_; + @SuppressWarnings("serial") + private volatile java.lang.Object listing_ = ""; - private com.google.protobuf.MapField internalGetLabels() { - if (labels_ == null) { - return com.google.protobuf.MapField.emptyMapField(LabelsDefaultEntryHolder.defaultEntry); + /** + * + * + *
    +     * 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, (.google.api.resource_reference) = { ... } + * + * + * @return The listing. + */ + @java.lang.Override + public java.lang.String getListing() { + java.lang.Object ref = listing_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + listing_ = s; + return s; + } } - return labels_; - } - public int getLabelsCount() { - return internalGetLabels().getMap().size(); - } - /** - * - * - *
    -   * See <a href="https://cloud.google.com/pubsub/docs/labels"> Creating and
    -   * managing labels</a>.
    -   * 
    - * - * map<string, string> labels = 9; - */ - @java.lang.Override - public boolean containsLabels(java.lang.String key) { - if (key == null) { - throw new java.lang.NullPointerException(); - } - return internalGetLabels().getMap().containsKey(key); - } - /** Use {@link #getLabelsMap()} instead. */ - @java.lang.Override - @java.lang.Deprecated - public java.util.Map getLabels() { - return getLabelsMap(); - } - /** - * - * - *
    -   * See <a href="https://cloud.google.com/pubsub/docs/labels"> Creating and
    -   * managing labels</a>.
    -   * 
    - * - * map<string, string> labels = 9; - */ - @java.lang.Override - public java.util.Map getLabelsMap() { - return internalGetLabels().getMap(); - } - /** - * - * - *
    -   * See <a href="https://cloud.google.com/pubsub/docs/labels"> Creating and
    -   * managing labels</a>.
    -   * 
    - * - * map<string, string> labels = 9; - */ - @java.lang.Override - public java.lang.String getLabelsOrDefault(java.lang.String key, java.lang.String defaultValue) { - if (key == null) { - throw new java.lang.NullPointerException(); - } - java.util.Map map = internalGetLabels().getMap(); - return map.containsKey(key) ? map.get(key) : defaultValue; - } - /** - * - * - *
    -   * See <a href="https://cloud.google.com/pubsub/docs/labels"> Creating and
    -   * managing labels</a>.
    -   * 
    - * - * map<string, string> labels = 9; - */ - @java.lang.Override - public java.lang.String getLabelsOrThrow(java.lang.String key) { - if (key == null) { - throw new java.lang.NullPointerException(); - } - java.util.Map map = internalGetLabels().getMap(); - if (!map.containsKey(key)) { - throw new java.lang.IllegalArgumentException(); + /** + * + * + *
    +     * 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, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for listing. + */ + @java.lang.Override + public com.google.protobuf.ByteString getListingBytes() { + java.lang.Object ref = listing_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + listing_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } } - return map.get(key); - } - public static final int ENABLE_MESSAGE_ORDERING_FIELD_NUMBER = 10; - private boolean enableMessageOrdering_; - /** - * - * - *
    -   * If true, messages published with the same `ordering_key` in `PubsubMessage`
    -   * will be delivered to the subscribers in the order in which they
    -   * are received by the Pub/Sub system. Otherwise, they may be delivered in
    -   * any order.
    -   * 
    - * - * bool enable_message_ordering = 10; - * - * @return The enableMessageOrdering. - */ - @java.lang.Override - public boolean getEnableMessageOrdering() { - return enableMessageOrdering_; + public static final int SUBSCRIPTION_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private volatile java.lang.Object subscription_ = ""; + + /** + * + * + *
    +     * Optional. The name of the associated Analytics Hub subscription resource.
    +     * Pattern:
    +     * "projects/{project}/locations/{location}/subscriptions/{subscription}"
    +     * 
    + * + * string subscription = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The subscription. + */ + @java.lang.Override + public java.lang.String getSubscription() { + java.lang.Object ref = subscription_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + subscription_ = s; + return s; + } + } + + /** + * + * + *
    +     * Optional. The name of the associated Analytics Hub subscription resource.
    +     * Pattern:
    +     * "projects/{project}/locations/{location}/subscriptions/{subscription}"
    +     * 
    + * + * string subscription = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for subscription. + */ + @java.lang.Override + public com.google.protobuf.ByteString getSubscriptionBytes() { + java.lang.Object ref = subscription_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + subscription_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(listing_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, listing_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(subscription_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, subscription_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(listing_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, listing_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(subscription_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, subscription_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo)) { + return super.equals(obj); + } + com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo other = + (com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo) obj; + + if (!getListing().equals(other.getListing())) return false; + if (!getSubscription().equals(other.getSubscription())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + LISTING_FIELD_NUMBER; + hash = (53 * hash) + getListing().hashCode(); + hash = (37 * hash) + SUBSCRIPTION_FIELD_NUMBER; + hash = (53 * hash) + getSubscription().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo parseFrom( + byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + + /** + * + * + *
    +     * Information about an associated [Analytics Hub
    +     * subscription](https://cloud.google.com/bigquery/docs/analytics-hub-manage-subscriptions).
    +     * 
    + * + * Protobuf type {@code google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder + implements + // @@protoc_insertion_point(builder_implements:google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo) + com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfoOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_Subscription_AnalyticsHubSubscriptionInfo_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_Subscription_AnalyticsHubSubscriptionInfo_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo.class, + com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo.Builder.class); + } + + // Construct using com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + listing_ = ""; + subscription_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_Subscription_AnalyticsHubSubscriptionInfo_descriptor; + } + + @java.lang.Override + public com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo + getDefaultInstanceForType() { + return com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo.getDefaultInstance(); + } + + @java.lang.Override + public com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo build() { + com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo buildPartial() { + com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo result = + new com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0( + com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.listing_ = listing_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.subscription_ = subscription_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo) { + return mergeFrom((com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo other) { + if (other + == com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo.getDefaultInstance()) + return this; + if (!other.getListing().isEmpty()) { + listing_ = other.listing_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getSubscription().isEmpty()) { + subscription_ = other.subscription_; + bitField0_ |= 0x00000002; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + listing_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + subscription_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.lang.Object listing_ = ""; + + /** + * + * + *
    +       * 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, (.google.api.resource_reference) = { ... } + * + * + * @return The listing. + */ + public java.lang.String getListing() { + java.lang.Object ref = listing_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + listing_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +       * 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, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for listing. + */ + public com.google.protobuf.ByteString getListingBytes() { + java.lang.Object ref = listing_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + listing_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +       * 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, (.google.api.resource_reference) = { ... } + * + * + * @param value The listing to set. + * @return This builder for chaining. + */ + public Builder setListing(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + listing_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + /** + * + * + *
    +       * 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, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearListing() { + listing_ = getDefaultInstance().getListing(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + + /** + * + * + *
    +       * 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, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for listing to set. + * @return This builder for chaining. + */ + public Builder setListingBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + listing_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object subscription_ = ""; + + /** + * + * + *
    +       * Optional. The name of the associated Analytics Hub subscription resource.
    +       * Pattern:
    +       * "projects/{project}/locations/{location}/subscriptions/{subscription}"
    +       * 
    + * + * string subscription = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The subscription. + */ + public java.lang.String getSubscription() { + java.lang.Object ref = subscription_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + subscription_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +       * Optional. The name of the associated Analytics Hub subscription resource.
    +       * Pattern:
    +       * "projects/{project}/locations/{location}/subscriptions/{subscription}"
    +       * 
    + * + * string subscription = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for subscription. + */ + public com.google.protobuf.ByteString getSubscriptionBytes() { + java.lang.Object ref = subscription_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + subscription_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +       * Optional. The name of the associated Analytics Hub subscription resource.
    +       * Pattern:
    +       * "projects/{project}/locations/{location}/subscriptions/{subscription}"
    +       * 
    + * + * string subscription = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The subscription to set. + * @return This builder for chaining. + */ + public Builder setSubscription(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + subscription_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. The name of the associated Analytics Hub subscription resource.
    +       * Pattern:
    +       * "projects/{project}/locations/{location}/subscriptions/{subscription}"
    +       * 
    + * + * string subscription = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearSubscription() { + subscription_ = getDefaultInstance().getSubscription(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + + /** + * + * + *
    +       * Optional. The name of the associated Analytics Hub subscription resource.
    +       * Pattern:
    +       * "projects/{project}/locations/{location}/subscriptions/{subscription}"
    +       * 
    + * + * string subscription = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for subscription to set. + * @return This builder for chaining. + */ + public Builder setSubscriptionBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + subscription_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo) + } + + // @@protoc_insertion_point(class_scope:google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo) + private static final com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo(); + } + + public static com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AnalyticsHubSubscriptionInfo parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException() + .setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } } - public static final int EXPIRATION_POLICY_FIELD_NUMBER = 11; - private com.google.pubsub.v1.ExpirationPolicy expirationPolicy_; + private int bitField0_; + public static final int NAME_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; + /** * * *
    -   * A policy that specifies the conditions for this subscription's expiration.
    -   * A subscription is considered active as long as any connected subscriber is
    -   * successfully consuming messages from the subscription or is issuing
    -   * operations on the subscription. If `expiration_policy` is not set, a
    -   * *default policy* with `ttl` of 31 days will be used. The minimum allowed
    -   * value for `expiration_policy.ttl` is 1 day.
    +   * Required. Identifier. The name of the subscription. It must have the format
    +   * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must
    +   * start with a letter, and contain only letters (`[A-Za-z]`), numbers
    +   * (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`),
    +   * plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters
    +   * in length, and it must not start with `"goog"`.
        * 
    * - * .google.pubsub.v1.ExpirationPolicy expiration_policy = 11; + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IDENTIFIER]; + * * - * @return Whether the expirationPolicy field is set. + * @return The name. */ @java.lang.Override - public boolean hasExpirationPolicy() { - return expirationPolicy_ != null; + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } } + /** * * *
    -   * A policy that specifies the conditions for this subscription's expiration.
    -   * A subscription is considered active as long as any connected subscriber is
    -   * successfully consuming messages from the subscription or is issuing
    -   * operations on the subscription. If `expiration_policy` is not set, a
    -   * *default policy* with `ttl` of 31 days will be used. The minimum allowed
    -   * value for `expiration_policy.ttl` is 1 day.
    +   * Required. Identifier. The name of the subscription. It must have the format
    +   * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must
    +   * start with a letter, and contain only letters (`[A-Za-z]`), numbers
    +   * (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`),
    +   * plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters
    +   * in length, and it must not start with `"goog"`.
        * 
    * - * .google.pubsub.v1.ExpirationPolicy expiration_policy = 11; - * - * @return The expirationPolicy. - */ - @java.lang.Override - public com.google.pubsub.v1.ExpirationPolicy getExpirationPolicy() { - return expirationPolicy_ == null - ? com.google.pubsub.v1.ExpirationPolicy.getDefaultInstance() - : expirationPolicy_; - } - /** - * - * - *
    -   * A policy that specifies the conditions for this subscription's expiration.
    -   * A subscription is considered active as long as any connected subscriber is
    -   * successfully consuming messages from the subscription or is issuing
    -   * operations on the subscription. If `expiration_policy` is not set, a
    -   * *default policy* with `ttl` of 31 days will be used. The minimum allowed
    -   * value for `expiration_policy.ttl` is 1 day.
    -   * 
    + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IDENTIFIER]; + * * - * .google.pubsub.v1.ExpirationPolicy expiration_policy = 11; + * @return The bytes for name. */ @java.lang.Override - public com.google.pubsub.v1.ExpirationPolicyOrBuilder getExpirationPolicyOrBuilder() { - return getExpirationPolicy(); + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } } - public static final int FILTER_FIELD_NUMBER = 12; - private volatile java.lang.Object filter_; + public static final int TOPIC_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private volatile java.lang.Object topic_ = ""; + /** * * *
    -   * An expression written in the Pub/Sub [filter
    -   * language](https://cloud.google.com/pubsub/docs/filtering). If non-empty,
    -   * then only `PubsubMessage`s whose `attributes` field matches the filter are
    -   * delivered on this subscription. If empty, then no messages are filtered
    -   * out.
    +   * Required. The name of the topic from which this subscription is receiving
    +   * messages. Format is `projects/{project}/topics/{topic}`. The value of this
    +   * field will be `_deleted-topic_` if the topic has been deleted.
        * 
    * - * string filter = 12; + * + * string topic = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * * - * @return The filter. + * @return The topic. */ @java.lang.Override - public java.lang.String getFilter() { - java.lang.Object ref = filter_; + public java.lang.String getTopic() { + java.lang.Object ref = topic_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); - filter_ = s; + topic_ = s; return s; } } + /** * * *
    -   * An expression written in the Pub/Sub [filter
    -   * language](https://cloud.google.com/pubsub/docs/filtering). If non-empty,
    -   * then only `PubsubMessage`s whose `attributes` field matches the filter are
    -   * delivered on this subscription. If empty, then no messages are filtered
    -   * out.
    +   * Required. The name of the topic from which this subscription is receiving
    +   * messages. Format is `projects/{project}/topics/{topic}`. The value of this
    +   * field will be `_deleted-topic_` if the topic has been deleted.
        * 
    * - * string filter = 12; + * + * string topic = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * * - * @return The bytes for filter. + * @return The bytes for topic. */ @java.lang.Override - public com.google.protobuf.ByteString getFilterBytes() { - java.lang.Object ref = filter_; + public com.google.protobuf.ByteString getTopicBytes() { + java.lang.Object ref = topic_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - filter_ = b; + topic_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } - public static final int DEAD_LETTER_POLICY_FIELD_NUMBER = 13; - private com.google.pubsub.v1.DeadLetterPolicy deadLetterPolicy_; + public static final int PUSH_CONFIG_FIELD_NUMBER = 4; + private com.google.pubsub.v1.PushConfig pushConfig_; + /** * * *
    -   * A policy that specifies the conditions for dead lettering messages in
    -   * this subscription. If dead_letter_policy is not set, dead lettering
    -   * is disabled.
    -   * The Cloud Pub/Sub service account associated with this subscriptions's
    -   * parent project (i.e.,
    -   * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
    -   * permission to Acknowledge() messages on this subscription.
    +   * Optional. If push delivery is used with this subscription, this field is
    +   * used to configure it.
        * 
    * - * .google.pubsub.v1.DeadLetterPolicy dead_letter_policy = 13; + * .google.pubsub.v1.PushConfig push_config = 4 [(.google.api.field_behavior) = OPTIONAL]; + * * - * @return Whether the deadLetterPolicy field is set. + * @return Whether the pushConfig field is set. */ @java.lang.Override - public boolean hasDeadLetterPolicy() { - return deadLetterPolicy_ != null; + public boolean hasPushConfig() { + return ((bitField0_ & 0x00000001) != 0); } + /** * * *
    -   * A policy that specifies the conditions for dead lettering messages in
    -   * this subscription. If dead_letter_policy is not set, dead lettering
    -   * is disabled.
    -   * The Cloud Pub/Sub service account associated with this subscriptions's
    -   * parent project (i.e.,
    -   * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
    -   * permission to Acknowledge() messages on this subscription.
    +   * Optional. If push delivery is used with this subscription, this field is
    +   * used to configure it.
        * 
    * - * .google.pubsub.v1.DeadLetterPolicy dead_letter_policy = 13; + * .google.pubsub.v1.PushConfig push_config = 4 [(.google.api.field_behavior) = OPTIONAL]; + * * - * @return The deadLetterPolicy. + * @return The pushConfig. */ @java.lang.Override - public com.google.pubsub.v1.DeadLetterPolicy getDeadLetterPolicy() { - return deadLetterPolicy_ == null - ? com.google.pubsub.v1.DeadLetterPolicy.getDefaultInstance() - : deadLetterPolicy_; + public com.google.pubsub.v1.PushConfig getPushConfig() { + return pushConfig_ == null ? com.google.pubsub.v1.PushConfig.getDefaultInstance() : pushConfig_; } + /** * * *
    -   * A policy that specifies the conditions for dead lettering messages in
    -   * this subscription. If dead_letter_policy is not set, dead lettering
    -   * is disabled.
    -   * The Cloud Pub/Sub service account associated with this subscriptions's
    -   * parent project (i.e.,
    -   * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
    -   * permission to Acknowledge() messages on this subscription.
    +   * Optional. If push delivery is used with this subscription, this field is
    +   * used to configure it.
        * 
    * - * .google.pubsub.v1.DeadLetterPolicy dead_letter_policy = 13; + * .google.pubsub.v1.PushConfig push_config = 4 [(.google.api.field_behavior) = OPTIONAL]; + * */ @java.lang.Override - public com.google.pubsub.v1.DeadLetterPolicyOrBuilder getDeadLetterPolicyOrBuilder() { - return getDeadLetterPolicy(); + public com.google.pubsub.v1.PushConfigOrBuilder getPushConfigOrBuilder() { + return pushConfig_ == null ? com.google.pubsub.v1.PushConfig.getDefaultInstance() : pushConfig_; } - public static final int RETRY_POLICY_FIELD_NUMBER = 14; - private com.google.pubsub.v1.RetryPolicy retryPolicy_; + public static final int BIGQUERY_CONFIG_FIELD_NUMBER = 18; + private com.google.pubsub.v1.BigQueryConfig bigqueryConfig_; + /** * * *
    -   * A policy that specifies how Pub/Sub retries message delivery for this
    -   * subscription.
    -   * If not set, the default retry policy is applied. This generally implies
    -   * that messages will be retried as soon as possible for healthy subscribers.
    -   * RetryPolicy will be triggered on NACKs or acknowledgement deadline
    -   * exceeded events for a given message.
    +   * Optional. If delivery to BigQuery is used with this subscription, this
    +   * field is used to configure it.
        * 
    * - * .google.pubsub.v1.RetryPolicy retry_policy = 14; + * + * .google.pubsub.v1.BigQueryConfig bigquery_config = 18 [(.google.api.field_behavior) = OPTIONAL]; + * * - * @return Whether the retryPolicy field is set. + * @return Whether the bigqueryConfig field is set. */ @java.lang.Override - public boolean hasRetryPolicy() { - return retryPolicy_ != null; + public boolean hasBigqueryConfig() { + return ((bitField0_ & 0x00000002) != 0); } + /** * * *
    -   * A policy that specifies how Pub/Sub retries message delivery for this
    -   * subscription.
    -   * If not set, the default retry policy is applied. This generally implies
    -   * that messages will be retried as soon as possible for healthy subscribers.
    -   * RetryPolicy will be triggered on NACKs or acknowledgement deadline
    -   * exceeded events for a given message.
    +   * Optional. If delivery to BigQuery is used with this subscription, this
    +   * field is used to configure it.
        * 
    * - * .google.pubsub.v1.RetryPolicy retry_policy = 14; + * + * .google.pubsub.v1.BigQueryConfig bigquery_config = 18 [(.google.api.field_behavior) = OPTIONAL]; + * * - * @return The retryPolicy. + * @return The bigqueryConfig. */ @java.lang.Override - public com.google.pubsub.v1.RetryPolicy getRetryPolicy() { - return retryPolicy_ == null - ? com.google.pubsub.v1.RetryPolicy.getDefaultInstance() - : retryPolicy_; + public com.google.pubsub.v1.BigQueryConfig getBigqueryConfig() { + return bigqueryConfig_ == null + ? com.google.pubsub.v1.BigQueryConfig.getDefaultInstance() + : bigqueryConfig_; } + /** * * *
    -   * A policy that specifies how Pub/Sub retries message delivery for this
    -   * subscription.
    -   * If not set, the default retry policy is applied. This generally implies
    -   * that messages will be retried as soon as possible for healthy subscribers.
    -   * RetryPolicy will be triggered on NACKs or acknowledgement deadline
    -   * exceeded events for a given message.
    +   * Optional. If delivery to BigQuery is used with this subscription, this
    +   * field is used to configure it.
        * 
    * - * .google.pubsub.v1.RetryPolicy retry_policy = 14; + * + * .google.pubsub.v1.BigQueryConfig bigquery_config = 18 [(.google.api.field_behavior) = OPTIONAL]; + * */ @java.lang.Override - public com.google.pubsub.v1.RetryPolicyOrBuilder getRetryPolicyOrBuilder() { - return getRetryPolicy(); + public com.google.pubsub.v1.BigQueryConfigOrBuilder getBigqueryConfigOrBuilder() { + return bigqueryConfig_ == null + ? com.google.pubsub.v1.BigQueryConfig.getDefaultInstance() + : bigqueryConfig_; + } + + public static final int CLOUD_STORAGE_CONFIG_FIELD_NUMBER = 22; + private com.google.pubsub.v1.CloudStorageConfig cloudStorageConfig_; + + /** + * + * + *
    +   * Optional. If delivery to Google Cloud Storage is used with this
    +   * subscription, this field is used to configure it.
    +   * 
    + * + * + * .google.pubsub.v1.CloudStorageConfig cloud_storage_config = 22 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the cloudStorageConfig field is set. + */ + @java.lang.Override + public boolean hasCloudStorageConfig() { + return ((bitField0_ & 0x00000004) != 0); + } + + /** + * + * + *
    +   * Optional. If delivery to Google Cloud Storage is used with this
    +   * subscription, this field is used to configure it.
    +   * 
    + * + * + * .google.pubsub.v1.CloudStorageConfig cloud_storage_config = 22 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The cloudStorageConfig. + */ + @java.lang.Override + public com.google.pubsub.v1.CloudStorageConfig getCloudStorageConfig() { + return cloudStorageConfig_ == null + ? com.google.pubsub.v1.CloudStorageConfig.getDefaultInstance() + : cloudStorageConfig_; + } + + /** + * + * + *
    +   * Optional. If delivery to Google Cloud Storage is used with this
    +   * subscription, this field is used to configure it.
    +   * 
    + * + * + * .google.pubsub.v1.CloudStorageConfig cloud_storage_config = 22 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.CloudStorageConfigOrBuilder getCloudStorageConfigOrBuilder() { + return cloudStorageConfig_ == null + ? com.google.pubsub.v1.CloudStorageConfig.getDefaultInstance() + : cloudStorageConfig_; + } + + public static final int BIGTABLE_CONFIG_FIELD_NUMBER = 27; + private com.google.pubsub.v1.BigtableConfig bigtableConfig_; + + /** + * + * + *
    +   * Optional. If delivery to Bigtable is used with this subscription, this
    +   * field is used to configure it.
    +   * 
    + * + * + * .google.pubsub.v1.BigtableConfig bigtable_config = 27 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the bigtableConfig field is set. + */ + @java.lang.Override + public boolean hasBigtableConfig() { + return ((bitField0_ & 0x00000008) != 0); + } + + /** + * + * + *
    +   * Optional. If delivery to Bigtable is used with this subscription, this
    +   * field is used to configure it.
    +   * 
    + * + * + * .google.pubsub.v1.BigtableConfig bigtable_config = 27 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The bigtableConfig. + */ + @java.lang.Override + public com.google.pubsub.v1.BigtableConfig getBigtableConfig() { + return bigtableConfig_ == null + ? com.google.pubsub.v1.BigtableConfig.getDefaultInstance() + : bigtableConfig_; + } + + /** + * + * + *
    +   * Optional. If delivery to Bigtable is used with this subscription, this
    +   * field is used to configure it.
    +   * 
    + * + * + * .google.pubsub.v1.BigtableConfig bigtable_config = 27 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.BigtableConfigOrBuilder getBigtableConfigOrBuilder() { + return bigtableConfig_ == null + ? com.google.pubsub.v1.BigtableConfig.getDefaultInstance() + : bigtableConfig_; + } + + public static final int ACK_DEADLINE_SECONDS_FIELD_NUMBER = 5; + private int ackDeadlineSeconds_ = 0; + + /** + * + * + *
    +   * Optional. The approximate amount of time (on a best-effort basis) Pub/Sub
    +   * waits for the subscriber to acknowledge receipt before resending the
    +   * message. In the interval after the message is delivered and before it is
    +   * acknowledged, it is considered to be _outstanding_. During that time
    +   * period, the message will not be redelivered (on a best-effort basis).
    +   *
    +   * For pull subscriptions, this value is used as the initial value for the ack
    +   * deadline. To override this value for a given message, call
    +   * `ModifyAckDeadline` with the corresponding `ack_id` if using
    +   * non-streaming pull or send the `ack_id` in a
    +   * `StreamingModifyAckDeadlineRequest` if using streaming pull.
    +   * The minimum custom deadline you can specify is 10 seconds.
    +   * The maximum custom deadline you can specify is 600 seconds (10 minutes).
    +   * If this parameter is 0, a default value of 10 seconds is used.
    +   *
    +   * For push delivery, this value is also used to set the request timeout for
    +   * the call to the push endpoint.
    +   *
    +   * If the subscriber never acknowledges the message, the Pub/Sub
    +   * system will eventually redeliver the message.
    +   * 
    + * + * int32 ack_deadline_seconds = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The ackDeadlineSeconds. + */ + @java.lang.Override + public int getAckDeadlineSeconds() { + return ackDeadlineSeconds_; } - public static final int DETACHED_FIELD_NUMBER = 15; - private boolean detached_; - /** - * - * - *
    -   * Indicates whether the subscription is detached from its topic. Detached
    -   * subscriptions don't receive messages from their topic and don't retain any
    -   * backlog. `Pull` and `StreamingPull` requests will return
    -   * FAILED_PRECONDITION. If the subscription is a push subscription, pushes to
    -   * the endpoint will not be made.
    -   * 
    - * - * bool detached = 15; - * - * @return The detached. - */ - @java.lang.Override - public boolean getDetached() { - return detached_; - } + public static final int RETAIN_ACKED_MESSAGES_FIELD_NUMBER = 7; + private boolean retainAckedMessages_ = false; + + /** + * + * + *
    +   * Optional. Indicates whether to retain acknowledged messages. If true, then
    +   * messages are not expunged from the subscription's backlog, even if they are
    +   * acknowledged, until they fall out of the `message_retention_duration`
    +   * window. This must be true if you would like to [`Seek` to a timestamp]
    +   * (https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time) in
    +   * the past to replay previously-acknowledged messages.
    +   * 
    + * + * bool retain_acked_messages = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The retainAckedMessages. + */ + @java.lang.Override + public boolean getRetainAckedMessages() { + return retainAckedMessages_; + } + + public static final int MESSAGE_RETENTION_DURATION_FIELD_NUMBER = 8; + private com.google.protobuf.Duration messageRetentionDuration_; + + /** + * + * + *
    +   * Optional. How long to retain unacknowledged messages in the subscription's
    +   * backlog, from the moment a message is published. If `retain_acked_messages`
    +   * is true, then this also configures the retention of acknowledged messages,
    +   * and thus configures how far back in time a `Seek` can be done. Defaults to
    +   * 7 days. Cannot be more than 31 days or less than 10 minutes.
    +   * 
    + * + * + * .google.protobuf.Duration message_retention_duration = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the messageRetentionDuration field is set. + */ + @java.lang.Override + public boolean hasMessageRetentionDuration() { + return ((bitField0_ & 0x00000010) != 0); + } + + /** + * + * + *
    +   * Optional. How long to retain unacknowledged messages in the subscription's
    +   * backlog, from the moment a message is published. If `retain_acked_messages`
    +   * is true, then this also configures the retention of acknowledged messages,
    +   * and thus configures how far back in time a `Seek` can be done. Defaults to
    +   * 7 days. Cannot be more than 31 days or less than 10 minutes.
    +   * 
    + * + * + * .google.protobuf.Duration message_retention_duration = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The messageRetentionDuration. + */ + @java.lang.Override + public com.google.protobuf.Duration getMessageRetentionDuration() { + return messageRetentionDuration_ == null + ? com.google.protobuf.Duration.getDefaultInstance() + : messageRetentionDuration_; + } + + /** + * + * + *
    +   * Optional. How long to retain unacknowledged messages in the subscription's
    +   * backlog, from the moment a message is published. If `retain_acked_messages`
    +   * is true, then this also configures the retention of acknowledged messages,
    +   * and thus configures how far back in time a `Seek` can be done. Defaults to
    +   * 7 days. Cannot be more than 31 days or less than 10 minutes.
    +   * 
    + * + * + * .google.protobuf.Duration message_retention_duration = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.protobuf.DurationOrBuilder getMessageRetentionDurationOrBuilder() { + return messageRetentionDuration_ == null + ? com.google.protobuf.Duration.getDefaultInstance() + : messageRetentionDuration_; + } + + public static final int LABELS_FIELD_NUMBER = 9; + + private static final class LabelsDefaultEntryHolder { + static final com.google.protobuf.MapEntry defaultEntry = + com.google.protobuf.MapEntry.newDefaultInstance( + com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_Subscription_LabelsEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.STRING, + ""); + } + + @SuppressWarnings("serial") + private com.google.protobuf.MapField labels_; + + private com.google.protobuf.MapField internalGetLabels() { + if (labels_ == null) { + return com.google.protobuf.MapField.emptyMapField(LabelsDefaultEntryHolder.defaultEntry); + } + return labels_; + } + + public int getLabelsCount() { + return internalGetLabels().getMap().size(); + } + + /** + * + * + *
    +   * Optional. See [Creating and managing
    +   * labels](https://cloud.google.com/pubsub/docs/labels).
    +   * 
    + * + * map<string, string> labels = 9 [(.google.api.field_behavior) = OPTIONAL]; + */ + @java.lang.Override + public boolean containsLabels(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetLabels().getMap().containsKey(key); + } + + /** Use {@link #getLabelsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getLabels() { + return getLabelsMap(); + } + + /** + * + * + *
    +   * Optional. See [Creating and managing
    +   * labels](https://cloud.google.com/pubsub/docs/labels).
    +   * 
    + * + * map<string, string> labels = 9 [(.google.api.field_behavior) = OPTIONAL]; + */ + @java.lang.Override + public java.util.Map getLabelsMap() { + return internalGetLabels().getMap(); + } + + /** + * + * + *
    +   * Optional. See [Creating and managing
    +   * labels](https://cloud.google.com/pubsub/docs/labels).
    +   * 
    + * + * map<string, string> labels = 9 [(.google.api.field_behavior) = OPTIONAL]; + */ + @java.lang.Override + public /* nullable */ java.lang.String getLabelsOrDefault( + java.lang.String key, + /* nullable */ + java.lang.String defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetLabels().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + + /** + * + * + *
    +   * Optional. See [Creating and managing
    +   * labels](https://cloud.google.com/pubsub/docs/labels).
    +   * 
    + * + * map<string, string> labels = 9 [(.google.api.field_behavior) = OPTIONAL]; + */ + @java.lang.Override + public java.lang.String getLabelsOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetLabels().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public static final int ENABLE_MESSAGE_ORDERING_FIELD_NUMBER = 10; + private boolean enableMessageOrdering_ = false; + + /** + * + * + *
    +   * Optional. If true, messages published with the same `ordering_key` in
    +   * `PubsubMessage` will be delivered to the subscribers in the order in which
    +   * they are received by the Pub/Sub system. Otherwise, they may be delivered
    +   * in any order.
    +   * 
    + * + * bool enable_message_ordering = 10 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The enableMessageOrdering. + */ + @java.lang.Override + public boolean getEnableMessageOrdering() { + return enableMessageOrdering_; + } + + public static final int EXPIRATION_POLICY_FIELD_NUMBER = 11; + private com.google.pubsub.v1.ExpirationPolicy expirationPolicy_; + + /** + * + * + *
    +   * Optional. A policy that specifies the conditions for this subscription's
    +   * expiration. A subscription is considered active as long as any connected
    +   * subscriber is successfully consuming messages from the subscription or is
    +   * issuing operations on the subscription. If `expiration_policy` is not set,
    +   * a *default policy* with `ttl` of 31 days will be used. The minimum allowed
    +   * value for `expiration_policy.ttl` is 1 day. If `expiration_policy` is set,
    +   * but `expiration_policy.ttl` is not set, the subscription never expires.
    +   * 
    + * + * + * .google.pubsub.v1.ExpirationPolicy expiration_policy = 11 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the expirationPolicy field is set. + */ + @java.lang.Override + public boolean hasExpirationPolicy() { + return ((bitField0_ & 0x00000020) != 0); + } + + /** + * + * + *
    +   * Optional. A policy that specifies the conditions for this subscription's
    +   * expiration. A subscription is considered active as long as any connected
    +   * subscriber is successfully consuming messages from the subscription or is
    +   * issuing operations on the subscription. If `expiration_policy` is not set,
    +   * a *default policy* with `ttl` of 31 days will be used. The minimum allowed
    +   * value for `expiration_policy.ttl` is 1 day. If `expiration_policy` is set,
    +   * but `expiration_policy.ttl` is not set, the subscription never expires.
    +   * 
    + * + * + * .google.pubsub.v1.ExpirationPolicy expiration_policy = 11 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The expirationPolicy. + */ + @java.lang.Override + public com.google.pubsub.v1.ExpirationPolicy getExpirationPolicy() { + return expirationPolicy_ == null + ? com.google.pubsub.v1.ExpirationPolicy.getDefaultInstance() + : expirationPolicy_; + } + + /** + * + * + *
    +   * Optional. A policy that specifies the conditions for this subscription's
    +   * expiration. A subscription is considered active as long as any connected
    +   * subscriber is successfully consuming messages from the subscription or is
    +   * issuing operations on the subscription. If `expiration_policy` is not set,
    +   * a *default policy* with `ttl` of 31 days will be used. The minimum allowed
    +   * value for `expiration_policy.ttl` is 1 day. If `expiration_policy` is set,
    +   * but `expiration_policy.ttl` is not set, the subscription never expires.
    +   * 
    + * + * + * .google.pubsub.v1.ExpirationPolicy expiration_policy = 11 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.ExpirationPolicyOrBuilder getExpirationPolicyOrBuilder() { + return expirationPolicy_ == null + ? com.google.pubsub.v1.ExpirationPolicy.getDefaultInstance() + : expirationPolicy_; + } + + public static final int FILTER_FIELD_NUMBER = 12; + + @SuppressWarnings("serial") + private volatile java.lang.Object filter_ = ""; + + /** + * + * + *
    +   * Optional. An expression written in the Pub/Sub [filter
    +   * language](https://cloud.google.com/pubsub/docs/filtering). If non-empty,
    +   * then only `PubsubMessage`s whose `attributes` field matches the filter are
    +   * delivered on this subscription. If empty, then no messages are filtered
    +   * out.
    +   * 
    + * + * string filter = 12 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The filter. + */ + @java.lang.Override + public java.lang.String getFilter() { + java.lang.Object ref = filter_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + filter_ = s; + return s; + } + } + + /** + * + * + *
    +   * Optional. An expression written in the Pub/Sub [filter
    +   * language](https://cloud.google.com/pubsub/docs/filtering). If non-empty,
    +   * then only `PubsubMessage`s whose `attributes` field matches the filter are
    +   * delivered on this subscription. If empty, then no messages are filtered
    +   * out.
    +   * 
    + * + * string filter = 12 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for filter. + */ + @java.lang.Override + public com.google.protobuf.ByteString getFilterBytes() { + java.lang.Object ref = filter_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + filter_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int DEAD_LETTER_POLICY_FIELD_NUMBER = 13; + private com.google.pubsub.v1.DeadLetterPolicy deadLetterPolicy_; + + /** + * + * + *
    +   * Optional. A policy that specifies the conditions for dead lettering
    +   * messages in this subscription. If dead_letter_policy is not set, dead
    +   * lettering is disabled.
    +   *
    +   * The Pub/Sub service account associated with this subscriptions's
    +   * parent project (i.e.,
    +   * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
    +   * permission to Acknowledge() messages on this subscription.
    +   * 
    + * + * + * .google.pubsub.v1.DeadLetterPolicy dead_letter_policy = 13 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the deadLetterPolicy field is set. + */ + @java.lang.Override + public boolean hasDeadLetterPolicy() { + return ((bitField0_ & 0x00000040) != 0); + } + + /** + * + * + *
    +   * Optional. A policy that specifies the conditions for dead lettering
    +   * messages in this subscription. If dead_letter_policy is not set, dead
    +   * lettering is disabled.
    +   *
    +   * The Pub/Sub service account associated with this subscriptions's
    +   * parent project (i.e.,
    +   * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
    +   * permission to Acknowledge() messages on this subscription.
    +   * 
    + * + * + * .google.pubsub.v1.DeadLetterPolicy dead_letter_policy = 13 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The deadLetterPolicy. + */ + @java.lang.Override + public com.google.pubsub.v1.DeadLetterPolicy getDeadLetterPolicy() { + return deadLetterPolicy_ == null + ? com.google.pubsub.v1.DeadLetterPolicy.getDefaultInstance() + : deadLetterPolicy_; + } + + /** + * + * + *
    +   * Optional. A policy that specifies the conditions for dead lettering
    +   * messages in this subscription. If dead_letter_policy is not set, dead
    +   * lettering is disabled.
    +   *
    +   * The Pub/Sub service account associated with this subscriptions's
    +   * parent project (i.e.,
    +   * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
    +   * permission to Acknowledge() messages on this subscription.
    +   * 
    + * + * + * .google.pubsub.v1.DeadLetterPolicy dead_letter_policy = 13 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.DeadLetterPolicyOrBuilder getDeadLetterPolicyOrBuilder() { + return deadLetterPolicy_ == null + ? com.google.pubsub.v1.DeadLetterPolicy.getDefaultInstance() + : deadLetterPolicy_; + } + + public static final int RETRY_POLICY_FIELD_NUMBER = 14; + private com.google.pubsub.v1.RetryPolicy retryPolicy_; + + /** + * + * + *
    +   * Optional. A policy that specifies how Pub/Sub retries message delivery for
    +   * this subscription.
    +   *
    +   * If not set, the default retry policy is applied. This generally implies
    +   * that messages will be retried as soon as possible for healthy subscribers.
    +   * RetryPolicy will be triggered on NACKs or acknowledgment deadline exceeded
    +   * events for a given message.
    +   * 
    + * + * + * .google.pubsub.v1.RetryPolicy retry_policy = 14 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the retryPolicy field is set. + */ + @java.lang.Override + public boolean hasRetryPolicy() { + return ((bitField0_ & 0x00000080) != 0); + } + + /** + * + * + *
    +   * Optional. A policy that specifies how Pub/Sub retries message delivery for
    +   * this subscription.
    +   *
    +   * If not set, the default retry policy is applied. This generally implies
    +   * that messages will be retried as soon as possible for healthy subscribers.
    +   * RetryPolicy will be triggered on NACKs or acknowledgment deadline exceeded
    +   * events for a given message.
    +   * 
    + * + * + * .google.pubsub.v1.RetryPolicy retry_policy = 14 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The retryPolicy. + */ + @java.lang.Override + public com.google.pubsub.v1.RetryPolicy getRetryPolicy() { + return retryPolicy_ == null + ? com.google.pubsub.v1.RetryPolicy.getDefaultInstance() + : retryPolicy_; + } + + /** + * + * + *
    +   * Optional. A policy that specifies how Pub/Sub retries message delivery for
    +   * this subscription.
    +   *
    +   * If not set, the default retry policy is applied. This generally implies
    +   * that messages will be retried as soon as possible for healthy subscribers.
    +   * RetryPolicy will be triggered on NACKs or acknowledgment deadline exceeded
    +   * events for a given message.
    +   * 
    + * + * + * .google.pubsub.v1.RetryPolicy retry_policy = 14 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.RetryPolicyOrBuilder getRetryPolicyOrBuilder() { + return retryPolicy_ == null + ? com.google.pubsub.v1.RetryPolicy.getDefaultInstance() + : retryPolicy_; + } + + public static final int DETACHED_FIELD_NUMBER = 15; + private boolean detached_ = false; + + /** + * + * + *
    +   * Optional. Indicates whether the subscription is detached from its topic.
    +   * Detached subscriptions don't receive messages from their topic and don't
    +   * retain any backlog. `Pull` and `StreamingPull` requests will return
    +   * FAILED_PRECONDITION. If the subscription is a push subscription, pushes to
    +   * the endpoint will not be made.
    +   * 
    + * + * bool detached = 15 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The detached. + */ + @java.lang.Override + public boolean getDetached() { + return detached_; + } + + public static final int ENABLE_EXACTLY_ONCE_DELIVERY_FIELD_NUMBER = 16; + private boolean enableExactlyOnceDelivery_ = false; + + /** + * + * + *
    +   * Optional. If true, Pub/Sub provides the following guarantees for the
    +   * delivery of a message with a given value of `message_id` on this
    +   * subscription:
    +   *
    +   * * The message sent to a subscriber is guaranteed not to be resent
    +   * before the message's acknowledgment deadline expires.
    +   * * An acknowledged message will not be resent to a subscriber.
    +   *
    +   * Note that subscribers may still receive multiple copies of a message
    +   * when `enable_exactly_once_delivery` is true if the message was published
    +   * multiple times by a publisher client. These copies are  considered distinct
    +   * by Pub/Sub and have distinct `message_id` values.
    +   * 
    + * + * bool enable_exactly_once_delivery = 16 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The enableExactlyOnceDelivery. + */ + @java.lang.Override + public boolean getEnableExactlyOnceDelivery() { + return enableExactlyOnceDelivery_; + } + + public static final int TOPIC_MESSAGE_RETENTION_DURATION_FIELD_NUMBER = 17; + private com.google.protobuf.Duration topicMessageRetentionDuration_; + + /** + * + * + *
    +   * Output only. Indicates the minimum duration for which a message is retained
    +   * after it is published to the subscription's topic. If this field is set,
    +   * messages published to the subscription's topic in the last
    +   * `topic_message_retention_duration` are always available to subscribers. See
    +   * the `message_retention_duration` field in `Topic`. This field is set only
    +   * in responses from the server; it is ignored if it is set in any requests.
    +   * 
    + * + * + * .google.protobuf.Duration topic_message_retention_duration = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the topicMessageRetentionDuration field is set. + */ + @java.lang.Override + public boolean hasTopicMessageRetentionDuration() { + return ((bitField0_ & 0x00000100) != 0); + } + + /** + * + * + *
    +   * Output only. Indicates the minimum duration for which a message is retained
    +   * after it is published to the subscription's topic. If this field is set,
    +   * messages published to the subscription's topic in the last
    +   * `topic_message_retention_duration` are always available to subscribers. See
    +   * the `message_retention_duration` field in `Topic`. This field is set only
    +   * in responses from the server; it is ignored if it is set in any requests.
    +   * 
    + * + * + * .google.protobuf.Duration topic_message_retention_duration = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The topicMessageRetentionDuration. + */ + @java.lang.Override + public com.google.protobuf.Duration getTopicMessageRetentionDuration() { + return topicMessageRetentionDuration_ == null + ? com.google.protobuf.Duration.getDefaultInstance() + : topicMessageRetentionDuration_; + } + + /** + * + * + *
    +   * Output only. Indicates the minimum duration for which a message is retained
    +   * after it is published to the subscription's topic. If this field is set,
    +   * messages published to the subscription's topic in the last
    +   * `topic_message_retention_duration` are always available to subscribers. See
    +   * the `message_retention_duration` field in `Topic`. This field is set only
    +   * in responses from the server; it is ignored if it is set in any requests.
    +   * 
    + * + * + * .google.protobuf.Duration topic_message_retention_duration = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.protobuf.DurationOrBuilder getTopicMessageRetentionDurationOrBuilder() { + return topicMessageRetentionDuration_ == null + ? com.google.protobuf.Duration.getDefaultInstance() + : topicMessageRetentionDuration_; + } + + public static final int STATE_FIELD_NUMBER = 19; + private int state_ = 0; + + /** + * + * + *
    +   * Output only. An output-only field indicating whether or not the
    +   * subscription can receive messages.
    +   * 
    + * + * + * .google.pubsub.v1.Subscription.State state = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for state. + */ + @java.lang.Override + public int getStateValue() { + return state_; + } + + /** + * + * + *
    +   * Output only. An output-only field indicating whether or not the
    +   * subscription can receive messages.
    +   * 
    + * + * + * .google.pubsub.v1.Subscription.State state = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The state. + */ + @java.lang.Override + public com.google.pubsub.v1.Subscription.State getState() { + com.google.pubsub.v1.Subscription.State result = + com.google.pubsub.v1.Subscription.State.forNumber(state_); + return result == null ? com.google.pubsub.v1.Subscription.State.UNRECOGNIZED : result; + } + + public static final int ANALYTICS_HUB_SUBSCRIPTION_INFO_FIELD_NUMBER = 23; + private com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo + analyticsHubSubscriptionInfo_; + + /** + * + * + *
    +   * Output only. Information about the associated Analytics Hub subscription.
    +   * Only set if the subscription is created by Analytics Hub.
    +   * 
    + * + * + * .google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo analytics_hub_subscription_info = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the analyticsHubSubscriptionInfo field is set. + */ + @java.lang.Override + public boolean hasAnalyticsHubSubscriptionInfo() { + return ((bitField0_ & 0x00000200) != 0); + } + + /** + * + * + *
    +   * Output only. Information about the associated Analytics Hub subscription.
    +   * Only set if the subscription is created by Analytics Hub.
    +   * 
    + * + * + * .google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo analytics_hub_subscription_info = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The analyticsHubSubscriptionInfo. + */ + @java.lang.Override + public com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo + getAnalyticsHubSubscriptionInfo() { + return analyticsHubSubscriptionInfo_ == null + ? com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo.getDefaultInstance() + : analyticsHubSubscriptionInfo_; + } + + /** + * + * + *
    +   * Output only. Information about the associated Analytics Hub subscription.
    +   * Only set if the subscription is created by Analytics Hub.
    +   * 
    + * + * + * .google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo analytics_hub_subscription_info = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfoOrBuilder + getAnalyticsHubSubscriptionInfoOrBuilder() { + return analyticsHubSubscriptionInfo_ == null + ? com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo.getDefaultInstance() + : analyticsHubSubscriptionInfo_; + } + + public static final int MESSAGE_TRANSFORMS_FIELD_NUMBER = 25; + + @SuppressWarnings("serial") + private java.util.List messageTransforms_; + + /** + * + * + *
    +   * Optional. Transforms to be applied to messages before they are delivered to
    +   * subscribers. Transforms are applied in the order specified.
    +   * 
    + * + * + * repeated .google.pubsub.v1.MessageTransform message_transforms = 25 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public java.util.List getMessageTransformsList() { + return messageTransforms_; + } + + /** + * + * + *
    +   * Optional. Transforms to be applied to messages before they are delivered to
    +   * subscribers. Transforms are applied in the order specified.
    +   * 
    + * + * + * repeated .google.pubsub.v1.MessageTransform message_transforms = 25 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public java.util.List + getMessageTransformsOrBuilderList() { + return messageTransforms_; + } + + /** + * + * + *
    +   * Optional. Transforms to be applied to messages before they are delivered to
    +   * subscribers. Transforms are applied in the order specified.
    +   * 
    + * + * + * repeated .google.pubsub.v1.MessageTransform message_transforms = 25 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public int getMessageTransformsCount() { + return messageTransforms_.size(); + } + + /** + * + * + *
    +   * Optional. Transforms to be applied to messages before they are delivered to
    +   * subscribers. Transforms are applied in the order specified.
    +   * 
    + * + * + * repeated .google.pubsub.v1.MessageTransform message_transforms = 25 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.MessageTransform getMessageTransforms(int index) { + return messageTransforms_.get(index); + } + + /** + * + * + *
    +   * Optional. Transforms to be applied to messages before they are delivered to
    +   * subscribers. Transforms are applied in the order specified.
    +   * 
    + * + * + * repeated .google.pubsub.v1.MessageTransform message_transforms = 25 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.MessageTransformOrBuilder getMessageTransformsOrBuilder(int index) { + 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"
    +   * See https://docs.cloud.google.com/pubsub/docs/tags for more information on
    +   * using tags with Pub/Sub resources.
    +   * 
    + * + * + * 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"
    +   * See https://docs.cloud.google.com/pubsub/docs/tags for more information on
    +   * using tags with Pub/Sub resources.
    +   * 
    + * + * + * 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"
    +   * See https://docs.cloud.google.com/pubsub/docs/tags for more information on
    +   * using tags with Pub/Sub resources.
    +   * 
    + * + * + * 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"
    +   * See https://docs.cloud.google.com/pubsub/docs/tags for more information on
    +   * using tags with Pub/Sub resources.
    +   * 
    + * + * + * 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 + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, name_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(topic_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, topic_); + } + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(4, getPushConfig()); + } + if (ackDeadlineSeconds_ != 0) { + output.writeInt32(5, ackDeadlineSeconds_); + } + if (retainAckedMessages_ != false) { + output.writeBool(7, retainAckedMessages_); + } + if (((bitField0_ & 0x00000010) != 0)) { + output.writeMessage(8, getMessageRetentionDuration()); + } + com.google.protobuf.GeneratedMessage.serializeStringMapTo( + output, internalGetLabels(), LabelsDefaultEntryHolder.defaultEntry, 9); + if (enableMessageOrdering_ != false) { + output.writeBool(10, enableMessageOrdering_); + } + if (((bitField0_ & 0x00000020) != 0)) { + output.writeMessage(11, getExpirationPolicy()); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(filter_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 12, filter_); + } + if (((bitField0_ & 0x00000040) != 0)) { + output.writeMessage(13, getDeadLetterPolicy()); + } + if (((bitField0_ & 0x00000080) != 0)) { + output.writeMessage(14, getRetryPolicy()); + } + if (detached_ != false) { + output.writeBool(15, detached_); + } + if (enableExactlyOnceDelivery_ != false) { + output.writeBool(16, enableExactlyOnceDelivery_); + } + if (((bitField0_ & 0x00000100) != 0)) { + output.writeMessage(17, getTopicMessageRetentionDuration()); + } + if (((bitField0_ & 0x00000002) != 0)) { + output.writeMessage(18, getBigqueryConfig()); + } + if (state_ != com.google.pubsub.v1.Subscription.State.STATE_UNSPECIFIED.getNumber()) { + output.writeEnum(19, state_); + } + if (((bitField0_ & 0x00000004) != 0)) { + output.writeMessage(22, getCloudStorageConfig()); + } + if (((bitField0_ & 0x00000200) != 0)) { + output.writeMessage(23, getAnalyticsHubSubscriptionInfo()); + } + for (int i = 0; i < messageTransforms_.size(); i++) { + output.writeMessage(25, messageTransforms_.get(i)); + } + com.google.protobuf.GeneratedMessage.serializeStringMapTo( + output, internalGetTags(), TagsDefaultEntryHolder.defaultEntry, 26); + if (((bitField0_ & 0x00000008) != 0)) { + output.writeMessage(27, getBigtableConfig()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, name_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(topic_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, topic_); + } + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, getPushConfig()); + } + if (ackDeadlineSeconds_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(5, ackDeadlineSeconds_); + } + if (retainAckedMessages_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(7, retainAckedMessages_); + } + if (((bitField0_ & 0x00000010) != 0)) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 8, getMessageRetentionDuration()); + } + for (java.util.Map.Entry entry : + internalGetLabels().getMap().entrySet()) { + com.google.protobuf.MapEntry labels__ = + LabelsDefaultEntryHolder.defaultEntry + .newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream.computeMessageSize(9, labels__); + } + if (enableMessageOrdering_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(10, enableMessageOrdering_); + } + if (((bitField0_ & 0x00000020) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(11, getExpirationPolicy()); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(filter_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(12, filter_); + } + if (((bitField0_ & 0x00000040) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(13, getDeadLetterPolicy()); + } + if (((bitField0_ & 0x00000080) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(14, getRetryPolicy()); + } + if (detached_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(15, detached_); + } + if (enableExactlyOnceDelivery_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(16, enableExactlyOnceDelivery_); + } + if (((bitField0_ & 0x00000100) != 0)) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 17, getTopicMessageRetentionDuration()); + } + if (((bitField0_ & 0x00000002) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(18, getBigqueryConfig()); + } + if (state_ != com.google.pubsub.v1.Subscription.State.STATE_UNSPECIFIED.getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(19, state_); + } + if (((bitField0_ & 0x00000004) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(22, getCloudStorageConfig()); + } + if (((bitField0_ & 0x00000200) != 0)) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 23, getAnalyticsHubSubscriptionInfo()); + } + for (int i = 0; i < messageTransforms_.size(); i++) { + 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__); + } + if (((bitField0_ & 0x00000008) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(27, getBigtableConfig()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.pubsub.v1.Subscription)) { + return super.equals(obj); + } + com.google.pubsub.v1.Subscription other = (com.google.pubsub.v1.Subscription) obj; + + if (!getName().equals(other.getName())) return false; + if (!getTopic().equals(other.getTopic())) return false; + if (hasPushConfig() != other.hasPushConfig()) return false; + if (hasPushConfig()) { + if (!getPushConfig().equals(other.getPushConfig())) return false; + } + if (hasBigqueryConfig() != other.hasBigqueryConfig()) return false; + if (hasBigqueryConfig()) { + if (!getBigqueryConfig().equals(other.getBigqueryConfig())) return false; + } + if (hasCloudStorageConfig() != other.hasCloudStorageConfig()) return false; + if (hasCloudStorageConfig()) { + if (!getCloudStorageConfig().equals(other.getCloudStorageConfig())) return false; + } + if (hasBigtableConfig() != other.hasBigtableConfig()) return false; + if (hasBigtableConfig()) { + if (!getBigtableConfig().equals(other.getBigtableConfig())) return false; + } + if (getAckDeadlineSeconds() != other.getAckDeadlineSeconds()) return false; + if (getRetainAckedMessages() != other.getRetainAckedMessages()) return false; + if (hasMessageRetentionDuration() != other.hasMessageRetentionDuration()) return false; + if (hasMessageRetentionDuration()) { + if (!getMessageRetentionDuration().equals(other.getMessageRetentionDuration())) return false; + } + if (!internalGetLabels().equals(other.internalGetLabels())) return false; + if (getEnableMessageOrdering() != other.getEnableMessageOrdering()) return false; + if (hasExpirationPolicy() != other.hasExpirationPolicy()) return false; + if (hasExpirationPolicy()) { + if (!getExpirationPolicy().equals(other.getExpirationPolicy())) return false; + } + if (!getFilter().equals(other.getFilter())) return false; + if (hasDeadLetterPolicy() != other.hasDeadLetterPolicy()) return false; + if (hasDeadLetterPolicy()) { + if (!getDeadLetterPolicy().equals(other.getDeadLetterPolicy())) return false; + } + if (hasRetryPolicy() != other.hasRetryPolicy()) return false; + if (hasRetryPolicy()) { + if (!getRetryPolicy().equals(other.getRetryPolicy())) return false; + } + if (getDetached() != other.getDetached()) return false; + if (getEnableExactlyOnceDelivery() != other.getEnableExactlyOnceDelivery()) return false; + if (hasTopicMessageRetentionDuration() != other.hasTopicMessageRetentionDuration()) + return false; + if (hasTopicMessageRetentionDuration()) { + if (!getTopicMessageRetentionDuration().equals(other.getTopicMessageRetentionDuration())) + return false; + } + if (state_ != other.state_) return false; + if (hasAnalyticsHubSubscriptionInfo() != other.hasAnalyticsHubSubscriptionInfo()) return false; + if (hasAnalyticsHubSubscriptionInfo()) { + if (!getAnalyticsHubSubscriptionInfo().equals(other.getAnalyticsHubSubscriptionInfo())) + 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; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + TOPIC_FIELD_NUMBER; + hash = (53 * hash) + getTopic().hashCode(); + if (hasPushConfig()) { + hash = (37 * hash) + PUSH_CONFIG_FIELD_NUMBER; + hash = (53 * hash) + getPushConfig().hashCode(); + } + if (hasBigqueryConfig()) { + hash = (37 * hash) + BIGQUERY_CONFIG_FIELD_NUMBER; + hash = (53 * hash) + getBigqueryConfig().hashCode(); + } + if (hasCloudStorageConfig()) { + hash = (37 * hash) + CLOUD_STORAGE_CONFIG_FIELD_NUMBER; + hash = (53 * hash) + getCloudStorageConfig().hashCode(); + } + if (hasBigtableConfig()) { + hash = (37 * hash) + BIGTABLE_CONFIG_FIELD_NUMBER; + hash = (53 * hash) + getBigtableConfig().hashCode(); + } + hash = (37 * hash) + ACK_DEADLINE_SECONDS_FIELD_NUMBER; + hash = (53 * hash) + getAckDeadlineSeconds(); + hash = (37 * hash) + RETAIN_ACKED_MESSAGES_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getRetainAckedMessages()); + if (hasMessageRetentionDuration()) { + hash = (37 * hash) + MESSAGE_RETENTION_DURATION_FIELD_NUMBER; + hash = (53 * hash) + getMessageRetentionDuration().hashCode(); + } + if (!internalGetLabels().getMap().isEmpty()) { + hash = (37 * hash) + LABELS_FIELD_NUMBER; + hash = (53 * hash) + internalGetLabels().hashCode(); + } + hash = (37 * hash) + ENABLE_MESSAGE_ORDERING_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getEnableMessageOrdering()); + if (hasExpirationPolicy()) { + hash = (37 * hash) + EXPIRATION_POLICY_FIELD_NUMBER; + hash = (53 * hash) + getExpirationPolicy().hashCode(); + } + hash = (37 * hash) + FILTER_FIELD_NUMBER; + hash = (53 * hash) + getFilter().hashCode(); + if (hasDeadLetterPolicy()) { + hash = (37 * hash) + DEAD_LETTER_POLICY_FIELD_NUMBER; + hash = (53 * hash) + getDeadLetterPolicy().hashCode(); + } + if (hasRetryPolicy()) { + hash = (37 * hash) + RETRY_POLICY_FIELD_NUMBER; + hash = (53 * hash) + getRetryPolicy().hashCode(); + } + hash = (37 * hash) + DETACHED_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getDetached()); + hash = (37 * hash) + ENABLE_EXACTLY_ONCE_DELIVERY_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getEnableExactlyOnceDelivery()); + if (hasTopicMessageRetentionDuration()) { + hash = (37 * hash) + TOPIC_MESSAGE_RETENTION_DURATION_FIELD_NUMBER; + hash = (53 * hash) + getTopicMessageRetentionDuration().hashCode(); + } + hash = (37 * hash) + STATE_FIELD_NUMBER; + hash = (53 * hash) + state_; + if (hasAnalyticsHubSubscriptionInfo()) { + hash = (37 * hash) + ANALYTICS_HUB_SUBSCRIPTION_INFO_FIELD_NUMBER; + hash = (53 * hash) + getAnalyticsHubSubscriptionInfo().hashCode(); + } + if (getMessageTransformsCount() > 0) { + 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; + } + + public static com.google.pubsub.v1.Subscription parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.Subscription parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.Subscription parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.Subscription parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.Subscription parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.Subscription parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.Subscription parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.Subscription parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.Subscription parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.Subscription parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.Subscription parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.Subscription parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.pubsub.v1.Subscription prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + + /** + * + * + *
    +   * A subscription resource. If none of `push_config`, `bigquery_config`, or
    +   * `cloud_storage_config` is set, then the subscriber will pull and ack messages
    +   * using API methods. At most one of these fields may be set.
    +   * 
    + * + * Protobuf type {@code google.pubsub.v1.Subscription} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder + implements + // @@protoc_insertion_point(builder_implements:google.pubsub.v1.Subscription) + com.google.pubsub.v1.SubscriptionOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_Subscription_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldReflection( + int number) { + switch (number) { + case 9: + return internalGetLabels(); + case 26: + return internalGetTags(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMutableMapFieldReflection( + int number) { + switch (number) { + case 9: + return internalGetMutableLabels(); + case 26: + return internalGetMutableTags(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_Subscription_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.Subscription.class, + com.google.pubsub.v1.Subscription.Builder.class); + } + + // Construct using com.google.pubsub.v1.Subscription.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + internalGetPushConfigFieldBuilder(); + internalGetBigqueryConfigFieldBuilder(); + internalGetCloudStorageConfigFieldBuilder(); + internalGetBigtableConfigFieldBuilder(); + internalGetMessageRetentionDurationFieldBuilder(); + internalGetExpirationPolicyFieldBuilder(); + internalGetDeadLetterPolicyFieldBuilder(); + internalGetRetryPolicyFieldBuilder(); + internalGetTopicMessageRetentionDurationFieldBuilder(); + internalGetAnalyticsHubSubscriptionInfoFieldBuilder(); + internalGetMessageTransformsFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + name_ = ""; + topic_ = ""; + pushConfig_ = null; + if (pushConfigBuilder_ != null) { + pushConfigBuilder_.dispose(); + pushConfigBuilder_ = null; + } + bigqueryConfig_ = null; + if (bigqueryConfigBuilder_ != null) { + bigqueryConfigBuilder_.dispose(); + bigqueryConfigBuilder_ = null; + } + cloudStorageConfig_ = null; + if (cloudStorageConfigBuilder_ != null) { + cloudStorageConfigBuilder_.dispose(); + cloudStorageConfigBuilder_ = null; + } + bigtableConfig_ = null; + if (bigtableConfigBuilder_ != null) { + bigtableConfigBuilder_.dispose(); + bigtableConfigBuilder_ = null; + } + ackDeadlineSeconds_ = 0; + retainAckedMessages_ = false; + messageRetentionDuration_ = null; + if (messageRetentionDurationBuilder_ != null) { + messageRetentionDurationBuilder_.dispose(); + messageRetentionDurationBuilder_ = null; + } + internalGetMutableLabels().clear(); + enableMessageOrdering_ = false; + expirationPolicy_ = null; + if (expirationPolicyBuilder_ != null) { + expirationPolicyBuilder_.dispose(); + expirationPolicyBuilder_ = null; + } + filter_ = ""; + deadLetterPolicy_ = null; + if (deadLetterPolicyBuilder_ != null) { + deadLetterPolicyBuilder_.dispose(); + deadLetterPolicyBuilder_ = null; + } + retryPolicy_ = null; + if (retryPolicyBuilder_ != null) { + retryPolicyBuilder_.dispose(); + retryPolicyBuilder_ = null; + } + detached_ = false; + enableExactlyOnceDelivery_ = false; + topicMessageRetentionDuration_ = null; + if (topicMessageRetentionDurationBuilder_ != null) { + topicMessageRetentionDurationBuilder_.dispose(); + topicMessageRetentionDurationBuilder_ = null; + } + state_ = 0; + analyticsHubSubscriptionInfo_ = null; + if (analyticsHubSubscriptionInfoBuilder_ != null) { + analyticsHubSubscriptionInfoBuilder_.dispose(); + analyticsHubSubscriptionInfoBuilder_ = null; + } + if (messageTransformsBuilder_ == null) { + messageTransforms_ = java.util.Collections.emptyList(); + } else { + messageTransforms_ = null; + messageTransformsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00100000); + internalGetMutableTags().clear(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_Subscription_descriptor; + } + + @java.lang.Override + public com.google.pubsub.v1.Subscription getDefaultInstanceForType() { + return com.google.pubsub.v1.Subscription.getDefaultInstance(); + } + + @java.lang.Override + public com.google.pubsub.v1.Subscription build() { + com.google.pubsub.v1.Subscription result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.pubsub.v1.Subscription buildPartial() { + com.google.pubsub.v1.Subscription result = new com.google.pubsub.v1.Subscription(this); + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields(com.google.pubsub.v1.Subscription result) { + if (messageTransformsBuilder_ == null) { + if (((bitField0_ & 0x00100000) != 0)) { + messageTransforms_ = java.util.Collections.unmodifiableList(messageTransforms_); + bitField0_ = (bitField0_ & ~0x00100000); + } + result.messageTransforms_ = messageTransforms_; + } else { + result.messageTransforms_ = messageTransformsBuilder_.build(); + } + } + + private void buildPartial0(com.google.pubsub.v1.Subscription result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.name_ = name_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.topic_ = topic_; + } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000004) != 0)) { + result.pushConfig_ = pushConfigBuilder_ == null ? pushConfig_ : pushConfigBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.bigqueryConfig_ = + bigqueryConfigBuilder_ == null ? bigqueryConfig_ : bigqueryConfigBuilder_.build(); + to_bitField0_ |= 0x00000002; + } + if (((from_bitField0_ & 0x00000010) != 0)) { + result.cloudStorageConfig_ = + cloudStorageConfigBuilder_ == null + ? cloudStorageConfig_ + : cloudStorageConfigBuilder_.build(); + to_bitField0_ |= 0x00000004; + } + if (((from_bitField0_ & 0x00000020) != 0)) { + result.bigtableConfig_ = + bigtableConfigBuilder_ == null ? bigtableConfig_ : bigtableConfigBuilder_.build(); + to_bitField0_ |= 0x00000008; + } + if (((from_bitField0_ & 0x00000040) != 0)) { + result.ackDeadlineSeconds_ = ackDeadlineSeconds_; + } + if (((from_bitField0_ & 0x00000080) != 0)) { + result.retainAckedMessages_ = retainAckedMessages_; + } + if (((from_bitField0_ & 0x00000100) != 0)) { + result.messageRetentionDuration_ = + messageRetentionDurationBuilder_ == null + ? messageRetentionDuration_ + : messageRetentionDurationBuilder_.build(); + to_bitField0_ |= 0x00000010; + } + if (((from_bitField0_ & 0x00000200) != 0)) { + result.labels_ = internalGetLabels(); + result.labels_.makeImmutable(); + } + if (((from_bitField0_ & 0x00000400) != 0)) { + result.enableMessageOrdering_ = enableMessageOrdering_; + } + if (((from_bitField0_ & 0x00000800) != 0)) { + result.expirationPolicy_ = + expirationPolicyBuilder_ == null ? expirationPolicy_ : expirationPolicyBuilder_.build(); + to_bitField0_ |= 0x00000020; + } + if (((from_bitField0_ & 0x00001000) != 0)) { + result.filter_ = filter_; + } + if (((from_bitField0_ & 0x00002000) != 0)) { + result.deadLetterPolicy_ = + deadLetterPolicyBuilder_ == null ? deadLetterPolicy_ : deadLetterPolicyBuilder_.build(); + to_bitField0_ |= 0x00000040; + } + if (((from_bitField0_ & 0x00004000) != 0)) { + result.retryPolicy_ = + retryPolicyBuilder_ == null ? retryPolicy_ : retryPolicyBuilder_.build(); + to_bitField0_ |= 0x00000080; + } + if (((from_bitField0_ & 0x00008000) != 0)) { + result.detached_ = detached_; + } + if (((from_bitField0_ & 0x00010000) != 0)) { + result.enableExactlyOnceDelivery_ = enableExactlyOnceDelivery_; + } + if (((from_bitField0_ & 0x00020000) != 0)) { + result.topicMessageRetentionDuration_ = + topicMessageRetentionDurationBuilder_ == null + ? topicMessageRetentionDuration_ + : topicMessageRetentionDurationBuilder_.build(); + to_bitField0_ |= 0x00000100; + } + if (((from_bitField0_ & 0x00040000) != 0)) { + result.state_ = state_; + } + if (((from_bitField0_ & 0x00080000) != 0)) { + result.analyticsHubSubscriptionInfo_ = + analyticsHubSubscriptionInfoBuilder_ == null + ? analyticsHubSubscriptionInfo_ + : analyticsHubSubscriptionInfoBuilder_.build(); + to_bitField0_ |= 0x00000200; + } + if (((from_bitField0_ & 0x00200000) != 0)) { + result.tags_ = internalGetTags(); + result.tags_.makeImmutable(); + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.pubsub.v1.Subscription) { + return mergeFrom((com.google.pubsub.v1.Subscription) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.pubsub.v1.Subscription other) { + if (other == com.google.pubsub.v1.Subscription.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getTopic().isEmpty()) { + topic_ = other.topic_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (other.hasPushConfig()) { + mergePushConfig(other.getPushConfig()); + } + if (other.hasBigqueryConfig()) { + mergeBigqueryConfig(other.getBigqueryConfig()); + } + if (other.hasCloudStorageConfig()) { + mergeCloudStorageConfig(other.getCloudStorageConfig()); + } + if (other.hasBigtableConfig()) { + mergeBigtableConfig(other.getBigtableConfig()); + } + if (other.getAckDeadlineSeconds() != 0) { + setAckDeadlineSeconds(other.getAckDeadlineSeconds()); + } + if (other.getRetainAckedMessages() != false) { + setRetainAckedMessages(other.getRetainAckedMessages()); + } + if (other.hasMessageRetentionDuration()) { + mergeMessageRetentionDuration(other.getMessageRetentionDuration()); + } + internalGetMutableLabels().mergeFrom(other.internalGetLabels()); + bitField0_ |= 0x00000200; + if (other.getEnableMessageOrdering() != false) { + setEnableMessageOrdering(other.getEnableMessageOrdering()); + } + if (other.hasExpirationPolicy()) { + mergeExpirationPolicy(other.getExpirationPolicy()); + } + if (!other.getFilter().isEmpty()) { + filter_ = other.filter_; + bitField0_ |= 0x00001000; + onChanged(); + } + if (other.hasDeadLetterPolicy()) { + mergeDeadLetterPolicy(other.getDeadLetterPolicy()); + } + if (other.hasRetryPolicy()) { + mergeRetryPolicy(other.getRetryPolicy()); + } + if (other.getDetached() != false) { + setDetached(other.getDetached()); + } + if (other.getEnableExactlyOnceDelivery() != false) { + setEnableExactlyOnceDelivery(other.getEnableExactlyOnceDelivery()); + } + if (other.hasTopicMessageRetentionDuration()) { + mergeTopicMessageRetentionDuration(other.getTopicMessageRetentionDuration()); + } + if (other.state_ != 0) { + setStateValue(other.getStateValue()); + } + if (other.hasAnalyticsHubSubscriptionInfo()) { + mergeAnalyticsHubSubscriptionInfo(other.getAnalyticsHubSubscriptionInfo()); + } + if (messageTransformsBuilder_ == null) { + if (!other.messageTransforms_.isEmpty()) { + if (messageTransforms_.isEmpty()) { + messageTransforms_ = other.messageTransforms_; + bitField0_ = (bitField0_ & ~0x00100000); + } else { + ensureMessageTransformsIsMutable(); + messageTransforms_.addAll(other.messageTransforms_); + } + onChanged(); + } + } else { + if (!other.messageTransforms_.isEmpty()) { + if (messageTransformsBuilder_.isEmpty()) { + messageTransformsBuilder_.dispose(); + messageTransformsBuilder_ = null; + messageTransforms_ = other.messageTransforms_; + bitField0_ = (bitField0_ & ~0x00100000); + messageTransformsBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders + ? internalGetMessageTransformsFieldBuilder() + : null; + } else { + messageTransformsBuilder_.addAllMessages(other.messageTransforms_); + } + } + } + internalGetMutableTags().mergeFrom(other.internalGetTags()); + bitField0_ |= 0x00200000; + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + name_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + topic_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 34: + { + input.readMessage( + internalGetPushConfigFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000004; + break; + } // case 34 + case 40: + { + ackDeadlineSeconds_ = input.readInt32(); + bitField0_ |= 0x00000040; + break; + } // case 40 + case 56: + { + retainAckedMessages_ = input.readBool(); + bitField0_ |= 0x00000080; + break; + } // case 56 + case 66: + { + input.readMessage( + internalGetMessageRetentionDurationFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000100; + break; + } // case 66 + case 74: + { + com.google.protobuf.MapEntry labels__ = + input.readMessage( + LabelsDefaultEntryHolder.defaultEntry.getParserForType(), + extensionRegistry); + internalGetMutableLabels() + .getMutableMap() + .put(labels__.getKey(), labels__.getValue()); + bitField0_ |= 0x00000200; + break; + } // case 74 + case 80: + { + enableMessageOrdering_ = input.readBool(); + bitField0_ |= 0x00000400; + break; + } // case 80 + case 90: + { + input.readMessage( + internalGetExpirationPolicyFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000800; + break; + } // case 90 + case 98: + { + filter_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00001000; + break; + } // case 98 + case 106: + { + input.readMessage( + internalGetDeadLetterPolicyFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00002000; + break; + } // case 106 + case 114: + { + input.readMessage( + internalGetRetryPolicyFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00004000; + break; + } // case 114 + case 120: + { + detached_ = input.readBool(); + bitField0_ |= 0x00008000; + break; + } // case 120 + case 128: + { + enableExactlyOnceDelivery_ = input.readBool(); + bitField0_ |= 0x00010000; + break; + } // case 128 + case 138: + { + input.readMessage( + internalGetTopicMessageRetentionDurationFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00020000; + break; + } // case 138 + case 146: + { + input.readMessage( + internalGetBigqueryConfigFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000008; + break; + } // case 146 + case 152: + { + state_ = input.readEnum(); + bitField0_ |= 0x00040000; + break; + } // case 152 + case 178: + { + input.readMessage( + internalGetCloudStorageConfigFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000010; + break; + } // case 178 + case 186: + { + input.readMessage( + internalGetAnalyticsHubSubscriptionInfoFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00080000; + break; + } // case 186 + case 202: + { + com.google.pubsub.v1.MessageTransform m = + input.readMessage( + com.google.pubsub.v1.MessageTransform.parser(), extensionRegistry); + if (messageTransformsBuilder_ == null) { + ensureMessageTransformsIsMutable(); + messageTransforms_.add(m); + } else { + messageTransformsBuilder_.addMessage(m); + } + break; + } // case 202 + case 210: + { + com.google.protobuf.MapEntry tags__ = + input.readMessage( + TagsDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry); + internalGetMutableTags().getMutableMap().put(tags__.getKey(), tags__.getValue()); + bitField0_ |= 0x00200000; + break; + } // case 210 + case 218: + { + input.readMessage( + internalGetBigtableConfigFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000020; + break; + } // case 218 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.lang.Object name_ = ""; + + /** + * + * + *
    +     * Required. Identifier. The name of the subscription. It must have the format
    +     * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must
    +     * start with a letter, and contain only letters (`[A-Za-z]`), numbers
    +     * (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`),
    +     * plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters
    +     * in length, and it must not start with `"goog"`.
    +     * 
    + * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IDENTIFIER]; + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +     * Required. Identifier. The name of the subscription. It must have the format
    +     * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must
    +     * start with a letter, and contain only letters (`[A-Za-z]`), numbers
    +     * (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`),
    +     * plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters
    +     * in length, and it must not start with `"goog"`.
    +     * 
    + * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IDENTIFIER]; + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +     * Required. Identifier. The name of the subscription. It must have the format
    +     * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must
    +     * start with a letter, and contain only letters (`[A-Za-z]`), numbers
    +     * (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`),
    +     * plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters
    +     * in length, and it must not start with `"goog"`.
    +     * 
    + * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IDENTIFIER]; + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Required. Identifier. The name of the subscription. It must have the format
    +     * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must
    +     * start with a letter, and contain only letters (`[A-Za-z]`), numbers
    +     * (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`),
    +     * plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters
    +     * in length, and it must not start with `"goog"`.
    +     * 
    + * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IDENTIFIER]; + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + + /** + * + * + *
    +     * Required. Identifier. The name of the subscription. It must have the format
    +     * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must
    +     * start with a letter, and contain only letters (`[A-Za-z]`), numbers
    +     * (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`),
    +     * plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters
    +     * in length, and it must not start with `"goog"`.
    +     * 
    + * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IDENTIFIER]; + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object topic_ = ""; + + /** + * + * + *
    +     * Required. The name of the topic from which this subscription is receiving
    +     * messages. Format is `projects/{project}/topics/{topic}`. The value of this
    +     * field will be `_deleted-topic_` if the topic has been deleted.
    +     * 
    + * + * + * string topic = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The topic. + */ + public java.lang.String getTopic() { + java.lang.Object ref = topic_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + topic_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +     * Required. The name of the topic from which this subscription is receiving
    +     * messages. Format is `projects/{project}/topics/{topic}`. The value of this
    +     * field will be `_deleted-topic_` if the topic has been deleted.
    +     * 
    + * + * + * string topic = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for topic. + */ + public com.google.protobuf.ByteString getTopicBytes() { + java.lang.Object ref = topic_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + topic_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +     * Required. The name of the topic from which this subscription is receiving
    +     * messages. Format is `projects/{project}/topics/{topic}`. The value of this
    +     * field will be `_deleted-topic_` if the topic has been deleted.
    +     * 
    + * + * + * string topic = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The topic to set. + * @return This builder for chaining. + */ + public Builder setTopic(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + topic_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Required. The name of the topic from which this subscription is receiving
    +     * messages. Format is `projects/{project}/topics/{topic}`. The value of this
    +     * field will be `_deleted-topic_` if the topic has been deleted.
    +     * 
    + * + * + * string topic = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearTopic() { + topic_ = getDefaultInstance().getTopic(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + + /** + * + * + *
    +     * Required. The name of the topic from which this subscription is receiving
    +     * messages. Format is `projects/{project}/topics/{topic}`. The value of this
    +     * field will be `_deleted-topic_` if the topic has been deleted.
    +     * 
    + * + * + * string topic = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for topic to set. + * @return This builder for chaining. + */ + public Builder setTopicBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + topic_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private com.google.pubsub.v1.PushConfig pushConfig_; + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.PushConfig, + com.google.pubsub.v1.PushConfig.Builder, + com.google.pubsub.v1.PushConfigOrBuilder> + pushConfigBuilder_; + + /** + * + * + *
    +     * Optional. If push delivery is used with this subscription, this field is
    +     * used to configure it.
    +     * 
    + * + * .google.pubsub.v1.PushConfig push_config = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the pushConfig field is set. + */ + public boolean hasPushConfig() { + return ((bitField0_ & 0x00000004) != 0); + } + + /** + * + * + *
    +     * Optional. If push delivery is used with this subscription, this field is
    +     * used to configure it.
    +     * 
    + * + * .google.pubsub.v1.PushConfig push_config = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The pushConfig. + */ + public com.google.pubsub.v1.PushConfig getPushConfig() { + if (pushConfigBuilder_ == null) { + return pushConfig_ == null + ? com.google.pubsub.v1.PushConfig.getDefaultInstance() + : pushConfig_; + } else { + return pushConfigBuilder_.getMessage(); + } + } - private byte memoizedIsInitialized = -1; + /** + * + * + *
    +     * Optional. If push delivery is used with this subscription, this field is
    +     * used to configure it.
    +     * 
    + * + * .google.pubsub.v1.PushConfig push_config = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setPushConfig(com.google.pubsub.v1.PushConfig value) { + if (pushConfigBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + pushConfig_ = value; + } else { + pushConfigBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; + /** + * + * + *
    +     * Optional. If push delivery is used with this subscription, this field is
    +     * used to configure it.
    +     * 
    + * + * .google.pubsub.v1.PushConfig push_config = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setPushConfig(com.google.pubsub.v1.PushConfig.Builder builderForValue) { + if (pushConfigBuilder_ == null) { + pushConfig_ = builderForValue.build(); + } else { + pushConfigBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } - memoizedIsInitialized = 1; - return true; - } + /** + * + * + *
    +     * Optional. If push delivery is used with this subscription, this field is
    +     * used to configure it.
    +     * 
    + * + * .google.pubsub.v1.PushConfig push_config = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergePushConfig(com.google.pubsub.v1.PushConfig value) { + if (pushConfigBuilder_ == null) { + if (((bitField0_ & 0x00000004) != 0) + && pushConfig_ != null + && pushConfig_ != com.google.pubsub.v1.PushConfig.getDefaultInstance()) { + getPushConfigBuilder().mergeFrom(value); + } else { + pushConfig_ = value; + } + } else { + pushConfigBuilder_.mergeFrom(value); + } + if (pushConfig_ != null) { + bitField0_ |= 0x00000004; + onChanged(); + } + return this; + } - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!getNameBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + /** + * + * + *
    +     * Optional. If push delivery is used with this subscription, this field is
    +     * used to configure it.
    +     * 
    + * + * .google.pubsub.v1.PushConfig push_config = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearPushConfig() { + bitField0_ = (bitField0_ & ~0x00000004); + pushConfig_ = null; + if (pushConfigBuilder_ != null) { + pushConfigBuilder_.dispose(); + pushConfigBuilder_ = null; + } + onChanged(); + return this; + } + + /** + * + * + *
    +     * Optional. If push delivery is used with this subscription, this field is
    +     * used to configure it.
    +     * 
    + * + * .google.pubsub.v1.PushConfig push_config = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.PushConfig.Builder getPushConfigBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return internalGetPushConfigFieldBuilder().getBuilder(); } - if (!getTopicBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 2, topic_); + + /** + * + * + *
    +     * Optional. If push delivery is used with this subscription, this field is
    +     * used to configure it.
    +     * 
    + * + * .google.pubsub.v1.PushConfig push_config = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.PushConfigOrBuilder getPushConfigOrBuilder() { + if (pushConfigBuilder_ != null) { + return pushConfigBuilder_.getMessageOrBuilder(); + } else { + return pushConfig_ == null + ? com.google.pubsub.v1.PushConfig.getDefaultInstance() + : pushConfig_; + } } - if (pushConfig_ != null) { - output.writeMessage(4, getPushConfig()); + + /** + * + * + *
    +     * Optional. If push delivery is used with this subscription, this field is
    +     * used to configure it.
    +     * 
    + * + * .google.pubsub.v1.PushConfig push_config = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.PushConfig, + com.google.pubsub.v1.PushConfig.Builder, + com.google.pubsub.v1.PushConfigOrBuilder> + internalGetPushConfigFieldBuilder() { + if (pushConfigBuilder_ == null) { + pushConfigBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.PushConfig, + com.google.pubsub.v1.PushConfig.Builder, + com.google.pubsub.v1.PushConfigOrBuilder>( + getPushConfig(), getParentForChildren(), isClean()); + pushConfig_ = null; + } + return pushConfigBuilder_; } - if (ackDeadlineSeconds_ != 0) { - output.writeInt32(5, ackDeadlineSeconds_); + + private com.google.pubsub.v1.BigQueryConfig bigqueryConfig_; + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.BigQueryConfig, + com.google.pubsub.v1.BigQueryConfig.Builder, + com.google.pubsub.v1.BigQueryConfigOrBuilder> + bigqueryConfigBuilder_; + + /** + * + * + *
    +     * Optional. If delivery to BigQuery is used with this subscription, this
    +     * field is used to configure it.
    +     * 
    + * + * + * .google.pubsub.v1.BigQueryConfig bigquery_config = 18 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the bigqueryConfig field is set. + */ + public boolean hasBigqueryConfig() { + return ((bitField0_ & 0x00000008) != 0); } - if (retainAckedMessages_ != false) { - output.writeBool(7, retainAckedMessages_); + + /** + * + * + *
    +     * Optional. If delivery to BigQuery is used with this subscription, this
    +     * field is used to configure it.
    +     * 
    + * + * + * .google.pubsub.v1.BigQueryConfig bigquery_config = 18 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The bigqueryConfig. + */ + public com.google.pubsub.v1.BigQueryConfig getBigqueryConfig() { + if (bigqueryConfigBuilder_ == null) { + return bigqueryConfig_ == null + ? com.google.pubsub.v1.BigQueryConfig.getDefaultInstance() + : bigqueryConfig_; + } else { + return bigqueryConfigBuilder_.getMessage(); + } } - if (messageRetentionDuration_ != null) { - output.writeMessage(8, getMessageRetentionDuration()); + + /** + * + * + *
    +     * Optional. If delivery to BigQuery is used with this subscription, this
    +     * field is used to configure it.
    +     * 
    + * + * + * .google.pubsub.v1.BigQueryConfig bigquery_config = 18 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setBigqueryConfig(com.google.pubsub.v1.BigQueryConfig value) { + if (bigqueryConfigBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + bigqueryConfig_ = value; + } else { + bigqueryConfigBuilder_.setMessage(value); + } + bitField0_ |= 0x00000008; + onChanged(); + return this; } - com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( - output, internalGetLabels(), LabelsDefaultEntryHolder.defaultEntry, 9); - if (enableMessageOrdering_ != false) { - output.writeBool(10, enableMessageOrdering_); + + /** + * + * + *
    +     * Optional. If delivery to BigQuery is used with this subscription, this
    +     * field is used to configure it.
    +     * 
    + * + * + * .google.pubsub.v1.BigQueryConfig bigquery_config = 18 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setBigqueryConfig(com.google.pubsub.v1.BigQueryConfig.Builder builderForValue) { + if (bigqueryConfigBuilder_ == null) { + bigqueryConfig_ = builderForValue.build(); + } else { + bigqueryConfigBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000008; + onChanged(); + return this; } - if (expirationPolicy_ != null) { - output.writeMessage(11, getExpirationPolicy()); + + /** + * + * + *
    +     * Optional. If delivery to BigQuery is used with this subscription, this
    +     * field is used to configure it.
    +     * 
    + * + * + * .google.pubsub.v1.BigQueryConfig bigquery_config = 18 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeBigqueryConfig(com.google.pubsub.v1.BigQueryConfig value) { + if (bigqueryConfigBuilder_ == null) { + if (((bitField0_ & 0x00000008) != 0) + && bigqueryConfig_ != null + && bigqueryConfig_ != com.google.pubsub.v1.BigQueryConfig.getDefaultInstance()) { + getBigqueryConfigBuilder().mergeFrom(value); + } else { + bigqueryConfig_ = value; + } + } else { + bigqueryConfigBuilder_.mergeFrom(value); + } + if (bigqueryConfig_ != null) { + bitField0_ |= 0x00000008; + onChanged(); + } + return this; } - if (!getFilterBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 12, filter_); + + /** + * + * + *
    +     * Optional. If delivery to BigQuery is used with this subscription, this
    +     * field is used to configure it.
    +     * 
    + * + * + * .google.pubsub.v1.BigQueryConfig bigquery_config = 18 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearBigqueryConfig() { + bitField0_ = (bitField0_ & ~0x00000008); + bigqueryConfig_ = null; + if (bigqueryConfigBuilder_ != null) { + bigqueryConfigBuilder_.dispose(); + bigqueryConfigBuilder_ = null; + } + onChanged(); + return this; } - if (deadLetterPolicy_ != null) { - output.writeMessage(13, getDeadLetterPolicy()); + + /** + * + * + *
    +     * Optional. If delivery to BigQuery is used with this subscription, this
    +     * field is used to configure it.
    +     * 
    + * + * + * .google.pubsub.v1.BigQueryConfig bigquery_config = 18 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.BigQueryConfig.Builder getBigqueryConfigBuilder() { + bitField0_ |= 0x00000008; + onChanged(); + return internalGetBigqueryConfigFieldBuilder().getBuilder(); } - if (retryPolicy_ != null) { - output.writeMessage(14, getRetryPolicy()); + + /** + * + * + *
    +     * Optional. If delivery to BigQuery is used with this subscription, this
    +     * field is used to configure it.
    +     * 
    + * + * + * .google.pubsub.v1.BigQueryConfig bigquery_config = 18 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.BigQueryConfigOrBuilder getBigqueryConfigOrBuilder() { + if (bigqueryConfigBuilder_ != null) { + return bigqueryConfigBuilder_.getMessageOrBuilder(); + } else { + return bigqueryConfig_ == null + ? com.google.pubsub.v1.BigQueryConfig.getDefaultInstance() + : bigqueryConfig_; + } } - if (detached_ != false) { - output.writeBool(15, detached_); + + /** + * + * + *
    +     * Optional. If delivery to BigQuery is used with this subscription, this
    +     * field is used to configure it.
    +     * 
    + * + * + * .google.pubsub.v1.BigQueryConfig bigquery_config = 18 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.BigQueryConfig, + com.google.pubsub.v1.BigQueryConfig.Builder, + com.google.pubsub.v1.BigQueryConfigOrBuilder> + internalGetBigqueryConfigFieldBuilder() { + if (bigqueryConfigBuilder_ == null) { + bigqueryConfigBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.BigQueryConfig, + com.google.pubsub.v1.BigQueryConfig.Builder, + com.google.pubsub.v1.BigQueryConfigOrBuilder>( + getBigqueryConfig(), getParentForChildren(), isClean()); + bigqueryConfig_ = null; + } + return bigqueryConfigBuilder_; } - unknownFields.writeTo(output); - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; + private com.google.pubsub.v1.CloudStorageConfig cloudStorageConfig_; + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.CloudStorageConfig, + com.google.pubsub.v1.CloudStorageConfig.Builder, + com.google.pubsub.v1.CloudStorageConfigOrBuilder> + cloudStorageConfigBuilder_; - size = 0; - if (!getNameBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); - } - if (!getTopicBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, topic_); - } - if (pushConfig_ != null) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, getPushConfig()); - } - if (ackDeadlineSeconds_ != 0) { - size += com.google.protobuf.CodedOutputStream.computeInt32Size(5, ackDeadlineSeconds_); - } - if (retainAckedMessages_ != false) { - size += com.google.protobuf.CodedOutputStream.computeBoolSize(7, retainAckedMessages_); - } - if (messageRetentionDuration_ != null) { - size += - com.google.protobuf.CodedOutputStream.computeMessageSize( - 8, getMessageRetentionDuration()); - } - for (java.util.Map.Entry entry : - internalGetLabels().getMap().entrySet()) { - com.google.protobuf.MapEntry labels__ = - LabelsDefaultEntryHolder.defaultEntry - .newBuilderForType() - .setKey(entry.getKey()) - .setValue(entry.getValue()) - .build(); - size += com.google.protobuf.CodedOutputStream.computeMessageSize(9, labels__); - } - if (enableMessageOrdering_ != false) { - size += com.google.protobuf.CodedOutputStream.computeBoolSize(10, enableMessageOrdering_); - } - if (expirationPolicy_ != null) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(11, getExpirationPolicy()); - } - if (!getFilterBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(12, filter_); + /** + * + * + *
    +     * Optional. If delivery to Google Cloud Storage is used with this
    +     * subscription, this field is used to configure it.
    +     * 
    + * + * + * .google.pubsub.v1.CloudStorageConfig cloud_storage_config = 22 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the cloudStorageConfig field is set. + */ + public boolean hasCloudStorageConfig() { + return ((bitField0_ & 0x00000010) != 0); } - if (deadLetterPolicy_ != null) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(13, getDeadLetterPolicy()); + + /** + * + * + *
    +     * Optional. If delivery to Google Cloud Storage is used with this
    +     * subscription, this field is used to configure it.
    +     * 
    + * + * + * .google.pubsub.v1.CloudStorageConfig cloud_storage_config = 22 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The cloudStorageConfig. + */ + public com.google.pubsub.v1.CloudStorageConfig getCloudStorageConfig() { + if (cloudStorageConfigBuilder_ == null) { + return cloudStorageConfig_ == null + ? com.google.pubsub.v1.CloudStorageConfig.getDefaultInstance() + : cloudStorageConfig_; + } else { + return cloudStorageConfigBuilder_.getMessage(); + } } - if (retryPolicy_ != null) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(14, getRetryPolicy()); + + /** + * + * + *
    +     * Optional. If delivery to Google Cloud Storage is used with this
    +     * subscription, this field is used to configure it.
    +     * 
    + * + * + * .google.pubsub.v1.CloudStorageConfig cloud_storage_config = 22 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setCloudStorageConfig(com.google.pubsub.v1.CloudStorageConfig value) { + if (cloudStorageConfigBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + cloudStorageConfig_ = value; + } else { + cloudStorageConfigBuilder_.setMessage(value); + } + bitField0_ |= 0x00000010; + onChanged(); + return this; } - if (detached_ != false) { - size += com.google.protobuf.CodedOutputStream.computeBoolSize(15, detached_); + + /** + * + * + *
    +     * Optional. If delivery to Google Cloud Storage is used with this
    +     * subscription, this field is used to configure it.
    +     * 
    + * + * + * .google.pubsub.v1.CloudStorageConfig cloud_storage_config = 22 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setCloudStorageConfig( + com.google.pubsub.v1.CloudStorageConfig.Builder builderForValue) { + if (cloudStorageConfigBuilder_ == null) { + cloudStorageConfig_ = builderForValue.build(); + } else { + cloudStorageConfigBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000010; + onChanged(); + return this; } - size += unknownFields.getSerializedSize(); - memoizedSize = size; - return size; - } - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; + /** + * + * + *
    +     * Optional. If delivery to Google Cloud Storage is used with this
    +     * subscription, this field is used to configure it.
    +     * 
    + * + * + * .google.pubsub.v1.CloudStorageConfig cloud_storage_config = 22 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeCloudStorageConfig(com.google.pubsub.v1.CloudStorageConfig value) { + if (cloudStorageConfigBuilder_ == null) { + if (((bitField0_ & 0x00000010) != 0) + && cloudStorageConfig_ != null + && cloudStorageConfig_ + != com.google.pubsub.v1.CloudStorageConfig.getDefaultInstance()) { + getCloudStorageConfigBuilder().mergeFrom(value); + } else { + cloudStorageConfig_ = value; + } + } else { + cloudStorageConfigBuilder_.mergeFrom(value); + } + if (cloudStorageConfig_ != null) { + bitField0_ |= 0x00000010; + onChanged(); + } + return this; } - if (!(obj instanceof com.google.pubsub.v1.Subscription)) { - return super.equals(obj); + + /** + * + * + *
    +     * Optional. If delivery to Google Cloud Storage is used with this
    +     * subscription, this field is used to configure it.
    +     * 
    + * + * + * .google.pubsub.v1.CloudStorageConfig cloud_storage_config = 22 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearCloudStorageConfig() { + bitField0_ = (bitField0_ & ~0x00000010); + cloudStorageConfig_ = null; + if (cloudStorageConfigBuilder_ != null) { + cloudStorageConfigBuilder_.dispose(); + cloudStorageConfigBuilder_ = null; + } + onChanged(); + return this; } - com.google.pubsub.v1.Subscription other = (com.google.pubsub.v1.Subscription) obj; - if (!getName().equals(other.getName())) return false; - if (!getTopic().equals(other.getTopic())) return false; - if (hasPushConfig() != other.hasPushConfig()) return false; - if (hasPushConfig()) { - if (!getPushConfig().equals(other.getPushConfig())) return false; + /** + * + * + *
    +     * Optional. If delivery to Google Cloud Storage is used with this
    +     * subscription, this field is used to configure it.
    +     * 
    + * + * + * .google.pubsub.v1.CloudStorageConfig cloud_storage_config = 22 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.CloudStorageConfig.Builder getCloudStorageConfigBuilder() { + bitField0_ |= 0x00000010; + onChanged(); + return internalGetCloudStorageConfigFieldBuilder().getBuilder(); } - if (getAckDeadlineSeconds() != other.getAckDeadlineSeconds()) return false; - if (getRetainAckedMessages() != other.getRetainAckedMessages()) return false; - if (hasMessageRetentionDuration() != other.hasMessageRetentionDuration()) return false; - if (hasMessageRetentionDuration()) { - if (!getMessageRetentionDuration().equals(other.getMessageRetentionDuration())) return false; + + /** + * + * + *
    +     * Optional. If delivery to Google Cloud Storage is used with this
    +     * subscription, this field is used to configure it.
    +     * 
    + * + * + * .google.pubsub.v1.CloudStorageConfig cloud_storage_config = 22 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.CloudStorageConfigOrBuilder getCloudStorageConfigOrBuilder() { + if (cloudStorageConfigBuilder_ != null) { + return cloudStorageConfigBuilder_.getMessageOrBuilder(); + } else { + return cloudStorageConfig_ == null + ? com.google.pubsub.v1.CloudStorageConfig.getDefaultInstance() + : cloudStorageConfig_; + } } - if (!internalGetLabels().equals(other.internalGetLabels())) return false; - if (getEnableMessageOrdering() != other.getEnableMessageOrdering()) return false; - if (hasExpirationPolicy() != other.hasExpirationPolicy()) return false; - if (hasExpirationPolicy()) { - if (!getExpirationPolicy().equals(other.getExpirationPolicy())) return false; + + /** + * + * + *
    +     * Optional. If delivery to Google Cloud Storage is used with this
    +     * subscription, this field is used to configure it.
    +     * 
    + * + * + * .google.pubsub.v1.CloudStorageConfig cloud_storage_config = 22 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.CloudStorageConfig, + com.google.pubsub.v1.CloudStorageConfig.Builder, + com.google.pubsub.v1.CloudStorageConfigOrBuilder> + internalGetCloudStorageConfigFieldBuilder() { + if (cloudStorageConfigBuilder_ == null) { + cloudStorageConfigBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.CloudStorageConfig, + com.google.pubsub.v1.CloudStorageConfig.Builder, + com.google.pubsub.v1.CloudStorageConfigOrBuilder>( + getCloudStorageConfig(), getParentForChildren(), isClean()); + cloudStorageConfig_ = null; + } + return cloudStorageConfigBuilder_; } - if (!getFilter().equals(other.getFilter())) return false; - if (hasDeadLetterPolicy() != other.hasDeadLetterPolicy()) return false; - if (hasDeadLetterPolicy()) { - if (!getDeadLetterPolicy().equals(other.getDeadLetterPolicy())) return false; + + private com.google.pubsub.v1.BigtableConfig bigtableConfig_; + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.BigtableConfig, + com.google.pubsub.v1.BigtableConfig.Builder, + com.google.pubsub.v1.BigtableConfigOrBuilder> + bigtableConfigBuilder_; + + /** + * + * + *
    +     * Optional. If delivery to Bigtable is used with this subscription, this
    +     * field is used to configure it.
    +     * 
    + * + * + * .google.pubsub.v1.BigtableConfig bigtable_config = 27 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the bigtableConfig field is set. + */ + public boolean hasBigtableConfig() { + return ((bitField0_ & 0x00000020) != 0); } - if (hasRetryPolicy() != other.hasRetryPolicy()) return false; - if (hasRetryPolicy()) { - if (!getRetryPolicy().equals(other.getRetryPolicy())) return false; + + /** + * + * + *
    +     * Optional. If delivery to Bigtable is used with this subscription, this
    +     * field is used to configure it.
    +     * 
    + * + * + * .google.pubsub.v1.BigtableConfig bigtable_config = 27 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The bigtableConfig. + */ + public com.google.pubsub.v1.BigtableConfig getBigtableConfig() { + if (bigtableConfigBuilder_ == null) { + return bigtableConfig_ == null + ? com.google.pubsub.v1.BigtableConfig.getDefaultInstance() + : bigtableConfig_; + } else { + return bigtableConfigBuilder_.getMessage(); + } } - if (getDetached() != other.getDetached()) return false; - if (!unknownFields.equals(other.unknownFields)) return false; - return true; - } - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; + /** + * + * + *
    +     * Optional. If delivery to Bigtable is used with this subscription, this
    +     * field is used to configure it.
    +     * 
    + * + * + * .google.pubsub.v1.BigtableConfig bigtable_config = 27 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setBigtableConfig(com.google.pubsub.v1.BigtableConfig value) { + if (bigtableConfigBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + bigtableConfig_ = value; + } else { + bigtableConfigBuilder_.setMessage(value); + } + bitField0_ |= 0x00000020; + onChanged(); + return this; } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + NAME_FIELD_NUMBER; - hash = (53 * hash) + getName().hashCode(); - hash = (37 * hash) + TOPIC_FIELD_NUMBER; - hash = (53 * hash) + getTopic().hashCode(); - if (hasPushConfig()) { - hash = (37 * hash) + PUSH_CONFIG_FIELD_NUMBER; - hash = (53 * hash) + getPushConfig().hashCode(); + + /** + * + * + *
    +     * Optional. If delivery to Bigtable is used with this subscription, this
    +     * field is used to configure it.
    +     * 
    + * + * + * .google.pubsub.v1.BigtableConfig bigtable_config = 27 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setBigtableConfig(com.google.pubsub.v1.BigtableConfig.Builder builderForValue) { + if (bigtableConfigBuilder_ == null) { + bigtableConfig_ = builderForValue.build(); + } else { + bigtableConfigBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000020; + onChanged(); + return this; } - hash = (37 * hash) + ACK_DEADLINE_SECONDS_FIELD_NUMBER; - hash = (53 * hash) + getAckDeadlineSeconds(); - hash = (37 * hash) + RETAIN_ACKED_MESSAGES_FIELD_NUMBER; - hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getRetainAckedMessages()); - if (hasMessageRetentionDuration()) { - hash = (37 * hash) + MESSAGE_RETENTION_DURATION_FIELD_NUMBER; - hash = (53 * hash) + getMessageRetentionDuration().hashCode(); + + /** + * + * + *
    +     * Optional. If delivery to Bigtable is used with this subscription, this
    +     * field is used to configure it.
    +     * 
    + * + * + * .google.pubsub.v1.BigtableConfig bigtable_config = 27 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeBigtableConfig(com.google.pubsub.v1.BigtableConfig value) { + if (bigtableConfigBuilder_ == null) { + if (((bitField0_ & 0x00000020) != 0) + && bigtableConfig_ != null + && bigtableConfig_ != com.google.pubsub.v1.BigtableConfig.getDefaultInstance()) { + getBigtableConfigBuilder().mergeFrom(value); + } else { + bigtableConfig_ = value; + } + } else { + bigtableConfigBuilder_.mergeFrom(value); + } + if (bigtableConfig_ != null) { + bitField0_ |= 0x00000020; + onChanged(); + } + return this; } - if (!internalGetLabels().getMap().isEmpty()) { - hash = (37 * hash) + LABELS_FIELD_NUMBER; - hash = (53 * hash) + internalGetLabels().hashCode(); + + /** + * + * + *
    +     * Optional. If delivery to Bigtable is used with this subscription, this
    +     * field is used to configure it.
    +     * 
    + * + * + * .google.pubsub.v1.BigtableConfig bigtable_config = 27 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearBigtableConfig() { + bitField0_ = (bitField0_ & ~0x00000020); + bigtableConfig_ = null; + if (bigtableConfigBuilder_ != null) { + bigtableConfigBuilder_.dispose(); + bigtableConfigBuilder_ = null; + } + onChanged(); + return this; } - hash = (37 * hash) + ENABLE_MESSAGE_ORDERING_FIELD_NUMBER; - hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getEnableMessageOrdering()); - if (hasExpirationPolicy()) { - hash = (37 * hash) + EXPIRATION_POLICY_FIELD_NUMBER; - hash = (53 * hash) + getExpirationPolicy().hashCode(); + + /** + * + * + *
    +     * Optional. If delivery to Bigtable is used with this subscription, this
    +     * field is used to configure it.
    +     * 
    + * + * + * .google.pubsub.v1.BigtableConfig bigtable_config = 27 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.BigtableConfig.Builder getBigtableConfigBuilder() { + bitField0_ |= 0x00000020; + onChanged(); + return internalGetBigtableConfigFieldBuilder().getBuilder(); } - hash = (37 * hash) + FILTER_FIELD_NUMBER; - hash = (53 * hash) + getFilter().hashCode(); - if (hasDeadLetterPolicy()) { - hash = (37 * hash) + DEAD_LETTER_POLICY_FIELD_NUMBER; - hash = (53 * hash) + getDeadLetterPolicy().hashCode(); + + /** + * + * + *
    +     * Optional. If delivery to Bigtable is used with this subscription, this
    +     * field is used to configure it.
    +     * 
    + * + * + * .google.pubsub.v1.BigtableConfig bigtable_config = 27 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.BigtableConfigOrBuilder getBigtableConfigOrBuilder() { + if (bigtableConfigBuilder_ != null) { + return bigtableConfigBuilder_.getMessageOrBuilder(); + } else { + return bigtableConfig_ == null + ? com.google.pubsub.v1.BigtableConfig.getDefaultInstance() + : bigtableConfig_; + } } - if (hasRetryPolicy()) { - hash = (37 * hash) + RETRY_POLICY_FIELD_NUMBER; - hash = (53 * hash) + getRetryPolicy().hashCode(); + + /** + * + * + *
    +     * Optional. If delivery to Bigtable is used with this subscription, this
    +     * field is used to configure it.
    +     * 
    + * + * + * .google.pubsub.v1.BigtableConfig bigtable_config = 27 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.BigtableConfig, + com.google.pubsub.v1.BigtableConfig.Builder, + com.google.pubsub.v1.BigtableConfigOrBuilder> + internalGetBigtableConfigFieldBuilder() { + if (bigtableConfigBuilder_ == null) { + bigtableConfigBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.BigtableConfig, + com.google.pubsub.v1.BigtableConfig.Builder, + com.google.pubsub.v1.BigtableConfigOrBuilder>( + getBigtableConfig(), getParentForChildren(), isClean()); + bigtableConfig_ = null; + } + return bigtableConfigBuilder_; } - hash = (37 * hash) + DETACHED_FIELD_NUMBER; - hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getDetached()); - hash = (29 * hash) + unknownFields.hashCode(); - memoizedHashCode = hash; - return hash; - } - public static com.google.pubsub.v1.Subscription parseFrom(java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } + private int ackDeadlineSeconds_; - public static com.google.pubsub.v1.Subscription parseFrom( - java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } + /** + * + * + *
    +     * Optional. The approximate amount of time (on a best-effort basis) Pub/Sub
    +     * waits for the subscriber to acknowledge receipt before resending the
    +     * message. In the interval after the message is delivered and before it is
    +     * acknowledged, it is considered to be _outstanding_. During that time
    +     * period, the message will not be redelivered (on a best-effort basis).
    +     *
    +     * For pull subscriptions, this value is used as the initial value for the ack
    +     * deadline. To override this value for a given message, call
    +     * `ModifyAckDeadline` with the corresponding `ack_id` if using
    +     * non-streaming pull or send the `ack_id` in a
    +     * `StreamingModifyAckDeadlineRequest` if using streaming pull.
    +     * The minimum custom deadline you can specify is 10 seconds.
    +     * The maximum custom deadline you can specify is 600 seconds (10 minutes).
    +     * If this parameter is 0, a default value of 10 seconds is used.
    +     *
    +     * For push delivery, this value is also used to set the request timeout for
    +     * the call to the push endpoint.
    +     *
    +     * If the subscriber never acknowledges the message, the Pub/Sub
    +     * system will eventually redeliver the message.
    +     * 
    + * + * int32 ack_deadline_seconds = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The ackDeadlineSeconds. + */ + @java.lang.Override + public int getAckDeadlineSeconds() { + return ackDeadlineSeconds_; + } - public static com.google.pubsub.v1.Subscription parseFrom(com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } + /** + * + * + *
    +     * Optional. The approximate amount of time (on a best-effort basis) Pub/Sub
    +     * waits for the subscriber to acknowledge receipt before resending the
    +     * message. In the interval after the message is delivered and before it is
    +     * acknowledged, it is considered to be _outstanding_. During that time
    +     * period, the message will not be redelivered (on a best-effort basis).
    +     *
    +     * For pull subscriptions, this value is used as the initial value for the ack
    +     * deadline. To override this value for a given message, call
    +     * `ModifyAckDeadline` with the corresponding `ack_id` if using
    +     * non-streaming pull or send the `ack_id` in a
    +     * `StreamingModifyAckDeadlineRequest` if using streaming pull.
    +     * The minimum custom deadline you can specify is 10 seconds.
    +     * The maximum custom deadline you can specify is 600 seconds (10 minutes).
    +     * If this parameter is 0, a default value of 10 seconds is used.
    +     *
    +     * For push delivery, this value is also used to set the request timeout for
    +     * the call to the push endpoint.
    +     *
    +     * If the subscriber never acknowledges the message, the Pub/Sub
    +     * system will eventually redeliver the message.
    +     * 
    + * + * int32 ack_deadline_seconds = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The ackDeadlineSeconds to set. + * @return This builder for chaining. + */ + public Builder setAckDeadlineSeconds(int value) { - public static com.google.pubsub.v1.Subscription parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } + ackDeadlineSeconds_ = value; + bitField0_ |= 0x00000040; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Optional. The approximate amount of time (on a best-effort basis) Pub/Sub
    +     * waits for the subscriber to acknowledge receipt before resending the
    +     * message. In the interval after the message is delivered and before it is
    +     * acknowledged, it is considered to be _outstanding_. During that time
    +     * period, the message will not be redelivered (on a best-effort basis).
    +     *
    +     * For pull subscriptions, this value is used as the initial value for the ack
    +     * deadline. To override this value for a given message, call
    +     * `ModifyAckDeadline` with the corresponding `ack_id` if using
    +     * non-streaming pull or send the `ack_id` in a
    +     * `StreamingModifyAckDeadlineRequest` if using streaming pull.
    +     * The minimum custom deadline you can specify is 10 seconds.
    +     * The maximum custom deadline you can specify is 600 seconds (10 minutes).
    +     * If this parameter is 0, a default value of 10 seconds is used.
    +     *
    +     * For push delivery, this value is also used to set the request timeout for
    +     * the call to the push endpoint.
    +     *
    +     * If the subscriber never acknowledges the message, the Pub/Sub
    +     * system will eventually redeliver the message.
    +     * 
    + * + * int32 ack_deadline_seconds = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearAckDeadlineSeconds() { + bitField0_ = (bitField0_ & ~0x00000040); + ackDeadlineSeconds_ = 0; + onChanged(); + return this; + } - public static com.google.pubsub.v1.Subscription parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } + private boolean retainAckedMessages_; - public static com.google.pubsub.v1.Subscription parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } + /** + * + * + *
    +     * Optional. Indicates whether to retain acknowledged messages. If true, then
    +     * messages are not expunged from the subscription's backlog, even if they are
    +     * acknowledged, until they fall out of the `message_retention_duration`
    +     * window. This must be true if you would like to [`Seek` to a timestamp]
    +     * (https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time) in
    +     * the past to replay previously-acknowledged messages.
    +     * 
    + * + * bool retain_acked_messages = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The retainAckedMessages. + */ + @java.lang.Override + public boolean getRetainAckedMessages() { + return retainAckedMessages_; + } - public static com.google.pubsub.v1.Subscription parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } + /** + * + * + *
    +     * Optional. Indicates whether to retain acknowledged messages. If true, then
    +     * messages are not expunged from the subscription's backlog, even if they are
    +     * acknowledged, until they fall out of the `message_retention_duration`
    +     * window. This must be true if you would like to [`Seek` to a timestamp]
    +     * (https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time) in
    +     * the past to replay previously-acknowledged messages.
    +     * 
    + * + * bool retain_acked_messages = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The retainAckedMessages to set. + * @return This builder for chaining. + */ + public Builder setRetainAckedMessages(boolean value) { - public static com.google.pubsub.v1.Subscription parseFrom( - java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( - PARSER, input, extensionRegistry); - } + retainAckedMessages_ = value; + bitField0_ |= 0x00000080; + onChanged(); + return this; + } - public static com.google.pubsub.v1.Subscription parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } + /** + * + * + *
    +     * Optional. Indicates whether to retain acknowledged messages. If true, then
    +     * messages are not expunged from the subscription's backlog, even if they are
    +     * acknowledged, until they fall out of the `message_retention_duration`
    +     * window. This must be true if you would like to [`Seek` to a timestamp]
    +     * (https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time) in
    +     * the past to replay previously-acknowledged messages.
    +     * 
    + * + * bool retain_acked_messages = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearRetainAckedMessages() { + bitField0_ = (bitField0_ & ~0x00000080); + retainAckedMessages_ = false; + onChanged(); + return this; + } - public static com.google.pubsub.v1.Subscription parseDelimitedFrom( - java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( - PARSER, input, extensionRegistry); - } + private com.google.protobuf.Duration messageRetentionDuration_; + private com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Duration, + com.google.protobuf.Duration.Builder, + com.google.protobuf.DurationOrBuilder> + messageRetentionDurationBuilder_; - public static com.google.pubsub.v1.Subscription parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } + /** + * + * + *
    +     * Optional. How long to retain unacknowledged messages in the subscription's
    +     * backlog, from the moment a message is published. If `retain_acked_messages`
    +     * is true, then this also configures the retention of acknowledged messages,
    +     * and thus configures how far back in time a `Seek` can be done. Defaults to
    +     * 7 days. Cannot be more than 31 days or less than 10 minutes.
    +     * 
    + * + * + * .google.protobuf.Duration message_retention_duration = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the messageRetentionDuration field is set. + */ + public boolean hasMessageRetentionDuration() { + return ((bitField0_ & 0x00000100) != 0); + } - public static com.google.pubsub.v1.Subscription parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( - PARSER, input, extensionRegistry); - } + /** + * + * + *
    +     * Optional. How long to retain unacknowledged messages in the subscription's
    +     * backlog, from the moment a message is published. If `retain_acked_messages`
    +     * is true, then this also configures the retention of acknowledged messages,
    +     * and thus configures how far back in time a `Seek` can be done. Defaults to
    +     * 7 days. Cannot be more than 31 days or less than 10 minutes.
    +     * 
    + * + * + * .google.protobuf.Duration message_retention_duration = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The messageRetentionDuration. + */ + public com.google.protobuf.Duration getMessageRetentionDuration() { + if (messageRetentionDurationBuilder_ == null) { + return messageRetentionDuration_ == null + ? com.google.protobuf.Duration.getDefaultInstance() + : messageRetentionDuration_; + } else { + return messageRetentionDurationBuilder_.getMessage(); + } + } - @java.lang.Override - public Builder newBuilderForType() { - return newBuilder(); - } + /** + * + * + *
    +     * Optional. How long to retain unacknowledged messages in the subscription's
    +     * backlog, from the moment a message is published. If `retain_acked_messages`
    +     * is true, then this also configures the retention of acknowledged messages,
    +     * and thus configures how far back in time a `Seek` can be done. Defaults to
    +     * 7 days. Cannot be more than 31 days or less than 10 minutes.
    +     * 
    + * + * + * .google.protobuf.Duration message_retention_duration = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setMessageRetentionDuration(com.google.protobuf.Duration value) { + if (messageRetentionDurationBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + messageRetentionDuration_ = value; + } else { + messageRetentionDurationBuilder_.setMessage(value); + } + bitField0_ |= 0x00000100; + onChanged(); + return this; + } - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } + /** + * + * + *
    +     * Optional. How long to retain unacknowledged messages in the subscription's
    +     * backlog, from the moment a message is published. If `retain_acked_messages`
    +     * is true, then this also configures the retention of acknowledged messages,
    +     * and thus configures how far back in time a `Seek` can be done. Defaults to
    +     * 7 days. Cannot be more than 31 days or less than 10 minutes.
    +     * 
    + * + * + * .google.protobuf.Duration message_retention_duration = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setMessageRetentionDuration( + com.google.protobuf.Duration.Builder builderForValue) { + if (messageRetentionDurationBuilder_ == null) { + messageRetentionDuration_ = builderForValue.build(); + } else { + messageRetentionDurationBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000100; + onChanged(); + return this; + } - public static Builder newBuilder(com.google.pubsub.v1.Subscription prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } + /** + * + * + *
    +     * Optional. How long to retain unacknowledged messages in the subscription's
    +     * backlog, from the moment a message is published. If `retain_acked_messages`
    +     * is true, then this also configures the retention of acknowledged messages,
    +     * and thus configures how far back in time a `Seek` can be done. Defaults to
    +     * 7 days. Cannot be more than 31 days or less than 10 minutes.
    +     * 
    + * + * + * .google.protobuf.Duration message_retention_duration = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeMessageRetentionDuration(com.google.protobuf.Duration value) { + if (messageRetentionDurationBuilder_ == null) { + if (((bitField0_ & 0x00000100) != 0) + && messageRetentionDuration_ != null + && messageRetentionDuration_ != com.google.protobuf.Duration.getDefaultInstance()) { + getMessageRetentionDurationBuilder().mergeFrom(value); + } else { + messageRetentionDuration_ = value; + } + } else { + messageRetentionDurationBuilder_.mergeFrom(value); + } + if (messageRetentionDuration_ != null) { + bitField0_ |= 0x00000100; + onChanged(); + } + return this; + } - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } + /** + * + * + *
    +     * Optional. How long to retain unacknowledged messages in the subscription's
    +     * backlog, from the moment a message is published. If `retain_acked_messages`
    +     * is true, then this also configures the retention of acknowledged messages,
    +     * and thus configures how far back in time a `Seek` can be done. Defaults to
    +     * 7 days. Cannot be more than 31 days or less than 10 minutes.
    +     * 
    + * + * + * .google.protobuf.Duration message_retention_duration = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearMessageRetentionDuration() { + bitField0_ = (bitField0_ & ~0x00000100); + messageRetentionDuration_ = null; + if (messageRetentionDurationBuilder_ != null) { + messageRetentionDurationBuilder_.dispose(); + messageRetentionDurationBuilder_ = null; + } + onChanged(); + return this; + } - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * - * - *
    -   * A subscription resource.
    -   * 
    - * - * Protobuf type {@code google.pubsub.v1.Subscription} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.pubsub.v1.Subscription) - com.google.pubsub.v1.SubscriptionOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.pubsub.v1.PubsubProto - .internal_static_google_pubsub_v1_Subscription_descriptor; + /** + * + * + *
    +     * Optional. How long to retain unacknowledged messages in the subscription's
    +     * backlog, from the moment a message is published. If `retain_acked_messages`
    +     * is true, then this also configures the retention of acknowledged messages,
    +     * and thus configures how far back in time a `Seek` can be done. Defaults to
    +     * 7 days. Cannot be more than 31 days or less than 10 minutes.
    +     * 
    + * + * + * .google.protobuf.Duration message_retention_duration = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.protobuf.Duration.Builder getMessageRetentionDurationBuilder() { + bitField0_ |= 0x00000100; + onChanged(); + return internalGetMessageRetentionDurationFieldBuilder().getBuilder(); + } + + /** + * + * + *
    +     * Optional. How long to retain unacknowledged messages in the subscription's
    +     * backlog, from the moment a message is published. If `retain_acked_messages`
    +     * is true, then this also configures the retention of acknowledged messages,
    +     * and thus configures how far back in time a `Seek` can be done. Defaults to
    +     * 7 days. Cannot be more than 31 days or less than 10 minutes.
    +     * 
    + * + * + * .google.protobuf.Duration message_retention_duration = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.protobuf.DurationOrBuilder getMessageRetentionDurationOrBuilder() { + if (messageRetentionDurationBuilder_ != null) { + return messageRetentionDurationBuilder_.getMessageOrBuilder(); + } else { + return messageRetentionDuration_ == null + ? com.google.protobuf.Duration.getDefaultInstance() + : messageRetentionDuration_; + } } - @SuppressWarnings({"rawtypes"}) - protected com.google.protobuf.MapField internalGetMapField(int number) { - switch (number) { - case 9: - return internalGetLabels(); - default: - throw new RuntimeException("Invalid map field number: " + number); + /** + * + * + *
    +     * Optional. How long to retain unacknowledged messages in the subscription's
    +     * backlog, from the moment a message is published. If `retain_acked_messages`
    +     * is true, then this also configures the retention of acknowledged messages,
    +     * and thus configures how far back in time a `Seek` can be done. Defaults to
    +     * 7 days. Cannot be more than 31 days or less than 10 minutes.
    +     * 
    + * + * + * .google.protobuf.Duration message_retention_duration = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Duration, + com.google.protobuf.Duration.Builder, + com.google.protobuf.DurationOrBuilder> + internalGetMessageRetentionDurationFieldBuilder() { + if (messageRetentionDurationBuilder_ == null) { + messageRetentionDurationBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Duration, + com.google.protobuf.Duration.Builder, + com.google.protobuf.DurationOrBuilder>( + getMessageRetentionDuration(), getParentForChildren(), isClean()); + messageRetentionDuration_ = null; } + return messageRetentionDurationBuilder_; } - @SuppressWarnings({"rawtypes"}) - protected com.google.protobuf.MapField internalGetMutableMapField(int number) { - switch (number) { - case 9: - return internalGetMutableLabels(); - default: - throw new RuntimeException("Invalid map field number: " + number); + private com.google.protobuf.MapField labels_; + + private com.google.protobuf.MapField internalGetLabels() { + if (labels_ == null) { + return com.google.protobuf.MapField.emptyMapField(LabelsDefaultEntryHolder.defaultEntry); } + return labels_; } - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.pubsub.v1.PubsubProto - .internal_static_google_pubsub_v1_Subscription_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.pubsub.v1.Subscription.class, - com.google.pubsub.v1.Subscription.Builder.class); + private com.google.protobuf.MapField + internalGetMutableLabels() { + if (labels_ == null) { + labels_ = com.google.protobuf.MapField.newMapField(LabelsDefaultEntryHolder.defaultEntry); + } + if (!labels_.isMutable()) { + labels_ = labels_.copy(); + } + bitField0_ |= 0x00000200; + onChanged(); + return labels_; } - // Construct using com.google.pubsub.v1.Subscription.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); + public int getLabelsCount() { + return internalGetLabels().getMap().size(); } - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); + /** + * + * + *
    +     * Optional. See [Creating and managing
    +     * labels](https://cloud.google.com/pubsub/docs/labels).
    +     * 
    + * + * map<string, string> labels = 9 [(.google.api.field_behavior) = OPTIONAL]; + */ + @java.lang.Override + public boolean containsLabels(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetLabels().getMap().containsKey(key); } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + /** Use {@link #getLabelsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getLabels() { + return getLabelsMap(); } + /** + * + * + *
    +     * Optional. See [Creating and managing
    +     * labels](https://cloud.google.com/pubsub/docs/labels).
    +     * 
    + * + * map<string, string> labels = 9 [(.google.api.field_behavior) = OPTIONAL]; + */ @java.lang.Override - public Builder clear() { - super.clear(); - name_ = ""; + public java.util.Map getLabelsMap() { + return internalGetLabels().getMap(); + } - topic_ = ""; + /** + * + * + *
    +     * Optional. See [Creating and managing
    +     * labels](https://cloud.google.com/pubsub/docs/labels).
    +     * 
    + * + * map<string, string> labels = 9 [(.google.api.field_behavior) = OPTIONAL]; + */ + @java.lang.Override + public /* nullable */ java.lang.String getLabelsOrDefault( + java.lang.String key, + /* nullable */ + java.lang.String defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetLabels().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } - if (pushConfigBuilder_ == null) { - pushConfig_ = null; - } else { - pushConfig_ = null; - pushConfigBuilder_ = null; + /** + * + * + *
    +     * Optional. See [Creating and managing
    +     * labels](https://cloud.google.com/pubsub/docs/labels).
    +     * 
    + * + * map<string, string> labels = 9 [(.google.api.field_behavior) = OPTIONAL]; + */ + @java.lang.Override + public java.lang.String getLabelsOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); } - ackDeadlineSeconds_ = 0; + java.util.Map map = internalGetLabels().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } - retainAckedMessages_ = false; + public Builder clearLabels() { + bitField0_ = (bitField0_ & ~0x00000200); + internalGetMutableLabels().getMutableMap().clear(); + return this; + } - if (messageRetentionDurationBuilder_ == null) { - messageRetentionDuration_ = null; - } else { - messageRetentionDuration_ = null; - messageRetentionDurationBuilder_ = null; + /** + * + * + *
    +     * Optional. See [Creating and managing
    +     * labels](https://cloud.google.com/pubsub/docs/labels).
    +     * 
    + * + * map<string, string> labels = 9 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder removeLabels(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); } - internalGetMutableLabels().clear(); - enableMessageOrdering_ = false; + internalGetMutableLabels().getMutableMap().remove(key); + return this; + } - if (expirationPolicyBuilder_ == null) { - expirationPolicy_ = null; - } else { - expirationPolicy_ = null; - expirationPolicyBuilder_ = null; - } - filter_ = ""; + /** Use alternate mutation accessors instead. */ + @java.lang.Deprecated + public java.util.Map getMutableLabels() { + bitField0_ |= 0x00000200; + return internalGetMutableLabels().getMutableMap(); + } - if (deadLetterPolicyBuilder_ == null) { - deadLetterPolicy_ = null; - } else { - deadLetterPolicy_ = null; - deadLetterPolicyBuilder_ = null; + /** + * + * + *
    +     * Optional. See [Creating and managing
    +     * labels](https://cloud.google.com/pubsub/docs/labels).
    +     * 
    + * + * map<string, string> labels = 9 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder putLabels(java.lang.String key, java.lang.String value) { + if (key == null) { + throw new NullPointerException("map key"); } - if (retryPolicyBuilder_ == null) { - retryPolicy_ = null; - } else { - retryPolicy_ = null; - retryPolicyBuilder_ = null; + if (value == null) { + throw new NullPointerException("map value"); } - detached_ = false; - + internalGetMutableLabels().getMutableMap().put(key, value); + bitField0_ |= 0x00000200; return this; } - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.pubsub.v1.PubsubProto - .internal_static_google_pubsub_v1_Subscription_descriptor; + /** + * + * + *
    +     * Optional. See [Creating and managing
    +     * labels](https://cloud.google.com/pubsub/docs/labels).
    +     * 
    + * + * map<string, string> labels = 9 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder putAllLabels(java.util.Map values) { + internalGetMutableLabels().getMutableMap().putAll(values); + bitField0_ |= 0x00000200; + return this; } - @java.lang.Override - public com.google.pubsub.v1.Subscription getDefaultInstanceForType() { - return com.google.pubsub.v1.Subscription.getDefaultInstance(); - } + private boolean enableMessageOrdering_; + /** + * + * + *
    +     * Optional. If true, messages published with the same `ordering_key` in
    +     * `PubsubMessage` will be delivered to the subscribers in the order in which
    +     * they are received by the Pub/Sub system. Otherwise, they may be delivered
    +     * in any order.
    +     * 
    + * + * bool enable_message_ordering = 10 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The enableMessageOrdering. + */ @java.lang.Override - public com.google.pubsub.v1.Subscription build() { - com.google.pubsub.v1.Subscription result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; + public boolean getEnableMessageOrdering() { + return enableMessageOrdering_; } - @java.lang.Override - public com.google.pubsub.v1.Subscription buildPartial() { - com.google.pubsub.v1.Subscription result = new com.google.pubsub.v1.Subscription(this); - int from_bitField0_ = bitField0_; - result.name_ = name_; - result.topic_ = topic_; - if (pushConfigBuilder_ == null) { - result.pushConfig_ = pushConfig_; - } else { - result.pushConfig_ = pushConfigBuilder_.build(); - } - result.ackDeadlineSeconds_ = ackDeadlineSeconds_; - result.retainAckedMessages_ = retainAckedMessages_; - if (messageRetentionDurationBuilder_ == null) { - result.messageRetentionDuration_ = messageRetentionDuration_; - } else { - result.messageRetentionDuration_ = messageRetentionDurationBuilder_.build(); - } - result.labels_ = internalGetLabels(); - result.labels_.makeImmutable(); - result.enableMessageOrdering_ = enableMessageOrdering_; - if (expirationPolicyBuilder_ == null) { - result.expirationPolicy_ = expirationPolicy_; - } else { - result.expirationPolicy_ = expirationPolicyBuilder_.build(); - } - result.filter_ = filter_; - if (deadLetterPolicyBuilder_ == null) { - result.deadLetterPolicy_ = deadLetterPolicy_; - } else { - result.deadLetterPolicy_ = deadLetterPolicyBuilder_.build(); - } - if (retryPolicyBuilder_ == null) { - result.retryPolicy_ = retryPolicy_; - } else { - result.retryPolicy_ = retryPolicyBuilder_.build(); - } - result.detached_ = detached_; - onBuilt(); - return result; - } + /** + * + * + *
    +     * Optional. If true, messages published with the same `ordering_key` in
    +     * `PubsubMessage` will be delivered to the subscribers in the order in which
    +     * they are received by the Pub/Sub system. Otherwise, they may be delivered
    +     * in any order.
    +     * 
    + * + * bool enable_message_ordering = 10 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The enableMessageOrdering to set. + * @return This builder for chaining. + */ + public Builder setEnableMessageOrdering(boolean value) { - @java.lang.Override - public Builder clone() { - return super.clone(); + enableMessageOrdering_ = value; + bitField0_ |= 0x00000400; + onChanged(); + return this; } - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); + /** + * + * + *
    +     * Optional. If true, messages published with the same `ordering_key` in
    +     * `PubsubMessage` will be delivered to the subscribers in the order in which
    +     * they are received by the Pub/Sub system. Otherwise, they may be delivered
    +     * in any order.
    +     * 
    + * + * bool enable_message_ordering = 10 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearEnableMessageOrdering() { + bitField0_ = (bitField0_ & ~0x00000400); + enableMessageOrdering_ = false; + onChanged(); + return this; } - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } + private com.google.pubsub.v1.ExpirationPolicy expirationPolicy_; + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.ExpirationPolicy, + com.google.pubsub.v1.ExpirationPolicy.Builder, + com.google.pubsub.v1.ExpirationPolicyOrBuilder> + expirationPolicyBuilder_; - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); + /** + * + * + *
    +     * Optional. A policy that specifies the conditions for this subscription's
    +     * expiration. A subscription is considered active as long as any connected
    +     * subscriber is successfully consuming messages from the subscription or is
    +     * issuing operations on the subscription. If `expiration_policy` is not set,
    +     * a *default policy* with `ttl` of 31 days will be used. The minimum allowed
    +     * value for `expiration_policy.ttl` is 1 day. If `expiration_policy` is set,
    +     * but `expiration_policy.ttl` is not set, the subscription never expires.
    +     * 
    + * + * + * .google.pubsub.v1.ExpirationPolicy expiration_policy = 11 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the expirationPolicy field is set. + */ + public boolean hasExpirationPolicy() { + return ((bitField0_ & 0x00000800) != 0); } - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); + /** + * + * + *
    +     * Optional. A policy that specifies the conditions for this subscription's
    +     * expiration. A subscription is considered active as long as any connected
    +     * subscriber is successfully consuming messages from the subscription or is
    +     * issuing operations on the subscription. If `expiration_policy` is not set,
    +     * a *default policy* with `ttl` of 31 days will be used. The minimum allowed
    +     * value for `expiration_policy.ttl` is 1 day. If `expiration_policy` is set,
    +     * but `expiration_policy.ttl` is not set, the subscription never expires.
    +     * 
    + * + * + * .google.pubsub.v1.ExpirationPolicy expiration_policy = 11 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The expirationPolicy. + */ + public com.google.pubsub.v1.ExpirationPolicy getExpirationPolicy() { + if (expirationPolicyBuilder_ == null) { + return expirationPolicy_ == null + ? com.google.pubsub.v1.ExpirationPolicy.getDefaultInstance() + : expirationPolicy_; + } else { + return expirationPolicyBuilder_.getMessage(); + } } - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); + /** + * + * + *
    +     * Optional. A policy that specifies the conditions for this subscription's
    +     * expiration. A subscription is considered active as long as any connected
    +     * subscriber is successfully consuming messages from the subscription or is
    +     * issuing operations on the subscription. If `expiration_policy` is not set,
    +     * a *default policy* with `ttl` of 31 days will be used. The minimum allowed
    +     * value for `expiration_policy.ttl` is 1 day. If `expiration_policy` is set,
    +     * but `expiration_policy.ttl` is not set, the subscription never expires.
    +     * 
    + * + * + * .google.pubsub.v1.ExpirationPolicy expiration_policy = 11 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setExpirationPolicy(com.google.pubsub.v1.ExpirationPolicy value) { + if (expirationPolicyBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + expirationPolicy_ = value; + } else { + expirationPolicyBuilder_.setMessage(value); + } + bitField0_ |= 0x00000800; + onChanged(); + return this; } - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.google.pubsub.v1.Subscription) { - return mergeFrom((com.google.pubsub.v1.Subscription) other); + /** + * + * + *
    +     * Optional. A policy that specifies the conditions for this subscription's
    +     * expiration. A subscription is considered active as long as any connected
    +     * subscriber is successfully consuming messages from the subscription or is
    +     * issuing operations on the subscription. If `expiration_policy` is not set,
    +     * a *default policy* with `ttl` of 31 days will be used. The minimum allowed
    +     * value for `expiration_policy.ttl` is 1 day. If `expiration_policy` is set,
    +     * but `expiration_policy.ttl` is not set, the subscription never expires.
    +     * 
    + * + * + * .google.pubsub.v1.ExpirationPolicy expiration_policy = 11 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setExpirationPolicy( + com.google.pubsub.v1.ExpirationPolicy.Builder builderForValue) { + if (expirationPolicyBuilder_ == null) { + expirationPolicy_ = builderForValue.build(); } else { - super.mergeFrom(other); - return this; + expirationPolicyBuilder_.setMessage(builderForValue.build()); } + bitField0_ |= 0x00000800; + onChanged(); + return this; } - public Builder mergeFrom(com.google.pubsub.v1.Subscription other) { - if (other == com.google.pubsub.v1.Subscription.getDefaultInstance()) return this; - if (!other.getName().isEmpty()) { - name_ = other.name_; - onChanged(); - } - if (!other.getTopic().isEmpty()) { - topic_ = other.topic_; - onChanged(); - } - if (other.hasPushConfig()) { - mergePushConfig(other.getPushConfig()); - } - if (other.getAckDeadlineSeconds() != 0) { - setAckDeadlineSeconds(other.getAckDeadlineSeconds()); - } - if (other.getRetainAckedMessages() != false) { - setRetainAckedMessages(other.getRetainAckedMessages()); - } - if (other.hasMessageRetentionDuration()) { - mergeMessageRetentionDuration(other.getMessageRetentionDuration()); - } - internalGetMutableLabels().mergeFrom(other.internalGetLabels()); - if (other.getEnableMessageOrdering() != false) { - setEnableMessageOrdering(other.getEnableMessageOrdering()); - } - if (other.hasExpirationPolicy()) { - mergeExpirationPolicy(other.getExpirationPolicy()); + /** + * + * + *
    +     * Optional. A policy that specifies the conditions for this subscription's
    +     * expiration. A subscription is considered active as long as any connected
    +     * subscriber is successfully consuming messages from the subscription or is
    +     * issuing operations on the subscription. If `expiration_policy` is not set,
    +     * a *default policy* with `ttl` of 31 days will be used. The minimum allowed
    +     * value for `expiration_policy.ttl` is 1 day. If `expiration_policy` is set,
    +     * but `expiration_policy.ttl` is not set, the subscription never expires.
    +     * 
    + * + * + * .google.pubsub.v1.ExpirationPolicy expiration_policy = 11 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeExpirationPolicy(com.google.pubsub.v1.ExpirationPolicy value) { + if (expirationPolicyBuilder_ == null) { + if (((bitField0_ & 0x00000800) != 0) + && expirationPolicy_ != null + && expirationPolicy_ != com.google.pubsub.v1.ExpirationPolicy.getDefaultInstance()) { + getExpirationPolicyBuilder().mergeFrom(value); + } else { + expirationPolicy_ = value; + } + } else { + expirationPolicyBuilder_.mergeFrom(value); } - if (!other.getFilter().isEmpty()) { - filter_ = other.filter_; + if (expirationPolicy_ != null) { + bitField0_ |= 0x00000800; onChanged(); } - if (other.hasDeadLetterPolicy()) { - mergeDeadLetterPolicy(other.getDeadLetterPolicy()); - } - if (other.hasRetryPolicy()) { - mergeRetryPolicy(other.getRetryPolicy()); - } - if (other.getDetached() != false) { - setDetached(other.getDetached()); + return this; + } + + /** + * + * + *
    +     * Optional. A policy that specifies the conditions for this subscription's
    +     * expiration. A subscription is considered active as long as any connected
    +     * subscriber is successfully consuming messages from the subscription or is
    +     * issuing operations on the subscription. If `expiration_policy` is not set,
    +     * a *default policy* with `ttl` of 31 days will be used. The minimum allowed
    +     * value for `expiration_policy.ttl` is 1 day. If `expiration_policy` is set,
    +     * but `expiration_policy.ttl` is not set, the subscription never expires.
    +     * 
    + * + * + * .google.pubsub.v1.ExpirationPolicy expiration_policy = 11 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearExpirationPolicy() { + bitField0_ = (bitField0_ & ~0x00000800); + expirationPolicy_ = null; + if (expirationPolicyBuilder_ != null) { + expirationPolicyBuilder_.dispose(); + expirationPolicyBuilder_ = null; } - this.mergeUnknownFields(other.unknownFields); onChanged(); return this; } - @java.lang.Override - public final boolean isInitialized() { - return true; + /** + * + * + *
    +     * Optional. A policy that specifies the conditions for this subscription's
    +     * expiration. A subscription is considered active as long as any connected
    +     * subscriber is successfully consuming messages from the subscription or is
    +     * issuing operations on the subscription. If `expiration_policy` is not set,
    +     * a *default policy* with `ttl` of 31 days will be used. The minimum allowed
    +     * value for `expiration_policy.ttl` is 1 day. If `expiration_policy` is set,
    +     * but `expiration_policy.ttl` is not set, the subscription never expires.
    +     * 
    + * + * + * .google.pubsub.v1.ExpirationPolicy expiration_policy = 11 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.ExpirationPolicy.Builder getExpirationPolicyBuilder() { + bitField0_ |= 0x00000800; + onChanged(); + return internalGetExpirationPolicyFieldBuilder().getBuilder(); } - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.pubsub.v1.Subscription parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.google.pubsub.v1.Subscription) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } + /** + * + * + *
    +     * Optional. A policy that specifies the conditions for this subscription's
    +     * expiration. A subscription is considered active as long as any connected
    +     * subscriber is successfully consuming messages from the subscription or is
    +     * issuing operations on the subscription. If `expiration_policy` is not set,
    +     * a *default policy* with `ttl` of 31 days will be used. The minimum allowed
    +     * value for `expiration_policy.ttl` is 1 day. If `expiration_policy` is set,
    +     * but `expiration_policy.ttl` is not set, the subscription never expires.
    +     * 
    + * + * + * .google.pubsub.v1.ExpirationPolicy expiration_policy = 11 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.ExpirationPolicyOrBuilder getExpirationPolicyOrBuilder() { + if (expirationPolicyBuilder_ != null) { + return expirationPolicyBuilder_.getMessageOrBuilder(); + } else { + return expirationPolicy_ == null + ? com.google.pubsub.v1.ExpirationPolicy.getDefaultInstance() + : expirationPolicy_; } - return this; } - private int bitField0_; + /** + * + * + *
    +     * Optional. A policy that specifies the conditions for this subscription's
    +     * expiration. A subscription is considered active as long as any connected
    +     * subscriber is successfully consuming messages from the subscription or is
    +     * issuing operations on the subscription. If `expiration_policy` is not set,
    +     * a *default policy* with `ttl` of 31 days will be used. The minimum allowed
    +     * value for `expiration_policy.ttl` is 1 day. If `expiration_policy` is set,
    +     * but `expiration_policy.ttl` is not set, the subscription never expires.
    +     * 
    + * + * + * .google.pubsub.v1.ExpirationPolicy expiration_policy = 11 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.ExpirationPolicy, + com.google.pubsub.v1.ExpirationPolicy.Builder, + com.google.pubsub.v1.ExpirationPolicyOrBuilder> + internalGetExpirationPolicyFieldBuilder() { + if (expirationPolicyBuilder_ == null) { + expirationPolicyBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.ExpirationPolicy, + com.google.pubsub.v1.ExpirationPolicy.Builder, + com.google.pubsub.v1.ExpirationPolicyOrBuilder>( + getExpirationPolicy(), getParentForChildren(), isClean()); + expirationPolicy_ = null; + } + return expirationPolicyBuilder_; + } + + private java.lang.Object filter_ = ""; - private java.lang.Object name_ = ""; /** * * *
    -     * Required. The name of the subscription. It must have the format
    -     * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must
    -     * start with a letter, and contain only letters (`[A-Za-z]`), numbers
    -     * (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`),
    -     * plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters
    -     * in length, and it must not start with `"goog"`.
    +     * Optional. An expression written in the Pub/Sub [filter
    +     * language](https://cloud.google.com/pubsub/docs/filtering). If non-empty,
    +     * then only `PubsubMessage`s whose `attributes` field matches the filter are
    +     * delivered on this subscription. If empty, then no messages are filtered
    +     * out.
          * 
    * - * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * string filter = 12 [(.google.api.field_behavior) = OPTIONAL]; * - * @return The name. + * @return The filter. */ - public java.lang.String getName() { - java.lang.Object ref = name_; + public java.lang.String getFilter() { + java.lang.Object ref = filter_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); - name_ = s; + filter_ = s; return s; } else { return (java.lang.String) ref; } } + /** * * *
    -     * Required. The name of the subscription. It must have the format
    -     * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must
    -     * start with a letter, and contain only letters (`[A-Za-z]`), numbers
    -     * (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`),
    -     * plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters
    -     * in length, and it must not start with `"goog"`.
    +     * Optional. An expression written in the Pub/Sub [filter
    +     * language](https://cloud.google.com/pubsub/docs/filtering). If non-empty,
    +     * then only `PubsubMessage`s whose `attributes` field matches the filter are
    +     * delivered on this subscription. If empty, then no messages are filtered
    +     * out.
          * 
    * - * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * string filter = 12 [(.google.api.field_behavior) = OPTIONAL]; * - * @return The bytes for name. + * @return The bytes for filter. */ - public com.google.protobuf.ByteString getNameBytes() { - java.lang.Object ref = name_; + public com.google.protobuf.ByteString getFilterBytes() { + java.lang.Object ref = filter_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - name_ = b; + filter_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } + /** * * *
    -     * Required. The name of the subscription. It must have the format
    -     * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must
    -     * start with a letter, and contain only letters (`[A-Za-z]`), numbers
    -     * (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`),
    -     * plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters
    -     * in length, and it must not start with `"goog"`.
    +     * Optional. An expression written in the Pub/Sub [filter
    +     * language](https://cloud.google.com/pubsub/docs/filtering). If non-empty,
    +     * then only `PubsubMessage`s whose `attributes` field matches the filter are
    +     * delivered on this subscription. If empty, then no messages are filtered
    +     * out.
          * 
    * - * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * string filter = 12 [(.google.api.field_behavior) = OPTIONAL]; * - * @param value The name to set. + * @param value The filter to set. * @return This builder for chaining. */ - public Builder setName(java.lang.String value) { + public Builder setFilter(java.lang.String value) { if (value == null) { throw new NullPointerException(); } - - name_ = value; + filter_ = value; + bitField0_ |= 0x00001000; onChanged(); return this; } + /** * * *
    -     * Required. The name of the subscription. It must have the format
    -     * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must
    -     * start with a letter, and contain only letters (`[A-Za-z]`), numbers
    -     * (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`),
    -     * plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters
    -     * in length, and it must not start with `"goog"`.
    +     * Optional. An expression written in the Pub/Sub [filter
    +     * language](https://cloud.google.com/pubsub/docs/filtering). If non-empty,
    +     * then only `PubsubMessage`s whose `attributes` field matches the filter are
    +     * delivered on this subscription. If empty, then no messages are filtered
    +     * out.
          * 
    * - * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * string filter = 12 [(.google.api.field_behavior) = OPTIONAL]; * * @return This builder for chaining. */ - public Builder clearName() { - - name_ = getDefaultInstance().getName(); + public Builder clearFilter() { + filter_ = getDefaultInstance().getFilter(); + bitField0_ = (bitField0_ & ~0x00001000); onChanged(); return this; } + /** * * *
    -     * Required. The name of the subscription. It must have the format
    -     * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must
    -     * start with a letter, and contain only letters (`[A-Za-z]`), numbers
    -     * (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`),
    -     * plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters
    -     * in length, and it must not start with `"goog"`.
    +     * Optional. An expression written in the Pub/Sub [filter
    +     * language](https://cloud.google.com/pubsub/docs/filtering). If non-empty,
    +     * then only `PubsubMessage`s whose `attributes` field matches the filter are
    +     * delivered on this subscription. If empty, then no messages are filtered
    +     * out.
          * 
    * - * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * string filter = 12 [(.google.api.field_behavior) = OPTIONAL]; * - * @param value The bytes for name to set. + * @param value The bytes for filter to set. * @return This builder for chaining. */ - public Builder setNameBytes(com.google.protobuf.ByteString value) { + public Builder setFilterBytes(com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); - - name_ = value; + filter_ = value; + bitField0_ |= 0x00001000; onChanged(); return this; } - private java.lang.Object topic_ = ""; + private com.google.pubsub.v1.DeadLetterPolicy deadLetterPolicy_; + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.DeadLetterPolicy, + com.google.pubsub.v1.DeadLetterPolicy.Builder, + com.google.pubsub.v1.DeadLetterPolicyOrBuilder> + deadLetterPolicyBuilder_; + /** * * *
    -     * Required. The name of the topic from which this subscription is receiving
    -     * messages. Format is `projects/{project}/topics/{topic}`. The value of this
    -     * field will be `_deleted-topic_` if the topic has been deleted.
    +     * Optional. A policy that specifies the conditions for dead lettering
    +     * messages in this subscription. If dead_letter_policy is not set, dead
    +     * lettering is disabled.
    +     *
    +     * The Pub/Sub service account associated with this subscriptions's
    +     * parent project (i.e.,
    +     * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
    +     * permission to Acknowledge() messages on this subscription.
          * 
    * * - * string topic = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * .google.pubsub.v1.DeadLetterPolicy dead_letter_policy = 13 [(.google.api.field_behavior) = OPTIONAL]; * * - * @return The topic. + * @return Whether the deadLetterPolicy field is set. */ - public java.lang.String getTopic() { - java.lang.Object ref = topic_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - topic_ = s; - return s; - } else { - return (java.lang.String) ref; - } + public boolean hasDeadLetterPolicy() { + return ((bitField0_ & 0x00002000) != 0); } + /** * * *
    -     * Required. The name of the topic from which this subscription is receiving
    -     * messages. Format is `projects/{project}/topics/{topic}`. The value of this
    -     * field will be `_deleted-topic_` if the topic has been deleted.
    +     * Optional. A policy that specifies the conditions for dead lettering
    +     * messages in this subscription. If dead_letter_policy is not set, dead
    +     * lettering is disabled.
    +     *
    +     * The Pub/Sub service account associated with this subscriptions's
    +     * parent project (i.e.,
    +     * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
    +     * permission to Acknowledge() messages on this subscription.
          * 
    * * - * string topic = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * .google.pubsub.v1.DeadLetterPolicy dead_letter_policy = 13 [(.google.api.field_behavior) = OPTIONAL]; * * - * @return The bytes for topic. + * @return The deadLetterPolicy. */ - public com.google.protobuf.ByteString getTopicBytes() { - java.lang.Object ref = topic_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - topic_ = b; - return b; + public com.google.pubsub.v1.DeadLetterPolicy getDeadLetterPolicy() { + if (deadLetterPolicyBuilder_ == null) { + return deadLetterPolicy_ == null + ? com.google.pubsub.v1.DeadLetterPolicy.getDefaultInstance() + : deadLetterPolicy_; } else { - return (com.google.protobuf.ByteString) ref; + return deadLetterPolicyBuilder_.getMessage(); } } + /** * * *
    -     * Required. The name of the topic from which this subscription is receiving
    -     * messages. Format is `projects/{project}/topics/{topic}`. The value of this
    -     * field will be `_deleted-topic_` if the topic has been deleted.
    +     * Optional. A policy that specifies the conditions for dead lettering
    +     * messages in this subscription. If dead_letter_policy is not set, dead
    +     * lettering is disabled.
    +     *
    +     * The Pub/Sub service account associated with this subscriptions's
    +     * parent project (i.e.,
    +     * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
    +     * permission to Acknowledge() messages on this subscription.
          * 
    * * - * string topic = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * .google.pubsub.v1.DeadLetterPolicy dead_letter_policy = 13 [(.google.api.field_behavior) = OPTIONAL]; * - * - * @param value The topic to set. - * @return This builder for chaining. */ - public Builder setTopic(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); + public Builder setDeadLetterPolicy(com.google.pubsub.v1.DeadLetterPolicy value) { + if (deadLetterPolicyBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + deadLetterPolicy_ = value; + } else { + deadLetterPolicyBuilder_.setMessage(value); } - - topic_ = value; + bitField0_ |= 0x00002000; onChanged(); return this; } + /** * * *
    -     * Required. The name of the topic from which this subscription is receiving
    -     * messages. Format is `projects/{project}/topics/{topic}`. The value of this
    -     * field will be `_deleted-topic_` if the topic has been deleted.
    +     * Optional. A policy that specifies the conditions for dead lettering
    +     * messages in this subscription. If dead_letter_policy is not set, dead
    +     * lettering is disabled.
    +     *
    +     * The Pub/Sub service account associated with this subscriptions's
    +     * parent project (i.e.,
    +     * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
    +     * permission to Acknowledge() messages on this subscription.
          * 
    * * - * string topic = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * .google.pubsub.v1.DeadLetterPolicy dead_letter_policy = 13 [(.google.api.field_behavior) = OPTIONAL]; * + */ + public Builder setDeadLetterPolicy( + com.google.pubsub.v1.DeadLetterPolicy.Builder builderForValue) { + if (deadLetterPolicyBuilder_ == null) { + deadLetterPolicy_ = builderForValue.build(); + } else { + deadLetterPolicyBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00002000; + onChanged(); + return this; + } + + /** * - * @return This builder for chaining. + * + *
    +     * Optional. A policy that specifies the conditions for dead lettering
    +     * messages in this subscription. If dead_letter_policy is not set, dead
    +     * lettering is disabled.
    +     *
    +     * The Pub/Sub service account associated with this subscriptions's
    +     * parent project (i.e.,
    +     * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
    +     * permission to Acknowledge() messages on this subscription.
    +     * 
    + * + * + * .google.pubsub.v1.DeadLetterPolicy dead_letter_policy = 13 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public Builder clearTopic() { + public Builder mergeDeadLetterPolicy(com.google.pubsub.v1.DeadLetterPolicy value) { + if (deadLetterPolicyBuilder_ == null) { + if (((bitField0_ & 0x00002000) != 0) + && deadLetterPolicy_ != null + && deadLetterPolicy_ != com.google.pubsub.v1.DeadLetterPolicy.getDefaultInstance()) { + getDeadLetterPolicyBuilder().mergeFrom(value); + } else { + deadLetterPolicy_ = value; + } + } else { + deadLetterPolicyBuilder_.mergeFrom(value); + } + if (deadLetterPolicy_ != null) { + bitField0_ |= 0x00002000; + onChanged(); + } + return this; + } - topic_ = getDefaultInstance().getTopic(); + /** + * + * + *
    +     * Optional. A policy that specifies the conditions for dead lettering
    +     * messages in this subscription. If dead_letter_policy is not set, dead
    +     * lettering is disabled.
    +     *
    +     * The Pub/Sub service account associated with this subscriptions's
    +     * parent project (i.e.,
    +     * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
    +     * permission to Acknowledge() messages on this subscription.
    +     * 
    + * + * + * .google.pubsub.v1.DeadLetterPolicy dead_letter_policy = 13 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearDeadLetterPolicy() { + bitField0_ = (bitField0_ & ~0x00002000); + deadLetterPolicy_ = null; + if (deadLetterPolicyBuilder_ != null) { + deadLetterPolicyBuilder_.dispose(); + deadLetterPolicyBuilder_ = null; + } onChanged(); return this; } + /** * * *
    -     * Required. The name of the topic from which this subscription is receiving
    -     * messages. Format is `projects/{project}/topics/{topic}`. The value of this
    -     * field will be `_deleted-topic_` if the topic has been deleted.
    +     * Optional. A policy that specifies the conditions for dead lettering
    +     * messages in this subscription. If dead_letter_policy is not set, dead
    +     * lettering is disabled.
    +     *
    +     * The Pub/Sub service account associated with this subscriptions's
    +     * parent project (i.e.,
    +     * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
    +     * permission to Acknowledge() messages on this subscription.
    +     * 
    + * + * + * .google.pubsub.v1.DeadLetterPolicy dead_letter_policy = 13 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.DeadLetterPolicy.Builder getDeadLetterPolicyBuilder() { + bitField0_ |= 0x00002000; + onChanged(); + return internalGetDeadLetterPolicyFieldBuilder().getBuilder(); + } + + /** + * + * + *
    +     * Optional. A policy that specifies the conditions for dead lettering
    +     * messages in this subscription. If dead_letter_policy is not set, dead
    +     * lettering is disabled.
    +     *
    +     * The Pub/Sub service account associated with this subscriptions's
    +     * parent project (i.e.,
    +     * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
    +     * permission to Acknowledge() messages on this subscription.
    +     * 
    + * + * + * .google.pubsub.v1.DeadLetterPolicy dead_letter_policy = 13 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.DeadLetterPolicyOrBuilder getDeadLetterPolicyOrBuilder() { + if (deadLetterPolicyBuilder_ != null) { + return deadLetterPolicyBuilder_.getMessageOrBuilder(); + } else { + return deadLetterPolicy_ == null + ? com.google.pubsub.v1.DeadLetterPolicy.getDefaultInstance() + : deadLetterPolicy_; + } + } + + /** + * + * + *
    +     * Optional. A policy that specifies the conditions for dead lettering
    +     * messages in this subscription. If dead_letter_policy is not set, dead
    +     * lettering is disabled.
    +     *
    +     * The Pub/Sub service account associated with this subscriptions's
    +     * parent project (i.e.,
    +     * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
    +     * permission to Acknowledge() messages on this subscription.
          * 
    * * - * string topic = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * .google.pubsub.v1.DeadLetterPolicy dead_letter_policy = 13 [(.google.api.field_behavior) = OPTIONAL]; * - * - * @param value The bytes for topic to set. - * @return This builder for chaining. */ - public Builder setTopicBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.DeadLetterPolicy, + com.google.pubsub.v1.DeadLetterPolicy.Builder, + com.google.pubsub.v1.DeadLetterPolicyOrBuilder> + internalGetDeadLetterPolicyFieldBuilder() { + if (deadLetterPolicyBuilder_ == null) { + deadLetterPolicyBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.DeadLetterPolicy, + com.google.pubsub.v1.DeadLetterPolicy.Builder, + com.google.pubsub.v1.DeadLetterPolicyOrBuilder>( + getDeadLetterPolicy(), getParentForChildren(), isClean()); + deadLetterPolicy_ = null; } - checkByteStringIsUtf8(value); - - topic_ = value; - onChanged(); - return this; + return deadLetterPolicyBuilder_; } - private com.google.pubsub.v1.PushConfig pushConfig_; - private com.google.protobuf.SingleFieldBuilderV3< - com.google.pubsub.v1.PushConfig, - com.google.pubsub.v1.PushConfig.Builder, - com.google.pubsub.v1.PushConfigOrBuilder> - pushConfigBuilder_; + private com.google.pubsub.v1.RetryPolicy retryPolicy_; + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.RetryPolicy, + com.google.pubsub.v1.RetryPolicy.Builder, + com.google.pubsub.v1.RetryPolicyOrBuilder> + retryPolicyBuilder_; + /** * * *
    -     * If push delivery is used with this subscription, this field is
    -     * used to configure it. An empty `pushConfig` signifies that the subscriber
    -     * will pull and ack messages using API methods.
    +     * Optional. A policy that specifies how Pub/Sub retries message delivery for
    +     * this subscription.
    +     *
    +     * If not set, the default retry policy is applied. This generally implies
    +     * that messages will be retried as soon as possible for healthy subscribers.
    +     * RetryPolicy will be triggered on NACKs or acknowledgment deadline exceeded
    +     * events for a given message.
          * 
    * - * .google.pubsub.v1.PushConfig push_config = 4; + * + * .google.pubsub.v1.RetryPolicy retry_policy = 14 [(.google.api.field_behavior) = OPTIONAL]; + * * - * @return Whether the pushConfig field is set. + * @return Whether the retryPolicy field is set. */ - public boolean hasPushConfig() { - return pushConfigBuilder_ != null || pushConfig_ != null; + public boolean hasRetryPolicy() { + return ((bitField0_ & 0x00004000) != 0); } + /** * * *
    -     * If push delivery is used with this subscription, this field is
    -     * used to configure it. An empty `pushConfig` signifies that the subscriber
    -     * will pull and ack messages using API methods.
    +     * Optional. A policy that specifies how Pub/Sub retries message delivery for
    +     * this subscription.
    +     *
    +     * If not set, the default retry policy is applied. This generally implies
    +     * that messages will be retried as soon as possible for healthy subscribers.
    +     * RetryPolicy will be triggered on NACKs or acknowledgment deadline exceeded
    +     * events for a given message.
          * 
    * - * .google.pubsub.v1.PushConfig push_config = 4; + * + * .google.pubsub.v1.RetryPolicy retry_policy = 14 [(.google.api.field_behavior) = OPTIONAL]; + * * - * @return The pushConfig. + * @return The retryPolicy. */ - public com.google.pubsub.v1.PushConfig getPushConfig() { - if (pushConfigBuilder_ == null) { - return pushConfig_ == null - ? com.google.pubsub.v1.PushConfig.getDefaultInstance() - : pushConfig_; + public com.google.pubsub.v1.RetryPolicy getRetryPolicy() { + if (retryPolicyBuilder_ == null) { + return retryPolicy_ == null + ? com.google.pubsub.v1.RetryPolicy.getDefaultInstance() + : retryPolicy_; } else { - return pushConfigBuilder_.getMessage(); + return retryPolicyBuilder_.getMessage(); } } + /** * * *
    -     * If push delivery is used with this subscription, this field is
    -     * used to configure it. An empty `pushConfig` signifies that the subscriber
    -     * will pull and ack messages using API methods.
    +     * Optional. A policy that specifies how Pub/Sub retries message delivery for
    +     * this subscription.
    +     *
    +     * If not set, the default retry policy is applied. This generally implies
    +     * that messages will be retried as soon as possible for healthy subscribers.
    +     * RetryPolicy will be triggered on NACKs or acknowledgment deadline exceeded
    +     * events for a given message.
          * 
    * - * .google.pubsub.v1.PushConfig push_config = 4; + * + * .google.pubsub.v1.RetryPolicy retry_policy = 14 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public Builder setPushConfig(com.google.pubsub.v1.PushConfig value) { - if (pushConfigBuilder_ == null) { + public Builder setRetryPolicy(com.google.pubsub.v1.RetryPolicy value) { + if (retryPolicyBuilder_ == null) { if (value == null) { throw new NullPointerException(); } - pushConfig_ = value; - onChanged(); + retryPolicy_ = value; } else { - pushConfigBuilder_.setMessage(value); + retryPolicyBuilder_.setMessage(value); } - + bitField0_ |= 0x00004000; + onChanged(); return this; } + /** * * *
    -     * If push delivery is used with this subscription, this field is
    -     * used to configure it. An empty `pushConfig` signifies that the subscriber
    -     * will pull and ack messages using API methods.
    +     * Optional. A policy that specifies how Pub/Sub retries message delivery for
    +     * this subscription.
    +     *
    +     * If not set, the default retry policy is applied. This generally implies
    +     * that messages will be retried as soon as possible for healthy subscribers.
    +     * RetryPolicy will be triggered on NACKs or acknowledgment deadline exceeded
    +     * events for a given message.
          * 
    * - * .google.pubsub.v1.PushConfig push_config = 4; + * + * .google.pubsub.v1.RetryPolicy retry_policy = 14 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public Builder setPushConfig(com.google.pubsub.v1.PushConfig.Builder builderForValue) { - if (pushConfigBuilder_ == null) { - pushConfig_ = builderForValue.build(); - onChanged(); + public Builder setRetryPolicy(com.google.pubsub.v1.RetryPolicy.Builder builderForValue) { + if (retryPolicyBuilder_ == null) { + retryPolicy_ = builderForValue.build(); } else { - pushConfigBuilder_.setMessage(builderForValue.build()); + retryPolicyBuilder_.setMessage(builderForValue.build()); } - + bitField0_ |= 0x00004000; + onChanged(); return this; } + /** * * *
    -     * If push delivery is used with this subscription, this field is
    -     * used to configure it. An empty `pushConfig` signifies that the subscriber
    -     * will pull and ack messages using API methods.
    +     * Optional. A policy that specifies how Pub/Sub retries message delivery for
    +     * this subscription.
    +     *
    +     * If not set, the default retry policy is applied. This generally implies
    +     * that messages will be retried as soon as possible for healthy subscribers.
    +     * RetryPolicy will be triggered on NACKs or acknowledgment deadline exceeded
    +     * events for a given message.
          * 
    * - * .google.pubsub.v1.PushConfig push_config = 4; + * + * .google.pubsub.v1.RetryPolicy retry_policy = 14 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public Builder mergePushConfig(com.google.pubsub.v1.PushConfig value) { - if (pushConfigBuilder_ == null) { - if (pushConfig_ != null) { - pushConfig_ = - com.google.pubsub.v1.PushConfig.newBuilder(pushConfig_) - .mergeFrom(value) - .buildPartial(); + public Builder mergeRetryPolicy(com.google.pubsub.v1.RetryPolicy value) { + if (retryPolicyBuilder_ == null) { + if (((bitField0_ & 0x00004000) != 0) + && retryPolicy_ != null + && retryPolicy_ != com.google.pubsub.v1.RetryPolicy.getDefaultInstance()) { + getRetryPolicyBuilder().mergeFrom(value); } else { - pushConfig_ = value; + retryPolicy_ = value; } - onChanged(); } else { - pushConfigBuilder_.mergeFrom(value); + retryPolicyBuilder_.mergeFrom(value); + } + if (retryPolicy_ != null) { + bitField0_ |= 0x00004000; + onChanged(); } - return this; } + /** * * *
    -     * If push delivery is used with this subscription, this field is
    -     * used to configure it. An empty `pushConfig` signifies that the subscriber
    -     * will pull and ack messages using API methods.
    +     * Optional. A policy that specifies how Pub/Sub retries message delivery for
    +     * this subscription.
    +     *
    +     * If not set, the default retry policy is applied. This generally implies
    +     * that messages will be retried as soon as possible for healthy subscribers.
    +     * RetryPolicy will be triggered on NACKs or acknowledgment deadline exceeded
    +     * events for a given message.
          * 
    * - * .google.pubsub.v1.PushConfig push_config = 4; + * + * .google.pubsub.v1.RetryPolicy retry_policy = 14 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public Builder clearPushConfig() { - if (pushConfigBuilder_ == null) { - pushConfig_ = null; - onChanged(); - } else { - pushConfig_ = null; - pushConfigBuilder_ = null; + public Builder clearRetryPolicy() { + bitField0_ = (bitField0_ & ~0x00004000); + retryPolicy_ = null; + if (retryPolicyBuilder_ != null) { + retryPolicyBuilder_.dispose(); + retryPolicyBuilder_ = null; } - + onChanged(); return this; } + /** * * *
    -     * If push delivery is used with this subscription, this field is
    -     * used to configure it. An empty `pushConfig` signifies that the subscriber
    -     * will pull and ack messages using API methods.
    +     * Optional. A policy that specifies how Pub/Sub retries message delivery for
    +     * this subscription.
    +     *
    +     * If not set, the default retry policy is applied. This generally implies
    +     * that messages will be retried as soon as possible for healthy subscribers.
    +     * RetryPolicy will be triggered on NACKs or acknowledgment deadline exceeded
    +     * events for a given message.
          * 
    * - * .google.pubsub.v1.PushConfig push_config = 4; + * + * .google.pubsub.v1.RetryPolicy retry_policy = 14 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public com.google.pubsub.v1.PushConfig.Builder getPushConfigBuilder() { - + public com.google.pubsub.v1.RetryPolicy.Builder getRetryPolicyBuilder() { + bitField0_ |= 0x00004000; onChanged(); - return getPushConfigFieldBuilder().getBuilder(); + return internalGetRetryPolicyFieldBuilder().getBuilder(); } + /** * * *
    -     * If push delivery is used with this subscription, this field is
    -     * used to configure it. An empty `pushConfig` signifies that the subscriber
    -     * will pull and ack messages using API methods.
    +     * Optional. A policy that specifies how Pub/Sub retries message delivery for
    +     * this subscription.
    +     *
    +     * If not set, the default retry policy is applied. This generally implies
    +     * that messages will be retried as soon as possible for healthy subscribers.
    +     * RetryPolicy will be triggered on NACKs or acknowledgment deadline exceeded
    +     * events for a given message.
          * 
    * - * .google.pubsub.v1.PushConfig push_config = 4; + * + * .google.pubsub.v1.RetryPolicy retry_policy = 14 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public com.google.pubsub.v1.PushConfigOrBuilder getPushConfigOrBuilder() { - if (pushConfigBuilder_ != null) { - return pushConfigBuilder_.getMessageOrBuilder(); + public com.google.pubsub.v1.RetryPolicyOrBuilder getRetryPolicyOrBuilder() { + if (retryPolicyBuilder_ != null) { + return retryPolicyBuilder_.getMessageOrBuilder(); } else { - return pushConfig_ == null - ? com.google.pubsub.v1.PushConfig.getDefaultInstance() - : pushConfig_; + return retryPolicy_ == null + ? com.google.pubsub.v1.RetryPolicy.getDefaultInstance() + : retryPolicy_; } } + /** * * *
    -     * If push delivery is used with this subscription, this field is
    -     * used to configure it. An empty `pushConfig` signifies that the subscriber
    -     * will pull and ack messages using API methods.
    +     * Optional. A policy that specifies how Pub/Sub retries message delivery for
    +     * this subscription.
    +     *
    +     * If not set, the default retry policy is applied. This generally implies
    +     * that messages will be retried as soon as possible for healthy subscribers.
    +     * RetryPolicy will be triggered on NACKs or acknowledgment deadline exceeded
    +     * events for a given message.
          * 
    * - * .google.pubsub.v1.PushConfig push_config = 4; + * + * .google.pubsub.v1.RetryPolicy retry_policy = 14 [(.google.api.field_behavior) = OPTIONAL]; + * */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.pubsub.v1.PushConfig, - com.google.pubsub.v1.PushConfig.Builder, - com.google.pubsub.v1.PushConfigOrBuilder> - getPushConfigFieldBuilder() { - if (pushConfigBuilder_ == null) { - pushConfigBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - com.google.pubsub.v1.PushConfig, - com.google.pubsub.v1.PushConfig.Builder, - com.google.pubsub.v1.PushConfigOrBuilder>( - getPushConfig(), getParentForChildren(), isClean()); - pushConfig_ = null; + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.RetryPolicy, + com.google.pubsub.v1.RetryPolicy.Builder, + com.google.pubsub.v1.RetryPolicyOrBuilder> + internalGetRetryPolicyFieldBuilder() { + if (retryPolicyBuilder_ == null) { + retryPolicyBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.RetryPolicy, + com.google.pubsub.v1.RetryPolicy.Builder, + com.google.pubsub.v1.RetryPolicyOrBuilder>( + getRetryPolicy(), getParentForChildren(), isClean()); + retryPolicy_ = null; } - return pushConfigBuilder_; + return retryPolicyBuilder_; } - private int ackDeadlineSeconds_; + private boolean detached_; + /** * * *
    -     * The approximate amount of time (on a best-effort basis) Pub/Sub waits for
    -     * the subscriber to acknowledge receipt before resending the message. In the
    -     * interval after the message is delivered and before it is acknowledged, it
    -     * is considered to be <i>outstanding</i>. During that time period, the
    -     * message will not be redelivered (on a best-effort basis).
    -     * For pull subscriptions, this value is used as the initial value for the ack
    -     * deadline. To override this value for a given message, call
    -     * `ModifyAckDeadline` with the corresponding `ack_id` if using
    -     * non-streaming pull or send the `ack_id` in a
    -     * `StreamingModifyAckDeadlineRequest` if using streaming pull.
    -     * The minimum custom deadline you can specify is 10 seconds.
    -     * The maximum custom deadline you can specify is 600 seconds (10 minutes).
    -     * If this parameter is 0, a default value of 10 seconds is used.
    -     * For push delivery, this value is also used to set the request timeout for
    -     * the call to the push endpoint.
    -     * If the subscriber never acknowledges the message, the Pub/Sub
    -     * system will eventually redeliver the message.
    +     * Optional. Indicates whether the subscription is detached from its topic.
    +     * Detached subscriptions don't receive messages from their topic and don't
    +     * retain any backlog. `Pull` and `StreamingPull` requests will return
    +     * FAILED_PRECONDITION. If the subscription is a push subscription, pushes to
    +     * the endpoint will not be made.
          * 
    * - * int32 ack_deadline_seconds = 5; + * bool detached = 15 [(.google.api.field_behavior) = OPTIONAL]; * - * @return The ackDeadlineSeconds. + * @return The detached. */ @java.lang.Override - public int getAckDeadlineSeconds() { - return ackDeadlineSeconds_; + public boolean getDetached() { + return detached_; } + /** * * *
    -     * The approximate amount of time (on a best-effort basis) Pub/Sub waits for
    -     * the subscriber to acknowledge receipt before resending the message. In the
    -     * interval after the message is delivered and before it is acknowledged, it
    -     * is considered to be <i>outstanding</i>. During that time period, the
    -     * message will not be redelivered (on a best-effort basis).
    -     * For pull subscriptions, this value is used as the initial value for the ack
    -     * deadline. To override this value for a given message, call
    -     * `ModifyAckDeadline` with the corresponding `ack_id` if using
    -     * non-streaming pull or send the `ack_id` in a
    -     * `StreamingModifyAckDeadlineRequest` if using streaming pull.
    -     * The minimum custom deadline you can specify is 10 seconds.
    -     * The maximum custom deadline you can specify is 600 seconds (10 minutes).
    -     * If this parameter is 0, a default value of 10 seconds is used.
    -     * For push delivery, this value is also used to set the request timeout for
    -     * the call to the push endpoint.
    -     * If the subscriber never acknowledges the message, the Pub/Sub
    -     * system will eventually redeliver the message.
    +     * Optional. Indicates whether the subscription is detached from its topic.
    +     * Detached subscriptions don't receive messages from their topic and don't
    +     * retain any backlog. `Pull` and `StreamingPull` requests will return
    +     * FAILED_PRECONDITION. If the subscription is a push subscription, pushes to
    +     * the endpoint will not be made.
          * 
    * - * int32 ack_deadline_seconds = 5; + * bool detached = 15 [(.google.api.field_behavior) = OPTIONAL]; * - * @param value The ackDeadlineSeconds to set. + * @param value The detached to set. * @return This builder for chaining. */ - public Builder setAckDeadlineSeconds(int value) { + public Builder setDetached(boolean value) { - ackDeadlineSeconds_ = value; + detached_ = value; + bitField0_ |= 0x00008000; onChanged(); return this; } + /** * * *
    -     * The approximate amount of time (on a best-effort basis) Pub/Sub waits for
    -     * the subscriber to acknowledge receipt before resending the message. In the
    -     * interval after the message is delivered and before it is acknowledged, it
    -     * is considered to be <i>outstanding</i>. During that time period, the
    -     * message will not be redelivered (on a best-effort basis).
    -     * For pull subscriptions, this value is used as the initial value for the ack
    -     * deadline. To override this value for a given message, call
    -     * `ModifyAckDeadline` with the corresponding `ack_id` if using
    -     * non-streaming pull or send the `ack_id` in a
    -     * `StreamingModifyAckDeadlineRequest` if using streaming pull.
    -     * The minimum custom deadline you can specify is 10 seconds.
    -     * The maximum custom deadline you can specify is 600 seconds (10 minutes).
    -     * If this parameter is 0, a default value of 10 seconds is used.
    -     * For push delivery, this value is also used to set the request timeout for
    -     * the call to the push endpoint.
    -     * If the subscriber never acknowledges the message, the Pub/Sub
    -     * system will eventually redeliver the message.
    +     * Optional. Indicates whether the subscription is detached from its topic.
    +     * Detached subscriptions don't receive messages from their topic and don't
    +     * retain any backlog. `Pull` and `StreamingPull` requests will return
    +     * FAILED_PRECONDITION. If the subscription is a push subscription, pushes to
    +     * the endpoint will not be made.
          * 
    * - * int32 ack_deadline_seconds = 5; + * bool detached = 15 [(.google.api.field_behavior) = OPTIONAL]; * - * @return This builder for chaining. - */ - public Builder clearAckDeadlineSeconds() { - - ackDeadlineSeconds_ = 0; + * @return This builder for chaining. + */ + public Builder clearDetached() { + bitField0_ = (bitField0_ & ~0x00008000); + detached_ = false; onChanged(); return this; } - private boolean retainAckedMessages_; + private boolean enableExactlyOnceDelivery_; + /** * * *
    -     * Indicates whether to retain acknowledged messages. If true, then
    -     * messages are not expunged from the subscription's backlog, even if they are
    -     * acknowledged, until they fall out of the `message_retention_duration`
    -     * window. This must be true if you would like to [Seek to a timestamp]
    -     * (https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time).
    +     * Optional. If true, Pub/Sub provides the following guarantees for the
    +     * delivery of a message with a given value of `message_id` on this
    +     * subscription:
    +     *
    +     * * The message sent to a subscriber is guaranteed not to be resent
    +     * before the message's acknowledgment deadline expires.
    +     * * An acknowledged message will not be resent to a subscriber.
    +     *
    +     * Note that subscribers may still receive multiple copies of a message
    +     * when `enable_exactly_once_delivery` is true if the message was published
    +     * multiple times by a publisher client. These copies are  considered distinct
    +     * by Pub/Sub and have distinct `message_id` values.
          * 
    * - * bool retain_acked_messages = 7; + * bool enable_exactly_once_delivery = 16 [(.google.api.field_behavior) = OPTIONAL]; + * * - * @return The retainAckedMessages. + * @return The enableExactlyOnceDelivery. */ @java.lang.Override - public boolean getRetainAckedMessages() { - return retainAckedMessages_; + public boolean getEnableExactlyOnceDelivery() { + return enableExactlyOnceDelivery_; } + /** * * *
    -     * Indicates whether to retain acknowledged messages. If true, then
    -     * messages are not expunged from the subscription's backlog, even if they are
    -     * acknowledged, until they fall out of the `message_retention_duration`
    -     * window. This must be true if you would like to [Seek to a timestamp]
    -     * (https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time).
    +     * Optional. If true, Pub/Sub provides the following guarantees for the
    +     * delivery of a message with a given value of `message_id` on this
    +     * subscription:
    +     *
    +     * * The message sent to a subscriber is guaranteed not to be resent
    +     * before the message's acknowledgment deadline expires.
    +     * * An acknowledged message will not be resent to a subscriber.
    +     *
    +     * Note that subscribers may still receive multiple copies of a message
    +     * when `enable_exactly_once_delivery` is true if the message was published
    +     * multiple times by a publisher client. These copies are  considered distinct
    +     * by Pub/Sub and have distinct `message_id` values.
          * 
    * - * bool retain_acked_messages = 7; + * bool enable_exactly_once_delivery = 16 [(.google.api.field_behavior) = OPTIONAL]; + * * - * @param value The retainAckedMessages to set. + * @param value The enableExactlyOnceDelivery to set. * @return This builder for chaining. */ - public Builder setRetainAckedMessages(boolean value) { + public Builder setEnableExactlyOnceDelivery(boolean value) { - retainAckedMessages_ = value; + enableExactlyOnceDelivery_ = value; + bitField0_ |= 0x00010000; onChanged(); return this; } + /** * * *
    -     * Indicates whether to retain acknowledged messages. If true, then
    -     * messages are not expunged from the subscription's backlog, even if they are
    -     * acknowledged, until they fall out of the `message_retention_duration`
    -     * window. This must be true if you would like to [Seek to a timestamp]
    -     * (https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time).
    +     * Optional. If true, Pub/Sub provides the following guarantees for the
    +     * delivery of a message with a given value of `message_id` on this
    +     * subscription:
    +     *
    +     * * The message sent to a subscriber is guaranteed not to be resent
    +     * before the message's acknowledgment deadline expires.
    +     * * An acknowledged message will not be resent to a subscriber.
    +     *
    +     * Note that subscribers may still receive multiple copies of a message
    +     * when `enable_exactly_once_delivery` is true if the message was published
    +     * multiple times by a publisher client. These copies are  considered distinct
    +     * by Pub/Sub and have distinct `message_id` values.
          * 
    * - * bool retain_acked_messages = 7; + * bool enable_exactly_once_delivery = 16 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return This builder for chaining. */ - public Builder clearRetainAckedMessages() { - - retainAckedMessages_ = false; + public Builder clearEnableExactlyOnceDelivery() { + bitField0_ = (bitField0_ & ~0x00010000); + enableExactlyOnceDelivery_ = false; onChanged(); return this; } - private com.google.protobuf.Duration messageRetentionDuration_; - private com.google.protobuf.SingleFieldBuilderV3< + private com.google.protobuf.Duration topicMessageRetentionDuration_; + private com.google.protobuf.SingleFieldBuilder< com.google.protobuf.Duration, com.google.protobuf.Duration.Builder, com.google.protobuf.DurationOrBuilder> - messageRetentionDurationBuilder_; + topicMessageRetentionDurationBuilder_; + /** * * *
    -     * How long to retain unacknowledged messages in the subscription's backlog,
    -     * from the moment a message is published.
    -     * If `retain_acked_messages` is true, then this also configures the retention
    -     * of acknowledged messages, and thus configures how far back in time a `Seek`
    -     * can be done. Defaults to 7 days. Cannot be more than 7 days or less than 10
    -     * minutes.
    +     * Output only. Indicates the minimum duration for which a message is retained
    +     * after it is published to the subscription's topic. If this field is set,
    +     * messages published to the subscription's topic in the last
    +     * `topic_message_retention_duration` are always available to subscribers. See
    +     * the `message_retention_duration` field in `Topic`. This field is set only
    +     * in responses from the server; it is ignored if it is set in any requests.
          * 
    * - * .google.protobuf.Duration message_retention_duration = 8; + * + * .google.protobuf.Duration topic_message_retention_duration = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * * - * @return Whether the messageRetentionDuration field is set. + * @return Whether the topicMessageRetentionDuration field is set. */ - public boolean hasMessageRetentionDuration() { - return messageRetentionDurationBuilder_ != null || messageRetentionDuration_ != null; + public boolean hasTopicMessageRetentionDuration() { + return ((bitField0_ & 0x00020000) != 0); } + /** * * *
    -     * How long to retain unacknowledged messages in the subscription's backlog,
    -     * from the moment a message is published.
    -     * If `retain_acked_messages` is true, then this also configures the retention
    -     * of acknowledged messages, and thus configures how far back in time a `Seek`
    -     * can be done. Defaults to 7 days. Cannot be more than 7 days or less than 10
    -     * minutes.
    +     * Output only. Indicates the minimum duration for which a message is retained
    +     * after it is published to the subscription's topic. If this field is set,
    +     * messages published to the subscription's topic in the last
    +     * `topic_message_retention_duration` are always available to subscribers. See
    +     * the `message_retention_duration` field in `Topic`. This field is set only
    +     * in responses from the server; it is ignored if it is set in any requests.
          * 
    * - * .google.protobuf.Duration message_retention_duration = 8; + * + * .google.protobuf.Duration topic_message_retention_duration = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * * - * @return The messageRetentionDuration. + * @return The topicMessageRetentionDuration. */ - public com.google.protobuf.Duration getMessageRetentionDuration() { - if (messageRetentionDurationBuilder_ == null) { - return messageRetentionDuration_ == null + public com.google.protobuf.Duration getTopicMessageRetentionDuration() { + if (topicMessageRetentionDurationBuilder_ == null) { + return topicMessageRetentionDuration_ == null ? com.google.protobuf.Duration.getDefaultInstance() - : messageRetentionDuration_; + : topicMessageRetentionDuration_; } else { - return messageRetentionDurationBuilder_.getMessage(); + return topicMessageRetentionDurationBuilder_.getMessage(); } } + /** * * *
    -     * How long to retain unacknowledged messages in the subscription's backlog,
    -     * from the moment a message is published.
    -     * If `retain_acked_messages` is true, then this also configures the retention
    -     * of acknowledged messages, and thus configures how far back in time a `Seek`
    -     * can be done. Defaults to 7 days. Cannot be more than 7 days or less than 10
    -     * minutes.
    +     * Output only. Indicates the minimum duration for which a message is retained
    +     * after it is published to the subscription's topic. If this field is set,
    +     * messages published to the subscription's topic in the last
    +     * `topic_message_retention_duration` are always available to subscribers. See
    +     * the `message_retention_duration` field in `Topic`. This field is set only
    +     * in responses from the server; it is ignored if it is set in any requests.
          * 
    * - * .google.protobuf.Duration message_retention_duration = 8; + * + * .google.protobuf.Duration topic_message_retention_duration = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * */ - public Builder setMessageRetentionDuration(com.google.protobuf.Duration value) { - if (messageRetentionDurationBuilder_ == null) { + public Builder setTopicMessageRetentionDuration(com.google.protobuf.Duration value) { + if (topicMessageRetentionDurationBuilder_ == null) { if (value == null) { throw new NullPointerException(); } - messageRetentionDuration_ = value; - onChanged(); + topicMessageRetentionDuration_ = value; } else { - messageRetentionDurationBuilder_.setMessage(value); + topicMessageRetentionDurationBuilder_.setMessage(value); } - + bitField0_ |= 0x00020000; + onChanged(); return this; } + /** * * *
    -     * How long to retain unacknowledged messages in the subscription's backlog,
    -     * from the moment a message is published.
    -     * If `retain_acked_messages` is true, then this also configures the retention
    -     * of acknowledged messages, and thus configures how far back in time a `Seek`
    -     * can be done. Defaults to 7 days. Cannot be more than 7 days or less than 10
    -     * minutes.
    +     * Output only. Indicates the minimum duration for which a message is retained
    +     * after it is published to the subscription's topic. If this field is set,
    +     * messages published to the subscription's topic in the last
    +     * `topic_message_retention_duration` are always available to subscribers. See
    +     * the `message_retention_duration` field in `Topic`. This field is set only
    +     * in responses from the server; it is ignored if it is set in any requests.
          * 
    * - * .google.protobuf.Duration message_retention_duration = 8; + * + * .google.protobuf.Duration topic_message_retention_duration = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * */ - public Builder setMessageRetentionDuration( + public Builder setTopicMessageRetentionDuration( com.google.protobuf.Duration.Builder builderForValue) { - if (messageRetentionDurationBuilder_ == null) { - messageRetentionDuration_ = builderForValue.build(); - onChanged(); + if (topicMessageRetentionDurationBuilder_ == null) { + topicMessageRetentionDuration_ = builderForValue.build(); } else { - messageRetentionDurationBuilder_.setMessage(builderForValue.build()); + topicMessageRetentionDurationBuilder_.setMessage(builderForValue.build()); } - + bitField0_ |= 0x00020000; + onChanged(); return this; } + /** * * *
    -     * How long to retain unacknowledged messages in the subscription's backlog,
    -     * from the moment a message is published.
    -     * If `retain_acked_messages` is true, then this also configures the retention
    -     * of acknowledged messages, and thus configures how far back in time a `Seek`
    -     * can be done. Defaults to 7 days. Cannot be more than 7 days or less than 10
    -     * minutes.
    +     * Output only. Indicates the minimum duration for which a message is retained
    +     * after it is published to the subscription's topic. If this field is set,
    +     * messages published to the subscription's topic in the last
    +     * `topic_message_retention_duration` are always available to subscribers. See
    +     * the `message_retention_duration` field in `Topic`. This field is set only
    +     * in responses from the server; it is ignored if it is set in any requests.
          * 
    * - * .google.protobuf.Duration message_retention_duration = 8; + * + * .google.protobuf.Duration topic_message_retention_duration = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * */ - public Builder mergeMessageRetentionDuration(com.google.protobuf.Duration value) { - if (messageRetentionDurationBuilder_ == null) { - if (messageRetentionDuration_ != null) { - messageRetentionDuration_ = - com.google.protobuf.Duration.newBuilder(messageRetentionDuration_) - .mergeFrom(value) - .buildPartial(); + public Builder mergeTopicMessageRetentionDuration(com.google.protobuf.Duration value) { + if (topicMessageRetentionDurationBuilder_ == null) { + if (((bitField0_ & 0x00020000) != 0) + && topicMessageRetentionDuration_ != null + && topicMessageRetentionDuration_ + != com.google.protobuf.Duration.getDefaultInstance()) { + getTopicMessageRetentionDurationBuilder().mergeFrom(value); } else { - messageRetentionDuration_ = value; + topicMessageRetentionDuration_ = value; } - onChanged(); } else { - messageRetentionDurationBuilder_.mergeFrom(value); + topicMessageRetentionDurationBuilder_.mergeFrom(value); + } + if (topicMessageRetentionDuration_ != null) { + bitField0_ |= 0x00020000; + onChanged(); } - return this; } + /** * * *
    -     * How long to retain unacknowledged messages in the subscription's backlog,
    -     * from the moment a message is published.
    -     * If `retain_acked_messages` is true, then this also configures the retention
    -     * of acknowledged messages, and thus configures how far back in time a `Seek`
    -     * can be done. Defaults to 7 days. Cannot be more than 7 days or less than 10
    -     * minutes.
    +     * Output only. Indicates the minimum duration for which a message is retained
    +     * after it is published to the subscription's topic. If this field is set,
    +     * messages published to the subscription's topic in the last
    +     * `topic_message_retention_duration` are always available to subscribers. See
    +     * the `message_retention_duration` field in `Topic`. This field is set only
    +     * in responses from the server; it is ignored if it is set in any requests.
          * 
    * - * .google.protobuf.Duration message_retention_duration = 8; + * + * .google.protobuf.Duration topic_message_retention_duration = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * */ - public Builder clearMessageRetentionDuration() { - if (messageRetentionDurationBuilder_ == null) { - messageRetentionDuration_ = null; - onChanged(); - } else { - messageRetentionDuration_ = null; - messageRetentionDurationBuilder_ = null; + public Builder clearTopicMessageRetentionDuration() { + bitField0_ = (bitField0_ & ~0x00020000); + topicMessageRetentionDuration_ = null; + if (topicMessageRetentionDurationBuilder_ != null) { + topicMessageRetentionDurationBuilder_.dispose(); + topicMessageRetentionDurationBuilder_ = null; } - + onChanged(); return this; } + /** * * *
    -     * How long to retain unacknowledged messages in the subscription's backlog,
    -     * from the moment a message is published.
    -     * If `retain_acked_messages` is true, then this also configures the retention
    -     * of acknowledged messages, and thus configures how far back in time a `Seek`
    -     * can be done. Defaults to 7 days. Cannot be more than 7 days or less than 10
    -     * minutes.
    +     * Output only. Indicates the minimum duration for which a message is retained
    +     * after it is published to the subscription's topic. If this field is set,
    +     * messages published to the subscription's topic in the last
    +     * `topic_message_retention_duration` are always available to subscribers. See
    +     * the `message_retention_duration` field in `Topic`. This field is set only
    +     * in responses from the server; it is ignored if it is set in any requests.
          * 
    * - * .google.protobuf.Duration message_retention_duration = 8; + * + * .google.protobuf.Duration topic_message_retention_duration = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * */ - public com.google.protobuf.Duration.Builder getMessageRetentionDurationBuilder() { - + public com.google.protobuf.Duration.Builder getTopicMessageRetentionDurationBuilder() { + bitField0_ |= 0x00020000; onChanged(); - return getMessageRetentionDurationFieldBuilder().getBuilder(); + return internalGetTopicMessageRetentionDurationFieldBuilder().getBuilder(); } + /** * * *
    -     * How long to retain unacknowledged messages in the subscription's backlog,
    -     * from the moment a message is published.
    -     * If `retain_acked_messages` is true, then this also configures the retention
    -     * of acknowledged messages, and thus configures how far back in time a `Seek`
    -     * can be done. Defaults to 7 days. Cannot be more than 7 days or less than 10
    -     * minutes.
    +     * Output only. Indicates the minimum duration for which a message is retained
    +     * after it is published to the subscription's topic. If this field is set,
    +     * messages published to the subscription's topic in the last
    +     * `topic_message_retention_duration` are always available to subscribers. See
    +     * the `message_retention_duration` field in `Topic`. This field is set only
    +     * in responses from the server; it is ignored if it is set in any requests.
          * 
    * - * .google.protobuf.Duration message_retention_duration = 8; + * + * .google.protobuf.Duration topic_message_retention_duration = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * */ - public com.google.protobuf.DurationOrBuilder getMessageRetentionDurationOrBuilder() { - if (messageRetentionDurationBuilder_ != null) { - return messageRetentionDurationBuilder_.getMessageOrBuilder(); + public com.google.protobuf.DurationOrBuilder getTopicMessageRetentionDurationOrBuilder() { + if (topicMessageRetentionDurationBuilder_ != null) { + return topicMessageRetentionDurationBuilder_.getMessageOrBuilder(); } else { - return messageRetentionDuration_ == null + return topicMessageRetentionDuration_ == null ? com.google.protobuf.Duration.getDefaultInstance() - : messageRetentionDuration_; + : topicMessageRetentionDuration_; } } + /** * * *
    -     * How long to retain unacknowledged messages in the subscription's backlog,
    -     * from the moment a message is published.
    -     * If `retain_acked_messages` is true, then this also configures the retention
    -     * of acknowledged messages, and thus configures how far back in time a `Seek`
    -     * can be done. Defaults to 7 days. Cannot be more than 7 days or less than 10
    -     * minutes.
    +     * Output only. Indicates the minimum duration for which a message is retained
    +     * after it is published to the subscription's topic. If this field is set,
    +     * messages published to the subscription's topic in the last
    +     * `topic_message_retention_duration` are always available to subscribers. See
    +     * the `message_retention_duration` field in `Topic`. This field is set only
    +     * in responses from the server; it is ignored if it is set in any requests.
          * 
    * - * .google.protobuf.Duration message_retention_duration = 8; + * + * .google.protobuf.Duration topic_message_retention_duration = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * */ - private com.google.protobuf.SingleFieldBuilderV3< + private com.google.protobuf.SingleFieldBuilder< com.google.protobuf.Duration, com.google.protobuf.Duration.Builder, com.google.protobuf.DurationOrBuilder> - getMessageRetentionDurationFieldBuilder() { - if (messageRetentionDurationBuilder_ == null) { - messageRetentionDurationBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< + internalGetTopicMessageRetentionDurationFieldBuilder() { + if (topicMessageRetentionDurationBuilder_ == null) { + topicMessageRetentionDurationBuilder_ = + new com.google.protobuf.SingleFieldBuilder< com.google.protobuf.Duration, com.google.protobuf.Duration.Builder, com.google.protobuf.DurationOrBuilder>( - getMessageRetentionDuration(), getParentForChildren(), isClean()); - messageRetentionDuration_ = null; - } - return messageRetentionDurationBuilder_; - } - - private com.google.protobuf.MapField labels_; - - private com.google.protobuf.MapField internalGetLabels() { - if (labels_ == null) { - return com.google.protobuf.MapField.emptyMapField(LabelsDefaultEntryHolder.defaultEntry); + getTopicMessageRetentionDuration(), getParentForChildren(), isClean()); + topicMessageRetentionDuration_ = null; } - return labels_; + return topicMessageRetentionDurationBuilder_; } - private com.google.protobuf.MapField - internalGetMutableLabels() { - onChanged(); - ; - if (labels_ == null) { - labels_ = com.google.protobuf.MapField.newMapField(LabelsDefaultEntryHolder.defaultEntry); - } - if (!labels_.isMutable()) { - labels_ = labels_.copy(); - } - return labels_; - } + private int state_ = 0; - public int getLabelsCount() { - return internalGetLabels().getMap().size(); - } - /** - * - * - *
    -     * See <a href="https://cloud.google.com/pubsub/docs/labels"> Creating and
    -     * managing labels</a>.
    -     * 
    - * - * map<string, string> labels = 9; - */ - @java.lang.Override - public boolean containsLabels(java.lang.String key) { - if (key == null) { - throw new java.lang.NullPointerException(); - } - return internalGetLabels().getMap().containsKey(key); - } - /** Use {@link #getLabelsMap()} instead. */ - @java.lang.Override - @java.lang.Deprecated - public java.util.Map getLabels() { - return getLabelsMap(); - } - /** - * - * - *
    -     * See <a href="https://cloud.google.com/pubsub/docs/labels"> Creating and
    -     * managing labels</a>.
    -     * 
    - * - * map<string, string> labels = 9; - */ - @java.lang.Override - public java.util.Map getLabelsMap() { - return internalGetLabels().getMap(); - } /** * * *
    -     * See <a href="https://cloud.google.com/pubsub/docs/labels"> Creating and
    -     * managing labels</a>.
    +     * Output only. An output-only field indicating whether or not the
    +     * subscription can receive messages.
          * 
    * - * map<string, string> labels = 9; - */ - @java.lang.Override - public java.lang.String getLabelsOrDefault( - java.lang.String key, java.lang.String defaultValue) { - if (key == null) { - throw new java.lang.NullPointerException(); - } - java.util.Map map = internalGetLabels().getMap(); - return map.containsKey(key) ? map.get(key) : defaultValue; - } - /** - * - * - *
    -     * See <a href="https://cloud.google.com/pubsub/docs/labels"> Creating and
    -     * managing labels</a>.
    -     * 
    + * + * .google.pubsub.v1.Subscription.State state = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * * - * map<string, string> labels = 9; + * @return The enum numeric value on the wire for state. */ @java.lang.Override - public java.lang.String getLabelsOrThrow(java.lang.String key) { - if (key == null) { - throw new java.lang.NullPointerException(); - } - java.util.Map map = internalGetLabels().getMap(); - if (!map.containsKey(key)) { - throw new java.lang.IllegalArgumentException(); - } - return map.get(key); + public int getStateValue() { + return state_; } - public Builder clearLabels() { - internalGetMutableLabels().getMutableMap().clear(); - return this; - } - /** - * - * - *
    -     * See <a href="https://cloud.google.com/pubsub/docs/labels"> Creating and
    -     * managing labels</a>.
    -     * 
    - * - * map<string, string> labels = 9; - */ - public Builder removeLabels(java.lang.String key) { - if (key == null) { - throw new java.lang.NullPointerException(); - } - internalGetMutableLabels().getMutableMap().remove(key); - return this; - } - /** Use alternate mutation accessors instead. */ - @java.lang.Deprecated - public java.util.Map getMutableLabels() { - return internalGetMutableLabels().getMutableMap(); - } /** * * *
    -     * See <a href="https://cloud.google.com/pubsub/docs/labels"> Creating and
    -     * managing labels</a>.
    +     * Output only. An output-only field indicating whether or not the
    +     * subscription can receive messages.
          * 
    * - * map<string, string> labels = 9; - */ - public Builder putLabels(java.lang.String key, java.lang.String value) { - if (key == null) { - throw new java.lang.NullPointerException(); - } - if (value == null) { - throw new java.lang.NullPointerException(); - } - internalGetMutableLabels().getMutableMap().put(key, value); - return this; - } - /** - * - * - *
    -     * See <a href="https://cloud.google.com/pubsub/docs/labels"> Creating and
    -     * managing labels</a>.
    -     * 
    + * + * .google.pubsub.v1.Subscription.State state = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * * - * map<string, string> labels = 9; + * @param value The enum numeric value on the wire for state to set. + * @return This builder for chaining. */ - public Builder putAllLabels(java.util.Map values) { - internalGetMutableLabels().getMutableMap().putAll(values); + public Builder setStateValue(int value) { + state_ = value; + bitField0_ |= 0x00040000; + onChanged(); return this; } - private boolean enableMessageOrdering_; /** * * *
    -     * If true, messages published with the same `ordering_key` in `PubsubMessage`
    -     * will be delivered to the subscribers in the order in which they
    -     * are received by the Pub/Sub system. Otherwise, they may be delivered in
    -     * any order.
    +     * Output only. An output-only field indicating whether or not the
    +     * subscription can receive messages.
          * 
    * - * bool enable_message_ordering = 10; + * + * .google.pubsub.v1.Subscription.State state = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * * - * @return The enableMessageOrdering. + * @return The state. */ @java.lang.Override - public boolean getEnableMessageOrdering() { - return enableMessageOrdering_; + public com.google.pubsub.v1.Subscription.State getState() { + com.google.pubsub.v1.Subscription.State result = + com.google.pubsub.v1.Subscription.State.forNumber(state_); + return result == null ? com.google.pubsub.v1.Subscription.State.UNRECOGNIZED : result; } + /** * * *
    -     * If true, messages published with the same `ordering_key` in `PubsubMessage`
    -     * will be delivered to the subscribers in the order in which they
    -     * are received by the Pub/Sub system. Otherwise, they may be delivered in
    -     * any order.
    +     * Output only. An output-only field indicating whether or not the
    +     * subscription can receive messages.
          * 
    * - * bool enable_message_ordering = 10; + * + * .google.pubsub.v1.Subscription.State state = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * * - * @param value The enableMessageOrdering to set. + * @param value The state to set. * @return This builder for chaining. */ - public Builder setEnableMessageOrdering(boolean value) { - - enableMessageOrdering_ = value; + public Builder setState(com.google.pubsub.v1.Subscription.State value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00040000; + state_ = value.getNumber(); onChanged(); return this; } + /** * * *
    -     * If true, messages published with the same `ordering_key` in `PubsubMessage`
    -     * will be delivered to the subscribers in the order in which they
    -     * are received by the Pub/Sub system. Otherwise, they may be delivered in
    -     * any order.
    +     * Output only. An output-only field indicating whether or not the
    +     * subscription can receive messages.
          * 
    * - * bool enable_message_ordering = 10; + * + * .google.pubsub.v1.Subscription.State state = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * * * @return This builder for chaining. */ - public Builder clearEnableMessageOrdering() { - - enableMessageOrdering_ = false; + public Builder clearState() { + bitField0_ = (bitField0_ & ~0x00040000); + state_ = 0; onChanged(); return this; } - private com.google.pubsub.v1.ExpirationPolicy expirationPolicy_; - private com.google.protobuf.SingleFieldBuilderV3< - com.google.pubsub.v1.ExpirationPolicy, - com.google.pubsub.v1.ExpirationPolicy.Builder, - com.google.pubsub.v1.ExpirationPolicyOrBuilder> - expirationPolicyBuilder_; + private com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo + analyticsHubSubscriptionInfo_; + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo, + com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo.Builder, + com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfoOrBuilder> + analyticsHubSubscriptionInfoBuilder_; + /** * * *
    -     * A policy that specifies the conditions for this subscription's expiration.
    -     * A subscription is considered active as long as any connected subscriber is
    -     * successfully consuming messages from the subscription or is issuing
    -     * operations on the subscription. If `expiration_policy` is not set, a
    -     * *default policy* with `ttl` of 31 days will be used. The minimum allowed
    -     * value for `expiration_policy.ttl` is 1 day.
    +     * Output only. Information about the associated Analytics Hub subscription.
    +     * Only set if the subscription is created by Analytics Hub.
          * 
    * - * .google.pubsub.v1.ExpirationPolicy expiration_policy = 11; + * + * .google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo analytics_hub_subscription_info = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * * - * @return Whether the expirationPolicy field is set. + * @return Whether the analyticsHubSubscriptionInfo field is set. */ - public boolean hasExpirationPolicy() { - return expirationPolicyBuilder_ != null || expirationPolicy_ != null; + public boolean hasAnalyticsHubSubscriptionInfo() { + return ((bitField0_ & 0x00080000) != 0); } + /** * * *
    -     * A policy that specifies the conditions for this subscription's expiration.
    -     * A subscription is considered active as long as any connected subscriber is
    -     * successfully consuming messages from the subscription or is issuing
    -     * operations on the subscription. If `expiration_policy` is not set, a
    -     * *default policy* with `ttl` of 31 days will be used. The minimum allowed
    -     * value for `expiration_policy.ttl` is 1 day.
    +     * Output only. Information about the associated Analytics Hub subscription.
    +     * Only set if the subscription is created by Analytics Hub.
          * 
    * - * .google.pubsub.v1.ExpirationPolicy expiration_policy = 11; + * + * .google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo analytics_hub_subscription_info = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * * - * @return The expirationPolicy. + * @return The analyticsHubSubscriptionInfo. */ - public com.google.pubsub.v1.ExpirationPolicy getExpirationPolicy() { - if (expirationPolicyBuilder_ == null) { - return expirationPolicy_ == null - ? com.google.pubsub.v1.ExpirationPolicy.getDefaultInstance() - : expirationPolicy_; + public com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo + getAnalyticsHubSubscriptionInfo() { + if (analyticsHubSubscriptionInfoBuilder_ == null) { + return analyticsHubSubscriptionInfo_ == null + ? com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo.getDefaultInstance() + : analyticsHubSubscriptionInfo_; } else { - return expirationPolicyBuilder_.getMessage(); + return analyticsHubSubscriptionInfoBuilder_.getMessage(); } } + /** * * *
    -     * A policy that specifies the conditions for this subscription's expiration.
    -     * A subscription is considered active as long as any connected subscriber is
    -     * successfully consuming messages from the subscription or is issuing
    -     * operations on the subscription. If `expiration_policy` is not set, a
    -     * *default policy* with `ttl` of 31 days will be used. The minimum allowed
    -     * value for `expiration_policy.ttl` is 1 day.
    +     * Output only. Information about the associated Analytics Hub subscription.
    +     * Only set if the subscription is created by Analytics Hub.
          * 
    * - * .google.pubsub.v1.ExpirationPolicy expiration_policy = 11; + * + * .google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo analytics_hub_subscription_info = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * */ - public Builder setExpirationPolicy(com.google.pubsub.v1.ExpirationPolicy value) { - if (expirationPolicyBuilder_ == null) { + public Builder setAnalyticsHubSubscriptionInfo( + com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo value) { + if (analyticsHubSubscriptionInfoBuilder_ == null) { if (value == null) { throw new NullPointerException(); } - expirationPolicy_ = value; - onChanged(); + analyticsHubSubscriptionInfo_ = value; } else { - expirationPolicyBuilder_.setMessage(value); + analyticsHubSubscriptionInfoBuilder_.setMessage(value); } - + bitField0_ |= 0x00080000; + onChanged(); return this; } + /** * * *
    -     * A policy that specifies the conditions for this subscription's expiration.
    -     * A subscription is considered active as long as any connected subscriber is
    -     * successfully consuming messages from the subscription or is issuing
    -     * operations on the subscription. If `expiration_policy` is not set, a
    -     * *default policy* with `ttl` of 31 days will be used. The minimum allowed
    -     * value for `expiration_policy.ttl` is 1 day.
    +     * Output only. Information about the associated Analytics Hub subscription.
    +     * Only set if the subscription is created by Analytics Hub.
          * 
    * - * .google.pubsub.v1.ExpirationPolicy expiration_policy = 11; + * + * .google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo analytics_hub_subscription_info = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * */ - public Builder setExpirationPolicy( - com.google.pubsub.v1.ExpirationPolicy.Builder builderForValue) { - if (expirationPolicyBuilder_ == null) { - expirationPolicy_ = builderForValue.build(); - onChanged(); + public Builder setAnalyticsHubSubscriptionInfo( + com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo.Builder builderForValue) { + if (analyticsHubSubscriptionInfoBuilder_ == null) { + analyticsHubSubscriptionInfo_ = builderForValue.build(); } else { - expirationPolicyBuilder_.setMessage(builderForValue.build()); + analyticsHubSubscriptionInfoBuilder_.setMessage(builderForValue.build()); } - + bitField0_ |= 0x00080000; + onChanged(); return this; } + /** * * *
    -     * A policy that specifies the conditions for this subscription's expiration.
    -     * A subscription is considered active as long as any connected subscriber is
    -     * successfully consuming messages from the subscription or is issuing
    -     * operations on the subscription. If `expiration_policy` is not set, a
    -     * *default policy* with `ttl` of 31 days will be used. The minimum allowed
    -     * value for `expiration_policy.ttl` is 1 day.
    +     * Output only. Information about the associated Analytics Hub subscription.
    +     * Only set if the subscription is created by Analytics Hub.
          * 
    * - * .google.pubsub.v1.ExpirationPolicy expiration_policy = 11; + * + * .google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo analytics_hub_subscription_info = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * */ - public Builder mergeExpirationPolicy(com.google.pubsub.v1.ExpirationPolicy value) { - if (expirationPolicyBuilder_ == null) { - if (expirationPolicy_ != null) { - expirationPolicy_ = - com.google.pubsub.v1.ExpirationPolicy.newBuilder(expirationPolicy_) - .mergeFrom(value) - .buildPartial(); + public Builder mergeAnalyticsHubSubscriptionInfo( + com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo value) { + if (analyticsHubSubscriptionInfoBuilder_ == null) { + if (((bitField0_ & 0x00080000) != 0) + && analyticsHubSubscriptionInfo_ != null + && analyticsHubSubscriptionInfo_ + != com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo + .getDefaultInstance()) { + getAnalyticsHubSubscriptionInfoBuilder().mergeFrom(value); } else { - expirationPolicy_ = value; + analyticsHubSubscriptionInfo_ = value; } - onChanged(); } else { - expirationPolicyBuilder_.mergeFrom(value); + analyticsHubSubscriptionInfoBuilder_.mergeFrom(value); + } + if (analyticsHubSubscriptionInfo_ != null) { + bitField0_ |= 0x00080000; + onChanged(); } - return this; } + /** * * *
    -     * A policy that specifies the conditions for this subscription's expiration.
    -     * A subscription is considered active as long as any connected subscriber is
    -     * successfully consuming messages from the subscription or is issuing
    -     * operations on the subscription. If `expiration_policy` is not set, a
    -     * *default policy* with `ttl` of 31 days will be used. The minimum allowed
    -     * value for `expiration_policy.ttl` is 1 day.
    +     * Output only. Information about the associated Analytics Hub subscription.
    +     * Only set if the subscription is created by Analytics Hub.
          * 
    * - * .google.pubsub.v1.ExpirationPolicy expiration_policy = 11; + * + * .google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo analytics_hub_subscription_info = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * */ - public Builder clearExpirationPolicy() { - if (expirationPolicyBuilder_ == null) { - expirationPolicy_ = null; - onChanged(); - } else { - expirationPolicy_ = null; - expirationPolicyBuilder_ = null; + public Builder clearAnalyticsHubSubscriptionInfo() { + bitField0_ = (bitField0_ & ~0x00080000); + analyticsHubSubscriptionInfo_ = null; + if (analyticsHubSubscriptionInfoBuilder_ != null) { + analyticsHubSubscriptionInfoBuilder_.dispose(); + analyticsHubSubscriptionInfoBuilder_ = null; } - + onChanged(); return this; } + /** * * *
    -     * A policy that specifies the conditions for this subscription's expiration.
    -     * A subscription is considered active as long as any connected subscriber is
    -     * successfully consuming messages from the subscription or is issuing
    -     * operations on the subscription. If `expiration_policy` is not set, a
    -     * *default policy* with `ttl` of 31 days will be used. The minimum allowed
    -     * value for `expiration_policy.ttl` is 1 day.
    +     * Output only. Information about the associated Analytics Hub subscription.
    +     * Only set if the subscription is created by Analytics Hub.
          * 
    * - * .google.pubsub.v1.ExpirationPolicy expiration_policy = 11; + * + * .google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo analytics_hub_subscription_info = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * */ - public com.google.pubsub.v1.ExpirationPolicy.Builder getExpirationPolicyBuilder() { - + public com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo.Builder + getAnalyticsHubSubscriptionInfoBuilder() { + bitField0_ |= 0x00080000; onChanged(); - return getExpirationPolicyFieldBuilder().getBuilder(); + return internalGetAnalyticsHubSubscriptionInfoFieldBuilder().getBuilder(); } + /** * * *
    -     * A policy that specifies the conditions for this subscription's expiration.
    -     * A subscription is considered active as long as any connected subscriber is
    -     * successfully consuming messages from the subscription or is issuing
    -     * operations on the subscription. If `expiration_policy` is not set, a
    -     * *default policy* with `ttl` of 31 days will be used. The minimum allowed
    -     * value for `expiration_policy.ttl` is 1 day.
    +     * Output only. Information about the associated Analytics Hub subscription.
    +     * Only set if the subscription is created by Analytics Hub.
          * 
    * - * .google.pubsub.v1.ExpirationPolicy expiration_policy = 11; + * + * .google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo analytics_hub_subscription_info = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * */ - public com.google.pubsub.v1.ExpirationPolicyOrBuilder getExpirationPolicyOrBuilder() { - if (expirationPolicyBuilder_ != null) { - return expirationPolicyBuilder_.getMessageOrBuilder(); + public com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfoOrBuilder + getAnalyticsHubSubscriptionInfoOrBuilder() { + if (analyticsHubSubscriptionInfoBuilder_ != null) { + return analyticsHubSubscriptionInfoBuilder_.getMessageOrBuilder(); } else { - return expirationPolicy_ == null - ? com.google.pubsub.v1.ExpirationPolicy.getDefaultInstance() - : expirationPolicy_; + return analyticsHubSubscriptionInfo_ == null + ? com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo.getDefaultInstance() + : analyticsHubSubscriptionInfo_; } } + /** * * *
    -     * A policy that specifies the conditions for this subscription's expiration.
    -     * A subscription is considered active as long as any connected subscriber is
    -     * successfully consuming messages from the subscription or is issuing
    -     * operations on the subscription. If `expiration_policy` is not set, a
    -     * *default policy* with `ttl` of 31 days will be used. The minimum allowed
    -     * value for `expiration_policy.ttl` is 1 day.
    +     * Output only. Information about the associated Analytics Hub subscription.
    +     * Only set if the subscription is created by Analytics Hub.
          * 
    * - * .google.pubsub.v1.ExpirationPolicy expiration_policy = 11; + * + * .google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo analytics_hub_subscription_info = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.pubsub.v1.ExpirationPolicy, - com.google.pubsub.v1.ExpirationPolicy.Builder, - com.google.pubsub.v1.ExpirationPolicyOrBuilder> - getExpirationPolicyFieldBuilder() { - if (expirationPolicyBuilder_ == null) { - expirationPolicyBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - com.google.pubsub.v1.ExpirationPolicy, - com.google.pubsub.v1.ExpirationPolicy.Builder, - com.google.pubsub.v1.ExpirationPolicyOrBuilder>( - getExpirationPolicy(), getParentForChildren(), isClean()); - expirationPolicy_ = null; + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo, + com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo.Builder, + com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfoOrBuilder> + internalGetAnalyticsHubSubscriptionInfoFieldBuilder() { + if (analyticsHubSubscriptionInfoBuilder_ == null) { + analyticsHubSubscriptionInfoBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo, + com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo.Builder, + com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfoOrBuilder>( + getAnalyticsHubSubscriptionInfo(), getParentForChildren(), isClean()); + analyticsHubSubscriptionInfo_ = null; } - return expirationPolicyBuilder_; + return analyticsHubSubscriptionInfoBuilder_; } - private java.lang.Object filter_ = ""; + private java.util.List messageTransforms_ = + java.util.Collections.emptyList(); + + private void ensureMessageTransformsIsMutable() { + if (!((bitField0_ & 0x00100000) != 0)) { + messageTransforms_ = + new java.util.ArrayList(messageTransforms_); + bitField0_ |= 0x00100000; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + com.google.pubsub.v1.MessageTransform, + com.google.pubsub.v1.MessageTransform.Builder, + com.google.pubsub.v1.MessageTransformOrBuilder> + messageTransformsBuilder_; + /** * * *
    -     * An expression written in the Pub/Sub [filter
    -     * language](https://cloud.google.com/pubsub/docs/filtering). If non-empty,
    -     * then only `PubsubMessage`s whose `attributes` field matches the filter are
    -     * delivered on this subscription. If empty, then no messages are filtered
    -     * out.
    +     * Optional. Transforms to be applied to messages before they are delivered to
    +     * subscribers. Transforms are applied in the order specified.
          * 
    * - * string filter = 12; - * - * @return The filter. + * + * repeated .google.pubsub.v1.MessageTransform message_transforms = 25 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public java.lang.String getFilter() { - java.lang.Object ref = filter_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - filter_ = s; - return s; + public java.util.List getMessageTransformsList() { + if (messageTransformsBuilder_ == null) { + return java.util.Collections.unmodifiableList(messageTransforms_); } else { - return (java.lang.String) ref; + return messageTransformsBuilder_.getMessageList(); } } + /** * * *
    -     * An expression written in the Pub/Sub [filter
    -     * language](https://cloud.google.com/pubsub/docs/filtering). If non-empty,
    -     * then only `PubsubMessage`s whose `attributes` field matches the filter are
    -     * delivered on this subscription. If empty, then no messages are filtered
    -     * out.
    +     * Optional. Transforms to be applied to messages before they are delivered to
    +     * subscribers. Transforms are applied in the order specified.
          * 
    * - * string filter = 12; - * - * @return The bytes for filter. + * + * repeated .google.pubsub.v1.MessageTransform message_transforms = 25 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public com.google.protobuf.ByteString getFilterBytes() { - java.lang.Object ref = filter_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - filter_ = b; - return b; + public int getMessageTransformsCount() { + if (messageTransformsBuilder_ == null) { + return messageTransforms_.size(); } else { - return (com.google.protobuf.ByteString) ref; + return messageTransformsBuilder_.getCount(); } } + /** * * *
    -     * An expression written in the Pub/Sub [filter
    -     * language](https://cloud.google.com/pubsub/docs/filtering). If non-empty,
    -     * then only `PubsubMessage`s whose `attributes` field matches the filter are
    -     * delivered on this subscription. If empty, then no messages are filtered
    -     * out.
    +     * Optional. Transforms to be applied to messages before they are delivered to
    +     * subscribers. Transforms are applied in the order specified.
          * 
    * - * string filter = 12; - * - * @param value The filter to set. - * @return This builder for chaining. + * + * repeated .google.pubsub.v1.MessageTransform message_transforms = 25 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public Builder setFilter(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); + public com.google.pubsub.v1.MessageTransform getMessageTransforms(int index) { + if (messageTransformsBuilder_ == null) { + return messageTransforms_.get(index); + } else { + return messageTransformsBuilder_.getMessage(index); } - - filter_ = value; - onChanged(); - return this; } - /** - * - * - *
    -     * An expression written in the Pub/Sub [filter
    -     * language](https://cloud.google.com/pubsub/docs/filtering). If non-empty,
    -     * then only `PubsubMessage`s whose `attributes` field matches the filter are
    -     * delivered on this subscription. If empty, then no messages are filtered
    -     * out.
    -     * 
    - * - * string filter = 12; - * - * @return This builder for chaining. - */ - public Builder clearFilter() { - filter_ = getDefaultInstance().getFilter(); - onChanged(); - return this; - } /** * * *
    -     * An expression written in the Pub/Sub [filter
    -     * language](https://cloud.google.com/pubsub/docs/filtering). If non-empty,
    -     * then only `PubsubMessage`s whose `attributes` field matches the filter are
    -     * delivered on this subscription. If empty, then no messages are filtered
    -     * out.
    +     * Optional. Transforms to be applied to messages before they are delivered to
    +     * subscribers. Transforms are applied in the order specified.
          * 
    * - * string filter = 12; - * - * @param value The bytes for filter to set. - * @return This builder for chaining. + * + * repeated .google.pubsub.v1.MessageTransform message_transforms = 25 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public Builder setFilterBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); + public Builder setMessageTransforms(int index, com.google.pubsub.v1.MessageTransform value) { + if (messageTransformsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureMessageTransformsIsMutable(); + messageTransforms_.set(index, value); + onChanged(); + } else { + messageTransformsBuilder_.setMessage(index, value); } - checkByteStringIsUtf8(value); - - filter_ = value; - onChanged(); return this; } - private com.google.pubsub.v1.DeadLetterPolicy deadLetterPolicy_; - private com.google.protobuf.SingleFieldBuilderV3< - com.google.pubsub.v1.DeadLetterPolicy, - com.google.pubsub.v1.DeadLetterPolicy.Builder, - com.google.pubsub.v1.DeadLetterPolicyOrBuilder> - deadLetterPolicyBuilder_; /** * * *
    -     * A policy that specifies the conditions for dead lettering messages in
    -     * this subscription. If dead_letter_policy is not set, dead lettering
    -     * is disabled.
    -     * The Cloud Pub/Sub service account associated with this subscriptions's
    -     * parent project (i.e.,
    -     * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
    -     * permission to Acknowledge() messages on this subscription.
    +     * Optional. Transforms to be applied to messages before they are delivered to
    +     * subscribers. Transforms are applied in the order specified.
          * 
    * - * .google.pubsub.v1.DeadLetterPolicy dead_letter_policy = 13; - * - * @return Whether the deadLetterPolicy field is set. + * + * repeated .google.pubsub.v1.MessageTransform message_transforms = 25 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public boolean hasDeadLetterPolicy() { - return deadLetterPolicyBuilder_ != null || deadLetterPolicy_ != null; + public Builder setMessageTransforms( + int index, com.google.pubsub.v1.MessageTransform.Builder builderForValue) { + if (messageTransformsBuilder_ == null) { + ensureMessageTransformsIsMutable(); + messageTransforms_.set(index, builderForValue.build()); + onChanged(); + } else { + messageTransformsBuilder_.setMessage(index, builderForValue.build()); + } + return this; } + /** * * *
    -     * A policy that specifies the conditions for dead lettering messages in
    -     * this subscription. If dead_letter_policy is not set, dead lettering
    -     * is disabled.
    -     * The Cloud Pub/Sub service account associated with this subscriptions's
    -     * parent project (i.e.,
    -     * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
    -     * permission to Acknowledge() messages on this subscription.
    +     * Optional. Transforms to be applied to messages before they are delivered to
    +     * subscribers. Transforms are applied in the order specified.
          * 
    * - * .google.pubsub.v1.DeadLetterPolicy dead_letter_policy = 13; - * - * @return The deadLetterPolicy. + * + * repeated .google.pubsub.v1.MessageTransform message_transforms = 25 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public com.google.pubsub.v1.DeadLetterPolicy getDeadLetterPolicy() { - if (deadLetterPolicyBuilder_ == null) { - return deadLetterPolicy_ == null - ? com.google.pubsub.v1.DeadLetterPolicy.getDefaultInstance() - : deadLetterPolicy_; + public Builder addMessageTransforms(com.google.pubsub.v1.MessageTransform value) { + if (messageTransformsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureMessageTransformsIsMutable(); + messageTransforms_.add(value); + onChanged(); } else { - return deadLetterPolicyBuilder_.getMessage(); + messageTransformsBuilder_.addMessage(value); } + return this; } + /** * * *
    -     * A policy that specifies the conditions for dead lettering messages in
    -     * this subscription. If dead_letter_policy is not set, dead lettering
    -     * is disabled.
    -     * The Cloud Pub/Sub service account associated with this subscriptions's
    -     * parent project (i.e.,
    -     * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
    -     * permission to Acknowledge() messages on this subscription.
    +     * Optional. Transforms to be applied to messages before they are delivered to
    +     * subscribers. Transforms are applied in the order specified.
          * 
    * - * .google.pubsub.v1.DeadLetterPolicy dead_letter_policy = 13; + * + * repeated .google.pubsub.v1.MessageTransform message_transforms = 25 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public Builder setDeadLetterPolicy(com.google.pubsub.v1.DeadLetterPolicy value) { - if (deadLetterPolicyBuilder_ == null) { + public Builder addMessageTransforms(int index, com.google.pubsub.v1.MessageTransform value) { + if (messageTransformsBuilder_ == null) { if (value == null) { throw new NullPointerException(); } - deadLetterPolicy_ = value; + ensureMessageTransformsIsMutable(); + messageTransforms_.add(index, value); onChanged(); } else { - deadLetterPolicyBuilder_.setMessage(value); + messageTransformsBuilder_.addMessage(index, value); } - return this; } + /** * * *
    -     * A policy that specifies the conditions for dead lettering messages in
    -     * this subscription. If dead_letter_policy is not set, dead lettering
    -     * is disabled.
    -     * The Cloud Pub/Sub service account associated with this subscriptions's
    -     * parent project (i.e.,
    -     * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
    -     * permission to Acknowledge() messages on this subscription.
    +     * Optional. Transforms to be applied to messages before they are delivered to
    +     * subscribers. Transforms are applied in the order specified.
          * 
    * - * .google.pubsub.v1.DeadLetterPolicy dead_letter_policy = 13; + * + * repeated .google.pubsub.v1.MessageTransform message_transforms = 25 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public Builder setDeadLetterPolicy( - com.google.pubsub.v1.DeadLetterPolicy.Builder builderForValue) { - if (deadLetterPolicyBuilder_ == null) { - deadLetterPolicy_ = builderForValue.build(); + public Builder addMessageTransforms( + com.google.pubsub.v1.MessageTransform.Builder builderForValue) { + if (messageTransformsBuilder_ == null) { + ensureMessageTransformsIsMutable(); + messageTransforms_.add(builderForValue.build()); onChanged(); } else { - deadLetterPolicyBuilder_.setMessage(builderForValue.build()); + messageTransformsBuilder_.addMessage(builderForValue.build()); } - return this; } + /** * * *
    -     * A policy that specifies the conditions for dead lettering messages in
    -     * this subscription. If dead_letter_policy is not set, dead lettering
    -     * is disabled.
    -     * The Cloud Pub/Sub service account associated with this subscriptions's
    -     * parent project (i.e.,
    -     * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
    -     * permission to Acknowledge() messages on this subscription.
    +     * Optional. Transforms to be applied to messages before they are delivered to
    +     * subscribers. Transforms are applied in the order specified.
          * 
    * - * .google.pubsub.v1.DeadLetterPolicy dead_letter_policy = 13; + * + * repeated .google.pubsub.v1.MessageTransform message_transforms = 25 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public Builder mergeDeadLetterPolicy(com.google.pubsub.v1.DeadLetterPolicy value) { - if (deadLetterPolicyBuilder_ == null) { - if (deadLetterPolicy_ != null) { - deadLetterPolicy_ = - com.google.pubsub.v1.DeadLetterPolicy.newBuilder(deadLetterPolicy_) - .mergeFrom(value) - .buildPartial(); - } else { - deadLetterPolicy_ = value; - } + public Builder addMessageTransforms( + int index, com.google.pubsub.v1.MessageTransform.Builder builderForValue) { + if (messageTransformsBuilder_ == null) { + ensureMessageTransformsIsMutable(); + messageTransforms_.add(index, builderForValue.build()); onChanged(); } else { - deadLetterPolicyBuilder_.mergeFrom(value); + messageTransformsBuilder_.addMessage(index, builderForValue.build()); } - return this; } + /** * * *
    -     * A policy that specifies the conditions for dead lettering messages in
    -     * this subscription. If dead_letter_policy is not set, dead lettering
    -     * is disabled.
    -     * The Cloud Pub/Sub service account associated with this subscriptions's
    -     * parent project (i.e.,
    -     * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
    -     * permission to Acknowledge() messages on this subscription.
    +     * Optional. Transforms to be applied to messages before they are delivered to
    +     * subscribers. Transforms are applied in the order specified.
          * 
    * - * .google.pubsub.v1.DeadLetterPolicy dead_letter_policy = 13; + * + * repeated .google.pubsub.v1.MessageTransform message_transforms = 25 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public Builder clearDeadLetterPolicy() { - if (deadLetterPolicyBuilder_ == null) { - deadLetterPolicy_ = null; + public Builder addAllMessageTransforms( + java.lang.Iterable values) { + if (messageTransformsBuilder_ == null) { + ensureMessageTransformsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, messageTransforms_); onChanged(); } else { - deadLetterPolicy_ = null; - deadLetterPolicyBuilder_ = null; + messageTransformsBuilder_.addAllMessages(values); } - return this; } + /** * * *
    -     * A policy that specifies the conditions for dead lettering messages in
    -     * this subscription. If dead_letter_policy is not set, dead lettering
    -     * is disabled.
    -     * The Cloud Pub/Sub service account associated with this subscriptions's
    -     * parent project (i.e.,
    -     * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
    -     * permission to Acknowledge() messages on this subscription.
    +     * Optional. Transforms to be applied to messages before they are delivered to
    +     * subscribers. Transforms are applied in the order specified.
          * 
    * - * .google.pubsub.v1.DeadLetterPolicy dead_letter_policy = 13; + * + * repeated .google.pubsub.v1.MessageTransform message_transforms = 25 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public com.google.pubsub.v1.DeadLetterPolicy.Builder getDeadLetterPolicyBuilder() { - - onChanged(); - return getDeadLetterPolicyFieldBuilder().getBuilder(); + public Builder clearMessageTransforms() { + if (messageTransformsBuilder_ == null) { + messageTransforms_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00100000); + onChanged(); + } else { + messageTransformsBuilder_.clear(); + } + return this; } + /** * * *
    -     * A policy that specifies the conditions for dead lettering messages in
    -     * this subscription. If dead_letter_policy is not set, dead lettering
    -     * is disabled.
    -     * The Cloud Pub/Sub service account associated with this subscriptions's
    -     * parent project (i.e.,
    -     * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
    -     * permission to Acknowledge() messages on this subscription.
    +     * Optional. Transforms to be applied to messages before they are delivered to
    +     * subscribers. Transforms are applied in the order specified.
          * 
    * - * .google.pubsub.v1.DeadLetterPolicy dead_letter_policy = 13; + * + * repeated .google.pubsub.v1.MessageTransform message_transforms = 25 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public com.google.pubsub.v1.DeadLetterPolicyOrBuilder getDeadLetterPolicyOrBuilder() { - if (deadLetterPolicyBuilder_ != null) { - return deadLetterPolicyBuilder_.getMessageOrBuilder(); + public Builder removeMessageTransforms(int index) { + if (messageTransformsBuilder_ == null) { + ensureMessageTransformsIsMutable(); + messageTransforms_.remove(index); + onChanged(); } else { - return deadLetterPolicy_ == null - ? com.google.pubsub.v1.DeadLetterPolicy.getDefaultInstance() - : deadLetterPolicy_; + messageTransformsBuilder_.remove(index); } + return this; } + /** * * *
    -     * A policy that specifies the conditions for dead lettering messages in
    -     * this subscription. If dead_letter_policy is not set, dead lettering
    -     * is disabled.
    -     * The Cloud Pub/Sub service account associated with this subscriptions's
    -     * parent project (i.e.,
    -     * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
    -     * permission to Acknowledge() messages on this subscription.
    +     * Optional. Transforms to be applied to messages before they are delivered to
    +     * subscribers. Transforms are applied in the order specified.
          * 
    * - * .google.pubsub.v1.DeadLetterPolicy dead_letter_policy = 13; + * + * repeated .google.pubsub.v1.MessageTransform message_transforms = 25 [(.google.api.field_behavior) = OPTIONAL]; + * */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.pubsub.v1.DeadLetterPolicy, - com.google.pubsub.v1.DeadLetterPolicy.Builder, - com.google.pubsub.v1.DeadLetterPolicyOrBuilder> - getDeadLetterPolicyFieldBuilder() { - if (deadLetterPolicyBuilder_ == null) { - deadLetterPolicyBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - com.google.pubsub.v1.DeadLetterPolicy, - com.google.pubsub.v1.DeadLetterPolicy.Builder, - com.google.pubsub.v1.DeadLetterPolicyOrBuilder>( - getDeadLetterPolicy(), getParentForChildren(), isClean()); - deadLetterPolicy_ = null; - } - return deadLetterPolicyBuilder_; + public com.google.pubsub.v1.MessageTransform.Builder getMessageTransformsBuilder(int index) { + return internalGetMessageTransformsFieldBuilder().getBuilder(index); } - private com.google.pubsub.v1.RetryPolicy retryPolicy_; - private com.google.protobuf.SingleFieldBuilderV3< - com.google.pubsub.v1.RetryPolicy, - com.google.pubsub.v1.RetryPolicy.Builder, - com.google.pubsub.v1.RetryPolicyOrBuilder> - retryPolicyBuilder_; /** * * *
    -     * A policy that specifies how Pub/Sub retries message delivery for this
    -     * subscription.
    -     * If not set, the default retry policy is applied. This generally implies
    -     * that messages will be retried as soon as possible for healthy subscribers.
    -     * RetryPolicy will be triggered on NACKs or acknowledgement deadline
    -     * exceeded events for a given message.
    +     * Optional. Transforms to be applied to messages before they are delivered to
    +     * subscribers. Transforms are applied in the order specified.
          * 
    * - * .google.pubsub.v1.RetryPolicy retry_policy = 14; - * - * @return Whether the retryPolicy field is set. + * + * repeated .google.pubsub.v1.MessageTransform message_transforms = 25 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public boolean hasRetryPolicy() { - return retryPolicyBuilder_ != null || retryPolicy_ != null; + public com.google.pubsub.v1.MessageTransformOrBuilder getMessageTransformsOrBuilder(int index) { + if (messageTransformsBuilder_ == null) { + return messageTransforms_.get(index); + } else { + return messageTransformsBuilder_.getMessageOrBuilder(index); + } } + /** * * *
    -     * A policy that specifies how Pub/Sub retries message delivery for this
    -     * subscription.
    -     * If not set, the default retry policy is applied. This generally implies
    -     * that messages will be retried as soon as possible for healthy subscribers.
    -     * RetryPolicy will be triggered on NACKs or acknowledgement deadline
    -     * exceeded events for a given message.
    +     * Optional. Transforms to be applied to messages before they are delivered to
    +     * subscribers. Transforms are applied in the order specified.
          * 
    * - * .google.pubsub.v1.RetryPolicy retry_policy = 14; - * - * @return The retryPolicy. + * + * repeated .google.pubsub.v1.MessageTransform message_transforms = 25 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public com.google.pubsub.v1.RetryPolicy getRetryPolicy() { - if (retryPolicyBuilder_ == null) { - return retryPolicy_ == null - ? com.google.pubsub.v1.RetryPolicy.getDefaultInstance() - : retryPolicy_; + public java.util.List + getMessageTransformsOrBuilderList() { + if (messageTransformsBuilder_ != null) { + return messageTransformsBuilder_.getMessageOrBuilderList(); } else { - return retryPolicyBuilder_.getMessage(); + return java.util.Collections.unmodifiableList(messageTransforms_); } } + /** * * *
    -     * A policy that specifies how Pub/Sub retries message delivery for this
    -     * subscription.
    -     * If not set, the default retry policy is applied. This generally implies
    -     * that messages will be retried as soon as possible for healthy subscribers.
    -     * RetryPolicy will be triggered on NACKs or acknowledgement deadline
    -     * exceeded events for a given message.
    +     * Optional. Transforms to be applied to messages before they are delivered to
    +     * subscribers. Transforms are applied in the order specified.
          * 
    * - * .google.pubsub.v1.RetryPolicy retry_policy = 14; + * + * repeated .google.pubsub.v1.MessageTransform message_transforms = 25 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public Builder setRetryPolicy(com.google.pubsub.v1.RetryPolicy value) { - if (retryPolicyBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - retryPolicy_ = value; - onChanged(); - } else { - retryPolicyBuilder_.setMessage(value); - } - - return this; + public com.google.pubsub.v1.MessageTransform.Builder addMessageTransformsBuilder() { + return internalGetMessageTransformsFieldBuilder() + .addBuilder(com.google.pubsub.v1.MessageTransform.getDefaultInstance()); } + /** * * *
    -     * A policy that specifies how Pub/Sub retries message delivery for this
    -     * subscription.
    -     * If not set, the default retry policy is applied. This generally implies
    -     * that messages will be retried as soon as possible for healthy subscribers.
    -     * RetryPolicy will be triggered on NACKs or acknowledgement deadline
    -     * exceeded events for a given message.
    +     * Optional. Transforms to be applied to messages before they are delivered to
    +     * subscribers. Transforms are applied in the order specified.
          * 
    * - * .google.pubsub.v1.RetryPolicy retry_policy = 14; + * + * repeated .google.pubsub.v1.MessageTransform message_transforms = 25 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public Builder setRetryPolicy(com.google.pubsub.v1.RetryPolicy.Builder builderForValue) { - if (retryPolicyBuilder_ == null) { - retryPolicy_ = builderForValue.build(); - onChanged(); - } else { - retryPolicyBuilder_.setMessage(builderForValue.build()); - } - - return this; + public com.google.pubsub.v1.MessageTransform.Builder addMessageTransformsBuilder(int index) { + return internalGetMessageTransformsFieldBuilder() + .addBuilder(index, com.google.pubsub.v1.MessageTransform.getDefaultInstance()); } + /** * * *
    -     * A policy that specifies how Pub/Sub retries message delivery for this
    -     * subscription.
    -     * If not set, the default retry policy is applied. This generally implies
    -     * that messages will be retried as soon as possible for healthy subscribers.
    -     * RetryPolicy will be triggered on NACKs or acknowledgement deadline
    -     * exceeded events for a given message.
    +     * Optional. Transforms to be applied to messages before they are delivered to
    +     * subscribers. Transforms are applied in the order specified.
          * 
    * - * .google.pubsub.v1.RetryPolicy retry_policy = 14; + * + * repeated .google.pubsub.v1.MessageTransform message_transforms = 25 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public Builder mergeRetryPolicy(com.google.pubsub.v1.RetryPolicy value) { - if (retryPolicyBuilder_ == null) { - if (retryPolicy_ != null) { - retryPolicy_ = - com.google.pubsub.v1.RetryPolicy.newBuilder(retryPolicy_) - .mergeFrom(value) - .buildPartial(); - } else { - retryPolicy_ = value; - } - onChanged(); - } else { - retryPolicyBuilder_.mergeFrom(value); + public java.util.List + getMessageTransformsBuilderList() { + return internalGetMessageTransformsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilder< + com.google.pubsub.v1.MessageTransform, + com.google.pubsub.v1.MessageTransform.Builder, + com.google.pubsub.v1.MessageTransformOrBuilder> + internalGetMessageTransformsFieldBuilder() { + if (messageTransformsBuilder_ == null) { + messageTransformsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilder< + com.google.pubsub.v1.MessageTransform, + com.google.pubsub.v1.MessageTransform.Builder, + com.google.pubsub.v1.MessageTransformOrBuilder>( + messageTransforms_, + ((bitField0_ & 0x00100000) != 0), + getParentForChildren(), + isClean()); + messageTransforms_ = null; + } + 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_; + } - return this; + private com.google.protobuf.MapField + internalGetMutableTags() { + if (tags_ == null) { + tags_ = com.google.protobuf.MapField.newMapField(TagsDefaultEntryHolder.defaultEntry); + } + if (!tags_.isMutable()) { + tags_ = tags_.copy(); + } + bitField0_ |= 0x00200000; + onChanged(); + return tags_; + } + + public int getTagsCount() { + return internalGetTags().getMap().size(); } + /** * * *
    -     * A policy that specifies how Pub/Sub retries message delivery for this
    -     * subscription.
    -     * If not set, the default retry policy is applied. This generally implies
    -     * that messages will be retried as soon as possible for healthy subscribers.
    -     * RetryPolicy will be triggered on NACKs or acknowledgement deadline
    -     * exceeded events for a given message.
    +     * Optional. Input only. Immutable. Tag keys/values directly bound to this
    +     * resource. For example:
    +     * "123/environment": "production",
    +     * "123/costCenter": "marketing"
    +     * See https://docs.cloud.google.com/pubsub/docs/tags for more information on
    +     * using tags with Pub/Sub resources.
          * 
    * - * .google.pubsub.v1.RetryPolicy retry_policy = 14; + * + * map<string, string> tags = 26 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * */ - public Builder clearRetryPolicy() { - if (retryPolicyBuilder_ == null) { - retryPolicy_ = null; - onChanged(); - } else { - retryPolicy_ = null; - retryPolicyBuilder_ = null; + @java.lang.Override + public boolean containsTags(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); } + return internalGetTags().getMap().containsKey(key); + } - return this; + /** Use {@link #getTagsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getTags() { + return getTagsMap(); } + /** * * *
    -     * A policy that specifies how Pub/Sub retries message delivery for this
    -     * subscription.
    -     * If not set, the default retry policy is applied. This generally implies
    -     * that messages will be retried as soon as possible for healthy subscribers.
    -     * RetryPolicy will be triggered on NACKs or acknowledgement deadline
    -     * exceeded events for a given message.
    +     * Optional. Input only. Immutable. Tag keys/values directly bound to this
    +     * resource. For example:
    +     * "123/environment": "production",
    +     * "123/costCenter": "marketing"
    +     * See https://docs.cloud.google.com/pubsub/docs/tags for more information on
    +     * using tags with Pub/Sub resources.
          * 
    * - * .google.pubsub.v1.RetryPolicy retry_policy = 14; + * + * map<string, string> tags = 26 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * */ - public com.google.pubsub.v1.RetryPolicy.Builder getRetryPolicyBuilder() { - - onChanged(); - return getRetryPolicyFieldBuilder().getBuilder(); + @java.lang.Override + public java.util.Map getTagsMap() { + return internalGetTags().getMap(); } + /** * * *
    -     * A policy that specifies how Pub/Sub retries message delivery for this
    -     * subscription.
    -     * If not set, the default retry policy is applied. This generally implies
    -     * that messages will be retried as soon as possible for healthy subscribers.
    -     * RetryPolicy will be triggered on NACKs or acknowledgement deadline
    -     * exceeded events for a given message.
    +     * Optional. Input only. Immutable. Tag keys/values directly bound to this
    +     * resource. For example:
    +     * "123/environment": "production",
    +     * "123/costCenter": "marketing"
    +     * See https://docs.cloud.google.com/pubsub/docs/tags for more information on
    +     * using tags with Pub/Sub resources.
          * 
    * - * .google.pubsub.v1.RetryPolicy retry_policy = 14; + * + * map<string, string> tags = 26 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * */ - public com.google.pubsub.v1.RetryPolicyOrBuilder getRetryPolicyOrBuilder() { - if (retryPolicyBuilder_ != null) { - return retryPolicyBuilder_.getMessageOrBuilder(); - } else { - return retryPolicy_ == null - ? com.google.pubsub.v1.RetryPolicy.getDefaultInstance() - : retryPolicy_; + @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; } + /** * * *
    -     * A policy that specifies how Pub/Sub retries message delivery for this
    -     * subscription.
    -     * If not set, the default retry policy is applied. This generally implies
    -     * that messages will be retried as soon as possible for healthy subscribers.
    -     * RetryPolicy will be triggered on NACKs or acknowledgement deadline
    -     * exceeded events for a given message.
    +     * Optional. Input only. Immutable. Tag keys/values directly bound to this
    +     * resource. For example:
    +     * "123/environment": "production",
    +     * "123/costCenter": "marketing"
    +     * See https://docs.cloud.google.com/pubsub/docs/tags for more information on
    +     * using tags with Pub/Sub resources.
          * 
    * - * .google.pubsub.v1.RetryPolicy retry_policy = 14; + * + * map<string, string> tags = 26 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.pubsub.v1.RetryPolicy, - com.google.pubsub.v1.RetryPolicy.Builder, - com.google.pubsub.v1.RetryPolicyOrBuilder> - getRetryPolicyFieldBuilder() { - if (retryPolicyBuilder_ == null) { - retryPolicyBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - com.google.pubsub.v1.RetryPolicy, - com.google.pubsub.v1.RetryPolicy.Builder, - com.google.pubsub.v1.RetryPolicyOrBuilder>( - getRetryPolicy(), getParentForChildren(), isClean()); - retryPolicy_ = null; + @java.lang.Override + public java.lang.String getTagsOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); } - return retryPolicyBuilder_; + java.util.Map map = internalGetTags().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public Builder clearTags() { + bitField0_ = (bitField0_ & ~0x00200000); + internalGetMutableTags().getMutableMap().clear(); + return this; } - private boolean detached_; /** * * *
    -     * Indicates whether the subscription is detached from its topic. Detached
    -     * subscriptions don't receive messages from their topic and don't retain any
    -     * backlog. `Pull` and `StreamingPull` requests will return
    -     * FAILED_PRECONDITION. If the subscription is a push subscription, pushes to
    -     * the endpoint will not be made.
    +     * Optional. Input only. Immutable. Tag keys/values directly bound to this
    +     * resource. For example:
    +     * "123/environment": "production",
    +     * "123/costCenter": "marketing"
    +     * See https://docs.cloud.google.com/pubsub/docs/tags for more information on
    +     * using tags with Pub/Sub resources.
          * 
    * - * bool detached = 15; - * - * @return The detached. + * + * 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 getDetached() { - return detached_; + 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_ |= 0x00200000; + return internalGetMutableTags().getMutableMap(); } + /** * * *
    -     * Indicates whether the subscription is detached from its topic. Detached
    -     * subscriptions don't receive messages from their topic and don't retain any
    -     * backlog. `Pull` and `StreamingPull` requests will return
    -     * FAILED_PRECONDITION. If the subscription is a push subscription, pushes to
    -     * the endpoint will not be made.
    +     * Optional. Input only. Immutable. Tag keys/values directly bound to this
    +     * resource. For example:
    +     * "123/environment": "production",
    +     * "123/costCenter": "marketing"
    +     * See https://docs.cloud.google.com/pubsub/docs/tags for more information on
    +     * using tags with Pub/Sub resources.
          * 
    * - * bool detached = 15; - * - * @param value The detached to set. - * @return This builder for chaining. + * + * map<string, string> tags = 26 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * */ - public Builder setDetached(boolean value) { - - detached_ = value; - onChanged(); + 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_ |= 0x00200000; return this; } + /** * * *
    -     * Indicates whether the subscription is detached from its topic. Detached
    -     * subscriptions don't receive messages from their topic and don't retain any
    -     * backlog. `Pull` and `StreamingPull` requests will return
    -     * FAILED_PRECONDITION. If the subscription is a push subscription, pushes to
    -     * the endpoint will not be made.
    +     * Optional. Input only. Immutable. Tag keys/values directly bound to this
    +     * resource. For example:
    +     * "123/environment": "production",
    +     * "123/costCenter": "marketing"
    +     * See https://docs.cloud.google.com/pubsub/docs/tags for more information on
    +     * using tags with Pub/Sub resources.
          * 
    * - * bool detached = 15; - * - * @return This builder for chaining. + * + * map<string, string> tags = 26 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * */ - public Builder clearDetached() { - - detached_ = false; - onChanged(); + public Builder putAllTags(java.util.Map values) { + internalGetMutableTags().getMutableMap().putAll(values); + bitField0_ |= 0x00200000; return this; } - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - // @@protoc_insertion_point(builder_scope:google.pubsub.v1.Subscription) } @@ -3524,7 +7774,18 @@ public Subscription parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new Subscription(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SubscriptionName.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SubscriptionName.java new file mode 100644 index 000000000..2c12a10dc --- /dev/null +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SubscriptionName.java @@ -0,0 +1,192 @@ +/* + * Copyright 2026 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 SubscriptionName implements ResourceName { + private static final PathTemplate PROJECT_SUBSCRIPTION = + PathTemplate.createWithoutUrlEncoding("projects/{project}/subscriptions/{subscription}"); + private volatile Map fieldValuesMap; + private final String project; + private final String subscription; + + @Deprecated + protected SubscriptionName() { + project = null; + subscription = null; + } + + private SubscriptionName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + subscription = Preconditions.checkNotNull(builder.getSubscription()); + } + + public String getProject() { + return project; + } + + public String getSubscription() { + return subscription; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + public static SubscriptionName of(String project, String subscription) { + return newBuilder().setProject(project).setSubscription(subscription).build(); + } + + public static String format(String project, String subscription) { + return newBuilder().setProject(project).setSubscription(subscription).build().toString(); + } + + public static SubscriptionName parse(String formattedString) { + if (formattedString.isEmpty()) { + return null; + } + Map matchMap = + PROJECT_SUBSCRIPTION.validatedMatch( + formattedString, "SubscriptionName.parse: formattedString not in valid format"); + return of(matchMap.get("project"), matchMap.get("subscription")); + } + + 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 (SubscriptionName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return PROJECT_SUBSCRIPTION.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 (subscription != null) { + fieldMapBuilder.put("subscription", subscription); + } + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + @Override + public String toString() { + return PROJECT_SUBSCRIPTION.instantiate("project", project, "subscription", subscription); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null && getClass() == o.getClass()) { + SubscriptionName that = ((SubscriptionName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.subscription, that.subscription); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(subscription); + return h; + } + + /** Builder for projects/{project}/subscriptions/{subscription}. */ + public static class Builder { + private String project; + private String subscription; + + protected Builder() {} + + public String getProject() { + return project; + } + + public String getSubscription() { + return subscription; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setSubscription(String subscription) { + this.subscription = subscription; + return this; + } + + private Builder(SubscriptionName subscriptionName) { + this.project = subscriptionName.project; + this.subscription = subscriptionName.subscription; + } + + public SubscriptionName build() { + return new SubscriptionName(this); + } + } +} 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 e19141cb0..ebb45ec6a 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 @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; +@com.google.protobuf.Generated public interface SubscriptionOrBuilder extends // @@protoc_insertion_point(interface_extends:google.pubsub.v1.Subscription) @@ -27,7 +30,7 @@ public interface SubscriptionOrBuilder * * *
    -   * Required. The name of the subscription. It must have the format
    +   * Required. Identifier. The name of the subscription. It must have the format
        * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must
        * start with a letter, and contain only letters (`[A-Za-z]`), numbers
        * (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`),
    @@ -35,16 +38,19 @@ public interface SubscriptionOrBuilder
        * in length, and it must not start with `"goog"`.
        * 
    * - * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IDENTIFIER]; + * * * @return The name. */ java.lang.String getName(); + /** * * *
    -   * Required. The name of the subscription. It must have the format
    +   * Required. Identifier. The name of the subscription. It must have the format
        * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must
        * start with a letter, and contain only letters (`[A-Za-z]`), numbers
        * (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`),
    @@ -52,7 +58,9 @@ public interface SubscriptionOrBuilder
        * in length, and it must not start with `"goog"`.
        * 
    * - * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IDENTIFIER]; + * * * @return The bytes for name. */ @@ -74,6 +82,7 @@ public interface SubscriptionOrBuilder * @return The topic. */ java.lang.String getTopic(); + /** * * @@ -95,40 +104,42 @@ public interface SubscriptionOrBuilder * * *
    -   * If push delivery is used with this subscription, this field is
    -   * used to configure it. An empty `pushConfig` signifies that the subscriber
    -   * will pull and ack messages using API methods.
    +   * Optional. If push delivery is used with this subscription, this field is
    +   * used to configure it.
        * 
    * - * .google.pubsub.v1.PushConfig push_config = 4; + * .google.pubsub.v1.PushConfig push_config = 4 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return Whether the pushConfig field is set. */ boolean hasPushConfig(); + /** * * *
    -   * If push delivery is used with this subscription, this field is
    -   * used to configure it. An empty `pushConfig` signifies that the subscriber
    -   * will pull and ack messages using API methods.
    +   * Optional. If push delivery is used with this subscription, this field is
    +   * used to configure it.
        * 
    * - * .google.pubsub.v1.PushConfig push_config = 4; + * .google.pubsub.v1.PushConfig push_config = 4 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return The pushConfig. */ com.google.pubsub.v1.PushConfig getPushConfig(); + /** * * *
    -   * If push delivery is used with this subscription, this field is
    -   * used to configure it. An empty `pushConfig` signifies that the subscriber
    -   * will pull and ack messages using API methods.
    +   * Optional. If push delivery is used with this subscription, this field is
    +   * used to configure it.
        * 
    * - * .google.pubsub.v1.PushConfig push_config = 4; + * .google.pubsub.v1.PushConfig push_config = 4 [(.google.api.field_behavior) = OPTIONAL]; + * */ com.google.pubsub.v1.PushConfigOrBuilder getPushConfigOrBuilder(); @@ -136,11 +147,150 @@ public interface SubscriptionOrBuilder * * *
    -   * The approximate amount of time (on a best-effort basis) Pub/Sub waits for
    -   * the subscriber to acknowledge receipt before resending the message. In the
    -   * interval after the message is delivered and before it is acknowledged, it
    -   * is considered to be <i>outstanding</i>. During that time period, the
    -   * message will not be redelivered (on a best-effort basis).
    +   * Optional. If delivery to BigQuery is used with this subscription, this
    +   * field is used to configure it.
    +   * 
    + * + * + * .google.pubsub.v1.BigQueryConfig bigquery_config = 18 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the bigqueryConfig field is set. + */ + boolean hasBigqueryConfig(); + + /** + * + * + *
    +   * Optional. If delivery to BigQuery is used with this subscription, this
    +   * field is used to configure it.
    +   * 
    + * + * + * .google.pubsub.v1.BigQueryConfig bigquery_config = 18 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The bigqueryConfig. + */ + com.google.pubsub.v1.BigQueryConfig getBigqueryConfig(); + + /** + * + * + *
    +   * Optional. If delivery to BigQuery is used with this subscription, this
    +   * field is used to configure it.
    +   * 
    + * + * + * .google.pubsub.v1.BigQueryConfig bigquery_config = 18 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.pubsub.v1.BigQueryConfigOrBuilder getBigqueryConfigOrBuilder(); + + /** + * + * + *
    +   * Optional. If delivery to Google Cloud Storage is used with this
    +   * subscription, this field is used to configure it.
    +   * 
    + * + * + * .google.pubsub.v1.CloudStorageConfig cloud_storage_config = 22 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the cloudStorageConfig field is set. + */ + boolean hasCloudStorageConfig(); + + /** + * + * + *
    +   * Optional. If delivery to Google Cloud Storage is used with this
    +   * subscription, this field is used to configure it.
    +   * 
    + * + * + * .google.pubsub.v1.CloudStorageConfig cloud_storage_config = 22 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The cloudStorageConfig. + */ + com.google.pubsub.v1.CloudStorageConfig getCloudStorageConfig(); + + /** + * + * + *
    +   * Optional. If delivery to Google Cloud Storage is used with this
    +   * subscription, this field is used to configure it.
    +   * 
    + * + * + * .google.pubsub.v1.CloudStorageConfig cloud_storage_config = 22 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.pubsub.v1.CloudStorageConfigOrBuilder getCloudStorageConfigOrBuilder(); + + /** + * + * + *
    +   * Optional. If delivery to Bigtable is used with this subscription, this
    +   * field is used to configure it.
    +   * 
    + * + * + * .google.pubsub.v1.BigtableConfig bigtable_config = 27 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the bigtableConfig field is set. + */ + boolean hasBigtableConfig(); + + /** + * + * + *
    +   * Optional. If delivery to Bigtable is used with this subscription, this
    +   * field is used to configure it.
    +   * 
    + * + * + * .google.pubsub.v1.BigtableConfig bigtable_config = 27 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The bigtableConfig. + */ + com.google.pubsub.v1.BigtableConfig getBigtableConfig(); + + /** + * + * + *
    +   * Optional. If delivery to Bigtable is used with this subscription, this
    +   * field is used to configure it.
    +   * 
    + * + * + * .google.pubsub.v1.BigtableConfig bigtable_config = 27 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.pubsub.v1.BigtableConfigOrBuilder getBigtableConfigOrBuilder(); + + /** + * + * + *
    +   * Optional. The approximate amount of time (on a best-effort basis) Pub/Sub
    +   * waits for the subscriber to acknowledge receipt before resending the
    +   * message. In the interval after the message is delivered and before it is
    +   * acknowledged, it is considered to be _outstanding_. During that time
    +   * period, the message will not be redelivered (on a best-effort basis).
    +   *
        * For pull subscriptions, this value is used as the initial value for the ack
        * deadline. To override this value for a given message, call
        * `ModifyAckDeadline` with the corresponding `ack_id` if using
    @@ -149,13 +299,15 @@ public interface SubscriptionOrBuilder
        * The minimum custom deadline you can specify is 10 seconds.
        * The maximum custom deadline you can specify is 600 seconds (10 minutes).
        * If this parameter is 0, a default value of 10 seconds is used.
    +   *
        * For push delivery, this value is also used to set the request timeout for
        * the call to the push endpoint.
    +   *
        * If the subscriber never acknowledges the message, the Pub/Sub
        * system will eventually redeliver the message.
        * 
    * - * int32 ack_deadline_seconds = 5; + * int32 ack_deadline_seconds = 5 [(.google.api.field_behavior) = OPTIONAL]; * * @return The ackDeadlineSeconds. */ @@ -165,14 +317,15 @@ public interface SubscriptionOrBuilder * * *
    -   * Indicates whether to retain acknowledged messages. If true, then
    +   * Optional. Indicates whether to retain acknowledged messages. If true, then
        * messages are not expunged from the subscription's backlog, even if they are
        * acknowledged, until they fall out of the `message_retention_duration`
    -   * window. This must be true if you would like to [Seek to a timestamp]
    -   * (https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time).
    +   * window. This must be true if you would like to [`Seek` to a timestamp]
    +   * (https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time) in
    +   * the past to replay previously-acknowledged messages.
        * 
    * - * bool retain_acked_messages = 7; + * bool retain_acked_messages = 7 [(.google.api.field_behavior) = OPTIONAL]; * * @return The retainAckedMessages. */ @@ -182,49 +335,54 @@ public interface SubscriptionOrBuilder * * *
    -   * How long to retain unacknowledged messages in the subscription's backlog,
    -   * from the moment a message is published.
    -   * If `retain_acked_messages` is true, then this also configures the retention
    -   * of acknowledged messages, and thus configures how far back in time a `Seek`
    -   * can be done. Defaults to 7 days. Cannot be more than 7 days or less than 10
    -   * minutes.
    +   * Optional. How long to retain unacknowledged messages in the subscription's
    +   * backlog, from the moment a message is published. If `retain_acked_messages`
    +   * is true, then this also configures the retention of acknowledged messages,
    +   * and thus configures how far back in time a `Seek` can be done. Defaults to
    +   * 7 days. Cannot be more than 31 days or less than 10 minutes.
        * 
    * - * .google.protobuf.Duration message_retention_duration = 8; + * + * .google.protobuf.Duration message_retention_duration = 8 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return Whether the messageRetentionDuration field is set. */ boolean hasMessageRetentionDuration(); + /** * * *
    -   * How long to retain unacknowledged messages in the subscription's backlog,
    -   * from the moment a message is published.
    -   * If `retain_acked_messages` is true, then this also configures the retention
    -   * of acknowledged messages, and thus configures how far back in time a `Seek`
    -   * can be done. Defaults to 7 days. Cannot be more than 7 days or less than 10
    -   * minutes.
    +   * Optional. How long to retain unacknowledged messages in the subscription's
    +   * backlog, from the moment a message is published. If `retain_acked_messages`
    +   * is true, then this also configures the retention of acknowledged messages,
    +   * and thus configures how far back in time a `Seek` can be done. Defaults to
    +   * 7 days. Cannot be more than 31 days or less than 10 minutes.
        * 
    * - * .google.protobuf.Duration message_retention_duration = 8; + * + * .google.protobuf.Duration message_retention_duration = 8 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return The messageRetentionDuration. */ com.google.protobuf.Duration getMessageRetentionDuration(); + /** * * *
    -   * How long to retain unacknowledged messages in the subscription's backlog,
    -   * from the moment a message is published.
    -   * If `retain_acked_messages` is true, then this also configures the retention
    -   * of acknowledged messages, and thus configures how far back in time a `Seek`
    -   * can be done. Defaults to 7 days. Cannot be more than 7 days or less than 10
    -   * minutes.
    +   * Optional. How long to retain unacknowledged messages in the subscription's
    +   * backlog, from the moment a message is published. If `retain_acked_messages`
    +   * is true, then this also configures the retention of acknowledged messages,
    +   * and thus configures how far back in time a `Seek` can be done. Defaults to
    +   * 7 days. Cannot be more than 31 days or less than 10 minutes.
        * 
    * - * .google.protobuf.Duration message_retention_duration = 8; + * + * .google.protobuf.Duration message_retention_duration = 8 [(.google.api.field_behavior) = OPTIONAL]; + * */ com.google.protobuf.DurationOrBuilder getMessageRetentionDurationOrBuilder(); @@ -232,58 +390,67 @@ public interface SubscriptionOrBuilder * * *
    -   * See <a href="https://cloud.google.com/pubsub/docs/labels"> Creating and
    -   * managing labels</a>.
    +   * Optional. See [Creating and managing
    +   * labels](https://cloud.google.com/pubsub/docs/labels).
        * 
    * - * map<string, string> labels = 9; + * map<string, string> labels = 9 [(.google.api.field_behavior) = OPTIONAL]; */ int getLabelsCount(); + /** * * *
    -   * See <a href="https://cloud.google.com/pubsub/docs/labels"> Creating and
    -   * managing labels</a>.
    +   * Optional. See [Creating and managing
    +   * labels](https://cloud.google.com/pubsub/docs/labels).
        * 
    * - * map<string, string> labels = 9; + * map<string, string> labels = 9 [(.google.api.field_behavior) = OPTIONAL]; */ boolean containsLabels(java.lang.String key); + /** Use {@link #getLabelsMap()} instead. */ @java.lang.Deprecated java.util.Map getLabels(); + /** * * *
    -   * See <a href="https://cloud.google.com/pubsub/docs/labels"> Creating and
    -   * managing labels</a>.
    +   * Optional. See [Creating and managing
    +   * labels](https://cloud.google.com/pubsub/docs/labels).
        * 
    * - * map<string, string> labels = 9; + * map<string, string> labels = 9 [(.google.api.field_behavior) = OPTIONAL]; */ java.util.Map getLabelsMap(); + /** * * *
    -   * See <a href="https://cloud.google.com/pubsub/docs/labels"> Creating and
    -   * managing labels</a>.
    +   * Optional. See [Creating and managing
    +   * labels](https://cloud.google.com/pubsub/docs/labels).
        * 
    * - * map<string, string> labels = 9; + * map<string, string> labels = 9 [(.google.api.field_behavior) = OPTIONAL]; */ - java.lang.String getLabelsOrDefault(java.lang.String key, java.lang.String defaultValue); + /* nullable */ + java.lang.String getLabelsOrDefault( + java.lang.String key, + /* nullable */ + java.lang.String defaultValue); + /** * * *
    -   * See <a href="https://cloud.google.com/pubsub/docs/labels"> Creating and
    -   * managing labels</a>.
    +   * Optional. See [Creating and managing
    +   * labels](https://cloud.google.com/pubsub/docs/labels).
        * 
    * - * map<string, string> labels = 9; + * map<string, string> labels = 9 [(.google.api.field_behavior) = OPTIONAL]; */ java.lang.String getLabelsOrThrow(java.lang.String key); @@ -291,13 +458,13 @@ public interface SubscriptionOrBuilder * * *
    -   * If true, messages published with the same `ordering_key` in `PubsubMessage`
    -   * will be delivered to the subscribers in the order in which they
    -   * are received by the Pub/Sub system. Otherwise, they may be delivered in
    -   * any order.
    +   * Optional. If true, messages published with the same `ordering_key` in
    +   * `PubsubMessage` will be delivered to the subscribers in the order in which
    +   * they are received by the Pub/Sub system. Otherwise, they may be delivered
    +   * in any order.
        * 
    * - * bool enable_message_ordering = 10; + * bool enable_message_ordering = 10 [(.google.api.field_behavior) = OPTIONAL]; * * @return The enableMessageOrdering. */ @@ -307,49 +474,60 @@ public interface SubscriptionOrBuilder * * *
    -   * A policy that specifies the conditions for this subscription's expiration.
    -   * A subscription is considered active as long as any connected subscriber is
    -   * successfully consuming messages from the subscription or is issuing
    -   * operations on the subscription. If `expiration_policy` is not set, a
    -   * *default policy* with `ttl` of 31 days will be used. The minimum allowed
    -   * value for `expiration_policy.ttl` is 1 day.
    +   * Optional. A policy that specifies the conditions for this subscription's
    +   * expiration. A subscription is considered active as long as any connected
    +   * subscriber is successfully consuming messages from the subscription or is
    +   * issuing operations on the subscription. If `expiration_policy` is not set,
    +   * a *default policy* with `ttl` of 31 days will be used. The minimum allowed
    +   * value for `expiration_policy.ttl` is 1 day. If `expiration_policy` is set,
    +   * but `expiration_policy.ttl` is not set, the subscription never expires.
        * 
    * - * .google.pubsub.v1.ExpirationPolicy expiration_policy = 11; + * + * .google.pubsub.v1.ExpirationPolicy expiration_policy = 11 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return Whether the expirationPolicy field is set. */ boolean hasExpirationPolicy(); + /** * * *
    -   * A policy that specifies the conditions for this subscription's expiration.
    -   * A subscription is considered active as long as any connected subscriber is
    -   * successfully consuming messages from the subscription or is issuing
    -   * operations on the subscription. If `expiration_policy` is not set, a
    -   * *default policy* with `ttl` of 31 days will be used. The minimum allowed
    -   * value for `expiration_policy.ttl` is 1 day.
    +   * Optional. A policy that specifies the conditions for this subscription's
    +   * expiration. A subscription is considered active as long as any connected
    +   * subscriber is successfully consuming messages from the subscription or is
    +   * issuing operations on the subscription. If `expiration_policy` is not set,
    +   * a *default policy* with `ttl` of 31 days will be used. The minimum allowed
    +   * value for `expiration_policy.ttl` is 1 day. If `expiration_policy` is set,
    +   * but `expiration_policy.ttl` is not set, the subscription never expires.
        * 
    * - * .google.pubsub.v1.ExpirationPolicy expiration_policy = 11; + * + * .google.pubsub.v1.ExpirationPolicy expiration_policy = 11 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return The expirationPolicy. */ com.google.pubsub.v1.ExpirationPolicy getExpirationPolicy(); + /** * * *
    -   * A policy that specifies the conditions for this subscription's expiration.
    -   * A subscription is considered active as long as any connected subscriber is
    -   * successfully consuming messages from the subscription or is issuing
    -   * operations on the subscription. If `expiration_policy` is not set, a
    -   * *default policy* with `ttl` of 31 days will be used. The minimum allowed
    -   * value for `expiration_policy.ttl` is 1 day.
    +   * Optional. A policy that specifies the conditions for this subscription's
    +   * expiration. A subscription is considered active as long as any connected
    +   * subscriber is successfully consuming messages from the subscription or is
    +   * issuing operations on the subscription. If `expiration_policy` is not set,
    +   * a *default policy* with `ttl` of 31 days will be used. The minimum allowed
    +   * value for `expiration_policy.ttl` is 1 day. If `expiration_policy` is set,
    +   * but `expiration_policy.ttl` is not set, the subscription never expires.
        * 
    * - * .google.pubsub.v1.ExpirationPolicy expiration_policy = 11; + * + * .google.pubsub.v1.ExpirationPolicy expiration_policy = 11 [(.google.api.field_behavior) = OPTIONAL]; + * */ com.google.pubsub.v1.ExpirationPolicyOrBuilder getExpirationPolicyOrBuilder(); @@ -357,30 +535,31 @@ public interface SubscriptionOrBuilder * * *
    -   * An expression written in the Pub/Sub [filter
    +   * Optional. An expression written in the Pub/Sub [filter
        * language](https://cloud.google.com/pubsub/docs/filtering). If non-empty,
        * then only `PubsubMessage`s whose `attributes` field matches the filter are
        * delivered on this subscription. If empty, then no messages are filtered
        * out.
        * 
    * - * string filter = 12; + * string filter = 12 [(.google.api.field_behavior) = OPTIONAL]; * * @return The filter. */ java.lang.String getFilter(); + /** * * *
    -   * An expression written in the Pub/Sub [filter
    +   * Optional. An expression written in the Pub/Sub [filter
        * language](https://cloud.google.com/pubsub/docs/filtering). If non-empty,
        * then only `PubsubMessage`s whose `attributes` field matches the filter are
        * delivered on this subscription. If empty, then no messages are filtered
        * out.
        * 
    * - * string filter = 12; + * string filter = 12 [(.google.api.field_behavior) = OPTIONAL]; * * @return The bytes for filter. */ @@ -390,52 +569,63 @@ public interface SubscriptionOrBuilder * * *
    -   * A policy that specifies the conditions for dead lettering messages in
    -   * this subscription. If dead_letter_policy is not set, dead lettering
    -   * is disabled.
    -   * The Cloud Pub/Sub service account associated with this subscriptions's
    +   * Optional. A policy that specifies the conditions for dead lettering
    +   * messages in this subscription. If dead_letter_policy is not set, dead
    +   * lettering is disabled.
    +   *
    +   * The Pub/Sub service account associated with this subscriptions's
        * parent project (i.e.,
        * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
        * permission to Acknowledge() messages on this subscription.
        * 
    * - * .google.pubsub.v1.DeadLetterPolicy dead_letter_policy = 13; + * + * .google.pubsub.v1.DeadLetterPolicy dead_letter_policy = 13 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return Whether the deadLetterPolicy field is set. */ boolean hasDeadLetterPolicy(); + /** * * *
    -   * A policy that specifies the conditions for dead lettering messages in
    -   * this subscription. If dead_letter_policy is not set, dead lettering
    -   * is disabled.
    -   * The Cloud Pub/Sub service account associated with this subscriptions's
    +   * Optional. A policy that specifies the conditions for dead lettering
    +   * messages in this subscription. If dead_letter_policy is not set, dead
    +   * lettering is disabled.
    +   *
    +   * The Pub/Sub service account associated with this subscriptions's
        * parent project (i.e.,
        * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
        * permission to Acknowledge() messages on this subscription.
        * 
    * - * .google.pubsub.v1.DeadLetterPolicy dead_letter_policy = 13; + * + * .google.pubsub.v1.DeadLetterPolicy dead_letter_policy = 13 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return The deadLetterPolicy. */ com.google.pubsub.v1.DeadLetterPolicy getDeadLetterPolicy(); + /** * * *
    -   * A policy that specifies the conditions for dead lettering messages in
    -   * this subscription. If dead_letter_policy is not set, dead lettering
    -   * is disabled.
    -   * The Cloud Pub/Sub service account associated with this subscriptions's
    +   * Optional. A policy that specifies the conditions for dead lettering
    +   * messages in this subscription. If dead_letter_policy is not set, dead
    +   * lettering is disabled.
    +   *
    +   * The Pub/Sub service account associated with this subscriptions's
        * parent project (i.e.,
        * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
        * permission to Acknowledge() messages on this subscription.
        * 
    * - * .google.pubsub.v1.DeadLetterPolicy dead_letter_policy = 13; + * + * .google.pubsub.v1.DeadLetterPolicy dead_letter_policy = 13 [(.google.api.field_behavior) = OPTIONAL]; + * */ com.google.pubsub.v1.DeadLetterPolicyOrBuilder getDeadLetterPolicyOrBuilder(); @@ -443,49 +633,60 @@ public interface SubscriptionOrBuilder * * *
    -   * A policy that specifies how Pub/Sub retries message delivery for this
    -   * subscription.
    +   * Optional. A policy that specifies how Pub/Sub retries message delivery for
    +   * this subscription.
    +   *
        * If not set, the default retry policy is applied. This generally implies
        * that messages will be retried as soon as possible for healthy subscribers.
    -   * RetryPolicy will be triggered on NACKs or acknowledgement deadline
    -   * exceeded events for a given message.
    +   * RetryPolicy will be triggered on NACKs or acknowledgment deadline exceeded
    +   * events for a given message.
        * 
    * - * .google.pubsub.v1.RetryPolicy retry_policy = 14; + * + * .google.pubsub.v1.RetryPolicy retry_policy = 14 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return Whether the retryPolicy field is set. */ boolean hasRetryPolicy(); + /** * * *
    -   * A policy that specifies how Pub/Sub retries message delivery for this
    -   * subscription.
    +   * Optional. A policy that specifies how Pub/Sub retries message delivery for
    +   * this subscription.
    +   *
        * If not set, the default retry policy is applied. This generally implies
        * that messages will be retried as soon as possible for healthy subscribers.
    -   * RetryPolicy will be triggered on NACKs or acknowledgement deadline
    -   * exceeded events for a given message.
    +   * RetryPolicy will be triggered on NACKs or acknowledgment deadline exceeded
    +   * events for a given message.
        * 
    * - * .google.pubsub.v1.RetryPolicy retry_policy = 14; + * + * .google.pubsub.v1.RetryPolicy retry_policy = 14 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return The retryPolicy. */ com.google.pubsub.v1.RetryPolicy getRetryPolicy(); + /** * * *
    -   * A policy that specifies how Pub/Sub retries message delivery for this
    -   * subscription.
    +   * Optional. A policy that specifies how Pub/Sub retries message delivery for
    +   * this subscription.
    +   *
        * If not set, the default retry policy is applied. This generally implies
        * that messages will be retried as soon as possible for healthy subscribers.
    -   * RetryPolicy will be triggered on NACKs or acknowledgement deadline
    -   * exceeded events for a given message.
    +   * RetryPolicy will be triggered on NACKs or acknowledgment deadline exceeded
    +   * events for a given message.
        * 
    * - * .google.pubsub.v1.RetryPolicy retry_policy = 14; + * + * .google.pubsub.v1.RetryPolicy retry_policy = 14 [(.google.api.field_behavior) = OPTIONAL]; + * */ com.google.pubsub.v1.RetryPolicyOrBuilder getRetryPolicyOrBuilder(); @@ -493,16 +694,346 @@ public interface SubscriptionOrBuilder * * *
    -   * Indicates whether the subscription is detached from its topic. Detached
    -   * subscriptions don't receive messages from their topic and don't retain any
    -   * backlog. `Pull` and `StreamingPull` requests will return
    +   * Optional. Indicates whether the subscription is detached from its topic.
    +   * Detached subscriptions don't receive messages from their topic and don't
    +   * retain any backlog. `Pull` and `StreamingPull` requests will return
        * FAILED_PRECONDITION. If the subscription is a push subscription, pushes to
        * the endpoint will not be made.
        * 
    * - * bool detached = 15; + * bool detached = 15 [(.google.api.field_behavior) = OPTIONAL]; * * @return The detached. */ boolean getDetached(); + + /** + * + * + *
    +   * Optional. If true, Pub/Sub provides the following guarantees for the
    +   * delivery of a message with a given value of `message_id` on this
    +   * subscription:
    +   *
    +   * * The message sent to a subscriber is guaranteed not to be resent
    +   * before the message's acknowledgment deadline expires.
    +   * * An acknowledged message will not be resent to a subscriber.
    +   *
    +   * Note that subscribers may still receive multiple copies of a message
    +   * when `enable_exactly_once_delivery` is true if the message was published
    +   * multiple times by a publisher client. These copies are  considered distinct
    +   * by Pub/Sub and have distinct `message_id` values.
    +   * 
    + * + * bool enable_exactly_once_delivery = 16 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The enableExactlyOnceDelivery. + */ + boolean getEnableExactlyOnceDelivery(); + + /** + * + * + *
    +   * Output only. Indicates the minimum duration for which a message is retained
    +   * after it is published to the subscription's topic. If this field is set,
    +   * messages published to the subscription's topic in the last
    +   * `topic_message_retention_duration` are always available to subscribers. See
    +   * the `message_retention_duration` field in `Topic`. This field is set only
    +   * in responses from the server; it is ignored if it is set in any requests.
    +   * 
    + * + * + * .google.protobuf.Duration topic_message_retention_duration = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the topicMessageRetentionDuration field is set. + */ + boolean hasTopicMessageRetentionDuration(); + + /** + * + * + *
    +   * Output only. Indicates the minimum duration for which a message is retained
    +   * after it is published to the subscription's topic. If this field is set,
    +   * messages published to the subscription's topic in the last
    +   * `topic_message_retention_duration` are always available to subscribers. See
    +   * the `message_retention_duration` field in `Topic`. This field is set only
    +   * in responses from the server; it is ignored if it is set in any requests.
    +   * 
    + * + * + * .google.protobuf.Duration topic_message_retention_duration = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The topicMessageRetentionDuration. + */ + com.google.protobuf.Duration getTopicMessageRetentionDuration(); + + /** + * + * + *
    +   * Output only. Indicates the minimum duration for which a message is retained
    +   * after it is published to the subscription's topic. If this field is set,
    +   * messages published to the subscription's topic in the last
    +   * `topic_message_retention_duration` are always available to subscribers. See
    +   * the `message_retention_duration` field in `Topic`. This field is set only
    +   * in responses from the server; it is ignored if it is set in any requests.
    +   * 
    + * + * + * .google.protobuf.Duration topic_message_retention_duration = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.protobuf.DurationOrBuilder getTopicMessageRetentionDurationOrBuilder(); + + /** + * + * + *
    +   * Output only. An output-only field indicating whether or not the
    +   * subscription can receive messages.
    +   * 
    + * + * + * .google.pubsub.v1.Subscription.State state = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for state. + */ + int getStateValue(); + + /** + * + * + *
    +   * Output only. An output-only field indicating whether or not the
    +   * subscription can receive messages.
    +   * 
    + * + * + * .google.pubsub.v1.Subscription.State state = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The state. + */ + com.google.pubsub.v1.Subscription.State getState(); + + /** + * + * + *
    +   * Output only. Information about the associated Analytics Hub subscription.
    +   * Only set if the subscription is created by Analytics Hub.
    +   * 
    + * + * + * .google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo analytics_hub_subscription_info = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the analyticsHubSubscriptionInfo field is set. + */ + boolean hasAnalyticsHubSubscriptionInfo(); + + /** + * + * + *
    +   * Output only. Information about the associated Analytics Hub subscription.
    +   * Only set if the subscription is created by Analytics Hub.
    +   * 
    + * + * + * .google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo analytics_hub_subscription_info = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The analyticsHubSubscriptionInfo. + */ + com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo getAnalyticsHubSubscriptionInfo(); + + /** + * + * + *
    +   * Output only. Information about the associated Analytics Hub subscription.
    +   * Only set if the subscription is created by Analytics Hub.
    +   * 
    + * + * + * .google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo analytics_hub_subscription_info = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfoOrBuilder + getAnalyticsHubSubscriptionInfoOrBuilder(); + + /** + * + * + *
    +   * Optional. Transforms to be applied to messages before they are delivered to
    +   * subscribers. Transforms are applied in the order specified.
    +   * 
    + * + * + * repeated .google.pubsub.v1.MessageTransform message_transforms = 25 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + java.util.List getMessageTransformsList(); + + /** + * + * + *
    +   * Optional. Transforms to be applied to messages before they are delivered to
    +   * subscribers. Transforms are applied in the order specified.
    +   * 
    + * + * + * repeated .google.pubsub.v1.MessageTransform message_transforms = 25 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.pubsub.v1.MessageTransform getMessageTransforms(int index); + + /** + * + * + *
    +   * Optional. Transforms to be applied to messages before they are delivered to
    +   * subscribers. Transforms are applied in the order specified.
    +   * 
    + * + * + * repeated .google.pubsub.v1.MessageTransform message_transforms = 25 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + int getMessageTransformsCount(); + + /** + * + * + *
    +   * Optional. Transforms to be applied to messages before they are delivered to
    +   * subscribers. Transforms are applied in the order specified.
    +   * 
    + * + * + * repeated .google.pubsub.v1.MessageTransform message_transforms = 25 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + java.util.List + getMessageTransformsOrBuilderList(); + + /** + * + * + *
    +   * Optional. Transforms to be applied to messages before they are delivered to
    +   * subscribers. Transforms are applied in the order specified.
    +   * 
    + * + * + * repeated .google.pubsub.v1.MessageTransform message_transforms = 25 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + 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"
    +   * See https://docs.cloud.google.com/pubsub/docs/tags for more information on
    +   * using tags with Pub/Sub resources.
    +   * 
    + * + * + * 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"
    +   * See https://docs.cloud.google.com/pubsub/docs/tags for more information on
    +   * using tags with Pub/Sub resources.
    +   * 
    + * + * + * 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"
    +   * See https://docs.cloud.google.com/pubsub/docs/tags for more information on
    +   * using tags with Pub/Sub resources.
    +   * 
    + * + * + * 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"
    +   * See https://docs.cloud.google.com/pubsub/docs/tags for more information on
    +   * using tags with Pub/Sub resources.
    +   * 
    + * + * + * 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"
    +   * See https://docs.cloud.google.com/pubsub/docs/tags for more information on
    +   * using tags with Pub/Sub resources.
    +   * 
    + * + * + * 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 6a7449962..52f12129f 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 @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; @@ -27,132 +29,33 @@ * * Protobuf type {@code google.pubsub.v1.Topic} */ -public final class Topic extends com.google.protobuf.GeneratedMessageV3 +@com.google.protobuf.Generated +public final class Topic extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:google.pubsub.v1.Topic) TopicOrBuilder { private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "Topic"); + } + // Use Topic.newBuilder() to construct. - private Topic(com.google.protobuf.GeneratedMessageV3.Builder builder) { + private Topic(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); } private Topic() { name_ = ""; kmsKeyName_ = ""; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new Topic(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - private Topic( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - java.lang.String s = input.readStringRequireUtf8(); - - name_ = s; - break; - } - case 18: - { - if (!((mutable_bitField0_ & 0x00000001) != 0)) { - labels_ = - com.google.protobuf.MapField.newMapField(LabelsDefaultEntryHolder.defaultEntry); - mutable_bitField0_ |= 0x00000001; - } - com.google.protobuf.MapEntry labels__ = - input.readMessage( - LabelsDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry); - labels_.getMutableMap().put(labels__.getKey(), labels__.getValue()); - break; - } - case 26: - { - com.google.pubsub.v1.MessageStoragePolicy.Builder subBuilder = null; - if (messageStoragePolicy_ != null) { - subBuilder = messageStoragePolicy_.toBuilder(); - } - messageStoragePolicy_ = - input.readMessage( - com.google.pubsub.v1.MessageStoragePolicy.parser(), extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(messageStoragePolicy_); - messageStoragePolicy_ = subBuilder.buildPartial(); - } - - break; - } - case 42: - { - java.lang.String s = input.readStringRequireUtf8(); - - kmsKeyName_ = s; - break; - } - case 50: - { - com.google.pubsub.v1.SchemaSettings.Builder subBuilder = null; - if (schemaSettings_ != null) { - subBuilder = schemaSettings_.toBuilder(); - } - schemaSettings_ = - input.readMessage( - com.google.pubsub.v1.SchemaSettings.parser(), extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(schemaSettings_); - schemaSettings_ = subBuilder.buildPartial(); - } - - break; - } - case 56: - { - satisfiesPzs_ = input.readBool(); - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } + state_ = 0; + messageTransforms_ = java.util.Collections.emptyList(); } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { @@ -161,17 +64,20 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { @SuppressWarnings({"rawtypes"}) @java.lang.Override - protected com.google.protobuf.MapField internalGetMapField(int number) { + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldReflection( + int number) { switch (number) { case 2: return internalGetLabels(); + case 14: + return internalGetTags(); default: throw new RuntimeException("Invalid map field number: " + number); } } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_Topic_fieldAccessorTable @@ -179,13 +85,190 @@ protected com.google.protobuf.MapField internalGetMapField(int number) { com.google.pubsub.v1.Topic.class, com.google.pubsub.v1.Topic.Builder.class); } + /** + * + * + *
    +   * The state of the topic.
    +   * 
    + * + * Protobuf enum {@code google.pubsub.v1.Topic.State} + */ + public enum State implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
    +     * Default value. This value is unused.
    +     * 
    + * + * STATE_UNSPECIFIED = 0; + */ + STATE_UNSPECIFIED(0), + /** + * + * + *
    +     * The topic does not have any persistent errors.
    +     * 
    + * + * ACTIVE = 1; + */ + ACTIVE(1), + /** + * + * + *
    +     * Ingestion from the data source has encountered a permanent error.
    +     * See the more detailed error state in the corresponding ingestion
    +     * source configuration.
    +     * 
    + * + * INGESTION_RESOURCE_ERROR = 2; + */ + INGESTION_RESOURCE_ERROR(2), + UNRECOGNIZED(-1), + ; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "State"); + } + + /** + * + * + *
    +     * Default value. This value is unused.
    +     * 
    + * + * STATE_UNSPECIFIED = 0; + */ + public static final int STATE_UNSPECIFIED_VALUE = 0; + + /** + * + * + *
    +     * The topic does not have any persistent errors.
    +     * 
    + * + * ACTIVE = 1; + */ + public static final int ACTIVE_VALUE = 1; + + /** + * + * + *
    +     * Ingestion from the data source has encountered a permanent error.
    +     * See the more detailed error state in the corresponding ingestion
    +     * source configuration.
    +     * 
    + * + * INGESTION_RESOURCE_ERROR = 2; + */ + public static final int INGESTION_RESOURCE_ERROR_VALUE = 2; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static State valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static State forNumber(int value) { + switch (value) { + case 0: + return STATE_UNSPECIFIED; + case 1: + return ACTIVE; + case 2: + return INGESTION_RESOURCE_ERROR; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public State findValueByNumber(int number) { + return State.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.pubsub.v1.Topic.getDescriptor().getEnumTypes().get(0); + } + + private static final State[] VALUES = values(); + + public static State valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private State(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.pubsub.v1.Topic.State) + } + + private int bitField0_; public static final int NAME_FIELD_NUMBER = 1; - private volatile java.lang.Object name_; + + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; + /** * * *
    -   * Required. The name of the topic. It must have the format
    +   * Required. Identifier. The name of the topic. It must have the format
        * `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter,
        * and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`),
        * underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent
    @@ -193,7 +276,9 @@ protected com.google.protobuf.MapField internalGetMapField(int number) {
        * must not start with `"goog"`.
        * 
    * - * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IDENTIFIER]; + * * * @return The name. */ @@ -209,11 +294,12 @@ public java.lang.String getName() { return s; } } + /** * * *
    -   * Required. The name of the topic. It must have the format
    +   * Required. Identifier. The name of the topic. It must have the format
        * `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter,
        * and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`),
        * underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent
    @@ -221,7 +307,9 @@ public java.lang.String getName() {
        * must not start with `"goog"`.
        * 
    * - * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IDENTIFIER]; + * * * @return The bytes for name. */ @@ -251,6 +339,7 @@ private static final class LabelsDefaultEntryHolder { ""); } + @SuppressWarnings("serial") private com.google.protobuf.MapField labels_; private com.google.protobuf.MapField internalGetLabels() { @@ -263,75 +352,83 @@ private com.google.protobuf.MapField interna public int getLabelsCount() { return internalGetLabels().getMap().size(); } + /** * * *
    -   * See [Creating and managing labels]
    +   * Optional. See [Creating and managing labels]
        * (https://cloud.google.com/pubsub/docs/labels).
        * 
    * - * map<string, string> labels = 2; + * map<string, string> labels = 2 [(.google.api.field_behavior) = OPTIONAL]; */ @java.lang.Override public boolean containsLabels(java.lang.String key) { if (key == null) { - throw new java.lang.NullPointerException(); + throw new NullPointerException("map key"); } return internalGetLabels().getMap().containsKey(key); } + /** Use {@link #getLabelsMap()} instead. */ @java.lang.Override @java.lang.Deprecated public java.util.Map getLabels() { return getLabelsMap(); } + /** * * *
    -   * See [Creating and managing labels]
    +   * Optional. See [Creating and managing labels]
        * (https://cloud.google.com/pubsub/docs/labels).
        * 
    * - * map<string, string> labels = 2; + * map<string, string> labels = 2 [(.google.api.field_behavior) = OPTIONAL]; */ @java.lang.Override public java.util.Map getLabelsMap() { return internalGetLabels().getMap(); } + /** * * *
    -   * See [Creating and managing labels]
    +   * Optional. See [Creating and managing labels]
        * (https://cloud.google.com/pubsub/docs/labels).
        * 
    * - * map<string, string> labels = 2; + * map<string, string> labels = 2 [(.google.api.field_behavior) = OPTIONAL]; */ @java.lang.Override - public java.lang.String getLabelsOrDefault(java.lang.String key, java.lang.String defaultValue) { + public /* nullable */ java.lang.String getLabelsOrDefault( + java.lang.String key, + /* nullable */ + java.lang.String defaultValue) { if (key == null) { - throw new java.lang.NullPointerException(); + throw new NullPointerException("map key"); } java.util.Map map = internalGetLabels().getMap(); return map.containsKey(key) ? map.get(key) : defaultValue; } + /** * * *
    -   * See [Creating and managing labels]
    +   * Optional. See [Creating and managing labels]
        * (https://cloud.google.com/pubsub/docs/labels).
        * 
    * - * map<string, string> labels = 2; + * map<string, string> labels = 2 [(.google.api.field_behavior) = OPTIONAL]; */ @java.lang.Override public java.lang.String getLabelsOrThrow(java.lang.String key) { if (key == null) { - throw new java.lang.NullPointerException(); + throw new NullPointerException("map key"); } java.util.Map map = internalGetLabels().getMap(); if (!map.containsKey(key)) { @@ -342,33 +439,39 @@ public java.lang.String getLabelsOrThrow(java.lang.String key) { public static final int MESSAGE_STORAGE_POLICY_FIELD_NUMBER = 3; private com.google.pubsub.v1.MessageStoragePolicy messageStoragePolicy_; + /** * * *
    -   * Policy constraining the set of Google Cloud Platform regions where messages
    -   * published to the topic may be stored. If not present, then no constraints
    -   * are in effect.
    +   * Optional. Policy constraining the set of Google Cloud Platform regions
    +   * where messages published to the topic may be stored. If not present, then
    +   * no constraints are in effect.
        * 
    * - * .google.pubsub.v1.MessageStoragePolicy message_storage_policy = 3; + * + * .google.pubsub.v1.MessageStoragePolicy message_storage_policy = 3 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return Whether the messageStoragePolicy field is set. */ @java.lang.Override public boolean hasMessageStoragePolicy() { - return messageStoragePolicy_ != null; + return ((bitField0_ & 0x00000001) != 0); } + /** * * *
    -   * Policy constraining the set of Google Cloud Platform regions where messages
    -   * published to the topic may be stored. If not present, then no constraints
    -   * are in effect.
    +   * Optional. Policy constraining the set of Google Cloud Platform regions
    +   * where messages published to the topic may be stored. If not present, then
    +   * no constraints are in effect.
        * 
    * - * .google.pubsub.v1.MessageStoragePolicy message_storage_policy = 3; + * + * .google.pubsub.v1.MessageStoragePolicy message_storage_policy = 3 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return The messageStoragePolicy. */ @@ -378,34 +481,45 @@ public com.google.pubsub.v1.MessageStoragePolicy getMessageStoragePolicy() { ? com.google.pubsub.v1.MessageStoragePolicy.getDefaultInstance() : messageStoragePolicy_; } + /** * * *
    -   * Policy constraining the set of Google Cloud Platform regions where messages
    -   * published to the topic may be stored. If not present, then no constraints
    -   * are in effect.
    +   * Optional. Policy constraining the set of Google Cloud Platform regions
    +   * where messages published to the topic may be stored. If not present, then
    +   * no constraints are in effect.
        * 
    * - * .google.pubsub.v1.MessageStoragePolicy message_storage_policy = 3; + * + * .google.pubsub.v1.MessageStoragePolicy message_storage_policy = 3 [(.google.api.field_behavior) = OPTIONAL]; + * */ @java.lang.Override public com.google.pubsub.v1.MessageStoragePolicyOrBuilder getMessageStoragePolicyOrBuilder() { - return getMessageStoragePolicy(); + return messageStoragePolicy_ == null + ? com.google.pubsub.v1.MessageStoragePolicy.getDefaultInstance() + : messageStoragePolicy_; } public static final int KMS_KEY_NAME_FIELD_NUMBER = 5; - private volatile java.lang.Object kmsKeyName_; + + @SuppressWarnings("serial") + private volatile java.lang.Object kmsKeyName_ = ""; + /** * * *
    -   * The resource name of the Cloud KMS CryptoKey to be used to protect access
    -   * to messages published on this topic.
    +   * Optional. The resource name of the Cloud KMS CryptoKey to be used to
    +   * protect access to messages published on this topic.
    +   *
        * The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
        * 
    * - * string kms_key_name = 5; + * + * string kms_key_name = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return The kmsKeyName. */ @@ -421,16 +535,20 @@ public java.lang.String getKmsKeyName() { return s; } } + /** * * *
    -   * The resource name of the Cloud KMS CryptoKey to be used to protect access
    -   * to messages published on this topic.
    +   * Optional. The resource name of the Cloud KMS CryptoKey to be used to
    +   * protect access to messages published on this topic.
    +   *
        * The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
        * 
    * - * string kms_key_name = 5; + * + * string kms_key_name = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return The bytes for kmsKeyName. */ @@ -449,31 +567,35 @@ public com.google.protobuf.ByteString getKmsKeyNameBytes() { public static final int SCHEMA_SETTINGS_FIELD_NUMBER = 6; private com.google.pubsub.v1.SchemaSettings schemaSettings_; + /** * * *
    -   * Settings for validating messages published against a schema.
    -   * EXPERIMENTAL: Schema support is in development and may not work yet.
    +   * Optional. Settings for validating messages published against a schema.
        * 
    * - * .google.pubsub.v1.SchemaSettings schema_settings = 6; + * + * .google.pubsub.v1.SchemaSettings schema_settings = 6 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return Whether the schemaSettings field is set. */ @java.lang.Override public boolean hasSchemaSettings() { - return schemaSettings_ != null; + return ((bitField0_ & 0x00000002) != 0); } + /** * * *
    -   * Settings for validating messages published against a schema.
    -   * EXPERIMENTAL: Schema support is in development and may not work yet.
    +   * Optional. Settings for validating messages published against a schema.
        * 
    * - * .google.pubsub.v1.SchemaSettings schema_settings = 6; + * + * .google.pubsub.v1.SchemaSettings schema_settings = 6 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return The schemaSettings. */ @@ -483,32 +605,37 @@ public com.google.pubsub.v1.SchemaSettings getSchemaSettings() { ? com.google.pubsub.v1.SchemaSettings.getDefaultInstance() : schemaSettings_; } + /** * * *
    -   * Settings for validating messages published against a schema.
    -   * EXPERIMENTAL: Schema support is in development and may not work yet.
    +   * Optional. Settings for validating messages published against a schema.
        * 
    * - * .google.pubsub.v1.SchemaSettings schema_settings = 6; + * + * .google.pubsub.v1.SchemaSettings schema_settings = 6 [(.google.api.field_behavior) = OPTIONAL]; + * */ @java.lang.Override public com.google.pubsub.v1.SchemaSettingsOrBuilder getSchemaSettingsOrBuilder() { - return getSchemaSettings(); + return schemaSettings_ == null + ? com.google.pubsub.v1.SchemaSettings.getDefaultInstance() + : schemaSettings_; } public static final int SATISFIES_PZS_FIELD_NUMBER = 7; - private boolean satisfiesPzs_; + private boolean satisfiesPzs_ = false; + /** * * *
    -   * Reserved for future use. This field is set only in responses from the
    -   * server; it is ignored if it is set in any requests.
    +   * Optional. Reserved for future use. This field is set only in responses from
    +   * the server; it is ignored if it is set in any requests.
        * 
    * - * bool satisfies_pzs = 7; + * bool satisfies_pzs = 7 [(.google.api.field_behavior) = OPTIONAL]; * * @return The satisfiesPzs. */ @@ -517,1323 +644,3328 @@ public boolean getSatisfiesPzs() { return satisfiesPzs_; } - private byte memoizedIsInitialized = -1; + public static final int MESSAGE_RETENTION_DURATION_FIELD_NUMBER = 8; + private com.google.protobuf.Duration messageRetentionDuration_; + /** + * + * + *
    +   * Optional. Indicates the minimum duration to retain a message after it is
    +   * published to the topic. If this field is set, messages published to the
    +   * topic in the last `message_retention_duration` are always available to
    +   * subscribers. For instance, it allows any attached subscription to [seek to
    +   * a
    +   * timestamp](https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time)
    +   * that is up to `message_retention_duration` in the past. If this field is
    +   * not set, message retention is controlled by settings on individual
    +   * subscriptions. Cannot be more than 31 days or less than 10 minutes.
    +   * 
    + * + * + * .google.protobuf.Duration message_retention_duration = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the messageRetentionDuration field is set. + */ @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; + public boolean hasMessageRetentionDuration() { + return ((bitField0_ & 0x00000004) != 0); } + /** + * + * + *
    +   * Optional. Indicates the minimum duration to retain a message after it is
    +   * published to the topic. If this field is set, messages published to the
    +   * topic in the last `message_retention_duration` are always available to
    +   * subscribers. For instance, it allows any attached subscription to [seek to
    +   * a
    +   * timestamp](https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time)
    +   * that is up to `message_retention_duration` in the past. If this field is
    +   * not set, message retention is controlled by settings on individual
    +   * subscriptions. Cannot be more than 31 days or less than 10 minutes.
    +   * 
    + * + * + * .google.protobuf.Duration message_retention_duration = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The messageRetentionDuration. + */ @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!getNameBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); - } - com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( - output, internalGetLabels(), LabelsDefaultEntryHolder.defaultEntry, 2); - if (messageStoragePolicy_ != null) { - output.writeMessage(3, getMessageStoragePolicy()); - } - if (!getKmsKeyNameBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 5, kmsKeyName_); - } - if (schemaSettings_ != null) { - output.writeMessage(6, getSchemaSettings()); - } - if (satisfiesPzs_ != false) { - output.writeBool(7, satisfiesPzs_); - } - unknownFields.writeTo(output); + public com.google.protobuf.Duration getMessageRetentionDuration() { + return messageRetentionDuration_ == null + ? com.google.protobuf.Duration.getDefaultInstance() + : messageRetentionDuration_; } + /** + * + * + *
    +   * Optional. Indicates the minimum duration to retain a message after it is
    +   * published to the topic. If this field is set, messages published to the
    +   * topic in the last `message_retention_duration` are always available to
    +   * subscribers. For instance, it allows any attached subscription to [seek to
    +   * a
    +   * timestamp](https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time)
    +   * that is up to `message_retention_duration` in the past. If this field is
    +   * not set, message retention is controlled by settings on individual
    +   * subscriptions. Cannot be more than 31 days or less than 10 minutes.
    +   * 
    + * + * + * .google.protobuf.Duration message_retention_duration = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + */ @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (!getNameBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); - } - for (java.util.Map.Entry entry : - internalGetLabels().getMap().entrySet()) { - com.google.protobuf.MapEntry labels__ = - LabelsDefaultEntryHolder.defaultEntry - .newBuilderForType() - .setKey(entry.getKey()) - .setValue(entry.getValue()) - .build(); - size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, labels__); - } - if (messageStoragePolicy_ != null) { - size += - com.google.protobuf.CodedOutputStream.computeMessageSize(3, getMessageStoragePolicy()); - } - if (!getKmsKeyNameBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, kmsKeyName_); - } - if (schemaSettings_ != null) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(6, getSchemaSettings()); - } - if (satisfiesPzs_ != false) { - size += com.google.protobuf.CodedOutputStream.computeBoolSize(7, satisfiesPzs_); - } - size += unknownFields.getSerializedSize(); - memoizedSize = size; - return size; + public com.google.protobuf.DurationOrBuilder getMessageRetentionDurationOrBuilder() { + return messageRetentionDuration_ == null + ? com.google.protobuf.Duration.getDefaultInstance() + : messageRetentionDuration_; } - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.pubsub.v1.Topic)) { - return super.equals(obj); - } - com.google.pubsub.v1.Topic other = (com.google.pubsub.v1.Topic) obj; + public static final int STATE_FIELD_NUMBER = 9; + private int state_ = 0; - if (!getName().equals(other.getName())) return false; - if (!internalGetLabels().equals(other.internalGetLabels())) return false; - if (hasMessageStoragePolicy() != other.hasMessageStoragePolicy()) return false; - if (hasMessageStoragePolicy()) { - if (!getMessageStoragePolicy().equals(other.getMessageStoragePolicy())) return false; - } - if (!getKmsKeyName().equals(other.getKmsKeyName())) return false; - if (hasSchemaSettings() != other.hasSchemaSettings()) return false; - if (hasSchemaSettings()) { - if (!getSchemaSettings().equals(other.getSchemaSettings())) return false; - } - if (getSatisfiesPzs() != other.getSatisfiesPzs()) return false; - if (!unknownFields.equals(other.unknownFields)) return false; - return true; + /** + * + * + *
    +   * Output only. An output-only field indicating the state of the topic.
    +   * 
    + * + * .google.pubsub.v1.Topic.State state = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for state. + */ + @java.lang.Override + public int getStateValue() { + return state_; } + /** + * + * + *
    +   * Output only. An output-only field indicating the state of the topic.
    +   * 
    + * + * .google.pubsub.v1.Topic.State state = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The state. + */ @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + NAME_FIELD_NUMBER; - hash = (53 * hash) + getName().hashCode(); - if (!internalGetLabels().getMap().isEmpty()) { - hash = (37 * hash) + LABELS_FIELD_NUMBER; - hash = (53 * hash) + internalGetLabels().hashCode(); - } - if (hasMessageStoragePolicy()) { - hash = (37 * hash) + MESSAGE_STORAGE_POLICY_FIELD_NUMBER; - hash = (53 * hash) + getMessageStoragePolicy().hashCode(); - } - hash = (37 * hash) + KMS_KEY_NAME_FIELD_NUMBER; - hash = (53 * hash) + getKmsKeyName().hashCode(); - if (hasSchemaSettings()) { - hash = (37 * hash) + SCHEMA_SETTINGS_FIELD_NUMBER; - hash = (53 * hash) + getSchemaSettings().hashCode(); - } - hash = (37 * hash) + SATISFIES_PZS_FIELD_NUMBER; - hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getSatisfiesPzs()); - hash = (29 * hash) + unknownFields.hashCode(); - memoizedHashCode = hash; - return hash; + public com.google.pubsub.v1.Topic.State getState() { + com.google.pubsub.v1.Topic.State result = com.google.pubsub.v1.Topic.State.forNumber(state_); + return result == null ? com.google.pubsub.v1.Topic.State.UNRECOGNIZED : result; } - public static com.google.pubsub.v1.Topic parseFrom(java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } + public static final int INGESTION_DATA_SOURCE_SETTINGS_FIELD_NUMBER = 10; + private com.google.pubsub.v1.IngestionDataSourceSettings ingestionDataSourceSettings_; - public static com.google.pubsub.v1.Topic parseFrom( - java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); + /** + * + * + *
    +   * Optional. Settings for ingestion from a data source into this topic.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings ingestion_data_source_settings = 10 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the ingestionDataSourceSettings field is set. + */ + @java.lang.Override + public boolean hasIngestionDataSourceSettings() { + return ((bitField0_ & 0x00000008) != 0); } - public static com.google.pubsub.v1.Topic parseFrom(com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); + /** + * + * + *
    +   * Optional. Settings for ingestion from a data source into this topic.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings ingestion_data_source_settings = 10 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The ingestionDataSourceSettings. + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettings getIngestionDataSourceSettings() { + return ingestionDataSourceSettings_ == null + ? com.google.pubsub.v1.IngestionDataSourceSettings.getDefaultInstance() + : ingestionDataSourceSettings_; } - public static com.google.pubsub.v1.Topic parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); + /** + * + * + *
    +   * Optional. Settings for ingestion from a data source into this topic.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings ingestion_data_source_settings = 10 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.IngestionDataSourceSettingsOrBuilder + getIngestionDataSourceSettingsOrBuilder() { + return ingestionDataSourceSettings_ == null + ? com.google.pubsub.v1.IngestionDataSourceSettings.getDefaultInstance() + : ingestionDataSourceSettings_; } - public static com.google.pubsub.v1.Topic parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } + public static final int MESSAGE_TRANSFORMS_FIELD_NUMBER = 13; - public static com.google.pubsub.v1.Topic parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } + @SuppressWarnings("serial") + private java.util.List messageTransforms_; - public static com.google.pubsub.v1.Topic parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + /** + * + * + *
    +   * Optional. Transforms to be applied to messages published to the topic.
    +   * Transforms are applied in the order specified.
    +   * 
    + * + * + * repeated .google.pubsub.v1.MessageTransform message_transforms = 13 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public java.util.List getMessageTransformsList() { + return messageTransforms_; } - public static com.google.pubsub.v1.Topic parseFrom( - java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( - PARSER, input, extensionRegistry); + /** + * + * + *
    +   * Optional. Transforms to be applied to messages published to the topic.
    +   * Transforms are applied in the order specified.
    +   * 
    + * + * + * repeated .google.pubsub.v1.MessageTransform message_transforms = 13 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public java.util.List + getMessageTransformsOrBuilderList() { + return messageTransforms_; } - public static com.google.pubsub.v1.Topic parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + /** + * + * + *
    +   * Optional. Transforms to be applied to messages published to the topic.
    +   * Transforms are applied in the order specified.
    +   * 
    + * + * + * repeated .google.pubsub.v1.MessageTransform message_transforms = 13 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public int getMessageTransformsCount() { + return messageTransforms_.size(); } - public static com.google.pubsub.v1.Topic parseDelimitedFrom( - java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( - PARSER, input, extensionRegistry); + /** + * + * + *
    +   * Optional. Transforms to be applied to messages published to the topic.
    +   * Transforms are applied in the order specified.
    +   * 
    + * + * + * repeated .google.pubsub.v1.MessageTransform message_transforms = 13 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.MessageTransform getMessageTransforms(int index) { + return messageTransforms_.get(index); } - public static com.google.pubsub.v1.Topic parseFrom(com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + /** + * + * + *
    +   * Optional. Transforms to be applied to messages published to the topic.
    +   * Transforms are applied in the order specified.
    +   * 
    + * + * + * repeated .google.pubsub.v1.MessageTransform message_transforms = 13 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.pubsub.v1.MessageTransformOrBuilder getMessageTransformsOrBuilder(int index) { + return messageTransforms_.get(index); } - public static com.google.pubsub.v1.Topic parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( - PARSER, input, extensionRegistry); + 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, + ""); } - @java.lang.Override - public Builder newBuilderForType() { - return newBuilder(); + @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 static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); + public int getTagsCount() { + return internalGetTags().getMap().size(); } - public static Builder newBuilder(com.google.pubsub.v1.Topic prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + /** + * + * + *
    +   * Optional. Input only. Immutable. Tag keys/values directly bound to this
    +   * resource. For example:
    +   * "123/environment": "production",
    +   * "123/costCenter": "marketing"
    +   * See https://docs.cloud.google.com/pubsub/docs/tags for more information on
    +   * using tags with Pub/Sub resources.
    +   * 
    + * + * + * 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 - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + @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"
    +   * See https://docs.cloud.google.com/pubsub/docs/tags for more information on
    +   * using tags with Pub/Sub resources.
    +   * 
    + * + * + * map<string, string> tags = 14 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * + */ @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; + public java.util.Map getTagsMap() { + return internalGetTags().getMap(); } + /** * * *
    -   * A topic resource.
    +   * Optional. Input only. Immutable. Tag keys/values directly bound to this
    +   * resource. For example:
    +   * "123/environment": "production",
    +   * "123/costCenter": "marketing"
    +   * See https://docs.cloud.google.com/pubsub/docs/tags for more information on
    +   * using tags with Pub/Sub resources.
        * 
    * - * Protobuf type {@code google.pubsub.v1.Topic} + * + * map<string, string> tags = 14 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.pubsub.v1.Topic) - com.google.pubsub.v1.TopicOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.pubsub.v1.PubsubProto.internal_static_google_pubsub_v1_Topic_descriptor; + @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; + } - @SuppressWarnings({"rawtypes"}) - protected com.google.protobuf.MapField internalGetMapField(int number) { - switch (number) { - case 2: - return internalGetLabels(); - default: - throw new RuntimeException("Invalid map field number: " + number); - } + /** + * + * + *
    +   * Optional. Input only. Immutable. Tag keys/values directly bound to this
    +   * resource. For example:
    +   * "123/environment": "production",
    +   * "123/costCenter": "marketing"
    +   * See https://docs.cloud.google.com/pubsub/docs/tags for more information on
    +   * using tags with Pub/Sub resources.
    +   * 
    + * + * + * 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"); } - - @SuppressWarnings({"rawtypes"}) - protected com.google.protobuf.MapField internalGetMutableMapField(int number) { - switch (number) { - case 2: - return internalGetMutableLabels(); - default: - throw new RuntimeException("Invalid map field number: " + number); - } + java.util.Map map = internalGetTags().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); } + return map.get(key); + } - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.pubsub.v1.PubsubProto - .internal_static_google_pubsub_v1_Topic_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.pubsub.v1.Topic.class, com.google.pubsub.v1.Topic.Builder.class); - } + private byte memoizedIsInitialized = -1; - // Construct using com.google.pubsub.v1.Topic.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } + memoizedIsInitialized = 1; + return true; + } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, name_); } + com.google.protobuf.GeneratedMessage.serializeStringMapTo( + output, internalGetLabels(), LabelsDefaultEntryHolder.defaultEntry, 2); + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(3, getMessageStoragePolicy()); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(kmsKeyName_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 5, kmsKeyName_); + } + if (((bitField0_ & 0x00000002) != 0)) { + output.writeMessage(6, getSchemaSettings()); + } + if (satisfiesPzs_ != false) { + output.writeBool(7, satisfiesPzs_); + } + if (((bitField0_ & 0x00000004) != 0)) { + output.writeMessage(8, getMessageRetentionDuration()); + } + if (state_ != com.google.pubsub.v1.Topic.State.STATE_UNSPECIFIED.getNumber()) { + output.writeEnum(9, state_); + } + if (((bitField0_ & 0x00000008) != 0)) { + output.writeMessage(10, getIngestionDataSourceSettings()); + } + for (int i = 0; i < messageTransforms_.size(); i++) { + output.writeMessage(13, messageTransforms_.get(i)); + } + com.google.protobuf.GeneratedMessage.serializeStringMapTo( + output, internalGetTags(), TagsDefaultEntryHolder.defaultEntry, 14); + getUnknownFields().writeTo(output); + } - @java.lang.Override - public Builder clear() { - super.clear(); - name_ = ""; - + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, name_); + } + for (java.util.Map.Entry entry : + internalGetLabels().getMap().entrySet()) { + com.google.protobuf.MapEntry labels__ = + LabelsDefaultEntryHolder.defaultEntry + .newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, labels__); + } + if (((bitField0_ & 0x00000001) != 0)) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize(3, getMessageStoragePolicy()); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(kmsKeyName_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(5, kmsKeyName_); + } + if (((bitField0_ & 0x00000002) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(6, getSchemaSettings()); + } + if (satisfiesPzs_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(7, satisfiesPzs_); + } + if (((bitField0_ & 0x00000004) != 0)) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 8, getMessageRetentionDuration()); + } + if (state_ != com.google.pubsub.v1.Topic.State.STATE_UNSPECIFIED.getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(9, state_); + } + if (((bitField0_ & 0x00000008) != 0)) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 10, getIngestionDataSourceSettings()); + } + for (int i = 0; i < messageTransforms_.size(); i++) { + 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; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.pubsub.v1.Topic)) { + return super.equals(obj); + } + com.google.pubsub.v1.Topic other = (com.google.pubsub.v1.Topic) obj; + + if (!getName().equals(other.getName())) return false; + if (!internalGetLabels().equals(other.internalGetLabels())) return false; + if (hasMessageStoragePolicy() != other.hasMessageStoragePolicy()) return false; + if (hasMessageStoragePolicy()) { + if (!getMessageStoragePolicy().equals(other.getMessageStoragePolicy())) return false; + } + if (!getKmsKeyName().equals(other.getKmsKeyName())) return false; + if (hasSchemaSettings() != other.hasSchemaSettings()) return false; + if (hasSchemaSettings()) { + if (!getSchemaSettings().equals(other.getSchemaSettings())) return false; + } + if (getSatisfiesPzs() != other.getSatisfiesPzs()) return false; + if (hasMessageRetentionDuration() != other.hasMessageRetentionDuration()) return false; + if (hasMessageRetentionDuration()) { + if (!getMessageRetentionDuration().equals(other.getMessageRetentionDuration())) return false; + } + if (state_ != other.state_) return false; + if (hasIngestionDataSourceSettings() != other.hasIngestionDataSourceSettings()) return false; + if (hasIngestionDataSourceSettings()) { + if (!getIngestionDataSourceSettings().equals(other.getIngestionDataSourceSettings())) + 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; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + if (!internalGetLabels().getMap().isEmpty()) { + hash = (37 * hash) + LABELS_FIELD_NUMBER; + hash = (53 * hash) + internalGetLabels().hashCode(); + } + if (hasMessageStoragePolicy()) { + hash = (37 * hash) + MESSAGE_STORAGE_POLICY_FIELD_NUMBER; + hash = (53 * hash) + getMessageStoragePolicy().hashCode(); + } + hash = (37 * hash) + KMS_KEY_NAME_FIELD_NUMBER; + hash = (53 * hash) + getKmsKeyName().hashCode(); + if (hasSchemaSettings()) { + hash = (37 * hash) + SCHEMA_SETTINGS_FIELD_NUMBER; + hash = (53 * hash) + getSchemaSettings().hashCode(); + } + hash = (37 * hash) + SATISFIES_PZS_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getSatisfiesPzs()); + if (hasMessageRetentionDuration()) { + hash = (37 * hash) + MESSAGE_RETENTION_DURATION_FIELD_NUMBER; + hash = (53 * hash) + getMessageRetentionDuration().hashCode(); + } + hash = (37 * hash) + STATE_FIELD_NUMBER; + hash = (53 * hash) + state_; + if (hasIngestionDataSourceSettings()) { + hash = (37 * hash) + INGESTION_DATA_SOURCE_SETTINGS_FIELD_NUMBER; + hash = (53 * hash) + getIngestionDataSourceSettings().hashCode(); + } + if (getMessageTransformsCount() > 0) { + 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; + } + + public static com.google.pubsub.v1.Topic parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.Topic parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.Topic parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.Topic parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.Topic parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.pubsub.v1.Topic parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.pubsub.v1.Topic parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.Topic parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.Topic parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.Topic parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.pubsub.v1.Topic parseFrom(com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.pubsub.v1.Topic parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.pubsub.v1.Topic prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + + /** + * + * + *
    +   * A topic resource.
    +   * 
    + * + * Protobuf type {@code google.pubsub.v1.Topic} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder + implements + // @@protoc_insertion_point(builder_implements:google.pubsub.v1.Topic) + com.google.pubsub.v1.TopicOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.pubsub.v1.PubsubProto.internal_static_google_pubsub_v1_Topic_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldReflection( + int number) { + switch (number) { + case 2: + return internalGetLabels(); + case 14: + return internalGetTags(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMutableMapFieldReflection( + int number) { + switch (number) { + case 2: + return internalGetMutableLabels(); + case 14: + return internalGetMutableTags(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.pubsub.v1.PubsubProto + .internal_static_google_pubsub_v1_Topic_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.pubsub.v1.Topic.class, com.google.pubsub.v1.Topic.Builder.class); + } + + // Construct using com.google.pubsub.v1.Topic.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + internalGetMessageStoragePolicyFieldBuilder(); + internalGetSchemaSettingsFieldBuilder(); + internalGetMessageRetentionDurationFieldBuilder(); + internalGetIngestionDataSourceSettingsFieldBuilder(); + internalGetMessageTransformsFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + name_ = ""; internalGetMutableLabels().clear(); + messageStoragePolicy_ = null; + if (messageStoragePolicyBuilder_ != null) { + messageStoragePolicyBuilder_.dispose(); + messageStoragePolicyBuilder_ = null; + } + kmsKeyName_ = ""; + schemaSettings_ = null; + if (schemaSettingsBuilder_ != null) { + schemaSettingsBuilder_.dispose(); + schemaSettingsBuilder_ = null; + } + satisfiesPzs_ = false; + messageRetentionDuration_ = null; + if (messageRetentionDurationBuilder_ != null) { + messageRetentionDurationBuilder_.dispose(); + messageRetentionDurationBuilder_ = null; + } + state_ = 0; + ingestionDataSourceSettings_ = null; + if (ingestionDataSourceSettingsBuilder_ != null) { + ingestionDataSourceSettingsBuilder_.dispose(); + ingestionDataSourceSettingsBuilder_ = null; + } + if (messageTransformsBuilder_ == null) { + messageTransforms_ = java.util.Collections.emptyList(); + } else { + messageTransforms_ = null; + messageTransformsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000200); + internalGetMutableTags().clear(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.pubsub.v1.PubsubProto.internal_static_google_pubsub_v1_Topic_descriptor; + } + + @java.lang.Override + public com.google.pubsub.v1.Topic getDefaultInstanceForType() { + return com.google.pubsub.v1.Topic.getDefaultInstance(); + } + + @java.lang.Override + public com.google.pubsub.v1.Topic build() { + com.google.pubsub.v1.Topic result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.pubsub.v1.Topic buildPartial() { + com.google.pubsub.v1.Topic result = new com.google.pubsub.v1.Topic(this); + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields(com.google.pubsub.v1.Topic result) { + if (messageTransformsBuilder_ == null) { + if (((bitField0_ & 0x00000200) != 0)) { + messageTransforms_ = java.util.Collections.unmodifiableList(messageTransforms_); + bitField0_ = (bitField0_ & ~0x00000200); + } + result.messageTransforms_ = messageTransforms_; + } else { + result.messageTransforms_ = messageTransformsBuilder_.build(); + } + } + + private void buildPartial0(com.google.pubsub.v1.Topic result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.name_ = name_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.labels_ = internalGetLabels(); + result.labels_.makeImmutable(); + } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000004) != 0)) { + result.messageStoragePolicy_ = + messageStoragePolicyBuilder_ == null + ? messageStoragePolicy_ + : messageStoragePolicyBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.kmsKeyName_ = kmsKeyName_; + } + if (((from_bitField0_ & 0x00000010) != 0)) { + result.schemaSettings_ = + schemaSettingsBuilder_ == null ? schemaSettings_ : schemaSettingsBuilder_.build(); + to_bitField0_ |= 0x00000002; + } + if (((from_bitField0_ & 0x00000020) != 0)) { + result.satisfiesPzs_ = satisfiesPzs_; + } + if (((from_bitField0_ & 0x00000040) != 0)) { + result.messageRetentionDuration_ = + messageRetentionDurationBuilder_ == null + ? messageRetentionDuration_ + : messageRetentionDurationBuilder_.build(); + to_bitField0_ |= 0x00000004; + } + if (((from_bitField0_ & 0x00000080) != 0)) { + result.state_ = state_; + } + if (((from_bitField0_ & 0x00000100) != 0)) { + result.ingestionDataSourceSettings_ = + ingestionDataSourceSettingsBuilder_ == null + ? ingestionDataSourceSettings_ + : ingestionDataSourceSettingsBuilder_.build(); + to_bitField0_ |= 0x00000008; + } + if (((from_bitField0_ & 0x00000400) != 0)) { + result.tags_ = internalGetTags(); + result.tags_.makeImmutable(); + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.pubsub.v1.Topic) { + return mergeFrom((com.google.pubsub.v1.Topic) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.pubsub.v1.Topic other) { + if (other == com.google.pubsub.v1.Topic.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + bitField0_ |= 0x00000001; + onChanged(); + } + internalGetMutableLabels().mergeFrom(other.internalGetLabels()); + bitField0_ |= 0x00000002; + if (other.hasMessageStoragePolicy()) { + mergeMessageStoragePolicy(other.getMessageStoragePolicy()); + } + if (!other.getKmsKeyName().isEmpty()) { + kmsKeyName_ = other.kmsKeyName_; + bitField0_ |= 0x00000008; + onChanged(); + } + if (other.hasSchemaSettings()) { + mergeSchemaSettings(other.getSchemaSettings()); + } + if (other.getSatisfiesPzs() != false) { + setSatisfiesPzs(other.getSatisfiesPzs()); + } + if (other.hasMessageRetentionDuration()) { + mergeMessageRetentionDuration(other.getMessageRetentionDuration()); + } + if (other.state_ != 0) { + setStateValue(other.getStateValue()); + } + if (other.hasIngestionDataSourceSettings()) { + mergeIngestionDataSourceSettings(other.getIngestionDataSourceSettings()); + } + if (messageTransformsBuilder_ == null) { + if (!other.messageTransforms_.isEmpty()) { + if (messageTransforms_.isEmpty()) { + messageTransforms_ = other.messageTransforms_; + bitField0_ = (bitField0_ & ~0x00000200); + } else { + ensureMessageTransformsIsMutable(); + messageTransforms_.addAll(other.messageTransforms_); + } + onChanged(); + } + } else { + if (!other.messageTransforms_.isEmpty()) { + if (messageTransformsBuilder_.isEmpty()) { + messageTransformsBuilder_.dispose(); + messageTransformsBuilder_ = null; + messageTransforms_ = other.messageTransforms_; + bitField0_ = (bitField0_ & ~0x00000200); + messageTransformsBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders + ? internalGetMessageTransformsFieldBuilder() + : null; + } else { + messageTransformsBuilder_.addAllMessages(other.messageTransforms_); + } + } + } + internalGetMutableTags().mergeFrom(other.internalGetTags()); + bitField0_ |= 0x00000400; + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + name_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + com.google.protobuf.MapEntry labels__ = + input.readMessage( + LabelsDefaultEntryHolder.defaultEntry.getParserForType(), + extensionRegistry); + internalGetMutableLabels() + .getMutableMap() + .put(labels__.getKey(), labels__.getValue()); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: + { + input.readMessage( + internalGetMessageStoragePolicyFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000004; + break; + } // case 26 + case 42: + { + kmsKeyName_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000008; + break; + } // case 42 + case 50: + { + input.readMessage( + internalGetSchemaSettingsFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000010; + break; + } // case 50 + case 56: + { + satisfiesPzs_ = input.readBool(); + bitField0_ |= 0x00000020; + break; + } // case 56 + case 66: + { + input.readMessage( + internalGetMessageRetentionDurationFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000040; + break; + } // case 66 + case 72: + { + state_ = input.readEnum(); + bitField0_ |= 0x00000080; + break; + } // case 72 + case 82: + { + input.readMessage( + internalGetIngestionDataSourceSettingsFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000100; + break; + } // case 82 + case 106: + { + com.google.pubsub.v1.MessageTransform m = + input.readMessage( + com.google.pubsub.v1.MessageTransform.parser(), extensionRegistry); + if (messageTransformsBuilder_ == null) { + ensureMessageTransformsIsMutable(); + messageTransforms_.add(m); + } else { + messageTransformsBuilder_.addMessage(m); + } + 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)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.lang.Object name_ = ""; + + /** + * + * + *
    +     * Required. Identifier. The name of the topic. It must have the format
    +     * `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter,
    +     * and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`),
    +     * underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent
    +     * signs (`%`). It must be between 3 and 255 characters in length, and it
    +     * must not start with `"goog"`.
    +     * 
    + * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IDENTIFIER]; + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
    +     * Required. Identifier. The name of the topic. It must have the format
    +     * `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter,
    +     * and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`),
    +     * underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent
    +     * signs (`%`). It must be between 3 and 255 characters in length, and it
    +     * must not start with `"goog"`.
    +     * 
    + * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IDENTIFIER]; + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +     * Required. Identifier. The name of the topic. It must have the format
    +     * `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter,
    +     * and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`),
    +     * underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent
    +     * signs (`%`). It must be between 3 and 255 characters in length, and it
    +     * must not start with `"goog"`.
    +     * 
    + * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IDENTIFIER]; + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Required. Identifier. The name of the topic. It must have the format
    +     * `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter,
    +     * and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`),
    +     * underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent
    +     * signs (`%`). It must be between 3 and 255 characters in length, and it
    +     * must not start with `"goog"`.
    +     * 
    + * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IDENTIFIER]; + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + + /** + * + * + *
    +     * Required. Identifier. The name of the topic. It must have the format
    +     * `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter,
    +     * and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`),
    +     * underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent
    +     * signs (`%`). It must be between 3 and 255 characters in length, and it
    +     * must not start with `"goog"`.
    +     * 
    + * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IDENTIFIER]; + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private com.google.protobuf.MapField labels_; + + private com.google.protobuf.MapField internalGetLabels() { + if (labels_ == null) { + return com.google.protobuf.MapField.emptyMapField(LabelsDefaultEntryHolder.defaultEntry); + } + return labels_; + } + + private com.google.protobuf.MapField + internalGetMutableLabels() { + if (labels_ == null) { + labels_ = com.google.protobuf.MapField.newMapField(LabelsDefaultEntryHolder.defaultEntry); + } + if (!labels_.isMutable()) { + labels_ = labels_.copy(); + } + bitField0_ |= 0x00000002; + onChanged(); + return labels_; + } + + public int getLabelsCount() { + return internalGetLabels().getMap().size(); + } + + /** + * + * + *
    +     * Optional. See [Creating and managing labels]
    +     * (https://cloud.google.com/pubsub/docs/labels).
    +     * 
    + * + * map<string, string> labels = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + @java.lang.Override + public boolean containsLabels(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetLabels().getMap().containsKey(key); + } + + /** Use {@link #getLabelsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getLabels() { + return getLabelsMap(); + } + + /** + * + * + *
    +     * Optional. See [Creating and managing labels]
    +     * (https://cloud.google.com/pubsub/docs/labels).
    +     * 
    + * + * map<string, string> labels = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + @java.lang.Override + public java.util.Map getLabelsMap() { + return internalGetLabels().getMap(); + } + + /** + * + * + *
    +     * Optional. See [Creating and managing labels]
    +     * (https://cloud.google.com/pubsub/docs/labels).
    +     * 
    + * + * map<string, string> labels = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + @java.lang.Override + public /* nullable */ java.lang.String getLabelsOrDefault( + java.lang.String key, + /* nullable */ + java.lang.String defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetLabels().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + + /** + * + * + *
    +     * Optional. See [Creating and managing labels]
    +     * (https://cloud.google.com/pubsub/docs/labels).
    +     * 
    + * + * map<string, string> labels = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + @java.lang.Override + public java.lang.String getLabelsOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetLabels().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public Builder clearLabels() { + bitField0_ = (bitField0_ & ~0x00000002); + internalGetMutableLabels().getMutableMap().clear(); + return this; + } + + /** + * + * + *
    +     * Optional. See [Creating and managing labels]
    +     * (https://cloud.google.com/pubsub/docs/labels).
    +     * 
    + * + * map<string, string> labels = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder removeLabels(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + internalGetMutableLabels().getMutableMap().remove(key); + return this; + } + + /** Use alternate mutation accessors instead. */ + @java.lang.Deprecated + public java.util.Map getMutableLabels() { + bitField0_ |= 0x00000002; + return internalGetMutableLabels().getMutableMap(); + } + + /** + * + * + *
    +     * Optional. See [Creating and managing labels]
    +     * (https://cloud.google.com/pubsub/docs/labels).
    +     * 
    + * + * map<string, string> labels = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder putLabels(java.lang.String key, java.lang.String value) { + if (key == null) { + throw new NullPointerException("map key"); + } + if (value == null) { + throw new NullPointerException("map value"); + } + internalGetMutableLabels().getMutableMap().put(key, value); + bitField0_ |= 0x00000002; + return this; + } + + /** + * + * + *
    +     * Optional. See [Creating and managing labels]
    +     * (https://cloud.google.com/pubsub/docs/labels).
    +     * 
    + * + * map<string, string> labels = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder putAllLabels(java.util.Map values) { + internalGetMutableLabels().getMutableMap().putAll(values); + bitField0_ |= 0x00000002; + return this; + } + + private com.google.pubsub.v1.MessageStoragePolicy messageStoragePolicy_; + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.MessageStoragePolicy, + com.google.pubsub.v1.MessageStoragePolicy.Builder, + com.google.pubsub.v1.MessageStoragePolicyOrBuilder> + messageStoragePolicyBuilder_; + + /** + * + * + *
    +     * Optional. Policy constraining the set of Google Cloud Platform regions
    +     * where messages published to the topic may be stored. If not present, then
    +     * no constraints are in effect.
    +     * 
    + * + * + * .google.pubsub.v1.MessageStoragePolicy message_storage_policy = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the messageStoragePolicy field is set. + */ + public boolean hasMessageStoragePolicy() { + return ((bitField0_ & 0x00000004) != 0); + } + + /** + * + * + *
    +     * Optional. Policy constraining the set of Google Cloud Platform regions
    +     * where messages published to the topic may be stored. If not present, then
    +     * no constraints are in effect.
    +     * 
    + * + * + * .google.pubsub.v1.MessageStoragePolicy message_storage_policy = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The messageStoragePolicy. + */ + public com.google.pubsub.v1.MessageStoragePolicy getMessageStoragePolicy() { + if (messageStoragePolicyBuilder_ == null) { + return messageStoragePolicy_ == null + ? com.google.pubsub.v1.MessageStoragePolicy.getDefaultInstance() + : messageStoragePolicy_; + } else { + return messageStoragePolicyBuilder_.getMessage(); + } + } + + /** + * + * + *
    +     * Optional. Policy constraining the set of Google Cloud Platform regions
    +     * where messages published to the topic may be stored. If not present, then
    +     * no constraints are in effect.
    +     * 
    + * + * + * .google.pubsub.v1.MessageStoragePolicy message_storage_policy = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setMessageStoragePolicy(com.google.pubsub.v1.MessageStoragePolicy value) { + if (messageStoragePolicyBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + messageStoragePolicy_ = value; + } else { + messageStoragePolicyBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Optional. Policy constraining the set of Google Cloud Platform regions
    +     * where messages published to the topic may be stored. If not present, then
    +     * no constraints are in effect.
    +     * 
    + * + * + * .google.pubsub.v1.MessageStoragePolicy message_storage_policy = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setMessageStoragePolicy( + com.google.pubsub.v1.MessageStoragePolicy.Builder builderForValue) { + if (messageStoragePolicyBuilder_ == null) { + messageStoragePolicy_ = builderForValue.build(); + } else { + messageStoragePolicyBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Optional. Policy constraining the set of Google Cloud Platform regions
    +     * where messages published to the topic may be stored. If not present, then
    +     * no constraints are in effect.
    +     * 
    + * + * + * .google.pubsub.v1.MessageStoragePolicy message_storage_policy = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeMessageStoragePolicy(com.google.pubsub.v1.MessageStoragePolicy value) { + if (messageStoragePolicyBuilder_ == null) { + if (((bitField0_ & 0x00000004) != 0) + && messageStoragePolicy_ != null + && messageStoragePolicy_ + != com.google.pubsub.v1.MessageStoragePolicy.getDefaultInstance()) { + getMessageStoragePolicyBuilder().mergeFrom(value); + } else { + messageStoragePolicy_ = value; + } + } else { + messageStoragePolicyBuilder_.mergeFrom(value); + } + if (messageStoragePolicy_ != null) { + bitField0_ |= 0x00000004; + onChanged(); + } + return this; + } + + /** + * + * + *
    +     * Optional. Policy constraining the set of Google Cloud Platform regions
    +     * where messages published to the topic may be stored. If not present, then
    +     * no constraints are in effect.
    +     * 
    + * + * + * .google.pubsub.v1.MessageStoragePolicy message_storage_policy = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearMessageStoragePolicy() { + bitField0_ = (bitField0_ & ~0x00000004); + messageStoragePolicy_ = null; + if (messageStoragePolicyBuilder_ != null) { + messageStoragePolicyBuilder_.dispose(); + messageStoragePolicyBuilder_ = null; + } + onChanged(); + return this; + } + + /** + * + * + *
    +     * Optional. Policy constraining the set of Google Cloud Platform regions
    +     * where messages published to the topic may be stored. If not present, then
    +     * no constraints are in effect.
    +     * 
    + * + * + * .google.pubsub.v1.MessageStoragePolicy message_storage_policy = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.MessageStoragePolicy.Builder getMessageStoragePolicyBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return internalGetMessageStoragePolicyFieldBuilder().getBuilder(); + } + + /** + * + * + *
    +     * Optional. Policy constraining the set of Google Cloud Platform regions
    +     * where messages published to the topic may be stored. If not present, then
    +     * no constraints are in effect.
    +     * 
    + * + * + * .google.pubsub.v1.MessageStoragePolicy message_storage_policy = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.MessageStoragePolicyOrBuilder getMessageStoragePolicyOrBuilder() { + if (messageStoragePolicyBuilder_ != null) { + return messageStoragePolicyBuilder_.getMessageOrBuilder(); + } else { + return messageStoragePolicy_ == null + ? com.google.pubsub.v1.MessageStoragePolicy.getDefaultInstance() + : messageStoragePolicy_; + } + } + + /** + * + * + *
    +     * Optional. Policy constraining the set of Google Cloud Platform regions
    +     * where messages published to the topic may be stored. If not present, then
    +     * no constraints are in effect.
    +     * 
    + * + * + * .google.pubsub.v1.MessageStoragePolicy message_storage_policy = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.MessageStoragePolicy, + com.google.pubsub.v1.MessageStoragePolicy.Builder, + com.google.pubsub.v1.MessageStoragePolicyOrBuilder> + internalGetMessageStoragePolicyFieldBuilder() { if (messageStoragePolicyBuilder_ == null) { + messageStoragePolicyBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.MessageStoragePolicy, + com.google.pubsub.v1.MessageStoragePolicy.Builder, + com.google.pubsub.v1.MessageStoragePolicyOrBuilder>( + getMessageStoragePolicy(), getParentForChildren(), isClean()); messageStoragePolicy_ = null; + } + return messageStoragePolicyBuilder_; + } + + private java.lang.Object kmsKeyName_ = ""; + + /** + * + * + *
    +     * Optional. The resource name of the Cloud KMS CryptoKey to be used to
    +     * 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, (.google.api.resource_reference) = { ... } + * + * + * @return The kmsKeyName. + */ + public java.lang.String getKmsKeyName() { + java.lang.Object ref = kmsKeyName_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + kmsKeyName_ = s; + return s; } else { - messageStoragePolicy_ = null; - messageStoragePolicyBuilder_ = null; + return (java.lang.String) ref; } - kmsKeyName_ = ""; + } + + /** + * + * + *
    +     * Optional. The resource name of the Cloud KMS CryptoKey to be used to
    +     * 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, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for kmsKeyName. + */ + public com.google.protobuf.ByteString getKmsKeyNameBytes() { + java.lang.Object ref = kmsKeyName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + kmsKeyName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
    +     * Optional. The resource name of the Cloud KMS CryptoKey to be used to
    +     * 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, (.google.api.resource_reference) = { ... } + * + * + * @param value The kmsKeyName to set. + * @return This builder for chaining. + */ + public Builder setKmsKeyName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + kmsKeyName_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Optional. The resource name of the Cloud KMS CryptoKey to be used to
    +     * 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, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearKmsKeyName() { + kmsKeyName_ = getDefaultInstance().getKmsKeyName(); + bitField0_ = (bitField0_ & ~0x00000008); + onChanged(); + return this; + } + + /** + * + * + *
    +     * Optional. The resource name of the Cloud KMS CryptoKey to be used to
    +     * 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, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for kmsKeyName to set. + * @return This builder for chaining. + */ + public Builder setKmsKeyNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + kmsKeyName_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + + private com.google.pubsub.v1.SchemaSettings schemaSettings_; + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.SchemaSettings, + com.google.pubsub.v1.SchemaSettings.Builder, + com.google.pubsub.v1.SchemaSettingsOrBuilder> + schemaSettingsBuilder_; + + /** + * + * + *
    +     * Optional. Settings for validating messages published against a schema.
    +     * 
    + * + * + * .google.pubsub.v1.SchemaSettings schema_settings = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the schemaSettings field is set. + */ + public boolean hasSchemaSettings() { + return ((bitField0_ & 0x00000010) != 0); + } + + /** + * + * + *
    +     * Optional. Settings for validating messages published against a schema.
    +     * 
    + * + * + * .google.pubsub.v1.SchemaSettings schema_settings = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The schemaSettings. + */ + public com.google.pubsub.v1.SchemaSettings getSchemaSettings() { + if (schemaSettingsBuilder_ == null) { + return schemaSettings_ == null + ? com.google.pubsub.v1.SchemaSettings.getDefaultInstance() + : schemaSettings_; + } else { + return schemaSettingsBuilder_.getMessage(); + } + } + + /** + * + * + *
    +     * Optional. Settings for validating messages published against a schema.
    +     * 
    + * + * + * .google.pubsub.v1.SchemaSettings schema_settings = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setSchemaSettings(com.google.pubsub.v1.SchemaSettings value) { + if (schemaSettingsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + schemaSettings_ = value; + } else { + schemaSettingsBuilder_.setMessage(value); + } + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Optional. Settings for validating messages published against a schema.
    +     * 
    + * + * + * .google.pubsub.v1.SchemaSettings schema_settings = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setSchemaSettings(com.google.pubsub.v1.SchemaSettings.Builder builderForValue) { + if (schemaSettingsBuilder_ == null) { + schemaSettings_ = builderForValue.build(); + } else { + schemaSettingsBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + /** + * + * + *
    +     * Optional. Settings for validating messages published against a schema.
    +     * 
    + * + * + * .google.pubsub.v1.SchemaSettings schema_settings = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeSchemaSettings(com.google.pubsub.v1.SchemaSettings value) { if (schemaSettingsBuilder_ == null) { - schemaSettings_ = null; + if (((bitField0_ & 0x00000010) != 0) + && schemaSettings_ != null + && schemaSettings_ != com.google.pubsub.v1.SchemaSettings.getDefaultInstance()) { + getSchemaSettingsBuilder().mergeFrom(value); + } else { + schemaSettings_ = value; + } } else { - schemaSettings_ = null; - schemaSettingsBuilder_ = null; + schemaSettingsBuilder_.mergeFrom(value); + } + if (schemaSettings_ != null) { + bitField0_ |= 0x00000010; + onChanged(); } - satisfiesPzs_ = false; - return this; } - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.pubsub.v1.PubsubProto.internal_static_google_pubsub_v1_Topic_descriptor; + /** + * + * + *
    +     * Optional. Settings for validating messages published against a schema.
    +     * 
    + * + * + * .google.pubsub.v1.SchemaSettings schema_settings = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearSchemaSettings() { + bitField0_ = (bitField0_ & ~0x00000010); + schemaSettings_ = null; + if (schemaSettingsBuilder_ != null) { + schemaSettingsBuilder_.dispose(); + schemaSettingsBuilder_ = null; + } + onChanged(); + return this; } - @java.lang.Override - public com.google.pubsub.v1.Topic getDefaultInstanceForType() { - return com.google.pubsub.v1.Topic.getDefaultInstance(); + /** + * + * + *
    +     * Optional. Settings for validating messages published against a schema.
    +     * 
    + * + * + * .google.pubsub.v1.SchemaSettings schema_settings = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.SchemaSettings.Builder getSchemaSettingsBuilder() { + bitField0_ |= 0x00000010; + onChanged(); + return internalGetSchemaSettingsFieldBuilder().getBuilder(); } - @java.lang.Override - public com.google.pubsub.v1.Topic build() { - com.google.pubsub.v1.Topic result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); + /** + * + * + *
    +     * Optional. Settings for validating messages published against a schema.
    +     * 
    + * + * + * .google.pubsub.v1.SchemaSettings schema_settings = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.SchemaSettingsOrBuilder getSchemaSettingsOrBuilder() { + if (schemaSettingsBuilder_ != null) { + return schemaSettingsBuilder_.getMessageOrBuilder(); + } else { + return schemaSettings_ == null + ? com.google.pubsub.v1.SchemaSettings.getDefaultInstance() + : schemaSettings_; } - return result; } - @java.lang.Override - public com.google.pubsub.v1.Topic buildPartial() { - com.google.pubsub.v1.Topic result = new com.google.pubsub.v1.Topic(this); - int from_bitField0_ = bitField0_; - result.name_ = name_; - result.labels_ = internalGetLabels(); - result.labels_.makeImmutable(); - if (messageStoragePolicyBuilder_ == null) { - result.messageStoragePolicy_ = messageStoragePolicy_; - } else { - result.messageStoragePolicy_ = messageStoragePolicyBuilder_.build(); - } - result.kmsKeyName_ = kmsKeyName_; + /** + * + * + *
    +     * Optional. Settings for validating messages published against a schema.
    +     * 
    + * + * + * .google.pubsub.v1.SchemaSettings schema_settings = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.SchemaSettings, + com.google.pubsub.v1.SchemaSettings.Builder, + com.google.pubsub.v1.SchemaSettingsOrBuilder> + internalGetSchemaSettingsFieldBuilder() { if (schemaSettingsBuilder_ == null) { - result.schemaSettings_ = schemaSettings_; - } else { - result.schemaSettings_ = schemaSettingsBuilder_.build(); + schemaSettingsBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.SchemaSettings, + com.google.pubsub.v1.SchemaSettings.Builder, + com.google.pubsub.v1.SchemaSettingsOrBuilder>( + getSchemaSettings(), getParentForChildren(), isClean()); + schemaSettings_ = null; } - result.satisfiesPzs_ = satisfiesPzs_; - onBuilt(); - return result; + return schemaSettingsBuilder_; } - @java.lang.Override - public Builder clone() { - return super.clone(); - } + private boolean satisfiesPzs_; + /** + * + * + *
    +     * Optional. Reserved for future use. This field is set only in responses from
    +     * the server; it is ignored if it is set in any requests.
    +     * 
    + * + * bool satisfies_pzs = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The satisfiesPzs. + */ @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); + public boolean getSatisfiesPzs() { + return satisfiesPzs_; } - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); + /** + * + * + *
    +     * Optional. Reserved for future use. This field is set only in responses from
    +     * the server; it is ignored if it is set in any requests.
    +     * 
    + * + * bool satisfies_pzs = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The satisfiesPzs to set. + * @return This builder for chaining. + */ + public Builder setSatisfiesPzs(boolean value) { + + satisfiesPzs_ = value; + bitField0_ |= 0x00000020; + onChanged(); + return this; } - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); + /** + * + * + *
    +     * Optional. Reserved for future use. This field is set only in responses from
    +     * the server; it is ignored if it is set in any requests.
    +     * 
    + * + * bool satisfies_pzs = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearSatisfiesPzs() { + bitField0_ = (bitField0_ & ~0x00000020); + satisfiesPzs_ = false; + onChanged(); + return this; } - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); + private com.google.protobuf.Duration messageRetentionDuration_; + private com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Duration, + com.google.protobuf.Duration.Builder, + com.google.protobuf.DurationOrBuilder> + messageRetentionDurationBuilder_; + + /** + * + * + *
    +     * Optional. Indicates the minimum duration to retain a message after it is
    +     * published to the topic. If this field is set, messages published to the
    +     * topic in the last `message_retention_duration` are always available to
    +     * subscribers. For instance, it allows any attached subscription to [seek to
    +     * a
    +     * timestamp](https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time)
    +     * that is up to `message_retention_duration` in the past. If this field is
    +     * not set, message retention is controlled by settings on individual
    +     * subscriptions. Cannot be more than 31 days or less than 10 minutes.
    +     * 
    + * + * + * .google.protobuf.Duration message_retention_duration = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the messageRetentionDuration field is set. + */ + public boolean hasMessageRetentionDuration() { + return ((bitField0_ & 0x00000040) != 0); } - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); + /** + * + * + *
    +     * Optional. Indicates the minimum duration to retain a message after it is
    +     * published to the topic. If this field is set, messages published to the
    +     * topic in the last `message_retention_duration` are always available to
    +     * subscribers. For instance, it allows any attached subscription to [seek to
    +     * a
    +     * timestamp](https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time)
    +     * that is up to `message_retention_duration` in the past. If this field is
    +     * not set, message retention is controlled by settings on individual
    +     * subscriptions. Cannot be more than 31 days or less than 10 minutes.
    +     * 
    + * + * + * .google.protobuf.Duration message_retention_duration = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The messageRetentionDuration. + */ + public com.google.protobuf.Duration getMessageRetentionDuration() { + if (messageRetentionDurationBuilder_ == null) { + return messageRetentionDuration_ == null + ? com.google.protobuf.Duration.getDefaultInstance() + : messageRetentionDuration_; + } else { + return messageRetentionDurationBuilder_.getMessage(); + } } - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.google.pubsub.v1.Topic) { - return mergeFrom((com.google.pubsub.v1.Topic) other); + /** + * + * + *
    +     * Optional. Indicates the minimum duration to retain a message after it is
    +     * published to the topic. If this field is set, messages published to the
    +     * topic in the last `message_retention_duration` are always available to
    +     * subscribers. For instance, it allows any attached subscription to [seek to
    +     * a
    +     * timestamp](https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time)
    +     * that is up to `message_retention_duration` in the past. If this field is
    +     * not set, message retention is controlled by settings on individual
    +     * subscriptions. Cannot be more than 31 days or less than 10 minutes.
    +     * 
    + * + * + * .google.protobuf.Duration message_retention_duration = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setMessageRetentionDuration(com.google.protobuf.Duration value) { + if (messageRetentionDurationBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + messageRetentionDuration_ = value; } else { - super.mergeFrom(other); - return this; + messageRetentionDurationBuilder_.setMessage(value); } + bitField0_ |= 0x00000040; + onChanged(); + return this; } - public Builder mergeFrom(com.google.pubsub.v1.Topic other) { - if (other == com.google.pubsub.v1.Topic.getDefaultInstance()) return this; - if (!other.getName().isEmpty()) { - name_ = other.name_; - onChanged(); + /** + * + * + *
    +     * Optional. Indicates the minimum duration to retain a message after it is
    +     * published to the topic. If this field is set, messages published to the
    +     * topic in the last `message_retention_duration` are always available to
    +     * subscribers. For instance, it allows any attached subscription to [seek to
    +     * a
    +     * timestamp](https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time)
    +     * that is up to `message_retention_duration` in the past. If this field is
    +     * not set, message retention is controlled by settings on individual
    +     * subscriptions. Cannot be more than 31 days or less than 10 minutes.
    +     * 
    + * + * + * .google.protobuf.Duration message_retention_duration = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setMessageRetentionDuration( + com.google.protobuf.Duration.Builder builderForValue) { + if (messageRetentionDurationBuilder_ == null) { + messageRetentionDuration_ = builderForValue.build(); + } else { + messageRetentionDurationBuilder_.setMessage(builderForValue.build()); } - internalGetMutableLabels().mergeFrom(other.internalGetLabels()); - if (other.hasMessageStoragePolicy()) { - mergeMessageStoragePolicy(other.getMessageStoragePolicy()); + bitField0_ |= 0x00000040; + onChanged(); + return this; + } + + /** + * + * + *
    +     * Optional. Indicates the minimum duration to retain a message after it is
    +     * published to the topic. If this field is set, messages published to the
    +     * topic in the last `message_retention_duration` are always available to
    +     * subscribers. For instance, it allows any attached subscription to [seek to
    +     * a
    +     * timestamp](https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time)
    +     * that is up to `message_retention_duration` in the past. If this field is
    +     * not set, message retention is controlled by settings on individual
    +     * subscriptions. Cannot be more than 31 days or less than 10 minutes.
    +     * 
    + * + * + * .google.protobuf.Duration message_retention_duration = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeMessageRetentionDuration(com.google.protobuf.Duration value) { + if (messageRetentionDurationBuilder_ == null) { + if (((bitField0_ & 0x00000040) != 0) + && messageRetentionDuration_ != null + && messageRetentionDuration_ != com.google.protobuf.Duration.getDefaultInstance()) { + getMessageRetentionDurationBuilder().mergeFrom(value); + } else { + messageRetentionDuration_ = value; + } + } else { + messageRetentionDurationBuilder_.mergeFrom(value); } - if (!other.getKmsKeyName().isEmpty()) { - kmsKeyName_ = other.kmsKeyName_; + if (messageRetentionDuration_ != null) { + bitField0_ |= 0x00000040; onChanged(); } - if (other.hasSchemaSettings()) { - mergeSchemaSettings(other.getSchemaSettings()); - } - if (other.getSatisfiesPzs() != false) { - setSatisfiesPzs(other.getSatisfiesPzs()); + return this; + } + + /** + * + * + *
    +     * Optional. Indicates the minimum duration to retain a message after it is
    +     * published to the topic. If this field is set, messages published to the
    +     * topic in the last `message_retention_duration` are always available to
    +     * subscribers. For instance, it allows any attached subscription to [seek to
    +     * a
    +     * timestamp](https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time)
    +     * that is up to `message_retention_duration` in the past. If this field is
    +     * not set, message retention is controlled by settings on individual
    +     * subscriptions. Cannot be more than 31 days or less than 10 minutes.
    +     * 
    + * + * + * .google.protobuf.Duration message_retention_duration = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearMessageRetentionDuration() { + bitField0_ = (bitField0_ & ~0x00000040); + messageRetentionDuration_ = null; + if (messageRetentionDurationBuilder_ != null) { + messageRetentionDurationBuilder_.dispose(); + messageRetentionDurationBuilder_ = null; } - this.mergeUnknownFields(other.unknownFields); onChanged(); return this; } - @java.lang.Override - public final boolean isInitialized() { - return true; + /** + * + * + *
    +     * Optional. Indicates the minimum duration to retain a message after it is
    +     * published to the topic. If this field is set, messages published to the
    +     * topic in the last `message_retention_duration` are always available to
    +     * subscribers. For instance, it allows any attached subscription to [seek to
    +     * a
    +     * timestamp](https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time)
    +     * that is up to `message_retention_duration` in the past. If this field is
    +     * not set, message retention is controlled by settings on individual
    +     * subscriptions. Cannot be more than 31 days or less than 10 minutes.
    +     * 
    + * + * + * .google.protobuf.Duration message_retention_duration = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.protobuf.Duration.Builder getMessageRetentionDurationBuilder() { + bitField0_ |= 0x00000040; + onChanged(); + return internalGetMessageRetentionDurationFieldBuilder().getBuilder(); } - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.pubsub.v1.Topic parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.google.pubsub.v1.Topic) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } + /** + * + * + *
    +     * Optional. Indicates the minimum duration to retain a message after it is
    +     * published to the topic. If this field is set, messages published to the
    +     * topic in the last `message_retention_duration` are always available to
    +     * subscribers. For instance, it allows any attached subscription to [seek to
    +     * a
    +     * timestamp](https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time)
    +     * that is up to `message_retention_duration` in the past. If this field is
    +     * not set, message retention is controlled by settings on individual
    +     * subscriptions. Cannot be more than 31 days or less than 10 minutes.
    +     * 
    + * + * + * .google.protobuf.Duration message_retention_duration = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.protobuf.DurationOrBuilder getMessageRetentionDurationOrBuilder() { + if (messageRetentionDurationBuilder_ != null) { + return messageRetentionDurationBuilder_.getMessageOrBuilder(); + } else { + return messageRetentionDuration_ == null + ? com.google.protobuf.Duration.getDefaultInstance() + : messageRetentionDuration_; } - return this; } - private int bitField0_; - - private java.lang.Object name_ = ""; /** * * *
    -     * Required. The name of the topic. It must have the format
    -     * `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter,
    -     * and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`),
    -     * underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent
    -     * signs (`%`). It must be between 3 and 255 characters in length, and it
    -     * must not start with `"goog"`.
    +     * Optional. Indicates the minimum duration to retain a message after it is
    +     * published to the topic. If this field is set, messages published to the
    +     * topic in the last `message_retention_duration` are always available to
    +     * subscribers. For instance, it allows any attached subscription to [seek to
    +     * a
    +     * timestamp](https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time)
    +     * that is up to `message_retention_duration` in the past. If this field is
    +     * not set, message retention is controlled by settings on individual
    +     * subscriptions. Cannot be more than 31 days or less than 10 minutes.
          * 
    * - * string name = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * @return The name. + * + * .google.protobuf.Duration message_retention_duration = 8 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public java.lang.String getName() { - java.lang.Object ref = name_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - name_ = s; - return s; - } else { - return (java.lang.String) ref; + private com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Duration, + com.google.protobuf.Duration.Builder, + com.google.protobuf.DurationOrBuilder> + internalGetMessageRetentionDurationFieldBuilder() { + if (messageRetentionDurationBuilder_ == null) { + messageRetentionDurationBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Duration, + com.google.protobuf.Duration.Builder, + com.google.protobuf.DurationOrBuilder>( + getMessageRetentionDuration(), getParentForChildren(), isClean()); + messageRetentionDuration_ = null; } + return messageRetentionDurationBuilder_; } + + private int state_ = 0; + /** * * *
    -     * Required. The name of the topic. It must have the format
    -     * `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter,
    -     * and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`),
    -     * underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent
    -     * signs (`%`). It must be between 3 and 255 characters in length, and it
    -     * must not start with `"goog"`.
    +     * Output only. An output-only field indicating the state of the topic.
          * 
    * - * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * .google.pubsub.v1.Topic.State state = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * * - * @return The bytes for name. + * @return The enum numeric value on the wire for state. */ - public com.google.protobuf.ByteString getNameBytes() { - java.lang.Object ref = name_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - name_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } + @java.lang.Override + public int getStateValue() { + return state_; } + /** * * *
    -     * Required. The name of the topic. It must have the format
    -     * `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter,
    -     * and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`),
    -     * underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent
    -     * signs (`%`). It must be between 3 and 255 characters in length, and it
    -     * must not start with `"goog"`.
    +     * Output only. An output-only field indicating the state of the topic.
          * 
    * - * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * .google.pubsub.v1.Topic.State state = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * * - * @param value The name to set. + * @param value The enum numeric value on the wire for state to set. * @return This builder for chaining. */ - public Builder setName(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - name_ = value; + public Builder setStateValue(int value) { + state_ = value; + bitField0_ |= 0x00000080; onChanged(); return this; } + /** * * *
    -     * Required. The name of the topic. It must have the format
    -     * `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter,
    -     * and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`),
    -     * underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent
    -     * signs (`%`). It must be between 3 and 255 characters in length, and it
    -     * must not start with `"goog"`.
    +     * Output only. An output-only field indicating the state of the topic.
          * 
    * - * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * .google.pubsub.v1.Topic.State state = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * * - * @return This builder for chaining. + * @return The state. */ - public Builder clearName() { - - name_ = getDefaultInstance().getName(); - onChanged(); - return this; + @java.lang.Override + public com.google.pubsub.v1.Topic.State getState() { + com.google.pubsub.v1.Topic.State result = com.google.pubsub.v1.Topic.State.forNumber(state_); + return result == null ? com.google.pubsub.v1.Topic.State.UNRECOGNIZED : result; } + /** * * *
    -     * Required. The name of the topic. It must have the format
    -     * `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter,
    -     * and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`),
    -     * underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent
    -     * signs (`%`). It must be between 3 and 255 characters in length, and it
    -     * must not start with `"goog"`.
    +     * Output only. An output-only field indicating the state of the topic.
          * 
    * - * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * .google.pubsub.v1.Topic.State state = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * * - * @param value The bytes for name to set. + * @param value The state to set. * @return This builder for chaining. */ - public Builder setNameBytes(com.google.protobuf.ByteString value) { + public Builder setState(com.google.pubsub.v1.Topic.State value) { if (value == null) { throw new NullPointerException(); } - checkByteStringIsUtf8(value); - - name_ = value; + bitField0_ |= 0x00000080; + state_ = value.getNumber(); onChanged(); return this; } - private com.google.protobuf.MapField labels_; - - private com.google.protobuf.MapField internalGetLabels() { - if (labels_ == null) { - return com.google.protobuf.MapField.emptyMapField(LabelsDefaultEntryHolder.defaultEntry); - } - return labels_; - } - - private com.google.protobuf.MapField - internalGetMutableLabels() { - onChanged(); - ; - if (labels_ == null) { - labels_ = com.google.protobuf.MapField.newMapField(LabelsDefaultEntryHolder.defaultEntry); - } - if (!labels_.isMutable()) { - labels_ = labels_.copy(); - } - return labels_; - } - - public int getLabelsCount() { - return internalGetLabels().getMap().size(); - } /** * * *
    -     * See [Creating and managing labels]
    -     * (https://cloud.google.com/pubsub/docs/labels).
    +     * Output only. An output-only field indicating the state of the topic.
          * 
    * - * map<string, string> labels = 2; + * .google.pubsub.v1.Topic.State state = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return This builder for chaining. */ - @java.lang.Override - public boolean containsLabels(java.lang.String key) { - if (key == null) { - throw new java.lang.NullPointerException(); - } - return internalGetLabels().getMap().containsKey(key); - } - /** Use {@link #getLabelsMap()} instead. */ - @java.lang.Override - @java.lang.Deprecated - public java.util.Map getLabels() { - return getLabelsMap(); + public Builder clearState() { + bitField0_ = (bitField0_ & ~0x00000080); + state_ = 0; + onChanged(); + return this; } + + private com.google.pubsub.v1.IngestionDataSourceSettings ingestionDataSourceSettings_; + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionDataSourceSettings, + com.google.pubsub.v1.IngestionDataSourceSettings.Builder, + com.google.pubsub.v1.IngestionDataSourceSettingsOrBuilder> + ingestionDataSourceSettingsBuilder_; + /** * * *
    -     * See [Creating and managing labels]
    -     * (https://cloud.google.com/pubsub/docs/labels).
    +     * Optional. Settings for ingestion from a data source into this topic.
          * 
    * - * map<string, string> labels = 2; + * + * .google.pubsub.v1.IngestionDataSourceSettings ingestion_data_source_settings = 10 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the ingestionDataSourceSettings field is set. */ - @java.lang.Override - public java.util.Map getLabelsMap() { - return internalGetLabels().getMap(); + public boolean hasIngestionDataSourceSettings() { + return ((bitField0_ & 0x00000100) != 0); } + /** * * *
    -     * See [Creating and managing labels]
    -     * (https://cloud.google.com/pubsub/docs/labels).
    +     * Optional. Settings for ingestion from a data source into this topic.
          * 
    * - * map<string, string> labels = 2; + * + * .google.pubsub.v1.IngestionDataSourceSettings ingestion_data_source_settings = 10 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The ingestionDataSourceSettings. */ - @java.lang.Override - public java.lang.String getLabelsOrDefault( - java.lang.String key, java.lang.String defaultValue) { - if (key == null) { - throw new java.lang.NullPointerException(); + public com.google.pubsub.v1.IngestionDataSourceSettings getIngestionDataSourceSettings() { + if (ingestionDataSourceSettingsBuilder_ == null) { + return ingestionDataSourceSettings_ == null + ? com.google.pubsub.v1.IngestionDataSourceSettings.getDefaultInstance() + : ingestionDataSourceSettings_; + } else { + return ingestionDataSourceSettingsBuilder_.getMessage(); } - java.util.Map map = internalGetLabels().getMap(); - return map.containsKey(key) ? map.get(key) : defaultValue; } + /** * * *
    -     * See [Creating and managing labels]
    -     * (https://cloud.google.com/pubsub/docs/labels).
    +     * Optional. Settings for ingestion from a data source into this topic.
          * 
    * - * map<string, string> labels = 2; + * + * .google.pubsub.v1.IngestionDataSourceSettings ingestion_data_source_settings = 10 [(.google.api.field_behavior) = OPTIONAL]; + * */ - @java.lang.Override - public java.lang.String getLabelsOrThrow(java.lang.String key) { - if (key == null) { - throw new java.lang.NullPointerException(); - } - java.util.Map map = internalGetLabels().getMap(); - if (!map.containsKey(key)) { - throw new java.lang.IllegalArgumentException(); + public Builder setIngestionDataSourceSettings( + com.google.pubsub.v1.IngestionDataSourceSettings value) { + if (ingestionDataSourceSettingsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ingestionDataSourceSettings_ = value; + } else { + ingestionDataSourceSettingsBuilder_.setMessage(value); } - return map.get(key); - } - - public Builder clearLabels() { - internalGetMutableLabels().getMutableMap().clear(); + bitField0_ |= 0x00000100; + onChanged(); return this; } + /** * * *
    -     * See [Creating and managing labels]
    -     * (https://cloud.google.com/pubsub/docs/labels).
    +     * Optional. Settings for ingestion from a data source into this topic.
          * 
    * - * map<string, string> labels = 2; + * + * .google.pubsub.v1.IngestionDataSourceSettings ingestion_data_source_settings = 10 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public Builder removeLabels(java.lang.String key) { - if (key == null) { - throw new java.lang.NullPointerException(); + public Builder setIngestionDataSourceSettings( + com.google.pubsub.v1.IngestionDataSourceSettings.Builder builderForValue) { + if (ingestionDataSourceSettingsBuilder_ == null) { + ingestionDataSourceSettings_ = builderForValue.build(); + } else { + ingestionDataSourceSettingsBuilder_.setMessage(builderForValue.build()); } - internalGetMutableLabels().getMutableMap().remove(key); + bitField0_ |= 0x00000100; + onChanged(); return this; } - /** Use alternate mutation accessors instead. */ - @java.lang.Deprecated - public java.util.Map getMutableLabels() { - return internalGetMutableLabels().getMutableMap(); - } + /** * * *
    -     * See [Creating and managing labels]
    -     * (https://cloud.google.com/pubsub/docs/labels).
    +     * Optional. Settings for ingestion from a data source into this topic.
          * 
    * - * map<string, string> labels = 2; + * + * .google.pubsub.v1.IngestionDataSourceSettings ingestion_data_source_settings = 10 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public Builder putLabels(java.lang.String key, java.lang.String value) { - if (key == null) { - throw new java.lang.NullPointerException(); + public Builder mergeIngestionDataSourceSettings( + com.google.pubsub.v1.IngestionDataSourceSettings value) { + if (ingestionDataSourceSettingsBuilder_ == null) { + if (((bitField0_ & 0x00000100) != 0) + && ingestionDataSourceSettings_ != null + && ingestionDataSourceSettings_ + != com.google.pubsub.v1.IngestionDataSourceSettings.getDefaultInstance()) { + getIngestionDataSourceSettingsBuilder().mergeFrom(value); + } else { + ingestionDataSourceSettings_ = value; + } + } else { + ingestionDataSourceSettingsBuilder_.mergeFrom(value); } - if (value == null) { - throw new java.lang.NullPointerException(); + if (ingestionDataSourceSettings_ != null) { + bitField0_ |= 0x00000100; + onChanged(); } - internalGetMutableLabels().getMutableMap().put(key, value); return this; } + /** * * *
    -     * See [Creating and managing labels]
    -     * (https://cloud.google.com/pubsub/docs/labels).
    +     * Optional. Settings for ingestion from a data source into this topic.
          * 
    * - * map<string, string> labels = 2; + * + * .google.pubsub.v1.IngestionDataSourceSettings ingestion_data_source_settings = 10 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public Builder putAllLabels(java.util.Map values) { - internalGetMutableLabels().getMutableMap().putAll(values); + public Builder clearIngestionDataSourceSettings() { + bitField0_ = (bitField0_ & ~0x00000100); + ingestionDataSourceSettings_ = null; + if (ingestionDataSourceSettingsBuilder_ != null) { + ingestionDataSourceSettingsBuilder_.dispose(); + ingestionDataSourceSettingsBuilder_ = null; + } + onChanged(); return this; } - private com.google.pubsub.v1.MessageStoragePolicy messageStoragePolicy_; - private com.google.protobuf.SingleFieldBuilderV3< - com.google.pubsub.v1.MessageStoragePolicy, - com.google.pubsub.v1.MessageStoragePolicy.Builder, - com.google.pubsub.v1.MessageStoragePolicyOrBuilder> - messageStoragePolicyBuilder_; /** * * *
    -     * Policy constraining the set of Google Cloud Platform regions where messages
    -     * published to the topic may be stored. If not present, then no constraints
    -     * are in effect.
    +     * Optional. Settings for ingestion from a data source into this topic.
          * 
    * - * .google.pubsub.v1.MessageStoragePolicy message_storage_policy = 3; + * + * .google.pubsub.v1.IngestionDataSourceSettings ingestion_data_source_settings = 10 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.pubsub.v1.IngestionDataSourceSettings.Builder + getIngestionDataSourceSettingsBuilder() { + bitField0_ |= 0x00000100; + onChanged(); + return internalGetIngestionDataSourceSettingsFieldBuilder().getBuilder(); + } + + /** + * * - * @return Whether the messageStoragePolicy field is set. + *
    +     * Optional. Settings for ingestion from a data source into this topic.
    +     * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings ingestion_data_source_settings = 10 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public boolean hasMessageStoragePolicy() { - return messageStoragePolicyBuilder_ != null || messageStoragePolicy_ != null; + public com.google.pubsub.v1.IngestionDataSourceSettingsOrBuilder + getIngestionDataSourceSettingsOrBuilder() { + if (ingestionDataSourceSettingsBuilder_ != null) { + return ingestionDataSourceSettingsBuilder_.getMessageOrBuilder(); + } else { + return ingestionDataSourceSettings_ == null + ? com.google.pubsub.v1.IngestionDataSourceSettings.getDefaultInstance() + : ingestionDataSourceSettings_; + } } + /** * * *
    -     * Policy constraining the set of Google Cloud Platform regions where messages
    -     * published to the topic may be stored. If not present, then no constraints
    -     * are in effect.
    +     * Optional. Settings for ingestion from a data source into this topic.
          * 
    * - * .google.pubsub.v1.MessageStoragePolicy message_storage_policy = 3; + * + * .google.pubsub.v1.IngestionDataSourceSettings ingestion_data_source_settings = 10 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionDataSourceSettings, + com.google.pubsub.v1.IngestionDataSourceSettings.Builder, + com.google.pubsub.v1.IngestionDataSourceSettingsOrBuilder> + internalGetIngestionDataSourceSettingsFieldBuilder() { + if (ingestionDataSourceSettingsBuilder_ == null) { + ingestionDataSourceSettingsBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + com.google.pubsub.v1.IngestionDataSourceSettings, + com.google.pubsub.v1.IngestionDataSourceSettings.Builder, + com.google.pubsub.v1.IngestionDataSourceSettingsOrBuilder>( + getIngestionDataSourceSettings(), getParentForChildren(), isClean()); + ingestionDataSourceSettings_ = null; + } + return ingestionDataSourceSettingsBuilder_; + } + + private java.util.List messageTransforms_ = + java.util.Collections.emptyList(); + + private void ensureMessageTransformsIsMutable() { + if (!((bitField0_ & 0x00000200) != 0)) { + messageTransforms_ = + new java.util.ArrayList(messageTransforms_); + bitField0_ |= 0x00000200; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + com.google.pubsub.v1.MessageTransform, + com.google.pubsub.v1.MessageTransform.Builder, + com.google.pubsub.v1.MessageTransformOrBuilder> + messageTransformsBuilder_; + + /** + * * - * @return The messageStoragePolicy. + *
    +     * Optional. Transforms to be applied to messages published to the topic.
    +     * Transforms are applied in the order specified.
    +     * 
    + * + * + * repeated .google.pubsub.v1.MessageTransform message_transforms = 13 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public com.google.pubsub.v1.MessageStoragePolicy getMessageStoragePolicy() { - if (messageStoragePolicyBuilder_ == null) { - return messageStoragePolicy_ == null - ? com.google.pubsub.v1.MessageStoragePolicy.getDefaultInstance() - : messageStoragePolicy_; + public java.util.List getMessageTransformsList() { + if (messageTransformsBuilder_ == null) { + return java.util.Collections.unmodifiableList(messageTransforms_); } else { - return messageStoragePolicyBuilder_.getMessage(); + return messageTransformsBuilder_.getMessageList(); } } + /** * * *
    -     * Policy constraining the set of Google Cloud Platform regions where messages
    -     * published to the topic may be stored. If not present, then no constraints
    -     * are in effect.
    +     * Optional. Transforms to be applied to messages published to the topic.
    +     * Transforms are applied in the order specified.
          * 
    * - * .google.pubsub.v1.MessageStoragePolicy message_storage_policy = 3; + * + * repeated .google.pubsub.v1.MessageTransform message_transforms = 13 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public Builder setMessageStoragePolicy(com.google.pubsub.v1.MessageStoragePolicy value) { - if (messageStoragePolicyBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - messageStoragePolicy_ = value; - onChanged(); + public int getMessageTransformsCount() { + if (messageTransformsBuilder_ == null) { + return messageTransforms_.size(); } else { - messageStoragePolicyBuilder_.setMessage(value); + return messageTransformsBuilder_.getCount(); } - - return this; } + /** * * *
    -     * Policy constraining the set of Google Cloud Platform regions where messages
    -     * published to the topic may be stored. If not present, then no constraints
    -     * are in effect.
    +     * Optional. Transforms to be applied to messages published to the topic.
    +     * Transforms are applied in the order specified.
          * 
    * - * .google.pubsub.v1.MessageStoragePolicy message_storage_policy = 3; + * + * repeated .google.pubsub.v1.MessageTransform message_transforms = 13 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public Builder setMessageStoragePolicy( - com.google.pubsub.v1.MessageStoragePolicy.Builder builderForValue) { - if (messageStoragePolicyBuilder_ == null) { - messageStoragePolicy_ = builderForValue.build(); - onChanged(); + public com.google.pubsub.v1.MessageTransform getMessageTransforms(int index) { + if (messageTransformsBuilder_ == null) { + return messageTransforms_.get(index); } else { - messageStoragePolicyBuilder_.setMessage(builderForValue.build()); + return messageTransformsBuilder_.getMessage(index); } - - return this; } + /** * * *
    -     * Policy constraining the set of Google Cloud Platform regions where messages
    -     * published to the topic may be stored. If not present, then no constraints
    -     * are in effect.
    +     * Optional. Transforms to be applied to messages published to the topic.
    +     * Transforms are applied in the order specified.
          * 
    * - * .google.pubsub.v1.MessageStoragePolicy message_storage_policy = 3; + * + * repeated .google.pubsub.v1.MessageTransform message_transforms = 13 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public Builder mergeMessageStoragePolicy(com.google.pubsub.v1.MessageStoragePolicy value) { - if (messageStoragePolicyBuilder_ == null) { - if (messageStoragePolicy_ != null) { - messageStoragePolicy_ = - com.google.pubsub.v1.MessageStoragePolicy.newBuilder(messageStoragePolicy_) - .mergeFrom(value) - .buildPartial(); - } else { - messageStoragePolicy_ = value; + public Builder setMessageTransforms(int index, com.google.pubsub.v1.MessageTransform value) { + if (messageTransformsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); } + ensureMessageTransformsIsMutable(); + messageTransforms_.set(index, value); onChanged(); } else { - messageStoragePolicyBuilder_.mergeFrom(value); + messageTransformsBuilder_.setMessage(index, value); } - return this; } + /** * * *
    -     * Policy constraining the set of Google Cloud Platform regions where messages
    -     * published to the topic may be stored. If not present, then no constraints
    -     * are in effect.
    +     * Optional. Transforms to be applied to messages published to the topic.
    +     * Transforms are applied in the order specified.
          * 
    * - * .google.pubsub.v1.MessageStoragePolicy message_storage_policy = 3; + * + * repeated .google.pubsub.v1.MessageTransform message_transforms = 13 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public Builder clearMessageStoragePolicy() { - if (messageStoragePolicyBuilder_ == null) { - messageStoragePolicy_ = null; + public Builder setMessageTransforms( + int index, com.google.pubsub.v1.MessageTransform.Builder builderForValue) { + if (messageTransformsBuilder_ == null) { + ensureMessageTransformsIsMutable(); + messageTransforms_.set(index, builderForValue.build()); onChanged(); } else { - messageStoragePolicy_ = null; - messageStoragePolicyBuilder_ = null; + messageTransformsBuilder_.setMessage(index, builderForValue.build()); } - return this; } + /** * * *
    -     * Policy constraining the set of Google Cloud Platform regions where messages
    -     * published to the topic may be stored. If not present, then no constraints
    -     * are in effect.
    +     * Optional. Transforms to be applied to messages published to the topic.
    +     * Transforms are applied in the order specified.
          * 
    * - * .google.pubsub.v1.MessageStoragePolicy message_storage_policy = 3; + * + * repeated .google.pubsub.v1.MessageTransform message_transforms = 13 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public com.google.pubsub.v1.MessageStoragePolicy.Builder getMessageStoragePolicyBuilder() { - - onChanged(); - return getMessageStoragePolicyFieldBuilder().getBuilder(); + public Builder addMessageTransforms(com.google.pubsub.v1.MessageTransform value) { + if (messageTransformsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureMessageTransformsIsMutable(); + messageTransforms_.add(value); + onChanged(); + } else { + messageTransformsBuilder_.addMessage(value); + } + return this; } + /** * * *
    -     * Policy constraining the set of Google Cloud Platform regions where messages
    -     * published to the topic may be stored. If not present, then no constraints
    -     * are in effect.
    +     * Optional. Transforms to be applied to messages published to the topic.
    +     * Transforms are applied in the order specified.
          * 
    * - * .google.pubsub.v1.MessageStoragePolicy message_storage_policy = 3; + * + * repeated .google.pubsub.v1.MessageTransform message_transforms = 13 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public com.google.pubsub.v1.MessageStoragePolicyOrBuilder getMessageStoragePolicyOrBuilder() { - if (messageStoragePolicyBuilder_ != null) { - return messageStoragePolicyBuilder_.getMessageOrBuilder(); + public Builder addMessageTransforms(int index, com.google.pubsub.v1.MessageTransform value) { + if (messageTransformsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureMessageTransformsIsMutable(); + messageTransforms_.add(index, value); + onChanged(); } else { - return messageStoragePolicy_ == null - ? com.google.pubsub.v1.MessageStoragePolicy.getDefaultInstance() - : messageStoragePolicy_; + messageTransformsBuilder_.addMessage(index, value); } + return this; } + /** * * *
    -     * Policy constraining the set of Google Cloud Platform regions where messages
    -     * published to the topic may be stored. If not present, then no constraints
    -     * are in effect.
    +     * Optional. Transforms to be applied to messages published to the topic.
    +     * Transforms are applied in the order specified.
          * 
    * - * .google.pubsub.v1.MessageStoragePolicy message_storage_policy = 3; + * + * repeated .google.pubsub.v1.MessageTransform message_transforms = 13 [(.google.api.field_behavior) = OPTIONAL]; + * */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.pubsub.v1.MessageStoragePolicy, - com.google.pubsub.v1.MessageStoragePolicy.Builder, - com.google.pubsub.v1.MessageStoragePolicyOrBuilder> - getMessageStoragePolicyFieldBuilder() { - if (messageStoragePolicyBuilder_ == null) { - messageStoragePolicyBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - com.google.pubsub.v1.MessageStoragePolicy, - com.google.pubsub.v1.MessageStoragePolicy.Builder, - com.google.pubsub.v1.MessageStoragePolicyOrBuilder>( - getMessageStoragePolicy(), getParentForChildren(), isClean()); - messageStoragePolicy_ = null; + public Builder addMessageTransforms( + com.google.pubsub.v1.MessageTransform.Builder builderForValue) { + if (messageTransformsBuilder_ == null) { + ensureMessageTransformsIsMutable(); + messageTransforms_.add(builderForValue.build()); + onChanged(); + } else { + messageTransformsBuilder_.addMessage(builderForValue.build()); } - return messageStoragePolicyBuilder_; + return this; } - private java.lang.Object kmsKeyName_ = ""; /** * * *
    -     * The resource name of the Cloud KMS CryptoKey to be used to protect access
    -     * to messages published on this topic.
    -     * The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
    +     * Optional. Transforms to be applied to messages published to the topic.
    +     * Transforms are applied in the order specified.
          * 
    * - * string kms_key_name = 5; - * - * @return The kmsKeyName. + * + * repeated .google.pubsub.v1.MessageTransform message_transforms = 13 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public java.lang.String getKmsKeyName() { - java.lang.Object ref = kmsKeyName_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - kmsKeyName_ = s; - return s; + public Builder addMessageTransforms( + int index, com.google.pubsub.v1.MessageTransform.Builder builderForValue) { + if (messageTransformsBuilder_ == null) { + ensureMessageTransformsIsMutable(); + messageTransforms_.add(index, builderForValue.build()); + onChanged(); } else { - return (java.lang.String) ref; + messageTransformsBuilder_.addMessage(index, builderForValue.build()); } + return this; } + /** * * *
    -     * The resource name of the Cloud KMS CryptoKey to be used to protect access
    -     * to messages published on this topic.
    -     * The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
    +     * Optional. Transforms to be applied to messages published to the topic.
    +     * Transforms are applied in the order specified.
          * 
    * - * string kms_key_name = 5; - * - * @return The bytes for kmsKeyName. + * + * repeated .google.pubsub.v1.MessageTransform message_transforms = 13 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public com.google.protobuf.ByteString getKmsKeyNameBytes() { - java.lang.Object ref = kmsKeyName_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - kmsKeyName_ = b; - return b; + public Builder addAllMessageTransforms( + java.lang.Iterable values) { + if (messageTransformsBuilder_ == null) { + ensureMessageTransformsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, messageTransforms_); + onChanged(); } else { - return (com.google.protobuf.ByteString) ref; + messageTransformsBuilder_.addAllMessages(values); } + return this; } + /** * * *
    -     * The resource name of the Cloud KMS CryptoKey to be used to protect access
    -     * to messages published on this topic.
    -     * The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
    +     * Optional. Transforms to be applied to messages published to the topic.
    +     * Transforms are applied in the order specified.
          * 
    * - * string kms_key_name = 5; - * - * @param value The kmsKeyName to set. - * @return This builder for chaining. + * + * repeated .google.pubsub.v1.MessageTransform message_transforms = 13 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public Builder setKmsKeyName(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); + public Builder clearMessageTransforms() { + if (messageTransformsBuilder_ == null) { + messageTransforms_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000200); + onChanged(); + } else { + messageTransformsBuilder_.clear(); } - - kmsKeyName_ = value; - onChanged(); return this; } + /** * * *
    -     * The resource name of the Cloud KMS CryptoKey to be used to protect access
    -     * to messages published on this topic.
    -     * The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
    +     * Optional. Transforms to be applied to messages published to the topic.
    +     * Transforms are applied in the order specified.
          * 
    * - * string kms_key_name = 5; - * - * @return This builder for chaining. + * + * repeated .google.pubsub.v1.MessageTransform message_transforms = 13 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public Builder clearKmsKeyName() { - - kmsKeyName_ = getDefaultInstance().getKmsKeyName(); - onChanged(); + public Builder removeMessageTransforms(int index) { + if (messageTransformsBuilder_ == null) { + ensureMessageTransformsIsMutable(); + messageTransforms_.remove(index); + onChanged(); + } else { + messageTransformsBuilder_.remove(index); + } return this; } + /** * * *
    -     * The resource name of the Cloud KMS CryptoKey to be used to protect access
    -     * to messages published on this topic.
    -     * The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
    +     * Optional. Transforms to be applied to messages published to the topic.
    +     * Transforms are applied in the order specified.
          * 
    * - * string kms_key_name = 5; - * - * @param value The bytes for kmsKeyName to set. - * @return This builder for chaining. + * + * repeated .google.pubsub.v1.MessageTransform message_transforms = 13 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public Builder setKmsKeyNameBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - kmsKeyName_ = value; - onChanged(); - return this; + public com.google.pubsub.v1.MessageTransform.Builder getMessageTransformsBuilder(int index) { + return internalGetMessageTransformsFieldBuilder().getBuilder(index); } - private com.google.pubsub.v1.SchemaSettings schemaSettings_; - private com.google.protobuf.SingleFieldBuilderV3< - com.google.pubsub.v1.SchemaSettings, - com.google.pubsub.v1.SchemaSettings.Builder, - com.google.pubsub.v1.SchemaSettingsOrBuilder> - schemaSettingsBuilder_; /** * * *
    -     * Settings for validating messages published against a schema.
    -     * EXPERIMENTAL: Schema support is in development and may not work yet.
    +     * Optional. Transforms to be applied to messages published to the topic.
    +     * Transforms are applied in the order specified.
          * 
    * - * .google.pubsub.v1.SchemaSettings schema_settings = 6; - * - * @return Whether the schemaSettings field is set. + * + * repeated .google.pubsub.v1.MessageTransform message_transforms = 13 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public boolean hasSchemaSettings() { - return schemaSettingsBuilder_ != null || schemaSettings_ != null; + public com.google.pubsub.v1.MessageTransformOrBuilder getMessageTransformsOrBuilder(int index) { + if (messageTransformsBuilder_ == null) { + return messageTransforms_.get(index); + } else { + return messageTransformsBuilder_.getMessageOrBuilder(index); + } } + /** * * *
    -     * Settings for validating messages published against a schema.
    -     * EXPERIMENTAL: Schema support is in development and may not work yet.
    +     * Optional. Transforms to be applied to messages published to the topic.
    +     * Transforms are applied in the order specified.
          * 
    * - * .google.pubsub.v1.SchemaSettings schema_settings = 6; - * - * @return The schemaSettings. + * + * repeated .google.pubsub.v1.MessageTransform message_transforms = 13 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public com.google.pubsub.v1.SchemaSettings getSchemaSettings() { - if (schemaSettingsBuilder_ == null) { - return schemaSettings_ == null - ? com.google.pubsub.v1.SchemaSettings.getDefaultInstance() - : schemaSettings_; + public java.util.List + getMessageTransformsOrBuilderList() { + if (messageTransformsBuilder_ != null) { + return messageTransformsBuilder_.getMessageOrBuilderList(); } else { - return schemaSettingsBuilder_.getMessage(); + return java.util.Collections.unmodifiableList(messageTransforms_); } } + /** * * *
    -     * Settings for validating messages published against a schema.
    -     * EXPERIMENTAL: Schema support is in development and may not work yet.
    +     * Optional. Transforms to be applied to messages published to the topic.
    +     * Transforms are applied in the order specified.
          * 
    * - * .google.pubsub.v1.SchemaSettings schema_settings = 6; + * + * repeated .google.pubsub.v1.MessageTransform message_transforms = 13 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public Builder setSchemaSettings(com.google.pubsub.v1.SchemaSettings value) { - if (schemaSettingsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - schemaSettings_ = value; - onChanged(); - } else { - schemaSettingsBuilder_.setMessage(value); - } - - return this; + public com.google.pubsub.v1.MessageTransform.Builder addMessageTransformsBuilder() { + return internalGetMessageTransformsFieldBuilder() + .addBuilder(com.google.pubsub.v1.MessageTransform.getDefaultInstance()); } + /** * * *
    -     * Settings for validating messages published against a schema.
    -     * EXPERIMENTAL: Schema support is in development and may not work yet.
    +     * Optional. Transforms to be applied to messages published to the topic.
    +     * Transforms are applied in the order specified.
          * 
    * - * .google.pubsub.v1.SchemaSettings schema_settings = 6; + * + * repeated .google.pubsub.v1.MessageTransform message_transforms = 13 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public Builder setSchemaSettings(com.google.pubsub.v1.SchemaSettings.Builder builderForValue) { - if (schemaSettingsBuilder_ == null) { - schemaSettings_ = builderForValue.build(); - onChanged(); - } else { - schemaSettingsBuilder_.setMessage(builderForValue.build()); - } - - return this; + public com.google.pubsub.v1.MessageTransform.Builder addMessageTransformsBuilder(int index) { + return internalGetMessageTransformsFieldBuilder() + .addBuilder(index, com.google.pubsub.v1.MessageTransform.getDefaultInstance()); } + /** * * *
    -     * Settings for validating messages published against a schema.
    -     * EXPERIMENTAL: Schema support is in development and may not work yet.
    +     * Optional. Transforms to be applied to messages published to the topic.
    +     * Transforms are applied in the order specified.
          * 
    * - * .google.pubsub.v1.SchemaSettings schema_settings = 6; + * + * repeated .google.pubsub.v1.MessageTransform message_transforms = 13 [(.google.api.field_behavior) = OPTIONAL]; + * */ - public Builder mergeSchemaSettings(com.google.pubsub.v1.SchemaSettings value) { - if (schemaSettingsBuilder_ == null) { - if (schemaSettings_ != null) { - schemaSettings_ = - com.google.pubsub.v1.SchemaSettings.newBuilder(schemaSettings_) - .mergeFrom(value) - .buildPartial(); - } else { - schemaSettings_ = value; - } - onChanged(); - } else { - schemaSettingsBuilder_.mergeFrom(value); + public java.util.List + getMessageTransformsBuilderList() { + return internalGetMessageTransformsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilder< + com.google.pubsub.v1.MessageTransform, + com.google.pubsub.v1.MessageTransform.Builder, + com.google.pubsub.v1.MessageTransformOrBuilder> + internalGetMessageTransformsFieldBuilder() { + if (messageTransformsBuilder_ == null) { + messageTransformsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilder< + com.google.pubsub.v1.MessageTransform, + com.google.pubsub.v1.MessageTransform.Builder, + com.google.pubsub.v1.MessageTransformOrBuilder>( + messageTransforms_, + ((bitField0_ & 0x00000200) != 0), + getParentForChildren(), + isClean()); + messageTransforms_ = null; } + return messageTransformsBuilder_; + } - 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_ |= 0x00000400; + onChanged(); + return tags_; + } + + public int getTagsCount() { + return internalGetTags().getMap().size(); } + /** * * *
    -     * Settings for validating messages published against a schema.
    -     * EXPERIMENTAL: Schema support is in development and may not work yet.
    +     * Optional. Input only. Immutable. Tag keys/values directly bound to this
    +     * resource. For example:
    +     * "123/environment": "production",
    +     * "123/costCenter": "marketing"
    +     * See https://docs.cloud.google.com/pubsub/docs/tags for more information on
    +     * using tags with Pub/Sub resources.
          * 
    * - * .google.pubsub.v1.SchemaSettings schema_settings = 6; + * + * map<string, string> tags = 14 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * */ - public Builder clearSchemaSettings() { - if (schemaSettingsBuilder_ == null) { - schemaSettings_ = null; - onChanged(); - } else { - schemaSettings_ = null; - schemaSettingsBuilder_ = null; + @java.lang.Override + public boolean containsTags(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); } + return internalGetTags().getMap().containsKey(key); + } - return this; + /** Use {@link #getTagsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getTags() { + return getTagsMap(); } + /** * * *
    -     * Settings for validating messages published against a schema.
    -     * EXPERIMENTAL: Schema support is in development and may not work yet.
    +     * Optional. Input only. Immutable. Tag keys/values directly bound to this
    +     * resource. For example:
    +     * "123/environment": "production",
    +     * "123/costCenter": "marketing"
    +     * See https://docs.cloud.google.com/pubsub/docs/tags for more information on
    +     * using tags with Pub/Sub resources.
          * 
    * - * .google.pubsub.v1.SchemaSettings schema_settings = 6; + * + * map<string, string> tags = 14 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * */ - public com.google.pubsub.v1.SchemaSettings.Builder getSchemaSettingsBuilder() { - - onChanged(); - return getSchemaSettingsFieldBuilder().getBuilder(); + @java.lang.Override + public java.util.Map getTagsMap() { + return internalGetTags().getMap(); } + /** * * *
    -     * Settings for validating messages published against a schema.
    -     * EXPERIMENTAL: Schema support is in development and may not work yet.
    +     * Optional. Input only. Immutable. Tag keys/values directly bound to this
    +     * resource. For example:
    +     * "123/environment": "production",
    +     * "123/costCenter": "marketing"
    +     * See https://docs.cloud.google.com/pubsub/docs/tags for more information on
    +     * using tags with Pub/Sub resources.
          * 
    * - * .google.pubsub.v1.SchemaSettings schema_settings = 6; + * + * map<string, string> tags = 14 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * */ - public com.google.pubsub.v1.SchemaSettingsOrBuilder getSchemaSettingsOrBuilder() { - if (schemaSettingsBuilder_ != null) { - return schemaSettingsBuilder_.getMessageOrBuilder(); - } else { - return schemaSettings_ == null - ? com.google.pubsub.v1.SchemaSettings.getDefaultInstance() - : schemaSettings_; + @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; } + /** * * *
    -     * Settings for validating messages published against a schema.
    -     * EXPERIMENTAL: Schema support is in development and may not work yet.
    +     * Optional. Input only. Immutable. Tag keys/values directly bound to this
    +     * resource. For example:
    +     * "123/environment": "production",
    +     * "123/costCenter": "marketing"
    +     * See https://docs.cloud.google.com/pubsub/docs/tags for more information on
    +     * using tags with Pub/Sub resources.
          * 
    * - * .google.pubsub.v1.SchemaSettings schema_settings = 6; + * + * map<string, string> tags = 14 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.pubsub.v1.SchemaSettings, - com.google.pubsub.v1.SchemaSettings.Builder, - com.google.pubsub.v1.SchemaSettingsOrBuilder> - getSchemaSettingsFieldBuilder() { - if (schemaSettingsBuilder_ == null) { - schemaSettingsBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - com.google.pubsub.v1.SchemaSettings, - com.google.pubsub.v1.SchemaSettings.Builder, - com.google.pubsub.v1.SchemaSettingsOrBuilder>( - getSchemaSettings(), getParentForChildren(), isClean()); - schemaSettings_ = null; + @java.lang.Override + public java.lang.String getTagsOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); } - return schemaSettingsBuilder_; + 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; } - private boolean satisfiesPzs_; /** * * *
    -     * Reserved for future use. This field is set only in responses from the
    -     * server; it is ignored if it is set in any requests.
    +     * Optional. Input only. Immutable. Tag keys/values directly bound to this
    +     * resource. For example:
    +     * "123/environment": "production",
    +     * "123/costCenter": "marketing"
    +     * See https://docs.cloud.google.com/pubsub/docs/tags for more information on
    +     * using tags with Pub/Sub resources.
          * 
    * - * bool satisfies_pzs = 7; - * - * @return The satisfiesPzs. + * + * 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 getSatisfiesPzs() { - return satisfiesPzs_; + 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(); } + /** * * *
    -     * Reserved for future use. This field is set only in responses from the
    -     * server; it is ignored if it is set in any requests.
    +     * Optional. Input only. Immutable. Tag keys/values directly bound to this
    +     * resource. For example:
    +     * "123/environment": "production",
    +     * "123/costCenter": "marketing"
    +     * See https://docs.cloud.google.com/pubsub/docs/tags for more information on
    +     * using tags with Pub/Sub resources.
          * 
    * - * bool satisfies_pzs = 7; - * - * @param value The satisfiesPzs to set. - * @return This builder for chaining. + * + * map<string, string> tags = 14 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * */ - public Builder setSatisfiesPzs(boolean value) { - - satisfiesPzs_ = value; - onChanged(); + 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; } + /** * * *
    -     * Reserved for future use. This field is set only in responses from the
    -     * server; it is ignored if it is set in any requests.
    +     * Optional. Input only. Immutable. Tag keys/values directly bound to this
    +     * resource. For example:
    +     * "123/environment": "production",
    +     * "123/costCenter": "marketing"
    +     * See https://docs.cloud.google.com/pubsub/docs/tags for more information on
    +     * using tags with Pub/Sub resources.
          * 
    * - * bool satisfies_pzs = 7; - * - * @return This builder for chaining. + * + * map<string, string> tags = 14 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * */ - public Builder clearSatisfiesPzs() { - - satisfiesPzs_ = false; - onChanged(); + 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); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - // @@protoc_insertion_point(builder_scope:google.pubsub.v1.Topic) } @@ -1855,7 +3987,18 @@ public Topic parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new Topic(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/TopicName.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/TopicName.java index 14d871ac5..0a21c87d8 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/TopicName.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/TopicName.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 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 + * 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, @@ -16,58 +16,60 @@ package com.google.pubsub.v1; -import com.google.api.core.BetaApi; import com.google.api.pathtemplate.PathTemplate; import com.google.api.pathtemplate.ValidationException; 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 */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class TopicName implements ResourceName { - - @Deprecated - protected TopicName() {} - - private static final PathTemplate PROJECT_TOPIC_PATH_TEMPLATE = + private static final PathTemplate PROJECT_TOPIC = PathTemplate.createWithoutUrlEncoding("projects/{project}/topics/{topic}"); - private static final String DELETED_TOPIC_FIXED_VALUE = "_deleted-topic_"; - private static final TopicName DELETED_TOPIC_INSTANCE = new TopicName("_deleted-topic_"); - + private static final String DELETED_TOPIC = "_deleted-topic_"; private volatile Map fieldValuesMap; private PathTemplate pathTemplate; private String fixedValue; + private final String project; + private final String topic; - private String project; - private String topic; - - public String getProject() { - return project; - } - - public String getTopic() { - return topic; + @Deprecated + protected TopicName() { + project = null; + topic = null; } private TopicName(Builder builder) { project = Preconditions.checkNotNull(builder.getProject()); topic = Preconditions.checkNotNull(builder.getTopic()); - pathTemplate = PROJECT_TOPIC_PATH_TEMPLATE; + pathTemplate = PROJECT_TOPIC; } private TopicName(String fixedValue) { this.fixedValue = fixedValue; fieldValuesMap = ImmutableMap.of("", fixedValue); + project = null; + topic = null; + } + + public String getProject() { + return project; + } + + public String getTopic() { + return topic; } public static Builder newBuilder() { return new Builder(); } - @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") public static Builder newProjectTopicBuilder() { return new Builder(); } @@ -77,49 +79,64 @@ public Builder toBuilder() { } public static TopicName of(String project, String topic) { - return newProjectTopicBuilder().setProject(project).setTopic(topic).build(); + return newBuilder().setProject(project).setTopic(topic).build(); } - @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static TopicName ofProjectTopicName(String project, String topic) { - return newProjectTopicBuilder().setProject(project).setTopic(topic).build(); + return newBuilder().setProject(project).setTopic(topic).build(); } - @BetaApi("The static create methods are not stable yet and may be changed in the future.") public static TopicName ofDeletedTopicName() { - return DELETED_TOPIC_INSTANCE; + return new TopicName("_deleted-topic_"); } public static String format(String project, String topic) { return newBuilder().setProject(project).setTopic(topic).build().toString(); } - @BetaApi("The static format methods are not stable yet and may be changed in the future.") public static String formatProjectTopicName(String project, String topic) { return newBuilder().setProject(project).setTopic(topic).build().toString(); } - @BetaApi("The static format methods are not stable yet and may be changed in the future.") public static String formatDeletedTopicName() { - return DELETED_TOPIC_FIXED_VALUE; + return "_deleted-topic_"; } public static TopicName parse(String formattedString) { if (formattedString.isEmpty()) { return null; } - if (PROJECT_TOPIC_PATH_TEMPLATE.matches(formattedString)) { - Map matchMap = PROJECT_TOPIC_PATH_TEMPLATE.match(formattedString); + if (PROJECT_TOPIC.matches(formattedString)) { + Map matchMap = PROJECT_TOPIC.match(formattedString); return ofProjectTopicName(matchMap.get("project"), matchMap.get("topic")); - } else if (DELETED_TOPIC_FIXED_VALUE.equals(formattedString)) { - return DELETED_TOPIC_INSTANCE; + } else if (DELETED_TOPIC.equals(formattedString)) { + return new TopicName("_deleted-topic_"); } - throw new ValidationException("JobName.parse: formattedString not in valid format"); + throw new ValidationException("TopicName.parse: formattedString not in valid format"); + } + + 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 (TopicName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; } public static boolean isParsableFrom(String formattedString) { - return PROJECT_TOPIC_PATH_TEMPLATE.matches(formattedString) - || DELETED_TOPIC_FIXED_VALUE.equals(formattedString); + return PROJECT_TOPIC.matches(formattedString) || DELETED_TOPIC.equals(formattedString); } @Override @@ -150,9 +167,30 @@ public String toString() { return fixedValue != null ? fixedValue : pathTemplate.instantiate(getFieldValuesMap()); } + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null && getClass() == o.getClass()) { + TopicName that = ((TopicName) o); + return Objects.equals(this.project, that.project) && Objects.equals(this.topic, that.topic); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(topic); + return h; + } + /** Builder for projects/{project}/topics/{topic}. */ public static class Builder { - private String project; private String topic; @@ -178,40 +216,15 @@ public Builder setTopic(String topic) { private Builder(TopicName topicName) { Preconditions.checkArgument( - topicName.pathTemplate == PROJECT_TOPIC_PATH_TEMPLATE, - "toBuilder is only supported when TopicName has the pattern of " - + "projects/{project}/topics/{topic}."); - project = topicName.project; - topic = topicName.topic; + Objects.equals(topicName.pathTemplate, PROJECT_TOPIC), + "toBuilder is only supported when TopicName has the pattern of" + + " projects/{project}/topics/{topic}"); + this.project = topicName.project; + this.topic = topicName.topic; } public TopicName build() { return new TopicName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o != null || getClass() == o.getClass()) { - TopicName that = (TopicName) o; - return (Objects.equals(this.project, that.project)) - && (Objects.equals(this.topic, that.topic)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= Objects.hashCode(fixedValue); - h *= 1000003; - h ^= Objects.hashCode(project); - h *= 1000003; - h ^= Objects.hashCode(topic); - return h; - } } 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 d7606f288..4d3334471 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 @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; +@com.google.protobuf.Generated public interface TopicOrBuilder extends // @@protoc_insertion_point(interface_extends:google.pubsub.v1.Topic) @@ -27,7 +30,7 @@ public interface TopicOrBuilder * * *
    -   * Required. The name of the topic. It must have the format
    +   * Required. Identifier. The name of the topic. It must have the format
        * `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter,
        * and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`),
        * underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent
    @@ -35,16 +38,19 @@ public interface TopicOrBuilder
        * must not start with `"goog"`.
        * 
    * - * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IDENTIFIER]; + * * * @return The name. */ java.lang.String getName(); + /** * * *
    -   * Required. The name of the topic. It must have the format
    +   * Required. Identifier. The name of the topic. It must have the format
        * `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter,
        * and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`),
        * underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent
    @@ -52,7 +58,9 @@ public interface TopicOrBuilder
        * must not start with `"goog"`.
        * 
    * - * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IDENTIFIER]; + * * * @return The bytes for name. */ @@ -62,58 +70,67 @@ public interface TopicOrBuilder * * *
    -   * See [Creating and managing labels]
    +   * Optional. See [Creating and managing labels]
        * (https://cloud.google.com/pubsub/docs/labels).
        * 
    * - * map<string, string> labels = 2; + * map<string, string> labels = 2 [(.google.api.field_behavior) = OPTIONAL]; */ int getLabelsCount(); + /** * * *
    -   * See [Creating and managing labels]
    +   * Optional. See [Creating and managing labels]
        * (https://cloud.google.com/pubsub/docs/labels).
        * 
    * - * map<string, string> labels = 2; + * map<string, string> labels = 2 [(.google.api.field_behavior) = OPTIONAL]; */ boolean containsLabels(java.lang.String key); + /** Use {@link #getLabelsMap()} instead. */ @java.lang.Deprecated java.util.Map getLabels(); + /** * * *
    -   * See [Creating and managing labels]
    +   * Optional. See [Creating and managing labels]
        * (https://cloud.google.com/pubsub/docs/labels).
        * 
    * - * map<string, string> labels = 2; + * map<string, string> labels = 2 [(.google.api.field_behavior) = OPTIONAL]; */ java.util.Map getLabelsMap(); + /** * * *
    -   * See [Creating and managing labels]
    +   * Optional. See [Creating and managing labels]
        * (https://cloud.google.com/pubsub/docs/labels).
        * 
    * - * map<string, string> labels = 2; + * map<string, string> labels = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - java.lang.String getLabelsOrDefault(java.lang.String key, java.lang.String defaultValue); + /* nullable */ + java.lang.String getLabelsOrDefault( + java.lang.String key, + /* nullable */ + java.lang.String defaultValue); + /** * * *
    -   * See [Creating and managing labels]
    +   * Optional. See [Creating and managing labels]
        * (https://cloud.google.com/pubsub/docs/labels).
        * 
    * - * map<string, string> labels = 2; + * map<string, string> labels = 2 [(.google.api.field_behavior) = OPTIONAL]; */ java.lang.String getLabelsOrThrow(java.lang.String key); @@ -121,40 +138,48 @@ public interface TopicOrBuilder * * *
    -   * Policy constraining the set of Google Cloud Platform regions where messages
    -   * published to the topic may be stored. If not present, then no constraints
    -   * are in effect.
    +   * Optional. Policy constraining the set of Google Cloud Platform regions
    +   * where messages published to the topic may be stored. If not present, then
    +   * no constraints are in effect.
        * 
    * - * .google.pubsub.v1.MessageStoragePolicy message_storage_policy = 3; + * + * .google.pubsub.v1.MessageStoragePolicy message_storage_policy = 3 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return Whether the messageStoragePolicy field is set. */ boolean hasMessageStoragePolicy(); + /** * * *
    -   * Policy constraining the set of Google Cloud Platform regions where messages
    -   * published to the topic may be stored. If not present, then no constraints
    -   * are in effect.
    +   * Optional. Policy constraining the set of Google Cloud Platform regions
    +   * where messages published to the topic may be stored. If not present, then
    +   * no constraints are in effect.
        * 
    * - * .google.pubsub.v1.MessageStoragePolicy message_storage_policy = 3; + * + * .google.pubsub.v1.MessageStoragePolicy message_storage_policy = 3 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return The messageStoragePolicy. */ com.google.pubsub.v1.MessageStoragePolicy getMessageStoragePolicy(); + /** * * *
    -   * Policy constraining the set of Google Cloud Platform regions where messages
    -   * published to the topic may be stored. If not present, then no constraints
    -   * are in effect.
    +   * Optional. Policy constraining the set of Google Cloud Platform regions
    +   * where messages published to the topic may be stored. If not present, then
    +   * no constraints are in effect.
        * 
    * - * .google.pubsub.v1.MessageStoragePolicy message_storage_policy = 3; + * + * .google.pubsub.v1.MessageStoragePolicy message_storage_policy = 3 [(.google.api.field_behavior) = OPTIONAL]; + * */ com.google.pubsub.v1.MessageStoragePolicyOrBuilder getMessageStoragePolicyOrBuilder(); @@ -162,26 +187,33 @@ public interface TopicOrBuilder * * *
    -   * The resource name of the Cloud KMS CryptoKey to be used to protect access
    -   * to messages published on this topic.
    +   * Optional. The resource name of the Cloud KMS CryptoKey to be used to
    +   * protect access to messages published on this topic.
    +   *
        * The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
        * 
    * - * string kms_key_name = 5; + * + * string kms_key_name = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return The kmsKeyName. */ java.lang.String getKmsKeyName(); + /** * * *
    -   * The resource name of the Cloud KMS CryptoKey to be used to protect access
    -   * to messages published on this topic.
    +   * Optional. The resource name of the Cloud KMS CryptoKey to be used to
    +   * protect access to messages published on this topic.
    +   *
        * The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
        * 
    * - * string kms_key_name = 5; + * + * string kms_key_name = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * * * @return The bytes for kmsKeyName. */ @@ -191,37 +223,42 @@ public interface TopicOrBuilder * * *
    -   * Settings for validating messages published against a schema.
    -   * EXPERIMENTAL: Schema support is in development and may not work yet.
    +   * Optional. Settings for validating messages published against a schema.
        * 
    * - * .google.pubsub.v1.SchemaSettings schema_settings = 6; + * + * .google.pubsub.v1.SchemaSettings schema_settings = 6 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return Whether the schemaSettings field is set. */ boolean hasSchemaSettings(); + /** * * *
    -   * Settings for validating messages published against a schema.
    -   * EXPERIMENTAL: Schema support is in development and may not work yet.
    +   * Optional. Settings for validating messages published against a schema.
        * 
    * - * .google.pubsub.v1.SchemaSettings schema_settings = 6; + * + * .google.pubsub.v1.SchemaSettings schema_settings = 6 [(.google.api.field_behavior) = OPTIONAL]; + * * * @return The schemaSettings. */ com.google.pubsub.v1.SchemaSettings getSchemaSettings(); + /** * * *
    -   * Settings for validating messages published against a schema.
    -   * EXPERIMENTAL: Schema support is in development and may not work yet.
    +   * Optional. Settings for validating messages published against a schema.
        * 
    * - * .google.pubsub.v1.SchemaSettings schema_settings = 6; + * + * .google.pubsub.v1.SchemaSettings schema_settings = 6 [(.google.api.field_behavior) = OPTIONAL]; + * */ com.google.pubsub.v1.SchemaSettingsOrBuilder getSchemaSettingsOrBuilder(); @@ -229,13 +266,321 @@ public interface TopicOrBuilder * * *
    -   * Reserved for future use. This field is set only in responses from the
    -   * server; it is ignored if it is set in any requests.
    +   * Optional. Reserved for future use. This field is set only in responses from
    +   * the server; it is ignored if it is set in any requests.
        * 
    * - * bool satisfies_pzs = 7; + * bool satisfies_pzs = 7 [(.google.api.field_behavior) = OPTIONAL]; * * @return The satisfiesPzs. */ boolean getSatisfiesPzs(); + + /** + * + * + *
    +   * Optional. Indicates the minimum duration to retain a message after it is
    +   * published to the topic. If this field is set, messages published to the
    +   * topic in the last `message_retention_duration` are always available to
    +   * subscribers. For instance, it allows any attached subscription to [seek to
    +   * a
    +   * timestamp](https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time)
    +   * that is up to `message_retention_duration` in the past. If this field is
    +   * not set, message retention is controlled by settings on individual
    +   * subscriptions. Cannot be more than 31 days or less than 10 minutes.
    +   * 
    + * + * + * .google.protobuf.Duration message_retention_duration = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the messageRetentionDuration field is set. + */ + boolean hasMessageRetentionDuration(); + + /** + * + * + *
    +   * Optional. Indicates the minimum duration to retain a message after it is
    +   * published to the topic. If this field is set, messages published to the
    +   * topic in the last `message_retention_duration` are always available to
    +   * subscribers. For instance, it allows any attached subscription to [seek to
    +   * a
    +   * timestamp](https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time)
    +   * that is up to `message_retention_duration` in the past. If this field is
    +   * not set, message retention is controlled by settings on individual
    +   * subscriptions. Cannot be more than 31 days or less than 10 minutes.
    +   * 
    + * + * + * .google.protobuf.Duration message_retention_duration = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The messageRetentionDuration. + */ + com.google.protobuf.Duration getMessageRetentionDuration(); + + /** + * + * + *
    +   * Optional. Indicates the minimum duration to retain a message after it is
    +   * published to the topic. If this field is set, messages published to the
    +   * topic in the last `message_retention_duration` are always available to
    +   * subscribers. For instance, it allows any attached subscription to [seek to
    +   * a
    +   * timestamp](https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time)
    +   * that is up to `message_retention_duration` in the past. If this field is
    +   * not set, message retention is controlled by settings on individual
    +   * subscriptions. Cannot be more than 31 days or less than 10 minutes.
    +   * 
    + * + * + * .google.protobuf.Duration message_retention_duration = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.protobuf.DurationOrBuilder getMessageRetentionDurationOrBuilder(); + + /** + * + * + *
    +   * Output only. An output-only field indicating the state of the topic.
    +   * 
    + * + * .google.pubsub.v1.Topic.State state = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for state. + */ + int getStateValue(); + + /** + * + * + *
    +   * Output only. An output-only field indicating the state of the topic.
    +   * 
    + * + * .google.pubsub.v1.Topic.State state = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The state. + */ + com.google.pubsub.v1.Topic.State getState(); + + /** + * + * + *
    +   * Optional. Settings for ingestion from a data source into this topic.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings ingestion_data_source_settings = 10 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the ingestionDataSourceSettings field is set. + */ + boolean hasIngestionDataSourceSettings(); + + /** + * + * + *
    +   * Optional. Settings for ingestion from a data source into this topic.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings ingestion_data_source_settings = 10 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The ingestionDataSourceSettings. + */ + com.google.pubsub.v1.IngestionDataSourceSettings getIngestionDataSourceSettings(); + + /** + * + * + *
    +   * Optional. Settings for ingestion from a data source into this topic.
    +   * 
    + * + * + * .google.pubsub.v1.IngestionDataSourceSettings ingestion_data_source_settings = 10 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.pubsub.v1.IngestionDataSourceSettingsOrBuilder + getIngestionDataSourceSettingsOrBuilder(); + + /** + * + * + *
    +   * Optional. Transforms to be applied to messages published to the topic.
    +   * Transforms are applied in the order specified.
    +   * 
    + * + * + * repeated .google.pubsub.v1.MessageTransform message_transforms = 13 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + java.util.List getMessageTransformsList(); + + /** + * + * + *
    +   * Optional. Transforms to be applied to messages published to the topic.
    +   * Transforms are applied in the order specified.
    +   * 
    + * + * + * repeated .google.pubsub.v1.MessageTransform message_transforms = 13 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.pubsub.v1.MessageTransform getMessageTransforms(int index); + + /** + * + * + *
    +   * Optional. Transforms to be applied to messages published to the topic.
    +   * Transforms are applied in the order specified.
    +   * 
    + * + * + * repeated .google.pubsub.v1.MessageTransform message_transforms = 13 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + int getMessageTransformsCount(); + + /** + * + * + *
    +   * Optional. Transforms to be applied to messages published to the topic.
    +   * Transforms are applied in the order specified.
    +   * 
    + * + * + * repeated .google.pubsub.v1.MessageTransform message_transforms = 13 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + java.util.List + getMessageTransformsOrBuilderList(); + + /** + * + * + *
    +   * Optional. Transforms to be applied to messages published to the topic.
    +   * Transforms are applied in the order specified.
    +   * 
    + * + * + * repeated .google.pubsub.v1.MessageTransform message_transforms = 13 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + 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"
    +   * See https://docs.cloud.google.com/pubsub/docs/tags for more information on
    +   * using tags with Pub/Sub resources.
    +   * 
    + * + * + * 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"
    +   * See https://docs.cloud.google.com/pubsub/docs/tags for more information on
    +   * using tags with Pub/Sub resources.
    +   * 
    + * + * + * 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"
    +   * See https://docs.cloud.google.com/pubsub/docs/tags for more information on
    +   * using tags with Pub/Sub resources.
    +   * 
    + * + * + * 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"
    +   * See https://docs.cloud.google.com/pubsub/docs/tags for more information on
    +   * using tags with Pub/Sub resources.
    +   * 
    + * + * + * 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"
    +   * See https://docs.cloud.google.com/pubsub/docs/tags for more information on
    +   * using tags with Pub/Sub resources.
    +   * 
    + * + * + * 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/java/com/google/pubsub/v1/UntypedTopicName.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/UntypedTopicName.java index 3dd3deea5..cb571b0b8 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/UntypedTopicName.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/UntypedTopicName.java @@ -19,8 +19,6 @@ 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; /** @@ -48,26 +46,6 @@ public static UntypedTopicName parse(String formattedString) { return new UntypedTopicName(formattedString); } - 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 (UntypedTopicName value : values) { - if (value == null) { - list.add(""); - } else { - list.add(value.toString()); - } - } - return list; - } - public static boolean isParsableFrom(String formattedString) { return true; } diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/UpdateSnapshotRequest.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/UpdateSnapshotRequest.java index 078d0d1be..954a9f822 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/UpdateSnapshotRequest.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/UpdateSnapshotRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; @@ -27,95 +29,29 @@ * * Protobuf type {@code google.pubsub.v1.UpdateSnapshotRequest} */ -public final class UpdateSnapshotRequest extends com.google.protobuf.GeneratedMessageV3 +@com.google.protobuf.Generated +public final class UpdateSnapshotRequest extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:google.pubsub.v1.UpdateSnapshotRequest) UpdateSnapshotRequestOrBuilder { private static final long serialVersionUID = 0L; - // Use UpdateSnapshotRequest.newBuilder() to construct. - private UpdateSnapshotRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private UpdateSnapshotRequest() {} - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new UpdateSnapshotRequest(); + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "UpdateSnapshotRequest"); } - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; + // Use UpdateSnapshotRequest.newBuilder() to construct. + private UpdateSnapshotRequest(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); } - private UpdateSnapshotRequest( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - com.google.pubsub.v1.Snapshot.Builder subBuilder = null; - if (snapshot_ != null) { - subBuilder = snapshot_.toBuilder(); - } - snapshot_ = - input.readMessage(com.google.pubsub.v1.Snapshot.parser(), extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(snapshot_); - snapshot_ = subBuilder.buildPartial(); - } - - break; - } - case 18: - { - com.google.protobuf.FieldMask.Builder subBuilder = null; - if (updateMask_ != null) { - subBuilder = updateMask_.toBuilder(); - } - updateMask_ = - input.readMessage(com.google.protobuf.FieldMask.parser(), extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(updateMask_); - updateMask_ = subBuilder.buildPartial(); - } - - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } + private UpdateSnapshotRequest() {} public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.pubsub.v1.PubsubProto @@ -123,7 +59,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_UpdateSnapshotRequest_fieldAccessorTable @@ -132,8 +68,10 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { com.google.pubsub.v1.UpdateSnapshotRequest.Builder.class); } + private int bitField0_; public static final int SNAPSHOT_FIELD_NUMBER = 1; private com.google.pubsub.v1.Snapshot snapshot_; + /** * * @@ -147,8 +85,9 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { */ @java.lang.Override public boolean hasSnapshot() { - return snapshot_ != null; + return ((bitField0_ & 0x00000001) != 0); } + /** * * @@ -164,6 +103,7 @@ public boolean hasSnapshot() { public com.google.pubsub.v1.Snapshot getSnapshot() { return snapshot_ == null ? com.google.pubsub.v1.Snapshot.getDefaultInstance() : snapshot_; } + /** * * @@ -175,11 +115,12 @@ public com.google.pubsub.v1.Snapshot getSnapshot() { */ @java.lang.Override public com.google.pubsub.v1.SnapshotOrBuilder getSnapshotOrBuilder() { - return getSnapshot(); + return snapshot_ == null ? com.google.pubsub.v1.Snapshot.getDefaultInstance() : snapshot_; } public static final int UPDATE_MASK_FIELD_NUMBER = 2; private com.google.protobuf.FieldMask updateMask_; + /** * * @@ -195,8 +136,9 @@ public com.google.pubsub.v1.SnapshotOrBuilder getSnapshotOrBuilder() { */ @java.lang.Override public boolean hasUpdateMask() { - return updateMask_ != null; + return ((bitField0_ & 0x00000002) != 0); } + /** * * @@ -214,6 +156,7 @@ public boolean hasUpdateMask() { public com.google.protobuf.FieldMask getUpdateMask() { return updateMask_ == null ? com.google.protobuf.FieldMask.getDefaultInstance() : updateMask_; } + /** * * @@ -227,7 +170,7 @@ public com.google.protobuf.FieldMask getUpdateMask() { */ @java.lang.Override public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { - return getUpdateMask(); + return updateMask_ == null ? com.google.protobuf.FieldMask.getDefaultInstance() : updateMask_; } private byte memoizedIsInitialized = -1; @@ -244,13 +187,13 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (snapshot_ != null) { + if (((bitField0_ & 0x00000001) != 0)) { output.writeMessage(1, getSnapshot()); } - if (updateMask_ != null) { + if (((bitField0_ & 0x00000002) != 0)) { output.writeMessage(2, getUpdateMask()); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -259,13 +202,13 @@ public int getSerializedSize() { if (size != -1) return size; size = 0; - if (snapshot_ != null) { + if (((bitField0_ & 0x00000001) != 0)) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getSnapshot()); } - if (updateMask_ != null) { + if (((bitField0_ & 0x00000002) != 0)) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getUpdateMask()); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -289,7 +232,7 @@ public boolean equals(final java.lang.Object obj) { if (hasUpdateMask()) { if (!getUpdateMask().equals(other.getUpdateMask())) return false; } - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -308,7 +251,7 @@ public int hashCode() { hash = (37 * hash) + UPDATE_MASK_FIELD_NUMBER; hash = (53 * hash) + getUpdateMask().hashCode(); } - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -350,38 +293,38 @@ public static com.google.pubsub.v1.UpdateSnapshotRequest parseFrom( public static com.google.pubsub.v1.UpdateSnapshotRequest parseFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.UpdateSnapshotRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.UpdateSnapshotRequest parseDelimitedFrom( java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); } public static com.google.pubsub.v1.UpdateSnapshotRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.UpdateSnapshotRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.UpdateSnapshotRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } @@ -404,10 +347,11 @@ public Builder toBuilder() { } @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** * * @@ -417,7 +361,7 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build * * Protobuf type {@code google.pubsub.v1.UpdateSnapshotRequest} */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements // @@protoc_insertion_point(builder_implements:google.pubsub.v1.UpdateSnapshotRequest) com.google.pubsub.v1.UpdateSnapshotRequestOrBuilder { @@ -427,7 +371,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_UpdateSnapshotRequest_fieldAccessorTable @@ -441,28 +385,30 @@ private Builder() { maybeForceBuilderInitialization(); } - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + internalGetSnapshotFieldBuilder(); + internalGetUpdateMaskFieldBuilder(); + } } @java.lang.Override public Builder clear() { super.clear(); - if (snapshotBuilder_ == null) { - snapshot_ = null; - } else { - snapshot_ = null; + bitField0_ = 0; + snapshot_ = null; + if (snapshotBuilder_ != null) { + snapshotBuilder_.dispose(); snapshotBuilder_ = null; } - if (updateMaskBuilder_ == null) { - updateMask_ = null; - } else { - updateMask_ = null; + updateMask_ = null; + if (updateMaskBuilder_ != null) { + updateMaskBuilder_.dispose(); updateMaskBuilder_ = null; } return this; @@ -492,51 +438,25 @@ public com.google.pubsub.v1.UpdateSnapshotRequest build() { public com.google.pubsub.v1.UpdateSnapshotRequest buildPartial() { com.google.pubsub.v1.UpdateSnapshotRequest result = new com.google.pubsub.v1.UpdateSnapshotRequest(this); - if (snapshotBuilder_ == null) { - result.snapshot_ = snapshot_; - } else { - result.snapshot_ = snapshotBuilder_.build(); - } - if (updateMaskBuilder_ == null) { - result.updateMask_ = updateMask_; - } else { - result.updateMask_ = updateMaskBuilder_.build(); + if (bitField0_ != 0) { + buildPartial0(result); } onBuilt(); return result; } - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); + private void buildPartial0(com.google.pubsub.v1.UpdateSnapshotRequest result) { + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.snapshot_ = snapshotBuilder_ == null ? snapshot_ : snapshotBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.updateMask_ = updateMaskBuilder_ == null ? updateMask_ : updateMaskBuilder_.build(); + to_bitField0_ |= 0x00000002; + } + result.bitField0_ |= to_bitField0_; } @java.lang.Override @@ -557,7 +477,7 @@ public Builder mergeFrom(com.google.pubsub.v1.UpdateSnapshotRequest other) { if (other.hasUpdateMask()) { mergeUpdateMask(other.getUpdateMask()); } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -572,26 +492,57 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.pubsub.v1.UpdateSnapshotRequest parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + input.readMessage( + internalGetSnapshotFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + input.readMessage( + internalGetUpdateMaskFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.google.pubsub.v1.UpdateSnapshotRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } + private int bitField0_; + private com.google.pubsub.v1.Snapshot snapshot_; - private com.google.protobuf.SingleFieldBuilderV3< + private com.google.protobuf.SingleFieldBuilder< com.google.pubsub.v1.Snapshot, com.google.pubsub.v1.Snapshot.Builder, com.google.pubsub.v1.SnapshotOrBuilder> snapshotBuilder_; + /** * * @@ -605,8 +556,9 @@ public Builder mergeFrom( * @return Whether the snapshot field is set. */ public boolean hasSnapshot() { - return snapshotBuilder_ != null || snapshot_ != null; + return ((bitField0_ & 0x00000001) != 0); } + /** * * @@ -626,6 +578,7 @@ public com.google.pubsub.v1.Snapshot getSnapshot() { return snapshotBuilder_.getMessage(); } } + /** * * @@ -642,13 +595,14 @@ public Builder setSnapshot(com.google.pubsub.v1.Snapshot value) { throw new NullPointerException(); } snapshot_ = value; - onChanged(); } else { snapshotBuilder_.setMessage(value); } - + bitField0_ |= 0x00000001; + onChanged(); return this; } + /** * * @@ -662,13 +616,14 @@ public Builder setSnapshot(com.google.pubsub.v1.Snapshot value) { public Builder setSnapshot(com.google.pubsub.v1.Snapshot.Builder builderForValue) { if (snapshotBuilder_ == null) { snapshot_ = builderForValue.build(); - onChanged(); } else { snapshotBuilder_.setMessage(builderForValue.build()); } - + bitField0_ |= 0x00000001; + onChanged(); return this; } + /** * * @@ -681,19 +636,23 @@ public Builder setSnapshot(com.google.pubsub.v1.Snapshot.Builder builderForValue */ public Builder mergeSnapshot(com.google.pubsub.v1.Snapshot value) { if (snapshotBuilder_ == null) { - if (snapshot_ != null) { - snapshot_ = - com.google.pubsub.v1.Snapshot.newBuilder(snapshot_).mergeFrom(value).buildPartial(); + if (((bitField0_ & 0x00000001) != 0) + && snapshot_ != null + && snapshot_ != com.google.pubsub.v1.Snapshot.getDefaultInstance()) { + getSnapshotBuilder().mergeFrom(value); } else { snapshot_ = value; } - onChanged(); } else { snapshotBuilder_.mergeFrom(value); } - + if (snapshot_ != null) { + bitField0_ |= 0x00000001; + onChanged(); + } return this; } + /** * * @@ -705,16 +664,16 @@ public Builder mergeSnapshot(com.google.pubsub.v1.Snapshot value) { * */ public Builder clearSnapshot() { - if (snapshotBuilder_ == null) { - snapshot_ = null; - onChanged(); - } else { - snapshot_ = null; + bitField0_ = (bitField0_ & ~0x00000001); + snapshot_ = null; + if (snapshotBuilder_ != null) { + snapshotBuilder_.dispose(); snapshotBuilder_ = null; } - + onChanged(); return this; } + /** * * @@ -726,10 +685,11 @@ public Builder clearSnapshot() { * */ public com.google.pubsub.v1.Snapshot.Builder getSnapshotBuilder() { - + bitField0_ |= 0x00000001; onChanged(); - return getSnapshotFieldBuilder().getBuilder(); + return internalGetSnapshotFieldBuilder().getBuilder(); } + /** * * @@ -747,6 +707,7 @@ public com.google.pubsub.v1.SnapshotOrBuilder getSnapshotOrBuilder() { return snapshot_ == null ? com.google.pubsub.v1.Snapshot.getDefaultInstance() : snapshot_; } } + /** * * @@ -757,14 +718,14 @@ public com.google.pubsub.v1.SnapshotOrBuilder getSnapshotOrBuilder() { * .google.pubsub.v1.Snapshot snapshot = 1 [(.google.api.field_behavior) = REQUIRED]; * */ - private com.google.protobuf.SingleFieldBuilderV3< + private com.google.protobuf.SingleFieldBuilder< com.google.pubsub.v1.Snapshot, com.google.pubsub.v1.Snapshot.Builder, com.google.pubsub.v1.SnapshotOrBuilder> - getSnapshotFieldBuilder() { + internalGetSnapshotFieldBuilder() { if (snapshotBuilder_ == null) { snapshotBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< + new com.google.protobuf.SingleFieldBuilder< com.google.pubsub.v1.Snapshot, com.google.pubsub.v1.Snapshot.Builder, com.google.pubsub.v1.SnapshotOrBuilder>( @@ -775,11 +736,12 @@ public com.google.pubsub.v1.SnapshotOrBuilder getSnapshotOrBuilder() { } private com.google.protobuf.FieldMask updateMask_; - private com.google.protobuf.SingleFieldBuilderV3< + private com.google.protobuf.SingleFieldBuilder< com.google.protobuf.FieldMask, com.google.protobuf.FieldMask.Builder, com.google.protobuf.FieldMaskOrBuilder> updateMaskBuilder_; + /** * * @@ -794,8 +756,9 @@ public com.google.pubsub.v1.SnapshotOrBuilder getSnapshotOrBuilder() { * @return Whether the updateMask field is set. */ public boolean hasUpdateMask() { - return updateMaskBuilder_ != null || updateMask_ != null; + return ((bitField0_ & 0x00000002) != 0); } + /** * * @@ -818,6 +781,7 @@ public com.google.protobuf.FieldMask getUpdateMask() { return updateMaskBuilder_.getMessage(); } } + /** * * @@ -835,13 +799,14 @@ public Builder setUpdateMask(com.google.protobuf.FieldMask value) { throw new NullPointerException(); } updateMask_ = value; - onChanged(); } else { updateMaskBuilder_.setMessage(value); } - + bitField0_ |= 0x00000002; + onChanged(); return this; } + /** * * @@ -856,13 +821,14 @@ public Builder setUpdateMask(com.google.protobuf.FieldMask value) { public Builder setUpdateMask(com.google.protobuf.FieldMask.Builder builderForValue) { if (updateMaskBuilder_ == null) { updateMask_ = builderForValue.build(); - onChanged(); } else { updateMaskBuilder_.setMessage(builderForValue.build()); } - + bitField0_ |= 0x00000002; + onChanged(); return this; } + /** * * @@ -876,19 +842,23 @@ public Builder setUpdateMask(com.google.protobuf.FieldMask.Builder builderForVal */ public Builder mergeUpdateMask(com.google.protobuf.FieldMask value) { if (updateMaskBuilder_ == null) { - if (updateMask_ != null) { - updateMask_ = - com.google.protobuf.FieldMask.newBuilder(updateMask_).mergeFrom(value).buildPartial(); + if (((bitField0_ & 0x00000002) != 0) + && updateMask_ != null + && updateMask_ != com.google.protobuf.FieldMask.getDefaultInstance()) { + getUpdateMaskBuilder().mergeFrom(value); } else { updateMask_ = value; } - onChanged(); } else { updateMaskBuilder_.mergeFrom(value); } - + if (updateMask_ != null) { + bitField0_ |= 0x00000002; + onChanged(); + } return this; } + /** * * @@ -901,16 +871,16 @@ public Builder mergeUpdateMask(com.google.protobuf.FieldMask value) { * */ public Builder clearUpdateMask() { - if (updateMaskBuilder_ == null) { - updateMask_ = null; - onChanged(); - } else { - updateMask_ = null; + bitField0_ = (bitField0_ & ~0x00000002); + updateMask_ = null; + if (updateMaskBuilder_ != null) { + updateMaskBuilder_.dispose(); updateMaskBuilder_ = null; } - + onChanged(); return this; } + /** * * @@ -923,10 +893,11 @@ public Builder clearUpdateMask() { * */ public com.google.protobuf.FieldMask.Builder getUpdateMaskBuilder() { - + bitField0_ |= 0x00000002; onChanged(); - return getUpdateMaskFieldBuilder().getBuilder(); + return internalGetUpdateMaskFieldBuilder().getBuilder(); } + /** * * @@ -947,6 +918,7 @@ public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { : updateMask_; } } + /** * * @@ -958,14 +930,14 @@ public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; * */ - private com.google.protobuf.SingleFieldBuilderV3< + private com.google.protobuf.SingleFieldBuilder< com.google.protobuf.FieldMask, com.google.protobuf.FieldMask.Builder, com.google.protobuf.FieldMaskOrBuilder> - getUpdateMaskFieldBuilder() { + internalGetUpdateMaskFieldBuilder() { if (updateMaskBuilder_ == null) { updateMaskBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< + new com.google.protobuf.SingleFieldBuilder< com.google.protobuf.FieldMask, com.google.protobuf.FieldMask.Builder, com.google.protobuf.FieldMaskOrBuilder>( @@ -975,17 +947,6 @@ public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { return updateMaskBuilder_; } - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - // @@protoc_insertion_point(builder_scope:google.pubsub.v1.UpdateSnapshotRequest) } @@ -1007,7 +968,18 @@ public UpdateSnapshotRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new UpdateSnapshotRequest(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/UpdateSnapshotRequestOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/UpdateSnapshotRequestOrBuilder.java index 2acbd1120..76a1b76dc 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/UpdateSnapshotRequestOrBuilder.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/UpdateSnapshotRequestOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; +@com.google.protobuf.Generated public interface UpdateSnapshotRequestOrBuilder extends // @@protoc_insertion_point(interface_extends:google.pubsub.v1.UpdateSnapshotRequest) @@ -35,6 +38,7 @@ public interface UpdateSnapshotRequestOrBuilder * @return Whether the snapshot field is set. */ boolean hasSnapshot(); + /** * * @@ -47,6 +51,7 @@ public interface UpdateSnapshotRequestOrBuilder * @return The snapshot. */ com.google.pubsub.v1.Snapshot getSnapshot(); + /** * * @@ -72,6 +77,7 @@ public interface UpdateSnapshotRequestOrBuilder * @return Whether the updateMask field is set. */ boolean hasUpdateMask(); + /** * * @@ -86,6 +92,7 @@ public interface UpdateSnapshotRequestOrBuilder * @return The updateMask. */ com.google.protobuf.FieldMask getUpdateMask(); + /** * * diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/UpdateSubscriptionRequest.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/UpdateSubscriptionRequest.java index ffed68bcf..59183a696 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/UpdateSubscriptionRequest.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/UpdateSubscriptionRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; @@ -27,95 +29,29 @@ * * Protobuf type {@code google.pubsub.v1.UpdateSubscriptionRequest} */ -public final class UpdateSubscriptionRequest extends com.google.protobuf.GeneratedMessageV3 +@com.google.protobuf.Generated +public final class UpdateSubscriptionRequest extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:google.pubsub.v1.UpdateSubscriptionRequest) UpdateSubscriptionRequestOrBuilder { private static final long serialVersionUID = 0L; - // Use UpdateSubscriptionRequest.newBuilder() to construct. - private UpdateSubscriptionRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private UpdateSubscriptionRequest() {} - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new UpdateSubscriptionRequest(); + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "UpdateSubscriptionRequest"); } - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; + // Use UpdateSubscriptionRequest.newBuilder() to construct. + private UpdateSubscriptionRequest(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); } - private UpdateSubscriptionRequest( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - com.google.pubsub.v1.Subscription.Builder subBuilder = null; - if (subscription_ != null) { - subBuilder = subscription_.toBuilder(); - } - subscription_ = - input.readMessage(com.google.pubsub.v1.Subscription.parser(), extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(subscription_); - subscription_ = subBuilder.buildPartial(); - } - - break; - } - case 18: - { - com.google.protobuf.FieldMask.Builder subBuilder = null; - if (updateMask_ != null) { - subBuilder = updateMask_.toBuilder(); - } - updateMask_ = - input.readMessage(com.google.protobuf.FieldMask.parser(), extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(updateMask_); - updateMask_ = subBuilder.buildPartial(); - } - - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } + private UpdateSubscriptionRequest() {} public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.pubsub.v1.PubsubProto @@ -123,7 +59,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_UpdateSubscriptionRequest_fieldAccessorTable @@ -132,8 +68,10 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { com.google.pubsub.v1.UpdateSubscriptionRequest.Builder.class); } + private int bitField0_; public static final int SUBSCRIPTION_FIELD_NUMBER = 1; private com.google.pubsub.v1.Subscription subscription_; + /** * * @@ -149,8 +87,9 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { */ @java.lang.Override public boolean hasSubscription() { - return subscription_ != null; + return ((bitField0_ & 0x00000001) != 0); } + /** * * @@ -170,6 +109,7 @@ public com.google.pubsub.v1.Subscription getSubscription() { ? com.google.pubsub.v1.Subscription.getDefaultInstance() : subscription_; } + /** * * @@ -183,11 +123,14 @@ public com.google.pubsub.v1.Subscription getSubscription() { */ @java.lang.Override public com.google.pubsub.v1.SubscriptionOrBuilder getSubscriptionOrBuilder() { - return getSubscription(); + return subscription_ == null + ? com.google.pubsub.v1.Subscription.getDefaultInstance() + : subscription_; } public static final int UPDATE_MASK_FIELD_NUMBER = 2; private com.google.protobuf.FieldMask updateMask_; + /** * * @@ -203,8 +146,9 @@ public com.google.pubsub.v1.SubscriptionOrBuilder getSubscriptionOrBuilder() { */ @java.lang.Override public boolean hasUpdateMask() { - return updateMask_ != null; + return ((bitField0_ & 0x00000002) != 0); } + /** * * @@ -222,6 +166,7 @@ public boolean hasUpdateMask() { public com.google.protobuf.FieldMask getUpdateMask() { return updateMask_ == null ? com.google.protobuf.FieldMask.getDefaultInstance() : updateMask_; } + /** * * @@ -235,7 +180,7 @@ public com.google.protobuf.FieldMask getUpdateMask() { */ @java.lang.Override public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { - return getUpdateMask(); + return updateMask_ == null ? com.google.protobuf.FieldMask.getDefaultInstance() : updateMask_; } private byte memoizedIsInitialized = -1; @@ -252,13 +197,13 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (subscription_ != null) { + if (((bitField0_ & 0x00000001) != 0)) { output.writeMessage(1, getSubscription()); } - if (updateMask_ != null) { + if (((bitField0_ & 0x00000002) != 0)) { output.writeMessage(2, getUpdateMask()); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -267,13 +212,13 @@ public int getSerializedSize() { if (size != -1) return size; size = 0; - if (subscription_ != null) { + if (((bitField0_ & 0x00000001) != 0)) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getSubscription()); } - if (updateMask_ != null) { + if (((bitField0_ & 0x00000002) != 0)) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getUpdateMask()); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -297,7 +242,7 @@ public boolean equals(final java.lang.Object obj) { if (hasUpdateMask()) { if (!getUpdateMask().equals(other.getUpdateMask())) return false; } - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -316,7 +261,7 @@ public int hashCode() { hash = (37 * hash) + UPDATE_MASK_FIELD_NUMBER; hash = (53 * hash) + getUpdateMask().hashCode(); } - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -358,38 +303,38 @@ public static com.google.pubsub.v1.UpdateSubscriptionRequest parseFrom( public static com.google.pubsub.v1.UpdateSubscriptionRequest parseFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.UpdateSubscriptionRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.UpdateSubscriptionRequest parseDelimitedFrom( java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); } public static com.google.pubsub.v1.UpdateSubscriptionRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.UpdateSubscriptionRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.UpdateSubscriptionRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } @@ -412,10 +357,11 @@ public Builder toBuilder() { } @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** * * @@ -425,7 +371,7 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build * * Protobuf type {@code google.pubsub.v1.UpdateSubscriptionRequest} */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements // @@protoc_insertion_point(builder_implements:google.pubsub.v1.UpdateSubscriptionRequest) com.google.pubsub.v1.UpdateSubscriptionRequestOrBuilder { @@ -435,7 +381,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_UpdateSubscriptionRequest_fieldAccessorTable @@ -449,28 +395,30 @@ private Builder() { maybeForceBuilderInitialization(); } - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + internalGetSubscriptionFieldBuilder(); + internalGetUpdateMaskFieldBuilder(); + } } @java.lang.Override public Builder clear() { super.clear(); - if (subscriptionBuilder_ == null) { - subscription_ = null; - } else { - subscription_ = null; + bitField0_ = 0; + subscription_ = null; + if (subscriptionBuilder_ != null) { + subscriptionBuilder_.dispose(); subscriptionBuilder_ = null; } - if (updateMaskBuilder_ == null) { - updateMask_ = null; - } else { - updateMask_ = null; + updateMask_ = null; + if (updateMaskBuilder_ != null) { + updateMaskBuilder_.dispose(); updateMaskBuilder_ = null; } return this; @@ -500,51 +448,26 @@ public com.google.pubsub.v1.UpdateSubscriptionRequest build() { public com.google.pubsub.v1.UpdateSubscriptionRequest buildPartial() { com.google.pubsub.v1.UpdateSubscriptionRequest result = new com.google.pubsub.v1.UpdateSubscriptionRequest(this); - if (subscriptionBuilder_ == null) { - result.subscription_ = subscription_; - } else { - result.subscription_ = subscriptionBuilder_.build(); - } - if (updateMaskBuilder_ == null) { - result.updateMask_ = updateMask_; - } else { - result.updateMask_ = updateMaskBuilder_.build(); + if (bitField0_ != 0) { + buildPartial0(result); } onBuilt(); return result; } - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); + private void buildPartial0(com.google.pubsub.v1.UpdateSubscriptionRequest result) { + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.subscription_ = + subscriptionBuilder_ == null ? subscription_ : subscriptionBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.updateMask_ = updateMaskBuilder_ == null ? updateMask_ : updateMaskBuilder_.build(); + to_bitField0_ |= 0x00000002; + } + result.bitField0_ |= to_bitField0_; } @java.lang.Override @@ -565,7 +488,7 @@ public Builder mergeFrom(com.google.pubsub.v1.UpdateSubscriptionRequest other) { if (other.hasUpdateMask()) { mergeUpdateMask(other.getUpdateMask()); } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -580,26 +503,57 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.pubsub.v1.UpdateSubscriptionRequest parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + input.readMessage( + internalGetSubscriptionFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + input.readMessage( + internalGetUpdateMaskFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.google.pubsub.v1.UpdateSubscriptionRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } + private int bitField0_; + private com.google.pubsub.v1.Subscription subscription_; - private com.google.protobuf.SingleFieldBuilderV3< + private com.google.protobuf.SingleFieldBuilder< com.google.pubsub.v1.Subscription, com.google.pubsub.v1.Subscription.Builder, com.google.pubsub.v1.SubscriptionOrBuilder> subscriptionBuilder_; + /** * * @@ -614,8 +568,9 @@ public Builder mergeFrom( * @return Whether the subscription field is set. */ public boolean hasSubscription() { - return subscriptionBuilder_ != null || subscription_ != null; + return ((bitField0_ & 0x00000001) != 0); } + /** * * @@ -638,6 +593,7 @@ public com.google.pubsub.v1.Subscription getSubscription() { return subscriptionBuilder_.getMessage(); } } + /** * * @@ -655,13 +611,14 @@ public Builder setSubscription(com.google.pubsub.v1.Subscription value) { throw new NullPointerException(); } subscription_ = value; - onChanged(); } else { subscriptionBuilder_.setMessage(value); } - + bitField0_ |= 0x00000001; + onChanged(); return this; } + /** * * @@ -676,13 +633,14 @@ public Builder setSubscription(com.google.pubsub.v1.Subscription value) { public Builder setSubscription(com.google.pubsub.v1.Subscription.Builder builderForValue) { if (subscriptionBuilder_ == null) { subscription_ = builderForValue.build(); - onChanged(); } else { subscriptionBuilder_.setMessage(builderForValue.build()); } - + bitField0_ |= 0x00000001; + onChanged(); return this; } + /** * * @@ -696,21 +654,23 @@ public Builder setSubscription(com.google.pubsub.v1.Subscription.Builder builder */ public Builder mergeSubscription(com.google.pubsub.v1.Subscription value) { if (subscriptionBuilder_ == null) { - if (subscription_ != null) { - subscription_ = - com.google.pubsub.v1.Subscription.newBuilder(subscription_) - .mergeFrom(value) - .buildPartial(); + if (((bitField0_ & 0x00000001) != 0) + && subscription_ != null + && subscription_ != com.google.pubsub.v1.Subscription.getDefaultInstance()) { + getSubscriptionBuilder().mergeFrom(value); } else { subscription_ = value; } - onChanged(); } else { subscriptionBuilder_.mergeFrom(value); } - + if (subscription_ != null) { + bitField0_ |= 0x00000001; + onChanged(); + } return this; } + /** * * @@ -723,16 +683,16 @@ public Builder mergeSubscription(com.google.pubsub.v1.Subscription value) { * */ public Builder clearSubscription() { - if (subscriptionBuilder_ == null) { - subscription_ = null; - onChanged(); - } else { - subscription_ = null; + bitField0_ = (bitField0_ & ~0x00000001); + subscription_ = null; + if (subscriptionBuilder_ != null) { + subscriptionBuilder_.dispose(); subscriptionBuilder_ = null; } - + onChanged(); return this; } + /** * * @@ -745,10 +705,11 @@ public Builder clearSubscription() { * */ public com.google.pubsub.v1.Subscription.Builder getSubscriptionBuilder() { - + bitField0_ |= 0x00000001; onChanged(); - return getSubscriptionFieldBuilder().getBuilder(); + return internalGetSubscriptionFieldBuilder().getBuilder(); } + /** * * @@ -769,6 +730,7 @@ public com.google.pubsub.v1.SubscriptionOrBuilder getSubscriptionOrBuilder() { : subscription_; } } + /** * * @@ -780,14 +742,14 @@ public com.google.pubsub.v1.SubscriptionOrBuilder getSubscriptionOrBuilder() { * .google.pubsub.v1.Subscription subscription = 1 [(.google.api.field_behavior) = REQUIRED]; * */ - private com.google.protobuf.SingleFieldBuilderV3< + private com.google.protobuf.SingleFieldBuilder< com.google.pubsub.v1.Subscription, com.google.pubsub.v1.Subscription.Builder, com.google.pubsub.v1.SubscriptionOrBuilder> - getSubscriptionFieldBuilder() { + internalGetSubscriptionFieldBuilder() { if (subscriptionBuilder_ == null) { subscriptionBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< + new com.google.protobuf.SingleFieldBuilder< com.google.pubsub.v1.Subscription, com.google.pubsub.v1.Subscription.Builder, com.google.pubsub.v1.SubscriptionOrBuilder>( @@ -798,11 +760,12 @@ public com.google.pubsub.v1.SubscriptionOrBuilder getSubscriptionOrBuilder() { } private com.google.protobuf.FieldMask updateMask_; - private com.google.protobuf.SingleFieldBuilderV3< + private com.google.protobuf.SingleFieldBuilder< com.google.protobuf.FieldMask, com.google.protobuf.FieldMask.Builder, com.google.protobuf.FieldMaskOrBuilder> updateMaskBuilder_; + /** * * @@ -817,8 +780,9 @@ public com.google.pubsub.v1.SubscriptionOrBuilder getSubscriptionOrBuilder() { * @return Whether the updateMask field is set. */ public boolean hasUpdateMask() { - return updateMaskBuilder_ != null || updateMask_ != null; + return ((bitField0_ & 0x00000002) != 0); } + /** * * @@ -841,6 +805,7 @@ public com.google.protobuf.FieldMask getUpdateMask() { return updateMaskBuilder_.getMessage(); } } + /** * * @@ -858,13 +823,14 @@ public Builder setUpdateMask(com.google.protobuf.FieldMask value) { throw new NullPointerException(); } updateMask_ = value; - onChanged(); } else { updateMaskBuilder_.setMessage(value); } - + bitField0_ |= 0x00000002; + onChanged(); return this; } + /** * * @@ -879,13 +845,14 @@ public Builder setUpdateMask(com.google.protobuf.FieldMask value) { public Builder setUpdateMask(com.google.protobuf.FieldMask.Builder builderForValue) { if (updateMaskBuilder_ == null) { updateMask_ = builderForValue.build(); - onChanged(); } else { updateMaskBuilder_.setMessage(builderForValue.build()); } - + bitField0_ |= 0x00000002; + onChanged(); return this; } + /** * * @@ -899,19 +866,23 @@ public Builder setUpdateMask(com.google.protobuf.FieldMask.Builder builderForVal */ public Builder mergeUpdateMask(com.google.protobuf.FieldMask value) { if (updateMaskBuilder_ == null) { - if (updateMask_ != null) { - updateMask_ = - com.google.protobuf.FieldMask.newBuilder(updateMask_).mergeFrom(value).buildPartial(); + if (((bitField0_ & 0x00000002) != 0) + && updateMask_ != null + && updateMask_ != com.google.protobuf.FieldMask.getDefaultInstance()) { + getUpdateMaskBuilder().mergeFrom(value); } else { updateMask_ = value; } - onChanged(); } else { updateMaskBuilder_.mergeFrom(value); } - + if (updateMask_ != null) { + bitField0_ |= 0x00000002; + onChanged(); + } return this; } + /** * * @@ -924,16 +895,16 @@ public Builder mergeUpdateMask(com.google.protobuf.FieldMask value) { * */ public Builder clearUpdateMask() { - if (updateMaskBuilder_ == null) { - updateMask_ = null; - onChanged(); - } else { - updateMask_ = null; + bitField0_ = (bitField0_ & ~0x00000002); + updateMask_ = null; + if (updateMaskBuilder_ != null) { + updateMaskBuilder_.dispose(); updateMaskBuilder_ = null; } - + onChanged(); return this; } + /** * * @@ -946,10 +917,11 @@ public Builder clearUpdateMask() { * */ public com.google.protobuf.FieldMask.Builder getUpdateMaskBuilder() { - + bitField0_ |= 0x00000002; onChanged(); - return getUpdateMaskFieldBuilder().getBuilder(); + return internalGetUpdateMaskFieldBuilder().getBuilder(); } + /** * * @@ -970,6 +942,7 @@ public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { : updateMask_; } } + /** * * @@ -981,14 +954,14 @@ public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; * */ - private com.google.protobuf.SingleFieldBuilderV3< + private com.google.protobuf.SingleFieldBuilder< com.google.protobuf.FieldMask, com.google.protobuf.FieldMask.Builder, com.google.protobuf.FieldMaskOrBuilder> - getUpdateMaskFieldBuilder() { + internalGetUpdateMaskFieldBuilder() { if (updateMaskBuilder_ == null) { updateMaskBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< + new com.google.protobuf.SingleFieldBuilder< com.google.protobuf.FieldMask, com.google.protobuf.FieldMask.Builder, com.google.protobuf.FieldMaskOrBuilder>( @@ -998,17 +971,6 @@ public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { return updateMaskBuilder_; } - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - // @@protoc_insertion_point(builder_scope:google.pubsub.v1.UpdateSubscriptionRequest) } @@ -1030,7 +992,18 @@ public UpdateSubscriptionRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new UpdateSubscriptionRequest(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/UpdateSubscriptionRequestOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/UpdateSubscriptionRequestOrBuilder.java index 730dc304b..e54b29c99 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/UpdateSubscriptionRequestOrBuilder.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/UpdateSubscriptionRequestOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; +@com.google.protobuf.Generated public interface UpdateSubscriptionRequestOrBuilder extends // @@protoc_insertion_point(interface_extends:google.pubsub.v1.UpdateSubscriptionRequest) @@ -37,6 +40,7 @@ public interface UpdateSubscriptionRequestOrBuilder * @return Whether the subscription field is set. */ boolean hasSubscription(); + /** * * @@ -51,6 +55,7 @@ public interface UpdateSubscriptionRequestOrBuilder * @return The subscription. */ com.google.pubsub.v1.Subscription getSubscription(); + /** * * @@ -78,6 +83,7 @@ public interface UpdateSubscriptionRequestOrBuilder * @return Whether the updateMask field is set. */ boolean hasUpdateMask(); + /** * * @@ -92,6 +98,7 @@ public interface UpdateSubscriptionRequestOrBuilder * @return The updateMask. */ com.google.protobuf.FieldMask getUpdateMask(); + /** * * diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/UpdateTopicRequest.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/UpdateTopicRequest.java index 7458cb8ad..a504c1e61 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/UpdateTopicRequest.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/UpdateTopicRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; @@ -27,94 +29,29 @@ * * Protobuf type {@code google.pubsub.v1.UpdateTopicRequest} */ -public final class UpdateTopicRequest extends com.google.protobuf.GeneratedMessageV3 +@com.google.protobuf.Generated +public final class UpdateTopicRequest extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:google.pubsub.v1.UpdateTopicRequest) UpdateTopicRequestOrBuilder { private static final long serialVersionUID = 0L; - // Use UpdateTopicRequest.newBuilder() to construct. - private UpdateTopicRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private UpdateTopicRequest() {} - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new UpdateTopicRequest(); + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "UpdateTopicRequest"); } - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; + // Use UpdateTopicRequest.newBuilder() to construct. + private UpdateTopicRequest(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); } - private UpdateTopicRequest( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - com.google.pubsub.v1.Topic.Builder subBuilder = null; - if (topic_ != null) { - subBuilder = topic_.toBuilder(); - } - topic_ = input.readMessage(com.google.pubsub.v1.Topic.parser(), extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(topic_); - topic_ = subBuilder.buildPartial(); - } - - break; - } - case 18: - { - com.google.protobuf.FieldMask.Builder subBuilder = null; - if (updateMask_ != null) { - subBuilder = updateMask_.toBuilder(); - } - updateMask_ = - input.readMessage(com.google.protobuf.FieldMask.parser(), extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(updateMask_); - updateMask_ = subBuilder.buildPartial(); - } - - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } + private UpdateTopicRequest() {} public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.pubsub.v1.PubsubProto @@ -122,7 +59,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_UpdateTopicRequest_fieldAccessorTable @@ -131,8 +68,10 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { com.google.pubsub.v1.UpdateTopicRequest.Builder.class); } + private int bitField0_; public static final int TOPIC_FIELD_NUMBER = 1; private com.google.pubsub.v1.Topic topic_; + /** * * @@ -146,8 +85,9 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { */ @java.lang.Override public boolean hasTopic() { - return topic_ != null; + return ((bitField0_ & 0x00000001) != 0); } + /** * * @@ -163,6 +103,7 @@ public boolean hasTopic() { public com.google.pubsub.v1.Topic getTopic() { return topic_ == null ? com.google.pubsub.v1.Topic.getDefaultInstance() : topic_; } + /** * * @@ -174,11 +115,12 @@ public com.google.pubsub.v1.Topic getTopic() { */ @java.lang.Override public com.google.pubsub.v1.TopicOrBuilder getTopicOrBuilder() { - return getTopic(); + return topic_ == null ? com.google.pubsub.v1.Topic.getDefaultInstance() : topic_; } public static final int UPDATE_MASK_FIELD_NUMBER = 2; private com.google.protobuf.FieldMask updateMask_; + /** * * @@ -197,8 +139,9 @@ public com.google.pubsub.v1.TopicOrBuilder getTopicOrBuilder() { */ @java.lang.Override public boolean hasUpdateMask() { - return updateMask_ != null; + return ((bitField0_ & 0x00000002) != 0); } + /** * * @@ -219,6 +162,7 @@ public boolean hasUpdateMask() { public com.google.protobuf.FieldMask getUpdateMask() { return updateMask_ == null ? com.google.protobuf.FieldMask.getDefaultInstance() : updateMask_; } + /** * * @@ -235,7 +179,7 @@ public com.google.protobuf.FieldMask getUpdateMask() { */ @java.lang.Override public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { - return getUpdateMask(); + return updateMask_ == null ? com.google.protobuf.FieldMask.getDefaultInstance() : updateMask_; } private byte memoizedIsInitialized = -1; @@ -252,13 +196,13 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (topic_ != null) { + if (((bitField0_ & 0x00000001) != 0)) { output.writeMessage(1, getTopic()); } - if (updateMask_ != null) { + if (((bitField0_ & 0x00000002) != 0)) { output.writeMessage(2, getUpdateMask()); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -267,13 +211,13 @@ public int getSerializedSize() { if (size != -1) return size; size = 0; - if (topic_ != null) { + if (((bitField0_ & 0x00000001) != 0)) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getTopic()); } - if (updateMask_ != null) { + if (((bitField0_ & 0x00000002) != 0)) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getUpdateMask()); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -296,7 +240,7 @@ public boolean equals(final java.lang.Object obj) { if (hasUpdateMask()) { if (!getUpdateMask().equals(other.getUpdateMask())) return false; } - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -315,7 +259,7 @@ public int hashCode() { hash = (37 * hash) + UPDATE_MASK_FIELD_NUMBER; hash = (53 * hash) + getUpdateMask().hashCode(); } - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -357,38 +301,38 @@ public static com.google.pubsub.v1.UpdateTopicRequest parseFrom( public static com.google.pubsub.v1.UpdateTopicRequest parseFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.UpdateTopicRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.UpdateTopicRequest parseDelimitedFrom( java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); } public static com.google.pubsub.v1.UpdateTopicRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.UpdateTopicRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.UpdateTopicRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } @@ -411,10 +355,11 @@ public Builder toBuilder() { } @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** * * @@ -424,7 +369,7 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build * * Protobuf type {@code google.pubsub.v1.UpdateTopicRequest} */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements // @@protoc_insertion_point(builder_implements:google.pubsub.v1.UpdateTopicRequest) com.google.pubsub.v1.UpdateTopicRequestOrBuilder { @@ -434,7 +379,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.PubsubProto .internal_static_google_pubsub_v1_UpdateTopicRequest_fieldAccessorTable @@ -448,28 +393,30 @@ private Builder() { maybeForceBuilderInitialization(); } - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + internalGetTopicFieldBuilder(); + internalGetUpdateMaskFieldBuilder(); + } } @java.lang.Override public Builder clear() { super.clear(); - if (topicBuilder_ == null) { - topic_ = null; - } else { - topic_ = null; + bitField0_ = 0; + topic_ = null; + if (topicBuilder_ != null) { + topicBuilder_.dispose(); topicBuilder_ = null; } - if (updateMaskBuilder_ == null) { - updateMask_ = null; - } else { - updateMask_ = null; + updateMask_ = null; + if (updateMaskBuilder_ != null) { + updateMaskBuilder_.dispose(); updateMaskBuilder_ = null; } return this; @@ -499,51 +446,25 @@ public com.google.pubsub.v1.UpdateTopicRequest build() { public com.google.pubsub.v1.UpdateTopicRequest buildPartial() { com.google.pubsub.v1.UpdateTopicRequest result = new com.google.pubsub.v1.UpdateTopicRequest(this); - if (topicBuilder_ == null) { - result.topic_ = topic_; - } else { - result.topic_ = topicBuilder_.build(); - } - if (updateMaskBuilder_ == null) { - result.updateMask_ = updateMask_; - } else { - result.updateMask_ = updateMaskBuilder_.build(); + if (bitField0_ != 0) { + buildPartial0(result); } onBuilt(); return result; } - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); + private void buildPartial0(com.google.pubsub.v1.UpdateTopicRequest result) { + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.topic_ = topicBuilder_ == null ? topic_ : topicBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.updateMask_ = updateMaskBuilder_ == null ? updateMask_ : updateMaskBuilder_.build(); + to_bitField0_ |= 0x00000002; + } + result.bitField0_ |= to_bitField0_; } @java.lang.Override @@ -564,7 +485,7 @@ public Builder mergeFrom(com.google.pubsub.v1.UpdateTopicRequest other) { if (other.hasUpdateMask()) { mergeUpdateMask(other.getUpdateMask()); } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -579,26 +500,56 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.pubsub.v1.UpdateTopicRequest parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + input.readMessage(internalGetTopicFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + input.readMessage( + internalGetUpdateMaskFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.google.pubsub.v1.UpdateTopicRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } + private int bitField0_; + private com.google.pubsub.v1.Topic topic_; - private com.google.protobuf.SingleFieldBuilderV3< + private com.google.protobuf.SingleFieldBuilder< com.google.pubsub.v1.Topic, com.google.pubsub.v1.Topic.Builder, com.google.pubsub.v1.TopicOrBuilder> topicBuilder_; + /** * * @@ -611,8 +562,9 @@ public Builder mergeFrom( * @return Whether the topic field is set. */ public boolean hasTopic() { - return topicBuilder_ != null || topic_ != null; + return ((bitField0_ & 0x00000001) != 0); } + /** * * @@ -631,6 +583,7 @@ public com.google.pubsub.v1.Topic getTopic() { return topicBuilder_.getMessage(); } } + /** * * @@ -646,13 +599,14 @@ public Builder setTopic(com.google.pubsub.v1.Topic value) { throw new NullPointerException(); } topic_ = value; - onChanged(); } else { topicBuilder_.setMessage(value); } - + bitField0_ |= 0x00000001; + onChanged(); return this; } + /** * * @@ -665,13 +619,14 @@ public Builder setTopic(com.google.pubsub.v1.Topic value) { public Builder setTopic(com.google.pubsub.v1.Topic.Builder builderForValue) { if (topicBuilder_ == null) { topic_ = builderForValue.build(); - onChanged(); } else { topicBuilder_.setMessage(builderForValue.build()); } - + bitField0_ |= 0x00000001; + onChanged(); return this; } + /** * * @@ -683,18 +638,23 @@ public Builder setTopic(com.google.pubsub.v1.Topic.Builder builderForValue) { */ public Builder mergeTopic(com.google.pubsub.v1.Topic value) { if (topicBuilder_ == null) { - if (topic_ != null) { - topic_ = com.google.pubsub.v1.Topic.newBuilder(topic_).mergeFrom(value).buildPartial(); + if (((bitField0_ & 0x00000001) != 0) + && topic_ != null + && topic_ != com.google.pubsub.v1.Topic.getDefaultInstance()) { + getTopicBuilder().mergeFrom(value); } else { topic_ = value; } - onChanged(); } else { topicBuilder_.mergeFrom(value); } - + if (topic_ != null) { + bitField0_ |= 0x00000001; + onChanged(); + } return this; } + /** * * @@ -705,16 +665,16 @@ public Builder mergeTopic(com.google.pubsub.v1.Topic value) { * .google.pubsub.v1.Topic topic = 1 [(.google.api.field_behavior) = REQUIRED]; */ public Builder clearTopic() { - if (topicBuilder_ == null) { - topic_ = null; - onChanged(); - } else { - topic_ = null; + bitField0_ = (bitField0_ & ~0x00000001); + topic_ = null; + if (topicBuilder_ != null) { + topicBuilder_.dispose(); topicBuilder_ = null; } - + onChanged(); return this; } + /** * * @@ -725,10 +685,11 @@ public Builder clearTopic() { * .google.pubsub.v1.Topic topic = 1 [(.google.api.field_behavior) = REQUIRED]; */ public com.google.pubsub.v1.Topic.Builder getTopicBuilder() { - + bitField0_ |= 0x00000001; onChanged(); - return getTopicFieldBuilder().getBuilder(); + return internalGetTopicFieldBuilder().getBuilder(); } + /** * * @@ -745,6 +706,7 @@ public com.google.pubsub.v1.TopicOrBuilder getTopicOrBuilder() { return topic_ == null ? com.google.pubsub.v1.Topic.getDefaultInstance() : topic_; } } + /** * * @@ -754,14 +716,14 @@ public com.google.pubsub.v1.TopicOrBuilder getTopicOrBuilder() { * * .google.pubsub.v1.Topic topic = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private com.google.protobuf.SingleFieldBuilderV3< + private com.google.protobuf.SingleFieldBuilder< com.google.pubsub.v1.Topic, com.google.pubsub.v1.Topic.Builder, com.google.pubsub.v1.TopicOrBuilder> - getTopicFieldBuilder() { + internalGetTopicFieldBuilder() { if (topicBuilder_ == null) { topicBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< + new com.google.protobuf.SingleFieldBuilder< com.google.pubsub.v1.Topic, com.google.pubsub.v1.Topic.Builder, com.google.pubsub.v1.TopicOrBuilder>(getTopic(), getParentForChildren(), isClean()); @@ -771,11 +733,12 @@ public com.google.pubsub.v1.TopicOrBuilder getTopicOrBuilder() { } private com.google.protobuf.FieldMask updateMask_; - private com.google.protobuf.SingleFieldBuilderV3< + private com.google.protobuf.SingleFieldBuilder< com.google.protobuf.FieldMask, com.google.protobuf.FieldMask.Builder, com.google.protobuf.FieldMaskOrBuilder> updateMaskBuilder_; + /** * * @@ -793,8 +756,9 @@ public com.google.pubsub.v1.TopicOrBuilder getTopicOrBuilder() { * @return Whether the updateMask field is set. */ public boolean hasUpdateMask() { - return updateMaskBuilder_ != null || updateMask_ != null; + return ((bitField0_ & 0x00000002) != 0); } + /** * * @@ -820,6 +784,7 @@ public com.google.protobuf.FieldMask getUpdateMask() { return updateMaskBuilder_.getMessage(); } } + /** * * @@ -840,13 +805,14 @@ public Builder setUpdateMask(com.google.protobuf.FieldMask value) { throw new NullPointerException(); } updateMask_ = value; - onChanged(); } else { updateMaskBuilder_.setMessage(value); } - + bitField0_ |= 0x00000002; + onChanged(); return this; } + /** * * @@ -864,13 +830,14 @@ public Builder setUpdateMask(com.google.protobuf.FieldMask value) { public Builder setUpdateMask(com.google.protobuf.FieldMask.Builder builderForValue) { if (updateMaskBuilder_ == null) { updateMask_ = builderForValue.build(); - onChanged(); } else { updateMaskBuilder_.setMessage(builderForValue.build()); } - + bitField0_ |= 0x00000002; + onChanged(); return this; } + /** * * @@ -887,19 +854,23 @@ public Builder setUpdateMask(com.google.protobuf.FieldMask.Builder builderForVal */ public Builder mergeUpdateMask(com.google.protobuf.FieldMask value) { if (updateMaskBuilder_ == null) { - if (updateMask_ != null) { - updateMask_ = - com.google.protobuf.FieldMask.newBuilder(updateMask_).mergeFrom(value).buildPartial(); + if (((bitField0_ & 0x00000002) != 0) + && updateMask_ != null + && updateMask_ != com.google.protobuf.FieldMask.getDefaultInstance()) { + getUpdateMaskBuilder().mergeFrom(value); } else { updateMask_ = value; } - onChanged(); } else { updateMaskBuilder_.mergeFrom(value); } - + if (updateMask_ != null) { + bitField0_ |= 0x00000002; + onChanged(); + } return this; } + /** * * @@ -915,16 +886,16 @@ public Builder mergeUpdateMask(com.google.protobuf.FieldMask value) { * */ public Builder clearUpdateMask() { - if (updateMaskBuilder_ == null) { - updateMask_ = null; - onChanged(); - } else { - updateMask_ = null; + bitField0_ = (bitField0_ & ~0x00000002); + updateMask_ = null; + if (updateMaskBuilder_ != null) { + updateMaskBuilder_.dispose(); updateMaskBuilder_ = null; } - + onChanged(); return this; } + /** * * @@ -940,10 +911,11 @@ public Builder clearUpdateMask() { * */ public com.google.protobuf.FieldMask.Builder getUpdateMaskBuilder() { - + bitField0_ |= 0x00000002; onChanged(); - return getUpdateMaskFieldBuilder().getBuilder(); + return internalGetUpdateMaskFieldBuilder().getBuilder(); } + /** * * @@ -967,6 +939,7 @@ public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { : updateMask_; } } + /** * * @@ -981,14 +954,14 @@ public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; * */ - private com.google.protobuf.SingleFieldBuilderV3< + private com.google.protobuf.SingleFieldBuilder< com.google.protobuf.FieldMask, com.google.protobuf.FieldMask.Builder, com.google.protobuf.FieldMaskOrBuilder> - getUpdateMaskFieldBuilder() { + internalGetUpdateMaskFieldBuilder() { if (updateMaskBuilder_ == null) { updateMaskBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< + new com.google.protobuf.SingleFieldBuilder< com.google.protobuf.FieldMask, com.google.protobuf.FieldMask.Builder, com.google.protobuf.FieldMaskOrBuilder>( @@ -998,17 +971,6 @@ public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { return updateMaskBuilder_; } - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - // @@protoc_insertion_point(builder_scope:google.pubsub.v1.UpdateTopicRequest) } @@ -1030,7 +992,18 @@ public UpdateTopicRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new UpdateTopicRequest(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/UpdateTopicRequestOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/UpdateTopicRequestOrBuilder.java index c65735f57..180f0b5b0 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/UpdateTopicRequestOrBuilder.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/UpdateTopicRequestOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/pubsub.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; +@com.google.protobuf.Generated public interface UpdateTopicRequestOrBuilder extends // @@protoc_insertion_point(interface_extends:google.pubsub.v1.UpdateTopicRequest) @@ -35,6 +38,7 @@ public interface UpdateTopicRequestOrBuilder * @return Whether the topic field is set. */ boolean hasTopic(); + /** * * @@ -47,6 +51,7 @@ public interface UpdateTopicRequestOrBuilder * @return The topic. */ com.google.pubsub.v1.Topic getTopic(); + /** * * @@ -75,6 +80,7 @@ public interface UpdateTopicRequestOrBuilder * @return Whether the updateMask field is set. */ boolean hasUpdateMask(); + /** * * @@ -92,6 +98,7 @@ public interface UpdateTopicRequestOrBuilder * @return The updateMask. */ com.google.protobuf.FieldMask getUpdateMask(); + /** * * diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ValidateMessageRequest.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ValidateMessageRequest.java index d1a77c968..2acb3165e 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ValidateMessageRequest.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ValidateMessageRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/schema.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; @@ -27,13 +29,25 @@ * * Protobuf type {@code google.pubsub.v1.ValidateMessageRequest} */ -public final class ValidateMessageRequest extends com.google.protobuf.GeneratedMessageV3 +@com.google.protobuf.Generated +public final class ValidateMessageRequest extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:google.pubsub.v1.ValidateMessageRequest) ValidateMessageRequestOrBuilder { private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "ValidateMessageRequest"); + } + // Use ValidateMessageRequest.newBuilder() to construct. - private ValidateMessageRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + private ValidateMessageRequest(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); } @@ -43,102 +57,13 @@ private ValidateMessageRequest() { encoding_ = 0; } - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new ValidateMessageRequest(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - private ValidateMessageRequest( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - java.lang.String s = input.readStringRequireUtf8(); - - parent_ = s; - break; - } - case 18: - { - java.lang.String s = input.readStringRequireUtf8(); - schemaSpecCase_ = 2; - schemaSpec_ = s; - break; - } - case 26: - { - com.google.pubsub.v1.Schema.Builder subBuilder = null; - if (schemaSpecCase_ == 3) { - subBuilder = ((com.google.pubsub.v1.Schema) schemaSpec_).toBuilder(); - } - schemaSpec_ = - input.readMessage(com.google.pubsub.v1.Schema.parser(), extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom((com.google.pubsub.v1.Schema) schemaSpec_); - schemaSpec_ = subBuilder.buildPartial(); - } - schemaSpecCase_ = 3; - break; - } - case 34: - { - message_ = input.readBytes(); - break; - } - case 40: - { - int rawValue = input.readEnum(); - - encoding_ = rawValue; - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.pubsub.v1.SchemaProto .internal_static_google_pubsub_v1_ValidateMessageRequest_descriptor; } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.SchemaProto .internal_static_google_pubsub_v1_ValidateMessageRequest_fieldAccessorTable @@ -148,6 +73,8 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } private int schemaSpecCase_ = 0; + + @SuppressWarnings("serial") private java.lang.Object schemaSpec_; public enum SchemaSpecCase @@ -162,6 +89,7 @@ public enum SchemaSpecCase private SchemaSpecCase(int value) { this.value = value; } + /** * @param value The number of the enum to look for. * @return The enum associated with the given number. @@ -195,7 +123,10 @@ public SchemaSpecCase getSchemaSpecCase() { } public static final int PARENT_FIELD_NUMBER = 1; - private volatile java.lang.Object parent_; + + @SuppressWarnings("serial") + private volatile java.lang.Object parent_ = ""; + /** * * @@ -222,6 +153,7 @@ public java.lang.String getParent() { return s; } } + /** * * @@ -250,11 +182,13 @@ public com.google.protobuf.ByteString getParentBytes() { } public static final int NAME_FIELD_NUMBER = 2; + /** * * *
        * Name of the schema against which to validate.
    +   *
        * Format is `projects/{project}/schemas/{schema}`.
        * 
    * @@ -265,11 +199,13 @@ public com.google.protobuf.ByteString getParentBytes() { public boolean hasName() { return schemaSpecCase_ == 2; } + /** * * *
        * Name of the schema against which to validate.
    +   *
        * Format is `projects/{project}/schemas/{schema}`.
        * 
    * @@ -293,11 +229,13 @@ public java.lang.String getName() { return s; } } + /** * * *
        * Name of the schema against which to validate.
    +   *
        * Format is `projects/{project}/schemas/{schema}`.
        * 
    * @@ -323,6 +261,7 @@ public com.google.protobuf.ByteString getNameBytes() { } public static final int SCHEMA_FIELD_NUMBER = 3; + /** * * @@ -338,6 +277,7 @@ public com.google.protobuf.ByteString getNameBytes() { public boolean hasSchema() { return schemaSpecCase_ == 3; } + /** * * @@ -356,6 +296,7 @@ public com.google.pubsub.v1.Schema getSchema() { } return com.google.pubsub.v1.Schema.getDefaultInstance(); } + /** * * @@ -374,7 +315,8 @@ public com.google.pubsub.v1.SchemaOrBuilder getSchemaOrBuilder() { } public static final int MESSAGE_FIELD_NUMBER = 4; - private com.google.protobuf.ByteString message_; + private com.google.protobuf.ByteString message_ = com.google.protobuf.ByteString.EMPTY; + /** * * @@ -392,7 +334,8 @@ public com.google.protobuf.ByteString getMessage() { } public static final int ENCODING_FIELD_NUMBER = 5; - private int encoding_; + private int encoding_ = 0; + /** * * @@ -408,6 +351,7 @@ public com.google.protobuf.ByteString getMessage() { public int getEncodingValue() { return encoding_; } + /** * * @@ -421,8 +365,7 @@ public int getEncodingValue() { */ @java.lang.Override public com.google.pubsub.v1.Encoding getEncoding() { - @SuppressWarnings("deprecation") - com.google.pubsub.v1.Encoding result = com.google.pubsub.v1.Encoding.valueOf(encoding_); + com.google.pubsub.v1.Encoding result = com.google.pubsub.v1.Encoding.forNumber(encoding_); return result == null ? com.google.pubsub.v1.Encoding.UNRECOGNIZED : result; } @@ -440,11 +383,11 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!getParentBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(parent_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, parent_); } if (schemaSpecCase_ == 2) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 2, schemaSpec_); + com.google.protobuf.GeneratedMessage.writeString(output, 2, schemaSpec_); } if (schemaSpecCase_ == 3) { output.writeMessage(3, (com.google.pubsub.v1.Schema) schemaSpec_); @@ -455,7 +398,7 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io if (encoding_ != com.google.pubsub.v1.Encoding.ENCODING_UNSPECIFIED.getNumber()) { output.writeEnum(5, encoding_); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -464,11 +407,11 @@ public int getSerializedSize() { if (size != -1) return size; size = 0; - if (!getParentBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(parent_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, parent_); } if (schemaSpecCase_ == 2) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, schemaSpec_); + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, schemaSpec_); } if (schemaSpecCase_ == 3) { size += @@ -481,7 +424,7 @@ public int getSerializedSize() { if (encoding_ != com.google.pubsub.v1.Encoding.ENCODING_UNSPECIFIED.getNumber()) { size += com.google.protobuf.CodedOutputStream.computeEnumSize(5, encoding_); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -511,7 +454,7 @@ public boolean equals(final java.lang.Object obj) { case 0: default: } - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -540,7 +483,7 @@ public int hashCode() { case 0: default: } - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -582,38 +525,38 @@ public static com.google.pubsub.v1.ValidateMessageRequest parseFrom( public static com.google.pubsub.v1.ValidateMessageRequest parseFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.ValidateMessageRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.ValidateMessageRequest parseDelimitedFrom( java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); } public static com.google.pubsub.v1.ValidateMessageRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.ValidateMessageRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.ValidateMessageRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } @@ -636,10 +579,11 @@ public Builder toBuilder() { } @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** * * @@ -649,7 +593,7 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build * * Protobuf type {@code google.pubsub.v1.ValidateMessageRequest} */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements // @@protoc_insertion_point(builder_implements:google.pubsub.v1.ValidateMessageRequest) com.google.pubsub.v1.ValidateMessageRequestOrBuilder { @@ -659,7 +603,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.SchemaProto .internal_static_google_pubsub_v1_ValidateMessageRequest_fieldAccessorTable @@ -669,28 +613,22 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } // Construct using com.google.pubsub.v1.ValidateMessageRequest.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } + private Builder() {} - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} } @java.lang.Override public Builder clear() { super.clear(); + bitField0_ = 0; parent_ = ""; - + if (schemaBuilder_ != null) { + schemaBuilder_.clear(); + } message_ = com.google.protobuf.ByteString.EMPTY; - encoding_ = 0; - schemaSpecCase_ = 0; schemaSpec_ = null; return this; @@ -720,55 +658,33 @@ public com.google.pubsub.v1.ValidateMessageRequest build() { public com.google.pubsub.v1.ValidateMessageRequest buildPartial() { com.google.pubsub.v1.ValidateMessageRequest result = new com.google.pubsub.v1.ValidateMessageRequest(this); - result.parent_ = parent_; - if (schemaSpecCase_ == 2) { - result.schemaSpec_ = schemaSpec_; - } - if (schemaSpecCase_ == 3) { - if (schemaBuilder_ == null) { - result.schemaSpec_ = schemaSpec_; - } else { - result.schemaSpec_ = schemaBuilder_.build(); - } + if (bitField0_ != 0) { + buildPartial0(result); } - result.message_ = message_; - result.encoding_ = encoding_; - result.schemaSpecCase_ = schemaSpecCase_; + buildPartialOneofs(result); onBuilt(); return result; } - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); + private void buildPartial0(com.google.pubsub.v1.ValidateMessageRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.parent_ = parent_; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.message_ = message_; + } + if (((from_bitField0_ & 0x00000010) != 0)) { + result.encoding_ = encoding_; + } } - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); + private void buildPartialOneofs(com.google.pubsub.v1.ValidateMessageRequest result) { + result.schemaSpecCase_ = schemaSpecCase_; + result.schemaSpec_ = this.schemaSpec_; + if (schemaSpecCase_ == 3 && schemaBuilder_ != null) { + result.schemaSpec_ = schemaBuilder_.build(); + } } @java.lang.Override @@ -785,9 +701,10 @@ public Builder mergeFrom(com.google.pubsub.v1.ValidateMessageRequest other) { if (other == com.google.pubsub.v1.ValidateMessageRequest.getDefaultInstance()) return this; if (!other.getParent().isEmpty()) { parent_ = other.parent_; + bitField0_ |= 0x00000001; onChanged(); } - if (other.getMessage() != com.google.protobuf.ByteString.EMPTY) { + if (!other.getMessage().isEmpty()) { setMessage(other.getMessage()); } if (other.encoding_ != 0) { @@ -811,7 +728,7 @@ public Builder mergeFrom(com.google.pubsub.v1.ValidateMessageRequest other) { break; } } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -826,17 +743,62 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.pubsub.v1.ValidateMessageRequest parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + parent_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + schemaSpecCase_ = 2; + schemaSpec_ = s; + break; + } // case 18 + case 26: + { + input.readMessage(internalGetSchemaFieldBuilder().getBuilder(), extensionRegistry); + schemaSpecCase_ = 3; + break; + } // case 26 + case 34: + { + message_ = input.readBytes(); + bitField0_ |= 0x00000008; + break; + } // case 34 + case 40: + { + encoding_ = input.readEnum(); + bitField0_ |= 0x00000010; + break; + } // case 40 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.google.pubsub.v1.ValidateMessageRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } @@ -854,7 +816,10 @@ public Builder clearSchemaSpec() { return this; } + private int bitField0_; + private java.lang.Object parent_ = ""; + /** * * @@ -880,6 +845,7 @@ public java.lang.String getParent() { return (java.lang.String) ref; } } + /** * * @@ -905,6 +871,7 @@ public com.google.protobuf.ByteString getParentBytes() { return (com.google.protobuf.ByteString) ref; } } + /** * * @@ -924,11 +891,12 @@ public Builder setParent(java.lang.String value) { if (value == null) { throw new NullPointerException(); } - parent_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } + /** * * @@ -944,11 +912,12 @@ public Builder setParent(java.lang.String value) { * @return This builder for chaining. */ public Builder clearParent() { - parent_ = getDefaultInstance().getParent(); + bitField0_ = (bitField0_ & ~0x00000001); onChanged(); return this; } + /** * * @@ -969,8 +938,8 @@ public Builder setParentBytes(com.google.protobuf.ByteString value) { throw new NullPointerException(); } checkByteStringIsUtf8(value); - parent_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } @@ -980,6 +949,7 @@ public Builder setParentBytes(com.google.protobuf.ByteString value) { * *
          * Name of the schema against which to validate.
    +     *
          * Format is `projects/{project}/schemas/{schema}`.
          * 
    * @@ -991,11 +961,13 @@ public Builder setParentBytes(com.google.protobuf.ByteString value) { public boolean hasName() { return schemaSpecCase_ == 2; } + /** * * *
          * Name of the schema against which to validate.
    +     *
          * Format is `projects/{project}/schemas/{schema}`.
          * 
    * @@ -1020,11 +992,13 @@ public java.lang.String getName() { return (java.lang.String) ref; } } + /** * * *
          * Name of the schema against which to validate.
    +     *
          * Format is `projects/{project}/schemas/{schema}`.
          * 
    * @@ -1049,11 +1023,13 @@ public com.google.protobuf.ByteString getNameBytes() { return (com.google.protobuf.ByteString) ref; } } + /** * * *
          * Name of the schema against which to validate.
    +     *
          * Format is `projects/{project}/schemas/{schema}`.
          * 
    * @@ -1071,11 +1047,13 @@ public Builder setName(java.lang.String value) { onChanged(); return this; } + /** * * *
          * Name of the schema against which to validate.
    +     *
          * Format is `projects/{project}/schemas/{schema}`.
          * 
    * @@ -1091,11 +1069,13 @@ public Builder clearName() { } return this; } + /** * * *
          * Name of the schema against which to validate.
    +     *
          * Format is `projects/{project}/schemas/{schema}`.
          * 
    * @@ -1115,11 +1095,12 @@ public Builder setNameBytes(com.google.protobuf.ByteString value) { return this; } - private com.google.protobuf.SingleFieldBuilderV3< + private com.google.protobuf.SingleFieldBuilder< com.google.pubsub.v1.Schema, com.google.pubsub.v1.Schema.Builder, com.google.pubsub.v1.SchemaOrBuilder> schemaBuilder_; + /** * * @@ -1135,6 +1116,7 @@ public Builder setNameBytes(com.google.protobuf.ByteString value) { public boolean hasSchema() { return schemaSpecCase_ == 3; } + /** * * @@ -1160,6 +1142,7 @@ public com.google.pubsub.v1.Schema getSchema() { return com.google.pubsub.v1.Schema.getDefaultInstance(); } } + /** * * @@ -1182,6 +1165,7 @@ public Builder setSchema(com.google.pubsub.v1.Schema value) { schemaSpecCase_ = 3; return this; } + /** * * @@ -1201,6 +1185,7 @@ public Builder setSchema(com.google.pubsub.v1.Schema.Builder builderForValue) { schemaSpecCase_ = 3; return this; } + /** * * @@ -1225,12 +1210,14 @@ public Builder mergeSchema(com.google.pubsub.v1.Schema value) { } else { if (schemaSpecCase_ == 3) { schemaBuilder_.mergeFrom(value); + } else { + schemaBuilder_.setMessage(value); } - schemaBuilder_.setMessage(value); } schemaSpecCase_ = 3; return this; } + /** * * @@ -1256,6 +1243,7 @@ public Builder clearSchema() { } return this; } + /** * * @@ -1266,8 +1254,9 @@ public Builder clearSchema() { * .google.pubsub.v1.Schema schema = 3; */ public com.google.pubsub.v1.Schema.Builder getSchemaBuilder() { - return getSchemaFieldBuilder().getBuilder(); + return internalGetSchemaFieldBuilder().getBuilder(); } + /** * * @@ -1288,6 +1277,7 @@ public com.google.pubsub.v1.SchemaOrBuilder getSchemaOrBuilder() { return com.google.pubsub.v1.Schema.getDefaultInstance(); } } + /** * * @@ -1297,17 +1287,17 @@ public com.google.pubsub.v1.SchemaOrBuilder getSchemaOrBuilder() { * * .google.pubsub.v1.Schema schema = 3; */ - private com.google.protobuf.SingleFieldBuilderV3< + private com.google.protobuf.SingleFieldBuilder< com.google.pubsub.v1.Schema, com.google.pubsub.v1.Schema.Builder, com.google.pubsub.v1.SchemaOrBuilder> - getSchemaFieldBuilder() { + internalGetSchemaFieldBuilder() { if (schemaBuilder_ == null) { if (!(schemaSpecCase_ == 3)) { schemaSpec_ = com.google.pubsub.v1.Schema.getDefaultInstance(); } schemaBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< + new com.google.protobuf.SingleFieldBuilder< com.google.pubsub.v1.Schema, com.google.pubsub.v1.Schema.Builder, com.google.pubsub.v1.SchemaOrBuilder>( @@ -1316,11 +1306,11 @@ public com.google.pubsub.v1.SchemaOrBuilder getSchemaOrBuilder() { } schemaSpecCase_ = 3; onChanged(); - ; return schemaBuilder_; } private com.google.protobuf.ByteString message_ = com.google.protobuf.ByteString.EMPTY; + /** * * @@ -1336,6 +1326,7 @@ public com.google.pubsub.v1.SchemaOrBuilder getSchemaOrBuilder() { public com.google.protobuf.ByteString getMessage() { return message_; } + /** * * @@ -1352,11 +1343,12 @@ public Builder setMessage(com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } - message_ = value; + bitField0_ |= 0x00000008; onChanged(); return this; } + /** * * @@ -1369,13 +1361,14 @@ public Builder setMessage(com.google.protobuf.ByteString value) { * @return This builder for chaining. */ public Builder clearMessage() { - + bitField0_ = (bitField0_ & ~0x00000008); message_ = getDefaultInstance().getMessage(); onChanged(); return this; } private int encoding_ = 0; + /** * * @@ -1391,6 +1384,7 @@ public Builder clearMessage() { public int getEncodingValue() { return encoding_; } + /** * * @@ -1404,11 +1398,12 @@ public int getEncodingValue() { * @return This builder for chaining. */ public Builder setEncodingValue(int value) { - encoding_ = value; + bitField0_ |= 0x00000010; onChanged(); return this; } + /** * * @@ -1422,10 +1417,10 @@ public Builder setEncodingValue(int value) { */ @java.lang.Override public com.google.pubsub.v1.Encoding getEncoding() { - @SuppressWarnings("deprecation") - com.google.pubsub.v1.Encoding result = com.google.pubsub.v1.Encoding.valueOf(encoding_); + com.google.pubsub.v1.Encoding result = com.google.pubsub.v1.Encoding.forNumber(encoding_); return result == null ? com.google.pubsub.v1.Encoding.UNRECOGNIZED : result; } + /** * * @@ -1442,11 +1437,12 @@ public Builder setEncoding(com.google.pubsub.v1.Encoding value) { if (value == null) { throw new NullPointerException(); } - + bitField0_ |= 0x00000010; encoding_ = value.getNumber(); onChanged(); return this; } + /** * * @@ -1459,23 +1455,12 @@ public Builder setEncoding(com.google.pubsub.v1.Encoding value) { * @return This builder for chaining. */ public Builder clearEncoding() { - + bitField0_ = (bitField0_ & ~0x00000010); encoding_ = 0; onChanged(); return this; } - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - // @@protoc_insertion_point(builder_scope:google.pubsub.v1.ValidateMessageRequest) } @@ -1497,7 +1482,18 @@ public ValidateMessageRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new ValidateMessageRequest(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ValidateMessageRequestOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ValidateMessageRequestOrBuilder.java index f2c3968c0..5f00d2f91 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ValidateMessageRequestOrBuilder.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ValidateMessageRequestOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/schema.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; +@com.google.protobuf.Generated public interface ValidateMessageRequestOrBuilder extends // @@protoc_insertion_point(interface_extends:google.pubsub.v1.ValidateMessageRequest) @@ -38,6 +41,7 @@ public interface ValidateMessageRequestOrBuilder * @return The parent. */ java.lang.String getParent(); + /** * * @@ -59,6 +63,7 @@ public interface ValidateMessageRequestOrBuilder * *
        * Name of the schema against which to validate.
    +   *
        * Format is `projects/{project}/schemas/{schema}`.
        * 
    * @@ -67,11 +72,13 @@ public interface ValidateMessageRequestOrBuilder * @return Whether the name field is set. */ boolean hasName(); + /** * * *
        * Name of the schema against which to validate.
    +   *
        * Format is `projects/{project}/schemas/{schema}`.
        * 
    * @@ -80,11 +87,13 @@ public interface ValidateMessageRequestOrBuilder * @return The name. */ java.lang.String getName(); + /** * * *
        * Name of the schema against which to validate.
    +   *
        * Format is `projects/{project}/schemas/{schema}`.
        * 
    * @@ -106,6 +115,7 @@ public interface ValidateMessageRequestOrBuilder * @return Whether the schema field is set. */ boolean hasSchema(); + /** * * @@ -118,6 +128,7 @@ public interface ValidateMessageRequestOrBuilder * @return The schema. */ com.google.pubsub.v1.Schema getSchema(); + /** * * @@ -154,6 +165,7 @@ public interface ValidateMessageRequestOrBuilder * @return The enum numeric value on the wire for encoding. */ int getEncodingValue(); + /** * * @@ -167,5 +179,5 @@ public interface ValidateMessageRequestOrBuilder */ com.google.pubsub.v1.Encoding getEncoding(); - public com.google.pubsub.v1.ValidateMessageRequest.SchemaSpecCase getSchemaSpecCase(); + com.google.pubsub.v1.ValidateMessageRequest.SchemaSpecCase getSchemaSpecCase(); } diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ValidateMessageResponse.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ValidateMessageResponse.java index 1b5fd13b0..559ef7b70 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ValidateMessageResponse.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ValidateMessageResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/schema.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; @@ -23,69 +25,34 @@ * *
      * Response for the `ValidateMessage` method.
    + * Empty for now.
      * 
    * * Protobuf type {@code google.pubsub.v1.ValidateMessageResponse} */ -public final class ValidateMessageResponse extends com.google.protobuf.GeneratedMessageV3 +@com.google.protobuf.Generated +public final class ValidateMessageResponse extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:google.pubsub.v1.ValidateMessageResponse) ValidateMessageResponseOrBuilder { private static final long serialVersionUID = 0L; - // Use ValidateMessageResponse.newBuilder() to construct. - private ValidateMessageResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - private ValidateMessageResponse() {} - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new ValidateMessageResponse(); + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "ValidateMessageResponse"); } - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; + // Use ValidateMessageResponse.newBuilder() to construct. + private ValidateMessageResponse(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); } - private ValidateMessageResponse( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } + private ValidateMessageResponse() {} public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.pubsub.v1.SchemaProto @@ -93,7 +60,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.SchemaProto .internal_static_google_pubsub_v1_ValidateMessageResponse_fieldAccessorTable @@ -116,7 +83,7 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -125,7 +92,7 @@ public int getSerializedSize() { if (size != -1) return size; size = 0; - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -141,7 +108,7 @@ public boolean equals(final java.lang.Object obj) { com.google.pubsub.v1.ValidateMessageResponse other = (com.google.pubsub.v1.ValidateMessageResponse) obj; - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -152,7 +119,7 @@ public int hashCode() { } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -194,38 +161,38 @@ public static com.google.pubsub.v1.ValidateMessageResponse parseFrom( public static com.google.pubsub.v1.ValidateMessageResponse parseFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.ValidateMessageResponse parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.ValidateMessageResponse parseDelimitedFrom( java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); } public static com.google.pubsub.v1.ValidateMessageResponse parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.ValidateMessageResponse parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.ValidateMessageResponse parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } @@ -248,20 +215,22 @@ public Builder toBuilder() { } @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** * * *
        * Response for the `ValidateMessage` method.
    +   * Empty for now.
        * 
    * * Protobuf type {@code google.pubsub.v1.ValidateMessageResponse} */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements // @@protoc_insertion_point(builder_implements:google.pubsub.v1.ValidateMessageResponse) com.google.pubsub.v1.ValidateMessageResponseOrBuilder { @@ -271,7 +240,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.SchemaProto .internal_static_google_pubsub_v1_ValidateMessageResponse_fieldAccessorTable @@ -281,17 +250,10 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } // Construct using com.google.pubsub.v1.ValidateMessageResponse.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } + private Builder() {} - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} } @java.lang.Override @@ -328,39 +290,6 @@ public com.google.pubsub.v1.ValidateMessageResponse buildPartial() { return result; } - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); - } - @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.google.pubsub.v1.ValidateMessageResponse) { @@ -373,7 +302,7 @@ public Builder mergeFrom(com.google.protobuf.Message other) { public Builder mergeFrom(com.google.pubsub.v1.ValidateMessageResponse other) { if (other == com.google.pubsub.v1.ValidateMessageResponse.getDefaultInstance()) return this; - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -388,31 +317,34 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.pubsub.v1.ValidateMessageResponse parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.google.pubsub.v1.ValidateMessageResponse) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - // @@protoc_insertion_point(builder_scope:google.pubsub.v1.ValidateMessageResponse) } @@ -434,7 +366,18 @@ public ValidateMessageResponse parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new ValidateMessageResponse(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ValidateMessageResponseOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ValidateMessageResponseOrBuilder.java index e8be64dc7..387ce625e 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ValidateMessageResponseOrBuilder.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ValidateMessageResponseOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/schema.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; +@com.google.protobuf.Generated public interface ValidateMessageResponseOrBuilder extends // @@protoc_insertion_point(interface_extends:google.pubsub.v1.ValidateMessageResponse) diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ValidateSchemaRequest.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ValidateSchemaRequest.java index 631fca4ef..27199f5c1 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ValidateSchemaRequest.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ValidateSchemaRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/schema.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; @@ -27,13 +29,25 @@ * * Protobuf type {@code google.pubsub.v1.ValidateSchemaRequest} */ -public final class ValidateSchemaRequest extends com.google.protobuf.GeneratedMessageV3 +@com.google.protobuf.Generated +public final class ValidateSchemaRequest extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:google.pubsub.v1.ValidateSchemaRequest) ValidateSchemaRequestOrBuilder { private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "ValidateSchemaRequest"); + } + // Use ValidateSchemaRequest.newBuilder() to construct. - private ValidateSchemaRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + private ValidateSchemaRequest(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); } @@ -41,82 +55,13 @@ private ValidateSchemaRequest() { parent_ = ""; } - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new ValidateSchemaRequest(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - private ValidateSchemaRequest( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - java.lang.String s = input.readStringRequireUtf8(); - - parent_ = s; - break; - } - case 18: - { - com.google.pubsub.v1.Schema.Builder subBuilder = null; - if (schema_ != null) { - subBuilder = schema_.toBuilder(); - } - schema_ = input.readMessage(com.google.pubsub.v1.Schema.parser(), extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(schema_); - schema_ = subBuilder.buildPartial(); - } - - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.pubsub.v1.SchemaProto .internal_static_google_pubsub_v1_ValidateSchemaRequest_descriptor; } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.SchemaProto .internal_static_google_pubsub_v1_ValidateSchemaRequest_fieldAccessorTable @@ -125,8 +70,12 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { com.google.pubsub.v1.ValidateSchemaRequest.Builder.class); } + private int bitField0_; public static final int PARENT_FIELD_NUMBER = 1; - private volatile java.lang.Object parent_; + + @SuppressWarnings("serial") + private volatile java.lang.Object parent_ = ""; + /** * * @@ -153,6 +102,7 @@ public java.lang.String getParent() { return s; } } + /** * * @@ -182,6 +132,7 @@ public com.google.protobuf.ByteString getParentBytes() { public static final int SCHEMA_FIELD_NUMBER = 2; private com.google.pubsub.v1.Schema schema_; + /** * * @@ -195,8 +146,9 @@ public com.google.protobuf.ByteString getParentBytes() { */ @java.lang.Override public boolean hasSchema() { - return schema_ != null; + return ((bitField0_ & 0x00000001) != 0); } + /** * * @@ -212,6 +164,7 @@ public boolean hasSchema() { public com.google.pubsub.v1.Schema getSchema() { return schema_ == null ? com.google.pubsub.v1.Schema.getDefaultInstance() : schema_; } + /** * * @@ -223,7 +176,7 @@ public com.google.pubsub.v1.Schema getSchema() { */ @java.lang.Override public com.google.pubsub.v1.SchemaOrBuilder getSchemaOrBuilder() { - return getSchema(); + return schema_ == null ? com.google.pubsub.v1.Schema.getDefaultInstance() : schema_; } private byte memoizedIsInitialized = -1; @@ -240,13 +193,13 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!getParentBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(parent_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, parent_); } - if (schema_ != null) { + if (((bitField0_ & 0x00000001) != 0)) { output.writeMessage(2, getSchema()); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -255,13 +208,13 @@ public int getSerializedSize() { if (size != -1) return size; size = 0; - if (!getParentBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(parent_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, parent_); } - if (schema_ != null) { + if (((bitField0_ & 0x00000001) != 0)) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getSchema()); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -282,7 +235,7 @@ public boolean equals(final java.lang.Object obj) { if (hasSchema()) { if (!getSchema().equals(other.getSchema())) return false; } - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -299,7 +252,7 @@ public int hashCode() { hash = (37 * hash) + SCHEMA_FIELD_NUMBER; hash = (53 * hash) + getSchema().hashCode(); } - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -341,38 +294,38 @@ public static com.google.pubsub.v1.ValidateSchemaRequest parseFrom( public static com.google.pubsub.v1.ValidateSchemaRequest parseFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.ValidateSchemaRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.ValidateSchemaRequest parseDelimitedFrom( java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); } public static com.google.pubsub.v1.ValidateSchemaRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.ValidateSchemaRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.ValidateSchemaRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } @@ -395,10 +348,11 @@ public Builder toBuilder() { } @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** * * @@ -408,7 +362,7 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build * * Protobuf type {@code google.pubsub.v1.ValidateSchemaRequest} */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements // @@protoc_insertion_point(builder_implements:google.pubsub.v1.ValidateSchemaRequest) com.google.pubsub.v1.ValidateSchemaRequestOrBuilder { @@ -418,7 +372,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.SchemaProto .internal_static_google_pubsub_v1_ValidateSchemaRequest_fieldAccessorTable @@ -432,24 +386,25 @@ private Builder() { maybeForceBuilderInitialization(); } - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + internalGetSchemaFieldBuilder(); + } } @java.lang.Override public Builder clear() { super.clear(); + bitField0_ = 0; parent_ = ""; - - if (schemaBuilder_ == null) { - schema_ = null; - } else { - schema_ = null; + schema_ = null; + if (schemaBuilder_ != null) { + schemaBuilder_.dispose(); schemaBuilder_ = null; } return this; @@ -479,47 +434,24 @@ public com.google.pubsub.v1.ValidateSchemaRequest build() { public com.google.pubsub.v1.ValidateSchemaRequest buildPartial() { com.google.pubsub.v1.ValidateSchemaRequest result = new com.google.pubsub.v1.ValidateSchemaRequest(this); - result.parent_ = parent_; - if (schemaBuilder_ == null) { - result.schema_ = schema_; - } else { - result.schema_ = schemaBuilder_.build(); + if (bitField0_ != 0) { + buildPartial0(result); } onBuilt(); return result; } - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); + private void buildPartial0(com.google.pubsub.v1.ValidateSchemaRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.parent_ = parent_; + } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000002) != 0)) { + result.schema_ = schemaBuilder_ == null ? schema_ : schemaBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + result.bitField0_ |= to_bitField0_; } @java.lang.Override @@ -536,12 +468,13 @@ public Builder mergeFrom(com.google.pubsub.v1.ValidateSchemaRequest other) { if (other == com.google.pubsub.v1.ValidateSchemaRequest.getDefaultInstance()) return this; if (!other.getParent().isEmpty()) { parent_ = other.parent_; + bitField0_ |= 0x00000001; onChanged(); } if (other.hasSchema()) { mergeSchema(other.getSchema()); } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -556,21 +489,50 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.pubsub.v1.ValidateSchemaRequest parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + parent_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + input.readMessage(internalGetSchemaFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.google.pubsub.v1.ValidateSchemaRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } + private int bitField0_; + private java.lang.Object parent_ = ""; + /** * * @@ -596,6 +558,7 @@ public java.lang.String getParent() { return (java.lang.String) ref; } } + /** * * @@ -621,6 +584,7 @@ public com.google.protobuf.ByteString getParentBytes() { return (com.google.protobuf.ByteString) ref; } } + /** * * @@ -640,11 +604,12 @@ public Builder setParent(java.lang.String value) { if (value == null) { throw new NullPointerException(); } - parent_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } + /** * * @@ -660,11 +625,12 @@ public Builder setParent(java.lang.String value) { * @return This builder for chaining. */ public Builder clearParent() { - parent_ = getDefaultInstance().getParent(); + bitField0_ = (bitField0_ & ~0x00000001); onChanged(); return this; } + /** * * @@ -685,18 +651,19 @@ public Builder setParentBytes(com.google.protobuf.ByteString value) { throw new NullPointerException(); } checkByteStringIsUtf8(value); - parent_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } private com.google.pubsub.v1.Schema schema_; - private com.google.protobuf.SingleFieldBuilderV3< + private com.google.protobuf.SingleFieldBuilder< com.google.pubsub.v1.Schema, com.google.pubsub.v1.Schema.Builder, com.google.pubsub.v1.SchemaOrBuilder> schemaBuilder_; + /** * * @@ -709,8 +676,9 @@ public Builder setParentBytes(com.google.protobuf.ByteString value) { * @return Whether the schema field is set. */ public boolean hasSchema() { - return schemaBuilder_ != null || schema_ != null; + return ((bitField0_ & 0x00000002) != 0); } + /** * * @@ -729,6 +697,7 @@ public com.google.pubsub.v1.Schema getSchema() { return schemaBuilder_.getMessage(); } } + /** * * @@ -744,13 +713,14 @@ public Builder setSchema(com.google.pubsub.v1.Schema value) { throw new NullPointerException(); } schema_ = value; - onChanged(); } else { schemaBuilder_.setMessage(value); } - + bitField0_ |= 0x00000002; + onChanged(); return this; } + /** * * @@ -763,13 +733,14 @@ public Builder setSchema(com.google.pubsub.v1.Schema value) { public Builder setSchema(com.google.pubsub.v1.Schema.Builder builderForValue) { if (schemaBuilder_ == null) { schema_ = builderForValue.build(); - onChanged(); } else { schemaBuilder_.setMessage(builderForValue.build()); } - + bitField0_ |= 0x00000002; + onChanged(); return this; } + /** * * @@ -781,18 +752,23 @@ public Builder setSchema(com.google.pubsub.v1.Schema.Builder builderForValue) { */ public Builder mergeSchema(com.google.pubsub.v1.Schema value) { if (schemaBuilder_ == null) { - if (schema_ != null) { - schema_ = com.google.pubsub.v1.Schema.newBuilder(schema_).mergeFrom(value).buildPartial(); + if (((bitField0_ & 0x00000002) != 0) + && schema_ != null + && schema_ != com.google.pubsub.v1.Schema.getDefaultInstance()) { + getSchemaBuilder().mergeFrom(value); } else { schema_ = value; } - onChanged(); } else { schemaBuilder_.mergeFrom(value); } - + if (schema_ != null) { + bitField0_ |= 0x00000002; + onChanged(); + } return this; } + /** * * @@ -803,16 +779,16 @@ public Builder mergeSchema(com.google.pubsub.v1.Schema value) { * .google.pubsub.v1.Schema schema = 2 [(.google.api.field_behavior) = REQUIRED]; */ public Builder clearSchema() { - if (schemaBuilder_ == null) { - schema_ = null; - onChanged(); - } else { - schema_ = null; + bitField0_ = (bitField0_ & ~0x00000002); + schema_ = null; + if (schemaBuilder_ != null) { + schemaBuilder_.dispose(); schemaBuilder_ = null; } - + onChanged(); return this; } + /** * * @@ -823,10 +799,11 @@ public Builder clearSchema() { * .google.pubsub.v1.Schema schema = 2 [(.google.api.field_behavior) = REQUIRED]; */ public com.google.pubsub.v1.Schema.Builder getSchemaBuilder() { - + bitField0_ |= 0x00000002; onChanged(); - return getSchemaFieldBuilder().getBuilder(); + return internalGetSchemaFieldBuilder().getBuilder(); } + /** * * @@ -843,6 +820,7 @@ public com.google.pubsub.v1.SchemaOrBuilder getSchemaOrBuilder() { return schema_ == null ? com.google.pubsub.v1.Schema.getDefaultInstance() : schema_; } } + /** * * @@ -852,14 +830,14 @@ public com.google.pubsub.v1.SchemaOrBuilder getSchemaOrBuilder() { * * .google.pubsub.v1.Schema schema = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private com.google.protobuf.SingleFieldBuilderV3< + private com.google.protobuf.SingleFieldBuilder< com.google.pubsub.v1.Schema, com.google.pubsub.v1.Schema.Builder, com.google.pubsub.v1.SchemaOrBuilder> - getSchemaFieldBuilder() { + internalGetSchemaFieldBuilder() { if (schemaBuilder_ == null) { schemaBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< + new com.google.protobuf.SingleFieldBuilder< com.google.pubsub.v1.Schema, com.google.pubsub.v1.Schema.Builder, com.google.pubsub.v1.SchemaOrBuilder>( @@ -869,17 +847,6 @@ public com.google.pubsub.v1.SchemaOrBuilder getSchemaOrBuilder() { return schemaBuilder_; } - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - // @@protoc_insertion_point(builder_scope:google.pubsub.v1.ValidateSchemaRequest) } @@ -901,7 +868,18 @@ public ValidateSchemaRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new ValidateSchemaRequest(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ValidateSchemaRequestOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ValidateSchemaRequestOrBuilder.java index 2c972155f..3ec527a91 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ValidateSchemaRequestOrBuilder.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ValidateSchemaRequestOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/schema.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; +@com.google.protobuf.Generated public interface ValidateSchemaRequestOrBuilder extends // @@protoc_insertion_point(interface_extends:google.pubsub.v1.ValidateSchemaRequest) @@ -38,6 +41,7 @@ public interface ValidateSchemaRequestOrBuilder * @return The parent. */ java.lang.String getParent(); + /** * * @@ -66,6 +70,7 @@ public interface ValidateSchemaRequestOrBuilder * @return Whether the schema field is set. */ boolean hasSchema(); + /** * * @@ -78,6 +83,7 @@ public interface ValidateSchemaRequestOrBuilder * @return The schema. */ com.google.pubsub.v1.Schema getSchema(); + /** * * diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ValidateSchemaResponse.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ValidateSchemaResponse.java index 2f8a70f0d..dda69a413 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ValidateSchemaResponse.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ValidateSchemaResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/schema.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; @@ -23,69 +25,34 @@ * *
      * Response for the `ValidateSchema` method.
    + * Empty for now.
      * 
    * * Protobuf type {@code google.pubsub.v1.ValidateSchemaResponse} */ -public final class ValidateSchemaResponse extends com.google.protobuf.GeneratedMessageV3 +@com.google.protobuf.Generated +public final class ValidateSchemaResponse extends com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:google.pubsub.v1.ValidateSchemaResponse) ValidateSchemaResponseOrBuilder { private static final long serialVersionUID = 0L; - // Use ValidateSchemaResponse.newBuilder() to construct. - private ValidateSchemaResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - private ValidateSchemaResponse() {} - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new ValidateSchemaResponse(); + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 2, + /* suffix= */ "", + "ValidateSchemaResponse"); } - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; + // Use ValidateSchemaResponse.newBuilder() to construct. + private ValidateSchemaResponse(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); } - private ValidateSchemaResponse( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } + private ValidateSchemaResponse() {} public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.pubsub.v1.SchemaProto @@ -93,7 +60,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.SchemaProto .internal_static_google_pubsub_v1_ValidateSchemaResponse_fieldAccessorTable @@ -116,7 +83,7 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -125,7 +92,7 @@ public int getSerializedSize() { if (size != -1) return size; size = 0; - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -141,7 +108,7 @@ public boolean equals(final java.lang.Object obj) { com.google.pubsub.v1.ValidateSchemaResponse other = (com.google.pubsub.v1.ValidateSchemaResponse) obj; - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -152,7 +119,7 @@ public int hashCode() { } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -194,38 +161,38 @@ public static com.google.pubsub.v1.ValidateSchemaResponse parseFrom( public static com.google.pubsub.v1.ValidateSchemaResponse parseFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.ValidateSchemaResponse parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.ValidateSchemaResponse parseDelimitedFrom( java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); } public static com.google.pubsub.v1.ValidateSchemaResponse parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.pubsub.v1.ValidateSchemaResponse parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); } public static com.google.pubsub.v1.ValidateSchemaResponse parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + return com.google.protobuf.GeneratedMessage.parseWithIOException( PARSER, input, extensionRegistry); } @@ -248,20 +215,22 @@ public Builder toBuilder() { } @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } + /** * * *
        * Response for the `ValidateSchema` method.
    +   * Empty for now.
        * 
    * * Protobuf type {@code google.pubsub.v1.ValidateSchemaResponse} */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements // @@protoc_insertion_point(builder_implements:google.pubsub.v1.ValidateSchemaResponse) com.google.pubsub.v1.ValidateSchemaResponseOrBuilder { @@ -271,7 +240,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.pubsub.v1.SchemaProto .internal_static_google_pubsub_v1_ValidateSchemaResponse_fieldAccessorTable @@ -281,17 +250,10 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } // Construct using com.google.pubsub.v1.ValidateSchemaResponse.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } + private Builder() {} - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} } @java.lang.Override @@ -328,39 +290,6 @@ public com.google.pubsub.v1.ValidateSchemaResponse buildPartial() { return result; } - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); - } - @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.google.pubsub.v1.ValidateSchemaResponse) { @@ -373,7 +302,7 @@ public Builder mergeFrom(com.google.protobuf.Message other) { public Builder mergeFrom(com.google.pubsub.v1.ValidateSchemaResponse other) { if (other == com.google.pubsub.v1.ValidateSchemaResponse.getDefaultInstance()) return this; - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -388,31 +317,34 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.google.pubsub.v1.ValidateSchemaResponse parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.google.pubsub.v1.ValidateSchemaResponse) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - // @@protoc_insertion_point(builder_scope:google.pubsub.v1.ValidateSchemaResponse) } @@ -434,7 +366,18 @@ public ValidateSchemaResponse parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new ValidateSchemaResponse(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ValidateSchemaResponseOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ValidateSchemaResponseOrBuilder.java index 9e8467fc1..cae8fc5fb 100644 --- a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ValidateSchemaResponseOrBuilder.java +++ b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ValidateSchemaResponseOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE // source: google/pubsub/v1/schema.proto +// Protobuf Java Version: 4.33.2 package com.google.pubsub.v1; +@com.google.protobuf.Generated public interface ValidateSchemaResponseOrBuilder extends // @@protoc_insertion_point(interface_extends:google.pubsub.v1.ValidateSchemaResponse) 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 9bc678e3a..382343c6a 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 @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -23,17 +23,25 @@ import "google/api/resource.proto"; import "google/protobuf/duration.proto"; import "google/protobuf/empty.proto"; import "google/protobuf/field_mask.proto"; +import "google/protobuf/struct.proto"; import "google/protobuf/timestamp.proto"; import "google/pubsub/v1/schema.proto"; -option cc_enable_arenas = true; option csharp_namespace = "Google.Cloud.PubSub.V1"; -option go_package = "google.golang.org/genproto/googleapis/pubsub/v1;pubsub"; +option go_package = "cloud.google.com/go/pubsub/v2/apiv1/pubsubpb;pubsubpb"; option java_multiple_files = true; 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. @@ -44,7 +52,7 @@ service Publisher { "https://www.googleapis.com/auth/pubsub"; // Creates the given topic with the given name. See the [resource name rules] - // (https://cloud.google.com/pubsub/docs/admin#resource_names). + // (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). rpc CreateTopic(Topic) returns (Topic) { option (google.api.http) = { put: "/v1/{name=projects/*/topics/*}" @@ -53,13 +61,14 @@ service Publisher { option (google.api.method_signature) = "name"; } - // Updates an existing topic. Note that certain properties of a - // topic are not modifiable. + // Updates an existing topic by updating the fields specified in the update + // mask. Note that certain properties of a topic are not modifiable. rpc UpdateTopic(UpdateTopicRequest) returns (Topic) { option (google.api.http) = { patch: "/v1/{topic.name=projects/*/topics/*}" body: "*" }; + option (google.api.method_signature) = "topic,update_mask"; } // Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic @@ -136,12 +145,21 @@ service Publisher { // A policy constraining the storage of messages published to the topic. message MessageStoragePolicy { - // A list of IDs of GCP regions where messages that are published to the topic - // may be persisted in storage. Messages published by publishers running in - // non-allowed GCP regions (or running outside of GCP altogether) will be - // routed for storage in one of the allowed regions. An empty list means that - // no regions are allowed, and is not a valid configuration. - repeated string allowed_persistence_regions = 1; + // Optional. A list of IDs of Google Cloud regions where messages that are + // published to the topic may be persisted in storage. Messages published by + // publishers running in non-allowed Google Cloud regions (or running outside + // of Google Cloud altogether) are routed for storage in one of the allowed + // regions. An empty list means that no regions are allowed, and is not a + // valid configuration. + repeated string allowed_persistence_regions = 1 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If true, `allowed_persistence_regions` is also used to enforce + // in-transit guarantees for messages. That is, Pub/Sub will fail + // Publish operations on this topic and subscribe operations + // on any subscription attached to this topic in any region that is + // not in `allowed_persistence_regions`. + bool enforce_in_transit = 2 [(google.api.field_behavior) = OPTIONAL]; } // Settings for validating messages published against a schema. @@ -155,8 +173,693 @@ message SchemaSettings { (google.api.resource_reference) = { type: "pubsub.googleapis.com/Schema" } ]; - // The encoding of messages validated against `schema`. - Encoding encoding = 2; + // Optional. The encoding of messages validated against `schema`. + Encoding encoding = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The minimum (inclusive) revision allowed for validating messages. + // If empty or not present, allow any revision to be validated against + // last_revision or any revision created before. + string first_revision_id = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The maximum (inclusive) revision allowed for validating messages. + // If empty or not present, allow any revision to be validated against + // first_revision or any revision created after. + string last_revision_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Settings for an ingestion data source on a topic. +message IngestionDataSourceSettings { + // Ingestion settings for Amazon Kinesis Data Streams. + message AwsKinesis { + // Possible states for ingestion from Amazon Kinesis Data Streams. + enum State { + // Default value. This value is unused. + STATE_UNSPECIFIED = 0; + + // Ingestion is active. + ACTIVE = 1; + + // Permission denied encountered while consuming data from Kinesis. + // This can happen if: + // - The provided `aws_role_arn` does not exist or does not have the + // appropriate permissions attached. + // - The provided `aws_role_arn` is not set up properly for Identity + // Federation using `gcp_service_account`. + // - The Pub/Sub SA is not granted the + // `iam.serviceAccounts.getOpenIdToken` permission on + // `gcp_service_account`. + KINESIS_PERMISSION_DENIED = 2; + + // Permission denied encountered while publishing to the topic. This can + // happen if the Pub/Sub SA has not been granted the [appropriate publish + // permissions](https://cloud.google.com/pubsub/docs/access-control#pubsub.publisher) + PUBLISH_PERMISSION_DENIED = 3; + + // The Kinesis stream does not exist. + STREAM_NOT_FOUND = 4; + + // The Kinesis consumer does not exist. + CONSUMER_NOT_FOUND = 5; + } + + // Output only. An output-only field that indicates the state of the Kinesis + // ingestion source. + State state = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. The Kinesis stream ARN to ingest data from. + string stream_arn = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The Kinesis consumer ARN to used for ingestion in Enhanced + // Fan-Out mode. The consumer must be already created and ready to be used. + string consumer_arn = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. AWS role ARN to be used for Federated Identity authentication + // with Kinesis. Check the Pub/Sub docs for how to set up this role and the + // required permissions that need to be attached to it. + string aws_role_arn = 4 [(google.api.field_behavior) = REQUIRED]; + + // Required. The GCP service account to be used for Federated Identity + // authentication with Kinesis (via a `AssumeRoleWithWebIdentity` call for + // the provided role). The `aws_role_arn` must be set up with + // `accounts.google.com:sub` equals to this service account number. + string gcp_service_account = 5 [(google.api.field_behavior) = REQUIRED]; + } + + // Ingestion settings for Cloud Storage. + message CloudStorage { + // Possible states for ingestion from Cloud Storage. + enum State { + // Default value. This value is unused. + STATE_UNSPECIFIED = 0; + + // Ingestion is active. + ACTIVE = 1; + + // Permission denied encountered while calling the Cloud Storage API. This + // can happen if the Pub/Sub SA has not been granted the + // [appropriate + // permissions](https://cloud.google.com/storage/docs/access-control/iam-permissions): + // - storage.objects.list: to list the objects in a bucket. + // - storage.objects.get: to read the objects in a bucket. + // - storage.buckets.get: to verify the bucket exists. + CLOUD_STORAGE_PERMISSION_DENIED = 2; + + // Permission denied encountered while publishing to the topic. This can + // happen if the Pub/Sub SA has not been granted the [appropriate publish + // permissions](https://cloud.google.com/pubsub/docs/access-control#pubsub.publisher) + PUBLISH_PERMISSION_DENIED = 3; + + // The provided Cloud Storage bucket doesn't exist. + BUCKET_NOT_FOUND = 4; + + // The Cloud Storage bucket has too many objects, ingestion will be + // paused. + TOO_MANY_OBJECTS = 5; + } + + // Configuration for reading Cloud Storage data in text format. Each line of + // text as specified by the delimiter will be set to the `data` field of a + // Pub/Sub message. + message TextFormat { + // Optional. When unset, '\n' is used. + optional string delimiter = 1 [(google.api.field_behavior) = OPTIONAL]; + } + + // Configuration for reading Cloud Storage data in Avro binary format. The + // bytes of each object will be set to the `data` field of a Pub/Sub + // message. + message AvroFormat {} + + // Configuration for reading Cloud Storage data written via [Cloud Storage + // subscriptions](https://cloud.google.com/pubsub/docs/cloudstorage). The + // data and attributes fields of the originally exported Pub/Sub message + // will be restored when publishing. + message PubSubAvroFormat {} + + // Output only. An output-only field that indicates the state of the Cloud + // Storage ingestion source. + State state = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Cloud Storage bucket. The bucket name must be without any + // prefix like "gs://". See the [bucket naming requirements] + // (https://cloud.google.com/storage/docs/buckets#naming). + string bucket = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Defaults to text format. + oneof input_format { + // Optional. Data from Cloud Storage will be interpreted as text. + TextFormat text_format = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Data from Cloud Storage will be interpreted in Avro format. + AvroFormat avro_format = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. It will be assumed data from Cloud Storage was written via + // [Cloud Storage + // subscriptions](https://cloud.google.com/pubsub/docs/cloudstorage). + PubSubAvroFormat pubsub_avro_format = 5 + [(google.api.field_behavior) = OPTIONAL]; + } + + // Optional. Only objects with a larger or equal creation timestamp will be + // ingested. + google.protobuf.Timestamp minimum_object_create_time = 6 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Glob pattern used to match objects that will be ingested. If + // unset, all objects will be ingested. See the [supported + // patterns](https://cloud.google.com/storage/docs/json_api/v1/objects/list#list-objects-and-prefixes-using-glob). + string match_glob = 9 [(google.api.field_behavior) = OPTIONAL]; + } + + // Ingestion settings for Azure Event Hubs. + message AzureEventHubs { + // Possible states for managed ingestion from Event Hubs. + enum State { + // Default value. This value is unused. + STATE_UNSPECIFIED = 0; + + // Ingestion is active. + ACTIVE = 1; + + // Permission denied encountered while consuming data from Event Hubs. + // This can happen when `client_id`, or `tenant_id` are invalid. Or the + // right permissions haven't been granted. + EVENT_HUBS_PERMISSION_DENIED = 2; + + // Permission denied encountered while publishing to the topic. + PUBLISH_PERMISSION_DENIED = 3; + + // The provided Event Hubs namespace couldn't be found. + NAMESPACE_NOT_FOUND = 4; + + // The provided Event Hub couldn't be found. + EVENT_HUB_NOT_FOUND = 5; + + // The provided Event Hubs subscription couldn't be found. + SUBSCRIPTION_NOT_FOUND = 6; + + // The provided Event Hubs resource group couldn't be found. + RESOURCE_GROUP_NOT_FOUND = 7; + } + + // Output only. An output-only field that indicates the state of the Event + // Hubs ingestion source. + State state = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Name of the resource group within the azure subscription. + string resource_group = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The name of the Event Hubs namespace. + string namespace = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The name of the Event Hub. + string event_hub = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The client id of the Azure application that is being used to + // authenticate Pub/Sub. + string client_id = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The tenant id of the Azure application that is being used to + // authenticate Pub/Sub. + string tenant_id = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The Azure subscription id. + string subscription_id = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The GCP service account to be used for Federated Identity + // authentication. + string gcp_service_account = 8 [(google.api.field_behavior) = OPTIONAL]; + } + + // Ingestion settings for Amazon MSK. + message AwsMsk { + // Possible states for managed ingestion from Amazon MSK. + enum State { + // Default value. This value is unused. + STATE_UNSPECIFIED = 0; + + // Ingestion is active. + ACTIVE = 1; + + // Permission denied encountered while consuming data from Amazon MSK. + MSK_PERMISSION_DENIED = 2; + + // Permission denied encountered while publishing to the topic. + PUBLISH_PERMISSION_DENIED = 3; + + // The provided MSK cluster wasn't found. + CLUSTER_NOT_FOUND = 4; + + // The provided topic wasn't found. + TOPIC_NOT_FOUND = 5; + } + + // Output only. An output-only field that indicates the state of the Amazon + // MSK ingestion source. + State state = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. The Amazon Resource Name (ARN) that uniquely identifies the + // cluster. + string cluster_arn = 2 [(google.api.field_behavior) = REQUIRED]; + + // 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, + (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 + // the required permissions that need to be attached to it. + string aws_role_arn = 4 [(google.api.field_behavior) = REQUIRED]; + + // Required. The GCP service account to be used for Federated Identity + // authentication with Amazon MSK (via a `AssumeRoleWithWebIdentity` call + // for the provided role). The `aws_role_arn` must be set up with + // `accounts.google.com:sub` equals to this service account number. + string gcp_service_account = 5 [(google.api.field_behavior) = REQUIRED]; + } + + // Ingestion settings for Confluent Cloud. + message ConfluentCloud { + // Possible states for managed ingestion from Confluent Cloud. + enum State { + // Default value. This value is unused. + STATE_UNSPECIFIED = 0; + + // Ingestion is active. + ACTIVE = 1; + + // Permission denied encountered while consuming data from Confluent + // Cloud. + CONFLUENT_CLOUD_PERMISSION_DENIED = 2; + + // Permission denied encountered while publishing to the topic. + PUBLISH_PERMISSION_DENIED = 3; + + // The provided bootstrap server address is unreachable. + UNREACHABLE_BOOTSTRAP_SERVER = 4; + + // The provided cluster wasn't found. + CLUSTER_NOT_FOUND = 5; + + // The provided topic wasn't found. + TOPIC_NOT_FOUND = 6; + } + + // Output only. An output-only field that indicates the state of the + // Confluent Cloud ingestion source. + State state = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. The address of the bootstrap server. The format is url:port. + string bootstrap_server = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The id of the cluster. + string cluster_id = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. The name of the topic in the Confluent Cloud cluster that + // Pub/Sub will import from. + string topic = 4 [(google.api.field_behavior) = REQUIRED]; + + // Required. The id of the identity pool to be used for Federated Identity + // authentication with Confluent Cloud. See + // https://docs.confluent.io/cloud/current/security/authenticate/workload-identities/identity-providers/oauth/identity-pools.html#add-oauth-identity-pools. + string identity_pool_id = 5 [(google.api.field_behavior) = REQUIRED]; + + // Required. The GCP service account to be used for Federated Identity + // authentication with `identity_pool_id`. + string gcp_service_account = 6 [(google.api.field_behavior) = REQUIRED]; + } + + // Only one source type can have settings set. + oneof source { + // Optional. Amazon Kinesis Data Streams. + AwsKinesis aws_kinesis = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Cloud Storage. + CloudStorage cloud_storage = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Azure Event Hubs. + AzureEventHubs azure_event_hubs = 3 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Amazon MSK. + AwsMsk aws_msk = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Confluent Cloud. + ConfluentCloud confluent_cloud = 6 [(google.api.field_behavior) = OPTIONAL]; + } + + // Optional. Platform Logs settings. If unset, no Platform Logs will be + // generated. + PlatformLogsSettings platform_logs_settings = 4 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Settings for Platform Logs produced by Pub/Sub. +message PlatformLogsSettings { + // Severity levels of Platform Logs. + enum Severity { + // Default value. Logs level is unspecified. Logs will be disabled. + SEVERITY_UNSPECIFIED = 0; + + // Logs will be disabled. + DISABLED = 1; + + // Debug logs and higher-severity logs will be written. + DEBUG = 2; + + // Info logs and higher-severity logs will be written. + INFO = 3; + + // Warning logs and higher-severity logs will be written. + WARNING = 4; + + // Only error logs will be written. + ERROR = 5; + } + + // Optional. The minimum severity level of Platform Logs that will be written. + Severity severity = 1 [(google.api.field_behavior) = OPTIONAL]; +} + +// Payload of the Platform Log entry sent when a failure is encountered while +// ingesting. +message IngestionFailureEvent { + // Specifies the reason why some data may have been left out of + // the desired Pub/Sub message due to the API message limits + // (https://cloud.google.com/pubsub/quotas#resource_limits). For example, + // when the number of attributes is larger than 100, the number of + // attributes is truncated to 100 to respect the limit on the attribute count. + // Other attribute limits are treated similarly. When the size of the desired + // message would've been larger than 10MB, the message won't be published at + // all, and ingestion of the subsequent messages will proceed as normal. + message ApiViolationReason {} + + // Set when an Avro file is unsupported or its format is not valid. When this + // occurs, one or more Avro objects won't be ingested. + message AvroFailureReason {} + + // Set when a Pub/Sub message fails to get published due to a schema + // validation violation. + message SchemaViolationReason {} + + // Set when a Pub/Sub message fails to get published due to a message + // transformation error. + message MessageTransformationFailureReason {} + + // Failure when ingesting from a Cloud Storage source. + message CloudStorageFailure { + // Optional. Name of the Cloud Storage bucket used for ingestion. + string bucket = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Name of the Cloud Storage object which contained the section + // that couldn't be ingested. + string object_name = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Generation of the Cloud Storage object which contained the + // section that couldn't be ingested. + int64 object_generation = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Reason why ingestion failed for the specified object. + oneof reason { + // Optional. Failure encountered when parsing an Avro file. + AvroFailureReason avro_failure_reason = 5 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The Pub/Sub API limits prevented the desired message from + // being published. + ApiViolationReason api_violation_reason = 6 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The Pub/Sub message failed schema validation. + SchemaViolationReason schema_violation_reason = 7 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Failure encountered when applying a message transformation to + // the Pub/Sub message. + MessageTransformationFailureReason message_transformation_failure_reason = + 8 [(google.api.field_behavior) = OPTIONAL]; + } + } + + // Failure when ingesting from an Amazon MSK source. + message AwsMskFailureReason { + // Optional. The ARN of the cluster of the topic being ingested from. + string cluster_arn = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The name of the Kafka topic being ingested from. + string kafka_topic = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The partition ID of the message that failed to be ingested. + int64 partition_id = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The offset within the partition of the message that failed to + // be ingested. + int64 offset = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Reason why ingestion failed for the specified message. + oneof reason { + // Optional. The Pub/Sub API limits prevented the desired message from + // being published. + ApiViolationReason api_violation_reason = 5 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The Pub/Sub message failed schema validation. + SchemaViolationReason schema_violation_reason = 6 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Failure encountered when applying a message transformation to + // the Pub/Sub message. + MessageTransformationFailureReason message_transformation_failure_reason = + 7 [(google.api.field_behavior) = OPTIONAL]; + } + } + + // Failure when ingesting from an Azure Event Hubs source. + message AzureEventHubsFailureReason { + // Optional. The namespace containing the event hub being ingested from. + string namespace = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The name of the event hub being ingested from. + string event_hub = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The partition ID of the message that failed to be ingested. + int64 partition_id = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The offset within the partition of the message that failed to + // be ingested. + int64 offset = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Reason why ingestion failed for the specified message. + oneof reason { + // Optional. The Pub/Sub API limits prevented the desired message from + // being published. + ApiViolationReason api_violation_reason = 5 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The Pub/Sub message failed schema validation. + SchemaViolationReason schema_violation_reason = 6 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Failure encountered when applying a message transformation to + // the Pub/Sub message. + MessageTransformationFailureReason message_transformation_failure_reason = + 7 [(google.api.field_behavior) = OPTIONAL]; + } + } + + // Failure when ingesting from a Confluent Cloud source. + message ConfluentCloudFailureReason { + // Optional. The cluster ID containing the topic being ingested from. + string cluster_id = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The name of the Kafka topic being ingested from. + string kafka_topic = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The partition ID of the message that failed to be ingested. + int64 partition_id = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The offset within the partition of the message that failed to + // be ingested. + int64 offset = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Reason why ingestion failed for the specified message. + oneof reason { + // Optional. The Pub/Sub API limits prevented the desired message from + // being published. + ApiViolationReason api_violation_reason = 5 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The Pub/Sub message failed schema validation. + SchemaViolationReason schema_violation_reason = 6 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Failure encountered when applying a message transformation to + // the Pub/Sub message. + MessageTransformationFailureReason message_transformation_failure_reason = + 7 [(google.api.field_behavior) = OPTIONAL]; + } + } + + // Failure when ingesting from an AWS Kinesis source. + message AwsKinesisFailureReason { + // Optional. The stream ARN of the Kinesis stream being ingested from. + string stream_arn = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The partition key of the message that failed to be ingested. + string partition_key = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The sequence number of the message that failed to be ingested. + string sequence_number = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Reason why ingestion failed for the specified message. + oneof reason { + // Optional. The Pub/Sub message failed schema validation. + SchemaViolationReason schema_violation_reason = 4 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Failure encountered when applying a message transformation to + // 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, + (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]; + + oneof failure { + // Optional. Failure when ingesting from Cloud Storage. + CloudStorageFailure cloud_storage_failure = 3 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Failure when ingesting from Amazon MSK. + AwsMskFailureReason aws_msk_failure = 4 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Failure when ingesting from Azure Event Hubs. + AzureEventHubsFailureReason azure_event_hubs_failure = 5 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Failure when ingesting from Confluent Cloud. + ConfluentCloudFailureReason confluent_cloud_failure = 6 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Failure when ingesting from AWS Kinesis. + AwsKinesisFailureReason aws_kinesis_failure = 7 + [(google.api.field_behavior) = OPTIONAL]; + } +} + +// User-defined JavaScript function that can transform or filter a Pub/Sub +// message. +message JavaScriptUDF { + // Required. Name of the JavasScript function that should applied to Pub/Sub + // messages. + string function_name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. JavaScript code that contains a function `function_name` with the + // below signature: + // + // ``` + // /** + // * Transforms a Pub/Sub message. + // + // * @return {(Object)>|null)} - To + // * filter a message, return `null`. To transform a message return a map + // * with the following keys: + // * - (required) 'data' : {string} + // * - (optional) 'attributes' : {Object} + // * Returning empty `attributes` will remove all attributes from the + // * message. + // * + // * @param {(Object)>} Pub/Sub + // * message. Keys: + // * - (required) 'data' : {string} + // * - (required) 'attributes' : {Object} + // * + // * @param {Object} metadata - Pub/Sub message metadata. + // * Keys: + // * - (optional) 'message_id' : {string} + // * - (optional) 'publish_time': {string} YYYY-MM-DDTHH:MM:SSZ format + // * - (optional) 'ordering_key': {string} + // */ + // + // function (message, metadata) { + // } + // ``` + string code = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Configuration for making inference requests against Vertex AI models. +message AIInference { + // Configuration for making inferences using arbitrary JSON payloads. + message UnstructuredInference { + // Optional. A parameters object to be included in each inference request. + // The parameters object is combined with the data field of the Pub/Sub + // message to form the inference request. + google.protobuf.Struct parameters = 1 + [(google.api.field_behavior) = OPTIONAL]; + } + + // Required. An endpoint to a Vertex AI model of the form + // `projects/{project}/locations/{location}/endpoints/{endpoint}` or + // `projects/{project}/locations/{location}/publishers/{publisher}/models/{model}`. + // Vertex AI API requests will be sent to this endpoint. + string endpoint = 1 [(google.api.field_behavior) = REQUIRED]; + + // The format of inference requests made to the endpoint. + oneof inference_mode { + // Optional. Requests and responses can be any arbitrary JSON object. + UnstructuredInference unstructured_inference = 2 + [(google.api.field_behavior) = OPTIONAL]; + } + + // Optional. The service account to use to make prediction requests against + // endpoints. The resource creator or updater that specifies this field must + // have `iam.serviceAccounts.actAs` permission on the service account. If not + // specified, the Pub/Sub [service + // agent](https://cloud.google.com/iam/docs/service-agents), + // service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used. + string service_account_email = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// All supported message transforms types. +message MessageTransform { + // The type of transform to apply to messages. + oneof transform { + // Optional. JavaScript User Defined Function. If multiple JavaScriptUDF's + // are specified on a resource, each must have a unique `function_name`. + JavaScriptUDF javascript_udf = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. AI Inference. Specifies the Vertex AI endpoint that inference + // requests built from the Pub/Sub message data and provided parameters will + // be sent to. + AIInference ai_inference = 6 [(google.api.field_behavior) = OPTIONAL]; + } + + // Optional. This field is deprecated, use the `disabled` field to disable + // transforms. + bool enabled = 3 [deprecated = true, (google.api.field_behavior) = OPTIONAL]; + + // Optional. If true, the transform is disabled and will not be applied to + // messages. Defaults to `false`. + bool disabled = 4 [(google.api.field_behavior) = OPTIONAL]; } // A topic resource. @@ -165,39 +868,98 @@ message Topic { type: "pubsub.googleapis.com/Topic" pattern: "projects/{project}/topics/{topic}" pattern: "_deleted-topic_" + plural: "topics" + singular: "topic" }; - // Required. The name of the topic. It must have the format + // The state of the topic. + enum State { + // Default value. This value is unused. + STATE_UNSPECIFIED = 0; + + // The topic does not have any persistent errors. + ACTIVE = 1; + + // Ingestion from the data source has encountered a permanent error. + // See the more detailed error state in the corresponding ingestion + // source configuration. + INGESTION_RESOURCE_ERROR = 2; + } + + // Required. Identifier. The name of the topic. It must have the format // `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter, // and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), // underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent // signs (`%`). It must be between 3 and 255 characters in length, and it // must not start with `"goog"`. - string name = 1 [(google.api.field_behavior) = REQUIRED]; + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = IDENTIFIER + ]; - // See [Creating and managing labels] + // Optional. See [Creating and managing labels] // (https://cloud.google.com/pubsub/docs/labels). - map labels = 2; + map labels = 2 [(google.api.field_behavior) = OPTIONAL]; - // Policy constraining the set of Google Cloud Platform regions where messages - // published to the topic may be stored. If not present, then no constraints - // are in effect. - MessageStoragePolicy message_storage_policy = 3; + // Optional. Policy constraining the set of Google Cloud Platform regions + // where messages published to the topic may be stored. If not present, then + // no constraints are in effect. + MessageStoragePolicy message_storage_policy = 3 + [(google.api.field_behavior) = OPTIONAL]; - // The resource name of the Cloud KMS CryptoKey to be used to protect access - // to messages published on this topic. + // Optional. The resource name of the Cloud KMS CryptoKey to be used to + // protect access to messages published on this topic. // // The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`. - string kms_key_name = 5; - - // Settings for validating messages published against a schema. - // - // EXPERIMENTAL: Schema support is in development and may not work yet. - SchemaSettings schema_settings = 6; + string kms_key_name = 5 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKey" + } + ]; - // Reserved for future use. This field is set only in responses from the - // server; it is ignored if it is set in any requests. - bool satisfies_pzs = 7; + // Optional. Settings for validating messages published against a schema. + SchemaSettings schema_settings = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Reserved for future use. This field is set only in responses from + // the server; it is ignored if it is set in any requests. + bool satisfies_pzs = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Indicates the minimum duration to retain a message after it is + // published to the topic. If this field is set, messages published to the + // topic in the last `message_retention_duration` are always available to + // subscribers. For instance, it allows any attached subscription to [seek to + // a + // timestamp](https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time) + // that is up to `message_retention_duration` in the past. If this field is + // not set, message retention is controlled by settings on individual + // subscriptions. Cannot be more than 31 days or less than 10 minutes. + google.protobuf.Duration message_retention_duration = 8 + [(google.api.field_behavior) = OPTIONAL]; + + // Output only. An output-only field indicating the state of the topic. + State state = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Settings for ingestion from a data source into this topic. + IngestionDataSourceSettings ingestion_data_source_settings = 10 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Transforms to be applied to messages published to the 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" + // See https://docs.cloud.google.com/pubsub/docs/tags for more information on + // using tags with Pub/Sub resources. + 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 @@ -209,14 +971,14 @@ message Topic { // (https://cloud.google.com/pubsub/quotas) for more information about message // limits. message PubsubMessage { - // The message data field. If this field is empty, the message must contain - // at least one attribute. - bytes data = 1; + // Optional. The message data field. If this field is empty, the message must + // contain at least one attribute. + bytes data = 1 [(google.api.field_behavior) = OPTIONAL]; - // Attributes for this message. If this field is empty, the message must - // contain non-empty data. This can be used to filter messages on the + // Optional. Attributes for this message. If this field is empty, the message + // must contain non-empty data. This can be used to filter messages on the // subscription. - map attributes = 2; + map attributes = 2 [(google.api.field_behavior) = OPTIONAL]; // ID of this message, assigned by the server when the message is published. // Guaranteed to be unique within the topic. This value may be read by a @@ -229,13 +991,15 @@ message PubsubMessage { // publisher in a `Publish` call. google.protobuf.Timestamp publish_time = 4; - // If non-empty, identifies related messages for which publish order should be - // respected. If a `Subscription` has `enable_message_ordering` set to `true`, - // messages published with the same non-empty `ordering_key` value will be - // delivered to subscribers in the order in which they are received by the - // Pub/Sub system. All `PubsubMessage`s published in a given `PublishRequest` - // must specify the same `ordering_key` value. - string ordering_key = 5; + // Optional. If non-empty, identifies related messages for which publish order + // should be respected. If a `Subscription` has `enable_message_ordering` set + // to `true`, messages published with the same non-empty `ordering_key` value + // will be delivered to subscribers in the order in which they are received by + // the Pub/Sub system. All `PubsubMessage`s published in a given + // `PublishRequest` must specify the same `ordering_key` value. For more + // information, see [ordering + // messages](https://cloud.google.com/pubsub/docs/ordering). + string ordering_key = 5 [(google.api.field_behavior) = OPTIONAL]; } // Request for the GetTopic method. @@ -277,10 +1041,10 @@ message PublishRequest { // Response for the `Publish` method. message PublishResponse { - // The server-assigned ID of each published message, in the same order as - // the messages in the request. IDs are guaranteed to be unique within - // the topic. - repeated string message_ids = 1; + // Optional. The server-assigned ID of each published message, in the same + // order as the messages in the request. IDs are guaranteed to be unique + // within the topic. + repeated string message_ids = 1 [(google.api.field_behavior) = OPTIONAL]; } // Request for the `ListTopics` method. @@ -294,23 +1058,23 @@ message ListTopicsRequest { } ]; - // Maximum number of topics to return. - int32 page_size = 2; + // Optional. Maximum number of topics to return. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - // The value returned by the last `ListTopicsResponse`; indicates that this is - // a continuation of a prior `ListTopics` call, and that the system should - // return the next page of data. - string page_token = 3; + // Optional. The value returned by the last `ListTopicsResponse`; indicates + // that this is a continuation of a prior `ListTopics` call, and that the + // system should return the next page of data. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; } // Response for the `ListTopics` method. message ListTopicsResponse { - // The resulting topics. - repeated Topic topics = 1; + // Optional. The resulting topics. + repeated Topic topics = 1 [(google.api.field_behavior) = OPTIONAL]; - // If not empty, indicates that there may be more topics that match the - // request; this value should be passed in a new `ListTopicsRequest`. - string next_page_token = 2; + // Optional. If not empty, indicates that there may be more topics that match + // the request; this value should be passed in a new `ListTopicsRequest`. + string next_page_token = 2 [(google.api.field_behavior) = OPTIONAL]; } // Request for the `ListTopicSubscriptions` method. @@ -322,26 +1086,30 @@ message ListTopicSubscriptionsRequest { (google.api.resource_reference) = { type: "pubsub.googleapis.com/Topic" } ]; - // Maximum number of subscription names to return. - int32 page_size = 2; + // Optional. Maximum number of subscription names to return. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - // The value returned by the last `ListTopicSubscriptionsResponse`; indicates - // that this is a continuation of a prior `ListTopicSubscriptions` call, and - // that the system should return the next page of data. - string page_token = 3; + // Optional. The value returned by the last `ListTopicSubscriptionsResponse`; + // indicates that this is a continuation of a prior `ListTopicSubscriptions` + // call, and that the system should return the next page of data. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; } // Response for the `ListTopicSubscriptions` method. message ListTopicSubscriptionsResponse { - // The names of subscriptions attached to the topic specified in the request. - repeated string subscriptions = 1 [(google.api.resource_reference) = { - type: "pubsub.googleapis.com/Subscription" - }]; + // Optional. The names of subscriptions attached to the topic specified in the + // request. + repeated string subscriptions = 1 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { + type: "pubsub.googleapis.com/Subscription" + } + ]; - // If not empty, indicates that there may be more subscriptions that match - // the request; this value should be passed in a new + // Optional. If not empty, indicates that there may be more subscriptions that + // match the request; this value should be passed in a new // `ListTopicSubscriptionsRequest` to get more subscriptions. - string next_page_token = 2; + string next_page_token = 2 [(google.api.field_behavior) = OPTIONAL]; } // Request for the `ListTopicSnapshots` method. @@ -353,24 +1121,27 @@ message ListTopicSnapshotsRequest { (google.api.resource_reference) = { type: "pubsub.googleapis.com/Topic" } ]; - // Maximum number of snapshot names to return. - int32 page_size = 2; + // Optional. Maximum number of snapshot names to return. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - // The value returned by the last `ListTopicSnapshotsResponse`; indicates - // that this is a continuation of a prior `ListTopicSnapshots` call, and - // that the system should return the next page of data. - string page_token = 3; + // Optional. The value returned by the last `ListTopicSnapshotsResponse`; + // indicates that this is a continuation of a prior `ListTopicSnapshots` call, + // and that the system should return the next page of data. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; } // Response for the `ListTopicSnapshots` method. message ListTopicSnapshotsResponse { - // The names of the snapshots that match the request. - repeated string snapshots = 1; + // Optional. The names of the snapshots that match the request. + repeated string snapshots = 1 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { type: "pubsub.googleapis.com/Snapshot" } + ]; - // If not empty, indicates that there may be more snapshots that match - // the request; this value should be passed in a new + // Optional. If not empty, indicates that there may be more snapshots that + // match the request; this value should be passed in a new // `ListTopicSnapshotsRequest` to get more snapshots. - string next_page_token = 2; + string next_page_token = 2 [(google.api.field_behavior) = OPTIONAL]; } // Request for the `DeleteTopic` method. @@ -409,16 +1180,16 @@ service Subscriber { "https://www.googleapis.com/auth/pubsub"; // Creates a subscription to a given topic. See the [resource name rules] - // (https://cloud.google.com/pubsub/docs/admin#resource_names). + // (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). // If the subscription already exists, returns `ALREADY_EXISTS`. // If the corresponding topic doesn't exist, returns `NOT_FOUND`. // // If the name is not provided in the request, the server will assign a random // name for this subscription on the same project as the topic, conforming // to the [resource name format] - // (https://cloud.google.com/pubsub/docs/admin#resource_names). The generated - // name is populated in the returned Subscription object. Note that for REST - // API requests, you must specify a name in the request. + // (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). The + // generated name is populated in the returned Subscription object. Note that + // for REST API requests, you must specify a name in the request. rpc CreateSubscription(Subscription) returns (Subscription) { option (google.api.http) = { put: "/v1/{name=projects/*/subscriptions/*}" @@ -436,13 +1207,15 @@ service Subscriber { option (google.api.method_signature) = "subscription"; } - // Updates an existing subscription. Note that certain properties of a - // subscription, such as its topic, are not modifiable. + // Updates an existing subscription by updating the fields specified in the + // update mask. Note that certain properties of a subscription, such as its + // topic, are not modifiable. rpc UpdateSubscription(UpdateSubscriptionRequest) returns (Subscription) { option (google.api.http) = { patch: "/v1/{subscription.name=projects/*/subscriptions/*}" body: "*" }; + option (google.api.method_signature) = "subscription,update_mask"; } // Lists matching subscriptions. @@ -497,9 +1270,7 @@ service Subscriber { option (google.api.method_signature) = "subscription,ack_ids"; } - // Pulls messages from the server. The server may return `UNAVAILABLE` if - // there are too many concurrent pull requests pending for the given - // subscription. + // Pulls messages from the server. rpc Pull(PullRequest) returns (PullResponse) { option (google.api.http) = { post: "/v1/{subscription=projects/*/subscriptions/*}:pull" @@ -507,10 +1278,11 @@ service Subscriber { }; option (google.api.method_signature) = "subscription,return_immediately,max_messages"; + option (google.api.method_signature) = "subscription,max_messages"; } // Establishes a stream with the server, which sends messages down to the - // client. The client streams acknowledgements and ack deadline modifications + // client. The client streams acknowledgments and ack deadline modifications // back to the server. The server will close the stream and return the status // on any error. The server may close the stream with status `UNAVAILABLE` to // reassign server-side resources, in which case, the client should @@ -535,10 +1307,10 @@ service Subscriber { } // Gets the configuration details of a snapshot. Snapshots are used in - // Seek - // operations, which allow you to manage message acknowledgments in bulk. That - // is, you can set the acknowledgment state of messages in an existing - // subscription to the state captured by a snapshot. + // [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, + // which allow you to manage message acknowledgments in bulk. That is, you can + // set the acknowledgment state of messages in an existing subscription to the + // state captured by a snapshot. rpc GetSnapshot(GetSnapshotRequest) returns (Snapshot) { option (google.api.http) = { get: "/v1/{snapshot=projects/*/snapshots/*}" @@ -571,7 +1343,7 @@ service Subscriber { // the request, the server will assign a random // name for this snapshot on the same project as the subscription, conforming // to the [resource name format] - // (https://cloud.google.com/pubsub/docs/admin#resource_names). The + // (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). The // generated name is populated in the returned Snapshot object. Note that for // REST API requests, you must specify a name in the request. rpc CreateSnapshot(CreateSnapshotRequest) returns (Snapshot) { @@ -582,17 +1354,18 @@ service Subscriber { option (google.api.method_signature) = "name,subscription"; } - // Updates an existing snapshot. Snapshots are used in - // Seek - // operations, which allow - // you to manage message acknowledgments in bulk. That is, you can set the - // acknowledgment state of messages in an existing subscription to the state - // captured by a snapshot. + // Updates an existing snapshot by updating the fields specified in the update + // mask. Snapshots are used in + // [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, + // which allow you to manage message acknowledgments in bulk. That is, you can + // set the acknowledgment state of messages in an existing subscription to the + // state captured by a snapshot. rpc UpdateSnapshot(UpdateSnapshotRequest) returns (Snapshot) { option (google.api.http) = { patch: "/v1/{snapshot.name=projects/*/snapshots/*}" body: "*" }; + option (google.api.method_signature) = "snapshot,update_mask"; } // Removes an existing snapshot. Snapshots are used in [Seek] @@ -626,20 +1399,60 @@ service Subscriber { } } -// A subscription resource. +// A subscription resource. If none of `push_config`, `bigquery_config`, or +// `cloud_storage_config` is set, then the subscriber will pull and ack messages +// using API methods. At most one of these fields may be set. message Subscription { option (google.api.resource) = { type: "pubsub.googleapis.com/Subscription" pattern: "projects/{project}/subscriptions/{subscription}" + plural: "subscriptions" + singular: "subscription" }; - // Required. The name of the subscription. It must have the format + // Possible states for a subscription. + enum State { + // Default value. This value is unused. + STATE_UNSPECIFIED = 0; + + // The subscription can actively receive messages + ACTIVE = 1; + + // The subscription cannot receive messages because of an error with the + // resource to which it pushes messages. See the more detailed error state + // in the corresponding configuration. + RESOURCE_ERROR = 2; + } + + // Information about an associated [Analytics Hub + // subscription](https://cloud.google.com/bigquery/docs/analytics-hub-manage-subscriptions). + message AnalyticsHubSubscriptionInfo { + // 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, + (google.api.resource_reference) = { + type: "analyticshub.googleapis.com/Listing" + } + ]; + + // Optional. The name of the associated Analytics Hub subscription resource. + // Pattern: + // "projects/{project}/locations/{location}/subscriptions/{subscription}" + string subscription = 2 [(google.api.field_behavior) = OPTIONAL]; + } + + // Required. Identifier. The name of the subscription. It must have the format // `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must // start with a letter, and contain only letters (`[A-Za-z]`), numbers // (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), // plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters // in length, and it must not start with `"goog"`. - string name = 1 [(google.api.field_behavior) = REQUIRED]; + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = IDENTIFIER + ]; // Required. The name of the topic from which this subscription is receiving // messages. Format is `projects/{project}/topics/{topic}`. The value of this @@ -649,16 +1462,28 @@ message Subscription { (google.api.resource_reference) = { type: "pubsub.googleapis.com/Topic" } ]; - // If push delivery is used with this subscription, this field is - // used to configure it. An empty `pushConfig` signifies that the subscriber - // will pull and ack messages using API methods. - PushConfig push_config = 4; + // Optional. If push delivery is used with this subscription, this field is + // used to configure it. + PushConfig push_config = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If delivery to BigQuery is used with this subscription, this + // field is used to configure it. + BigQueryConfig bigquery_config = 18 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If delivery to Google Cloud Storage is used with this + // subscription, this field is used to configure it. + CloudStorageConfig cloud_storage_config = 22 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If delivery to Bigtable is used with this subscription, this + // field is used to configure it. + BigtableConfig bigtable_config = 27 [(google.api.field_behavior) = OPTIONAL]; - // The approximate amount of time (on a best-effort basis) Pub/Sub waits for - // the subscriber to acknowledge receipt before resending the message. In the - // interval after the message is delivered and before it is acknowledged, it - // is considered to be outstanding. During that time period, the - // message will not be redelivered (on a best-effort basis). + // Optional. The approximate amount of time (on a best-effort basis) Pub/Sub + // waits for the subscriber to acknowledge receipt before resending the + // message. In the interval after the message is delivered and before it is + // acknowledged, it is considered to be _outstanding_. During that time + // period, the message will not be redelivered (on a best-effort basis). // // For pull subscriptions, this value is used as the initial value for the ack // deadline. To override this value for a given message, call @@ -674,94 +1499,151 @@ message Subscription { // // If the subscriber never acknowledges the message, the Pub/Sub // system will eventually redeliver the message. - int32 ack_deadline_seconds = 5; + int32 ack_deadline_seconds = 5 [(google.api.field_behavior) = OPTIONAL]; - // Indicates whether to retain acknowledged messages. If true, then + // Optional. Indicates whether to retain acknowledged messages. If true, then // messages are not expunged from the subscription's backlog, even if they are // acknowledged, until they fall out of the `message_retention_duration` - // window. This must be true if you would like to [Seek to a timestamp] - // (https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time). - bool retain_acked_messages = 7; - - // How long to retain unacknowledged messages in the subscription's backlog, - // from the moment a message is published. - // If `retain_acked_messages` is true, then this also configures the retention - // of acknowledged messages, and thus configures how far back in time a `Seek` - // can be done. Defaults to 7 days. Cannot be more than 7 days or less than 10 - // minutes. - google.protobuf.Duration message_retention_duration = 8; - - // See Creating and - // managing labels. - map labels = 9; - - // If true, messages published with the same `ordering_key` in `PubsubMessage` - // will be delivered to the subscribers in the order in which they - // are received by the Pub/Sub system. Otherwise, they may be delivered in - // any order. - bool enable_message_ordering = 10; - - // A policy that specifies the conditions for this subscription's expiration. - // A subscription is considered active as long as any connected subscriber is - // successfully consuming messages from the subscription or is issuing - // operations on the subscription. If `expiration_policy` is not set, a - // *default policy* with `ttl` of 31 days will be used. The minimum allowed - // value for `expiration_policy.ttl` is 1 day. - ExpirationPolicy expiration_policy = 11; - - // An expression written in the Pub/Sub [filter + // window. This must be true if you would like to [`Seek` to a timestamp] + // (https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time) in + // the past to replay previously-acknowledged messages. + bool retain_acked_messages = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. How long to retain unacknowledged messages in the subscription's + // backlog, from the moment a message is published. If `retain_acked_messages` + // is true, then this also configures the retention of acknowledged messages, + // and thus configures how far back in time a `Seek` can be done. Defaults to + // 7 days. Cannot be more than 31 days or less than 10 minutes. + google.protobuf.Duration message_retention_duration = 8 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. See [Creating and managing + // labels](https://cloud.google.com/pubsub/docs/labels). + map labels = 9 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If true, messages published with the same `ordering_key` in + // `PubsubMessage` will be delivered to the subscribers in the order in which + // they are received by the Pub/Sub system. Otherwise, they may be delivered + // in any order. + bool enable_message_ordering = 10 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A policy that specifies the conditions for this subscription's + // expiration. A subscription is considered active as long as any connected + // subscriber is successfully consuming messages from the subscription or is + // issuing operations on the subscription. If `expiration_policy` is not set, + // a *default policy* with `ttl` of 31 days will be used. The minimum allowed + // value for `expiration_policy.ttl` is 1 day. If `expiration_policy` is set, + // but `expiration_policy.ttl` is not set, the subscription never expires. + ExpirationPolicy expiration_policy = 11 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. An expression written in the Pub/Sub [filter // language](https://cloud.google.com/pubsub/docs/filtering). If non-empty, // then only `PubsubMessage`s whose `attributes` field matches the filter are // delivered on this subscription. If empty, then no messages are filtered // out. - string filter = 12; + string filter = 12 [(google.api.field_behavior) = OPTIONAL]; - // A policy that specifies the conditions for dead lettering messages in - // this subscription. If dead_letter_policy is not set, dead lettering - // is disabled. + // Optional. A policy that specifies the conditions for dead lettering + // messages in this subscription. If dead_letter_policy is not set, dead + // lettering is disabled. // - // The Cloud Pub/Sub service account associated with this subscriptions's + // The Pub/Sub service account associated with this subscriptions's // parent project (i.e., // service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have // permission to Acknowledge() messages on this subscription. - DeadLetterPolicy dead_letter_policy = 13; + DeadLetterPolicy dead_letter_policy = 13 + [(google.api.field_behavior) = OPTIONAL]; - // A policy that specifies how Pub/Sub retries message delivery for this - // subscription. + // Optional. A policy that specifies how Pub/Sub retries message delivery for + // this subscription. // // If not set, the default retry policy is applied. This generally implies // that messages will be retried as soon as possible for healthy subscribers. - // RetryPolicy will be triggered on NACKs or acknowledgement deadline - // exceeded events for a given message. - RetryPolicy retry_policy = 14; + // RetryPolicy will be triggered on NACKs or acknowledgment deadline exceeded + // events for a given message. + RetryPolicy retry_policy = 14 [(google.api.field_behavior) = OPTIONAL]; - // Indicates whether the subscription is detached from its topic. Detached - // subscriptions don't receive messages from their topic and don't retain any - // backlog. `Pull` and `StreamingPull` requests will return + // Optional. Indicates whether the subscription is detached from its topic. + // Detached subscriptions don't receive messages from their topic and don't + // retain any backlog. `Pull` and `StreamingPull` requests will return // FAILED_PRECONDITION. If the subscription is a push subscription, pushes to // the endpoint will not be made. - bool detached = 15; + bool detached = 15 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If true, Pub/Sub provides the following guarantees for the + // delivery of a message with a given value of `message_id` on this + // subscription: + // + // * The message sent to a subscriber is guaranteed not to be resent + // before the message's acknowledgment deadline expires. + // * An acknowledged message will not be resent to a subscriber. + // + // Note that subscribers may still receive multiple copies of a message + // when `enable_exactly_once_delivery` is true if the message was published + // multiple times by a publisher client. These copies are considered distinct + // by Pub/Sub and have distinct `message_id` values. + bool enable_exactly_once_delivery = 16 + [(google.api.field_behavior) = OPTIONAL]; + + // Output only. Indicates the minimum duration for which a message is retained + // after it is published to the subscription's topic. If this field is set, + // messages published to the subscription's topic in the last + // `topic_message_retention_duration` are always available to subscribers. See + // the `message_retention_duration` field in `Topic`. This field is set only + // in responses from the server; it is ignored if it is set in any requests. + google.protobuf.Duration topic_message_retention_duration = 17 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. An output-only field indicating whether or not the + // subscription can receive messages. + State state = 19 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Information about the associated Analytics Hub subscription. + // Only set if the subscription is created by Analytics Hub. + AnalyticsHubSubscriptionInfo analytics_hub_subscription_info = 23 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Transforms to be applied to messages before they are delivered to + // 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" + // See https://docs.cloud.google.com/pubsub/docs/tags for more information on + // using tags with Pub/Sub resources. + map tags = 26 [ + (google.api.field_behavior) = INPUT_ONLY, + (google.api.field_behavior) = IMMUTABLE, + (google.api.field_behavior) = OPTIONAL + ]; } -// A policy that specifies how Cloud Pub/Sub retries message delivery. +// A policy that specifies how Pub/Sub retries message delivery. // // Retry delay will be exponential based on provided minimum and maximum // backoffs. https://en.wikipedia.org/wiki/Exponential_backoff. // -// RetryPolicy will be triggered on NACKs or acknowledgement deadline exceeded +// RetryPolicy will be triggered on NACKs or acknowledgment deadline exceeded // events for a given message. // // Retry Policy is implemented on a best effort basis. At times, the delay // between consecutive deliveries may not match the configuration. That is, // delay can be more or less than configured backoff. message RetryPolicy { - // The minimum delay between consecutive deliveries of a given message. - // Value should be between 0 and 600 seconds. Defaults to 10 seconds. - google.protobuf.Duration minimum_backoff = 1; - - // The maximum delay between consecutive deliveries of a given message. - // Value should be between 0 and 600 seconds. Defaults to 600 seconds. - google.protobuf.Duration maximum_backoff = 2; + // Optional. The minimum delay between consecutive deliveries of a given + // message. Value should be between 0 and 600 seconds. Defaults to 10 seconds. + google.protobuf.Duration minimum_backoff = 1 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The maximum delay between consecutive deliveries of a given + // message. Value should be between 0 and 600 seconds. Defaults to 600 + // seconds. + google.protobuf.Duration maximum_backoff = 2 + [(google.api.field_behavior) = OPTIONAL]; } // Dead lettering is done on a best effort basis. The same message might be @@ -770,22 +1652,25 @@ message RetryPolicy { // If validation on any of the fields fails at subscription creation/updation, // the create/update subscription request will fail. message DeadLetterPolicy { - // The name of the topic to which dead letter messages should be published. - // Format is `projects/{project}/topics/{topic}`.The Cloud Pub/Sub service - // account associated with the enclosing subscription's parent project (i.e., - // service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have - // permission to Publish() to this topic. + // Optional. The name of the topic to which dead letter messages should be + // published. Format is `projects/{project}/topics/{topic}`.The Pub/Sub + // service account associated with the enclosing subscription's parent project + // (i.e., service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must + // have permission to Publish() to this topic. // // 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; + string dead_letter_topic = 1 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { type: "pubsub.googleapis.com/Topic" } + ]; - // The maximum number of delivery attempts for any message. The value must be - // between 5 and 100. + // Optional. The maximum number of delivery attempts for any message. The + // value must be between 5 and 100. // // The number of delivery attempts is defined as 1 + (the sum of number of - // NACKs and number of times the acknowledgement deadline has been exceeded + // NACKs and number of times the acknowledgment deadline has been exceeded // for the message). // // A NACK is any call to ModifyAckDeadline with a 0 deadline. Note that @@ -794,19 +1679,19 @@ message DeadLetterPolicy { // This field will be honored on a best effort basis. // // If this parameter is 0, a default value of 5 is used. - int32 max_delivery_attempts = 2; + int32 max_delivery_attempts = 2 [(google.api.field_behavior) = OPTIONAL]; } // A policy that specifies the conditions for resource expiration (i.e., // automatic resource deletion). message ExpirationPolicy { - // Specifies the "time-to-live" duration for an associated resource. The - // resource expires if it is not active for a period of `ttl`. The definition - // of "activity" depends on the type of the associated resource. The minimum - // and maximum allowed values for `ttl` depend on the type of the associated - // resource, as well. If `ttl` is not set, the associated resource never - // expires. - google.protobuf.Duration ttl = 1; + // Optional. Specifies the "time-to-live" duration for an associated resource. + // The resource expires if it is not active for a period of `ttl`. The + // definition of "activity" depends on the type of the associated resource. + // The minimum and maximum allowed values for `ttl` depend on the type of the + // associated resource, as well. If `ttl` is not set, the associated resource + // never expires. + google.protobuf.Duration ttl = 1 [(google.api.field_behavior) = OPTIONAL]; } // Configuration for a push delivery endpoint. @@ -815,28 +1700,42 @@ message PushConfig { // [OpenID Connect // token](https://developers.google.com/identity/protocols/OpenIDConnect). message OidcToken { - // [Service account + // Optional. [Service account // email](https://cloud.google.com/iam/docs/service-accounts) - // to be used for generating the OIDC token. The caller (for - // CreateSubscription, UpdateSubscription, and ModifyPushConfig RPCs) must - // have the iam.serviceAccounts.actAs permission for the service account. - string service_account_email = 1; - - // Audience to be used when generating OIDC token. The audience claim - // identifies the recipients that the JWT is intended for. The audience - // value is a single case-sensitive string. Having multiple values (array) - // for the audience field is not supported. More info about the OIDC JWT - // token audience here: https://tools.ietf.org/html/rfc7519#section-4.1.3 - // Note: if not specified, the Push endpoint URL will be used. - string audience = 2; + // used for generating the OIDC token. For more information + // on setting up authentication, see + // [Push subscriptions](https://cloud.google.com/pubsub/docs/push). + string service_account_email = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Audience to be used when generating OIDC token. The audience + // claim identifies the recipients that the JWT is intended for. The + // audience value is a single case-sensitive string. Having multiple values + // (array) for the audience field is not supported. More info about the OIDC + // JWT token audience here: + // https://tools.ietf.org/html/rfc7519#section-4.1.3 Note: if not specified, + // the Push endpoint URL will be used. + string audience = 2 [(google.api.field_behavior) = OPTIONAL]; + } + + // The payload to the push endpoint is in the form of the JSON representation + // of a PubsubMessage + // (https://cloud.google.com/pubsub/docs/reference/rpc/google.pubsub.v1#pubsubmessage). + message PubsubWrapper {} + + // Sets the `data` field as the HTTP body for delivery. + message NoWrapper { + // Optional. When true, writes the Pub/Sub message metadata to + // `x-goog-pubsub-:` headers of the HTTP request. Writes the + // Pub/Sub message attributes to `:` headers of the HTTP request. + bool write_metadata = 1 [(google.api.field_behavior) = OPTIONAL]; } - // A URL locating the endpoint to which messages should be pushed. + // Optional. A URL locating the endpoint to which messages should be pushed. // For example, a Webhook endpoint might use `https://example.com/push`. - string push_endpoint = 1; + string push_endpoint = 1 [(google.api.field_behavior) = OPTIONAL]; - // Endpoint configuration attributes that can be used to control different - // aspects of the message delivery. + // Optional. Endpoint configuration attributes that can be used to control + // different aspects of the message delivery. // // The only currently supported attribute is `x-goog-version`, which you can // use to change the format of the pushed message. This attribute @@ -855,31 +1754,308 @@ message PushConfig { // * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API. // // For example: - //
    attributes { "x-goog-version": "v1" } 
    - map attributes = 2; + // `attributes { "x-goog-version": "v1" }` + map attributes = 2 [(google.api.field_behavior) = OPTIONAL]; // An authentication method used by push endpoints to verify the source of // push requests. This can be used with push endpoints that are private by - // default to allow requests only from the Cloud Pub/Sub system, for example. + // default to allow requests only from the Pub/Sub system, for example. // This field is optional and should be set only by users interested in // authenticated push. oneof authentication_method { - // If specified, Pub/Sub will generate and attach an OIDC JWT token as an - // `Authorization` header in the HTTP request for every pushed message. - OidcToken oidc_token = 3; + // Optional. If specified, Pub/Sub will generate and attach an OIDC JWT + // token as an `Authorization` header in the HTTP request for every pushed + // message. + OidcToken oidc_token = 3 [(google.api.field_behavior) = OPTIONAL]; } + + // The format of the delivered message to the push endpoint is defined by + // the chosen wrapper. When unset, `PubsubWrapper` is used. + oneof wrapper { + // Optional. When set, the payload to the push endpoint is in the form of + // the JSON representation of a PubsubMessage + // (https://cloud.google.com/pubsub/docs/reference/rpc/google.pubsub.v1#pubsubmessage). + PubsubWrapper pubsub_wrapper = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. When set, the payload to the push endpoint is not wrapped. + NoWrapper no_wrapper = 5 [(google.api.field_behavior) = OPTIONAL]; + } +} + +// Configuration for a BigQuery subscription. +message BigQueryConfig { + // Possible states for a BigQuery subscription. + enum State { + // Default value. This value is unused. + STATE_UNSPECIFIED = 0; + + // The subscription can actively send messages to BigQuery + ACTIVE = 1; + + // Cannot write to the BigQuery table because of permission denied errors. + // This can happen if + // - Pub/Sub SA has not been granted the [appropriate BigQuery IAM + // permissions](https://cloud.google.com/pubsub/docs/create-subscription#assign_bigquery_service_account) + // - bigquery.googleapis.com API is not enabled for the project + // ([instructions](https://cloud.google.com/service-usage/docs/enable-disable)) + PERMISSION_DENIED = 2; + + // Cannot write to the BigQuery table because it does not exist. + NOT_FOUND = 3; + + // Cannot write to the BigQuery table due to a schema mismatch. + SCHEMA_MISMATCH = 4; + + // Cannot write to the destination because enforce_in_transit is set to true + // and the destination locations are not in the allowed regions. + IN_TRANSIT_LOCATION_RESTRICTION = 5; + + // Cannot write to the BigQuery table because the table is not in the same + // location as where Vertex AI models used in `message_transform`s are + // deployed. + VERTEX_AI_LOCATION_RESTRICTION = 6; + } + + // Optional. The name of the table to which to write data, of the form + // {projectId}.{datasetId}.{tableId} + string table = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. When true, use the topic's schema as the columns to write to in + // BigQuery, if it exists. `use_topic_schema` and `use_table_schema` cannot be + // enabled at the same time. + bool use_topic_schema = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. When true, write the subscription name, message_id, publish_time, + // attributes, and ordering_key to additional columns in the table. The + // subscription name, message_id, and publish_time fields are put in their own + // columns while all other message properties (other than data) are written to + // a JSON object in the attributes column. + bool write_metadata = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. When true and use_topic_schema is true, any fields that are a + // part of the topic schema that are not part of the BigQuery table schema are + // dropped when writing to BigQuery. Otherwise, the schemas must be kept in + // sync and any messages with extra fields are not written and remain in the + // subscription's backlog. + bool drop_unknown_fields = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. An output-only field that indicates whether or not the + // subscription can receive messages. + State state = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. When true, use the BigQuery table's schema as the columns to + // write to in BigQuery. `use_table_schema` and `use_topic_schema` cannot be + // enabled at the same time. + bool use_table_schema = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The service account to use to write to BigQuery. The subscription + // creator or updater that specifies this field must have + // `iam.serviceAccounts.actAs` permission on the service account. If not + // specified, the Pub/Sub [service + // agent](https://cloud.google.com/iam/docs/service-agents), + // service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used. + string service_account_email = 7 [(google.api.field_behavior) = OPTIONAL]; +} + +// Configuration for a Bigtable subscription. The Pub/Sub message will be +// written to a Bigtable row as follows: +// - row key: subscription name and message ID delimited by #. +// - columns: message bytes written to a single column family "data" with an +// empty-string column qualifier. +// - cell timestamp: the message publish timestamp. +message BigtableConfig { + // Possible states for a Bigtable subscription. + // Note: more states could be added in the future. Please code accordingly. + enum State { + // Default value. This value is unused. + STATE_UNSPECIFIED = 0; + + // The subscription can actively send messages to Bigtable. + ACTIVE = 1; + + // Cannot write to Bigtable because the instance, table, or app profile + // does not exist. + NOT_FOUND = 2; + + // Cannot write to Bigtable because the app profile is not configured for + // single-cluster routing. + APP_PROFILE_MISCONFIGURED = 3; + + // Cannot write to Bigtable because of permission denied errors. + // This can happen if: + // - The Pub/Sub service agent has not been granted the + // [appropriate Bigtable IAM permission + // bigtable.tables.mutateRows]({$universe.dns_names.final_documentation_domain}/bigtable/docs/access-control#permissions) + // - The bigtable.googleapis.com API is not enabled for the project + // ([instructions]({$universe.dns_names.final_documentation_domain}/service-usage/docs/enable-disable)) + PERMISSION_DENIED = 4; + + // Cannot write to Bigtable because of a missing column family ("data") or + // if there is no structured row key for the subscription name + message ID. + SCHEMA_MISMATCH = 5; + + // Cannot write to the destination because enforce_in_transit is set to true + // and the destination locations are not in the allowed regions. + IN_TRANSIT_LOCATION_RESTRICTION = 6; + + // Cannot write to Bigtable because the table is not in the same location as + // where Vertex AI models used in `message_transform`s are deployed. + VERTEX_AI_LOCATION_RESTRICTION = 7; + } + + // Optional. The unique name of the table to write messages to. + // + // Values are of the form + // `projects//instances//tables/`. + string table = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The app profile to use for the Bigtable writes. If not specified, + // the "default" application profile will be used. The app profile must use + // single-cluster routing. + string app_profile_id = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The service account to use to write to Bigtable. The subscription + // creator or updater that specifies this field must have + // `iam.serviceAccounts.actAs` permission on the service account. If not + // specified, the Pub/Sub [service + // agent](https://cloud.google.com/iam/docs/service-agents), + // service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used. + string service_account_email = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. When true, write the subscription name, message_id, publish_time, + // attributes, and ordering_key to additional columns in the table under the + // pubsub_metadata column family. The subscription name, message_id, and + // publish_time fields are put in their own columns while all other message + // properties (other than data) are written to a JSON object in the attributes + // column. + bool write_metadata = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. An output-only field that indicates whether or not the + // subscription can receive messages. + State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Configuration for a Cloud Storage subscription. +message CloudStorageConfig { + // Configuration for writing message data in text format. + // Message payloads will be written to files as raw text, separated by a + // newline. + message TextConfig {} + + // Configuration for writing message data in Avro format. + // Message payloads and metadata will be written to files as an Avro binary. + message AvroConfig { + // Optional. When true, write the subscription name, message_id, + // publish_time, attributes, and ordering_key as additional fields in the + // output. The subscription name, message_id, and publish_time fields are + // put in their own fields while all other message properties other than + // data (for example, an ordering_key, if present) are added as entries in + // the attributes map. + bool write_metadata = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. When true, the output Cloud Storage file will be serialized + // using the topic schema, if it exists. + bool use_topic_schema = 2 [(google.api.field_behavior) = OPTIONAL]; + } + + // Possible states for a Cloud Storage subscription. + enum State { + // Default value. This value is unused. + STATE_UNSPECIFIED = 0; + + // The subscription can actively send messages to Cloud Storage. + ACTIVE = 1; + + // Cannot write to the Cloud Storage bucket because of permission denied + // errors. + PERMISSION_DENIED = 2; + + // Cannot write to the Cloud Storage bucket because it does not exist. + NOT_FOUND = 3; + + // Cannot write to the destination because enforce_in_transit is set to true + // and the destination locations are not in the allowed regions. + IN_TRANSIT_LOCATION_RESTRICTION = 4; + + // Cannot write to the Cloud Storage bucket due to an incompatibility + // between the topic schema and subscription settings. + SCHEMA_MISMATCH = 5; + + // Cannot write to the Cloud Storage bucket because the bucket is not in the + // same location as where Vertex AI models used in `message_transform`s are + // deployed. + VERTEX_AI_LOCATION_RESTRICTION = 6; + } + + // Required. User-provided name for the Cloud Storage bucket. + // The bucket must be created by the user. The bucket name must be without + // any prefix like "gs://". See the [bucket naming + // requirements] (https://cloud.google.com/storage/docs/buckets#naming). + string bucket = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. User-provided prefix for Cloud Storage filename. See the [object + // naming requirements](https://cloud.google.com/storage/docs/objects#naming). + string filename_prefix = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. User-provided suffix for Cloud Storage filename. See the [object + // naming requirements](https://cloud.google.com/storage/docs/objects#naming). + // Must not end in "/". + string filename_suffix = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. User-provided format string specifying how to represent datetimes + // in Cloud Storage filenames. See the [datetime format + // guidance](https://cloud.google.com/pubsub/docs/create-cloudstorage-subscription#file_names). + string filename_datetime_format = 10 [(google.api.field_behavior) = OPTIONAL]; + + // Defaults to text format. + oneof output_format { + // Optional. If set, message data will be written to Cloud Storage in text + // format. + TextConfig text_config = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If set, message data will be written to Cloud Storage in Avro + // format. + AvroConfig avro_config = 5 [(google.api.field_behavior) = OPTIONAL]; + } + + // Optional. The maximum duration that can elapse before a new Cloud Storage + // file is created. Min 1 minute, max 10 minutes, default 5 minutes. May not + // exceed the subscription's acknowledgment deadline. + google.protobuf.Duration max_duration = 6 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The maximum bytes that can be written to a Cloud Storage file + // before a new file is created. Min 1 KB, max 10 GiB. The max_bytes limit may + // be exceeded in cases where messages are larger than the limit. + int64 max_bytes = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The maximum number of messages that can be written to a Cloud + // Storage file before a new file is created. Min 1000 messages. + int64 max_messages = 8 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. An output-only field that indicates whether or not the + // subscription can receive messages. + State state = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. The service account to use to write to Cloud Storage. The + // subscription creator or updater that specifies this field must have + // `iam.serviceAccounts.actAs` permission on the service account. If not + // specified, the Pub/Sub + // [service agent](https://cloud.google.com/iam/docs/service-agents), + // service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used. + string service_account_email = 11 [(google.api.field_behavior) = OPTIONAL]; } // A message and its corresponding acknowledgment ID. message ReceivedMessage { - // This ID can be used to acknowledge the received message. - string ack_id = 1; + // Optional. This ID can be used to acknowledge the received message. + string ack_id = 1 [(google.api.field_behavior) = OPTIONAL]; - // The message. - PubsubMessage message = 2; + // Optional. The message. + PubsubMessage message = 2 [(google.api.field_behavior) = OPTIONAL]; - // The approximate number of times that Cloud Pub/Sub has attempted to deliver - // the associated message to a subscriber. + // Optional. The approximate number of times that Pub/Sub has attempted to + // deliver the associated message to a subscriber. // // More precisely, this is 1 + (number of NACKs) + // (number of ack_deadline exceeds) for this message. @@ -894,7 +2070,7 @@ message ReceivedMessage { // value of 1. The value is calculated at best effort and is approximate. // // If a DeadLetterPolicy is not set on the subscription, this will be 0. - int32 delivery_attempt = 3; + int32 delivery_attempt = 3 [(google.api.field_behavior) = OPTIONAL]; } // Request for the GetSubscription method. @@ -931,24 +2107,25 @@ message ListSubscriptionsRequest { } ]; - // Maximum number of subscriptions to return. - int32 page_size = 2; + // Optional. Maximum number of subscriptions to return. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - // The value returned by the last `ListSubscriptionsResponse`; indicates that - // this is a continuation of a prior `ListSubscriptions` call, and that the - // system should return the next page of data. - string page_token = 3; + // Optional. The value returned by the last `ListSubscriptionsResponse`; + // indicates that this is a continuation of a prior `ListSubscriptions` call, + // and that the system should return the next page of data. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; } // Response for the `ListSubscriptions` method. message ListSubscriptionsResponse { - // The subscriptions that match the request. - repeated Subscription subscriptions = 1; + // Optional. The subscriptions that match the request. + repeated Subscription subscriptions = 1 + [(google.api.field_behavior) = OPTIONAL]; - // If not empty, indicates that there may be more subscriptions that match - // the request; this value should be passed in a new + // Optional. If not empty, indicates that there may be more subscriptions that + // match the request; this value should be passed in a new // `ListSubscriptionsRequest` to get more subscriptions. - string next_page_token = 2; + string next_page_token = 2 [(google.api.field_behavior) = OPTIONAL]; } // Request for the DeleteSubscription method. @@ -1012,11 +2189,13 @@ message PullRequest { // Response for the `Pull` method. message PullResponse { - // Received Pub/Sub messages. The list will be empty if there are no more - // messages available in the backlog. For JSON, the response can be entirely + // Optional. Received Pub/Sub messages. The list will be empty if there are no + // more messages available in the backlog, or if no messages could be returned + // before the request timeout. For JSON, the response can be entirely // empty. The Pub/Sub system may return fewer than the `maxMessages` requested // even if there are more messages available in the backlog. - repeated ReceivedMessage received_messages = 1; + repeated ReceivedMessage received_messages = 1 + [(google.api.field_behavior) = OPTIONAL]; } // Request for the ModifyAckDeadline method. @@ -1040,7 +2219,8 @@ message ModifyAckDeadlineRequest { // delivery to another subscriber client. This typically results in an // increase in the rate of message redeliveries (that is, duplicates). // The minimum deadline you can specify is 0 seconds. - // The maximum deadline you can specify is 600 seconds (10 minutes). + // The maximum deadline you can specify in a single request is 600 seconds + // (10 minutes). int32 ack_deadline_seconds = 3 [(google.api.field_behavior) = REQUIRED]; } @@ -1062,7 +2242,7 @@ message AcknowledgeRequest { } // Request for the `StreamingPull` streaming RPC method. This request is used to -// establish the initial stream as well as to stream acknowledgements and ack +// establish the initial stream as well as to stream acknowledgments and ack // deadline modifications from the client to the server. message StreamingPullRequest { // Required. The subscription for which to initialize the new stream. This @@ -1076,14 +2256,14 @@ message StreamingPullRequest { } ]; - // List of acknowledgement IDs for acknowledging previously received messages - // (received on this stream or a different stream). If an ack ID has expired, - // the corresponding message may be redelivered later. Acknowledging a message - // more than once will not result in an error. If the acknowledgement ID is - // malformed, the stream will be aborted with status `INVALID_ARGUMENT`. - repeated string ack_ids = 2; + // Optional. List of acknowledgment IDs for acknowledging previously received + // messages (received on this stream or a different stream). If an ack ID has + // expired, the corresponding message may be redelivered later. Acknowledging + // a message more than once will not result in an error. If the acknowledgment + // ID is malformed, the stream will be aborted with status `INVALID_ARGUMENT`. + repeated string ack_ids = 2 [(google.api.field_behavior) = OPTIONAL]; - // The list of new ack deadlines for the IDs listed in + // Optional. The list of new ack deadlines for the IDs listed in // `modify_deadline_ack_ids`. The size of this list must be the same as the // size of `modify_deadline_ack_ids`. If it differs the stream will be aborted // with `INVALID_ARGUMENT`. Each element in this list is applied to the @@ -1094,14 +2274,16 @@ message StreamingPullRequest { // the message is immediately made available for another streaming or // non-streaming pull request. If the value is < 0 (an error), the stream will // be aborted with status `INVALID_ARGUMENT`. - repeated int32 modify_deadline_seconds = 3; + repeated int32 modify_deadline_seconds = 3 + [(google.api.field_behavior) = OPTIONAL]; - // List of acknowledgement IDs whose deadline will be modified based on the - // corresponding element in `modify_deadline_seconds`. This field can be used - // to indicate that more time is needed to process a message by the + // Optional. List of acknowledgment IDs whose deadline will be modified based + // on the corresponding element in `modify_deadline_seconds`. This field can + // be used to indicate that more time is needed to process a message by the // subscriber, or to make the message available for redelivery if the // processing was interrupted. - repeated string modify_deadline_ack_ids = 4; + repeated string modify_deadline_ack_ids = 4 + [(google.api.field_behavior) = OPTIONAL]; // Required. The ack deadline to use for the stream. This must be provided in // the first request on the stream, but it can also be updated on subsequent @@ -1110,16 +2292,16 @@ message StreamingPullRequest { int32 stream_ack_deadline_seconds = 5 [(google.api.field_behavior) = REQUIRED]; - // A unique identifier that is used to distinguish client instances from each - // other. Only needs to be provided on the initial request. When a stream - // disconnects and reconnects for the same stream, the client_id should be set - // to the same value so that state associated with the old stream can be - // transferred to the new stream. The same client_id should not be used for + // Optional. A unique identifier that is used to distinguish client instances + // from each other. Only needs to be provided on the initial request. When a + // stream disconnects and reconnects for the same stream, the client_id should + // be set to the same value so that state associated with the old stream can + // be transferred to the new stream. The same client_id should not be used for // different client instances. - string client_id = 6; + string client_id = 6 [(google.api.field_behavior) = OPTIONAL]; - // Flow control settings for the maximum number of outstanding messages. When - // there are `max_outstanding_messages` or more currently sent to the + // Optional. Flow control settings for the maximum number of outstanding + // messages. When there are `max_outstanding_messages` currently sent to the // streaming pull client that have not yet been acked or nacked, the server // stops sending more messages. The sending of messages resumes once the // number of outstanding messages is less than this value. If the value is @@ -1127,25 +2309,94 @@ message StreamingPullRequest { // property can only be set on the initial StreamingPullRequest. If it is set // on a subsequent request, the stream will be aborted with status // `INVALID_ARGUMENT`. - int64 max_outstanding_messages = 7; - - // Flow control settings for the maximum number of outstanding bytes. When - // there are `max_outstanding_bytes` or more worth of messages currently sent - // to the streaming pull client that have not yet been acked or nacked, the - // server will stop sending more messages. The sending of messages resumes - // once the number of outstanding bytes is less than this value. If the value - // is <= 0, there is no limit to the number of outstanding bytes. This - // property can only be set on the initial StreamingPullRequest. If it is set - // on a subsequent request, the stream will be aborted with status + int64 max_outstanding_messages = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Flow control settings for the maximum number of outstanding + // bytes. When there are `max_outstanding_bytes` or more worth of messages + // currently sent to the streaming pull client that have not yet been acked or + // nacked, the server will stop sending more messages. The sending of messages + // resumes once the number of outstanding bytes is less than this value. If + // the value is <= 0, there is no limit to the number of outstanding bytes. + // This property can only be set on the initial StreamingPullRequest. If it is + // set on a subsequent request, the stream will be aborted with status // `INVALID_ARGUMENT`. - int64 max_outstanding_bytes = 8; + int64 max_outstanding_bytes = 8 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The protocol version used by the client. This property can only + // be set on the initial StreamingPullRequest. If it is set on a subsequent + // request, the stream will be aborted with status `INVALID_ARGUMENT`. + int64 protocol_version = 10 [(google.api.field_behavior) = OPTIONAL]; } // Response for the `StreamingPull` method. This response is used to stream // messages from the server to the client. message StreamingPullResponse { - // Received Pub/Sub messages. This will not be empty. - repeated ReceivedMessage received_messages = 1; + // Acknowledgment IDs sent in one or more previous requests to acknowledge a + // previously received message. + message AcknowledgeConfirmation { + // Optional. Successfully processed acknowledgment IDs. + repeated string ack_ids = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. List of acknowledgment IDs that were malformed or whose + // acknowledgment deadline has expired. + repeated string invalid_ack_ids = 2 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. List of acknowledgment IDs that were out of order. + repeated string unordered_ack_ids = 3 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. List of acknowledgment IDs that failed processing with + // temporary issues. + repeated string temporary_failed_ack_ids = 4 + [(google.api.field_behavior) = OPTIONAL]; + } + + // Acknowledgment IDs sent in one or more previous requests to modify the + // deadline for a specific message. + message ModifyAckDeadlineConfirmation { + // Optional. Successfully processed acknowledgment IDs. + repeated string ack_ids = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. List of acknowledgment IDs that were malformed or whose + // acknowledgment deadline has expired. + repeated string invalid_ack_ids = 2 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. List of acknowledgment IDs that failed processing with + // temporary issues. + repeated string temporary_failed_ack_ids = 3 + [(google.api.field_behavior) = OPTIONAL]; + } + + // Subscription properties sent as part of the response. + message SubscriptionProperties { + // Optional. True iff exactly once delivery is enabled for this + // subscription. + bool exactly_once_delivery_enabled = 1 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. True iff message ordering is enabled for this subscription. + bool message_ordering_enabled = 2 [(google.api.field_behavior) = OPTIONAL]; + } + + // Optional. Received Pub/Sub messages. + repeated ReceivedMessage received_messages = 1 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. This field will only be set if `enable_exactly_once_delivery` is + // set to `true` and is not guaranteed to be populated. + AcknowledgeConfirmation acknowledge_confirmation = 5 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. This field will only be set if `enable_exactly_once_delivery` is + // set to `true` and is not guaranteed to be populated. + ModifyAckDeadlineConfirmation modify_ack_deadline_confirmation = 3 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Properties associated with this subscription. + SubscriptionProperties subscription_properties = 4 + [(google.api.field_behavior) = OPTIONAL]; } // Request for the `CreateSnapshot` method. @@ -1153,9 +2404,9 @@ message CreateSnapshotRequest { // Required. User-provided name for this snapshot. If the name is not provided // in the request, the server will assign a random name for this snapshot on // the same project as the subscription. Note that for REST API requests, you - // must specify a name. See the resource - // name rules. Format is `projects/{project}/snapshots/{snap}`. + // must specify a name. See the [resource name + // rules](https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). + // Format is `projects/{project}/snapshots/{snap}`. string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { type: "pubsub.googleapis.com/Snapshot" } @@ -1177,9 +2428,21 @@ message CreateSnapshotRequest { } ]; - // See Creating and - // managing labels. - map labels = 3; + // 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" + // See https://docs.cloud.google.com/pubsub/docs/tags for more information on + // using tags with Pub/Sub resources. + map tags = 4 [ + (google.api.field_behavior) = INPUT_ONLY, + (google.api.field_behavior) = IMMUTABLE, + (google.api.field_behavior) = OPTIONAL + ]; } // Request for the UpdateSnapshot method. @@ -1202,17 +2465,21 @@ message Snapshot { option (google.api.resource) = { type: "pubsub.googleapis.com/Snapshot" pattern: "projects/{project}/snapshots/{snapshot}" + plural: "snapshots" + singular: "snapshot" }; - // The name of the snapshot. - string name = 1; + // Optional. The name of the snapshot. + string name = 1 [(google.api.field_behavior) = OPTIONAL]; - // The name of the topic from which this snapshot is retaining messages. + // Optional. The name of the topic from which this snapshot is retaining + // messages. string topic = 2 [ + (google.api.field_behavior) = OPTIONAL, (google.api.resource_reference) = { type: "pubsub.googleapis.com/Topic" } ]; - // The snapshot is guaranteed to exist up until this time. + // Optional. The snapshot is guaranteed to exist up until this time. // A newly-created snapshot expires no later than 7 days from the time of its // creation. Its exact lifetime is determined at creation by the existing // backlog in the source subscription. Specifically, the lifetime of the @@ -1222,11 +2489,12 @@ message Snapshot { // will always capture this 3-day-old backlog as long as the snapshot // exists -- will expire in 4 days. The service will refuse to create a // snapshot that would expire in less than 1 hour after creation. - google.protobuf.Timestamp expire_time = 3; + google.protobuf.Timestamp expire_time = 3 + [(google.api.field_behavior) = OPTIONAL]; - // See [Creating and managing labels] + // Optional. See [Creating and managing labels] // (https://cloud.google.com/pubsub/docs/labels). - map labels = 4; + map labels = 4 [(google.api.field_behavior) = OPTIONAL]; } // Request for the GetSnapshot method. @@ -1250,23 +2518,24 @@ message ListSnapshotsRequest { } ]; - // Maximum number of snapshots to return. - int32 page_size = 2; + // Optional. Maximum number of snapshots to return. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - // The value returned by the last `ListSnapshotsResponse`; indicates that this - // is a continuation of a prior `ListSnapshots` call, and that the system - // should return the next page of data. - string page_token = 3; + // Optional. The value returned by the last `ListSnapshotsResponse`; indicates + // that this is a continuation of a prior `ListSnapshots` call, and that the + // system should return the next page of data. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; } // Response for the `ListSnapshots` method. message ListSnapshotsResponse { - // The resulting snapshots. - repeated Snapshot snapshots = 1; + // Optional. The resulting snapshots. + repeated Snapshot snapshots = 1 [(google.api.field_behavior) = OPTIONAL]; - // If not empty, indicates that there may be more snapshot that match the - // request; this value should be passed in a new `ListSnapshotsRequest`. - string next_page_token = 2; + // Optional. If not empty, indicates that there may be more snapshot that + // match the request; this value should be passed in a new + // `ListSnapshotsRequest`. + string next_page_token = 2 [(google.api.field_behavior) = OPTIONAL]; } // Request for the `DeleteSnapshot` method. @@ -1290,7 +2559,7 @@ message SeekRequest { ]; oneof target { - // The time to seek to. + // Optional. The time to seek to. // Messages retained in the subscription that were published before this // time are marked as acknowledged, and messages retained in the // subscription that were published after this time are marked as @@ -1301,14 +2570,17 @@ message SeekRequest { // window (or to a point before the system's notion of the subscription // creation time), only retained messages will be marked as unacknowledged, // and already-expunged messages will not be restored. - google.protobuf.Timestamp time = 2; - - // The snapshot to seek to. The snapshot's topic must be the same as that of - // the provided subscription. - // Format is `projects/{project}/snapshots/{snap}`. - string snapshot = 3 [(google.api.resource_reference) = { - type: "pubsub.googleapis.com/Snapshot" - }]; + google.protobuf.Timestamp time = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The snapshot to seek to. The snapshot's topic must be the same + // as that of the provided subscription. Format is + // `projects/{project}/snapshots/{snap}`. + string snapshot = 3 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { + type: "pubsub.googleapis.com/Snapshot" + } + ]; } } diff --git a/proto-google-cloud-pubsub-v1/src/main/proto/google/pubsub/v1/schema.proto b/proto-google-cloud-pubsub-v1/src/main/proto/google/pubsub/v1/schema.proto index ae402ac4d..48a6b2aee 100644 --- a/proto-google-cloud-pubsub-v1/src/main/proto/google/pubsub/v1/schema.proto +++ b/proto-google-cloud-pubsub-v1/src/main/proto/google/pubsub/v1/schema.proto @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -21,10 +21,10 @@ import "google/api/client.proto"; import "google/api/field_behavior.proto"; import "google/api/resource.proto"; import "google/protobuf/empty.proto"; +import "google/protobuf/timestamp.proto"; -option cc_enable_arenas = true; option csharp_namespace = "Google.Cloud.PubSub.V1"; -option go_package = "google.golang.org/genproto/googleapis/pubsub/v1;pubsub"; +option go_package = "cloud.google.com/go/pubsub/v2/apiv1/pubsubpb;pubsubpb"; option java_multiple_files = true; option java_outer_classname = "SchemaProto"; option java_package = "com.google.pubsub.v1"; @@ -32,9 +32,6 @@ option php_namespace = "Google\\Cloud\\PubSub\\V1"; option ruby_package = "Google::Cloud::PubSub::V1"; // Service for doing schema-related operations. -// -// EXPERIMENTAL: The Schema service is in development and may not work yet. - service SchemaService { option (google.api.default_host) = "pubsub.googleapis.com"; option (google.api.oauth_scopes) = @@ -66,6 +63,41 @@ service SchemaService { option (google.api.method_signature) = "parent"; } + // Lists all schema revisions for the named schema. + rpc ListSchemaRevisions(ListSchemaRevisionsRequest) + returns (ListSchemaRevisionsResponse) { + option (google.api.http) = { + get: "/v1/{name=projects/*/schemas/*}:listRevisions" + }; + option (google.api.method_signature) = "name"; + } + + // Commits a new schema revision to an existing schema. + rpc CommitSchema(CommitSchemaRequest) returns (Schema) { + option (google.api.http) = { + post: "/v1/{name=projects/*/schemas/*}:commit" + body: "*" + }; + option (google.api.method_signature) = "name,schema"; + } + + // Creates a new schema revision that is a copy of the provided revision_id. + rpc RollbackSchema(RollbackSchemaRequest) returns (Schema) { + option (google.api.http) = { + post: "/v1/{name=projects/*/schemas/*}:rollback" + body: "*" + }; + option (google.api.method_signature) = "name,revision_id"; + } + + // Deletes a specific schema revision. + rpc DeleteSchemaRevision(DeleteSchemaRevisionRequest) returns (Schema) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/schemas/*}:deleteRevision" + }; + option (google.api.method_signature) = "name,revision_id"; + } + // Deletes a schema. rpc DeleteSchema(DeleteSchemaRequest) returns (google.protobuf.Empty) { option (google.api.http) = { @@ -123,6 +155,29 @@ message Schema { // the full definition of the schema that is a valid schema definition of // the type specified in `type`. string definition = 3; + + // Output only. Immutable. The revision ID of the schema. + string revision_id = 4 [ + (google.api.field_behavior) = IMMUTABLE, + (google.api.field_behavior) = OUTPUT_ONLY + ]; + + // Output only. The timestamp that the revision was created. + google.protobuf.Timestamp revision_create_time = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// View of Schema object fields to be returned by GetSchema and ListSchemas. +enum SchemaView { + // The default / unset value. + // The API will default to the BASIC view. + SCHEMA_VIEW_UNSPECIFIED = 0; + + // Include the name and type of the schema, but not the definition. + BASIC = 1; + + // Include all Schema object fields. + FULL = 2; } // Request for the CreateSchema method. @@ -146,24 +201,11 @@ message CreateSchemaRequest { // The ID to use for the schema, which will become the final component of // the schema's resource name. // - // See https://cloud.google.com/pubsub/docs/admin#resource_names for resource - // name constraints. + // See https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names for + // resource name constraints. string schema_id = 3; } -// View of Schema object fields to be returned by GetSchema and ListSchemas. -enum SchemaView { - // The default / unset value. - // The API will default to the BASIC view. - SCHEMA_VIEW_UNSPECIFIED = 0; - - // Include the name and type of the schema, but not the definition. - BASIC = 1; - - // Include all Schema object fields. - FULL = 2; -} - // Request for the GetSchema method. message GetSchemaRequest { // Required. The name of the schema to get. @@ -174,8 +216,7 @@ message GetSchemaRequest { ]; // The set of fields to return in the response. If not set, returns a Schema - // with `name` and `type`, but not `definition`. Set to `FULL` to retrieve all - // fields. + // with all fields filled out. Set to `BASIC` to omit the `definition`. SchemaView view = 2; } @@ -214,6 +255,83 @@ message ListSchemasResponse { string next_page_token = 2; } +// Request for the `ListSchemaRevisions` method. +message ListSchemaRevisionsRequest { + // Required. The name of the schema to list revisions for. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "pubsub.googleapis.com/Schema" } + ]; + + // The set of Schema fields to return in the response. If not set, returns + // Schemas with `name` and `type`, but not `definition`. Set to `FULL` to + // retrieve all fields. + SchemaView view = 2; + + // The maximum number of revisions to return per page. + int32 page_size = 3; + + // The page token, received from a previous ListSchemaRevisions call. + // Provide this to retrieve the subsequent page. + string page_token = 4; +} + +// Response for the `ListSchemaRevisions` method. +message ListSchemaRevisionsResponse { + // The revisions of the schema. + repeated Schema schemas = 1; + + // A token that can be sent as `page_token` to retrieve the next page. + // If this field is empty, there are no subsequent pages. + string next_page_token = 2; +} + +// Request for CommitSchema method. +message CommitSchemaRequest { + // Required. The name of the schema we are revising. + // Format is `projects/{project}/schemas/{schema}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "pubsub.googleapis.com/Schema" } + ]; + + // Required. The schema revision to commit. + Schema schema = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for the `RollbackSchema` method. +message RollbackSchemaRequest { + // Required. The schema being rolled back with revision id. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "pubsub.googleapis.com/Schema" } + ]; + + // Required. The revision ID to roll back to. + // It must be a revision of the same schema. + // + // Example: c7cfa2a8 + string revision_id = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for the `DeleteSchemaRevision` method. +message DeleteSchemaRevisionRequest { + // Required. The name of the schema revision to be deleted, with a revision ID + // explicitly included. + // + // Example: `projects/123/schemas/my-schema@c7cfa2a8` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "pubsub.googleapis.com/Schema" } + ]; + + // Optional. This field is deprecated and should not be used for specifying + // the revision ID. The revision ID should be specified via the `name` + // parameter. + string revision_id = 2 + [deprecated = true, (google.api.field_behavior) = OPTIONAL]; +} + // Request for the `DeleteSchema` method. message DeleteSchemaRequest { // Required. Name of the schema to delete. @@ -240,6 +358,7 @@ message ValidateSchemaRequest { } // Response for the `ValidateSchema` method. +// Empty for now. message ValidateSchemaResponse {} // Request for the `ValidateMessage` method. @@ -273,6 +392,7 @@ message ValidateMessageRequest { } // Response for the `ValidateMessage` method. +// Empty for now. message ValidateMessageResponse {} // Possible encoding types for messages. diff --git a/renovate.json b/renovate.json index decec422e..91b1a27f7 100644 --- a/renovate.json +++ b/renovate.json @@ -1,4 +1,6 @@ + { + "extends": [ ":separateMajorReleases", ":combinePatchMinorReleases", @@ -10,6 +12,26 @@ ":maintainLockFilesDisabled", ":autodetectPinVersions" ], + "ignorePaths": [ + ".kokoro/requirements.txt", + ".github/workflows/approve-readme.yaml", + ".github/workflows/ci.yaml", + ".github/workflows/renovate_config_check.yaml", + ".github/workflows/samples.yaml" + ], + "customManagers": [ + { + "customType": "regex", + "fileMatch": [ + "^.github/workflows/unmanaged_dependency_check.yaml$" + ], + "matchStrings": [ + "uses: googleapis/google-cloud-java/sdk-platform-java/java-shared-dependencies/unmanaged-dependency-check@v(?.+?)\\n" + ], + "depNameTemplate": "com.google.cloud:gapic-libraries-bom", + "datasourceTemplate": "maven" + } + ], "packageRules": [ { "packagePatterns": [ @@ -30,7 +52,6 @@ "^org.jacoco:", "^org.codehaus.mojo:", "^org.sonatype.plugins:", - "^com.coveo:", "^com.google.cloud:google-cloud-shared-config" ], "semanticCommitType": "build", @@ -50,7 +71,9 @@ "^junit:junit", "^com.google.truth:truth", "^org.mockito:mockito-core", - "^org.objenesis:objenesis" + "^org.objenesis:objenesis", + "^com.google.cloud:google-cloud-conformance-tests", + "^org.graalvm.buildtools:junit-platform-native" ], "semanticCommitType": "test", "semanticCommitScope": "deps" @@ -69,5 +92,7 @@ } ], "semanticCommits": true, - "masterIssue": true + "dependencyDashboard": true, + "prConcurrentLimit": 0, + "prHourlyLimit": 0 } diff --git a/samples/README.md b/samples/README.md new file mode 100644 index 000000000..4390e7ea6 --- /dev/null +++ b/samples/README.md @@ -0,0 +1,25 @@ +# How to run the samples + +1. Clone this repo and navigate to the `snippets` directory. + ```shell + git clone https://github.com/googleapis/java-pubsub + cd java-pubsub/samples/snippets + ``` + +1. [Obtain GCP user access credentials] via a web flow for your application. + ```shell + gcloud auth application-default login + ``` + +1. With [Maven] installed, run a sample that has the to-do section completed: + ```shell + mvn clean compile exec:java -Dexec.mainClass=pubsub.CreateTopicExample + ``` + +1. To run the samples test: + ```shell + mvn -Dtest=pubsub.AdminIT test + ``` + +[Maven]: https://maven.apache.org/ +[Obtain GCP user access credentials]: https://cloud.google.com/sdk/gcloud/reference/auth/application-default/login \ No newline at end of file diff --git a/samples/checkstyle-suppressions.xml b/samples/checkstyle-suppressions.xml index 2d134a8c2..a1bfbb84a 100644 --- a/samples/checkstyle-suppressions.xml +++ b/samples/checkstyle-suppressions.xml @@ -20,15 +20,9 @@ "https://checkstyle.org/dtds/suppressions_1_2.dtd"> - - - - - - - - - + + - + + \ No newline at end of file diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml index 140a2ab86..f5f4ee888 100644 --- a/samples/install-without-bom/pom.xml +++ b/samples/install-without-bom/pom.xml @@ -29,7 +29,7 @@ com.google.cloud.samples shared-configuration - 1.0.21 + 1.2.2 @@ -44,20 +44,20 @@ com.google.cloud google-cloud-pubsub - 1.111.4 + 1.148.0 org.apache.avro avro - 1.10.1 + 1.11.4 compile org.xerial.snappy snappy-java - 1.1.8.4 + 1.1.10.8 @@ -69,20 +69,35 @@ com.google.truth truth - 1.1.2 + 1.4.5 test com.google.protobuf protobuf-java-util - 3.15.5 + 4.33.5 com.google.cloud google-cloud-core - 1.94.4 + 2.65.0 tests + + com.google.cloud + google-cloud-bigquery + 2.59.0 + + + com.google.cloud + google-cloud-storage + 2.63.0 + + + com.google.cloud.opentelemetry + exporter-trace + 0.36.0 + @@ -91,7 +106,7 @@ org.codehaus.mojo build-helper-maven-plugin - 3.2.0 + 3.6.1 add-snippets-source diff --git a/samples/pom.xml b/samples/pom.xml index 4e20813d1..b63314dd5 100644 --- a/samples/pom.xml +++ b/samples/pom.xml @@ -33,7 +33,7 @@ com.google.cloud.samples shared-configuration - 1.0.21 + 1.2.2 @@ -53,7 +53,7 @@ org.apache.maven.plugins maven-deploy-plugin - 2.8.2 + 3.1.4 true @@ -61,7 +61,7 @@ org.sonatype.plugins nexus-staging-maven-plugin - 1.6.8 + 1.7.0 true @@ -74,7 +74,7 @@ org.apache.maven.plugins maven-checkstyle-plugin - 3.1.2 + 3.6.0 checkstyle-suppressions.xml diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index c95d747f1..432ce85de 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -29,7 +29,7 @@ com.google.cloud.samples shared-configuration - 1.0.21 + 1.2.2 @@ -43,25 +43,25 @@ com.google.cloud google-cloud-pubsub - 1.111.5-SNAPSHOT + 1.150.3-SNAPSHOT org.apache.avro avro - 1.10.1 + 1.11.4 compile org.xerial.snappy snappy-java - 1.1.8.4 + 1.1.10.8 com.google.protobuf protobuf-java-util - 3.15.5 + 4.33.5 @@ -73,15 +73,30 @@ com.google.truth truth - 1.1.2 + 1.4.5 test com.google.cloud google-cloud-core - 1.94.4 + 2.65.0 tests + + com.google.cloud + google-cloud-bigquery + 2.59.0 + + + com.google.cloud + google-cloud-storage + 2.63.0 + + + com.google.cloud.opentelemetry + exporter-trace + 0.36.0 + @@ -90,7 +105,7 @@ org.codehaus.mojo build-helper-maven-plugin - 3.2.0 + 3.6.1 add-snippets-source diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml index 14bec5145..42f69ff4a 100644 --- a/samples/snippets/pom.xml +++ b/samples/snippets/pom.xml @@ -29,7 +29,7 @@ com.google.cloud.samples shared-configuration - 1.0.21 + 1.2.2 @@ -45,7 +45,7 @@ com.google.cloud libraries-bom - 19.0.0 + 26.76.0 pom import @@ -57,22 +57,35 @@ com.google.cloud google-cloud-pubsub - + + + com.google.cloud + google-cloud-bigquery + + + com.google.cloud + google-cloud-storage + + + com.google.cloud.opentelemetry + exporter-trace + 0.36.0 + org.apache.avro avro - 1.10.1 + 1.11.4 org.xerial.snappy snappy-java - 1.1.8.4 + 1.1.10.8 com.google.protobuf protobuf-java-util - 3.15.5 + 4.33.5 @@ -84,13 +97,13 @@ com.google.truth truth - 1.1.2 + 1.4.5 test com.google.cloud google-cloud-core - 1.94.4 + 2.65.0 tests diff --git a/samples/snippets/src/main/java/pubsub/CommitAvroSchemaExample.java b/samples/snippets/src/main/java/pubsub/CommitAvroSchemaExample.java new file mode 100644 index 000000000..8f24e75a2 --- /dev/null +++ b/samples/snippets/src/main/java/pubsub/CommitAvroSchemaExample.java @@ -0,0 +1,69 @@ +/* + * Copyright 2023 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 pubsub; + +// [START pubsub_commit_avro_schema] + +import com.google.api.gax.rpc.NotFoundException; +import com.google.cloud.pubsub.v1.SchemaServiceClient; +import com.google.pubsub.v1.ProjectName; +import com.google.pubsub.v1.Schema; +import com.google.pubsub.v1.SchemaName; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; + +public class CommitAvroSchemaExample { + + public static void main(String... args) throws Exception { + // TODO(developer): Replace these variables before running the sample. + String projectId = "your-project-id"; + String schemaId = "your-schema-id"; + String avscFile = "path/to/an/avro/schema/file/(.avsc)/formatted/in/json"; + + commitAvroSchemaExample(projectId, schemaId, avscFile); + } + + public static Schema commitAvroSchemaExample(String projectId, String schemaId, String avscFile) + throws IOException { + + ProjectName projectName = ProjectName.of(projectId); + SchemaName schemaName = SchemaName.of(projectId, schemaId); + + // Read an Avro schema file formatted in JSON as a string. + String avscSource = new String(Files.readAllBytes(Paths.get(avscFile))); + + try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) { + + Schema schema = + schemaServiceClient.commitSchema( + schemaName.toString(), + Schema.newBuilder() + .setName(schemaName.toString()) + .setType(Schema.Type.AVRO) + .setDefinition(avscSource) + .build()); + + System.out.println("Committed a schema using an Avro schema:\n" + schema); + return schema; + } catch (NotFoundException e) { + System.out.println(schemaName + "does not exist."); + return null; + } + } +} +// [END pubsub_commit_avro_schema] diff --git a/samples/snippets/src/main/java/pubsub/CommitProtoSchemaExample.java b/samples/snippets/src/main/java/pubsub/CommitProtoSchemaExample.java new file mode 100644 index 000000000..e609b9a5f --- /dev/null +++ b/samples/snippets/src/main/java/pubsub/CommitProtoSchemaExample.java @@ -0,0 +1,69 @@ +/* + * Copyright 2023 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 pubsub; + +// [START pubsub_commit_proto_schema] + +import com.google.api.gax.rpc.NotFoundException; +import com.google.cloud.pubsub.v1.SchemaServiceClient; +import com.google.pubsub.v1.ProjectName; +import com.google.pubsub.v1.Schema; +import com.google.pubsub.v1.SchemaName; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; + +public class CommitProtoSchemaExample { + + public static void main(String... args) throws Exception { + // TODO(developer): Replace these variables before running the sample. + String projectId = "your-project-id"; + String schemaId = "your-schema-id"; + String protoFile = "path/to/a/proto/file/(.proto)/formatted/in/protocol/buffers"; + + commitProtoSchemaExample(projectId, schemaId, protoFile); + } + + public static Schema commitProtoSchemaExample(String projectId, String schemaId, String protoFile) + throws IOException { + + ProjectName projectName = ProjectName.of(projectId); + SchemaName schemaName = SchemaName.of(projectId, schemaId); + + // Read a proto file as a string. + String protoSource = new String(Files.readAllBytes(Paths.get(protoFile))); + + try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) { + + Schema schema = + schemaServiceClient.commitSchema( + schemaName.toString(), + Schema.newBuilder() + .setName(schemaName.toString()) + .setType(Schema.Type.PROTOCOL_BUFFER) + .setDefinition(protoSource) + .build()); + + System.out.println("Committed a schema using a protobuf schema:\n" + schema); + return schema; + } catch (NotFoundException e) { + System.out.println(schemaName + "does not exist."); + return null; + } + } +} +// [END pubsub_commit_proto_schema] diff --git a/samples/snippets/src/main/java/pubsub/CreateAvroSchemaExample.java b/samples/snippets/src/main/java/pubsub/CreateAvroSchemaExample.java index 1b93b7fbe..393b128b3 100644 --- a/samples/snippets/src/main/java/pubsub/CreateAvroSchemaExample.java +++ b/samples/snippets/src/main/java/pubsub/CreateAvroSchemaExample.java @@ -38,7 +38,7 @@ public static void main(String... args) throws Exception { createAvroSchemaExample(projectId, schemaId, avscFile); } - public static void createAvroSchemaExample(String projectId, String schemaId, String avscFile) + public static Schema createAvroSchemaExample(String projectId, String schemaId, String avscFile) throws IOException { ProjectName projectName = ProjectName.of(projectId); @@ -60,8 +60,10 @@ public static void createAvroSchemaExample(String projectId, String schemaId, St schemaId); System.out.println("Created a schema using an Avro schema:\n" + schema); + return schema; } catch (AlreadyExistsException e) { System.out.println(schemaName + "already exists."); + return null; } } } diff --git a/samples/snippets/src/main/java/pubsub/CreateBigQuerySubscriptionExample.java b/samples/snippets/src/main/java/pubsub/CreateBigQuerySubscriptionExample.java new file mode 100644 index 000000000..002b6ef1f --- /dev/null +++ b/samples/snippets/src/main/java/pubsub/CreateBigQuerySubscriptionExample.java @@ -0,0 +1,62 @@ +/* + * Copyright 2022 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 pubsub; + +// [START pubsub_create_bigquery_subscription] +import com.google.cloud.pubsub.v1.SubscriptionAdminClient; +import com.google.pubsub.v1.BigQueryConfig; +import com.google.pubsub.v1.ProjectSubscriptionName; +import com.google.pubsub.v1.ProjectTopicName; +import com.google.pubsub.v1.Subscription; +import java.io.IOException; + +public class CreateBigQuerySubscriptionExample { + public static void main(String... args) throws Exception { + // TODO(developer): Replace these variables before running the sample. + String projectId = "your-project-id"; + String topicId = "your-topic-id"; + String subscriptionId = "your-subscription-id"; + String bigqueryTableId = "your-project.your-dataset.your-table"; + + createBigQuerySubscription(projectId, topicId, subscriptionId, bigqueryTableId); + } + + public static void createBigQuerySubscription( + String projectId, String topicId, String subscriptionId, String bigqueryTableId) + throws IOException { + try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) { + + ProjectTopicName topicName = ProjectTopicName.of(projectId, topicId); + ProjectSubscriptionName subscriptionName = + ProjectSubscriptionName.of(projectId, subscriptionId); + + BigQueryConfig bigqueryConfig = + BigQueryConfig.newBuilder().setTable(bigqueryTableId).setWriteMetadata(true).build(); + + Subscription subscription = + subscriptionAdminClient.createSubscription( + Subscription.newBuilder() + .setName(subscriptionName.toString()) + .setTopic(topicName.toString()) + .setBigqueryConfig(bigqueryConfig) + .build()); + + System.out.println("Created a BigQuery subscription: " + subscription.getAllFields()); + } + } +} +// [END pubsub_create_bigquery_subscription] diff --git a/samples/snippets/src/main/java/pubsub/CreateCloudStorageSubscriptionExample.java b/samples/snippets/src/main/java/pubsub/CreateCloudStorageSubscriptionExample.java new file mode 100644 index 000000000..654ba3857 --- /dev/null +++ b/samples/snippets/src/main/java/pubsub/CreateCloudStorageSubscriptionExample.java @@ -0,0 +1,78 @@ +/* + * Copyright 2022 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 pubsub; + +// [START pubsub_create_cloud_storage_subscription] +import com.google.cloud.pubsub.v1.SubscriptionAdminClient; +import com.google.protobuf.Duration; +import com.google.pubsub.v1.CloudStorageConfig; +import com.google.pubsub.v1.ProjectSubscriptionName; +import com.google.pubsub.v1.ProjectTopicName; +import com.google.pubsub.v1.Subscription; +import java.io.IOException; + +public class CreateCloudStorageSubscriptionExample { + public static void main(String... args) throws Exception { + // TODO(developer): Replace these variables before running the sample. + String projectId = "your-project-id"; + String topicId = "your-topic-id"; + String subscriptionId = "your-subscription-id"; + String bucket = "your-bucket"; + String filenamePrefix = "log_events_"; + String filenameSuffix = ".text"; + Duration maxDuration = Duration.newBuilder().setSeconds(300).build(); + + createCloudStorageSubscription( + projectId, topicId, subscriptionId, bucket, filenamePrefix, filenameSuffix, maxDuration); + } + + public static void createCloudStorageSubscription( + String projectId, + String topicId, + String subscriptionId, + String bucket, + String filenamePrefix, + String filenameSuffix, + Duration maxDuration) + throws IOException { + try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) { + + ProjectTopicName topicName = ProjectTopicName.of(projectId, topicId); + ProjectSubscriptionName subscriptionName = + ProjectSubscriptionName.of(projectId, subscriptionId); + + CloudStorageConfig cloudStorageConfig = + CloudStorageConfig.newBuilder() + .setBucket(bucket) + .setFilenamePrefix(filenamePrefix) + .setFilenameSuffix(filenameSuffix) + .setMaxDuration(maxDuration) + .build(); + + Subscription subscription = + subscriptionAdminClient.createSubscription( + Subscription.newBuilder() + .setName(subscriptionName.toString()) + .setTopic(topicName.toString()) + .setCloudStorageConfig(cloudStorageConfig) + .build()); + + System.out.println("Created a CloudStorage subscription: " + subscription.getAllFields()); + } + } +} +// [END pubsub_create_cloud_storage_subscription] diff --git a/samples/snippets/src/main/java/pubsub/CreateProtoSchemaExample.java b/samples/snippets/src/main/java/pubsub/CreateProtoSchemaExample.java index a8efdeb8e..e7b5bf113 100644 --- a/samples/snippets/src/main/java/pubsub/CreateProtoSchemaExample.java +++ b/samples/snippets/src/main/java/pubsub/CreateProtoSchemaExample.java @@ -38,7 +38,7 @@ public static void main(String... args) throws Exception { createProtoSchemaExample(projectId, schemaId, protoFile); } - public static void createProtoSchemaExample(String projectId, String schemaId, String protoFile) + public static Schema createProtoSchemaExample(String projectId, String schemaId, String protoFile) throws IOException { ProjectName projectName = ProjectName.of(projectId); @@ -60,8 +60,10 @@ public static void createProtoSchemaExample(String projectId, String schemaId, S schemaId); System.out.println("Created a schema using a protobuf schema:\n" + schema); + return schema; } catch (AlreadyExistsException e) { System.out.println(schemaName + "already exists."); + return null; } } } diff --git a/samples/snippets/src/main/java/pubsub/CreatePullSubscriptionExample.java b/samples/snippets/src/main/java/pubsub/CreatePullSubscriptionExample.java index b8ba1ae68..e58fd621e 100644 --- a/samples/snippets/src/main/java/pubsub/CreatePullSubscriptionExample.java +++ b/samples/snippets/src/main/java/pubsub/CreatePullSubscriptionExample.java @@ -19,9 +19,9 @@ // [START pubsub_create_pull_subscription] import com.google.cloud.pubsub.v1.SubscriptionAdminClient; -import com.google.pubsub.v1.ProjectSubscriptionName; import com.google.pubsub.v1.PushConfig; import com.google.pubsub.v1.Subscription; +import com.google.pubsub.v1.SubscriptionName; import com.google.pubsub.v1.TopicName; import java.io.IOException; @@ -39,8 +39,7 @@ public static void createPullSubscriptionExample( String projectId, String subscriptionId, String topicId) throws IOException { try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) { TopicName topicName = TopicName.of(projectId, topicId); - ProjectSubscriptionName subscriptionName = - ProjectSubscriptionName.of(projectId, subscriptionId); + SubscriptionName subscriptionName = SubscriptionName.of(projectId, subscriptionId); // Create a pull subscription with default acknowledgement deadline of 10 seconds. // Messages not successfully acknowledged within 10 seconds will get resent by the server. Subscription subscription = diff --git a/samples/snippets/src/main/java/pubsub/CreatePushSubscriptionExample.java b/samples/snippets/src/main/java/pubsub/CreatePushSubscriptionExample.java index db0175b07..b77795290 100644 --- a/samples/snippets/src/main/java/pubsub/CreatePushSubscriptionExample.java +++ b/samples/snippets/src/main/java/pubsub/CreatePushSubscriptionExample.java @@ -19,9 +19,9 @@ // [START pubsub_create_push_subscription] import com.google.cloud.pubsub.v1.SubscriptionAdminClient; -import com.google.pubsub.v1.ProjectSubscriptionName; import com.google.pubsub.v1.PushConfig; import com.google.pubsub.v1.Subscription; +import com.google.pubsub.v1.SubscriptionName; import com.google.pubsub.v1.TopicName; import java.io.IOException; @@ -41,8 +41,7 @@ public static void createPushSubscriptionExample( throws IOException { try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) { TopicName topicName = TopicName.of(projectId, topicId); - ProjectSubscriptionName subscriptionName = - ProjectSubscriptionName.of(projectId, subscriptionId); + SubscriptionName subscriptionName = SubscriptionName.of(projectId, subscriptionId); PushConfig pushConfig = PushConfig.newBuilder().setPushEndpoint(pushEndpoint).build(); // Create a push subscription with default acknowledgement deadline of 10 seconds. diff --git a/samples/snippets/src/main/java/pubsub/CreateSubscriptionWithExactlyOnceDelivery.java b/samples/snippets/src/main/java/pubsub/CreateSubscriptionWithExactlyOnceDelivery.java new file mode 100644 index 000000000..e5f4a0e92 --- /dev/null +++ b/samples/snippets/src/main/java/pubsub/CreateSubscriptionWithExactlyOnceDelivery.java @@ -0,0 +1,59 @@ +/* + * Copyright 2022 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 pubsub; + +// [START pubsub_create_subscription_with_exactly_once_delivery] +import com.google.cloud.pubsub.v1.SubscriptionAdminClient; +import com.google.pubsub.v1.ProjectSubscriptionName; +import com.google.pubsub.v1.ProjectTopicName; +import com.google.pubsub.v1.Subscription; +import java.io.IOException; + +public class CreateSubscriptionWithExactlyOnceDelivery { + public static void main(String... args) throws Exception { + // TODO(developer): Replace these variables before running the sample. + String projectId = "your-project-id"; + String topicId = "your-topic-id"; + String subscriptionId = "your-subscription-id"; + + createSubscriptionWithExactlyOnceDeliveryExample(projectId, topicId, subscriptionId); + } + + public static void createSubscriptionWithExactlyOnceDeliveryExample( + String projectId, String topicId, String subscriptionId) throws IOException { + try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) { + + ProjectTopicName topicName = ProjectTopicName.of(projectId, topicId); + ProjectSubscriptionName subscriptionName = + ProjectSubscriptionName.of(projectId, subscriptionId); + + Subscription subscription = + subscriptionAdminClient.createSubscription( + Subscription.newBuilder() + .setName(subscriptionName.toString()) + .setTopic(topicName.toString()) + // Enable exactly once delivery in the subscription. + .setEnableExactlyOnceDelivery(true) + .build()); + + System.out.println( + "Created a subscription with exactly once delivery enabled: " + + subscription.getAllFields()); + } + } +} +// [END pubsub_create_subscription_with_exactly_once_delivery] diff --git a/samples/snippets/src/main/java/pubsub/CreateSubscriptionWithFiltering.java b/samples/snippets/src/main/java/pubsub/CreateSubscriptionWithFiltering.java new file mode 100644 index 000000000..40bbac034 --- /dev/null +++ b/samples/snippets/src/main/java/pubsub/CreateSubscriptionWithFiltering.java @@ -0,0 +1,59 @@ +/* + * Copyright 2020 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 pubsub; + +// [START pubsub_create_subscription_with_filter] +import com.google.cloud.pubsub.v1.SubscriptionAdminClient; +import com.google.pubsub.v1.ProjectSubscriptionName; +import com.google.pubsub.v1.ProjectTopicName; +import com.google.pubsub.v1.Subscription; +import java.io.IOException; + +public class CreateSubscriptionWithFiltering { + public static void main(String... args) throws Exception { + // TODO(developer): Replace these variables before running the sample. + String projectId = "your-project-id"; + String topicId = "your-topic-id"; + String subscriptionId = "your-subscription-id"; + String filter = "attributes.author=\"unknown\""; + + createSubscriptionWithFilteringExample(projectId, topicId, subscriptionId, filter); + } + + public static void createSubscriptionWithFilteringExample( + String projectId, String topicId, String subscriptionId, String filter) throws IOException { + try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) { + + ProjectTopicName topicName = ProjectTopicName.of(projectId, topicId); + ProjectSubscriptionName subscriptionName = + ProjectSubscriptionName.of(projectId, subscriptionId); + + Subscription subscription = + subscriptionAdminClient.createSubscription( + Subscription.newBuilder() + .setName(subscriptionName.toString()) + .setTopic(topicName.toString()) + // Receive messages with attribute key "author" and value "unknown". + .setFilter(filter) + .build()); + + System.out.println( + "Created a subscription with filtering enabled: " + subscription.getAllFields()); + } + } +} +// [END pubsub_create_subscription_with_filter] diff --git a/samples/snippets/src/main/java/pubsub/CreateSubscriptionWithSmtExample.java b/samples/snippets/src/main/java/pubsub/CreateSubscriptionWithSmtExample.java new file mode 100644 index 000000000..53516c540 --- /dev/null +++ b/samples/snippets/src/main/java/pubsub/CreateSubscriptionWithSmtExample.java @@ -0,0 +1,74 @@ +/* + * 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 pubsub; + +// [START pubsub_create_subscription_with_smt] +import com.google.cloud.pubsub.v1.SubscriptionAdminClient; +import com.google.pubsub.v1.JavaScriptUDF; +import com.google.pubsub.v1.MessageTransform; +import com.google.pubsub.v1.ProjectSubscriptionName; +import com.google.pubsub.v1.ProjectTopicName; +import com.google.pubsub.v1.Subscription; +import java.io.IOException; + +public class CreateSubscriptionWithSmtExample { + public static void main(String... args) throws Exception { + // TODO(developer): Replace these variables before running the sample. + String projectId = "your-project-id"; + String topicId = "your-topic-id"; + String subscriptionId = "your-subscription-id"; + + createSubscriptionWithSmtExample(projectId, topicId, subscriptionId); + } + + public static void createSubscriptionWithSmtExample( + String projectId, String topicId, String subscriptionId) throws IOException { + + // UDF that removes the 'ssn' field, if present + String code = + "function redactSSN(message, metadata) {" + + " const data = JSON.parse(message.data);" + + " delete data['ssn'];" + + " message.data = JSON.stringify(data);" + + " return message;" + + "}"; + String functionName = "redactSSN"; + + JavaScriptUDF udf = + JavaScriptUDF.newBuilder().setCode(code).setFunctionName(functionName).build(); + MessageTransform transform = MessageTransform.newBuilder().setJavascriptUdf(udf).build(); + + try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) { + + ProjectTopicName topicName = ProjectTopicName.of(projectId, topicId); + ProjectSubscriptionName subscriptionName = + ProjectSubscriptionName.of(projectId, subscriptionId); + + Subscription subscription = + subscriptionAdminClient.createSubscription( + Subscription.newBuilder() + .setName(subscriptionName.toString()) + .setTopic(topicName.toString()) + // Add the UDF message transform + .addMessageTransforms(transform) + .build()); + + System.out.println("Created subscription with SMT: " + subscription.getAllFields()); + } + } +} +// [END pubsub_create_subscription_with_smt] diff --git a/samples/snippets/src/main/java/pubsub/CreateTopicWithAwsMskIngestionExample.java b/samples/snippets/src/main/java/pubsub/CreateTopicWithAwsMskIngestionExample.java new file mode 100644 index 000000000..52aed57dd --- /dev/null +++ b/samples/snippets/src/main/java/pubsub/CreateTopicWithAwsMskIngestionExample.java @@ -0,0 +1,74 @@ +/* + * 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 pubsub; + +// [START pubsub_create_topic_with_aws_msk_ingestion] + +import com.google.cloud.pubsub.v1.TopicAdminClient; +import com.google.pubsub.v1.IngestionDataSourceSettings; +import com.google.pubsub.v1.Topic; +import com.google.pubsub.v1.TopicName; +import java.io.IOException; + +public class CreateTopicWithAwsMskIngestionExample { + public static void main(String... args) throws Exception { + // TODO(developer): Replace these variables before running the sample. + String projectId = "your-project-id"; + String topicId = "your-topic-id"; + // AWS MSK ingestion settings. + String clusterArn = "cluster-arn"; + String mskTopic = "msk-topic"; + String awsRoleArn = "aws-role-arn"; + String gcpServiceAccount = "gcp-service-account"; + + createTopicWithAwsMskIngestionExample( + projectId, topicId, clusterArn, mskTopic, awsRoleArn, gcpServiceAccount); + } + + public static void createTopicWithAwsMskIngestionExample( + String projectId, + String topicId, + String clusterArn, + String mskTopic, + String awsRoleArn, + String gcpServiceAccount) + throws IOException { + try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) { + TopicName topicName = TopicName.of(projectId, topicId); + + IngestionDataSourceSettings.AwsMsk awsMsk = + IngestionDataSourceSettings.AwsMsk.newBuilder() + .setClusterArn(clusterArn) + .setTopic(mskTopic) + .setAwsRoleArn(awsRoleArn) + .setGcpServiceAccount(gcpServiceAccount) + .build(); + IngestionDataSourceSettings ingestionDataSourceSettings = + IngestionDataSourceSettings.newBuilder().setAwsMsk(awsMsk).build(); + + Topic topic = + topicAdminClient.createTopic( + Topic.newBuilder() + .setName(topicName.toString()) + .setIngestionDataSourceSettings(ingestionDataSourceSettings) + .build()); + + System.out.println("Created topic with AWS MSK ingestion settings: " + topic.getAllFields()); + } + } +} +// [END pubsub_create_topic_with_aws_msk_ingestion] diff --git a/samples/snippets/src/main/java/pubsub/CreateTopicWithAzureEventHubsIngestionExample.java b/samples/snippets/src/main/java/pubsub/CreateTopicWithAzureEventHubsIngestionExample.java new file mode 100644 index 000000000..fb72a3e1d --- /dev/null +++ b/samples/snippets/src/main/java/pubsub/CreateTopicWithAzureEventHubsIngestionExample.java @@ -0,0 +1,92 @@ +/* + * 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 pubsub; + +// [START pubsub_create_topic_with_azure_event_hubs_ingestion] + +import com.google.cloud.pubsub.v1.TopicAdminClient; +import com.google.pubsub.v1.IngestionDataSourceSettings; +import com.google.pubsub.v1.Topic; +import com.google.pubsub.v1.TopicName; +import java.io.IOException; + +public class CreateTopicWithAzureEventHubsIngestionExample { + public static void main(String... args) throws Exception { + // TODO(developer): Replace these variables before running the sample. + String projectId = "your-project-id"; + String topicId = "your-topic-id"; + // Azure Event Hubs ingestion settings. + String resourceGroup = "resource-group"; + String namespace = "namespace"; + String eventHub = "event-hub"; + String clientId = "client-id"; + String tenantId = "tenant-id"; + String subscriptionId = "subscription-id"; + String gcpServiceAccount = "gcp-service-account"; + + createTopicWithAzureEventHubsIngestionExample( + projectId, + topicId, + resourceGroup, + namespace, + eventHub, + clientId, + tenantId, + subscriptionId, + gcpServiceAccount); + } + + public static void createTopicWithAzureEventHubsIngestionExample( + String projectId, + String topicId, + String resourceGroup, + String namespace, + String eventHub, + String clientId, + String tenantId, + String subscriptionId, + String gcpServiceAccount) + throws IOException { + try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) { + TopicName topicName = TopicName.of(projectId, topicId); + + IngestionDataSourceSettings.AzureEventHubs azureEventHubs = + IngestionDataSourceSettings.AzureEventHubs.newBuilder() + .setResourceGroup(resourceGroup) + .setNamespace(namespace) + .setEventHub(eventHub) + .setClientId(clientId) + .setTenantId(tenantId) + .setSubscriptionId(subscriptionId) + .setGcpServiceAccount(gcpServiceAccount) + .build(); + IngestionDataSourceSettings ingestionDataSourceSettings = + IngestionDataSourceSettings.newBuilder().setAzureEventHubs(azureEventHubs).build(); + + Topic topic = + topicAdminClient.createTopic( + Topic.newBuilder() + .setName(topicName.toString()) + .setIngestionDataSourceSettings(ingestionDataSourceSettings) + .build()); + + System.out.println( + "Created topic with Azure Event Hubs ingestion settings: " + topic.getAllFields()); + } + } +} +// [END pubsub_create_topic_with_azure_event_hubs_ingestion] diff --git a/samples/snippets/src/main/java/pubsub/CreateTopicWithCloudStorageIngestionExample.java b/samples/snippets/src/main/java/pubsub/CreateTopicWithCloudStorageIngestionExample.java new file mode 100644 index 000000000..d795cdc28 --- /dev/null +++ b/samples/snippets/src/main/java/pubsub/CreateTopicWithCloudStorageIngestionExample.java @@ -0,0 +1,109 @@ +/* + * Copyright 2024 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 pubsub; + +// [START pubsub_create_topic_with_cloud_storage_ingestion] + +import com.google.cloud.pubsub.v1.TopicAdminClient; +import com.google.protobuf.util.Timestamps; +import com.google.pubsub.v1.IngestionDataSourceSettings; +import com.google.pubsub.v1.Topic; +import com.google.pubsub.v1.TopicName; +import java.io.IOException; +import java.text.ParseException; + +public class CreateTopicWithCloudStorageIngestionExample { + public static void main(String... args) throws Exception { + // TODO(developer): Replace these variables before running the sample. + String projectId = "your-project-id"; + String topicId = "your-topic-id"; + // Cloud Storage ingestion settings. + // bucket and inputFormat are required arguments. + String bucket = "your-bucket"; + String inputFormat = "text"; + String textDelimiter = "\n"; + String matchGlob = "**.txt"; + String minimumObjectCreateTime = "YYYY-MM-DDThh:mm:ssZ"; + + createTopicWithCloudStorageIngestionExample( + projectId, topicId, bucket, inputFormat, textDelimiter, matchGlob, minimumObjectCreateTime); + } + + public static void createTopicWithCloudStorageIngestionExample( + String projectId, + String topicId, + String bucket, + String inputFormat, + String textDelimiter, + String matchGlob, + String minimumObjectCreateTime) + throws IOException { + try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) { + IngestionDataSourceSettings.CloudStorage.Builder cloudStorageBuilder = + IngestionDataSourceSettings.CloudStorage.newBuilder().setBucket(bucket); + switch (inputFormat) { + case "text": + cloudStorageBuilder.setTextFormat( + IngestionDataSourceSettings.CloudStorage.TextFormat.newBuilder() + .setDelimiter(textDelimiter) + .build()); + break; + case "avro": + cloudStorageBuilder.setAvroFormat( + IngestionDataSourceSettings.CloudStorage.AvroFormat.getDefaultInstance()); + break; + case "pubsub_avro": + cloudStorageBuilder.setPubsubAvroFormat( + IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat.getDefaultInstance()); + break; + default: + throw new IllegalArgumentException( + "inputFormat must be in ('text', 'avro', 'pubsub_avro'); got value: " + inputFormat); + } + + if (matchGlob != null && !matchGlob.isEmpty()) { + cloudStorageBuilder.setMatchGlob(matchGlob); + } + + if (minimumObjectCreateTime != null && !minimumObjectCreateTime.isEmpty()) { + try { + cloudStorageBuilder.setMinimumObjectCreateTime(Timestamps.parse(minimumObjectCreateTime)); + } catch (ParseException e) { + System.err.println("Unable to parse timestamp: " + minimumObjectCreateTime); + } + } + + IngestionDataSourceSettings ingestionDataSourceSettings = + IngestionDataSourceSettings.newBuilder() + .setCloudStorage(cloudStorageBuilder.build()) + .build(); + + TopicName topicName = TopicName.of(projectId, topicId); + + Topic topic = + topicAdminClient.createTopic( + Topic.newBuilder() + .setName(topicName.toString()) + .setIngestionDataSourceSettings(ingestionDataSourceSettings) + .build()); + + System.out.println( + "Created topic with Cloud Storage ingestion settings: " + topic.getAllFields()); + } + } +} +// [END pubsub_create_topic_with_cloud_storage_ingestion] diff --git a/samples/snippets/src/main/java/pubsub/CreateTopicWithConfluentCloudIngestionExample.java b/samples/snippets/src/main/java/pubsub/CreateTopicWithConfluentCloudIngestionExample.java new file mode 100644 index 000000000..cd27a0ac9 --- /dev/null +++ b/samples/snippets/src/main/java/pubsub/CreateTopicWithConfluentCloudIngestionExample.java @@ -0,0 +1,84 @@ +/* + * 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 pubsub; + +// [START pubsub_create_topic_with_confluent_cloud_ingestion] + +import com.google.cloud.pubsub.v1.TopicAdminClient; +import com.google.pubsub.v1.IngestionDataSourceSettings; +import com.google.pubsub.v1.Topic; +import com.google.pubsub.v1.TopicName; +import java.io.IOException; + +public class CreateTopicWithConfluentCloudIngestionExample { + public static void main(String... args) throws Exception { + // TODO(developer): Replace these variables before running the sample. + String projectId = "your-project-id"; + String topicId = "your-topic-id"; + // Confluent Cloud ingestion settings. + String bootstrapServer = "bootstrap-server"; + String clusterId = "cluster-id"; + String confluentTopic = "confluent-topic"; + String identityPoolId = "identity-pool-id"; + String gcpServiceAccount = "gcp-service-account"; + + createTopicWithConfluentCloudIngestionExample( + projectId, + topicId, + bootstrapServer, + clusterId, + confluentTopic, + identityPoolId, + gcpServiceAccount); + } + + public static void createTopicWithConfluentCloudIngestionExample( + String projectId, + String topicId, + String bootstrapServer, + String clusterId, + String confluentTopic, + String identityPoolId, + String gcpServiceAccount) + throws IOException { + try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) { + TopicName topicName = TopicName.of(projectId, topicId); + + IngestionDataSourceSettings.ConfluentCloud confluentCloud = + IngestionDataSourceSettings.ConfluentCloud.newBuilder() + .setBootstrapServer(bootstrapServer) + .setClusterId(clusterId) + .setTopic(confluentTopic) + .setIdentityPoolId(identityPoolId) + .setGcpServiceAccount(gcpServiceAccount) + .build(); + IngestionDataSourceSettings ingestionDataSourceSettings = + IngestionDataSourceSettings.newBuilder().setConfluentCloud(confluentCloud).build(); + + Topic topic = + topicAdminClient.createTopic( + Topic.newBuilder() + .setName(topicName.toString()) + .setIngestionDataSourceSettings(ingestionDataSourceSettings) + .build()); + + System.out.println( + "Created topic with Confluent Cloud ingestion settings: " + topic.getAllFields()); + } + } +} +// [END pubsub_create_topic_with_confluent_cloud_ingestion] diff --git a/samples/snippets/src/main/java/pubsub/CreateTopicWithKinesisIngestionExample.java b/samples/snippets/src/main/java/pubsub/CreateTopicWithKinesisIngestionExample.java new file mode 100644 index 000000000..6f79ef6b7 --- /dev/null +++ b/samples/snippets/src/main/java/pubsub/CreateTopicWithKinesisIngestionExample.java @@ -0,0 +1,74 @@ +/* + * Copyright 2024 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 pubsub; + +// [START pubsub_create_topic_with_kinesis_ingestion] + +import com.google.cloud.pubsub.v1.TopicAdminClient; +import com.google.pubsub.v1.IngestionDataSourceSettings; +import com.google.pubsub.v1.Topic; +import com.google.pubsub.v1.TopicName; +import java.io.IOException; + +public class CreateTopicWithKinesisIngestionExample { + public static void main(String... args) throws Exception { + // TODO(developer): Replace these variables before running the sample. + String projectId = "your-project-id"; + String topicId = "your-topic-id"; + // Kinesis ingestion settings. + String streamArn = "stream-arn"; + String consumerArn = "consumer-arn"; + String awsRoleArn = "aws-role-arn"; + String gcpServiceAccount = "gcp-service-account"; + + createTopicWithKinesisIngestionExample( + projectId, topicId, streamArn, consumerArn, awsRoleArn, gcpServiceAccount); + } + + public static void createTopicWithKinesisIngestionExample( + String projectId, + String topicId, + String streamArn, + String consumerArn, + String awsRoleArn, + String gcpServiceAccount) + throws IOException { + try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) { + TopicName topicName = TopicName.of(projectId, topicId); + + IngestionDataSourceSettings.AwsKinesis awsKinesis = + IngestionDataSourceSettings.AwsKinesis.newBuilder() + .setStreamArn(streamArn) + .setConsumerArn(consumerArn) + .setAwsRoleArn(awsRoleArn) + .setGcpServiceAccount(gcpServiceAccount) + .build(); + IngestionDataSourceSettings ingestionDataSourceSettings = + IngestionDataSourceSettings.newBuilder().setAwsKinesis(awsKinesis).build(); + + Topic topic = + topicAdminClient.createTopic( + Topic.newBuilder() + .setName(topicName.toString()) + .setIngestionDataSourceSettings(ingestionDataSourceSettings) + .build()); + + System.out.println("Created topic with Kinesis ingestion settings: " + topic.getAllFields()); + } + } +} +// [END pubsub_create_topic_with_kinesis_ingestion] diff --git a/samples/snippets/src/main/java/pubsub/CreateTopicWithSchemaRevisionsExample.java b/samples/snippets/src/main/java/pubsub/CreateTopicWithSchemaRevisionsExample.java new file mode 100644 index 000000000..69322d927 --- /dev/null +++ b/samples/snippets/src/main/java/pubsub/CreateTopicWithSchemaRevisionsExample.java @@ -0,0 +1,82 @@ +/* + * Copyright 2023 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 pubsub; + +// [START pubsub_create_topic_with_schema_revisions] + +import com.google.api.gax.rpc.AlreadyExistsException; +import com.google.cloud.pubsub.v1.TopicAdminClient; +import com.google.pubsub.v1.Encoding; +import com.google.pubsub.v1.SchemaName; +import com.google.pubsub.v1.SchemaSettings; +import com.google.pubsub.v1.Topic; +import com.google.pubsub.v1.TopicName; +import java.io.IOException; + +public class CreateTopicWithSchemaRevisionsExample { + + public static void main(String... args) throws Exception { + // TODO(developer): Replace these variables before running the sample. + String projectId = "your-project-id"; + String topicId = "your-topic-id"; + // Use an existing schema. + String schemaId = "your-schema-id"; + // Choose either BINARY or JSON message serialization in this topic. + Encoding encoding = Encoding.BINARY; + // Set the minimum and maximum revsion ID + String firstRevisionId = "your-revision-id"; + String lastRevisionId = "your-revision-id"; + + createTopicWithSchemaRevisionsExample( + projectId, topicId, schemaId, firstRevisionId, lastRevisionId, encoding); + } + + public static void createTopicWithSchemaRevisionsExample( + String projectId, + String topicId, + String schemaId, + String firstRevisionid, + String lastRevisionId, + Encoding encoding) + throws IOException { + TopicName topicName = TopicName.of(projectId, topicId); + SchemaName schemaName = SchemaName.of(projectId, schemaId); + + SchemaSettings schemaSettings = + SchemaSettings.newBuilder() + .setSchema(schemaName.toString()) + .setFirstRevisionId(firstRevisionid) + .setLastRevisionId(lastRevisionId) + .setEncoding(encoding) + .build(); + + try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) { + + Topic topic = + topicAdminClient.createTopic( + Topic.newBuilder() + .setName(topicName.toString()) + .setSchemaSettings(schemaSettings) + .build()); + + System.out.println("Created topic with schema: " + topic.getName()); + } catch (AlreadyExistsException e) { + System.out.println(schemaName + "already exists."); + } + } +} +// [END pubsub_create_topic_with_schema_revisions] diff --git a/samples/snippets/src/main/java/pubsub/CreateTopicWithSmtExample.java b/samples/snippets/src/main/java/pubsub/CreateTopicWithSmtExample.java new file mode 100644 index 000000000..c96322015 --- /dev/null +++ b/samples/snippets/src/main/java/pubsub/CreateTopicWithSmtExample.java @@ -0,0 +1,72 @@ +/* + * 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 pubsub; + +// [START pubsub_create_topic_with_smt] + +import com.google.api.gax.rpc.AlreadyExistsException; +import com.google.cloud.pubsub.v1.TopicAdminClient; +import com.google.pubsub.v1.JavaScriptUDF; +import com.google.pubsub.v1.MessageTransform; +import com.google.pubsub.v1.Topic; +import com.google.pubsub.v1.TopicName; +import java.io.IOException; + +public class CreateTopicWithSmtExample { + + public static void main(String... args) throws Exception { + // TODO(developer): Replace these variables before running the sample. + String projectId = "your-project-id"; + String topicId = "your-topic-id"; + + createTopicWithSmtExample(projectId, topicId); + } + + public static void createTopicWithSmtExample(String projectId, String topicId) + throws IOException { + TopicName topicName = TopicName.of(projectId, topicId); + + // UDF that removes the 'ssn' field, if present + String code = + "function redactSSN(message, metadata) {" + + " const data = JSON.parse(message.data);" + + " delete data['ssn'];" + + " message.data = JSON.stringify(data);" + + " return message;" + + "}"; + String functionName = "redactSSN"; + + JavaScriptUDF udf = + JavaScriptUDF.newBuilder().setCode(code).setFunctionName(functionName).build(); + MessageTransform transform = MessageTransform.newBuilder().setJavascriptUdf(udf).build(); + try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) { + + Topic topic = + topicAdminClient.createTopic( + Topic.newBuilder() + .setName(topicName.toString()) + // Add the UDF message transform + .addMessageTransforms(transform) + .build()); + + System.out.println("Created topic with SMT: " + topic.getName()); + } catch (AlreadyExistsException e) { + System.out.println(topicName + "already exists."); + } + } +} + // [END pubsub_create_topic_with_smt] diff --git a/samples/snippets/src/main/java/pubsub/CreateUnwrappedPushSubscriptionExample.java b/samples/snippets/src/main/java/pubsub/CreateUnwrappedPushSubscriptionExample.java new file mode 100644 index 000000000..d2fef4382 --- /dev/null +++ b/samples/snippets/src/main/java/pubsub/CreateUnwrappedPushSubscriptionExample.java @@ -0,0 +1,63 @@ +/* + * Copyright 2016 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 pubsub; + +// [START pubsub_create_unwrapped_push_subscription] + +import com.google.cloud.pubsub.v1.SubscriptionAdminClient; +import com.google.pubsub.v1.PushConfig; +import com.google.pubsub.v1.PushConfig.NoWrapper; +import com.google.pubsub.v1.Subscription; +import com.google.pubsub.v1.SubscriptionName; +import com.google.pubsub.v1.TopicName; +import java.io.IOException; + +public class CreateUnwrappedPushSubscriptionExample { + public static void main(String... args) throws Exception { + // TODO(developer): Replace these variables before running the sample. + String projectId = "your-project-id"; + String subscriptionId = "your-subscription-id"; + String topicId = "your-topic-id"; + String pushEndpoint = "https://my-test-project.appspot.com/push"; + + createPushSubscriptionExample(projectId, subscriptionId, topicId, pushEndpoint); + } + + public static void createPushSubscriptionExample( + String projectId, String subscriptionId, String topicId, String pushEndpoint) + throws IOException { + try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) { + TopicName topicName = TopicName.of(projectId, topicId); + SubscriptionName subscriptionName = SubscriptionName.of(projectId, subscriptionId); + NoWrapper noWrapper = + NoWrapper.newBuilder() + // Determines if message metadata is added to the HTTP headers of + // the delivered message. + .setWriteMetadata(true) + .build(); + PushConfig pushConfig = + PushConfig.newBuilder().setPushEndpoint(pushEndpoint).setNoWrapper(noWrapper).build(); + + // Create a push subscription with default acknowledgement deadline of 10 seconds. + // Messages not successfully acknowledged within 10 seconds will get resent by the server. + Subscription subscription = + subscriptionAdminClient.createSubscription(subscriptionName, topicName, pushConfig, 10); + System.out.println("Created push subscription: " + subscription.getName()); + } + } +} +// [END pubsub_create_unwrapped_push_subscription] diff --git a/samples/snippets/src/main/java/pubsub/DeleteSchemaRevisionExample.java b/samples/snippets/src/main/java/pubsub/DeleteSchemaRevisionExample.java new file mode 100644 index 000000000..30aa65a53 --- /dev/null +++ b/samples/snippets/src/main/java/pubsub/DeleteSchemaRevisionExample.java @@ -0,0 +1,55 @@ +/* + * Copyright 2023 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 pubsub; + +// [START pubsub_delete_schema_revision] + +import com.google.api.gax.rpc.NotFoundException; +import com.google.cloud.pubsub.v1.SchemaServiceClient; +import com.google.pubsub.v1.DeleteSchemaRevisionRequest; +import com.google.pubsub.v1.SchemaName; +import java.io.IOException; + +public class DeleteSchemaRevisionExample { + + public static void main(String... args) throws Exception { + // TODO(developer): Replace these variables before running the sample. + String projectId = "your-project-id"; + String schemaId = "your-schema-id@your-revision-id"; + + deleteSchemaRevisionExample(projectId, schemaId); + } + + public static void deleteSchemaRevisionExample(String projectId, String schemaId) + throws IOException { + SchemaName schemaName = SchemaName.of(projectId, schemaId); + + try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) { + + DeleteSchemaRevisionRequest request = + DeleteSchemaRevisionRequest.newBuilder().setName(schemaName.toString()).build(); + + schemaServiceClient.deleteSchemaRevision(request); + + System.out.println("Deleted a schema revision:" + schemaName); + + } catch (NotFoundException e) { + System.out.println(schemaName + "not found."); + } + } +} +// [END pubsub_delete_schema_revision] diff --git a/samples/snippets/src/main/java/pubsub/DeleteSubscriptionExample.java b/samples/snippets/src/main/java/pubsub/DeleteSubscriptionExample.java index 28d683f1f..0142ba2c3 100644 --- a/samples/snippets/src/main/java/pubsub/DeleteSubscriptionExample.java +++ b/samples/snippets/src/main/java/pubsub/DeleteSubscriptionExample.java @@ -20,7 +20,7 @@ import com.google.api.gax.rpc.NotFoundException; import com.google.cloud.pubsub.v1.SubscriptionAdminClient; -import com.google.pubsub.v1.ProjectSubscriptionName; +import com.google.pubsub.v1.SubscriptionName; import java.io.IOException; public class DeleteSubscriptionExample { @@ -36,8 +36,7 @@ public static void main(String... args) throws Exception { public static void deleteSubscriptionExample(String projectId, String subscriptionId) throws IOException { try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) { - ProjectSubscriptionName subscriptionName = - ProjectSubscriptionName.of(projectId, subscriptionId); + SubscriptionName subscriptionName = SubscriptionName.of(projectId, subscriptionId); try { subscriptionAdminClient.deleteSubscription(subscriptionName); System.out.println("Deleted subscription."); diff --git a/samples/snippets/src/main/java/pubsub/DetachSubscriptionExample.java b/samples/snippets/src/main/java/pubsub/DetachSubscriptionExample.java index 88ebb8e05..b414563c2 100644 --- a/samples/snippets/src/main/java/pubsub/DetachSubscriptionExample.java +++ b/samples/snippets/src/main/java/pubsub/DetachSubscriptionExample.java @@ -20,8 +20,8 @@ import com.google.cloud.pubsub.v1.SubscriptionAdminClient; import com.google.cloud.pubsub.v1.TopicAdminClient; import com.google.pubsub.v1.DetachSubscriptionRequest; -import com.google.pubsub.v1.ProjectSubscriptionName; import com.google.pubsub.v1.Subscription; +import com.google.pubsub.v1.SubscriptionName; import java.io.IOException; public class DetachSubscriptionExample { @@ -36,8 +36,7 @@ public static void main(String... args) throws Exception { public static void detachSubscriptionExample(String projectId, String subscriptionId) throws IOException { - ProjectSubscriptionName subscriptionName = - ProjectSubscriptionName.of(projectId, subscriptionId); + SubscriptionName subscriptionName = SubscriptionName.of(projectId, subscriptionId); try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) { topicAdminClient.detachSubscription( diff --git a/samples/snippets/src/main/java/pubsub/GetSchemaRevisionExample.java b/samples/snippets/src/main/java/pubsub/GetSchemaRevisionExample.java new file mode 100644 index 000000000..ce8c17ee8 --- /dev/null +++ b/samples/snippets/src/main/java/pubsub/GetSchemaRevisionExample.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 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 pubsub; + +// [START pubsub_get_schema_revision] + +import com.google.api.gax.rpc.NotFoundException; +import com.google.cloud.pubsub.v1.SchemaServiceClient; +import com.google.pubsub.v1.Schema; +import com.google.pubsub.v1.SchemaName; +import java.io.IOException; + +public class GetSchemaRevisionExample { + + public static void main(String... args) throws Exception { + // TODO(developer): Replace these variables before running the sample. + String projectId = "your-project-id"; + String schemaId = "your-schema-id[@your-schema-revision]"; + getSchemaRevisionExample(projectId, schemaId); + } + + public static void getSchemaRevisionExample(String projectId, String schemaId) + throws IOException { + SchemaName schemaName = SchemaName.of(projectId, schemaId); + + try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) { + + Schema schema = schemaServiceClient.getSchema(schemaName); + + System.out.println("Got a schema:\n" + schema); + + } catch (NotFoundException e) { + System.out.println(schemaName + "not found."); + } + } +} +// [END pubsub_get_schema_revision] diff --git a/samples/snippets/src/main/java/pubsub/ListSchemaRevisionsExample.java b/samples/snippets/src/main/java/pubsub/ListSchemaRevisionsExample.java new file mode 100644 index 000000000..69cfa59ab --- /dev/null +++ b/samples/snippets/src/main/java/pubsub/ListSchemaRevisionsExample.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 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 pubsub; + +// [START pubsub_list_schema_revisions] +import com.google.cloud.pubsub.v1.SchemaServiceClient; +import com.google.pubsub.v1.Schema; +import com.google.pubsub.v1.SchemaName; +import java.io.IOException; + +public class ListSchemaRevisionsExample { + public static void main(String... args) throws Exception { + // TODO(developer): Replace these variables before running the sample. + String projectId = "your-project-id"; + String schemaId = "your-schema-id"; + + listSchemaRevisionsExample(projectId, schemaId); + } + + public static void listSchemaRevisionsExample(String projectId, String schemaId) + throws IOException { + SchemaName schemaName = SchemaName.of(projectId, schemaId); + + try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) { + for (Schema schema : schemaServiceClient.listSchemaRevisions(schemaName).iterateAll()) { + System.out.println(schema); + } + System.out.println("Listed schema revisions."); + } + } +} +// [END pubsub_list_schema_revisions] diff --git a/samples/snippets/src/main/java/pubsub/OpenTelemetryPublisherExample.java b/samples/snippets/src/main/java/pubsub/OpenTelemetryPublisherExample.java new file mode 100644 index 000000000..606c6fe36 --- /dev/null +++ b/samples/snippets/src/main/java/pubsub/OpenTelemetryPublisherExample.java @@ -0,0 +1,99 @@ +/* + * Copyright 2024 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 pubsub; + +// [START pubsub_publish_otel_tracing] + +import com.google.api.core.ApiFuture; +import com.google.cloud.opentelemetry.trace.TraceConfiguration; +import com.google.cloud.opentelemetry.trace.TraceExporter; +import com.google.cloud.pubsub.v1.Publisher; +import com.google.protobuf.ByteString; +import com.google.pubsub.v1.PubsubMessage; +import com.google.pubsub.v1.TopicName; +import io.opentelemetry.api.OpenTelemetry; +import io.opentelemetry.sdk.OpenTelemetrySdk; +import io.opentelemetry.sdk.resources.Resource; +import io.opentelemetry.sdk.trace.SdkTracerProvider; +import io.opentelemetry.sdk.trace.export.SimpleSpanProcessor; +import io.opentelemetry.sdk.trace.export.SpanExporter; +import io.opentelemetry.sdk.trace.samplers.Sampler; +import io.opentelemetry.semconv.ResourceAttributes; +import java.io.IOException; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeUnit; + +public class OpenTelemetryPublisherExample { + public static void main(String... args) throws Exception { + // TODO(developer): Replace these variables before running the sample. + String projectId = "your-project-id"; + String topicId = "your-topic-id"; + + openTelemetryPublisherExample(projectId, topicId); + } + + public static void openTelemetryPublisherExample(String projectId, String topicId) + throws IOException, ExecutionException, InterruptedException { + Resource resource = + Resource.getDefault().toBuilder() + .put(ResourceAttributes.SERVICE_NAME, "publisher-example") + .build(); + + // Creates a Cloud Trace exporter. + SpanExporter traceExporter = + TraceExporter.createWithConfiguration( + TraceConfiguration.builder().setProjectId(projectId).build()); + + SdkTracerProvider sdkTracerProvider = + SdkTracerProvider.builder() + .setResource(resource) + .addSpanProcessor(SimpleSpanProcessor.create(traceExporter)) + .setSampler(Sampler.alwaysOn()) + .build(); + + OpenTelemetry openTelemetry = + OpenTelemetrySdk.builder().setTracerProvider(sdkTracerProvider).buildAndRegisterGlobal(); + + TopicName topicName = TopicName.of(projectId, topicId); + + Publisher publisher = null; + try { + // Create a publisher instance with the created OpenTelemetry object and enabling tracing. + publisher = + Publisher.newBuilder(topicName) + .setOpenTelemetry(openTelemetry) + .setEnableOpenTelemetryTracing(true) + .build(); + + String message = "Hello World!"; + ByteString data = ByteString.copyFromUtf8(message); + PubsubMessage pubsubMessage = PubsubMessage.newBuilder().setData(data).build(); + + // Once published, returns a server-assigned message id (unique within the topic) + ApiFuture messageIdFuture = publisher.publish(pubsubMessage); + String messageId = messageIdFuture.get(); + System.out.println("Published message ID: " + messageId); + } finally { + if (publisher != null) { + // When finished with the publisher, shutdown to free up resources. + publisher.shutdown(); + publisher.awaitTermination(1, TimeUnit.MINUTES); + } + } + } +} +// [END pubsub_publish_otel_tracing] diff --git a/samples/snippets/src/main/java/pubsub/OpenTelemetrySubscriberExample.java b/samples/snippets/src/main/java/pubsub/OpenTelemetrySubscriberExample.java new file mode 100644 index 000000000..f78c38d19 --- /dev/null +++ b/samples/snippets/src/main/java/pubsub/OpenTelemetrySubscriberExample.java @@ -0,0 +1,100 @@ +/* + * Copyright 2024 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 pubsub; + +// [START pubsub_subscribe_otel_tracing] + +import com.google.cloud.opentelemetry.trace.TraceConfiguration; +import com.google.cloud.opentelemetry.trace.TraceExporter; +import com.google.cloud.pubsub.v1.AckReplyConsumer; +import com.google.cloud.pubsub.v1.MessageReceiver; +import com.google.cloud.pubsub.v1.Subscriber; +import com.google.pubsub.v1.ProjectSubscriptionName; +import com.google.pubsub.v1.PubsubMessage; +import io.opentelemetry.api.OpenTelemetry; +import io.opentelemetry.sdk.OpenTelemetrySdk; +import io.opentelemetry.sdk.resources.Resource; +import io.opentelemetry.sdk.trace.SdkTracerProvider; +import io.opentelemetry.sdk.trace.export.SimpleSpanProcessor; +import io.opentelemetry.sdk.trace.export.SpanExporter; +import io.opentelemetry.sdk.trace.samplers.Sampler; +import io.opentelemetry.semconv.ResourceAttributes; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; + +public class OpenTelemetrySubscriberExample { + public static void main(String... args) throws Exception { + // TODO(developer): Replace these variables before running the sample. + String projectId = "your-project-id"; + String subscriptionId = "your-subscription-id"; + + openTelemetrySubscriberExample(projectId, subscriptionId); + } + + public static void openTelemetrySubscriberExample(String projectId, String subscriptionId) { + Resource resource = + Resource.getDefault().toBuilder() + .put(ResourceAttributes.SERVICE_NAME, "subscriber-example") + .build(); + + // Creates a Cloud Trace exporter. + SpanExporter traceExporter = + TraceExporter.createWithConfiguration( + TraceConfiguration.builder().setProjectId(projectId).build()); + + SdkTracerProvider sdkTracerProvider = + SdkTracerProvider.builder() + .setResource(resource) + .addSpanProcessor(SimpleSpanProcessor.create(traceExporter)) + .setSampler(Sampler.alwaysOn()) + .build(); + + OpenTelemetry openTelemetry = + OpenTelemetrySdk.builder().setTracerProvider(sdkTracerProvider).buildAndRegisterGlobal(); + + ProjectSubscriptionName subscriptionName = + ProjectSubscriptionName.of(projectId, subscriptionId); + + // Instantiate an asynchronous message receiver. + MessageReceiver receiver = + (PubsubMessage message, AckReplyConsumer consumer) -> { + // Handle incoming message, then ack the received message. + System.out.println("Id: " + message.getMessageId()); + System.out.println("Data: " + message.getData().toStringUtf8()); + consumer.ack(); + }; + + Subscriber subscriber = null; + try { + subscriber = + Subscriber.newBuilder(subscriptionName, receiver) + .setOpenTelemetry(openTelemetry) + .setEnableOpenTelemetryTracing(true) + .build(); + + // Start the subscriber. + subscriber.startAsync().awaitRunning(); + System.out.printf("Listening for messages on %s:\n", subscriptionName.toString()); + // Allow the subscriber to run for 30s unless an unrecoverable error occurs. + subscriber.awaitTerminated(30, TimeUnit.SECONDS); + } catch (TimeoutException timeoutException) { + // Shut down the subscriber after 30s. Stop receiving messages. + subscriber.stopAsync(); + } + } +} + // [END pubsub_subscribe_otel_tracing] diff --git a/samples/snippets/src/main/java/pubsub/OptimisticSubscribeExample.java b/samples/snippets/src/main/java/pubsub/OptimisticSubscribeExample.java new file mode 100644 index 000000000..fbc9a183b --- /dev/null +++ b/samples/snippets/src/main/java/pubsub/OptimisticSubscribeExample.java @@ -0,0 +1,103 @@ +/* + * Copyright 2024 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 pubsub; + +// [START pubsub_optimistic_subscribe] + +import com.google.api.gax.rpc.NotFoundException; +import com.google.cloud.pubsub.v1.AckReplyConsumer; +import com.google.cloud.pubsub.v1.MessageReceiver; +import com.google.cloud.pubsub.v1.Subscriber; +import com.google.cloud.pubsub.v1.SubscriptionAdminClient; +import com.google.common.util.concurrent.MoreExecutors; +import com.google.pubsub.v1.ProjectSubscriptionName; +import com.google.pubsub.v1.PubsubMessage; +import com.google.pubsub.v1.PushConfig; +import com.google.pubsub.v1.Subscription; +import com.google.pubsub.v1.TopicName; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; + +public class OptimisticSubscribeExample { + public static void main(String... args) throws Exception { + // TODO(developer): Replace these variables before running the sample. + String projectId = "your-project-id"; + String subscriptionId = "your-subscription-id"; + String topicId = "your-topic-id"; + + optimisticSubscribeExample(projectId, subscriptionId, topicId); + } + + public static void optimisticSubscribeExample( + String projectId, String subscriptionId, String topicId) throws IOException { + ProjectSubscriptionName subscriptionName = + ProjectSubscriptionName.of(projectId, subscriptionId); + + // Instantiate an asynchronous message receiver. + MessageReceiver receiver = + (PubsubMessage message, AckReplyConsumer consumer) -> { + // Handle incoming message, then ack the received message. + System.out.println("Id: " + message.getMessageId()); + System.out.println("Data: " + message.getData().toStringUtf8()); + consumer.ack(); + }; + + Subscriber subscriber = null; + try { + subscriber = Subscriber.newBuilder(subscriptionName, receiver).build(); + + // Listen for resource NOT_FOUND errors and rebuild the subscriber and restart subscribing + // when the current subscriber encounters these errors. + subscriber.addListener( + new Subscriber.Listener() { + public void failed(Subscriber.State from, Throwable failure) { + System.out.println(failure.getStackTrace()); + if (failure instanceof NotFoundException) { + try (SubscriptionAdminClient subscriptionAdminClient = + SubscriptionAdminClient.create()) { + TopicName topicName = TopicName.of(projectId, topicId); + // Create a pull subscription with default acknowledgement deadline of 10 seconds. + // The client library will automatically extend acknowledgement deadlines. + Subscription subscription = + subscriptionAdminClient.createSubscription( + subscriptionName, topicName, PushConfig.getDefaultInstance(), 10); + System.out.println("Created pull subscription: " + subscription.getName()); + optimisticSubscribeExample(projectId, subscriptionId, topicId); + } catch (IOException err) { + System.out.println("Failed to create pull subscription: " + err.getMessage()); + } + } + } + }, + MoreExecutors.directExecutor()); + + subscriber.startAsync().awaitRunning(); + System.out.printf("Listening for messages on %s:\n", subscriptionName.toString()); + subscriber.awaitTerminated(30, TimeUnit.SECONDS); + } catch (IllegalStateException e) { + // Prevent an exception from being thrown if it is the expected NotFoundException + if (!(subscriber.failureCause() instanceof NotFoundException)) { + throw e; + } + } catch (TimeoutException e) { + subscriber.stopAsync(); + } + } +} + +// [END pubsub_optimistic_subscribe] diff --git a/samples/snippets/src/main/java/pubsub/PublishAvroRecordsExample.java b/samples/snippets/src/main/java/pubsub/PublishAvroRecordsExample.java index aa7d571c9..763882d65 100644 --- a/samples/snippets/src/main/java/pubsub/PublishAvroRecordsExample.java +++ b/samples/snippets/src/main/java/pubsub/PublishAvroRecordsExample.java @@ -74,7 +74,7 @@ public static void publishAvroRecordsExample(String projectId, String topicId) switch (encoding) { case BINARY: System.out.println("Preparing a BINARY encoder..."); - encoder = EncoderFactory.get().directBinaryEncoder(byteStream, /*reuse=*/ null); + encoder = EncoderFactory.get().directBinaryEncoder(byteStream, /* reuse= */ null); break; case JSON: diff --git a/samples/snippets/src/main/java/pubsub/PublishWithBatchSettingsExample.java b/samples/snippets/src/main/java/pubsub/PublishWithBatchSettingsExample.java index 176c36f5d..7a2252d76 100644 --- a/samples/snippets/src/main/java/pubsub/PublishWithBatchSettingsExample.java +++ b/samples/snippets/src/main/java/pubsub/PublishWithBatchSettingsExample.java @@ -49,8 +49,8 @@ public static void publishWithBatchSettingsExample(String projectId, String topi try { // Batch settings control how the publisher batches messages - long requestBytesThreshold = 5000L; // default : 1 byte - long messageCountBatchSize = 100L; // default : 1 message + long requestBytesThreshold = 5000L; // default : 1000 bytes + long messageCountBatchSize = 100L; // default : 100 message Duration publishDelayThreshold = Duration.ofMillis(100); // default : 1 ms diff --git a/samples/snippets/src/main/java/pubsub/PublishWithFlowControlExample.java b/samples/snippets/src/main/java/pubsub/PublishWithFlowControlExample.java new file mode 100644 index 000000000..b1d4a8ef8 --- /dev/null +++ b/samples/snippets/src/main/java/pubsub/PublishWithFlowControlExample.java @@ -0,0 +1,94 @@ +/* + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * 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 pubsub; + +// [START pubsub_publisher_flow_control] + +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.gax.batching.BatchingSettings; +import com.google.api.gax.batching.FlowControlSettings; +import com.google.api.gax.batching.FlowController.LimitExceededBehavior; +import com.google.cloud.pubsub.v1.Publisher; +import com.google.protobuf.ByteString; +import com.google.pubsub.v1.PubsubMessage; +import com.google.pubsub.v1.TopicName; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeUnit; + +public class PublishWithFlowControlExample { + public static void main(String... args) throws Exception { + // TODO(developer): Replace these variables before running the sample. + String projectId = "your-project-id"; + String topicId = "your-topic-id"; + + publishWithFlowControlExample(projectId, topicId); + } + + public static void publishWithFlowControlExample(String projectId, String topicId) + throws IOException, ExecutionException, InterruptedException { + TopicName topicName = TopicName.of(projectId, topicId); + Publisher publisher = null; + List> messageIdFutures = new ArrayList<>(); + + try { + // Configure how many messages the publisher client can hold in memory + // and what to do when messages exceed the limit. + FlowControlSettings flowControlSettings = + FlowControlSettings.newBuilder() + // Block more messages from being published when the limit is reached. The other + // options are Ignore (or continue publishing) and ThrowException (or error out). + .setLimitExceededBehavior(LimitExceededBehavior.Block) + .setMaxOutstandingRequestBytes(10 * 1024 * 1024L) // 10 MiB + .setMaxOutstandingElementCount(100L) // 100 messages + .build(); + + // By default, messages are not batched. + BatchingSettings batchingSettings = + BatchingSettings.newBuilder().setFlowControlSettings(flowControlSettings).build(); + + publisher = Publisher.newBuilder(topicName).setBatchingSettings(batchingSettings).build(); + + // Publish 1000 messages in quick succession may be constrained by publisher flow control. + for (int i = 0; i < 1000; i++) { + String message = "message " + i; + ByteString data = ByteString.copyFromUtf8(message); + PubsubMessage pubsubMessage = PubsubMessage.newBuilder().setData(data).build(); + + // Once published, returns a server-assigned message id (unique within the topic) + ApiFuture messageIdFuture = publisher.publish(pubsubMessage); + messageIdFutures.add(messageIdFuture); + } + } finally { + // Wait on any pending publish requests. + List messageIds = ApiFutures.allAsList(messageIdFutures).get(); + + System.out.println( + "Published " + messageIds.size() + " messages with flow control settings."); + + if (publisher != null) { + // When finished with the publisher, shut down to free up resources. + publisher.shutdown(); + publisher.awaitTermination(1, TimeUnit.MINUTES); + } + } + } +} +// [END pubsub_publisher_flow_control] diff --git a/samples/snippets/src/main/java/pubsub/PublishWithGrpcCompressionExample.java b/samples/snippets/src/main/java/pubsub/PublishWithGrpcCompressionExample.java new file mode 100644 index 000000000..ccbf7b5a8 --- /dev/null +++ b/samples/snippets/src/main/java/pubsub/PublishWithGrpcCompressionExample.java @@ -0,0 +1,77 @@ +/* + * Copyright 2022 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 pubsub; + +// [START pubsub_publisher_with_compression] +import com.google.api.core.ApiFuture; +import com.google.cloud.pubsub.v1.Publisher; +import com.google.protobuf.ByteString; +import com.google.pubsub.v1.PubsubMessage; +import com.google.pubsub.v1.TopicName; +import java.io.IOException; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeUnit; + +public class PublishWithGrpcCompressionExample { + public static void main(String... args) throws Exception { + // TODO(developer): Replace these variables before running the sample. + String projectId = "your-project-id"; + // Choose an existing topic. + String topicId = "your-topic-id"; + + publishWithGrpcCompressionExample(projectId, topicId); + } + + public static void publishWithGrpcCompressionExample(String projectId, String topicId) + throws IOException, ExecutionException, InterruptedException { + TopicName topicName = TopicName.of(projectId, topicId); + + // Create a publisher and set enable compression to true. + Publisher publisher = null; + try { + // Enable compression and configure the compression threshold to 10 bytes (default to 240 B). + // Publish requests of sizes > 10 B (excluding the request headers) will get compressed. + // The number of messages in a publish request is determined by publisher batch settings. + // Batching is turned off by default, i.e. each publish request contains only one message. + publisher = + Publisher.newBuilder(topicName) + .setEnableCompression(true) + .setCompressionBytesThreshold(10L) + .build(); + + byte[] bytes = new byte[1024]; + ByteString data = ByteString.copyFrom(bytes); + PubsubMessage pubsubMessage = PubsubMessage.newBuilder().setData(data).build(); + + // Once published, returns a server-assigned message id (unique within the topic). + // You can look up the actual size of the outbound data using the Java Logging API. + // Configure logging properties as shown in + // https://github.com/googleapis/java-pubsub/tree/main/samples/snippets/src/main/resources/logging.properties + // and look for "OUTBOUND DATA" with "length=" in the output log. + ApiFuture messageIdFuture = publisher.publish(pubsubMessage); + String messageId = messageIdFuture.get(); + System.out.println("Published a compressed message of message ID: " + messageId); + } finally { + if (publisher != null) { + // When finished with the publisher, shutdown to free up resources. + publisher.shutdown(); + publisher.awaitTermination(1, TimeUnit.MINUTES); + } + } + } +} +// [END pubsub_publisher_with_compression] diff --git a/samples/snippets/src/main/java/pubsub/PublishWithOrderingKeys.java b/samples/snippets/src/main/java/pubsub/PublishWithOrderingKeys.java index d199e7ff8..e1509db5a 100644 --- a/samples/snippets/src/main/java/pubsub/PublishWithOrderingKeys.java +++ b/samples/snippets/src/main/java/pubsub/PublishWithOrderingKeys.java @@ -27,7 +27,7 @@ import com.google.pubsub.v1.PubsubMessage; import com.google.pubsub.v1.TopicName; import java.io.IOException; -import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.Map; import java.util.concurrent.TimeUnit; @@ -54,7 +54,7 @@ public static void publishWithOrderingKeysExample(String projectId, String topic .build(); try { - Map messages = new HashMap(); + Map messages = new LinkedHashMap(); messages.put("message1", "key1"); messages.put("message2", "key2"); messages.put("message3", "key1"); diff --git a/samples/snippets/src/main/java/pubsub/ResumePublishWithOrderingKeys.java b/samples/snippets/src/main/java/pubsub/ResumePublishWithOrderingKeys.java index 06489637d..ce5e91754 100644 --- a/samples/snippets/src/main/java/pubsub/ResumePublishWithOrderingKeys.java +++ b/samples/snippets/src/main/java/pubsub/ResumePublishWithOrderingKeys.java @@ -27,7 +27,7 @@ import com.google.pubsub.v1.PubsubMessage; import com.google.pubsub.v1.TopicName; import java.io.IOException; -import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.Map; import java.util.concurrent.TimeUnit; @@ -52,7 +52,7 @@ public static void resumePublishWithOrderingKeysExample(String projectId, String .build(); try { - Map messages = new HashMap(); + Map messages = new LinkedHashMap(); messages.put("message1", "key1"); messages.put("message2", "key2"); messages.put("message3", "key1"); diff --git a/samples/snippets/src/main/java/pubsub/RollbackSchemaExample.java b/samples/snippets/src/main/java/pubsub/RollbackSchemaExample.java new file mode 100644 index 000000000..0af304ed5 --- /dev/null +++ b/samples/snippets/src/main/java/pubsub/RollbackSchemaExample.java @@ -0,0 +1,53 @@ +/* + * Copyright 2023 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 pubsub; + +// [START pubsub_rollback_schema] + +import com.google.api.gax.rpc.NotFoundException; +import com.google.cloud.pubsub.v1.SchemaServiceClient; +import com.google.pubsub.v1.Schema; +import com.google.pubsub.v1.SchemaName; +import java.io.IOException; + +public class RollbackSchemaExample { + + public static void main(String... args) throws Exception { + // TODO(developer): Replace these variables before running the sample. + String projectId = "your-project"; + String schemaId = "your-schema"; + String revisionId = "your-revision"; + + rollbackSchemaExample(projectId, schemaId, revisionId); + } + + public static void rollbackSchemaExample(String projectId, String schemaId, String revisionId) + throws IOException { + SchemaName schemaName = SchemaName.of(projectId, schemaId); + + try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) { + + Schema schema = schemaServiceClient.rollbackSchema(schemaName, revisionId); + + System.out.println("Rolled back a schema:" + schema); + + } catch (NotFoundException e) { + System.out.println(schemaName + "not found."); + } + } +} +// [END pubsub_rollback_schema] diff --git a/samples/snippets/src/main/java/pubsub/SetSubscriptionPolicyExample.java b/samples/snippets/src/main/java/pubsub/SetSubscriptionPolicyExample.java index f0a449de8..f5b19f685 100644 --- a/samples/snippets/src/main/java/pubsub/SetSubscriptionPolicyExample.java +++ b/samples/snippets/src/main/java/pubsub/SetSubscriptionPolicyExample.java @@ -46,7 +46,10 @@ public static void setSubscriptionPolicyExample(String projectId, String subscri // Create new role -> members binding Binding binding = - Binding.newBuilder().setRole("roles/pubsub.editor").addMembers("allUsers").build(); + Binding.newBuilder() + .setRole("roles/pubsub.editor") + .addMembers("domain:google.com") + .build(); // Add new binding to updated policy Policy updatedPolicy = Policy.newBuilder(oldPolicy).addBindings(binding).build(); diff --git a/samples/snippets/src/main/java/pubsub/SetTopicPolicyExample.java b/samples/snippets/src/main/java/pubsub/SetTopicPolicyExample.java index 7e987c218..6a2359e8c 100644 --- a/samples/snippets/src/main/java/pubsub/SetTopicPolicyExample.java +++ b/samples/snippets/src/main/java/pubsub/SetTopicPolicyExample.java @@ -44,7 +44,10 @@ public static void setTopicPolicyExample(String projectId, String topicId) throw // Create new role -> members binding Binding binding = - Binding.newBuilder().setRole("roles/pubsub.editor").addMembers("allUsers").build(); + Binding.newBuilder() + .setRole("roles/pubsub.editor") + .addMembers("domain:google.com") + .build(); // Add new binding to updated policy Policy updatedPolicy = Policy.newBuilder(oldPolicy).addBindings(binding).build(); diff --git a/samples/snippets/src/main/java/pubsub/SubscribeSyncExample.java b/samples/snippets/src/main/java/pubsub/SubscribeSyncExample.java index 1ece29c37..e3a034044 100644 --- a/samples/snippets/src/main/java/pubsub/SubscribeSyncExample.java +++ b/samples/snippets/src/main/java/pubsub/SubscribeSyncExample.java @@ -60,12 +60,21 @@ public static void subscribeSyncExample( // Use pullCallable().futureCall to asynchronously perform this operation. PullResponse pullResponse = subscriber.pullCallable().call(pullRequest); + + // Stop the program if the pull response is empty to avoid acknowledging + // an empty list of ack IDs. + if (pullResponse.getReceivedMessagesList().isEmpty()) { + System.out.println("No message was pulled. Exiting."); + return; + } + List ackIds = new ArrayList<>(); for (ReceivedMessage message : pullResponse.getReceivedMessagesList()) { // Handle received message // ... ackIds.add(message.getAckId()); } + // Acknowledge received messages. AcknowledgeRequest acknowledgeRequest = AcknowledgeRequest.newBuilder() diff --git a/samples/snippets/src/main/java/pubsub/SubscribeSyncWithLeaseExample.java b/samples/snippets/src/main/java/pubsub/SubscribeSyncWithLeaseExample.java index e074aa3fa..67b604203 100644 --- a/samples/snippets/src/main/java/pubsub/SubscribeSyncWithLeaseExample.java +++ b/samples/snippets/src/main/java/pubsub/SubscribeSyncWithLeaseExample.java @@ -38,9 +38,6 @@ public static void main(String... args) throws Exception { String subscriptionId = "your-subscription-id"; Integer numOfMessages = 10; - projectId = "tz-playground-bigdata"; - subscriptionId = "uno"; - subscribeSyncWithLeaseExample(projectId, subscriptionId, numOfMessages); } @@ -68,8 +65,14 @@ public static void subscribeSyncWithLeaseExample( // Use pullCallable().futureCall to asynchronously perform this operation. PullResponse pullResponse = subscriber.pullCallable().call(pullRequest); - List ackIds = new ArrayList<>(); + // Stop the program if the pull response is empty to avoid acknowledging + // an empty list of ack IDs. + if (pullResponse.getReceivedMessagesList().isEmpty()) { + System.out.println("No message was pulled. Exiting."); + return; + } + List ackIds = new ArrayList<>(); for (ReceivedMessage message : pullResponse.getReceivedMessagesList()) { ackIds.add(message.getAckId()); diff --git a/samples/snippets/src/main/java/pubsub/SubscribeWithAvroSchemaExample.java b/samples/snippets/src/main/java/pubsub/SubscribeWithAvroSchemaExample.java index 65b1937b8..68880d1d3 100644 --- a/samples/snippets/src/main/java/pubsub/SubscribeWithAvroSchemaExample.java +++ b/samples/snippets/src/main/java/pubsub/SubscribeWithAvroSchemaExample.java @@ -72,7 +72,7 @@ public static void subscribeWithAvroSchemaExample(String projectId, String subsc try { switch (encoding) { case "BINARY": - decoder = DecoderFactory.get().directBinaryDecoder(inputStream, /*reuse=*/ null); + decoder = DecoderFactory.get().directBinaryDecoder(inputStream, /* reuse= */ null); System.out.println("Receiving a binary-encoded message:"); break; case "JSON": diff --git a/samples/snippets/src/main/java/pubsub/SubscribeWithAvroSchemaRevisionsExample.java b/samples/snippets/src/main/java/pubsub/SubscribeWithAvroSchemaRevisionsExample.java new file mode 100644 index 000000000..9498bd020 --- /dev/null +++ b/samples/snippets/src/main/java/pubsub/SubscribeWithAvroSchemaRevisionsExample.java @@ -0,0 +1,158 @@ +/* + * Copyright 2023 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 pubsub; + +// [START pubsub_subscribe_avro_records_with_revisions] + +import com.google.cloud.pubsub.v1.AckReplyConsumer; +import com.google.cloud.pubsub.v1.MessageReceiver; +import com.google.cloud.pubsub.v1.SchemaServiceClient; +import com.google.cloud.pubsub.v1.Subscriber; +import com.google.protobuf.ByteString; +import com.google.pubsub.v1.ProjectSubscriptionName; +import com.google.pubsub.v1.PubsubMessage; +import com.google.pubsub.v1.Schema; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; +import org.apache.avro.io.Decoder; +import org.apache.avro.io.DecoderFactory; +import org.apache.avro.specific.SpecificDatumReader; +import utilities.State; + +public class SubscribeWithAvroSchemaRevisionsExample { + + public static void main(String... args) throws Exception { + // TODO(developer): Replace these variables before running the sample. + String projectId = "your-project-id"; + // Use an existing subscription. + String subscriptionId = "your-subscription-id"; + + subscribeWithAvroSchemaRevisionsExample(projectId, subscriptionId); + } + + static SchemaServiceClient getSchemaServiceClient() { + try { + return SchemaServiceClient.create(); + } catch (IOException e) { + System.out.println("Could not get schema client: " + e); + return null; + } + } + + public static void subscribeWithAvroSchemaRevisionsExample( + String projectId, String subscriptionId) { + // Used to get the schemas for revsions. + final SchemaServiceClient schemaServiceClient = getSchemaServiceClient(); + if (schemaServiceClient == null) { + return; + } + + // Cache for the readers for different revision IDs. + Map> revisionReaders = + new HashMap>(); + + ProjectSubscriptionName subscriptionName = + ProjectSubscriptionName.of(projectId, subscriptionId); + + // Instantiate an asynchronous message receiver. + MessageReceiver receiver = + (PubsubMessage message, AckReplyConsumer consumer) -> { + // Get the schema encoding type. + String name = message.getAttributesMap().get("googclient_schemaname"); + String revision = message.getAttributesMap().get("googclient_schemarevisionid"); + + SpecificDatumReader reader = null; + synchronized (revisionReaders) { + reader = revisionReaders.get(revision); + } + if (reader == null) { + // This is the first time we are seeing this revision. We need to + // fetch the schema and cache its decoder. It would be more typical + // to do this asynchronously, but is shown here in a synchronous + // way to ease readability. + try { + Schema schema = schemaServiceClient.getSchema(name + "@" + revision); + org.apache.avro.Schema avroSchema = + new org.apache.avro.Schema.Parser().parse(schema.getDefinition()); + reader = new SpecificDatumReader(avroSchema, State.getClassSchema()); + synchronized (revisionReaders) { + revisionReaders.put(revision, reader); + } + } catch (Exception e) { + System.out.println("Could not get schema: " + e); + // Without the schema, we cannot read the message, so nack it. + consumer.nack(); + return; + } + } + + ByteString data = message.getData(); + // Send the message data to a byte[] input stream. + InputStream inputStream = new ByteArrayInputStream(data.toByteArray()); + + String encoding = message.getAttributesMap().get("googclient_schemaencoding"); + + Decoder decoder = null; + + // Prepare an appropriate decoder for the message data in the input stream + // based on the schema encoding type. + try { + switch (encoding) { + case "BINARY": + decoder = DecoderFactory.get().directBinaryDecoder(inputStream, /* reuse= */ null); + System.out.println("Receiving a binary-encoded message:"); + break; + case "JSON": + decoder = DecoderFactory.get().jsonDecoder(State.getClassSchema(), inputStream); + System.out.println("Receiving a JSON-encoded message:"); + break; + default: + System.out.println("Unknown message type; nacking."); + consumer.nack(); + break; + } + + // Obtain an object of the generated Avro class using the decoder. + State state = reader.read(null, decoder); + System.out.println(state.getName() + " is abbreviated as " + state.getPostAbbr()); + + // Ack the message. + consumer.ack(); + } catch (IOException e) { + System.err.println(e); + // If we failed to process the message, nack it. + consumer.nack(); + } + }; + + Subscriber subscriber = null; + try { + subscriber = Subscriber.newBuilder(subscriptionName, receiver).build(); + subscriber.startAsync().awaitRunning(); + System.out.printf("Listening for messages on %s:\n", subscriptionName.toString()); + subscriber.awaitTerminated(30, TimeUnit.SECONDS); + } catch (TimeoutException timeoutException) { + subscriber.stopAsync(); + } + } +} +// [END pubsub_subscribe_avro_records_with_revisions] diff --git a/samples/snippets/src/main/java/pubsub/SubscribeWithErrorListenerExample.java b/samples/snippets/src/main/java/pubsub/SubscribeWithErrorListenerExample.java index a03c867a8..1e17afe68 100644 --- a/samples/snippets/src/main/java/pubsub/SubscribeWithErrorListenerExample.java +++ b/samples/snippets/src/main/java/pubsub/SubscribeWithErrorListenerExample.java @@ -62,15 +62,11 @@ public static void subscribeWithErrorListenerExample(String projectId, String su .setExecutorProvider(executorProvider) .build(); - // Listen for unrecoverable failures. Rebuild a subscriber and restart subscribing - // when the current subscriber encounters permanent errors. + // Listen for unrecoverable failures. subscriber.addListener( new Subscriber.Listener() { public void failed(Subscriber.State from, Throwable failure) { - System.out.println(failure.getStackTrace()); - if (!executorProvider.getExecutor().isShutdown()) { - subscribeWithErrorListenerExample(projectId, subscriptionId); - } + System.out.println("Unrecoverable subscriber failure:" + failure.getStackTrace()); } }, MoreExecutors.directExecutor()); diff --git a/samples/snippets/src/main/java/pubsub/SubscribeWithExactlyOnceConsumerWithResponseExample.java b/samples/snippets/src/main/java/pubsub/SubscribeWithExactlyOnceConsumerWithResponseExample.java new file mode 100644 index 000000000..cf5ed3248 --- /dev/null +++ b/samples/snippets/src/main/java/pubsub/SubscribeWithExactlyOnceConsumerWithResponseExample.java @@ -0,0 +1,117 @@ +/* + * Copyright 2022 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 pubsub; + +// [START pubsub_subscriber_exactly_once] + +import com.google.cloud.pubsub.v1.AckReplyConsumerWithResponse; +import com.google.cloud.pubsub.v1.AckResponse; +import com.google.cloud.pubsub.v1.MessageReceiverWithAckResponse; +import com.google.cloud.pubsub.v1.Subscriber; +import com.google.pubsub.v1.ProjectSubscriptionName; +import com.google.pubsub.v1.PubsubMessage; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; + +public class SubscribeWithExactlyOnceConsumerWithResponseExample { + public static void main(String... args) throws Exception { + // TODO(developer): Replace these variables before running the sample. + String projectId = "your-project-id"; + String subscriptionId = "your-subscription-id"; + + subscribeWithExactlyOnceConsumerWithResponseExample(projectId, subscriptionId); + } + + public static void subscribeWithExactlyOnceConsumerWithResponseExample( + String projectId, String subscriptionId) { + ProjectSubscriptionName subscriptionName = + ProjectSubscriptionName.of(projectId, subscriptionId); + + // Instantiate an asynchronous message receiver using `AckReplyConsumerWithResponse` + // instead of `AckReplyConsumer` to get a future that tracks the result of the ack call. + // When exactly once delivery is enabled on the subscription, the message is guaranteed + // to not be delivered again if the ack future succeeds. + MessageReceiverWithAckResponse receiverWithResponse = + (PubsubMessage message, AckReplyConsumerWithResponse consumerWithResponse) -> { + try { + // Handle incoming message, then ack the message, and receive an ack response. + System.out.println("Message received: " + message.getData().toStringUtf8()); + Future ackResponseFuture = consumerWithResponse.ack(); + + // Retrieve the completed future for the ack response from the server. + AckResponse ackResponse = ackResponseFuture.get(); + + switch (ackResponse) { + case SUCCESSFUL: + // Success code means that this MessageID will not be delivered again. + System.out.println("Message successfully acked: " + message.getMessageId()); + break; + case INVALID: + System.out.println( + "Message failed to ack with a response of Invalid. Id: " + + message.getMessageId()); + break; + case PERMISSION_DENIED: + System.out.println( + "Message failed to ack with a response of Permission Denied. Id: " + + message.getMessageId()); + break; + case FAILED_PRECONDITION: + System.out.println( + "Message failed to ack with a response of Failed Precondition. Id: " + + message.getMessageId()); + break; + case OTHER: + System.out.println( + "Message failed to ack with a response of Other. Id: " + + message.getMessageId()); + break; + default: + break; + } + } catch (InterruptedException | ExecutionException e) { + System.out.println( + "MessageId: " + message.getMessageId() + " failed when retrieving future"); + } catch (Throwable t) { + System.out.println("Throwable caught" + t.getMessage()); + } + }; + + Subscriber subscriber = null; + try { + // Pub/Sub's exactly once delivery guarantee only applies when subscribers connect to the + // service in the same region. + // For list of locational endpoints for Pub/Sub, see + // https://cloud.google.com/pubsub/docs/reference/service_apis_overview#list_of_locational_endpoints + subscriber = + Subscriber.newBuilder(subscriptionName, receiverWithResponse) + .setEndpoint("us-west1-pubsub.googleapis.com:443") + .build(); + // Start the subscriber. + subscriber.startAsync().awaitRunning(); + System.out.printf("Listening for messages on %s:\n", subscriptionName.toString()); + // Allow the subscriber to run for 30s unless an unrecoverable error occurs. + subscriber.awaitTerminated(30, TimeUnit.SECONDS); + } catch (TimeoutException timeoutException) { + // Shut down the subscriber after 30s. Stop receiving messages. + subscriber.stopAsync(); + } + } +} +// [END pubsub_subscriber_exactly_once] diff --git a/samples/snippets/src/main/java/pubsub/UpdateDeadLetterPolicyExample.java b/samples/snippets/src/main/java/pubsub/UpdateDeadLetterPolicyExample.java index c8d7babee..d2946e8f3 100644 --- a/samples/snippets/src/main/java/pubsub/UpdateDeadLetterPolicyExample.java +++ b/samples/snippets/src/main/java/pubsub/UpdateDeadLetterPolicyExample.java @@ -21,8 +21,8 @@ import com.google.cloud.pubsub.v1.SubscriptionAdminClient; import com.google.protobuf.FieldMask; import com.google.pubsub.v1.DeadLetterPolicy; -import com.google.pubsub.v1.ProjectSubscriptionName; import com.google.pubsub.v1.Subscription; +import com.google.pubsub.v1.SubscriptionName; import com.google.pubsub.v1.TopicName; import com.google.pubsub.v1.UpdateSubscriptionRequest; import java.io.IOException; @@ -48,8 +48,7 @@ public static void updateDeadLetterPolicyExample( throws IOException { try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) { - ProjectSubscriptionName subscriptionName = - ProjectSubscriptionName.of(projectId, subscriptionId); + SubscriptionName subscriptionName = SubscriptionName.of(projectId, subscriptionId); System.out.println( "Before: " + subscriptionAdminClient.getSubscription(subscriptionName).getAllFields()); diff --git a/samples/snippets/src/main/java/pubsub/UpdatePushConfigurationExample.java b/samples/snippets/src/main/java/pubsub/UpdatePushConfigurationExample.java index ae674be74..d4a583e92 100644 --- a/samples/snippets/src/main/java/pubsub/UpdatePushConfigurationExample.java +++ b/samples/snippets/src/main/java/pubsub/UpdatePushConfigurationExample.java @@ -19,9 +19,9 @@ // [START pubsub_update_push_configuration] import com.google.cloud.pubsub.v1.SubscriptionAdminClient; -import com.google.pubsub.v1.ProjectSubscriptionName; import com.google.pubsub.v1.PushConfig; import com.google.pubsub.v1.Subscription; +import com.google.pubsub.v1.SubscriptionName; import java.io.IOException; public class UpdatePushConfigurationExample { @@ -37,8 +37,7 @@ public static void main(String... args) throws Exception { public static void updatePushConfigurationExample( String projectId, String subscriptionId, String pushEndpoint) throws IOException { try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) { - ProjectSubscriptionName subscriptionName = - ProjectSubscriptionName.of(projectId, subscriptionId); + SubscriptionName subscriptionName = SubscriptionName.of(projectId, subscriptionId); PushConfig pushConfig = PushConfig.newBuilder().setPushEndpoint(pushEndpoint).build(); subscriptionAdminClient.modifyPushConfig(subscriptionName, pushConfig); Subscription subscription = subscriptionAdminClient.getSubscription(subscriptionName); diff --git a/samples/snippets/src/main/java/pubsub/UpdateTopicSchemaExample.java b/samples/snippets/src/main/java/pubsub/UpdateTopicSchemaExample.java new file mode 100644 index 000000000..4383fffd6 --- /dev/null +++ b/samples/snippets/src/main/java/pubsub/UpdateTopicSchemaExample.java @@ -0,0 +1,80 @@ +/* + * Copyright 2023 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 pubsub; + +// [START pubsub_update_topic_schema] + +import com.google.cloud.pubsub.v1.TopicAdminClient; +import com.google.protobuf.FieldMask; +import com.google.pubsub.v1.SchemaSettings; +import com.google.pubsub.v1.Topic; +import com.google.pubsub.v1.TopicName; +import com.google.pubsub.v1.UpdateTopicRequest; +import java.io.IOException; + +public class UpdateTopicSchemaExample { + public static void main(String... args) throws Exception { + // TODO(developer): Replace these variables before running the sample. + String projectId = "your-project-id"; + // This is an existing topic that has schema settings attached to it. + String topicId = "your-topic-id"; + // Set the minimum and maximum revsion ID + String firstRevisionId = "your-revision-id"; + String lastRevisionId = "your-revision-id"; + + UpdateTopicSchemaExample.updateTopicSchemaExample( + projectId, topicId, firstRevisionId, lastRevisionId); + } + + public static void updateTopicSchemaExample( + String projectId, String topicId, String firstRevisionid, String lastRevisionId) + throws IOException { + try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) { + + TopicName topicName = TopicName.of(projectId, topicId); + + // Construct the schema settings with the changes you want to make. + SchemaSettings schemaSettings = + SchemaSettings.newBuilder() + .setFirstRevisionId(firstRevisionid) + .setLastRevisionId(lastRevisionId) + .build(); + + // Construct the topic with the schema settings you want to change. + Topic topic = + Topic.newBuilder() + .setName(topicName.toString()) + .setSchemaSettings(schemaSettings) + .build(); + + // Construct a field mask to indicate which field to update in the topic. + FieldMask updateMask = + FieldMask.newBuilder() + .addPaths("schema_settings.first_revision_id") + .addPaths("schema_settings.last_revision_id") + .build(); + + UpdateTopicRequest request = + UpdateTopicRequest.newBuilder().setTopic(topic).setUpdateMask(updateMask).build(); + + Topic response = topicAdminClient.updateTopic(request); + + System.out.println("Updated topic with schema: " + topic.getName()); + } + } +} +// [END pubsub_update_topic_schema] diff --git a/samples/snippets/src/main/java/pubsub/UpdateTopicTypeExample.java b/samples/snippets/src/main/java/pubsub/UpdateTopicTypeExample.java new file mode 100644 index 000000000..6b8497ea7 --- /dev/null +++ b/samples/snippets/src/main/java/pubsub/UpdateTopicTypeExample.java @@ -0,0 +1,86 @@ +/* + * Copyright 2024 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 pubsub; + +// [START pubsub_update_topic_type] + +import com.google.cloud.pubsub.v1.TopicAdminClient; +import com.google.protobuf.FieldMask; +import com.google.pubsub.v1.IngestionDataSourceSettings; +import com.google.pubsub.v1.Topic; +import com.google.pubsub.v1.TopicName; +import com.google.pubsub.v1.UpdateTopicRequest; +import java.io.IOException; + +public class UpdateTopicTypeExample { + public static void main(String... args) throws Exception { + // TODO(developer): Replace these variables before running the sample. + String projectId = "your-project-id"; + String topicId = "your-topic-id"; + // Kinesis ingestion settings. + String streamArn = "stream-arn"; + String consumerArn = "consumer-arn"; + String awsRoleArn = "aws-role-arn"; + String gcpServiceAccount = "gcp-service-account"; + + UpdateTopicTypeExample.updateTopicTypeExample( + projectId, topicId, streamArn, consumerArn, awsRoleArn, gcpServiceAccount); + } + + public static void updateTopicTypeExample( + String projectId, + String topicId, + String streamArn, + String consumerArn, + String awsRoleArn, + String gcpServiceAccount) + throws IOException { + try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) { + TopicName topicName = TopicName.of(projectId, topicId); + + IngestionDataSourceSettings.AwsKinesis awsKinesis = + IngestionDataSourceSettings.AwsKinesis.newBuilder() + .setStreamArn(streamArn) + .setConsumerArn(consumerArn) + .setAwsRoleArn(awsRoleArn) + .setGcpServiceAccount(gcpServiceAccount) + .build(); + IngestionDataSourceSettings ingestionDataSourceSettings = + IngestionDataSourceSettings.newBuilder().setAwsKinesis(awsKinesis).build(); + + // Construct the topic with Kinesis ingestion settings. + Topic topic = + Topic.newBuilder() + .setName(topicName.toString()) + .setIngestionDataSourceSettings(ingestionDataSourceSettings) + .build(); + + // Construct a field mask to indicate which field to update in the topic. + FieldMask updateMask = + FieldMask.newBuilder().addPaths("ingestion_data_source_settings").build(); + + UpdateTopicRequest request = + UpdateTopicRequest.newBuilder().setTopic(topic).setUpdateMask(updateMask).build(); + + Topic response = topicAdminClient.updateTopic(request); + + System.out.println( + "Updated topic with Kinesis ingestion settings: " + response.getAllFields()); + } + } +} +// [END pubsub_update_topic_type] diff --git a/samples/snippets/src/main/java/pubsub/UsePubSubEmulatorExample.java b/samples/snippets/src/main/java/pubsub/UsePubSubEmulatorExample.java new file mode 100644 index 000000000..c73aca098 --- /dev/null +++ b/samples/snippets/src/main/java/pubsub/UsePubSubEmulatorExample.java @@ -0,0 +1,85 @@ +/* + * Copyright 2017 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 pubsub; + +/** + * Snippet that demonstrates creating Pub/Sub clients using the Google Cloud Pub/Sub emulator. + * + *

    Note: clients cannot start/stop the emulator. + */ + +// [START pubsub_use_emulator] + +import com.google.api.core.ApiFuture; +import com.google.api.gax.core.CredentialsProvider; +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.grpc.GrpcTransportChannel; +import com.google.api.gax.rpc.FixedTransportChannelProvider; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.cloud.pubsub.v1.Publisher; +import com.google.cloud.pubsub.v1.TopicAdminClient; +import com.google.cloud.pubsub.v1.TopicAdminSettings; +import com.google.protobuf.ByteString; +import com.google.pubsub.v1.PubsubMessage; +import com.google.pubsub.v1.Topic; +import com.google.pubsub.v1.TopicName; +import io.grpc.ManagedChannel; +import io.grpc.ManagedChannelBuilder; + +public class UsePubSubEmulatorExample { + public static void main(String... args) throws Exception { + String hostport = System.getenv("PUBSUB_EMULATOR_HOST"); + ManagedChannel channel = ManagedChannelBuilder.forTarget(hostport).usePlaintext().build(); + try { + TransportChannelProvider channelProvider = + FixedTransportChannelProvider.create(GrpcTransportChannel.create(channel)); + CredentialsProvider credentialsProvider = NoCredentialsProvider.create(); + + // Set the channel and credentials provider when creating a `TopicAdminClient`. + // Can be done similarly for a `SubscriptionAdminClient`. + TopicAdminClient topicAdminClient = + TopicAdminClient.create( + TopicAdminSettings.newBuilder() + .setTransportChannelProvider(channelProvider) + .setCredentialsProvider(credentialsProvider) + .build()); + + TopicName topicName = TopicName.of("my-project-id", "my-topic-id"); + Topic topic = topicAdminClient.createTopic(topicName); + System.out.println("Created topic: " + topic.getName()); + + // Set the channel and credentials provider when creating a `Publisher`. + // Can be done similarly for a `Subscriber`. + Publisher publisher = + Publisher.newBuilder(topicName) + .setChannelProvider(channelProvider) + .setCredentialsProvider(credentialsProvider) + .build(); + + String message = "Hello World!"; + ByteString data = ByteString.copyFromUtf8(message); + PubsubMessage pubsubMessage = PubsubMessage.newBuilder().setData(data).build(); + + ApiFuture messageIdFuture = publisher.publish(pubsubMessage); + String messageId = messageIdFuture.get(); + System.out.println("Published message ID: " + messageId); + } finally { + channel.shutdown(); + } + } +} +// [END pubsub_use_emulator] diff --git a/samples/snippets/src/main/java/utilities/State.java b/samples/snippets/src/main/java/utilities/State.java index 503acf61f..60d869e23 100644 --- a/samples/snippets/src/main/java/utilities/State.java +++ b/samples/snippets/src/main/java/utilities/State.java @@ -46,7 +46,12 @@ public class State extends org.apache.avro.specific.SpecificRecordBase public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser() .parse( - "{\"type\":\"record\",\"name\":\"State\",\"namespace\":\"utilities\",\"doc\":\"A list of states in the United States of America.\",\"fields\":[{\"name\":\"name\",\"type\":\"string\",\"doc\":\"The common name of the state.\"},{\"name\":\"post_abbr\",\"type\":\"string\",\"doc\":\"The postal code abbreviation of the state.\"}]}"); + "{\"type\":\"record\",\"name\":\"State\",\"namespace\":\"utilities\",\"doc\":\"A list" + + " of states in the United States of" + + " America.\",\"fields\":[{\"name\":\"name\",\"type\":\"string\",\"doc\":\"The" + + " common name of the" + + " state.\"},{\"name\":\"post_abbr\",\"type\":\"string\",\"doc\":\"The postal" + + " code abbreviation of the state.\"}]}"); public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; @@ -113,6 +118,7 @@ public static State fromByteBuffer(java.nio.ByteBuffer b) throws java.io.IOExcep /** The common name of the state. */ private java.lang.CharSequence name; + /** The postal code abbreviation of the state. */ private java.lang.CharSequence post_abbr; @@ -140,6 +146,7 @@ public org.apache.avro.specific.SpecificData getSpecificData() { public org.apache.avro.Schema getSchema() { return SCHEMA$; } + // Used by DatumWriter. Applications should not call. public java.lang.Object get(int field$) { switch (field$) { @@ -247,6 +254,7 @@ public static class Builder extends org.apache.avro.specific.SpecificRecordBuild /** The common name of the state. */ private java.lang.CharSequence name; + /** The postal code abbreviation of the state. */ private java.lang.CharSequence post_abbr; diff --git a/samples/snippets/src/main/java/utilities/StateProto.java b/samples/snippets/src/main/java/utilities/StateProto.java index 60701da37..388ba9b97 100644 --- a/samples/snippets/src/main/java/utilities/StateProto.java +++ b/samples/snippets/src/main/java/utilities/StateProto.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Google LLC + * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,9 +14,6 @@ * limitations under the License. */ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: us-states.proto - /** * This file is created using protoc. * @@ -27,6 +24,10 @@ *

    `protoc --proto_path=src/main/resources/ --java_out=src/main/java/ * src/main/resources/us-states.proto` */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: us-states.proto + +// Protobuf Java Version: 3.25.4 package utilities; public final class StateProto { @@ -49,6 +50,7 @@ public interface StateOrBuilder * @return The name. */ java.lang.String getName(); + /** * string name = 1; * @@ -62,6 +64,7 @@ public interface StateOrBuilder * @return The postAbbr. */ java.lang.String getPostAbbr(); + /** * string post_abbr = 2; * @@ -69,12 +72,14 @@ public interface StateOrBuilder */ com.google.protobuf.ByteString getPostAbbrBytes(); } + /** Protobuf type {@code utilities.State} */ public static final class State extends com.google.protobuf.GeneratedMessageV3 implements // @@protoc_insertion_point(message_implements:utilities.State) StateOrBuilder { private static final long serialVersionUID = 0L; + // Use State.newBuilder() to construct. private State(com.google.protobuf.GeneratedMessageV3.Builder builder) { super(builder); @@ -91,62 +96,6 @@ protected java.lang.Object newInstance(UnusedPrivateParameter unused) { return new State(); } - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - private State( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - java.lang.String s = input.readStringRequireUtf8(); - - name_ = s; - break; - } - case 18: - { - java.lang.String s = input.readStringRequireUtf8(); - - postAbbr_ = s; - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return utilities.StateProto.internal_static_utilities_State_descriptor; } @@ -160,7 +109,10 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } public static final int NAME_FIELD_NUMBER = 1; - private volatile java.lang.Object name_; + + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; + /** * string name = 1; * @@ -178,6 +130,7 @@ public java.lang.String getName() { return s; } } + /** * string name = 1; * @@ -197,7 +150,10 @@ public com.google.protobuf.ByteString getNameBytes() { } public static final int POST_ABBR_FIELD_NUMBER = 2; - private volatile java.lang.Object postAbbr_; + + @SuppressWarnings("serial") + private volatile java.lang.Object postAbbr_ = ""; + /** * string post_abbr = 2; * @@ -215,6 +171,7 @@ public java.lang.String getPostAbbr() { return s; } } + /** * string post_abbr = 2; * @@ -247,13 +204,13 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!getNameBytes().isEmpty()) { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); } - if (!getPostAbbrBytes().isEmpty()) { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(postAbbr_)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 2, postAbbr_); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -262,13 +219,13 @@ public int getSerializedSize() { if (size != -1) return size; size = 0; - if (!getNameBytes().isEmpty()) { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); } - if (!getPostAbbrBytes().isEmpty()) { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(postAbbr_)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, postAbbr_); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -285,7 +242,7 @@ public boolean equals(final java.lang.Object obj) { if (!getName().equals(other.getName())) return false; if (!getPostAbbr().equals(other.getPostAbbr())) return false; - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -300,7 +257,7 @@ public int hashCode() { hash = (53 * hash) + getName().hashCode(); hash = (37 * hash) + POST_ABBR_FIELD_NUMBER; hash = (53 * hash) + getPostAbbr().hashCode(); - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -400,6 +357,7 @@ protected Builder newBuilderForType( Builder builder = new Builder(parent); return builder; } + /** Protobuf type {@code utilities.State} */ public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder @@ -419,26 +377,18 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } // Construct using utilities.StateProto.State.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } + private Builder() {} private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} } @java.lang.Override public Builder clear() { super.clear(); + bitField0_ = 0; name_ = ""; - postAbbr_ = ""; - return this; } @@ -464,12 +414,23 @@ public utilities.StateProto.State build() { @java.lang.Override public utilities.StateProto.State buildPartial() { utilities.StateProto.State result = new utilities.StateProto.State(this); - result.name_ = name_; - result.postAbbr_ = postAbbr_; + if (bitField0_ != 0) { + buildPartial0(result); + } onBuilt(); return result; } + private void buildPartial0(utilities.StateProto.State result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.name_ = name_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.postAbbr_ = postAbbr_; + } + } + @java.lang.Override public Builder clone() { return super.clone(); @@ -519,13 +480,15 @@ public Builder mergeFrom(utilities.StateProto.State other) { if (other == utilities.StateProto.State.getDefaultInstance()) return this; if (!other.getName().isEmpty()) { name_ = other.name_; + bitField0_ |= 0x00000001; onChanged(); } if (!other.getPostAbbr().isEmpty()) { postAbbr_ = other.postAbbr_; + bitField0_ |= 0x00000002; onChanged(); } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -540,21 +503,50 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - utilities.StateProto.State parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + name_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + postAbbr_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (utilities.StateProto.State) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } + private int bitField0_; + private java.lang.Object name_ = ""; + /** * string name = 1; * @@ -571,6 +563,7 @@ public java.lang.String getName() { return (java.lang.String) ref; } } + /** * string name = 1; * @@ -587,6 +580,7 @@ public com.google.protobuf.ByteString getNameBytes() { return (com.google.protobuf.ByteString) ref; } } + /** * string name = 1; * @@ -597,22 +591,24 @@ public Builder setName(java.lang.String value) { if (value == null) { throw new NullPointerException(); } - name_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } + /** * string name = 1; * * @return This builder for chaining. */ public Builder clearName() { - name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000001); onChanged(); return this; } + /** * string name = 1; * @@ -624,13 +620,14 @@ public Builder setNameBytes(com.google.protobuf.ByteString value) { throw new NullPointerException(); } checkByteStringIsUtf8(value); - name_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } private java.lang.Object postAbbr_ = ""; + /** * string post_abbr = 2; * @@ -647,6 +644,7 @@ public java.lang.String getPostAbbr() { return (java.lang.String) ref; } } + /** * string post_abbr = 2; * @@ -663,6 +661,7 @@ public com.google.protobuf.ByteString getPostAbbrBytes() { return (com.google.protobuf.ByteString) ref; } } + /** * string post_abbr = 2; * @@ -673,22 +672,24 @@ public Builder setPostAbbr(java.lang.String value) { if (value == null) { throw new NullPointerException(); } - postAbbr_ = value; + bitField0_ |= 0x00000002; onChanged(); return this; } + /** * string post_abbr = 2; * * @return This builder for chaining. */ public Builder clearPostAbbr() { - postAbbr_ = getDefaultInstance().getPostAbbr(); + bitField0_ = (bitField0_ & ~0x00000002); onChanged(); return this; } + /** * string post_abbr = 2; * @@ -700,8 +701,8 @@ public Builder setPostAbbrBytes(com.google.protobuf.ByteString value) { throw new NullPointerException(); } checkByteStringIsUtf8(value); - postAbbr_ = value; + bitField0_ |= 0x00000002; onChanged(); return this; } @@ -739,7 +740,19 @@ public State parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new State(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException() + .setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; diff --git a/samples/snippets/src/main/resources/logging.properties b/samples/snippets/src/main/resources/logging.properties new file mode 100644 index 000000000..b4c616c80 --- /dev/null +++ b/samples/snippets/src/main/resources/logging.properties @@ -0,0 +1,23 @@ +## Copyright 2022 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. + +# To run the example with the following logging config: +# cd samples/snippets/ +# mvn clean exec:java -Dexec.mainClass=pubsub.PublishWithGrpcCompression -Djava.util.logging.config.file=src/main/resources/logging.properties + +handlers=java.util.logging.FileHandler +.level=FINE +java.util.logging.FileHandler.pattern=log.txt +java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter +java.util.logging.SimpleFormatter.format=[%1$tF %1$tT] %4$-5s %5$s %n \ No newline at end of file diff --git a/samples/snippets/src/main/resources/us-states-plus.avsc b/samples/snippets/src/main/resources/us-states-plus.avsc new file mode 100644 index 000000000..74225ae7e --- /dev/null +++ b/samples/snippets/src/main/resources/us-states-plus.avsc @@ -0,0 +1,24 @@ +{ + "type":"record", + "name":"State", + "namespace":"utilities", + "doc":"A list of states in the United States of America.", + "fields":[ + { + "name":"name", + "type":"string", + "doc":"The common name of the state." + }, + { + "name":"post_abbr", + "type":"string", + "doc":"The postal code abbreviation of the state." + }, + { + "name":"population", + "type":"long", + "default":0, + "doc":"The population of the state." + } + ] +} diff --git a/samples/snippets/src/main/resources/us-states-plus.proto b/samples/snippets/src/main/resources/us-states-plus.proto new file mode 100644 index 000000000..646c7dcb6 --- /dev/null +++ b/samples/snippets/src/main/resources/us-states-plus.proto @@ -0,0 +1,10 @@ +syntax = "proto3"; + +package utilities; +option java_outer_classname = "StateProto"; + +message State { + string name = 1; + string post_abbr = 2; + int64 population = 3; +} diff --git a/samples/snippets/src/test/java/pubsub/AdminIT.java b/samples/snippets/src/test/java/pubsub/AdminIT.java index 1d198044d..2d31e17f7 100644 --- a/samples/snippets/src/test/java/pubsub/AdminIT.java +++ b/samples/snippets/src/test/java/pubsub/AdminIT.java @@ -20,10 +20,22 @@ import static junit.framework.TestCase.assertNotNull; import com.google.api.gax.rpc.NotFoundException; +import com.google.cloud.bigquery.BigQuery; +import com.google.cloud.bigquery.BigQueryOptions; +import com.google.cloud.bigquery.DatasetId; +import com.google.cloud.bigquery.DatasetInfo; +import com.google.cloud.bigquery.Field; +import com.google.cloud.bigquery.Schema; +import com.google.cloud.bigquery.StandardSQLTypeName; +import com.google.cloud.bigquery.StandardTableDefinition; +import com.google.cloud.bigquery.TableDefinition; +import com.google.cloud.bigquery.TableId; +import com.google.cloud.bigquery.TableInfo; import com.google.cloud.pubsub.v1.SubscriptionAdminClient; import com.google.cloud.pubsub.v1.TopicAdminClient; -import com.google.pubsub.v1.ProjectSubscriptionName; -import com.google.pubsub.v1.ProjectTopicName; +import com.google.protobuf.Duration; +import com.google.pubsub.v1.SubscriptionName; +import com.google.pubsub.v1.TopicName; import java.io.ByteArrayOutputStream; import java.io.PrintStream; import java.util.UUID; @@ -41,18 +53,93 @@ public class AdminIT { private static final String projectId = System.getenv("GOOGLE_CLOUD_PROJECT"); private static final String _suffix = UUID.randomUUID().toString(); private static final String topicId = "iam-topic-" + _suffix; + private static final String kinesisIngestionTopicId = "kinesis-ingestion-topic-" + _suffix; + private static final String cloudStorageIngestionTopicId = + "cloud-storage-ingestion-topic-" + _suffix; + private static final String awsMskIngestionTopicId = "aws-msk-ingestion-topic-" + _suffix; + private static final String confluentCloudIngestionTopicId = + "confluent-cloud-ingestion-topic-" + _suffix; + private static final String azureEventHubsIngestionTopicId = + "azure-event-hubs-ingestion-topic-" + _suffix; + private static final String smtTopicId = "smt-topic-" + _suffix; private static final String pullSubscriptionId = "iam-pull-subscription-" + _suffix; private static final String pushSubscriptionId = "iam-push-subscription-" + _suffix; private static final String orderedSubscriptionId = "iam-ordered-subscription-" + _suffix; + private static final String filteredSubscriptionId = "iam-filtered-subscription-" + _suffix; + private static final String smtSubscriptionId = "smt-subscription-" + _suffix; + private static final String exactlyOnceSubscriptionId = + "iam-exactly-once-subscription-" + _suffix; private static final String pushEndpoint = "https://my-test-project.appspot.com/push"; + private static final String bigqueryDatasetId = + "java_samples_data_set" + _suffix.replace("-", "_"); + private static final String bigquerySubscriptionId = "iam-bigquery-subscription-" + _suffix; + private static final String bigqueryTableId = "java_samples_table_" + _suffix; + private static final String cloudStorageSubscriptionId = + "iam-cloud-storage-subscription-" + _suffix; + private static final String cloudStorageFilenamePrefix = "log_events_"; + private static final String cloudStorageFilenameSuffix = ".txt"; + private static final Duration cloudStorageMaxDuration = + Duration.newBuilder().setSeconds(300).build(); + private static final String gcpServiceAccount = + "fake-service-account@fake-gcp-project.iam.gserviceaccount.com"; + // AWS Kinesis ingestion settings. + private static final String streamArn = + "arn:aws:kinesis:us-west-2:111111111111:stream/fake-stream-name"; + private static final String consumerArn = + "arn:aws:kinesis:us-west-2:111111111111:stream/fake-stream-name/" + + "consumer/consumer-1:1111111111"; + private static final String consumerArn2 = + "arn:aws:kinesis:us-west-2:111111111111:stream/fake-stream-name/" + + "consumer/consumer-2:2222222222"; + private static final String awsRoleArn = "arn:aws:iam::111111111111:role/fake-role-name"; + // GCS ingestion settings. + private static final String cloudStorageBucket = "pubsub-cloud-storage-bucket"; + private static final String cloudStorageInputFormat = "text"; + private static final String cloudStorageTextDelimiter = ","; + private static final String cloudStorageMatchGlob = "**.txt"; + private static final String cloudStorageMinimumObjectCreateTime = "1970-01-01T00:00:01Z"; + private static final String cloudStorageMinimumObjectCreateTimeSeconds = "seconds: 1"; + // AWS MSK ingestion settings. + String clusterArn = + "arn:aws:kafka:us-east-1:111111111111:cluster/fake-cluster-name/11111111-1111-1"; + String mskTopic = "fake-msk-topic-name"; + // Confluent Cloud ingestion settings. + String bootstrapServer = "fake-bootstrap-server-id.us-south1.gcp.confluent.cloud:9092"; + String clusterId = "fake-cluster-id"; + String confluentTopic = "fake-confluent-topic-name"; + String identityPoolId = "fake-pool-id"; + // Azure Event Hubs ingestion settings. + String resourceGroup = "fake-resource-group"; + String namespace = "fake-namespace"; + String eventHub = "fake-event-hub"; + String clientId = "11111111-1111-1111-1111-111111111111"; + String tenantId = "22222222-2222-2222-2222-222222222222"; + String subscriptionId = "33333333-3333-3333-3333-333333333333"; - private static final ProjectTopicName topicName = ProjectTopicName.of(projectId, topicId); - private static final ProjectSubscriptionName pullSubscriptionName = - ProjectSubscriptionName.of(projectId, pullSubscriptionId); - private static final ProjectSubscriptionName pushSubscriptionName = - ProjectSubscriptionName.of(projectId, pushSubscriptionId); - private static final ProjectSubscriptionName orderedSubscriptionName = - ProjectSubscriptionName.of(projectId, orderedSubscriptionId); + private static final TopicName topicName = TopicName.of(projectId, topicId); + private static final TopicName kinesisIngestionTopicName = + TopicName.of(projectId, kinesisIngestionTopicId); + private static final TopicName cloudStorageIngestionTopicName = + TopicName.of(projectId, cloudStorageIngestionTopicId); + private static final TopicName awsMskIngestionTopicName = + TopicName.of(projectId, awsMskIngestionTopicId); + private static final TopicName confluentCloudIngestionTopicName = + TopicName.of(projectId, confluentCloudIngestionTopicId); + private static final TopicName azureEventHubsIngestionTopicName = + TopicName.of(projectId, azureEventHubsIngestionTopicId); + private static final TopicName smtTopicName = TopicName.of(projectId, smtTopicId); + private static final SubscriptionName pullSubscriptionName = + SubscriptionName.of(projectId, pullSubscriptionId); + private static final SubscriptionName pushSubscriptionName = + SubscriptionName.of(projectId, pushSubscriptionId); + private static final SubscriptionName orderedSubscriptionName = + SubscriptionName.of(projectId, orderedSubscriptionId); + private static final SubscriptionName filteredSubscriptionName = + SubscriptionName.of(projectId, filteredSubscriptionId); + private static final SubscriptionName exactlyOnceSubscriptionName = + SubscriptionName.of(projectId, exactlyOnceSubscriptionId); + private static final SubscriptionName smtSubscriptionName = + SubscriptionName.of(projectId, smtSubscriptionId); private static void requireEnvVar(String varName) { assertNotNull( @@ -72,6 +159,9 @@ public void setUp() throws Exception { bout = new ByteArrayOutputStream(); out = new PrintStream(bout); System.setOut(out); + + // Create table for BigQuery subscription. + createBigQueryTable(); } @After @@ -82,6 +172,8 @@ public void tearDown() throws Exception { subscriptionAdminClient.deleteSubscription(pullSubscriptionName); subscriptionAdminClient.deleteSubscription(pushSubscriptionName); subscriptionAdminClient.deleteSubscription(orderedSubscriptionName); + subscriptionAdminClient.deleteSubscription(filteredSubscriptionName); + subscriptionAdminClient.deleteSubscription(exactlyOnceSubscriptionName); } catch (NotFoundException ignored) { // ignore this as resources may not have been created } @@ -93,9 +185,39 @@ public void tearDown() throws Exception { } catch (NotFoundException ignored) { // ignore this as resources may not have been created } + + // Delete BigQuery table. + deleteBigQueryTable(); + System.setOut(null); } + private void createBigQueryTable() throws Exception { + BigQuery bigquery = BigQueryOptions.getDefaultInstance().getService(); + DatasetInfo datasetInfo = DatasetInfo.newBuilder(projectId, bigqueryDatasetId).build(); + bigquery.create(datasetInfo); + + Schema schema = + Schema.of( + Field.of("data", StandardSQLTypeName.STRING), + Field.of("message_id", StandardSQLTypeName.STRING), + Field.of("attributes", StandardSQLTypeName.STRING), + Field.of("subscription_name", StandardSQLTypeName.STRING), + Field.of("publish_time", StandardSQLTypeName.TIMESTAMP)); + + TableId tableId = TableId.of(projectId, bigqueryDatasetId, bigqueryTableId); + TableDefinition tableDefinition = StandardTableDefinition.of(schema); + TableInfo tableInfo = TableInfo.newBuilder(tableId, tableDefinition).build(); + + bigquery.create(tableInfo); + } + + private void deleteBigQueryTable() throws Exception { + BigQuery bigquery = BigQueryOptions.getDefaultInstance().getService(); + DatasetId datasetId = DatasetId.of(projectId, bigqueryDatasetId); + bigquery.delete(datasetId, BigQuery.DatasetDeleteOption.deleteContents()); + } + @Test public void testAdmin() throws Exception { // Test create topic. @@ -184,15 +306,199 @@ public void testAdmin() throws Exception { assertThat(bout.toString()).contains("enable_message_ordering=true"); bout.reset(); - // Test delete subscription. Run twice to delete both pull and push subscriptions. + // Test create a subscription with filtering enabled + CreateSubscriptionWithFiltering.createSubscriptionWithFilteringExample( + projectId, topicId, filteredSubscriptionId, "attributes.author=\"unknown\""); + assertThat(bout.toString()).contains("Created a subscription with filtering enabled"); + assertThat(bout.toString()) + .contains("google.pubsub.v1.Subscription.filter=attributes.author=\"unknown\""); + + bout.reset(); + // Test create a subscription with exactly once delivery enabled + CreateSubscriptionWithExactlyOnceDelivery.createSubscriptionWithExactlyOnceDeliveryExample( + projectId, topicId, exactlyOnceSubscriptionId); + assertThat(bout.toString()) + .contains("Created a subscription with exactly once delivery enabled:"); + assertThat(bout.toString()).contains("enable_exactly_once_delivery=true"); + + bout.reset(); + // Test create a BigQuery subscription + String bigqueryTablePath = String.join(".", projectId, bigqueryDatasetId, bigqueryTableId); + CreateBigQuerySubscriptionExample.createBigQuerySubscription( + projectId, topicId, bigquerySubscriptionId, bigqueryTablePath); + assertThat(bout.toString()).contains("Created a BigQuery subscription:"); + assertThat(bout.toString()).contains(bigqueryTablePath); + + bout.reset(); + // Test create a Cloud Storage subscription. + CreateCloudStorageSubscriptionExample.createCloudStorageSubscription( + projectId, + topicId, + cloudStorageSubscriptionId, + cloudStorageBucket, + cloudStorageFilenamePrefix, + cloudStorageFilenameSuffix, + cloudStorageMaxDuration); + assertThat(bout.toString()).contains("Created a CloudStorage subscription:"); + assertThat(bout.toString()).contains(cloudStorageBucket); + assertThat(bout.toString()).contains(cloudStorageFilenamePrefix); + assertThat(bout.toString()).contains(cloudStorageFilenameSuffix); + assertThat(bout.toString()).contains(Long.toString(cloudStorageMaxDuration.getSeconds())); + + bout.reset(); + // Test delete subscription. DeleteSubscriptionExample.deleteSubscriptionExample(projectId, pullSubscriptionId); DeleteSubscriptionExample.deleteSubscriptionExample(projectId, pushSubscriptionId); DeleteSubscriptionExample.deleteSubscriptionExample(projectId, orderedSubscriptionId); + DeleteSubscriptionExample.deleteSubscriptionExample(projectId, exactlyOnceSubscriptionId); + DeleteSubscriptionExample.deleteSubscriptionExample(projectId, bigquerySubscriptionId); + DeleteSubscriptionExample.deleteSubscriptionExample(projectId, cloudStorageSubscriptionId); assertThat(bout.toString()).contains("Deleted subscription."); + bout.reset(); + // Update topic type to Kinesis ingestion. + UpdateTopicTypeExample.updateTopicTypeExample( + projectId, topicId, streamArn, consumerArn, awsRoleArn, gcpServiceAccount); + assertThat(bout.toString()).contains("google.pubsub.v1.Topic.name=" + topicName.toString()); + assertThat(bout.toString()).contains(streamArn); + assertThat(bout.toString()).contains(consumerArn); + assertThat(bout.toString()).contains(awsRoleArn); + assertThat(bout.toString()).contains(gcpServiceAccount); + bout.reset(); // Test delete topic. DeleteTopicExample.deleteTopicExample(projectId, topicId); assertThat(bout.toString()).contains("Deleted topic."); + + bout.reset(); + // Test create topic with Kinesis ingestion settings. + CreateTopicWithKinesisIngestionExample.createTopicWithKinesisIngestionExample( + projectId, kinesisIngestionTopicId, streamArn, consumerArn, awsRoleArn, gcpServiceAccount); + assertThat(bout.toString()) + .contains("google.pubsub.v1.Topic.name=" + kinesisIngestionTopicName.toString()); + assertThat(bout.toString()).contains(streamArn); + assertThat(bout.toString()).contains(consumerArn); + assertThat(bout.toString()).contains(awsRoleArn); + assertThat(bout.toString()).contains(gcpServiceAccount); + + bout.reset(); + // Test update existing Kinesis ingestion settings. + UpdateTopicTypeExample.updateTopicTypeExample( + projectId, kinesisIngestionTopicId, streamArn, consumerArn2, awsRoleArn, gcpServiceAccount); + assertThat(bout.toString()) + .contains("google.pubsub.v1.Topic.name=" + kinesisIngestionTopicName.toString()); + assertThat(bout.toString()).contains(streamArn); + assertThat(bout.toString()).contains(consumerArn2); + assertThat(bout.toString()).contains(awsRoleArn); + assertThat(bout.toString()).contains(gcpServiceAccount); + + bout.reset(); + // Test delete Kinesis ingestion topic. + DeleteTopicExample.deleteTopicExample(projectId, kinesisIngestionTopicId); + assertThat(bout.toString()).contains("Deleted topic."); + + bout.reset(); + // Test create topic with Cloud Storage ingestion settings. + CreateTopicWithCloudStorageIngestionExample.createTopicWithCloudStorageIngestionExample( + projectId, + cloudStorageIngestionTopicId, + cloudStorageBucket, + cloudStorageInputFormat, + cloudStorageTextDelimiter, + cloudStorageMatchGlob, + cloudStorageMinimumObjectCreateTime); + assertThat(bout.toString()) + .contains("google.pubsub.v1.Topic.name=" + cloudStorageIngestionTopicName.toString()); + assertThat(bout.toString()).contains(cloudStorageBucket); + assertThat(bout.toString()).contains(cloudStorageInputFormat); + assertThat(bout.toString()).contains(cloudStorageTextDelimiter); + assertThat(bout.toString()).contains(cloudStorageMatchGlob); + assertThat(bout.toString()).contains(cloudStorageMinimumObjectCreateTimeSeconds); + + bout.reset(); + // Test delete Cloud Storage ingestion topic. + DeleteTopicExample.deleteTopicExample(projectId, cloudStorageIngestionTopicId); + assertThat(bout.toString()).contains("Deleted topic."); + + bout.reset(); + // Test create topic with AWS MSK ingestion settings. + CreateTopicWithAwsMskIngestionExample.createTopicWithAwsMskIngestionExample( + projectId, awsMskIngestionTopicId, clusterArn, mskTopic, awsRoleArn, gcpServiceAccount); + assertThat(bout.toString()) + .contains("google.pubsub.v1.Topic.name=" + awsMskIngestionTopicName.toString()); + assertThat(bout.toString()).contains(clusterArn); + assertThat(bout.toString()).contains(mskTopic); + assertThat(bout.toString()).contains(awsRoleArn); + assertThat(bout.toString()).contains(gcpServiceAccount); + + bout.reset(); + // Test delete AWS MSK ingestion topic. + DeleteTopicExample.deleteTopicExample(projectId, awsMskIngestionTopicId); + assertThat(bout.toString()).contains("Deleted topic."); + + bout.reset(); + // Test create topic with Confluent Cloud ingestion settings. + CreateTopicWithConfluentCloudIngestionExample.createTopicWithConfluentCloudIngestionExample( + projectId, + confluentCloudIngestionTopicId, + bootstrapServer, + clusterId, + confluentTopic, + identityPoolId, + gcpServiceAccount); + assertThat(bout.toString()) + .contains("google.pubsub.v1.Topic.name=" + confluentCloudIngestionTopicName.toString()); + assertThat(bout.toString()).contains(bootstrapServer); + assertThat(bout.toString()).contains(clusterId); + assertThat(bout.toString()).contains(confluentTopic); + assertThat(bout.toString()).contains(identityPoolId); + assertThat(bout.toString()).contains(gcpServiceAccount); + + bout.reset(); + // Test delete Confluent Cloud ingestion topic. + DeleteTopicExample.deleteTopicExample(projectId, confluentCloudIngestionTopicId); + assertThat(bout.toString()).contains("Deleted topic."); + + bout.reset(); + // Test create topic with Azure Event Hubs ingestion settings. + CreateTopicWithAzureEventHubsIngestionExample.createTopicWithAzureEventHubsIngestionExample( + projectId, + azureEventHubsIngestionTopicId, + resourceGroup, + namespace, + eventHub, + clientId, + tenantId, + subscriptionId, + gcpServiceAccount); + assertThat(bout.toString()) + .contains("google.pubsub.v1.Topic.name=" + azureEventHubsIngestionTopicName.toString()); + assertThat(bout.toString()).contains(resourceGroup); + assertThat(bout.toString()).contains(namespace); + assertThat(bout.toString()).contains(eventHub); + assertThat(bout.toString()).contains(clientId); + assertThat(bout.toString()).contains(tenantId); + assertThat(bout.toString()).contains(subscriptionId); + assertThat(bout.toString()).contains(gcpServiceAccount); + + bout.reset(); + // Test delete Azure Event Hubs ingestion topic. + DeleteTopicExample.deleteTopicExample(projectId, azureEventHubsIngestionTopicId); + assertThat(bout.toString()).contains("Deleted topic."); + + bout.reset(); + // Test create topic with an SMT. + CreateTopicWithSmtExample.createTopicWithSmtExample(projectId, smtTopicId); + assertThat(bout.toString()).contains("Created topic with SMT: " + smtTopicName.toString()); + + bout.reset(); + // Test create topic with an SMT. + CreateSubscriptionWithSmtExample.createSubscriptionWithSmtExample( + projectId, smtTopicId, smtSubscriptionId); + assertThat(bout.toString()).contains("Created subscription with SMT"); + assertThat(bout.toString()).contains(smtSubscriptionName.toString()); + assertThat(bout.toString()).contains("redactSSN"); + DeleteSubscriptionExample.deleteSubscriptionExample(projectId, smtSubscriptionId); + DeleteTopicExample.deleteTopicExample(projectId, smtTopicId); } } diff --git a/samples/snippets/src/test/java/pubsub/DeadLetterQueueIT.java b/samples/snippets/src/test/java/pubsub/DeadLetterQueueIT.java index 5b342612e..d85c27ad8 100644 --- a/samples/snippets/src/test/java/pubsub/DeadLetterQueueIT.java +++ b/samples/snippets/src/test/java/pubsub/DeadLetterQueueIT.java @@ -22,11 +22,12 @@ import com.google.cloud.pubsub.v1.Publisher; import com.google.cloud.pubsub.v1.SubscriptionAdminClient; import com.google.cloud.pubsub.v1.TopicAdminClient; +import com.google.cloud.testing.junit4.MultipleAttemptsRule; import com.google.protobuf.ByteString; -import com.google.pubsub.v1.ProjectSubscriptionName; -import com.google.pubsub.v1.ProjectTopicName; import com.google.pubsub.v1.PubsubMessage; +import com.google.pubsub.v1.SubscriptionName; import com.google.pubsub.v1.Topic; +import com.google.pubsub.v1.TopicName; import java.io.ByteArrayOutputStream; import java.io.PrintStream; import java.util.UUID; @@ -43,15 +44,13 @@ public class DeadLetterQueueIT { private PrintStream out; private static final String projectId = System.getenv("GOOGLE_CLOUD_PROJECT"); - private static final String _suffix = UUID.randomUUID().toString(); - private static final String topicId = "topic-" + _suffix; - private static final String subscriptionId = "subscription-" + _suffix; - private static final String deadLetterTopicId = "topic-dlq-" + _suffix; - private static final ProjectTopicName topicName = ProjectTopicName.of(projectId, topicId); - private static final ProjectTopicName deadLetterTopicName = - ProjectTopicName.of(projectId, deadLetterTopicId); - private static final ProjectSubscriptionName subscriptionName = - ProjectSubscriptionName.of(projectId, subscriptionId); + private static String _suffix; + private static String topicId; + private static String subscriptionId; + private static String deadLetterTopicId; + private static TopicName topicName; + private static TopicName deadLetterTopicName; + private static SubscriptionName subscriptionName; private static void requireEnvVar(String varName) { assertNotNull( @@ -61,7 +60,7 @@ private static void requireEnvVar(String varName) { // Helper function to publish a message. private static void publishSomeMessages() throws Exception { - ProjectTopicName topicName = ProjectTopicName.of(projectId, topicId); + TopicName topicName = TopicName.of(projectId, topicId); Publisher publisher = Publisher.newBuilder(topicName).build(); ByteString data = ByteString.copyFromUtf8("Hello"); PubsubMessage pubsubMessage = PubsubMessage.newBuilder().setData(data).build(); @@ -69,10 +68,18 @@ private static void publishSomeMessages() throws Exception { } @Rule public Timeout globalTimeout = Timeout.seconds(300); // 5 minute timeout + @Rule public MultipleAttemptsRule retryRule = new MultipleAttemptsRule(/* maxAttemptCount= */ 3); @BeforeClass public static void checkRequirements() { requireEnvVar("GOOGLE_CLOUD_PROJECT"); + _suffix = UUID.randomUUID().toString(); + topicId = "topic-" + _suffix; + subscriptionId = "subscription-" + _suffix; + deadLetterTopicId = "topic-dlq-" + _suffix; + topicName = TopicName.of(projectId, topicId); + deadLetterTopicName = TopicName.of(projectId, deadLetterTopicId); + subscriptionName = SubscriptionName.of(projectId, subscriptionId); } @Before diff --git a/samples/snippets/src/test/java/pubsub/PublisherIT.java b/samples/snippets/src/test/java/pubsub/PublisherIT.java index 0ed25c082..cd86aaef6 100644 --- a/samples/snippets/src/test/java/pubsub/PublisherIT.java +++ b/samples/snippets/src/test/java/pubsub/PublisherIT.java @@ -96,6 +96,11 @@ public void testPublisher() throws Exception { PublishWithBatchSettingsExample.publishWithBatchSettingsExample(projectId, topicId); assertThat(bout.toString()).contains("Published 100 messages with batch settings."); + bout.reset(); + // Test publish with flow control settings. + PublishWithFlowControlExample.publishWithFlowControlExample(projectId, topicId); + assertThat(bout.toString()).contains("Published 1000 messages with flow control settings."); + bout.reset(); // Test publish with concurrency control. PublishWithConcurrencyControlExample.publishWithConcurrencyControlExample(projectId, topicId); @@ -119,5 +124,10 @@ public void testPublisher() throws Exception { for (int i = 1; i <= 4; i++) { assertThat(bout.toString()).contains("message" + i); } + + bout.reset(); + // Test publish with gRPC compression. + PublishWithGrpcCompressionExample.publishWithGrpcCompressionExample(projectId, topicId); + assertThat(bout.toString()).contains("Published a compressed message of message ID: "); } } diff --git a/samples/snippets/src/test/java/pubsub/SchemaIT.java b/samples/snippets/src/test/java/pubsub/SchemaIT.java index e920891eb..342a42c61 100644 --- a/samples/snippets/src/test/java/pubsub/SchemaIT.java +++ b/samples/snippets/src/test/java/pubsub/SchemaIT.java @@ -26,6 +26,7 @@ import com.google.cloud.testing.junit4.MultipleAttemptsRule; import com.google.pubsub.v1.Encoding; import com.google.pubsub.v1.ProjectSubscriptionName; +import com.google.pubsub.v1.Schema; import com.google.pubsub.v1.SchemaName; import com.google.pubsub.v1.TopicName; import java.io.ByteArrayOutputStream; @@ -43,29 +44,33 @@ public class SchemaIT { private PrintStream out; private static final String projectId = System.getenv("GOOGLE_CLOUD_PROJECT"); - private static final String _suffix = UUID.randomUUID().toString(); - private static final String avroTopicId = "avro-topic-" + _suffix; - private static final String protoTopicId = "proto-topic-" + _suffix; - private static final String avroSubscriptionId = "avro-subscription-" + _suffix; - private static final String protoSubscriptionId = "proto-subscription-" + _suffix; - private static final String avroSchemaId = "avro-schema-" + _suffix; - private static final String protoSchemaId = "proto-schema-" + _suffix; + private static String _suffix; + private static String avroTopicId; + private static String protoTopicId; + private static String protoTopicWithRevisionsId; + private static String avroSubscriptionId; + private static String protoSubscriptionId; + private static String avroSchemaId; + private static String protoSchemaId; ClassLoader classLoader = getClass().getClassLoader(); File avscFile = new File(classLoader.getResource("us-states.avsc").getFile()); String absoluteAvscFilePath = avscFile.getAbsolutePath(); + File avscRevisionFile = new File(classLoader.getResource("us-states-plus.avsc").getFile()); + String absoluteAvscRevisionFilePath = avscRevisionFile.getAbsolutePath(); - File protoFile = new File(classLoader.getResource("us-states.proto").getFile()); + File protoFile = new File(classLoader.getResource("us-states-plus.proto").getFile()); String absoluteProtoFilePath = protoFile.getAbsolutePath(); + File protoRevisionFile = new File(classLoader.getResource("us-states.proto").getFile()); + String absoluteProtoRevisionFilePath = protoFile.getAbsolutePath(); - private static final TopicName avroTopicName = TopicName.of(projectId, avroTopicId); - private static final TopicName protoTopicName = TopicName.of(projectId, protoTopicId); - private static final ProjectSubscriptionName avroSubscriptionName = - ProjectSubscriptionName.of(projectId, avroSubscriptionId); - private static final ProjectSubscriptionName protoSubscriptionName = - ProjectSubscriptionName.of(projectId, protoSubscriptionId); - private static final SchemaName avroSchemaName = SchemaName.of(projectId, avroSchemaId); - private static final SchemaName protoSchemaName = SchemaName.of(projectId, protoSchemaId); + private static TopicName avroTopicName; + private static TopicName protoTopicName; + private static TopicName protoTopicWithRevisionsName; + private static ProjectSubscriptionName avroSubscriptionName; + private static ProjectSubscriptionName protoSubscriptionName; + private static SchemaName avroSchemaName; + private static SchemaName protoSchemaName; private static void requireEnvVar(String varName) { assertNotNull( @@ -74,10 +79,25 @@ private static void requireEnvVar(String varName) { } @Rule public Timeout globalTimeout = Timeout.seconds(600); // 10 minute timeout - @Rule public MultipleAttemptsRule retryRule = new MultipleAttemptsRule(/*maxAttemptCount=*/ 3); + @Rule public MultipleAttemptsRule retryRule = new MultipleAttemptsRule(/* maxAttemptCount= */ 3); @Before public void setUp() { + _suffix = UUID.randomUUID().toString(); + avroTopicId = "avro-topic-" + _suffix; + protoTopicId = "proto-topic-" + _suffix; + protoTopicWithRevisionsId = "proto-topic-with-revisions-" + _suffix; + avroSubscriptionId = "avro-subscription-" + _suffix; + protoSubscriptionId = "proto-subscription-" + _suffix; + avroSchemaId = "avro-schema-" + _suffix; + protoSchemaId = "proto-schema-" + _suffix; + avroTopicName = TopicName.of(projectId, avroTopicId); + protoTopicName = TopicName.of(projectId, protoTopicId); + protoTopicWithRevisionsName = TopicName.of(projectId, protoTopicWithRevisionsId); + avroSubscriptionName = ProjectSubscriptionName.of(projectId, avroSubscriptionId); + protoSubscriptionName = ProjectSubscriptionName.of(projectId, protoSubscriptionId); + avroSchemaName = SchemaName.of(projectId, avroSchemaId); + protoSchemaName = SchemaName.of(projectId, protoSchemaId); bout = new ByteArrayOutputStream(); out = new PrintStream(bout); System.setOut(out); @@ -87,26 +107,49 @@ public void setUp() { public void tearDown() throws Exception { // Delete the schemas if they have not been cleaned up. try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) { - schemaServiceClient.deleteSchema(protoSchemaName); - schemaServiceClient.deleteSchema(avroSchemaName); - } catch (NotFoundException ignored) { - // Ignore this as resources may have already been cleaned up. + try { + schemaServiceClient.deleteSchema(protoSchemaName); + } catch (NotFoundException ignored) { + // Ignore this as resources may have already been cleaned up. + } + try { + schemaServiceClient.deleteSchema(avroSchemaName); + } catch (NotFoundException ignored) { + // Ignore this as resources may have already been cleaned up. + } } // Delete the subscriptions. try (SubscriptionAdminClient subscriptionAdmin = SubscriptionAdminClient.create()) { - subscriptionAdmin.deleteSubscription(avroSubscriptionName.toString()); - subscriptionAdmin.deleteSubscription(protoSubscriptionName.toString()); - } catch (NotFoundException ignored) { - // Ignore this as resources may have already been cleaned up. + try { + subscriptionAdmin.deleteSubscription(avroSubscriptionName.toString()); + } catch (NotFoundException ignored) { + // Ignore this as resources may have already been cleaned up. + } + try { + subscriptionAdmin.deleteSubscription(protoSubscriptionName.toString()); + } catch (NotFoundException ignored) { + // Ignore this as resources may have already been cleaned up. + } } // Delete the topics. try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) { - topicAdminClient.deleteTopic(avroTopicName.toString()); - topicAdminClient.deleteTopic(protoTopicName.toString()); - } catch (NotFoundException ignored) { - // Ignore this as resources may have already been cleaned up. + try { + topicAdminClient.deleteTopic(avroTopicName.toString()); + } catch (NotFoundException ignored) { + // Ignore this as resources may have already been cleaned up. + } + try { + topicAdminClient.deleteTopic(protoTopicName.toString()); + } catch (NotFoundException ignored) { + // Ignore this as resources may have already been cleaned up. + } + try { + topicAdminClient.deleteTopic(protoTopicWithRevisionsName.toString()); + } catch (NotFoundException ignored) { + // Ignore this as resources may have already been cleaned up. + } } System.setOut(null); } @@ -114,28 +157,67 @@ public void tearDown() throws Exception { @Test public void testSchema() throws Exception { // Test creating Avro schema. - CreateAvroSchemaExample.createAvroSchemaExample(projectId, avroSchemaId, absoluteAvscFilePath); + Schema avroSchema = + CreateAvroSchemaExample.createAvroSchemaExample( + projectId, avroSchemaId, absoluteAvscFilePath); assertThat(bout.toString()).contains("Created a schema using an Avro schema:"); assertThat(bout.toString()).contains(avroSchemaName.toString()); + bout.reset(); + // Test committing Avro schema. + CommitAvroSchemaExample.commitAvroSchemaExample( + projectId, avroSchemaId, absoluteAvscRevisionFilePath); + assertThat(bout.toString()).contains("Committed a schema using an Avro schema:"); + assertThat(bout.toString()).contains(avroSchemaName.toString()); + + bout.reset(); // Test creating Proto schema. - CreateProtoSchemaExample.createProtoSchemaExample( - projectId, protoSchemaId, absoluteProtoFilePath); + final Schema protoSchema = + CreateProtoSchemaExample.createProtoSchemaExample( + projectId, protoSchemaId, absoluteProtoFilePath); assertThat(bout.toString()).contains("Created a schema using a protobuf schema:"); assertThat(bout.toString()).contains(protoSchemaName.toString()); + bout.reset(); + // Test committing Proto schema. + final Schema protoSchemaRevision = + CommitProtoSchemaExample.commitProtoSchemaExample( + projectId, protoSchemaId, absoluteProtoRevisionFilePath); + assertThat(bout.toString()).contains("Committed a schema using a protobuf schema:"); + assertThat(bout.toString()).contains(protoSchemaName.toString()); + + bout.reset(); + // Test rolling back a schema. + RollbackSchemaExample.rollbackSchemaExample( + projectId, protoSchemaId, protoSchema.getRevisionId()); + assertThat(bout.toString()).contains("Rolled back a schema:"); + assertThat(bout.toString()).contains(protoSchemaName.toString()); + bout.reset(); // Test getting a schema. GetSchemaExample.getSchemaExample(projectId, avroSchemaId); assertThat(bout.toString()).contains("Got a schema:"); assertThat(bout.toString()).contains(avroSchemaName.toString()); + bout.reset(); + // Test getting a schema revision. + GetSchemaRevisionExample.getSchemaRevisionExample( + projectId, protoSchemaId + "@" + protoSchemaRevision.getRevisionId()); + assertThat(bout.toString()).contains("Got a schema:"); + assertThat(bout.toString()).contains(protoSchemaName.toString()); + bout.reset(); // Test listing schemas. ListSchemasExample.listSchemasExample(projectId); assertThat(bout.toString()).contains("Listed schemas."); assertThat(bout.toString()).contains(avroSchemaName.toString()); + bout.reset(); + // Test listing schema revisions. + ListSchemaRevisionsExample.listSchemaRevisionsExample(projectId, protoSchemaId); + assertThat(bout.toString()).contains("Listed schema revisions."); + assertThat(bout.toString()).contains(protoSchemaName.toString()); + bout.reset(); // Test creating a topic with an Avro schema with BINARY encoding. CreateTopicWithSchemaExample.createTopicWithSchemaExample( @@ -148,6 +230,19 @@ public void testSchema() throws Exception { projectId, protoTopicId, protoSchemaId, Encoding.JSON); assertThat(bout.toString()).contains("Created topic with schema: " + protoTopicName.toString()); + bout.reset(); + // Test creating a topic with a proto schema with revisions specified. + CreateTopicWithSchemaRevisionsExample.createTopicWithSchemaRevisionsExample( + projectId, + protoTopicWithRevisionsId, + protoSchemaId, + protoSchema.getRevisionId(), + protoSchemaRevision.getRevisionId(), + Encoding.BINARY); + assertThat(bout.toString()) + .contains("Created topic with schema: " + protoTopicWithRevisionsName.toString()); + + bout.reset(); // Attach a default pull subscription to each topic. CreatePullSubscriptionExample.createPullSubscriptionExample( projectId, avroSubscriptionId, avroTopicId); @@ -166,6 +261,19 @@ public void testSchema() throws Exception { assertThat(bout.toString()).contains("Publishing a JSON-formatted message:"); assertThat(bout.toString()).contains("Published message ID:"); + bout.reset(); + // Test receiving BINARY-encoded Avro records. + SubscribeWithAvroSchemaRevisionsExample.subscribeWithAvroSchemaRevisionsExample( + projectId, avroSubscriptionId); + assertThat(bout.toString()).contains("Receiving a binary-encoded message:"); + assertThat(bout.toString()).contains(" is abbreviated as "); + + bout.reset(); + // Test publishing BINARY-encoded Avro records. + PublishAvroRecordsExample.publishAvroRecordsExample(projectId, avroTopicId); + assertThat(bout.toString()).contains("Preparing a BINARY encoder..."); + assertThat(bout.toString()).contains("Published message ID:"); + bout.reset(); // Test receiving BINARY-encoded Avro records. SubscribeWithAvroSchemaExample.subscribeWithAvroSchemaExample(projectId, avroSubscriptionId); @@ -178,6 +286,23 @@ public void testSchema() throws Exception { assertThat(bout.toString()).contains("Received a JSON-formatted message:"); assertThat(bout.toString()).contains("Ack'ed the message"); + bout.reset(); + // Test updating a topic schema settings + UpdateTopicSchemaExample.updateTopicSchemaExample( + projectId, + protoTopicWithRevisionsId, + protoSchemaRevision.getRevisionId(), + protoSchemaRevision.getRevisionId()); + assertThat(bout.toString()) + .contains("Updated topic with schema: " + protoTopicWithRevisionsName.toString()); + + bout.reset(); + // Test deleting a schema revision. + DeleteSchemaRevisionExample.deleteSchemaRevisionExample( + projectId, protoSchemaId + "@" + protoSchemaRevision.getRevisionId()); + assertThat(bout.toString()).contains("Deleted a schema revision:"); + assertThat(bout.toString()).contains(protoSchemaName.toString()); + bout.reset(); // Test deleting a schema. DeleteSchemaExample.deleteSchemaExample(projectId, avroSchemaId); diff --git a/samples/snippets/src/test/java/pubsub/SubscriberIT.java b/samples/snippets/src/test/java/pubsub/SubscriberIT.java index aae4fb5af..dc4bf0f7b 100644 --- a/samples/snippets/src/test/java/pubsub/SubscriberIT.java +++ b/samples/snippets/src/test/java/pubsub/SubscriberIT.java @@ -21,8 +21,6 @@ import com.google.api.core.ApiFuture; import com.google.api.core.ApiFutures; -import com.google.api.gax.core.ExecutorProvider; -import com.google.api.gax.core.InstantiatingExecutorProvider; import com.google.cloud.pubsub.v1.Publisher; import com.google.cloud.pubsub.v1.SubscriptionAdminClient; import com.google.cloud.pubsub.v1.TopicAdminClient; @@ -40,26 +38,33 @@ import java.util.HashSet; import java.util.List; import java.util.UUID; -import org.junit.After; -import org.junit.Before; +import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Rule; import org.junit.Test; import org.junit.rules.Timeout; public class SubscriberIT { - private ByteArrayOutputStream bout; - private PrintStream out; + private static ByteArrayOutputStream bout; + private static PrintStream out; private static final String projectId = System.getenv("GOOGLE_CLOUD_PROJECT"); private static final String _suffix = UUID.randomUUID().toString(); private static final String topicId = "subscriber-test-topic-" + _suffix; + private static final String topicIdEod = "subscriber-test-topic-eod" + _suffix; private static final String subscriptionId = "subscriber-test-subscription-" + _suffix; + // For a subscription with exactly once delivery enabled. + private static final String subscriptionEodId = "subscriber-test-subscription-eod" + _suffix; + private static final String subscriptionOptimisticId = + "subscriber-test-subscription-optimistic" + _suffix; private static final TopicName topicName = TopicName.of(projectId, topicId); + private static final TopicName topicNameEod = TopicName.of(projectId, topicIdEod); private static final ProjectSubscriptionName subscriptionName = ProjectSubscriptionName.of(projectId, subscriptionId); - private static final ExecutorProvider executorProvider = - InstantiatingExecutorProvider.newBuilder().setExecutorThreadCount(4).build(); + private static final ProjectSubscriptionName subscriptionEodName = + ProjectSubscriptionName.of(projectId, subscriptionEodId); + private static final ProjectSubscriptionName subscriptionOptimisticName = + ProjectSubscriptionName.of(projectId, subscriptionOptimisticId); private static void requireEnvVar(String varName) { assertNotNull( @@ -67,8 +72,13 @@ private static void requireEnvVar(String varName) { System.getenv(varName)); } + private static List publishSomeMessages(Integer numOfMessages) throws Exception { + return publishSomeMessages(numOfMessages, topicId); + } + // Helper function to publish some messages. - private static void publishSomeMessages(Integer numOfMessages) throws Exception { + private static List publishSomeMessages(Integer numOfMessages, String topicId) + throws Exception { ProjectTopicName topicName = ProjectTopicName.of(projectId, topicId); Publisher publisher = Publisher.newBuilder(topicName).build(); List> messageIdFutures = new ArrayList<>(); @@ -82,7 +92,7 @@ private static void publishSomeMessages(Integer numOfMessages) throws Exception ApiFuture messageIdFuture = publisher.publish(pubsubMessage); messageIdFutures.add(messageIdFuture); } - ApiFutures.allAsList(messageIdFutures).get(); + return ApiFutures.allAsList(messageIdFutures).get(); } // Helper function to retry synchronous pull attempts until all outstanding messages are received. @@ -118,8 +128,8 @@ public static void checkRequirements() { requireEnvVar("GOOGLE_CLOUD_PROJECT"); } - @Before - public void setUp() throws Exception { + @BeforeClass + public static void setUp() throws Exception { bout = new ByteArrayOutputStream(); out = new PrintStream(bout); System.setOut(out); @@ -127,6 +137,9 @@ public void setUp() throws Exception { try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) { Topic topic = Topic.newBuilder().setName(topicName.toString()).build(); topicAdminClient.createTopic(topic); + + Topic topicEod = Topic.newBuilder().setName(topicNameEod.toString()).build(); + topicAdminClient.createTopic(topicEod); } try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) { @@ -136,17 +149,33 @@ public void setUp() throws Exception { .setTopic(topicName.toString()) .build(); subscriptionAdminClient.createSubscription(subscription); + + Subscription subscriptionEod = + Subscription.newBuilder() + .setName(subscriptionEodName.toString()) + .setTopic(topicNameEod.toString()) + // Enable exactly once delivery in the subscription. + .setEnableExactlyOnceDelivery(true) + .build(); + subscriptionAdminClient.createSubscription(subscriptionEod); } } - @After - public void tearDown() throws Exception { + @AfterClass + public static void tearDown() throws Exception { try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) { subscriptionAdminClient.deleteSubscription(subscriptionName.toString()); + subscriptionAdminClient.deleteSubscription(subscriptionEodName.toString()); + try { + subscriptionAdminClient.deleteSubscription(subscriptionOptimisticName.toString()); + } catch (Exception e) { + // Ignore exception. + } } try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) { topicAdminClient.deleteTopic(topicName.toString()); + topicAdminClient.deleteTopic(topicNameEod.toString()); } System.setOut(null); @@ -208,4 +237,25 @@ public void testSubscriber() throws Exception { SubscribeSyncWithLeaseExample.subscribeSyncWithLeaseExample( projectId, subscriptionId, 10)); } + + @Test + public void testSubscriberExactlyOnceDelivery() throws Exception { + List messageIds = publishSomeMessages(10, topicIdEod); + bout.reset(); + SubscribeWithExactlyOnceConsumerWithResponseExample + .subscribeWithExactlyOnceConsumerWithResponseExample(projectId, subscriptionEodId); + for (String messageId : messageIds) { + assertThat(bout.toString()).contains("Message successfully acked: " + messageId); + } + } + + @Test + public void testOptimisticSubscriber() throws Exception { + bout.reset(); + OptimisticSubscribeExample.optimisticSubscribeExample( + projectId, subscriptionOptimisticId, topicId); + assertThat( + bout.toString() + .contains("Created pull subscription: " + subscriptionOptimisticName.toString())); + } } diff --git a/samples/snippets/src/test/resources/us-states-plus.avsc b/samples/snippets/src/test/resources/us-states-plus.avsc new file mode 100644 index 000000000..74225ae7e --- /dev/null +++ b/samples/snippets/src/test/resources/us-states-plus.avsc @@ -0,0 +1,24 @@ +{ + "type":"record", + "name":"State", + "namespace":"utilities", + "doc":"A list of states in the United States of America.", + "fields":[ + { + "name":"name", + "type":"string", + "doc":"The common name of the state." + }, + { + "name":"post_abbr", + "type":"string", + "doc":"The postal code abbreviation of the state." + }, + { + "name":"population", + "type":"long", + "default":0, + "doc":"The population of the state." + } + ] +} diff --git a/samples/snippets/src/test/resources/us-states-plus.proto b/samples/snippets/src/test/resources/us-states-plus.proto new file mode 100644 index 000000000..646c7dcb6 --- /dev/null +++ b/samples/snippets/src/test/resources/us-states-plus.proto @@ -0,0 +1,10 @@ +syntax = "proto3"; + +package utilities; +option java_outer_classname = "StateProto"; + +message State { + string name = 1; + string post_abbr = 2; + int64 population = 3; +} diff --git a/synth.metadata b/synth.metadata index 9791c3dc8..dae629fee 100644 --- a/synth.metadata +++ b/synth.metadata @@ -3,23 +3,23 @@ { "git": { "name": ".", - "remote": "https://github.com/googleapis/java-pubsub.git", - "sha": "3f23ac6cda00814f74f2c435dd8a05b70ac69d27" + "remote": "https://github.com/hannahrogers-google/java-pubsub.git", + "sha": "e882af1abcd8f6d4efa4e97faeb613dd392ec982" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "f6dd7e47620566925a4b3f1ce029e74e1b2f2516", - "internalRef": "359781040" + "sha": "0b896069c16e32304f0289db165c16ee959ce35e", + "internalRef": "391849098" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "0b064d767537e0675fc053e53fca473c5c701fb8" + "sha": "484b7ec7bdef3909589a83e3d763e7588cb8c37c" } } ], @@ -33,232 +33,5 @@ "generator": "bazel" } } - ], - "generatedFiles": [ - ".github/CODEOWNERS", - ".github/ISSUE_TEMPLATE/bug_report.md", - ".github/ISSUE_TEMPLATE/feature_request.md", - ".github/ISSUE_TEMPLATE/support_request.md", - ".github/PULL_REQUEST_TEMPLATE.md", - ".github/blunderbuss.yml", - ".github/generated-files-bot.yml", - ".github/readme/synth.py", - ".github/release-please.yml", - ".github/snippet-bot.yml", - ".github/trusted-contribution.yml", - ".github/workflows/approve-readme.yaml", - ".github/workflows/auto-release.yaml", - ".github/workflows/ci.yaml", - ".kokoro/build.bat", - ".kokoro/build.sh", - ".kokoro/coerce_logs.sh", - ".kokoro/common.cfg", - ".kokoro/common.sh", - ".kokoro/continuous/common.cfg", - ".kokoro/continuous/java8.cfg", - ".kokoro/continuous/readme.cfg", - ".kokoro/dependencies.sh", - ".kokoro/nightly/common.cfg", - ".kokoro/nightly/integration.cfg", - ".kokoro/nightly/java11.cfg", - ".kokoro/nightly/java7.cfg", - ".kokoro/nightly/java8-osx.cfg", - ".kokoro/nightly/java8-win.cfg", - ".kokoro/nightly/java8.cfg", - ".kokoro/nightly/samples.cfg", - ".kokoro/populate-secrets.sh", - ".kokoro/presubmit/clirr.cfg", - ".kokoro/presubmit/common.cfg", - ".kokoro/presubmit/dependencies.cfg", - ".kokoro/presubmit/integration.cfg", - ".kokoro/presubmit/java11.cfg", - ".kokoro/presubmit/java7.cfg", - ".kokoro/presubmit/java8-osx.cfg", - ".kokoro/presubmit/java8-win.cfg", - ".kokoro/presubmit/java8.cfg", - ".kokoro/presubmit/linkage-monitor.cfg", - ".kokoro/presubmit/lint.cfg", - ".kokoro/presubmit/samples.cfg", - ".kokoro/readme.sh", - ".kokoro/release/bump_snapshot.cfg", - ".kokoro/release/common.cfg", - ".kokoro/release/common.sh", - ".kokoro/release/drop.cfg", - ".kokoro/release/drop.sh", - ".kokoro/release/promote.cfg", - ".kokoro/release/promote.sh", - ".kokoro/release/publish_javadoc.cfg", - ".kokoro/release/publish_javadoc.sh", - ".kokoro/release/publish_javadoc11.cfg", - ".kokoro/release/publish_javadoc11.sh", - ".kokoro/release/snapshot.cfg", - ".kokoro/release/snapshot.sh", - ".kokoro/release/stage.cfg", - ".kokoro/release/stage.sh", - ".kokoro/trampoline.sh", - "CODE_OF_CONDUCT.md", - "CONTRIBUTING.md", - "LICENSE", - "codecov.yaml", - "google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/SchemaServiceClient.java", - "google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/SchemaServiceSettings.java", - "google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/SubscriptionAdminClient.java", - "google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/SubscriptionAdminSettings.java", - "google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/TopicAdminClient.java", - "google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/TopicAdminSettings.java", - "google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/package-info.java", - "google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/GrpcPublisherCallableFactory.java", - "google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/GrpcPublisherStub.java", - "google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/GrpcSchemaServiceCallableFactory.java", - "google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/GrpcSchemaServiceStub.java", - "google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/GrpcSubscriberCallableFactory.java", - "google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/GrpcSubscriberStub.java", - "google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/PublisherStub.java", - "google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/PublisherStubSettings.java", - "google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/SchemaServiceStub.java", - "google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/SchemaServiceStubSettings.java", - "google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/SubscriberStub.java", - "google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/SubscriberStubSettings.java", - "google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MockIAMPolicy.java", - "google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MockIAMPolicyImpl.java", - "google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MockPublisher.java", - "google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MockPublisherImpl.java", - "google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MockSchemaService.java", - "google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MockSchemaServiceImpl.java", - "google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MockSubscriber.java", - "google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/MockSubscriberImpl.java", - "google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/SchemaServiceClientTest.java", - "google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/SubscriptionAdminClientTest.java", - "google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/TopicAdminClientTest.java", - "google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/TopicAdminSmokeTest.java", - "grpc-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PublisherGrpc.java", - "grpc-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SchemaServiceGrpc.java", - "grpc-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SubscriberGrpc.java", - "java.header", - "license-checks.xml", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/AcknowledgeRequest.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/AcknowledgeRequestOrBuilder.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/CreateSchemaRequest.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/CreateSchemaRequestOrBuilder.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/CreateSnapshotRequest.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/CreateSnapshotRequestOrBuilder.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeadLetterPolicy.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeadLetterPolicyOrBuilder.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeleteSchemaRequest.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeleteSchemaRequestOrBuilder.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeleteSnapshotRequest.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeleteSnapshotRequestOrBuilder.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeleteSubscriptionRequest.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeleteSubscriptionRequestOrBuilder.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeleteTopicRequest.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DeleteTopicRequestOrBuilder.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DetachSubscriptionRequest.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DetachSubscriptionRequestOrBuilder.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DetachSubscriptionResponse.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/DetachSubscriptionResponseOrBuilder.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/Encoding.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ExpirationPolicy.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ExpirationPolicyOrBuilder.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/GetSchemaRequest.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/GetSchemaRequestOrBuilder.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/GetSnapshotRequest.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/GetSnapshotRequestOrBuilder.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/GetSubscriptionRequest.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/GetSubscriptionRequestOrBuilder.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/GetTopicRequest.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/GetTopicRequestOrBuilder.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSchemasRequest.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSchemasRequestOrBuilder.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSchemasResponse.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSchemasResponseOrBuilder.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSnapshotsRequest.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSnapshotsRequestOrBuilder.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSnapshotsResponse.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSnapshotsResponseOrBuilder.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSubscriptionsRequest.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSubscriptionsRequestOrBuilder.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSubscriptionsResponse.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListSubscriptionsResponseOrBuilder.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicSnapshotsRequest.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicSnapshotsRequestOrBuilder.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicSnapshotsResponse.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicSnapshotsResponseOrBuilder.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicSubscriptionsRequest.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicSubscriptionsRequestOrBuilder.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicSubscriptionsResponse.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicSubscriptionsResponseOrBuilder.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicsRequest.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicsRequestOrBuilder.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicsResponse.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ListTopicsResponseOrBuilder.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/MessageStoragePolicy.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/MessageStoragePolicyOrBuilder.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ModifyAckDeadlineRequest.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ModifyAckDeadlineRequestOrBuilder.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ModifyPushConfigRequest.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ModifyPushConfigRequestOrBuilder.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ProjectName.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ProjectSnapshotName.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ProjectSubscriptionName.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PublishRequest.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PublishRequestOrBuilder.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PublishResponse.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PublishResponseOrBuilder.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PubsubMessage.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PubsubMessageOrBuilder.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PubsubProto.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PullRequest.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PullRequestOrBuilder.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PullResponse.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PullResponseOrBuilder.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PushConfig.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PushConfigOrBuilder.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ReceivedMessage.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ReceivedMessageOrBuilder.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/RetryPolicy.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/RetryPolicyOrBuilder.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/Schema.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SchemaName.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SchemaOrBuilder.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SchemaProto.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SchemaSettings.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SchemaSettingsOrBuilder.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SchemaView.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SeekRequest.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SeekRequestOrBuilder.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SeekResponse.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SeekResponseOrBuilder.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/Snapshot.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SnapshotOrBuilder.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/StreamingPullRequest.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/StreamingPullRequestOrBuilder.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/StreamingPullResponse.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/StreamingPullResponseOrBuilder.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/Subscription.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/SubscriptionOrBuilder.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/Topic.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/TopicName.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/TopicOrBuilder.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/UpdateSnapshotRequest.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/UpdateSnapshotRequestOrBuilder.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/UpdateSubscriptionRequest.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/UpdateSubscriptionRequestOrBuilder.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/UpdateTopicRequest.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/UpdateTopicRequestOrBuilder.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ValidateMessageRequest.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ValidateMessageRequestOrBuilder.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ValidateMessageResponse.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ValidateMessageResponseOrBuilder.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ValidateSchemaRequest.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ValidateSchemaRequestOrBuilder.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ValidateSchemaResponse.java", - "proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/ValidateSchemaResponseOrBuilder.java", - "proto-google-cloud-pubsub-v1/src/main/proto/google/pubsub/v1/pubsub.proto", - "proto-google-cloud-pubsub-v1/src/main/proto/google/pubsub/v1/schema.proto", - "renovate.json", - "samples/install-without-bom/pom.xml", - "samples/pom.xml", - "samples/snapshot/pom.xml", - "samples/snippets/pom.xml" ] } \ No newline at end of file diff --git a/synth.py b/synth.py deleted file mode 100644 index 8b63ce45a..000000000 --- a/synth.py +++ /dev/null @@ -1,527 +0,0 @@ -# Copyright 2018 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. - -"""This script is used to synthesize generated parts of this library.""" - -import synthtool as s -import synthtool.languages.java as java - -AUTOSYNTH_MULTIPLE_COMMITS = True - -service = 'pubsub' -versions = ['v1'] - -GET_IAM_POLICY_TOPIC = """ - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Gets the access control policy for a resource. Returns an empty policy if the resource exists - * and does not have a policy set. - * - *

    Sample code: - * - *

    
    -   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    -   *   String formattedResource = ProjectTopicName.format("[PROJECT]", "[TOPIC]");
    -   *   Policy response = topicAdminClient.getIamPolicy(formattedResource);
    -   * }
    -   * 
    - * - * @param resource REQUIRED: The resource for which the policy is being requested. See the - * operation documentation for the appropriate value for this field. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - * @deprecated Use {@link #getIamPolicy(GetIamPolicyRequest)} instead. - */ - @Deprecated - public final Policy getIamPolicy(String resource) { - GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder().setResource(resource).build(); - return getIamPolicy(request); - } -""" -GET_IAM_POLICY_SUBSCRIPTION = """ - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Gets the access control policy for a resource. Returns an empty policy if the resource exists - * and does not have a policy set. - * - *

    Sample code: - * - *

    
    -   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    -   *   String formattedResource = ProjectTopicName.format("[PROJECT]", "[TOPIC]");
    -   *   Policy response = subscriptionAdminClient.getIamPolicy(formattedResource);
    -   * }
    -   * 
    - * - * @param resource REQUIRED: The resource for which the policy is being requested. See the - * operation documentation for the appropriate value for this field. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - * @deprecated Use {@link #getIamPolicy(GetIamPolicyRequest)} instead. - */ - @Deprecated - public final Policy getIamPolicy(String resource) { - GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder().setResource(resource).build(); - return getIamPolicy(request); - } -""" - -GET_IAM_POLICY_PREVIOUS = r'(\s+public final Policy getIamPolicy\(GetIamPolicyRequest request\) {\n\s+return .*\n\s+})' - -SET_IAM_POLICY_TOPIC = """ - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Sets the access control policy on the specified resource. Replaces any existing policy. - * - *

    Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED - * - *

    Sample code: - * - *

    
    -   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    -   *   String formattedResource = ProjectTopicName.format("[PROJECT]", "[TOPIC]");
    -   *   Policy policy = Policy.newBuilder().build();
    -   *   Policy response = topicAdminClient.setIamPolicy(formattedResource, policy);
    -   * }
    -   * 
    - * - * @param resource REQUIRED: The resource for which the policy is being specified. See the - * operation documentation for the appropriate value for this field. - * @param policy REQUIRED: The complete policy to be applied to the `resource`. The size of the - * policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud - * Platform services (such as Projects) might reject them. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - * @deprecated Use {@link #setIamPolicy(SetIamPolicyRequest)} instead. - */ - @Deprecated - public final Policy setIamPolicy(String resource, Policy policy) { - SetIamPolicyRequest request = - SetIamPolicyRequest.newBuilder().setResource(resource).setPolicy(policy).build(); - return setIamPolicy(request); - } -""" -SET_IAM_POLICY_SUBSCRIPTION = """ - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Sets the access control policy on the specified resource. Replaces any existing policy. - * - *

    Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED - * - *

    Sample code: - * - *

    
    -   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    -   *   String formattedResource = ProjectTopicName.format("[PROJECT]", "[TOPIC]");
    -   *   Policy policy = Policy.newBuilder().build();
    -   *   Policy response = subscriptionAdminClient.setIamPolicy(formattedResource, policy);
    -   * }
    -   * 
    - * - * @param resource REQUIRED: The resource for which the policy is being specified. See the - * operation documentation for the appropriate value for this field. - * @param policy REQUIRED: The complete policy to be applied to the `resource`. The size of the - * policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud - * Platform services (such as Projects) might reject them. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - * @deprecated Use {@link #setIamPolicy(SetIamPolicyRequest)} instead. - */ - @Deprecated - public final Policy setIamPolicy(String resource, Policy policy) { - SetIamPolicyRequest request = - SetIamPolicyRequest.newBuilder().setResource(resource).setPolicy(policy).build(); - return setIamPolicy(request); - } -""" -SET_IAM_POLICY_PREVIOUS = r'(\s+public final Policy setIamPolicy\(SetIamPolicyRequest request\) {\n\s+return .*\n\s+})' - -TEST_IAM_PERMISSIONS_TOPIC = """ - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Returns permissions that a caller has on the specified resource. If the resource does not - * exist, this will return an empty set of permissions, not a NOT_FOUND error. - * - *

    Note: This operation is designed to be used for building permission-aware UIs and - * command-line tools, not for authorization checking. This operation may "fail open" without - * warning. - * - *

    Sample code: - * - *

    
    -   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    -   *   String formattedResource = ProjectTopicName.format("[PROJECT]", "[TOPIC]");
    -   *   List<String> permissions = new ArrayList<>();
    -   *   TestIamPermissionsResponse response = topicAdminClient.testIamPermissions(formattedResource, permissions);
    -   * }
    -   * 
    - * - * @param resource REQUIRED: The resource for which the policy detail is being requested. See the - * operation documentation for the appropriate value for this field. - * @param permissions The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - * @deprecated Use {@link #testIamPermissions(TestIamPermissionsRequest)} instead. - */ - @Deprecated - public final TestIamPermissionsResponse testIamPermissions( - String resource, List permissions) { - TestIamPermissionsRequest request = - TestIamPermissionsRequest.newBuilder() - .setResource(resource) - .addAllPermissions(permissions) - .build(); - return testIamPermissions(request); - } -""" -TEST_IAM_PERMISSIONS_SUBSCRIPTION = """ - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Returns permissions that a caller has on the specified resource. If the resource does not - * exist, this will return an empty set of permissions, not a NOT_FOUND error. - * - *

    Note: This operation is designed to be used for building permission-aware UIs and - * command-line tools, not for authorization checking. This operation may "fail open" without - * warning. - * - *

    Sample code: - * - *

    
    -   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    -   *   String formattedResource = ProjectTopicName.format("[PROJECT]", "[TOPIC]");
    -   *   List<String> permissions = new ArrayList<>();
    -   *   TestIamPermissionsResponse response = subscriptionAdminClient.testIamPermissions(formattedResource, permissions);
    -   * }
    -   * 
    - * - * @param resource REQUIRED: The resource for which the policy detail is being requested. See the - * operation documentation for the appropriate value for this field. - * @param permissions The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - * @deprecated Use {@link #testIamPermissions(TestIamPermissionsRequest)} instead. - */ - @Deprecated - public final TestIamPermissionsResponse testIamPermissions( - String resource, List permissions) { - TestIamPermissionsRequest request = - TestIamPermissionsRequest.newBuilder() - .setResource(resource) - .addAllPermissions(permissions) - .build(); - return testIamPermissions(request); - } -""" -TEST_IAM_PERMISSIONS_PREVIOUS = r'(\s+public final TestIamPermissionsResponse testIamPermissions\(TestIamPermissionsRequest request\) {\n\s+return .*\n\s+})' - -CREATE_TOPIC = """ - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Creates the given topic with the given name. See the <a - * href="https://cloud.google.com/pubsub/docs/admin#resource_names"> resource name - * rules</a>. - * - *

    Sample code: - * - *

    
    -   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    -   *   ProjectTopicName name = ProjectTopicName.of("[PROJECT]", "[TOPIC]");
    -   *   Topic response = topicAdminClient.createTopic(name);
    -   * }
    -   * 
    - * - * @param name Required. The name of the topic. It must have the format - * `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter, and contain only - * letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), - * tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters in - * length, and it must not start with `"goog"`. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - * @deprecated Use {@link #createTopic(TopicName)} instead. - */ - @Deprecated - public final Topic createTopic(ProjectTopicName name) { - Topic request = Topic.newBuilder().setName(name == null ? null : name.toString()).build(); - return createTopic(request); - } -""" - -CREATE_TOPIC_PREVIOUS = r'(\s+public final Topic createTopic\(String name\) {\n\s+.*\n\s+return.*\n\s+})' - -DELETE_TOPIC = """ - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Deletes the topic with the given name. Returns `NOT_FOUND` if the topic does not exist. After a - * topic is deleted, a new topic may be created with the same name; this is an entirely new topic - * with none of the old configuration or subscriptions. Existing subscriptions to this topic are - * not deleted, but their `topic` field is set to `_deleted-topic_`. - * - *

    Sample code: - * - *

    
    -   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    -   *   ProjectTopicName topic = ProjectTopicName.of("[PROJECT]", "[TOPIC]");
    -   *   topicAdminClient.deleteTopic(topic);
    -   * }
    -   * 
    - * - * @param topic Required. Name of the topic to delete. Format is - * `projects/{project}/topics/{topic}`. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - * @deprecated Use {@link #deleteTopic(TopicName)} instead. - */ - @Deprecated - public final void deleteTopic(ProjectTopicName topic) { - DeleteTopicRequest request = - DeleteTopicRequest.newBuilder().setTopic(topic == null ? null : topic.toString()).build(); - deleteTopic(request); - } -""" - -GET_TOPIC_PREVIOUS = r'(\s+public final Topic getTopic\(String topic\) {\n\s+.*\n\s+return.*\n\s+})' - -GET_TOPIC = """ - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Gets the configuration of a topic. - * - *

    Sample code: - * - *

    
    -   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    -   *   ProjectTopicName topic = ProjectTopicName.of("[PROJECT]", "[TOPIC]");
    -   *   Topic response = topicAdminClient.getTopic(topic);
    -   * }
    -   * 
    - * - * @param topic Required. The name of the topic to get. Format is - * `projects/{project}/topics/{topic}`. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - * @deprecated Use {@link #getTopic(TopicName)} instead. - */ - @Deprecated - public final Topic getTopic(ProjectTopicName topic) { - GetTopicRequest request = - GetTopicRequest.newBuilder().setTopic(topic == null ? null : topic.toString()).build(); - return getTopic(request); - } -""" - -DELETE_TOPIC_PREVIOUS = r'(\s+public final void deleteTopic\(String topic\) {\n\s+.*\n\s+deleteTopic.*\n\s+})' - -LIST_TOPIC_SUBSCRIPTIONS = """ - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Lists the names of the subscriptions on this topic. - * - *

    Sample code: - * - *

    
    -   * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
    -   *   ProjectTopicName topic = ProjectTopicName.of("[PROJECT]", "[TOPIC]");
    -   *   for (ProjectSubscriptionName element : topicAdminClient.listTopicSubscriptions(topic).iterateAllAsProjectSubscriptionName()) {
    -   *     // doThingsWith(element);
    -   *   }
    -   * }
    -   * 
    - * - * @param topic Required. The name of the topic that subscriptions are attached to. Format is - * `projects/{project}/topics/{topic}`. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - * @deprecated Use {@link #listTopicSubscriptions(TopicName)} instead. - */ - @Deprecated - public final ListTopicSubscriptionsPagedResponse listTopicSubscriptions(ProjectTopicName topic) { - ListTopicSubscriptionsRequest request = - ListTopicSubscriptionsRequest.newBuilder() - .setTopic(topic == null ? null : topic.toString()) - .build(); - return listTopicSubscriptions(request); - } -""" - -LIST_TOPIC_SUBSCRIPTIONS_PREVIOUS = r'(\s+public final ListTopicSubscriptionsPagedResponse listTopicSubscriptions\(String topic\) {\n\s+.*\n\s+.*\n\s+return.*\n\s+})' - -CREATE_SUBSCRIPTION_PREVIOUS = r'(\s+public final Subscription createSubscription\(Subscription request\) {\n\s+return.*\n\s+})' - -CREATE_SUBSCRIPTION = """ - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Creates a subscription to a given topic. See the <a - * href="https://cloud.google.com/pubsub/docs/admin#resource_names"> resource name - * rules</a>. If the subscription already exists, returns `ALREADY_EXISTS`. If the - * corresponding topic doesn't exist, returns `NOT_FOUND`. - * - *

    If the name is not provided in the request, the server will assign a random name for this - * subscription on the same project as the topic, conforming to the [resource name - * format](https://cloud.google.com/pubsub/docs/admin#resource_names). The generated name is - * populated in the returned Subscription object. Note that for REST API requests, you must - * specify a name in the request. - * - *

    Sample code: - * - *

    
    -   * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
    -   *   ProjectSubscriptionName name = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
    -   *   ProjectTopicName topic = ProjectTopicName.of("[PROJECT]", "[TOPIC]");
    -   *   PushConfig pushConfig = PushConfig.newBuilder().build();
    -   *   int ackDeadlineSeconds = 0;
    -   *   Subscription response = subscriptionAdminClient.createSubscription(name, topic, pushConfig, ackDeadlineSeconds);
    -   * }
    -   * 
    - * - * @param name Required. The name of the subscription. It must have the format - * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must start with a - * letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores - * (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 - * and 255 characters in length, and it must not start with `"goog"`. - * @param topic Required. The name of the topic from which this subscription is receiving - * messages. Format is `projects/{project}/topics/{topic}`. The value of this field will be - * `_deleted-topic_` if the topic has been deleted. - * @param pushConfig If push delivery is used with this subscription, this field is used to - * configure it. An empty `pushConfig` signifies that the subscriber will pull and ack - * messages using API methods. - * @param ackDeadlineSeconds The approximate amount of time (on a best-effort basis) Pub/Sub waits - * for the subscriber to acknowledge receipt before resending the message. In the interval - * after the message is delivered and before it is acknowledged, it is considered to be - * <i>outstanding</i>. During that time period, the message will not be - * redelivered (on a best-effort basis). - *

    For pull subscriptions, this value is used as the initial value for the ack deadline. To - * override this value for a given message, call `ModifyAckDeadline` with the corresponding - * `ack_id` if using non-streaming pull or send the `ack_id` in a - * `StreamingModifyAckDeadlineRequest` if using streaming pull. The minimum custom deadline - * you can specify is 10 seconds. The maximum custom deadline you can specify is 600 seconds - * (10 minutes). If this parameter is 0, a default value of 10 seconds is used. - *

    For push delivery, this value is also used to set the request timeout for the call to - * the push endpoint. - *

    If the subscriber never acknowledges the message, the Pub/Sub system will eventually - * redeliver the message. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - * @deprecated Use {@link #createSubscription(ProjectSubscriptionName, TopicName, PushConfig, int)} instead. - */ - @Deprecated - public final Subscription createSubscription( - ProjectSubscriptionName name, - ProjectTopicName topic, - PushConfig pushConfig, - int ackDeadlineSeconds) { - Subscription request = - Subscription.newBuilder() - .setName(name == null ? null : name.toString()) - .setTopic(topic == null ? null : topic.toString()) - .setPushConfig(pushConfig) - .setAckDeadlineSeconds(ackDeadlineSeconds) - .build(); - return createSubscription(request); - } -""" - -PACKAGE = 'package com.google.cloud.pubsub.v1;' - -IMPORT_PROJECT_TOPIC_NAME = 'import com.google.pubsub.v1.ProjectTopicName;' - -for version in versions: - java.bazel_library( - service=service, - version=version, - proto_path=f'google/{service}/{version}', - bazel_target=f'//google/{service}/{version}:google-cloud-{service}-{version}-java', - ) - s.replace( - '**/stub/SubscriberStubSettings.java', - r'setMaxInboundMessageSize\(Integer.MAX_VALUE\)', - 'setMaxInboundMessageSize(20 << 20)' - ) - s.replace( - f"proto-google-cloud-{service}-{version}/src/**/*.java", - java.BAD_LICENSE, - java.GOOD_LICENSE, - ) - - s.replace( - '**/TopicAdminClient.java', - GET_IAM_POLICY_PREVIOUS, - "\g<1>\n\n" + GET_IAM_POLICY_TOPIC - ) - - s.replace( - '**/TopicAdminClient.java', - SET_IAM_POLICY_PREVIOUS, - "\g<1>\n\n" + SET_IAM_POLICY_TOPIC - ) - - s.replace( - '**/TopicAdminClient.java', - TEST_IAM_PERMISSIONS_PREVIOUS, - "\g<1>\n\n" + TEST_IAM_PERMISSIONS_TOPIC - ) - - s.replace( - '**/SubscriptionAdminClient.java', - GET_IAM_POLICY_PREVIOUS, - "\g<1>\n\n" + GET_IAM_POLICY_SUBSCRIPTION - ) - - s.replace( - '**/SubscriptionAdminClient.java', - SET_IAM_POLICY_PREVIOUS, - "\g<1>\n\n" + SET_IAM_POLICY_SUBSCRIPTION - ) - - s.replace( - '**/SubscriptionAdminClient.java', - TEST_IAM_PERMISSIONS_PREVIOUS, - "\g<1>\n\n" + TEST_IAM_PERMISSIONS_SUBSCRIPTION - ) - - s.replace( - '**/TopicAdminClient.java', - CREATE_TOPIC_PREVIOUS, - "\g<1>\n\n" + CREATE_TOPIC - ) - - s.replace( - '**/TopicAdminClient.java', - DELETE_TOPIC_PREVIOUS, - "\g<1>\n\n" + DELETE_TOPIC - ) - - s.replace( - '**/TopicAdminClient.java', - LIST_TOPIC_SUBSCRIPTIONS_PREVIOUS, - "\g<1>\n\n" + LIST_TOPIC_SUBSCRIPTIONS - ) - - s.replace( - '**/TopicAdminClient.java', - GET_TOPIC_PREVIOUS, - "\g<1>\n\n" + GET_TOPIC - ) - - s.replace( - '**/SubscriptionAdminClient.java', - CREATE_SUBSCRIPTION_PREVIOUS, - "\g<1>\n\n" + CREATE_SUBSCRIPTION - ) - - s.replace( - '**/*AdminClient.java', - PACKAGE, - PACKAGE + '\n\n' + IMPORT_PROJECT_TOPIC_NAME + '\n' - ) - - java.format_code('google-cloud-pubsub/src') - java.format_code(f'grpc-google-cloud-{service}-{version}/src') - java.format_code(f'proto-google-cloud-{service}-{version}/src') - -java.common_templates(excludes=[ - ".github/workflows/samples.yaml", -]) diff --git a/versions.txt b/versions.txt index 95b81fc76..55484585a 100644 --- a/versions.txt +++ b/versions.txt @@ -1,6 +1,6 @@ # Format: # module:released-version:current-version -proto-google-cloud-pubsub-v1:1.93.4:1.93.5-SNAPSHOT -grpc-google-cloud-pubsub-v1:1.93.4:1.93.5-SNAPSHOT -google-cloud-pubsub:1.111.4:1.111.5-SNAPSHOT \ No newline at end of file +google-cloud-pubsub:1.150.2:1.150.3-SNAPSHOT +grpc-google-cloud-pubsub-v1:1.132.2:1.132.3-SNAPSHOT +proto-google-cloud-pubsub-v1:1.132.2:1.132.3-SNAPSHOT