diff --git a/.github/.OwlBot.yaml b/.github/.OwlBot-hermetic.yaml similarity index 100% rename from .github/.OwlBot.yaml rename to .github/.OwlBot-hermetic.yaml diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 5db36a5f7..359fe71c1 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-java:latest - digest: sha256:68ba5f5164a4b55529d358bb262feaa000536a0c62980727dd05a91bbb47ea5e -# created: 2024-05-09T16:31:37.168667071Z + digest: sha256:72f0d373307d128b2cb720c5cb4d90b31f0e86529dd138c632710ae0c69efae3 +# created: 2024-06-05T18:32:21.724930324Z diff --git a/.github/scripts/hermetic_library_generation.sh b/.github/scripts/hermetic_library_generation.sh new file mode 100644 index 000000000..6c3f22d8f --- /dev/null +++ b/.github/scripts/hermetic_library_generation.sh @@ -0,0 +1,117 @@ +#!/bin/bash +set -e +# This script should be run at the root of the repository. +# This script is used to, when a pull request changes the generation +# configuration (generation_config.yaml by default): +# 1. Find whether the last commit in this pull request contains changes to +# the generation configuration and exit early if it doesn't have such a change +# since the generation result would be the same. +# 2. Compare generation configurations in the current branch (with which the +# pull request associated) and target branch (into which the pull request is +# merged); +# 3. Generate changed libraries using library_generation image; +# 4. Commit the changes to the pull request, if any. +# 5. Edit the PR body with generated pull request description, if applicable. + +# The following commands need to be installed before running the script: +# 1. git +# 2. gh +# 3. docker + +# The parameters of this script is: +# 1. target_branch, the branch into which the pull request is merged. +# 2. current_branch, the branch with which the pull request is associated. +# 3. [optional] generation_config, the path to the generation configuration, +# the default value is generation_config.yaml in the repository root. +while [[ $# -gt 0 ]]; do +key="$1" +case "${key}" in + --target_branch) + target_branch="$2" + shift + ;; + --current_branch) + current_branch="$2" + shift + ;; + --generation_config) + generation_config="$2" + shift + ;; + *) + echo "Invalid option: [$1]" + exit 1 + ;; +esac +shift +done + +if [ -z "${target_branch}" ]; then + echo "missing required argument --target_branch" + exit 1 +fi + +if [ -z "${current_branch}" ]; then + echo "missing required argument --current_branch" + exit 1 +fi + +if [ -z "${generation_config}" ]; then + generation_config=generation_config.yaml + echo "Using default generation config: ${generation_config}" +fi + +workspace_name="/workspace" +baseline_generation_config="baseline_generation_config.yaml" +message="chore: generate libraries at $(date)" + +git checkout "${target_branch}" +git checkout "${current_branch}" +# if the last commit doesn't contain changes to generation configuration, +# do not generate again as the result will be the same. +change_of_last_commit="$(git diff-tree --no-commit-id --name-only HEAD~1..HEAD -r)" +if [[ ! ("${change_of_last_commit}" == *"${generation_config}"*) ]]; then + echo "The last commit doesn't contain any changes to the generation_config.yaml, skipping the whole generation process." || true + exit 0 +fi +# copy generation configuration from target branch to current branch. +git show "${target_branch}":"${generation_config}" > "${baseline_generation_config}" +config_diff=$(diff "${generation_config}" "${baseline_generation_config}" || true) + +# parse image tag from the generation configuration. +image_tag=$(grep "gapic_generator_version" "${generation_config}" | cut -d ':' -f 2 | xargs) + +# run hermetic code generation docker image. +docker run \ + --rm \ + -u "$(id -u):$(id -g)" \ + -v "$(pwd):${workspace_name}" \ + gcr.io/cloud-devrel-public-resources/java-library-generation:"${image_tag}" \ + --baseline-generation-config-path="${workspace_name}/${baseline_generation_config}" \ + --current-generation-config-path="${workspace_name}/${generation_config}" + + +# commit the change to the pull request. +if [[ $(basename $(pwd)) == "google-cloud-java" ]]; then + git add java-* pom.xml gapic-libraries-bom/pom.xml versions.txt +else + # The image leaves intermediate folders and files it works with. Here we remove them + rm -rdf output googleapis "${baseline_generation_config}" + git add --all -- ':!pr_description.txt' +fi +changed_files=$(git diff --cached --name-only) +if [[ "${changed_files}" == "" ]]; then + echo "There is no generated code change with the generation config change ${config_diff}." + echo "Skip committing to the pull request." + exit 0 +fi + +echo "Configuration diff:" +echo "${config_diff}" +git commit -m "${message}" +git push +# set pr body if pr_description.txt is generated. +if [[ -f "pr_description.txt" ]]; then + pr_num=$(gh pr list -s open -H "${current_branch}" -q . --json number | jq ".[] | .number") + gh pr edit "${pr_num}" --body "$(cat pr_description.txt)" +fi diff --git a/.github/scripts/update_generation_config.sh b/.github/scripts/update_generation_config.sh new file mode 100644 index 000000000..561a31304 --- /dev/null +++ b/.github/scripts/update_generation_config.sh @@ -0,0 +1,121 @@ +#!/bin/bash +set -e +# 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 + latest=$(curl -s "https://search.maven.org/solrsearch/select?q=g:${group_id}+AND+a:${artifact_id}&core=gav&rows=500&wt=json" | jq -r '.response.docs[] | select(.v | test("^[0-9]+(\\.[0-9]+)*$")) | .v' | sort -V | tail -n 1) + echo "${latest}" +} + +# 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}" +} + +# 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. +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 + ;; + *) + 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 + +current_branch="generate-libraries-${base_branch}" +title="chore: Update generation configuration at $(date)" + +# 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}" +else + gh pr checkout "${pr_num}" +fi + +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_version=$(get_latest_released_version "com.google.api" "gapic-generator-java") +update_config "gapic_generator_version" "${latest_version}" "${generation_config}" + +# 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}" +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." + exit 0 +fi +git commit -m "${title}" +if [ -z "${pr_num}" ]; then + git remote add remote_repo https://cloud-java-bot:"${GH_TOKEN}@github.com/${repo}.git" + git fetch -q --unshallow 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/trusted-contribution.yml b/.github/trusted-contribution.yml index a0ba1f7d9..88d3ac9bf 100644 --- a/.github/trusted-contribution.yml +++ b/.github/trusted-contribution.yml @@ -1,3 +1,9 @@ trustedContributors: - renovate-bot - gcf-owl-bot[bot] + +annotations: +- type: comment + text: "/gcbrun" +- type: label + text: "kokoro:force-run" diff --git a/.github/workflows/hermetic_library_generation.yaml b/.github/workflows/hermetic_library_generation.yaml new file mode 100644 index 000000000..7146cc3dc --- /dev/null +++ b/.github/workflows/hermetic_library_generation.yaml @@ -0,0 +1,40 @@ +# 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: + +jobs: + library_generation: + # skip pull requests coming from a forked repository + if: github.event.pull_request.head.repo.full_name == github.repository + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ secrets.CLOUD_JAVA_BOT_TOKEN }} + - name: Generate changed libraries + 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/hermetic_library_generation.sh \ + --target_branch ${{ github.base_ref }} \ + --current_branch ${{ github.head_ref }} + env: + GH_TOKEN: ${{ secrets.CLOUD_JAVA_BOT_TOKEN }} diff --git a/.github/workflows/unmanaged_dependency_check.yaml b/.github/workflows/unmanaged_dependency_check.yaml index ebaa54bab..de006d9e2 100644 --- a/.github/workflows/unmanaged_dependency_check.yaml +++ b/.github/workflows/unmanaged_dependency_check.yaml @@ -17,6 +17,6 @@ jobs: # repository .kokoro/build.sh - name: Unmanaged dependency check - uses: googleapis/sdk-platform-java/java-shared-dependencies/unmanaged-dependency-check@google-cloud-shared-dependencies/v3.30.1 + uses: googleapis/sdk-platform-java/java-shared-dependencies/unmanaged-dependency-check@google-cloud-shared-dependencies/v3.32.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..3cf773992 --- /dev/null +++ b/.github/workflows/update_generation_config.yaml @@ -0,0 +1,42 @@ +# 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-22.04 + env: + # the branch into which the pull request is merged + base_branch: main + steps: + - uses: actions/checkout@v4 + with: + token: ${{ secrets.CLOUD_JAVA_BOT_TOKEN }} + - 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_TOKEN }} diff --git a/.kokoro/presubmit/graalvm-native-17.cfg b/.kokoro/presubmit/graalvm-native-17.cfg index 532f888ec..7d5ab3a25 100644 --- a/.kokoro/presubmit/graalvm-native-17.cfg +++ b/.kokoro/presubmit/graalvm-native-17.cfg @@ -3,7 +3,7 @@ # Configure the docker image for kokoro-trampoline. env_vars: { key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_b:3.30.1" + value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_b:3.32.0" } env_vars: { diff --git a/.kokoro/presubmit/graalvm-native.cfg b/.kokoro/presubmit/graalvm-native.cfg index 1292cf163..519c2e3ce 100644 --- a/.kokoro/presubmit/graalvm-native.cfg +++ b/.kokoro/presubmit/graalvm-native.cfg @@ -3,7 +3,7 @@ # Configure the docker image for kokoro-trampoline. env_vars: { key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_a:3.30.1" + value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_a:3.32.0" } env_vars: { diff --git a/.repo-metadata.json b/.repo-metadata.json index f30706ceb..0c8364b05 100644 --- a/.repo-metadata.json +++ b/.repo-metadata.json @@ -1,19 +1,20 @@ { "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", + "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", "library_type": "GAPIC_COMBO", "requires_billing": true, + "api_reference": "https://cloud.google.com/pubsub/", + "codeowner_team": "@googleapis/api-pubsub", + "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 82292bbdf..89626575a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,58 @@ # Changelog +## [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) diff --git a/README.md b/README.md index 19e6155b2..b446529b4 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file: com.google.cloud libraries-bom - 26.39.0 + 26.42.0 pom import @@ -44,7 +44,7 @@ If you are using Maven without the BOM, add this to your dependencies: com.google.cloud google-cloud-pubsub - 1.129.4 + 1.131.0 ``` @@ -52,20 +52,20 @@ If you are using Maven without the BOM, add this to your dependencies: If you are using Gradle 5.x or later, add this to your dependencies: ```Groovy -implementation platform('com.google.cloud:libraries-bom:26.39.0') +implementation platform('com.google.cloud:libraries-bom:26.42.0') implementation 'com.google.cloud:google-cloud-pubsub' ``` If you are using Gradle without BOM, add this to your dependencies: ```Groovy -implementation 'com.google.cloud:google-cloud-pubsub:1.129.5' +implementation 'com.google.cloud:google-cloud-pubsub:1.131.0' ``` If you are using SBT, add this to your dependencies: ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-pubsub" % "1.129.5" +libraryDependencies += "com.google.cloud" % "google-cloud-pubsub" % "1.131.0" ``` @@ -275,6 +275,7 @@ Samples are in the [`samples/`](https://github.com/googleapis/java-pubsub/tree/m | 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) | +| 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) | @@ -319,6 +320,10 @@ Samples are in the [`samples/`](https://github.com/googleapis/java-pubsub/tree/m To get help, follow the instructions in the [shared Troubleshooting document][troubleshooting]. +## 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. @@ -411,7 +416,7 @@ Java is a registered trademark of Oracle and/or its affiliates. [kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-pubsub/java11.html [stability-image]: https://img.shields.io/badge/stability-stable-green [maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-pubsub.svg -[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-pubsub/1.129.5 +[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-pubsub/1.131.0 [authentication]: https://github.com/googleapis/google-cloud-java#authentication [auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes [predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles diff --git a/generation_config.yaml b/generation_config.yaml new file mode 100644 index 000000000..7f9f93bd9 --- /dev/null +++ b/generation_config.yaml @@ -0,0 +1,23 @@ +gapic_generator_version: 2.42.0 +googleapis_commitish: 7976ffadc0f21ee9149708c0c97ef000e15de1eb +libraries_bom_version: 26.42.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/api-pubsub' + 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 b78628e9a..295c7717e 100644 --- a/google-cloud-pubsub-bom/pom.xml +++ b/google-cloud-pubsub-bom/pom.xml @@ -3,12 +3,12 @@ 4.0.0 com.google.cloud google-cloud-pubsub-bom - 1.129.5 + 1.131.1-SNAPSHOT pom com.google.cloud google-cloud-shared-config - 1.7.7 + 1.8.1 Google Cloud pubsub BOM @@ -52,17 +52,17 @@ com.google.cloud google-cloud-pubsub - 1.129.5 + 1.131.1-SNAPSHOT com.google.api.grpc grpc-google-cloud-pubsub-v1 - 1.111.5 + 1.113.1-SNAPSHOT com.google.api.grpc proto-google-cloud-pubsub-v1 - 1.111.5 + 1.113.1-SNAPSHOT diff --git a/google-cloud-pubsub/pom.xml b/google-cloud-pubsub/pom.xml index cbbe43bba..af2d034e5 100644 --- a/google-cloud-pubsub/pom.xml +++ b/google-cloud-pubsub/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-pubsub - 1.129.5 + 1.131.1-SNAPSHOT jar Google Cloud Pub/Sub https://github.com/googleapis/java-pubsub @@ -11,7 +11,7 @@ com.google.cloud google-cloud-pubsub-parent - 1.129.5 + 1.131.1-SNAPSHOT google-cloud-pubsub @@ -85,7 +85,7 @@ io.grpc grpc-inprocess - runtime + test com.google.errorprone diff --git a/grpc-google-cloud-pubsub-v1/pom.xml b/grpc-google-cloud-pubsub-v1/pom.xml index cd7cf1543..9b5e7af10 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.111.5 + 1.113.1-SNAPSHOT grpc-google-cloud-pubsub-v1 GRPC library for grpc-google-cloud-pubsub-v1 com.google.cloud google-cloud-pubsub-parent - 1.129.5 + 1.131.1-SNAPSHOT diff --git a/pom.xml b/pom.xml index f5ce4e879..42b2ec00d 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-pubsub-parent pom - 1.129.5 + 1.131.1-SNAPSHOT Google Cloud Pub/Sub Parent https://github.com/googleapis/java-pubsub @@ -14,7 +14,7 @@ com.google.cloud sdk-platform-java-config - 3.30.1 + 3.32.0 @@ -69,17 +69,17 @@ com.google.api.grpc proto-google-cloud-pubsub-v1 - 1.111.5 + 1.113.1-SNAPSHOT com.google.api.grpc grpc-google-cloud-pubsub-v1 - 1.111.5 + 1.113.1-SNAPSHOT com.google.cloud google-cloud-pubsub - 1.129.5 + 1.131.1-SNAPSHOT @@ -104,7 +104,7 @@ com.google.truth truth - 1.4.2 + 1.4.3 test @@ -145,7 +145,7 @@ org.apache.maven.plugins maven-project-info-reports-plugin - 3.5.0 + 3.6.1 diff --git a/proto-google-cloud-pubsub-v1/pom.xml b/proto-google-cloud-pubsub-v1/pom.xml index 035d3c1a9..4d6605394 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.111.5 + 1.113.1-SNAPSHOT proto-google-cloud-pubsub-v1 PROTO library for proto-google-cloud-pubsub-v1 com.google.cloud google-cloud-pubsub-parent - 1.129.5 + 1.131.1-SNAPSHOT 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 index 67b06239d..66323e6af 100644 --- 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 @@ -41,6 +41,7 @@ private BigQueryConfig(com.google.protobuf.GeneratedMessageV3.Builder builder private BigQueryConfig() { table_ = ""; state_ = 0; + serviceAccountEmail_ = ""; } @java.lang.Override @@ -477,6 +478,67 @@ 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 @@ -509,6 +571,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io if (useTableSchema_ != false) { output.writeBool(6, useTableSchema_); } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(serviceAccountEmail_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 7, serviceAccountEmail_); + } getUnknownFields().writeTo(output); } @@ -536,6 +601,9 @@ public int getSerializedSize() { if (useTableSchema_ != false) { size += com.google.protobuf.CodedOutputStream.computeBoolSize(6, useTableSchema_); } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(serviceAccountEmail_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(7, serviceAccountEmail_); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -557,6 +625,7 @@ public boolean equals(final java.lang.Object obj) { 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; } @@ -580,6 +649,8 @@ public int hashCode() { 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; @@ -724,6 +795,7 @@ public Builder clear() { dropUnknownFields_ = false; state_ = 0; useTableSchema_ = false; + serviceAccountEmail_ = ""; return this; } @@ -777,6 +849,9 @@ private void buildPartial0(com.google.pubsub.v1.BigQueryConfig result) { if (((from_bitField0_ & 0x00000020) != 0)) { result.useTableSchema_ = useTableSchema_; } + if (((from_bitField0_ & 0x00000040) != 0)) { + result.serviceAccountEmail_ = serviceAccountEmail_; + } } @java.lang.Override @@ -844,6 +919,11 @@ public Builder mergeFrom(com.google.pubsub.v1.BigQueryConfig other) { if (other.getUseTableSchema() != false) { setUseTableSchema(other.getUseTableSchema()); } + if (!other.getServiceAccountEmail().isEmpty()) { + serviceAccountEmail_ = other.serviceAccountEmail_; + bitField0_ |= 0x00000040; + onChanged(); + } this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; @@ -906,6 +986,12 @@ public Builder mergeFrom( bitField0_ |= 0x00000020; break; } // case 48 + case 58: + { + serviceAccountEmail_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000040; + break; + } // case 58 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { @@ -1389,6 +1475,137 @@ public Builder clearUseTableSchema() { 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; + } + @java.lang.Override public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/BigQueryConfigOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/BigQueryConfigOrBuilder.java index a2420175d..958a634f2 100644 --- 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 @@ -145,4 +145,39 @@ public interface BigQueryConfigOrBuilder * @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/CloudStorageConfig.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/CloudStorageConfig.java index 5d3704a7d..f847f91d6 100644 --- 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 @@ -44,6 +44,7 @@ private CloudStorageConfig() { filenameSuffix_ = ""; filenameDatetimeFormat_ = ""; state_ = 0; + serviceAccountEmail_ = ""; } @java.lang.Override @@ -129,6 +130,17 @@ public enum State implements com.google.protobuf.ProtocolMessageEnum { * 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), UNRECOGNIZED(-1), ; @@ -184,6 +196,17 @@ public enum State implements com.google.protobuf.ProtocolMessageEnum { * 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; public final int getNumber() { if (this == UNRECOGNIZED) { @@ -219,6 +242,8 @@ public static State forNumber(int value) { return NOT_FOUND; case 4: return IN_TRANSIT_LOCATION_RESTRICTION; + case 5: + return SCHEMA_MISMATCH; default: return null; } @@ -720,6 +745,20 @@ public interface AvroConfigOrBuilder * @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(); } /** * @@ -787,6 +826,25 @@ 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 @@ -804,6 +862,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io if (writeMetadata_ != false) { output.writeBool(1, writeMetadata_); } + if (useTopicSchema_ != false) { + output.writeBool(2, useTopicSchema_); + } getUnknownFields().writeTo(output); } @@ -816,6 +877,9 @@ public int getSerializedSize() { 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; @@ -833,6 +897,7 @@ public boolean equals(final java.lang.Object obj) { (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; } @@ -846,6 +911,8 @@ public int hashCode() { 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; @@ -989,6 +1056,7 @@ public Builder clear() { super.clear(); bitField0_ = 0; writeMetadata_ = false; + useTopicSchema_ = false; return this; } @@ -1028,6 +1096,9 @@ private void buildPartial0(com.google.pubsub.v1.CloudStorageConfig.AvroConfig re if (((from_bitField0_ & 0x00000001) != 0)) { result.writeMetadata_ = writeMetadata_; } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.useTopicSchema_ = useTopicSchema_; + } } @java.lang.Override @@ -1081,6 +1152,9 @@ public Builder mergeFrom(com.google.pubsub.v1.CloudStorageConfig.AvroConfig othe if (other.getWriteMetadata() != false) { setWriteMetadata(other.getWriteMetadata()); } + if (other.getUseTopicSchema() != false) { + setUseTopicSchema(other.getUseTopicSchema()); + } this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; @@ -1113,6 +1187,12 @@ public Builder mergeFrom( bitField0_ |= 0x00000001; break; } // case 8 + case 16: + { + useTopicSchema_ = input.readBool(); + bitField0_ |= 0x00000002; + break; + } // case 16 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { @@ -1200,6 +1280,62 @@ public Builder clearWriteMetadata() { 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; + } + @java.lang.Override public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { @@ -1770,6 +1906,67 @@ public com.google.pubsub.v1.CloudStorageConfig.State getState() { 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 @@ -1811,6 +2008,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(filenameDatetimeFormat_)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 10, filenameDatetimeFormat_); } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(serviceAccountEmail_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 11, serviceAccountEmail_); + } getUnknownFields().writeTo(output); } @@ -1851,6 +2051,9 @@ public int getSerializedSize() { if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(filenameDatetimeFormat_)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(10, filenameDatetimeFormat_); } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(serviceAccountEmail_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(11, serviceAccountEmail_); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -1876,6 +2079,7 @@ public boolean equals(final java.lang.Object obj) { } if (getMaxBytes() != other.getMaxBytes()) 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: @@ -1914,6 +2118,8 @@ public int hashCode() { hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getMaxBytes()); 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; @@ -2091,6 +2297,7 @@ public Builder clear() { } maxBytes_ = 0L; state_ = 0; + serviceAccountEmail_ = ""; outputFormatCase_ = 0; outputFormat_ = null; return this; @@ -2154,6 +2361,9 @@ private void buildPartial0(com.google.pubsub.v1.CloudStorageConfig result) { if (((from_bitField0_ & 0x00000100) != 0)) { result.state_ = state_; } + if (((from_bitField0_ & 0x00000200) != 0)) { + result.serviceAccountEmail_ = serviceAccountEmail_; + } result.bitField0_ |= to_bitField0_; } @@ -2242,6 +2452,11 @@ public Builder mergeFrom(com.google.pubsub.v1.CloudStorageConfig other) { if (other.state_ != 0) { setStateValue(other.getStateValue()); } + if (!other.getServiceAccountEmail().isEmpty()) { + serviceAccountEmail_ = other.serviceAccountEmail_; + bitField0_ |= 0x00000200; + onChanged(); + } switch (other.getOutputFormatCase()) { case TEXT_CONFIG: { @@ -2338,6 +2553,12 @@ public Builder mergeFrom( bitField0_ |= 0x00000008; break; } // case 82 + case 90: + { + serviceAccountEmail_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000200; + break; + } // case 90 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { @@ -3685,6 +3906,137 @@ public Builder clearState() { 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_ |= 0x00000200; + 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_ & ~0x00000200); + 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_ |= 0x00000200; + onChanged(); + return this; + } + @java.lang.Override public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/CloudStorageConfigOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/CloudStorageConfigOrBuilder.java index 19eab21ab..11d3fa787 100644 --- 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 @@ -318,5 +318,40 @@ public interface CloudStorageConfigOrBuilder */ 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/PubsubProto.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PubsubProto.java index 8fff960ed..a80aaa209 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 @@ -417,239 +417,242 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "\032\017\n\rPubsubWrapper\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\025authen" - + "tication_methodB\t\n\007wrapper\"\352\002\n\016BigQueryC" + + "tication_methodB\t\n\007wrapper\"\216\003\n\016BigQueryC" + "onfig\022\022\n\005table\030\001 \001(\tB\003\340A\001\022\035\n\020use_topic_s" + "chema\030\002 \001(\010B\003\340A\001\022\033\n\016write_metadata\030\003 \001(\010" + "B\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.BigQue" + "ryConfig.StateB\003\340A\003\022\035\n\020use_table_schema\030" - + "\006 \001(\010B\003\340A\001\"\212\001\n\005State\022\025\n\021STATE_UNSPECIFIE" - + "D\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\"\365\004\n\022Clou" - + "dStorageConfig\022\023\n\006bucket\030\001 \001(\tB\003\340A\002\022\034\n\017f" - + "ilename_prefix\030\002 \001(\tB\003\340A\001\022\034\n\017filename_su" - + "ffix\030\003 \001(\tB\003\340A\001\022%\n\030filename_datetime_for" - + "mat\030\n \001(\tB\003\340A\001\022K\n\013text_config\030\004 \001(\0132/.go" - + "ogle.pubsub.v1.CloudStorageConfig.TextCo" - + "nfigB\003\340A\001H\000\022K\n\013avro_config\030\005 \001(\0132/.googl" - + "e.pubsub.v1.CloudStorageConfig.AvroConfi" - + "gB\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>\n\005state\030\t \001(\0162*.google.pubsub.v1" - + ".CloudStorageConfig.StateB\003\340A\003\032\014\n\nTextCo" - + "nfig\032)\n\nAvroConfig\022\033\n\016write_metadata\030\001 \001" - + "(\010B\003\340A\001\"u\n\005State\022\025\n\021STATE_UNSPECIFIED\020\000\022" + + "\006 \001(\010B\003\340A\001\022\"\n\025service_account_email\030\007 \001(" + + "\tB\003\340A\001\"\212\001\n\005State\022\025\n\021STATE_UNSPECIFIED\020\000\022" + "\n\n\006ACTIVE\020\001\022\025\n\021PERMISSION_DENIED\020\002\022\r\n\tNO" - + "T_FOUND\020\003\022#\n\037IN_TRANSIT_LOCATION_RESTRIC" - + "TION\020\004B\017\n\routput_format\"|\n\017ReceivedMessa" - + "ge\022\023\n\006ack_id\030\001 \001(\tB\003\340A\001\0225\n\007message\030\002 \001(\013" - + "2\037.google.pubsub.v1.PubsubMessageB\003\340A\001\022\035" - + "\n\020delivery_attempt\030\003 \001(\005B\003\340A\001\"Z\n\026GetSubs" - + "criptionRequest\022@\n\014subscription\030\001 \001(\tB*\340" - + "A\002\372A$\n\"pubsub.googleapis.com/Subscriptio" - + "n\"\214\001\n\031UpdateSubscriptionRequest\0229\n\014subsc" - + "ription\030\001 \001(\0132\036.google.pubsub.v1.Subscri" - + "ptionB\003\340A\002\0224\n\013update_mask\030\002 \001(\0132\032.google" - + ".protobuf.FieldMaskB\003\340A\002\"\221\001\n\030ListSubscri" - + "ptionsRequest\022D\n\007project\030\001 \001(\tB3\340A\002\372A-\n+" - + "cloudresourcemanager.googleapis.com/Proj" - + "ect\022\026\n\tpage_size\030\002 \001(\005B\003\340A\001\022\027\n\npage_toke" - + "n\030\003 \001(\tB\003\340A\001\"u\n\031ListSubscriptionsRespons" - + "e\022:\n\rsubscriptions\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.g" - + "oogleapis.com/Subscription\"\223\001\n\027ModifyPus" - + "hConfigRequest\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\014subs" - + "cription\030\001 \001(\tB*\340A\002\372A$\n\"pubsub.googleapi" - + "s.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\014subs" - + "cription\030\001 \001(\tB*\340A\002\372A$\n\"pubsub.googleapi" - + "s.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\022A" - + "cknowledgeRequest\022@\n\014subscription\030\001 \001(\tB" - + "*\340A\002\372A$\n\"pubsub.googleapis.com/Subscript" - + "ion\022\024\n\007ack_ids\030\002 \003(\tB\003\340A\002\"\307\002\n\024StreamingP" - + "ullRequest\022@\n\014subscription\030\001 \001(\tB*\340A\002\372A$" - + "\n\"pubsub.googleapis.com/Subscription\022\024\n\007" - + "ack_ids\030\002 \003(\tB\003\340A\001\022$\n\027modify_deadline_se" - + "conds\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_se" - + "conds\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\"\236\006\n\025" - + "StreamingPullResponse\022A\n\021received_messag" + + "T_FOUND\020\003\022\023\n\017SCHEMA_MISMATCH\020\004\022#\n\037IN_TRA" + + "NSIT_LOCATION_RESTRICTION\020\005\"\316\005\n\022CloudSto" + + "rageConfig\022\023\n\006bucket\030\001 \001(\tB\003\340A\002\022\034\n\017filen" + + "ame_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/.google" + + ".pubsub.v1.CloudStorageConfig.TextConfig" + + "B\003\340A\001H\000\022K\n\013avro_config\030\005 \001(\0132/.google.pu" + + "bsub.v1.CloudStorageConfig.AvroConfigB\003\340" + + "A\001H\000\0224\n\014max_duration\030\006 \001(\0132\031.google.prot" + + "obuf.DurationB\003\340A\001\022\026\n\tmax_bytes\030\007 \001(\003B\003\340" + + "A\001\022>\n\005state\030\t \001(\0162*.google.pubsub.v1.Clo" + + "udStorageConfig.StateB\003\340A\003\022\"\n\025service_ac" + + "count_email\030\013 \001(\tB\003\340A\001\032\014\n\nTextConfig\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\"\212\001\n\005State" + + "\022\025\n\021STATE_UNSPECIFIED\020\000\022\n\n\006ACTIVE\020\001\022\025\n\021P" + + "ERMISSION_DENIED\020\002\022\r\n\tNOT_FOUND\020\003\022#\n\037IN_" + + "TRANSIT_LOCATION_RESTRICTION\020\004\022\023\n\017SCHEMA" + + "_MISMATCH\020\005B\017\n\routput_format\"|\n\017Received" + + "Message\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\026Ge" + + "tSubscriptionRequest\022@\n\014subscription\030\001 \001" + + "(\tB*\340A\002\372A$\n\"pubsub.googleapis.com/Subscr" + + "iption\"\214\001\n\031UpdateSubscriptionRequest\0229\n\014" + + "subscription\030\001 \001(\0132\036.google.pubsub.v1.Su" + + "bscriptionB\003\340A\002\0224\n\013update_mask\030\002 \001(\0132\032.g" + + "oogle.protobuf.FieldMaskB\003\340A\002\"\221\001\n\030ListSu" + + "bscriptionsRequest\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\npage" + + "_token\030\003 \001(\tB\003\340A\001\"u\n\031ListSubscriptionsRe" + + "sponse\022:\n\rsubscriptions\030\001 \003(\0132\036.google.p" + + "ubsub.v1.SubscriptionB\003\340A\001\022\034\n\017next_page_" + + "token\030\002 \001(\tB\003\340A\001\"]\n\031DeleteSubscriptionRe" + + "quest\022@\n\014subscription\030\001 \001(\tB*\340A\002\372A$\n\"pub" + + "sub.googleapis.com/Subscription\"\223\001\n\027Modi" + + "fyPushConfigRequest\022@\n\014subscription\030\001 \001(" + + "\tB*\340A\002\372A$\n\"pubsub.googleapis.com/Subscri" + + "ption\0226\n\013push_config\030\002 \001(\0132\034.google.pubs" + + "ub.v1.PushConfigB\003\340A\002\"\215\001\n\013PullRequest\022@\n" + + "\014subscription\030\001 \001(\tB*\340A\002\372A$\n\"pubsub.goog" + + "leapis.com/Subscription\022!\n\022return_immedi" + + "ately\030\002 \001(\010B\005\030\001\340A\001\022\031\n\014max_messages\030\003 \001(\005" + + "B\003\340A\002\"Q\n\014PullResponse\022A\n\021received_messag" + "es\030\001 \003(\0132!.google.pubsub.v1.ReceivedMess" - + "ageB\003\340A\001\022f\n\030acknowledge_confirmation\030\005 \001" - + "(\0132?.google.pubsub.v1.StreamingPullRespo" - + "nse.AcknowledgeConfirmationB\003\340A\001\022t\n modi" - + "fy_ack_deadline_confirmation\030\003 \001(\0132E.goo" - + "gle.pubsub.v1.StreamingPullResponse.Modi" - + "fyAckDeadlineConfirmationB\003\340A\001\022d\n\027subscr" - + "iption_properties\030\004 \001(\0132>.google.pubsub." - + "v1.StreamingPullResponse.SubscriptionPro" - + "pertiesB\003\340A\001\032\224\001\n\027AcknowledgeConfirmation" - + "\022\024\n\007ack_ids\030\001 \003(\tB\003\340A\001\022\034\n\017invalid_ack_id" - + "s\030\002 \003(\tB\003\340A\001\022\036\n\021unordered_ack_ids\030\003 \003(\tB" - + "\003\340A\001\022%\n\030temporary_failed_ack_ids\030\004 \003(\tB\003" - + "\340A\001\032z\n\035ModifyAckDeadlineConfirmation\022\024\n\007" - + "ack_ids\030\001 \003(\tB\003\340A\001\022\034\n\017invalid_ack_ids\030\002 " - + "\003(\tB\003\340A\001\022%\n\030temporary_failed_ack_ids\030\003 \003" - + "(\tB\003\340A\001\032k\n\026SubscriptionProperties\022*\n\035exa" - + "ctly_once_delivery_enabled\030\001 \001(\010B\003\340A\001\022%\n" - + "\030message_ordering_enabled\030\002 \001(\010B\003\340A\001\"\210\002\n" - + "\025CreateSnapshotRequest\0224\n\004name\030\001 \001(\tB&\340A" - + "\002\372A \n\036pubsub.googleapis.com/Snapshot\022@\n\014" - + "subscription\030\002 \001(\tB*\340A\002\372A$\n\"pubsub.googl" - + "eapis.com/Subscription\022H\n\006labels\030\003 \003(\01323" - + ".google.pubsub.v1.CreateSnapshotRequest." - + "LabelsEntryB\003\340A\001\032-\n\013LabelsEntry\022\013\n\003key\030\001" - + " \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001\"\200\001\n\025UpdateSnapsh" - + "otRequest\0221\n\010snapshot\030\001 \001(\0132\032.google.pub" - + "sub.v1.SnapshotB\003\340A\002\0224\n\013update_mask\030\002 \001(" - + "\0132\032.google.protobuf.FieldMaskB\003\340A\002\"\301\002\n\010S" - + "napshot\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.Ti" - + "mestampB\003\340A\001\022;\n\006labels\030\004 \003(\0132&.google.pu" - + "bsub.v1.Snapshot.LabelsEntryB\003\340A\001\032-\n\013Lab" - + "elsEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001" - + ":L\352AI\n\036pubsub.googleapis.com/Snapshot\022\'p" - + "rojects/{project}/snapshots/{snapshot}\"N" - + "\n\022GetSnapshotRequest\0228\n\010snapshot\030\001 \001(\tB&" - + "\340A\002\372A \n\036pubsub.googleapis.com/Snapshot\"\215" - + "\001\n\024ListSnapshotsRequest\022D\n\007project\030\001 \001(\t" - + "B3\340A\002\372A-\n+cloudresourcemanager.googleapi" - + "s.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\025ListSnapshotsR" - + "esponse\0222\n\tsnapshots\030\001 \003(\0132\032.google.pubs" - + "ub.v1.SnapshotB\003\340A\001\022\034\n\017next_page_token\030\002" - + " \001(\tB\003\340A\001\"Q\n\025DeleteSnapshotRequest\0228\n\010sn" - + "apshot\030\001 \001(\tB&\340A\002\372A \n\036pubsub.googleapis." - + "com/Snapshot\"\306\001\n\013SeekRequest\022@\n\014subscrip" - + "tion\030\001 \001(\tB*\340A\002\372A$\n\"pubsub.googleapis.co" - + "m/Subscription\022/\n\004time\030\002 \001(\0132\032.google.pr" - + "otobuf.TimestampB\003\340A\001H\000\022:\n\010snapshot\030\003 \001(" - + "\tB&\340A\001\372A \n\036pubsub.googleapis.com/Snapsho" - + "tH\000B\010\n\006target\"\016\n\014SeekResponse2\270\013\n\tPublis" - + "her\022q\n\013CreateTopic\022\027.google.pubsub.v1.To" - + "pic\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.Update" - + "TopicRequest\032\027.google.pubsub.v1.Topic\"C\332" - + "A\021topic,update_mask\202\323\344\223\002)2$/v1/{topic.na" - + "me=projects/*/topics/*}:\001*\022\223\001\n\007Publish\022 " - + ".google.pubsub.v1.PublishRequest\032!.googl" - + "e.pubsub.v1.PublishResponse\"C\332A\016topic,me" - + "ssages\202\323\344\223\002,\"\'/v1/{topic=projects/*/topi" - + "cs/*}:publish:\001*\022w\n\010GetTopic\022!.google.pu" - + "bsub.v1.GetTopicRequest\032\027.google.pubsub." - + "v1.Topic\"/\332A\005topic\202\323\344\223\002!\022\037/v1/{topic=pro" - + "jects/*/topics/*}\022\212\001\n\nListTopics\022#.googl" - + "e.pubsub.v1.ListTopicsRequest\032$.google.p" - + "ubsub.v1.ListTopicsResponse\"1\332A\007project\202" - + "\323\344\223\002!\022\037/v1/{project=projects/*}/topics\022\272" - + "\001\n\026ListTopicSubscriptions\022/.google.pubsu" - + "b.v1.ListTopicSubscriptionsRequest\0320.goo" - + "gle.pubsub.v1.ListTopicSubscriptionsResp" - + "onse\"=\332A\005topic\202\323\344\223\002/\022-/v1/{topic=project" - + "s/*/topics/*}/subscriptions\022\252\001\n\022ListTopi" - + "cSnapshots\022+.google.pubsub.v1.ListTopicS" - + "napshotsRequest\032,.google.pubsub.v1.ListT" - + "opicSnapshotsResponse\"9\332A\005topic\202\323\344\223\002+\022)/" - + "v1/{topic=projects/*/topics/*}/snapshots" - + "\022|\n\013DeleteTopic\022$.google.pubsub.v1.Delet" - + "eTopicRequest\032\026.google.protobuf.Empty\"/\332" - + "A\005topic\202\323\344\223\002!*\037/v1/{topic=projects/*/top" - + "ics/*}\022\255\001\n\022DetachSubscription\022+.google.p" - + "ubsub.v1.DetachSubscriptionRequest\032,.goo" - + "gle.pubsub.v1.DetachSubscriptionResponse" - + "\"<\202\323\344\223\0026\"4/v1/{subscription=projects/*/s" - + "ubscriptions/*}:detach\032p\312A\025pubsub.google" - + "apis.com\322AUhttps://www.googleapis.com/au" - + "th/cloud-platform,https://www.googleapis" - + ".com/auth/pubsub2\322\025\n\nSubscriber\022\264\001\n\022Crea" - + "teSubscription\022\036.google.pubsub.v1.Subscr" - + "iption\032\036.google.pubsub.v1.Subscription\"^" - + "\332A+name,topic,push_config,ack_deadline_s" - + "econds\202\323\344\223\002*\032%/v1/{name=projects/*/subsc" - + "riptions/*}:\001*\022\241\001\n\017GetSubscription\022(.goo" - + "gle.pubsub.v1.GetSubscriptionRequest\032\036.g" - + "oogle.pubsub.v1.Subscription\"D\332A\014subscri" - + "ption\202\323\344\223\002/\022-/v1/{subscription=projects/" - + "*/subscriptions/*}\022\273\001\n\022UpdateSubscriptio" - + "n\022+.google.pubsub.v1.UpdateSubscriptionR" - + "equest\032\036.google.pubsub.v1.Subscription\"X" - + "\332A\030subscription,update_mask\202\323\344\223\002722/v1/{" - + "subscription.name=projects/*/subscriptio" - + "ns/*}:\001*\022\246\001\n\021ListSubscriptions\022*.google." - + "pubsub.v1.ListSubscriptionsRequest\032+.goo" - + "gle.pubsub.v1.ListSubscriptionsResponse\"" - + "8\332A\007project\202\323\344\223\002(\022&/v1/{project=projects" - + "/*}/subscriptions\022\237\001\n\022DeleteSubscription" - + "\022+.google.pubsub.v1.DeleteSubscriptionRe" - + "quest\032\026.google.protobuf.Empty\"D\332A\014subscr" - + "iption\202\323\344\223\002/*-/v1/{subscription=projects" - + "/*/subscriptions/*}\022\317\001\n\021ModifyAckDeadlin" - + "e\022*.google.pubsub.v1.ModifyAckDeadlineRe" - + "quest\032\026.google.protobuf.Empty\"v\332A)subscr" - + "iption,ack_ids,ack_deadline_seconds\202\323\344\223\002" - + "D\"?/v1/{subscription=projects/*/subscrip" - + "tions/*}:modifyAckDeadline:\001*\022\250\001\n\013Acknow" - + "ledge\022$.google.pubsub.v1.AcknowledgeRequ" - + "est\032\026.google.protobuf.Empty\"[\332A\024subscrip" - + "tion,ack_ids\202\323\344\223\002>\"9/v1/{subscription=pr" - + "ojects/*/subscriptions/*}:acknowledge:\001*" - + "\022\320\001\n\004Pull\022\035.google.pubsub.v1.PullRequest" - + "\032\036.google.pubsub.v1.PullResponse\"\210\001\332A,su" - + "bscription,return_immediately,max_messag" - + "es\332A\031subscription,max_messages\202\323\344\223\0027\"2/v" - + "1/{subscription=projects/*/subscriptions" - + "/*}:pull:\001*\022f\n\rStreamingPull\022&.google.pu" - + "bsub.v1.StreamingPullRequest\032\'.google.pu" - + "bsub.v1.StreamingPullResponse\"\000(\0010\001\022\273\001\n\020" - + "ModifyPushConfig\022).google.pubsub.v1.Modi" - + "fyPushConfigRequest\032\026.google.protobuf.Em" - + "pty\"d\332A\030subscription,push_config\202\323\344\223\002C\">" - + "/v1/{subscription=projects/*/subscriptio" - + "ns/*}:modifyPushConfig:\001*\022\211\001\n\013GetSnapsho" - + "t\022$.google.pubsub.v1.GetSnapshotRequest\032" - + "\032.google.pubsub.v1.Snapshot\"8\332A\010snapshot" - + "\202\323\344\223\002\'\022%/v1/{snapshot=projects/*/snapsho" - + "ts/*}\022\226\001\n\rListSnapshots\022&.google.pubsub." - + "v1.ListSnapshotsRequest\032\'.google.pubsub." - + "v1.ListSnapshotsResponse\"4\332A\007project\202\323\344\223" - + "\002$\022\"/v1/{project=projects/*}/snapshots\022\227" - + "\001\n\016CreateSnapshot\022\'.google.pubsub.v1.Cre" - + "ateSnapshotRequest\032\032.google.pubsub.v1.Sn" - + "apshot\"@\332A\021name,subscription\202\323\344\223\002&\032!/v1/" - + "{name=projects/*/snapshots/*}:\001*\022\243\001\n\016Upd" - + "ateSnapshot\022\'.google.pubsub.v1.UpdateSna" - + "pshotRequest\032\032.google.pubsub.v1.Snapshot" - + "\"L\332A\024snapshot,update_mask\202\323\344\223\002/2*/v1/{sn" - + "apshot.name=projects/*/snapshots/*}:\001*\022\213" - + "\001\n\016DeleteSnapshot\022\'.google.pubsub.v1.Del" - + "eteSnapshotRequest\032\026.google.protobuf.Emp" - + "ty\"8\332A\010snapshot\202\323\344\223\002\'*%/v1/{snapshot=pro" - + "jects/*/snapshots/*}\022\204\001\n\004Seek\022\035.google.p" - + "ubsub.v1.SeekRequest\032\036.google.pubsub.v1." - + "SeekResponse\"=\202\323\344\223\0027\"2/v1/{subscription=" - + "projects/*/subscriptions/*}:seek:\001*\032p\312A\025" - + "pubsub.googleapis.com\322AUhttps://www.goog" - + "leapis.com/auth/cloud-platform,https://w" - + "ww.googleapis.com/auth/pubsubB\252\001\n\024com.go" - + "ogle.pubsub.v1B\013PubsubProtoP\001Z2cloud.goo" - + "gle.com/go/pubsub/apiv1/pubsubpb;pubsubp" - + "b\370\001\001\252\002\026Google.Cloud.PubSub.V1\312\002\026Google\\C" - + "loud\\PubSub\\V1\352\002\031Google::Cloud::PubSub::" - + "V1b\006proto3" + + "ageB\003\340A\001\"\225\001\n\030ModifyAckDeadlineRequest\022@\n" + + "\014subscription\030\001 \001(\tB*\340A\002\372A$\n\"pubsub.goog" + + "leapis.com/Subscription\022\024\n\007ack_ids\030\004 \003(\t" + + "B\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/Subs" + + "cription\022\024\n\007ack_ids\030\002 \003(\tB\003\340A\002\"\307\002\n\024Strea" + + "mingPullRequest\022@\n\014subscription\030\001 \001(\tB*\340" + + "A\002\372A$\n\"pubsub.googleapis.com/Subscriptio" + + "n\022\024\n\007ack_ids\030\002 \003(\tB\003\340A\001\022$\n\027modify_deadli" + + "ne_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_deadli" + + "ne_seconds\030\005 \001(\005B\003\340A\002\022\026\n\tclient_id\030\006 \001(\t" + + "B\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" + + "\"\236\006\n\025StreamingPullResponse\022A\n\021received_m" + + "essages\030\001 \003(\0132!.google.pubsub.v1.Receive" + + "dMessageB\003\340A\001\022f\n\030acknowledge_confirmatio" + + "n\030\005 \001(\0132?.google.pubsub.v1.StreamingPull" + + "Response.AcknowledgeConfirmationB\003\340A\001\022t\n" + + " modify_ack_deadline_confirmation\030\003 \001(\0132" + + "E.google.pubsub.v1.StreamingPullResponse" + + ".ModifyAckDeadlineConfirmationB\003\340A\001\022d\n\027s" + + "ubscription_properties\030\004 \001(\0132>.google.pu" + + "bsub.v1.StreamingPullResponse.Subscripti" + + "onPropertiesB\003\340A\001\032\224\001\n\027AcknowledgeConfirm" + + "ation\022\024\n\007ack_ids\030\001 \003(\tB\003\340A\001\022\034\n\017invalid_a" + + "ck_ids\030\002 \003(\tB\003\340A\001\022\036\n\021unordered_ack_ids\030\003" + + " \003(\tB\003\340A\001\022%\n\030temporary_failed_ack_ids\030\004 " + + "\003(\tB\003\340A\001\032z\n\035ModifyAckDeadlineConfirmatio" + + "n\022\024\n\007ack_ids\030\001 \003(\tB\003\340A\001\022\034\n\017invalid_ack_i" + + "ds\030\002 \003(\tB\003\340A\001\022%\n\030temporary_failed_ack_id" + + "s\030\003 \003(\tB\003\340A\001\032k\n\026SubscriptionProperties\022*" + + "\n\035exactly_once_delivery_enabled\030\001 \001(\010B\003\340" + + "A\001\022%\n\030message_ordering_enabled\030\002 \001(\010B\003\340A" + + "\001\"\210\002\n\025CreateSnapshotRequest\0224\n\004name\030\001 \001(" + + "\tB&\340A\002\372A \n\036pubsub.googleapis.com/Snapsho" + + "t\022@\n\014subscription\030\002 \001(\tB*\340A\002\372A$\n\"pubsub." + + "googleapis.com/Subscription\022H\n\006labels\030\003 " + + "\003(\01323.google.pubsub.v1.CreateSnapshotReq" + + "uest.LabelsEntryB\003\340A\001\032-\n\013LabelsEntry\022\013\n\003" + + "key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001\"\200\001\n\025UpdateS" + + "napshotRequest\0221\n\010snapshot\030\001 \001(\0132\032.googl" + + "e.pubsub.v1.SnapshotB\003\340A\002\0224\n\013update_mask" + + "\030\002 \001(\0132\032.google.protobuf.FieldMaskB\003\340A\002\"" + + "\301\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/To" + + "pic\0224\n\013expire_time\030\003 \001(\0132\032.google.protob" + + "uf.TimestampB\003\340A\001\022;\n\006labels\030\004 \003(\0132&.goog" + + "le.pubsub.v1.Snapshot.LabelsEntryB\003\340A\001\032-" + + "\n\013LabelsEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(" + + "\t:\0028\001:L\352AI\n\036pubsub.googleapis.com/Snapsh" + + "ot\022\'projects/{project}/snapshots/{snapsh" + + "ot}\"N\n\022GetSnapshotRequest\0228\n\010snapshot\030\001 " + + "\001(\tB&\340A\002\372A \n\036pubsub.googleapis.com/Snaps" + + "hot\"\215\001\n\024ListSnapshotsRequest\022D\n\007project\030" + + "\001 \001(\tB3\340A\002\372A-\n+cloudresourcemanager.goog" + + "leapis.com/Project\022\026\n\tpage_size\030\002 \001(\005B\003\340" + + "A\001\022\027\n\npage_token\030\003 \001(\tB\003\340A\001\"i\n\025ListSnaps" + + "hotsResponse\0222\n\tsnapshots\030\001 \003(\0132\032.google" + + ".pubsub.v1.SnapshotB\003\340A\001\022\034\n\017next_page_to" + + "ken\030\002 \001(\tB\003\340A\001\"Q\n\025DeleteSnapshotRequest\022" + + "8\n\010snapshot\030\001 \001(\tB&\340A\002\372A \n\036pubsub.google" + + "apis.com/Snapshot\"\306\001\n\013SeekRequest\022@\n\014sub" + + "scription\030\001 \001(\tB*\340A\002\372A$\n\"pubsub.googleap" + + "is.com/Subscription\022/\n\004time\030\002 \001(\0132\032.goog" + + "le.protobuf.TimestampB\003\340A\001H\000\022:\n\010snapshot" + + "\030\003 \001(\tB&\340A\001\372A \n\036pubsub.googleapis.com/Sn" + + "apshotH\000B\010\n\006target\"\016\n\014SeekResponse2\270\013\n\tP" + + "ublisher\022q\n\013CreateTopic\022\027.google.pubsub." + + "v1.Topic\032\027.google.pubsub.v1.Topic\"0\332A\004na" + + "me\202\323\344\223\002#\032\036/v1/{name=projects/*/topics/*}" + + ":\001*\022\221\001\n\013UpdateTopic\022$.google.pubsub.v1.U" + + "pdateTopicRequest\032\027.google.pubsub.v1.Top" + + "ic\"C\332A\021topic,update_mask\202\323\344\223\002)2$/v1/{top" + + "ic.name=projects/*/topics/*}:\001*\022\223\001\n\007Publ" + + "ish\022 .google.pubsub.v1.PublishRequest\032!." + + "google.pubsub.v1.PublishResponse\"C\332A\016top" + + "ic,messages\202\323\344\223\002,\"\'/v1/{topic=projects/*" + + "/topics/*}:publish:\001*\022w\n\010GetTopic\022!.goog" + + "le.pubsub.v1.GetTopicRequest\032\027.google.pu" + + "bsub.v1.Topic\"/\332A\005topic\202\323\344\223\002!\022\037/v1/{topi" + + "c=projects/*/topics/*}\022\212\001\n\nListTopics\022#." + + "google.pubsub.v1.ListTopicsRequest\032$.goo" + + "gle.pubsub.v1.ListTopicsResponse\"1\332A\007pro" + + "ject\202\323\344\223\002!\022\037/v1/{project=projects/*}/top" + + "ics\022\272\001\n\026ListTopicSubscriptions\022/.google." + + "pubsub.v1.ListTopicSubscriptionsRequest\032" + + "0.google.pubsub.v1.ListTopicSubscription" + + "sResponse\"=\332A\005topic\202\323\344\223\002/\022-/v1/{topic=pr" + + "ojects/*/topics/*}/subscriptions\022\252\001\n\022Lis" + + "tTopicSnapshots\022+.google.pubsub.v1.ListT" + + "opicSnapshotsRequest\032,.google.pubsub.v1." + + "ListTopicSnapshotsResponse\"9\332A\005topic\202\323\344\223" + + "\002+\022)/v1/{topic=projects/*/topics/*}/snap" + + "shots\022|\n\013DeleteTopic\022$.google.pubsub.v1." + + "DeleteTopicRequest\032\026.google.protobuf.Emp" + + "ty\"/\332A\005topic\202\323\344\223\002!*\037/v1/{topic=projects/" + + "*/topics/*}\022\255\001\n\022DetachSubscription\022+.goo" + + "gle.pubsub.v1.DetachSubscriptionRequest\032" + + ",.google.pubsub.v1.DetachSubscriptionRes" + + "ponse\"<\202\323\344\223\0026\"4/v1/{subscription=project" + + "s/*/subscriptions/*}:detach\032p\312A\025pubsub.g" + + "oogleapis.com\322AUhttps://www.googleapis.c" + + "om/auth/cloud-platform,https://www.googl" + + "eapis.com/auth/pubsub2\322\025\n\nSubscriber\022\264\001\n" + + "\022CreateSubscription\022\036.google.pubsub.v1.S" + + "ubscription\032\036.google.pubsub.v1.Subscript" + + "ion\"^\332A+name,topic,push_config,ack_deadl" + + "ine_seconds\202\323\344\223\002*\032%/v1/{name=projects/*/" + + "subscriptions/*}:\001*\022\241\001\n\017GetSubscription\022" + + "(.google.pubsub.v1.GetSubscriptionReques" + + "t\032\036.google.pubsub.v1.Subscription\"D\332A\014su" + + "bscription\202\323\344\223\002/\022-/v1/{subscription=proj" + + "ects/*/subscriptions/*}\022\273\001\n\022UpdateSubscr" + + "iption\022+.google.pubsub.v1.UpdateSubscrip" + + "tionRequest\032\036.google.pubsub.v1.Subscript" + + "ion\"X\332A\030subscription,update_mask\202\323\344\223\002722" + + "/v1/{subscription.name=projects/*/subscr" + + "iptions/*}:\001*\022\246\001\n\021ListSubscriptions\022*.go" + + "ogle.pubsub.v1.ListSubscriptionsRequest\032" + + "+.google.pubsub.v1.ListSubscriptionsResp" + + "onse\"8\332A\007project\202\323\344\223\002(\022&/v1/{project=pro" + + "jects/*}/subscriptions\022\237\001\n\022DeleteSubscri" + + "ption\022+.google.pubsub.v1.DeleteSubscript" + + "ionRequest\032\026.google.protobuf.Empty\"D\332A\014s" + + "ubscription\202\323\344\223\002/*-/v1/{subscription=pro" + + "jects/*/subscriptions/*}\022\317\001\n\021ModifyAckDe" + + "adline\022*.google.pubsub.v1.ModifyAckDeadl" + + "ineRequest\032\026.google.protobuf.Empty\"v\332A)s" + + "ubscription,ack_ids,ack_deadline_seconds" + + "\202\323\344\223\002D\"?/v1/{subscription=projects/*/sub" + + "scriptions/*}:modifyAckDeadline:\001*\022\250\001\n\013A" + + "cknowledge\022$.google.pubsub.v1.Acknowledg" + + "eRequest\032\026.google.protobuf.Empty\"[\332A\024sub" + + "scription,ack_ids\202\323\344\223\002>\"9/v1/{subscripti" + + "on=projects/*/subscriptions/*}:acknowled" + + "ge:\001*\022\320\001\n\004Pull\022\035.google.pubsub.v1.PullRe" + + "quest\032\036.google.pubsub.v1.PullResponse\"\210\001" + + "\332A,subscription,return_immediately,max_m" + + "essages\332A\031subscription,max_messages\202\323\344\223\002" + + "7\"2/v1/{subscription=projects/*/subscrip" + + "tions/*}:pull:\001*\022f\n\rStreamingPull\022&.goog" + + "le.pubsub.v1.StreamingPullRequest\032\'.goog" + + "le.pubsub.v1.StreamingPullResponse\"\000(\0010\001" + + "\022\273\001\n\020ModifyPushConfig\022).google.pubsub.v1" + + ".ModifyPushConfigRequest\032\026.google.protob" + + "uf.Empty\"d\332A\030subscription,push_config\202\323\344" + + "\223\002C\">/v1/{subscription=projects/*/subscr" + + "iptions/*}:modifyPushConfig:\001*\022\211\001\n\013GetSn" + + "apshot\022$.google.pubsub.v1.GetSnapshotReq" + + "uest\032\032.google.pubsub.v1.Snapshot\"8\332A\010sna" + + "pshot\202\323\344\223\002\'\022%/v1/{snapshot=projects/*/sn" + + "apshots/*}\022\226\001\n\rListSnapshots\022&.google.pu" + + "bsub.v1.ListSnapshotsRequest\032\'.google.pu" + + "bsub.v1.ListSnapshotsResponse\"4\332A\007projec" + + "t\202\323\344\223\002$\022\"/v1/{project=projects/*}/snapsh" + + "ots\022\227\001\n\016CreateSnapshot\022\'.google.pubsub.v" + + "1.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\016UpdateSnapshot\022\'.google.pubsub.v1.Upda" + + "teSnapshotRequest\032\032.google.pubsub.v1.Sna" + + "pshot\"L\332A\024snapshot,update_mask\202\323\344\223\002/2*/v" + + "1/{snapshot.name=projects/*/snapshots/*}" + + ":\001*\022\213\001\n\016DeleteSnapshot\022\'.google.pubsub.v" + + "1.DeleteSnapshotRequest\032\026.google.protobu" + + "f.Empty\"8\332A\010snapshot\202\323\344\223\002\'*%/v1/{snapsho" + + "t=projects/*/snapshots/*}\022\204\001\n\004Seek\022\035.goo" + + "gle.pubsub.v1.SeekRequest\032\036.google.pubsu" + + "b.v1.SeekResponse\"=\202\323\344\223\0027\"2/v1/{subscrip" + + "tion=projects/*/subscriptions/*}:seek:\001*" + + "\032p\312A\025pubsub.googleapis.com\322AUhttps://www" + + ".googleapis.com/auth/cloud-platform,http" + + "s://www.googleapis.com/auth/pubsubB\252\001\n\024c" + + "om.google.pubsub.v1B\013PubsubProtoP\001Z2clou" + + "d.google.com/go/pubsub/apiv1/pubsubpb;pu" + + "bsubpb\370\001\001\252\002\026Google.Cloud.PubSub.V1\312\002\026Goo" + + "gle\\Cloud\\PubSub\\V1\352\002\031Google::Cloud::Pub" + + "Sub::V1b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( @@ -953,6 +956,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "DropUnknownFields", "State", "UseTableSchema", + "ServiceAccountEmail", }); internal_static_google_pubsub_v1_CloudStorageConfig_descriptor = getDescriptor().getMessageTypes().get(24); @@ -969,6 +973,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "MaxDuration", "MaxBytes", "State", + "ServiceAccountEmail", "OutputFormat", }); internal_static_google_pubsub_v1_CloudStorageConfig_TextConfig_descriptor = @@ -983,7 +988,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_pubsub_v1_CloudStorageConfig_AvroConfig_descriptor, new java.lang.String[] { - "WriteMetadata", + "WriteMetadata", "UseTopicSchema", }); internal_static_google_pubsub_v1_ReceivedMessage_descriptor = getDescriptor().getMessageTypes().get(25); 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 9d0f93c99..a26effb78 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 @@ -137,7 +137,7 @@ public com.google.protobuf.ByteString getSubscriptionBytes() { * * * @deprecated google.pubsub.v1.PullRequest.return_immediately is deprecated. See - * google/pubsub/v1/pubsub.proto;l=1363 + * google/pubsub/v1/pubsub.proto;l=1387 * @return The returnImmediately. */ @java.lang.Override @@ -688,7 +688,7 @@ public Builder setSubscriptionBytes(com.google.protobuf.ByteString value) { * * * @deprecated google.pubsub.v1.PullRequest.return_immediately is deprecated. See - * google/pubsub/v1/pubsub.proto;l=1363 + * google/pubsub/v1/pubsub.proto;l=1387 * @return The returnImmediately. */ @java.lang.Override @@ -714,7 +714,7 @@ public boolean getReturnImmediately() { * * * @deprecated google.pubsub.v1.PullRequest.return_immediately is deprecated. See - * google/pubsub/v1/pubsub.proto;l=1363 + * google/pubsub/v1/pubsub.proto;l=1387 * @param value The returnImmediately to set. * @return This builder for chaining. */ @@ -744,7 +744,7 @@ public Builder setReturnImmediately(boolean value) { * * * @deprecated google.pubsub.v1.PullRequest.return_immediately is deprecated. See - * google/pubsub/v1/pubsub.proto;l=1363 + * google/pubsub/v1/pubsub.proto;l=1387 * @return This builder for chaining. */ @java.lang.Deprecated diff --git a/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PullRequestOrBuilder.java b/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/PullRequestOrBuilder.java index 08a7576aa..94c2e0c10 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 @@ -72,7 +72,7 @@ public interface PullRequestOrBuilder * * * @deprecated google.pubsub.v1.PullRequest.return_immediately is deprecated. See - * google/pubsub/v1/pubsub.proto;l=1363 + * google/pubsub/v1/pubsub.proto;l=1387 * @return The returnImmediately. */ @java.lang.Deprecated 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 2e606060d..b70bda11a 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 @@ -1141,6 +1141,14 @@ message BigQueryConfig { // 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 Cloud Storage subscription. @@ -1160,6 +1168,10 @@ message CloudStorageConfig { // 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. @@ -1180,6 +1192,10 @@ message CloudStorageConfig { // 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; } // Required. User-provided name for the Cloud Storage bucket. @@ -1227,6 +1243,14 @@ message CloudStorageConfig { // 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. diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml index aca7ad857..13fd9af3a 100644 --- a/samples/install-without-bom/pom.xml +++ b/samples/install-without-bom/pom.xml @@ -44,7 +44,7 @@ com.google.cloud google-cloud-pubsub - 1.129.4 + 1.131.0 @@ -69,29 +69,29 @@ com.google.truth truth - 1.4.2 + 1.4.3 test com.google.protobuf protobuf-java-util - 4.26.1 + 4.27.2 com.google.cloud google-cloud-core - 2.38.1 + 2.40.0 tests com.google.cloud google-cloud-bigquery - 2.40.1 + 2.41.0 com.google.cloud google-cloud-storage - 2.38.0 + 2.40.1
@@ -101,7 +101,7 @@ org.codehaus.mojo build-helper-maven-plugin - 3.5.0 + 3.6.0 add-snippets-source diff --git a/samples/native-image-sample/pom.xml b/samples/native-image-sample/pom.xml index 9be5d698b..91bfe85e4 100644 --- a/samples/native-image-sample/pom.xml +++ b/samples/native-image-sample/pom.xml @@ -30,7 +30,7 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd"> com.google.cloud libraries-bom - 26.39.0 + 26.42.0 pom import @@ -56,7 +56,7 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd"> com.google.truth truth - 1.4.2 + 1.4.3 test
@@ -79,7 +79,7 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd"> org.apache.maven.plugins maven-dependency-plugin - 3.6.1 + 3.7.1 copy-dependencies @@ -107,13 +107,13 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd"> org.junit.vintage junit-vintage-engine - 5.10.2 + 5.10.3 test org.graalvm.buildtools junit-platform-native - 0.10.1 + 0.10.2 test @@ -124,7 +124,7 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd"> org.apache.maven.plugins maven-surefire-plugin - 3.2.5 + 3.3.0 **/*IT @@ -134,7 +134,7 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd"> org.graalvm.buildtools native-maven-plugin - 0.10.1 + 0.10.2 true pubsub.NativeImagePubSubSample diff --git a/samples/pom.xml b/samples/pom.xml index 62bf27316..6d05e41e2 100644 --- a/samples/pom.xml +++ b/samples/pom.xml @@ -62,7 +62,7 @@ org.sonatype.plugins nexus-staging-maven-plugin - 1.6.13 + 1.7.0 true @@ -75,7 +75,7 @@ org.apache.maven.plugins maven-checkstyle-plugin - 3.3.1 + 3.4.0 checkstyle-suppressions.xml diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index 30eff75fc..5bf9d6093 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -43,7 +43,7 @@ com.google.cloud google-cloud-pubsub - 1.129.5 + 1.131.1-SNAPSHOT @@ -61,7 +61,7 @@ com.google.protobuf protobuf-java-util - 4.26.1 + 4.27.2 @@ -73,24 +73,24 @@ com.google.truth truth - 1.4.2 + 1.4.3 test com.google.cloud google-cloud-core - 2.38.1 + 2.40.0 tests com.google.cloud google-cloud-bigquery - 2.40.1 + 2.41.0 com.google.cloud google-cloud-storage - 2.38.0 + 2.40.1 @@ -100,7 +100,7 @@ org.codehaus.mojo build-helper-maven-plugin - 3.5.0 + 3.6.0 add-snippets-source diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml index d61fbb200..5f9cf65b9 100644 --- a/samples/snippets/pom.xml +++ b/samples/snippets/pom.xml @@ -45,7 +45,7 @@ com.google.cloud libraries-bom - 26.39.0 + 26.42.0 pom import @@ -80,7 +80,7 @@ com.google.protobuf protobuf-java-util - 4.26.1 + 4.27.2 @@ -92,13 +92,13 @@ com.google.truth truth - 1.4.2 + 1.4.3 test com.google.cloud google-cloud-core - 2.38.1 + 2.40.0 tests 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/test/java/pubsub/SubscriberIT.java b/samples/snippets/src/test/java/pubsub/SubscriberIT.java index ee4e03068..3f91a2a31 100644 --- a/samples/snippets/src/test/java/pubsub/SubscriberIT.java +++ b/samples/snippets/src/test/java/pubsub/SubscriberIT.java @@ -56,12 +56,16 @@ public class SubscriberIT { 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 ProjectSubscriptionName subscriptionEodName = ProjectSubscriptionName.of(projectId, subscriptionEodId); + private static final ProjectSubscriptionName subscriptionOptimisticName = + ProjectSubscriptionName.of(projectId, subscriptionOptimisticId); private static void requireEnvVar(String varName) { assertNotNull( @@ -163,6 +167,11 @@ public 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()) { @@ -240,4 +249,14 @@ public void testSubscriberExactlyOnceDelivery() throws Exception { 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/versions.txt b/versions.txt index a60a4ba33..cdd8b1243 100644 --- a/versions.txt +++ b/versions.txt @@ -1,6 +1,6 @@ # Format: # module:released-version:current-version -google-cloud-pubsub:1.129.5:1.129.5 -grpc-google-cloud-pubsub-v1:1.111.5:1.111.5 -proto-google-cloud-pubsub-v1:1.111.5:1.111.5 +google-cloud-pubsub:1.131.0:1.131.1-SNAPSHOT +grpc-google-cloud-pubsub-v1:1.113.0:1.113.1-SNAPSHOT +proto-google-cloud-pubsub-v1:1.113.0:1.113.1-SNAPSHOT