diff --git a/.flake8 b/.flake8 index 20fe9bda2..ed9316381 100644 --- a/.flake8 +++ b/.flake8 @@ -21,6 +21,8 @@ exclude = # Exclude generated code. **/proto/** **/gapic/** + **/services/** + **/types/** *_pb2.py # Standard linting exemptions. diff --git a/.gitignore b/.gitignore index 3fb06e09c..b87e1ed58 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ dist build eggs +.eggs parts bin var @@ -49,6 +50,7 @@ bigquery/docs/generated # Virtual environment env/ coverage.xml +sponge_log.xml # System test environment variables. system_tests/local_test_setup diff --git a/.kokoro/publish-docs.sh b/.kokoro/publish-docs.sh index 6a15192de..f462c727b 100755 --- a/.kokoro/publish-docs.sh +++ b/.kokoro/publish-docs.sh @@ -13,8 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -#!/bin/bash - set -eo pipefail # Disable buffering, so that the logs stream through. diff --git a/.kokoro/release.sh b/.kokoro/release.sh index 9f8df9b3e..321ef575c 100755 --- a/.kokoro/release.sh +++ b/.kokoro/release.sh @@ -13,8 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -#!/bin/bash - set -eo pipefail # Start the releasetool reporter diff --git a/.kokoro/samples/lint/common.cfg b/.kokoro/samples/lint/common.cfg new file mode 100644 index 000000000..7dcd14193 --- /dev/null +++ b/.kokoro/samples/lint/common.cfg @@ -0,0 +1,34 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + } +} + +# Specify which tests to run +env_vars: { + key: "RUN_TESTS_SESSION" + value: "lint" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/python-pubsub/.kokoro/test-samples.sh" +} + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/python-samples-testing-docker" +} + +# Download secrets for samples +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples" + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "python-pubsub/.kokoro/trampoline.sh" \ No newline at end of file diff --git a/.kokoro/samples/lint/continuous.cfg b/.kokoro/samples/lint/continuous.cfg new file mode 100644 index 000000000..a1c8d9759 --- /dev/null +++ b/.kokoro/samples/lint/continuous.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "True" +} \ No newline at end of file diff --git a/.kokoro/samples/lint/periodic.cfg b/.kokoro/samples/lint/periodic.cfg new file mode 100644 index 000000000..50fec9649 --- /dev/null +++ b/.kokoro/samples/lint/periodic.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "False" +} \ No newline at end of file diff --git a/.kokoro/samples/lint/presubmit.cfg b/.kokoro/samples/lint/presubmit.cfg new file mode 100644 index 000000000..a1c8d9759 --- /dev/null +++ b/.kokoro/samples/lint/presubmit.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "True" +} \ No newline at end of file diff --git a/.kokoro/samples/python3.6/common.cfg b/.kokoro/samples/python3.6/common.cfg new file mode 100644 index 000000000..354ad19ef --- /dev/null +++ b/.kokoro/samples/python3.6/common.cfg @@ -0,0 +1,34 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + } +} + +# Specify which tests to run +env_vars: { + key: "RUN_TESTS_SESSION" + value: "py-3.6" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/python-pubsub/.kokoro/test-samples.sh" +} + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/python-samples-testing-docker" +} + +# Download secrets for samples +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples" + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "python-pubsub/.kokoro/trampoline.sh" \ No newline at end of file diff --git a/.kokoro/samples/python3.6/continuous.cfg b/.kokoro/samples/python3.6/continuous.cfg new file mode 100644 index 000000000..7218af149 --- /dev/null +++ b/.kokoro/samples/python3.6/continuous.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "True" +} + diff --git a/.kokoro/samples/python3.6/periodic.cfg b/.kokoro/samples/python3.6/periodic.cfg new file mode 100644 index 000000000..50fec9649 --- /dev/null +++ b/.kokoro/samples/python3.6/periodic.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "False" +} \ No newline at end of file diff --git a/.kokoro/samples/python3.6/presubmit.cfg b/.kokoro/samples/python3.6/presubmit.cfg new file mode 100644 index 000000000..a1c8d9759 --- /dev/null +++ b/.kokoro/samples/python3.6/presubmit.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "True" +} \ No newline at end of file diff --git a/.kokoro/samples/python3.7/common.cfg b/.kokoro/samples/python3.7/common.cfg new file mode 100644 index 000000000..becd0399d --- /dev/null +++ b/.kokoro/samples/python3.7/common.cfg @@ -0,0 +1,34 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + } +} + +# Specify which tests to run +env_vars: { + key: "RUN_TESTS_SESSION" + value: "py-3.7" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/python-pubsub/.kokoro/test-samples.sh" +} + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/python-samples-testing-docker" +} + +# Download secrets for samples +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples" + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "python-pubsub/.kokoro/trampoline.sh" \ No newline at end of file diff --git a/.kokoro/samples/python3.7/continuous.cfg b/.kokoro/samples/python3.7/continuous.cfg new file mode 100644 index 000000000..a1c8d9759 --- /dev/null +++ b/.kokoro/samples/python3.7/continuous.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "True" +} \ No newline at end of file diff --git a/.kokoro/samples/python3.7/periodic.cfg b/.kokoro/samples/python3.7/periodic.cfg new file mode 100644 index 000000000..50fec9649 --- /dev/null +++ b/.kokoro/samples/python3.7/periodic.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "False" +} \ No newline at end of file diff --git a/.kokoro/samples/python3.7/presubmit.cfg b/.kokoro/samples/python3.7/presubmit.cfg new file mode 100644 index 000000000..a1c8d9759 --- /dev/null +++ b/.kokoro/samples/python3.7/presubmit.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "True" +} \ No newline at end of file diff --git a/.kokoro/samples/python3.8/common.cfg b/.kokoro/samples/python3.8/common.cfg new file mode 100644 index 000000000..685dfdc59 --- /dev/null +++ b/.kokoro/samples/python3.8/common.cfg @@ -0,0 +1,34 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + } +} + +# Specify which tests to run +env_vars: { + key: "RUN_TESTS_SESSION" + value: "py-3.8" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/python-pubsub/.kokoro/test-samples.sh" +} + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/python-samples-testing-docker" +} + +# Download secrets for samples +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples" + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "python-pubsub/.kokoro/trampoline.sh" \ No newline at end of file diff --git a/.kokoro/samples/python3.8/continuous.cfg b/.kokoro/samples/python3.8/continuous.cfg new file mode 100644 index 000000000..a1c8d9759 --- /dev/null +++ b/.kokoro/samples/python3.8/continuous.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "True" +} \ No newline at end of file diff --git a/.kokoro/samples/python3.8/periodic.cfg b/.kokoro/samples/python3.8/periodic.cfg new file mode 100644 index 000000000..50fec9649 --- /dev/null +++ b/.kokoro/samples/python3.8/periodic.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "False" +} \ No newline at end of file diff --git a/.kokoro/samples/python3.8/presubmit.cfg b/.kokoro/samples/python3.8/presubmit.cfg new file mode 100644 index 000000000..a1c8d9759 --- /dev/null +++ b/.kokoro/samples/python3.8/presubmit.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "True" +} \ No newline at end of file diff --git a/.kokoro/test-samples.sh b/.kokoro/test-samples.sh new file mode 100755 index 000000000..98851b56b --- /dev/null +++ b/.kokoro/test-samples.sh @@ -0,0 +1,104 @@ +#!/bin/bash +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# `-e` enables the script to automatically fail when a command fails +# `-o pipefail` sets the exit code to the rightmost comment to exit with a non-zero +set -eo pipefail +# Enables `**` to include files nested inside sub-folders +shopt -s globstar + +cd github/python-pubsub + +# Run periodic samples tests at latest release +if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"periodic"* ]]; then + LATEST_RELEASE=$(git describe --abbrev=0 --tags) + git checkout $LATEST_RELEASE +fi + +# Disable buffering, so that the logs stream through. +export PYTHONUNBUFFERED=1 + +# Debug: show build environment +env | grep KOKORO + +# Install nox +python3.6 -m pip install --upgrade --quiet nox + +# Use secrets acessor service account to get secrets +if [[ -f "${KOKORO_GFILE_DIR}/secrets_viewer_service_account.json" ]]; then + gcloud auth activate-service-account \ + --key-file="${KOKORO_GFILE_DIR}/secrets_viewer_service_account.json" \ + --project="cloud-devrel-kokoro-resources" +fi + +# This script will create 3 files: +# - testing/test-env.sh +# - testing/service-account.json +# - testing/client-secrets.json +./scripts/decrypt-secrets.sh + +source ./testing/test-env.sh +export GOOGLE_APPLICATION_CREDENTIALS=$(pwd)/testing/service-account.json + +# For cloud-run session, we activate the service account for gcloud sdk. +gcloud auth activate-service-account \ + --key-file "${GOOGLE_APPLICATION_CREDENTIALS}" + +export GOOGLE_CLIENT_SECRETS=$(pwd)/testing/client-secrets.json + +echo -e "\n******************** TESTING PROJECTS ********************" + +# Switch to 'fail at end' to allow all tests to complete before exiting. +set +e +# Use RTN to return a non-zero value if the test fails. +RTN=0 +ROOT=$(pwd) +# Find all requirements.txt in the samples directory (may break on whitespace). +for file in samples/**/requirements.txt; do + cd "$ROOT" + # Navigate to the project folder. + file=$(dirname "$file") + cd "$file" + + echo "------------------------------------------------------------" + echo "- testing $file" + echo "------------------------------------------------------------" + + # Use nox to execute the tests for the project. + python3.6 -m nox -s "$RUN_TESTS_SESSION" + EXIT=$? + + # If this is a periodic build, send the test log to the Build Cop Bot. + # See https://github.com/googleapis/repo-automation-bots/tree/master/packages/buildcop. + if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"periodic"* ]]; then + chmod +x $KOKORO_GFILE_DIR/linux_amd64/buildcop + $KOKORO_GFILE_DIR/linux_amd64/buildcop + fi + + if [[ $EXIT -ne 0 ]]; then + RTN=1 + echo -e "\n Testing failed: Nox returned a non-zero exit code. \n" + else + echo -e "\n Testing completed.\n" + fi + +done +cd "$ROOT" + +# Workaround for Kokoro permissions issue: delete secrets +rm testing/{test-env.sh,client-secrets.json,service-account.json} + +exit "$RTN" \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index e3d380fe9..3541a3e0d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,28 @@ [1]: https://pypi.org/project/google-cloud-pubsub/#history +## [1.6.0](https://www.github.com/googleapis/python-pubsub/compare/v1.5.0...v1.6.0) (2020-06-09) + + +### Features + +* Add flow control for message publishing ([#96](https://www.github.com/googleapis/python-pubsub/issues/96)) ([06085c4](https://www.github.com/googleapis/python-pubsub/commit/06085c4083b9dccdd50383257799904510bbf3a0)) + + +### Bug Fixes + +* Fix PubSub incompatibility with api-core 1.17.0+ ([#103](https://www.github.com/googleapis/python-pubsub/issues/103)) ([c02060f](https://www.github.com/googleapis/python-pubsub/commit/c02060fbbe6e2ca4664bee08d2de10665d41dc0b)) + + +### Documentation +- Clarify that Schedulers shouldn't be used with multiple SubscriberClients ([#100](https://github.com/googleapis/python-pubsub/pull/100)) ([cf9e87c](https://github.com/googleapis/python-pubsub/commit/cf9e87c80c0771f3fa6ef784a8d76cb760ad37ef)) +- Fix update subscription/snapshot/topic samples ([#113](https://github.com/googleapis/python-pubsub/pull/113)) ([e62c38b](https://github.com/googleapis/python-pubsub/commit/e62c38bb33de2434e32f866979de769382dea34a)) + + +### Internal / Testing Changes +- Re-generated service implementaton using synth: removed experimental notes from the RetryPolicy and filtering features in anticipation of GA, added DetachSubscription (experimental) ([#114](https://github.com/googleapis/python-pubsub/pull/114)) ([0132a46](https://github.com/googleapis/python-pubsub/commit/0132a4680e0727ce45d5e27d98ffc9f3541a0962)) +- Incorporate will_accept() checks into publish() ([#108](https://github.com/googleapis/python-pubsub/pull/108)) ([6c7677e](https://github.com/googleapis/python-pubsub/commit/6c7677ecb259672bbb9b6f7646919e602c698570)) + ## [1.5.0](https://www.github.com/googleapis/python-pubsub/compare/v1.4.3...v1.5.0) (2020-05-04) diff --git a/MANIFEST.in b/MANIFEST.in index 68855abc3..e9e29d120 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -20,3 +20,6 @@ recursive-include google *.json *.proto recursive-include tests * global-exclude *.py[co] global-exclude __pycache__ + +# Exclude scripts for samples readmegen +prune scripts/readme-gen \ No newline at end of file diff --git a/docs/conf.py b/docs/conf.py index 20c1b57fe..3e4bdfa1d 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -38,6 +38,7 @@ "sphinx.ext.napoleon", "sphinx.ext.todo", "sphinx.ext.viewcode", + "recommonmark", ] # autodoc/autosummary flags @@ -49,10 +50,6 @@ # Add any paths that contain templates here, relative to this directory. templates_path = ["_templates"] -# Allow markdown includes (so releases.md can include CHANGLEOG.md) -# http://www.sphinx-doc.org/en/master/markdown.html -source_parsers = {".md": "recommonmark.parser.CommonMarkParser"} - # The suffix(es) of source filenames. # You can specify multiple suffix as a list of string: # source_suffix = ['.rst', '.md'] diff --git a/docs/index.rst b/docs/index.rst index 5f6f8d4d2..ae3053625 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,5 +1,7 @@ .. include:: README.rst +.. include:: multiprocessing.rst + API Documentation ----------------- diff --git a/docs/multiprocessing.rst b/docs/multiprocessing.rst new file mode 100644 index 000000000..1cb29d4ca --- /dev/null +++ b/docs/multiprocessing.rst @@ -0,0 +1,7 @@ +.. note:: + + Because this client uses :mod:`grpcio` library, it is safe to + share instances across threads. In multiprocessing scenarios, the best + practice is to create client instances *after* the invocation of + :func:`os.fork` by :class:`multiprocessing.Pool` or + :class:`multiprocessing.Process`. diff --git a/google/cloud/pubsub_v1/gapic/publisher_client.py b/google/cloud/pubsub_v1/gapic/publisher_client.py index 1a981fefa..6a60d775b 100644 --- a/google/cloud/pubsub_v1/gapic/publisher_client.py +++ b/google/cloud/pubsub_v1/gapic/publisher_client.py @@ -119,6 +119,15 @@ def project_path(cls, project): "projects/{project}", project=project ) + @classmethod + def subscription_path(cls, project, subscription): + """Return a fully-qualified subscription string.""" + return google.api_core.path_template.expand( + "projects/{project}/subscriptions/{subscription}", + project=project, + subscription=subscription, + ) + @classmethod def topic_path(cls, project, topic): """Return a fully-qualified topic string.""" @@ -349,11 +358,13 @@ def update_topic( >>> >>> client = pubsub_v1.PublisherClient() >>> - >>> # TODO: Initialize `topic`: - >>> topic = {} + >>> topic_name = 'projects/my-project/topics/my-topic' + >>> topic_labels = {'source': 'external'} + >>> topic = {'name': topic_name, 'labels': topic_labels} >>> - >>> # TODO: Initialize `update_mask`: - >>> update_mask = {} + >>> paths_element = 'labels' + >>> paths = [paths_element] + >>> update_mask = {'paths': paths} >>> >>> response = client.update_topic(topic, update_mask) @@ -362,9 +373,9 @@ def update_topic( If a dict is provided, it must be of the same form as the protobuf message :class:`~google.cloud.pubsub_v1.types.Topic` - update_mask (Union[dict, ~google.cloud.pubsub_v1.types.FieldMask]): Required. Indicates which fields in the provided topic to update. Must - be specified and non-empty. Note that if ``update_mask`` contains - "message\_storage\_policy" but the ``message_storage_policy`` is not set + update_mask (Union[dict, ~google.cloud.pubsub_v1.types.FieldMask]): Required. Indicates which fields in the provided topic to update. + Must be specified and non-empty. Note that if ``update_mask`` contains + "message_storage_policy" but the ``message_storage_policy`` is not set in the ``topic`` provided above, then the updated value is determined by the policy configured at the project or organization level. @@ -443,8 +454,8 @@ def publish( >>> response = client.publish(topic, messages) Args: - topic (str): Required. The messages in the request will be published on this topic. - Format is ``projects/{project}/topics/{topic}``. + topic (str): Required. The messages in the request will be published on this + topic. Format is ``projects/{project}/topics/{topic}``. messages (list[Union[dict, ~google.cloud.pubsub_v1.types.PubsubMessage]]): Required. The messages to publish. If a dict is provided, it must be of the same form as the protobuf @@ -678,7 +689,7 @@ def list_topic_subscriptions( metadata=None, ): """ - Lists the names of the subscriptions on this topic. + Lists the names of the attached subscriptions on this topic. Example: >>> from google.cloud import pubsub_v1 @@ -811,8 +822,8 @@ def list_topic_snapshots( ... pass Args: - topic (str): Required. The name of the topic that snapshots are attached to. Format - is ``projects/{project}/topics/{topic}``. + topic (str): Required. The name of the topic that snapshots are attached to. + Format is ``projects/{project}/topics/{topic}``. page_size (int): The maximum number of resources contained in the underlying API response. If page streaming is performed per- resource, this parameter does not affect the return value. If page @@ -1151,8 +1162,8 @@ def test_iam_permissions( Args: resource (str): REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field. - permissions (list[str]): The set of permissions to check for the ``resource``. Permissions with - wildcards (such as '*' or 'storage.*') are not allowed. For more + permissions (list[str]): The set of permissions to check for the ``resource``. Permissions + with wildcards (such as '*' or 'storage.*') are not allowed. For more information see `IAM Overview `__. retry (Optional[google.api_core.retry.Retry]): A retry object used @@ -1204,3 +1215,76 @@ def test_iam_permissions( return self._inner_api_calls["test_iam_permissions"]( request, retry=retry, timeout=timeout, metadata=metadata ) + + def detach_subscription( + self, + subscription, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None, + ): + """ + Detaches a subscription from this topic. All messages retained in + the subscription are dropped. Subsequent ``Pull`` and ``StreamingPull`` + requests will return FAILED_PRECONDITION. If the subscription is a push + subscription, pushes to the endpoint will stop. + + Example: + >>> from google.cloud import pubsub_v1 + >>> + >>> client = pubsub_v1.PublisherClient() + >>> + >>> subscription = client.subscription_path('[PROJECT]', '[SUBSCRIPTION]') + >>> + >>> response = client.detach_subscription(subscription) + + Args: + subscription (str): Required. The subscription to detach. Format is + ``projects/{project}/subscriptions/{subscription}``. + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will + be retried using a default configuration. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Returns: + A :class:`~google.cloud.pubsub_v1.types.DetachSubscriptionResponse` instance. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if "detach_subscription" not in self._inner_api_calls: + self._inner_api_calls[ + "detach_subscription" + ] = google.api_core.gapic_v1.method.wrap_method( + self.transport.detach_subscription, + default_retry=self._method_configs["DetachSubscription"].retry, + default_timeout=self._method_configs["DetachSubscription"].timeout, + client_info=self._client_info, + ) + + request = pubsub_pb2.DetachSubscriptionRequest(subscription=subscription) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [("subscription", subscription)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header + ) + metadata.append(routing_metadata) + + return self._inner_api_calls["detach_subscription"]( + request, retry=retry, timeout=timeout, metadata=metadata + ) diff --git a/google/cloud/pubsub_v1/gapic/publisher_client_config.py b/google/cloud/pubsub_v1/gapic/publisher_client_config.py index ec8f8baec..8c96fd10b 100644 --- a/google/cloud/pubsub_v1/gapic/publisher_client_config.py +++ b/google/cloud/pubsub_v1/gapic/publisher_client_config.py @@ -3,6 +3,7 @@ "google.pubsub.v1.Publisher": { "retry_codes": { "idempotent": ["ABORTED", "UNAVAILABLE", "UNKNOWN"], + "non_idempotent2": [], "non_idempotent": ["UNAVAILABLE"], "idempotent2": ["DEADLINE_EXCEEDED", "UNAVAILABLE"], "none": [], @@ -99,6 +100,11 @@ "retry_codes_name": "non_idempotent", "retry_params_name": "default", }, + "DetachSubscription": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent2", + "retry_params_name": "default", + }, }, } } diff --git a/google/cloud/pubsub_v1/gapic/subscriber_client.py b/google/cloud/pubsub_v1/gapic/subscriber_client.py index e98a686bf..12c2a780d 100644 --- a/google/cloud/pubsub_v1/gapic/subscriber_client.py +++ b/google/cloud/pubsub_v1/gapic/subscriber_client.py @@ -51,8 +51,8 @@ class SubscriberClient(object): """ - The service that an application uses to manipulate subscriptions and to - consume messages from a subscription via the ``Pull`` method or by + The service that an application uses to manipulate subscriptions and + to consume messages from a subscription via the ``Pull`` method or by establishing a bi-directional stream using the ``StreamingPull`` method. """ @@ -249,14 +249,15 @@ def create_subscription( filter_=None, dead_letter_policy=None, retry_policy=None, + detached=None, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """ - Creates a subscription to a given topic. See the resource name rules. If - the subscription already exists, returns ``ALREADY_EXISTS``. If the - corresponding topic doesn't exist, returns ``NOT_FOUND``. + Creates a subscription to a given topic. See the resource name + rules. If the subscription already exists, returns ``ALREADY_EXISTS``. + If the corresponding topic doesn't exist, returns ``NOT_FOUND``. If the name is not provided in the request, the server will assign a random name for this subscription on the same project as the topic, @@ -287,15 +288,15 @@ def create_subscription( receiving messages. Format is ``projects/{project}/topics/{topic}``. The value of this field will be ``_deleted-topic_`` if the topic has been deleted. - push_config (Union[dict, ~google.cloud.pubsub_v1.types.PushConfig]): If push delivery is used with this subscription, this field is used to - configure it. An empty ``pushConfig`` signifies that the subscriber will - pull and ack messages using API methods. + push_config (Union[dict, ~google.cloud.pubsub_v1.types.PushConfig]): If push delivery is used with this subscription, this field is used + to configure it. An empty ``pushConfig`` signifies that the subscriber + will pull and ack messages using API methods. If a dict is provided, it must be of the same form as the protobuf message :class:`~google.cloud.pubsub_v1.types.PushConfig` - ack_deadline_seconds (int): The approximate amount of time (on a best-effort basis) Pub/Sub waits - for the subscriber to acknowledge receipt before resending the message. - In the interval after the message is delivered and before it is + ack_deadline_seconds (int): The approximate amount of time (on a best-effort basis) Pub/Sub + waits for the subscriber to acknowledge receipt before resending the + message. In the interval after the message is delivered and before it is acknowledged, it is considered to be outstanding. During that time period, the message will not be redelivered (on a best-effort basis). @@ -348,34 +349,33 @@ def create_subscription( filter_ (str): An expression written in the Cloud Pub/Sub filter language. If non-empty, then only ``PubsubMessage``\ s whose ``attributes`` field matches the filter are delivered on this subscription. If empty, then no - messages are filtered out. EXPERIMENTAL: This feature is part of a - closed alpha release. This API might be changed in backward-incompatible - ways and is not recommended for production use. It is not subject to any - SLA or deprecation policy. - dead_letter_policy (Union[dict, ~google.cloud.pubsub_v1.types.DeadLetterPolicy]): A policy that specifies the conditions for dead lettering messages in - this subscription. If dead\_letter\_policy is not set, dead lettering is - disabled. + messages are filtered out. + dead_letter_policy (Union[dict, ~google.cloud.pubsub_v1.types.DeadLetterPolicy]): A policy that specifies the conditions for dead lettering messages + in this subscription. If dead_letter_policy is not set, dead lettering + is disabled. The Cloud Pub/Sub service account associated with this subscriptions's parent project (i.e., - service-{project\_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must + service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have permission to Acknowledge() messages on this subscription. If a dict is provided, it must be of the same form as the protobuf message :class:`~google.cloud.pubsub_v1.types.DeadLetterPolicy` - retry_policy (Union[dict, ~google.cloud.pubsub_v1.types.RetryPolicy]): A policy that specifies how Cloud Pub/Sub retries message delivery for this + retry_policy (Union[dict, ~google.cloud.pubsub_v1.types.RetryPolicy]): A policy that specifies how Pub/Sub retries message delivery for this subscription. If not set, the default retry policy is applied. This generally implies that messages will be retried as soon as possible for healthy subscribers. RetryPolicy will be triggered on NACKs or acknowledgement deadline exceeded events for a given message. - EXPERIMENTAL: This API might be changed in backward-incompatible - ways and is not recommended for production use. It is not subject to any - SLA or deprecation policy. If a dict is provided, it must be of the same form as the protobuf message :class:`~google.cloud.pubsub_v1.types.RetryPolicy` + detached (bool): Indicates whether the subscription is detached from its topic. + Detached subscriptions don't receive messages from their topic and don't + retain any backlog. ``Pull`` and ``StreamingPull`` requests will return + FAILED_PRECONDITION. If the subscription is a push subscription, pushes + to the endpoint will not be made. retry (Optional[google.api_core.retry.Retry]): A retry object used to retry requests. If ``None`` is specified, requests will be retried using a default configuration. @@ -419,6 +419,7 @@ def create_subscription( filter=filter_, dead_letter_policy=dead_letter_policy, retry_policy=retry_policy, + detached=detached, ) if metadata is None: metadata = [] @@ -525,7 +526,11 @@ def update_subscription( >>> client = pubsub_v1.SubscriberClient() >>> >>> ack_deadline_seconds = 42 - >>> subscription = {'ack_deadline_seconds': ack_deadline_seconds} + >>> subscription_name = 'projects/my-project/subscriptions/my-subscription' + >>> subscription = { + ... 'name': subscription_name, + ... 'ack_deadline_seconds': ack_deadline_seconds, + ... } >>> paths_element = 'ack_deadline_seconds' >>> paths = [paths_element] >>> update_mask = {'paths': paths} @@ -625,8 +630,8 @@ def list_subscriptions( ... pass Args: - project (str): Required. The name of the project in which to list subscriptions. Format - is ``projects/{project-id}``. + project (str): Required. The name of the project in which to list subscriptions. + Format is ``projects/{project-id}``. page_size (int): The maximum number of resources contained in the underlying API response. If page streaming is performed per- resource, this parameter does not affect the return value. If page @@ -852,8 +857,8 @@ def modify_ack_deadline( metadata=None, ): """ - Modifies the ack deadline for a specific message. This method is useful - to indicate that more time is needed to process a message by the + Modifies the ack deadline for a specific message. This method is + useful to indicate that more time is needed to process a message by the subscriber, or to make the message available for redelivery if the processing was interrupted. Note that this does not modify the subscription-level ``ackDeadlineSeconds`` used for subsequent messages. @@ -877,11 +882,11 @@ def modify_ack_deadline( subscription (str): Required. The name of the subscription. Format is ``projects/{project}/subscriptions/{sub}``. ack_ids (list[str]): Required. List of acknowledgment IDs. - ack_deadline_seconds (int): Required. The new ack deadline with respect to the time this request was - sent to the Pub/Sub system. For example, if the value is 10, the new ack - deadline will expire 10 seconds after the ``ModifyAckDeadline`` call was - made. Specifying zero might immediately make the message available for - delivery to another subscriber client. This typically results in an + ack_deadline_seconds (int): Required. The new ack deadline with respect to the time this request + was sent to the Pub/Sub system. For example, if the value is 10, the new + ack deadline will expire 10 seconds after the ``ModifyAckDeadline`` call + was made. Specifying zero might immediately make the message available + for delivery to another subscriber client. This typically results in an increase in the rate of message redeliveries (that is, duplicates). The minimum deadline you can specify is 0 seconds. The maximum deadline you can specify is 600 seconds (10 minutes). @@ -964,11 +969,11 @@ def acknowledge( >>> client.acknowledge(subscription, ack_ids) Args: - subscription (str): Required. The subscription whose message is being acknowledged. Format - is ``projects/{project}/subscriptions/{sub}``. - ack_ids (list[str]): Required. The acknowledgment ID for the messages being acknowledged that - was returned by the Pub/Sub system in the ``Pull`` response. Must not be - empty. + subscription (str): Required. The subscription whose message is being acknowledged. + Format is ``projects/{project}/subscriptions/{sub}``. + ack_ids (list[str]): Required. The acknowledgment ID for the messages being acknowledged + that was returned by the Pub/Sub system in the ``Pull`` response. Must + not be empty. retry (Optional[google.api_core.retry.Retry]): A retry object used to retry requests. If ``None`` is specified, requests will be retried using a default configuration. @@ -1026,9 +1031,9 @@ def pull( metadata=None, ): """ - Pulls messages from the server. The server may return ``UNAVAILABLE`` if - there are too many concurrent pull requests pending for the given - subscription. + Pulls messages from the server. The server may return + ``UNAVAILABLE`` if there are too many concurrent pull requests pending + for the given subscription. Example: >>> from google.cloud import pubsub_v1 @@ -1043,17 +1048,17 @@ def pull( >>> response = client.pull(subscription, max_messages) Args: - subscription (str): Required. The subscription from which messages should be pulled. Format - is ``projects/{project}/subscriptions/{sub}``. + subscription (str): Required. The subscription from which messages should be pulled. + Format is ``projects/{project}/subscriptions/{sub}``. max_messages (int): Required. The maximum number of messages to return for this request. Must be a positive integer. The Pub/Sub system may return fewer than the number specified. - return_immediately (bool): Optional. If this field set to true, the system will respond immediately - even if it there are no messages available to return in the ``Pull`` - response. Otherwise, the system may wait (for a bounded amount of time) - until at least one message is available, rather than returning no - messages. Warning: setting this field to ``true`` is discouraged because - it adversely impacts the performance of ``Pull`` operations. We + return_immediately (bool): Optional. If this field set to true, the system will respond + immediately even if it there are no messages available to return in the + ``Pull`` response. Otherwise, the system may wait (for a bounded amount + of time) until at least one message is available, rather than returning + no messages. Warning: setting this field to ``true`` is discouraged + because it adversely impacts the performance of ``Pull`` operations. We recommend that users do not set this field. retry (Optional[google.api_core.retry.Retry]): A retry object used to retry requests. If ``None`` is specified, requests will @@ -1113,8 +1118,8 @@ def streaming_pull( metadata=None, ): """ - Establishes a stream with the server, which sends messages down to the - client. The client streams acknowledgements and ack deadline + Establishes a stream with the server, which sends messages down to + the client. The client streams acknowledgements and ack deadline modifications back to the server. The server will close the stream and return the status on any error. The server may close the stream with status ``UNAVAILABLE`` to reassign server-side resources, in which case, @@ -1170,6 +1175,11 @@ def streaming_pull( client_info=self._client_info, ) + # Wrappers in api-core should not automatically pre-fetch the first + # stream result, as this breaks the stream when re-opening it. + # https://github.com/googleapis/python-pubsub/issues/93#issuecomment-630762257 + self.transport.streaming_pull._prefetch_first_result_ = False + return self._inner_api_calls["streaming_pull"]( requests, retry=retry, timeout=timeout, metadata=metadata ) @@ -1300,8 +1310,8 @@ def list_snapshots( ... pass Args: - project (str): Required. The name of the project in which to list snapshots. Format is - ``projects/{project-id}``. + project (str): Required. The name of the project in which to list snapshots. Format + is ``projects/{project-id}``. page_size (int): The maximum number of resources contained in the underlying API response. If page streaming is performed per- resource, this parameter does not affect the return value. If page @@ -1379,17 +1389,18 @@ def create_snapshot( metadata=None, ): """ - Creates a snapshot from the requested subscription. Snapshots are used - in Seek operations, which allow you to manage message acknowledgments in - bulk. That is, you can set the acknowledgment state of messages in an - existing subscription to the state captured by a snapshot. If the - snapshot already exists, returns ``ALREADY_EXISTS``. If the requested - subscription doesn't exist, returns ``NOT_FOUND``. If the backlog in the - subscription is too old -- and the resulting snapshot would expire in - less than 1 hour -- then ``FAILED_PRECONDITION`` is returned. See also - the ``Snapshot.expire_time`` field. If the name is not provided in the - request, the server will assign a random name for this snapshot on the - same project as the subscription, conforming to the `resource name + Creates a snapshot from the requested subscription. Snapshots are + used in Seek operations, which allow you to manage message + acknowledgments in bulk. That is, you can set the acknowledgment state + of messages in an existing subscription to the state captured by a + snapshot. If the snapshot already exists, returns ``ALREADY_EXISTS``. If + the requested subscription doesn't exist, returns ``NOT_FOUND``. If the + backlog in the subscription is too old -- and the resulting snapshot + would expire in less than 1 hour -- then ``FAILED_PRECONDITION`` is + returned. See also the ``Snapshot.expire_time`` field. If the name is + not provided in the request, the server will assign a random name for + this snapshot on the same project as the subscription, conforming to the + `resource name format `__. The generated name is populated in the returned Snapshot object. Note that for REST API requests, you must specify a name in the request. @@ -1493,7 +1504,11 @@ def update_snapshot( >>> >>> seconds = 123456 >>> expire_time = {'seconds': seconds} - >>> snapshot = {'expire_time': expire_time} + >>> snapshot_name = 'projects/my-project/snapshots/my-snapshot' + >>> snapshot = { + ... 'name': snapshot_name, + ... 'expire_time': expire_time, + ... } >>> paths_element = 'expire_time' >>> paths = [paths_element] >>> update_mask = {'paths': paths} @@ -1679,8 +1694,8 @@ def seek( If a dict is provided, it must be of the same form as the protobuf message :class:`~google.cloud.pubsub_v1.types.Timestamp` - snapshot (str): The snapshot to seek to. The snapshot's topic must be the same as that - of the provided subscription. Format is + snapshot (str): The snapshot to seek to. The snapshot's topic must be the same as + that of the provided subscription. Format is ``projects/{project}/snapshots/{snap}``. retry (Optional[google.api_core.retry.Retry]): A retry object used to retry requests. If ``None`` is specified, requests will @@ -1933,8 +1948,8 @@ def test_iam_permissions( Args: resource (str): REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field. - permissions (list[str]): The set of permissions to check for the ``resource``. Permissions with - wildcards (such as '*' or 'storage.*') are not allowed. For more + permissions (list[str]): The set of permissions to check for the ``resource``. Permissions + with wildcards (such as '*' or 'storage.*') are not allowed. For more information see `IAM Overview `__. retry (Optional[google.api_core.retry.Retry]): A retry object used diff --git a/google/cloud/pubsub_v1/gapic/transports/publisher_grpc_transport.py b/google/cloud/pubsub_v1/gapic/transports/publisher_grpc_transport.py index a32aa8f7e..c874e78d3 100644 --- a/google/cloud/pubsub_v1/gapic/transports/publisher_grpc_transport.py +++ b/google/cloud/pubsub_v1/gapic/transports/publisher_grpc_transport.py @@ -184,7 +184,7 @@ def list_topics(self): def list_topic_subscriptions(self): """Return the gRPC stub for :meth:`PublisherClient.list_topic_subscriptions`. - Lists the names of the subscriptions on this topic. + Lists the names of the attached subscriptions on this topic. Returns: Callable: A callable which accepts the appropriate @@ -278,3 +278,19 @@ def test_iam_permissions(self): deserialized response object. """ return self._stubs["iam_policy_stub"].TestIamPermissions + + @property + def detach_subscription(self): + """Return the gRPC stub for :meth:`PublisherClient.detach_subscription`. + + Detaches a subscription from this topic. All messages retained in + the subscription are dropped. Subsequent ``Pull`` and ``StreamingPull`` + requests will return FAILED_PRECONDITION. If the subscription is a push + subscription, pushes to the endpoint will stop. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs["publisher_stub"].DetachSubscription diff --git a/google/cloud/pubsub_v1/gapic/transports/subscriber_grpc_transport.py b/google/cloud/pubsub_v1/gapic/transports/subscriber_grpc_transport.py index c569051b3..4a48b9317 100644 --- a/google/cloud/pubsub_v1/gapic/transports/subscriber_grpc_transport.py +++ b/google/cloud/pubsub_v1/gapic/transports/subscriber_grpc_transport.py @@ -116,9 +116,9 @@ def channel(self): def create_subscription(self): """Return the gRPC stub for :meth:`SubscriberClient.create_subscription`. - Creates a subscription to a given topic. See the resource name rules. If - the subscription already exists, returns ``ALREADY_EXISTS``. If the - corresponding topic doesn't exist, returns ``NOT_FOUND``. + Creates a subscription to a given topic. See the resource name + rules. If the subscription already exists, returns ``ALREADY_EXISTS``. + If the corresponding topic doesn't exist, returns ``NOT_FOUND``. If the name is not provided in the request, the server will assign a random name for this subscription on the same project as the topic, @@ -213,8 +213,8 @@ def get_snapshot(self): def modify_ack_deadline(self): """Return the gRPC stub for :meth:`SubscriberClient.modify_ack_deadline`. - Modifies the ack deadline for a specific message. This method is useful - to indicate that more time is needed to process a message by the + Modifies the ack deadline for a specific message. This method is + useful to indicate that more time is needed to process a message by the subscriber, or to make the message available for redelivery if the processing was interrupted. Note that this does not modify the subscription-level ``ackDeadlineSeconds`` used for subsequent messages. @@ -249,9 +249,9 @@ def acknowledge(self): def pull(self): """Return the gRPC stub for :meth:`SubscriberClient.pull`. - Pulls messages from the server. The server may return ``UNAVAILABLE`` if - there are too many concurrent pull requests pending for the given - subscription. + Pulls messages from the server. The server may return + ``UNAVAILABLE`` if there are too many concurrent pull requests pending + for the given subscription. Returns: Callable: A callable which accepts the appropriate @@ -264,8 +264,8 @@ def pull(self): def streaming_pull(self): """Return the gRPC stub for :meth:`SubscriberClient.streaming_pull`. - Establishes a stream with the server, which sends messages down to the - client. The client streams acknowledgements and ack deadline + Establishes a stream with the server, which sends messages down to + the client. The client streams acknowledgements and ack deadline modifications back to the server. The server will close the stream and return the status on any error. The server may close the stream with status ``UNAVAILABLE`` to reassign server-side resources, in which case, @@ -320,17 +320,18 @@ def list_snapshots(self): def create_snapshot(self): """Return the gRPC stub for :meth:`SubscriberClient.create_snapshot`. - Creates a snapshot from the requested subscription. Snapshots are used - in Seek operations, which allow you to manage message acknowledgments in - bulk. That is, you can set the acknowledgment state of messages in an - existing subscription to the state captured by a snapshot. If the - snapshot already exists, returns ``ALREADY_EXISTS``. If the requested - subscription doesn't exist, returns ``NOT_FOUND``. If the backlog in the - subscription is too old -- and the resulting snapshot would expire in - less than 1 hour -- then ``FAILED_PRECONDITION`` is returned. See also - the ``Snapshot.expire_time`` field. If the name is not provided in the - request, the server will assign a random name for this snapshot on the - same project as the subscription, conforming to the `resource name + Creates a snapshot from the requested subscription. Snapshots are + used in Seek operations, which allow you to manage message + acknowledgments in bulk. That is, you can set the acknowledgment state + of messages in an existing subscription to the state captured by a + snapshot. If the snapshot already exists, returns ``ALREADY_EXISTS``. If + the requested subscription doesn't exist, returns ``NOT_FOUND``. If the + backlog in the subscription is too old -- and the resulting snapshot + would expire in less than 1 hour -- then ``FAILED_PRECONDITION`` is + returned. See also the ``Snapshot.expire_time`` field. If the name is + not provided in the request, the server will assign a random name for + this snapshot on the same project as the subscription, conforming to the + `resource name format `__. The generated name is populated in the returned Snapshot object. Note that for REST API requests, you must specify a name in the request. diff --git a/google/cloud/pubsub_v1/proto/pubsub.proto b/google/cloud/pubsub_v1/proto/pubsub.proto index 832e0649c..d85f2734e 100644 --- a/google/cloud/pubsub_v1/proto/pubsub.proto +++ b/google/cloud/pubsub_v1/proto/pubsub.proto @@ -88,7 +88,7 @@ service Publisher { option (google.api.method_signature) = "project"; } - // Lists the names of the subscriptions on this topic. + // Lists the names of the attached subscriptions on this topic. rpc ListTopicSubscriptions(ListTopicSubscriptionsRequest) returns (ListTopicSubscriptionsResponse) { option (google.api.http) = { @@ -122,8 +122,20 @@ service Publisher { }; option (google.api.method_signature) = "topic"; } + + // Detaches a subscription from this topic. All messages retained in the + // subscription are dropped. Subsequent `Pull` and `StreamingPull` requests + // will return FAILED_PRECONDITION. If the subscription is a push + // subscription, pushes to the endpoint will stop. + rpc DetachSubscription(DetachSubscriptionRequest) + returns (DetachSubscriptionResponse) { + option (google.api.http) = { + post: "/v1/{subscription=projects/*/subscriptions/*}:detach" + }; + } } +// A policy constraining the storage of messages published to the topic. message MessageStoragePolicy { // A list of IDs of GCP regions where messages that are published to the topic // may be persisted in storage. Messages published by publishers running in @@ -300,7 +312,7 @@ message ListTopicSubscriptionsRequest { // Response for the `ListTopicSubscriptions` method. message ListTopicSubscriptionsResponse { - // The names of the subscriptions that match the request. + // The names of subscriptions attached to the topic specified in the request. repeated string subscriptions = 1 [(google.api.resource_reference) = { type: "pubsub.googleapis.com/Subscription" }]; @@ -350,6 +362,22 @@ message DeleteTopicRequest { ]; } +// Request for the DetachSubscription method. +message DetachSubscriptionRequest { + // Required. The subscription to detach. + // Format is `projects/{project}/subscriptions/{subscription}`. + string subscription = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "pubsub.googleapis.com/Subscription" + } + ]; +} + +// Response for the DetachSubscription method. +// Reserved for future use. +message DetachSubscriptionResponse {} + // The service that an application uses to manipulate subscriptions and to // consume messages from a subscription via the `Pull` method or by // establishing a bi-directional stream using the `StreamingPull` method. @@ -676,9 +704,6 @@ message Subscription { // then only `PubsubMessage`s whose `attributes` field matches the filter are // delivered on this subscription. If empty, then no messages are filtered // out. - // EXPERIMENTAL: This feature is part of a closed alpha release. This - // API might be changed in backward-incompatible ways and is not recommended - // for production use. It is not subject to any SLA or deprecation policy. string filter = 12; // A policy that specifies the conditions for dead lettering messages in @@ -691,17 +716,21 @@ message Subscription { // permission to Acknowledge() messages on this subscription. DeadLetterPolicy dead_letter_policy = 13; - // A policy that specifies how Cloud Pub/Sub retries message delivery for this + // A policy that specifies how Pub/Sub retries message delivery for this // subscription. // // If not set, the default retry policy is applied. This generally implies // that messages will be retried as soon as possible for healthy subscribers. // RetryPolicy will be triggered on NACKs or acknowledgement deadline // exceeded events for a given message. - // EXPERIMENTAL: This API might be changed in backward-incompatible - // ways and is not recommended for production use. It is not subject to any - // SLA or deprecation policy. RetryPolicy retry_policy = 14; + + // Indicates whether the subscription is detached from its topic. Detached + // subscriptions don't receive messages from their topic and don't retain any + // backlog. `Pull` and `StreamingPull` requests will return + // FAILED_PRECONDITION. If the subscription is a push subscription, pushes to + // the endpoint will not be made. + bool detached = 15; } // A policy that specifies how Cloud Pub/Sub retries message delivery. @@ -839,8 +868,11 @@ message ReceivedMessage { // The message. PubsubMessage message = 2; - // Delivery attempt counter is 1 + (the sum of number of NACKs and number of - // ack_deadline exceeds) for this message. + // The approximate number of times that Cloud Pub/Sub has attempted to deliver + // the associated message to a subscriber. + // + // More precisely, this is 1 + (number of NACKs) + + // (number of ack_deadline exceeds) for this message. // // A NACK is any call to ModifyAckDeadline with a 0 deadline. An ack_deadline // exceeds event is whenever a message is not acknowledged within @@ -848,13 +880,10 @@ message ReceivedMessage { // Subscription.ackDeadlineSeconds, but may get extended automatically by // the client library. // - // The first delivery of a given message will have this value as 1. The value - // is calculated at best effort and is approximate. + // Upon the first delivery of a given message, `delivery_attempt` will have a + // value of 1. The value is calculated at best effort and is approximate. // // If a DeadLetterPolicy is not set on the subscription, this will be 0. - // EXPERIMENTAL: This feature is part of a closed alpha release. This - // API might be changed in backward-incompatible ways and is not recommended - // for production use. It is not subject to any SLA or deprecation policy. int32 delivery_attempt = 3; } diff --git a/google/cloud/pubsub_v1/proto/pubsub_pb2.py b/google/cloud/pubsub_v1/proto/pubsub_pb2.py index 4729f11ee..6ba73883d 100644 --- a/google/cloud/pubsub_v1/proto/pubsub_pb2.py +++ b/google/cloud/pubsub_v1/proto/pubsub_pb2.py @@ -2,9 +2,6 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/cloud/pubsub_v1/proto/pubsub.proto -import sys - -_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1")) from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection @@ -29,12 +26,9 @@ name="google/cloud/pubsub_v1/proto/pubsub.proto", package="google.pubsub.v1", syntax="proto3", - serialized_options=_b( - "\n\024com.google.pubsub.v1B\013PubsubProtoP\001Z6google.golang.org/genproto/googleapis/pubsub/v1;pubsub\370\001\001\252\002\026Google.Cloud.PubSub.V1\312\002\026Google\\Cloud\\PubSub\\V1\352\002\031Google::Cloud::PubSub::V1" - ), - serialized_pb=_b( - '\n)google/cloud/pubsub_v1/proto/pubsub.proto\x12\x10google.pubsub.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto";\n\x14MessageStoragePolicy\x12#\n\x1b\x61llowed_persistence_regions\x18\x01 \x03(\t"\xb2\x02\n\x05Topic\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x33\n\x06labels\x18\x02 \x03(\x0b\x32#.google.pubsub.v1.Topic.LabelsEntry\x12\x46\n\x16message_storage_policy\x18\x03 \x01(\x0b\x32&.google.pubsub.v1.MessageStoragePolicy\x12\x14\n\x0ckms_key_name\x18\x05 \x01(\t\x1a-\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01:T\xea\x41Q\n\x1bpubsub.googleapis.com/Topic\x12!projects/{project}/topics/{topic}\x12\x0f_deleted-topic_"\xf1\x01\n\rPubsubMessage\x12\x0c\n\x04\x64\x61ta\x18\x01 \x01(\x0c\x12\x43\n\nattributes\x18\x02 \x03(\x0b\x32/.google.pubsub.v1.PubsubMessage.AttributesEntry\x12\x12\n\nmessage_id\x18\x03 \x01(\t\x12\x30\n\x0cpublish_time\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x14\n\x0cordering_key\x18\x05 \x01(\t\x1a\x31\n\x0f\x41ttributesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01"E\n\x0fGetTopicRequest\x12\x32\n\x05topic\x18\x01 \x01(\tB#\xe0\x41\x02\xfa\x41\x1d\n\x1bpubsub.googleapis.com/Topic"w\n\x12UpdateTopicRequest\x12+\n\x05topic\x18\x01 \x01(\x0b\x32\x17.google.pubsub.v1.TopicB\x03\xe0\x41\x02\x12\x34\n\x0bupdate_mask\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.FieldMaskB\x03\xe0\x41\x02"|\n\x0ePublishRequest\x12\x32\n\x05topic\x18\x01 \x01(\tB#\xe0\x41\x02\xfa\x41\x1d\n\x1bpubsub.googleapis.com/Topic\x12\x36\n\x08messages\x18\x02 \x03(\x0b\x32\x1f.google.pubsub.v1.PubsubMessageB\x03\xe0\x41\x02"&\n\x0fPublishResponse\x12\x13\n\x0bmessage_ids\x18\x01 \x03(\t"\x80\x01\n\x11ListTopicsRequest\x12\x44\n\x07project\x18\x01 \x01(\tB3\xe0\x41\x02\xfa\x41-\n+cloudresourcemanager.googleapis.com/Project\x12\x11\n\tpage_size\x18\x02 \x01(\x05\x12\x12\n\npage_token\x18\x03 \x01(\t"V\n\x12ListTopicsResponse\x12\'\n\x06topics\x18\x01 \x03(\x0b\x32\x17.google.pubsub.v1.Topic\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t"z\n\x1dListTopicSubscriptionsRequest\x12\x32\n\x05topic\x18\x01 \x01(\tB#\xe0\x41\x02\xfa\x41\x1d\n\x1bpubsub.googleapis.com/Topic\x12\x11\n\tpage_size\x18\x02 \x01(\x05\x12\x12\n\npage_token\x18\x03 \x01(\t"y\n\x1eListTopicSubscriptionsResponse\x12>\n\rsubscriptions\x18\x01 \x03(\tB\'\xfa\x41$\n"pubsub.googleapis.com/Subscription\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t"v\n\x19ListTopicSnapshotsRequest\x12\x32\n\x05topic\x18\x01 \x01(\tB#\xe0\x41\x02\xfa\x41\x1d\n\x1bpubsub.googleapis.com/Topic\x12\x11\n\tpage_size\x18\x02 \x01(\x05\x12\x12\n\npage_token\x18\x03 \x01(\t"H\n\x1aListTopicSnapshotsResponse\x12\x11\n\tsnapshots\x18\x01 \x03(\t\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t"H\n\x12\x44\x65leteTopicRequest\x12\x32\n\x05topic\x18\x01 \x01(\tB#\xe0\x41\x02\xfa\x41\x1d\n\x1bpubsub.googleapis.com/Topic"\xae\x05\n\x0cSubscription\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x32\n\x05topic\x18\x02 \x01(\tB#\xe0\x41\x02\xfa\x41\x1d\n\x1bpubsub.googleapis.com/Topic\x12\x31\n\x0bpush_config\x18\x04 \x01(\x0b\x32\x1c.google.pubsub.v1.PushConfig\x12\x1c\n\x14\x61\x63k_deadline_seconds\x18\x05 \x01(\x05\x12\x1d\n\x15retain_acked_messages\x18\x07 \x01(\x08\x12=\n\x1amessage_retention_duration\x18\x08 \x01(\x0b\x32\x19.google.protobuf.Duration\x12:\n\x06labels\x18\t \x03(\x0b\x32*.google.pubsub.v1.Subscription.LabelsEntry\x12\x1f\n\x17\x65nable_message_ordering\x18\n \x01(\x08\x12=\n\x11\x65xpiration_policy\x18\x0b \x01(\x0b\x32".google.pubsub.v1.ExpirationPolicy\x12\x0e\n\x06\x66ilter\x18\x0c \x01(\t\x12>\n\x12\x64\x65\x61\x64_letter_policy\x18\r \x01(\x0b\x32".google.pubsub.v1.DeadLetterPolicy\x12\x33\n\x0cretry_policy\x18\x0e \x01(\x0b\x32\x1d.google.pubsub.v1.RetryPolicy\x1a-\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01:X\xea\x41U\n"pubsub.googleapis.com/Subscription\x12/projects/{project}/subscriptions/{subscription}"u\n\x0bRetryPolicy\x12\x32\n\x0fminimum_backoff\x18\x01 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x32\n\x0fmaximum_backoff\x18\x02 \x01(\x0b\x32\x19.google.protobuf.Duration"L\n\x10\x44\x65\x61\x64LetterPolicy\x12\x19\n\x11\x64\x65\x61\x64_letter_topic\x18\x01 \x01(\t\x12\x1d\n\x15max_delivery_attempts\x18\x02 \x01(\x05":\n\x10\x45xpirationPolicy\x12&\n\x03ttl\x18\x01 \x01(\x0b\x32\x19.google.protobuf.Duration"\xad\x02\n\nPushConfig\x12\x15\n\rpush_endpoint\x18\x01 \x01(\t\x12@\n\nattributes\x18\x02 \x03(\x0b\x32,.google.pubsub.v1.PushConfig.AttributesEntry\x12<\n\noidc_token\x18\x03 \x01(\x0b\x32&.google.pubsub.v1.PushConfig.OidcTokenH\x00\x1a<\n\tOidcToken\x12\x1d\n\x15service_account_email\x18\x01 \x01(\t\x12\x10\n\x08\x61udience\x18\x02 \x01(\t\x1a\x31\n\x0f\x41ttributesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x42\x17\n\x15\x61uthentication_method"m\n\x0fReceivedMessage\x12\x0e\n\x06\x61\x63k_id\x18\x01 \x01(\t\x12\x30\n\x07message\x18\x02 \x01(\x0b\x32\x1f.google.pubsub.v1.PubsubMessage\x12\x18\n\x10\x64\x65livery_attempt\x18\x03 \x01(\x05"Z\n\x16GetSubscriptionRequest\x12@\n\x0csubscription\x18\x01 \x01(\tB*\xe0\x41\x02\xfa\x41$\n"pubsub.googleapis.com/Subscription"\x8c\x01\n\x19UpdateSubscriptionRequest\x12\x39\n\x0csubscription\x18\x01 \x01(\x0b\x32\x1e.google.pubsub.v1.SubscriptionB\x03\xe0\x41\x02\x12\x34\n\x0bupdate_mask\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.FieldMaskB\x03\xe0\x41\x02"\x87\x01\n\x18ListSubscriptionsRequest\x12\x44\n\x07project\x18\x01 \x01(\tB3\xe0\x41\x02\xfa\x41-\n+cloudresourcemanager.googleapis.com/Project\x12\x11\n\tpage_size\x18\x02 \x01(\x05\x12\x12\n\npage_token\x18\x03 \x01(\t"k\n\x19ListSubscriptionsResponse\x12\x35\n\rsubscriptions\x18\x01 \x03(\x0b\x32\x1e.google.pubsub.v1.Subscription\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t"]\n\x19\x44\x65leteSubscriptionRequest\x12@\n\x0csubscription\x18\x01 \x01(\tB*\xe0\x41\x02\xfa\x41$\n"pubsub.googleapis.com/Subscription"\x93\x01\n\x17ModifyPushConfigRequest\x12@\n\x0csubscription\x18\x01 \x01(\tB*\xe0\x41\x02\xfa\x41$\n"pubsub.googleapis.com/Subscription\x12\x36\n\x0bpush_config\x18\x02 \x01(\x0b\x32\x1c.google.pubsub.v1.PushConfigB\x03\xe0\x41\x02"\x8d\x01\n\x0bPullRequest\x12@\n\x0csubscription\x18\x01 \x01(\tB*\xe0\x41\x02\xfa\x41$\n"pubsub.googleapis.com/Subscription\x12!\n\x12return_immediately\x18\x02 \x01(\x08\x42\x05\x18\x01\xe0\x41\x01\x12\x19\n\x0cmax_messages\x18\x03 \x01(\x05\x42\x03\xe0\x41\x02"L\n\x0cPullResponse\x12<\n\x11received_messages\x18\x01 \x03(\x0b\x32!.google.pubsub.v1.ReceivedMessage"\x95\x01\n\x18ModifyAckDeadlineRequest\x12@\n\x0csubscription\x18\x01 \x01(\tB*\xe0\x41\x02\xfa\x41$\n"pubsub.googleapis.com/Subscription\x12\x14\n\x07\x61\x63k_ids\x18\x04 \x03(\tB\x03\xe0\x41\x02\x12!\n\x14\x61\x63k_deadline_seconds\x18\x03 \x01(\x05\x42\x03\xe0\x41\x02"l\n\x12\x41\x63knowledgeRequest\x12@\n\x0csubscription\x18\x01 \x01(\tB*\xe0\x41\x02\xfa\x41$\n"pubsub.googleapis.com/Subscription\x12\x14\n\x07\x61\x63k_ids\x18\x02 \x03(\tB\x03\xe0\x41\x02"\xe8\x01\n\x14StreamingPullRequest\x12@\n\x0csubscription\x18\x01 \x01(\tB*\xe0\x41\x02\xfa\x41$\n"pubsub.googleapis.com/Subscription\x12\x0f\n\x07\x61\x63k_ids\x18\x02 \x03(\t\x12\x1f\n\x17modify_deadline_seconds\x18\x03 \x03(\x05\x12\x1f\n\x17modify_deadline_ack_ids\x18\x04 \x03(\t\x12(\n\x1bstream_ack_deadline_seconds\x18\x05 \x01(\x05\x42\x03\xe0\x41\x02\x12\x11\n\tclient_id\x18\x06 \x01(\t"U\n\x15StreamingPullResponse\x12<\n\x11received_messages\x18\x01 \x03(\x0b\x32!.google.pubsub.v1.ReceivedMessage"\x83\x02\n\x15\x43reateSnapshotRequest\x12\x34\n\x04name\x18\x01 \x01(\tB&\xe0\x41\x02\xfa\x41 \n\x1epubsub.googleapis.com/Snapshot\x12@\n\x0csubscription\x18\x02 \x01(\tB*\xe0\x41\x02\xfa\x41$\n"pubsub.googleapis.com/Subscription\x12\x43\n\x06labels\x18\x03 \x03(\x0b\x32\x33.google.pubsub.v1.CreateSnapshotRequest.LabelsEntry\x1a-\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01"\x80\x01\n\x15UpdateSnapshotRequest\x12\x31\n\x08snapshot\x18\x01 \x01(\x0b\x32\x1a.google.pubsub.v1.SnapshotB\x03\xe0\x41\x02\x12\x34\n\x0bupdate_mask\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.FieldMaskB\x03\xe0\x41\x02"\xaf\x02\n\x08Snapshot\x12\x0c\n\x04name\x18\x01 \x01(\t\x12/\n\x05topic\x18\x02 \x01(\tB \xfa\x41\x1d\n\x1bpubsub.googleapis.com/Topic\x12/\n\x0b\x65xpire_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x36\n\x06labels\x18\x04 \x03(\x0b\x32&.google.pubsub.v1.Snapshot.LabelsEntry\x1a-\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01:L\xea\x41I\n\x1epubsub.googleapis.com/Snapshot\x12\'projects/{project}/snapshots/{snapshot}"N\n\x12GetSnapshotRequest\x12\x38\n\x08snapshot\x18\x01 \x01(\tB&\xe0\x41\x02\xfa\x41 \n\x1epubsub.googleapis.com/Snapshot"\x83\x01\n\x14ListSnapshotsRequest\x12\x44\n\x07project\x18\x01 \x01(\tB3\xe0\x41\x02\xfa\x41-\n+cloudresourcemanager.googleapis.com/Project\x12\x11\n\tpage_size\x18\x02 \x01(\x05\x12\x12\n\npage_token\x18\x03 \x01(\t"_\n\x15ListSnapshotsResponse\x12-\n\tsnapshots\x18\x01 \x03(\x0b\x32\x1a.google.pubsub.v1.Snapshot\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t"Q\n\x15\x44\x65leteSnapshotRequest\x12\x38\n\x08snapshot\x18\x01 \x01(\tB&\xe0\x41\x02\xfa\x41 \n\x1epubsub.googleapis.com/Snapshot"\xbe\x01\n\x0bSeekRequest\x12@\n\x0csubscription\x18\x01 \x01(\tB*\xe0\x41\x02\xfa\x41$\n"pubsub.googleapis.com/Subscription\x12*\n\x04time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.TimestampH\x00\x12\x37\n\x08snapshot\x18\x03 \x01(\tB#\xfa\x41 \n\x1epubsub.googleapis.com/SnapshotH\x00\x42\x08\n\x06target"\x0e\n\x0cSeekResponse2\xf3\t\n\tPublisher\x12q\n\x0b\x43reateTopic\x12\x17.google.pubsub.v1.Topic\x1a\x17.google.pubsub.v1.Topic"0\x82\xd3\xe4\x93\x02#\x1a\x1e/v1/{name=projects/*/topics/*}:\x01*\xda\x41\x04name\x12}\n\x0bUpdateTopic\x12$.google.pubsub.v1.UpdateTopicRequest\x1a\x17.google.pubsub.v1.Topic"/\x82\xd3\xe4\x93\x02)2$/v1/{topic.name=projects/*/topics/*}:\x01*\x12\x93\x01\n\x07Publish\x12 .google.pubsub.v1.PublishRequest\x1a!.google.pubsub.v1.PublishResponse"C\x82\xd3\xe4\x93\x02,"\'/v1/{topic=projects/*/topics/*}:publish:\x01*\xda\x41\x0etopic,messages\x12w\n\x08GetTopic\x12!.google.pubsub.v1.GetTopicRequest\x1a\x17.google.pubsub.v1.Topic"/\x82\xd3\xe4\x93\x02!\x12\x1f/v1/{topic=projects/*/topics/*}\xda\x41\x05topic\x12\x8a\x01\n\nListTopics\x12#.google.pubsub.v1.ListTopicsRequest\x1a$.google.pubsub.v1.ListTopicsResponse"1\x82\xd3\xe4\x93\x02!\x12\x1f/v1/{project=projects/*}/topics\xda\x41\x07project\x12\xba\x01\n\x16ListTopicSubscriptions\x12/.google.pubsub.v1.ListTopicSubscriptionsRequest\x1a\x30.google.pubsub.v1.ListTopicSubscriptionsResponse"=\x82\xd3\xe4\x93\x02/\x12-/v1/{topic=projects/*/topics/*}/subscriptions\xda\x41\x05topic\x12\xaa\x01\n\x12ListTopicSnapshots\x12+.google.pubsub.v1.ListTopicSnapshotsRequest\x1a,.google.pubsub.v1.ListTopicSnapshotsResponse"9\x82\xd3\xe4\x93\x02+\x12)/v1/{topic=projects/*/topics/*}/snapshots\xda\x41\x05topic\x12|\n\x0b\x44\x65leteTopic\x12$.google.pubsub.v1.DeleteTopicRequest\x1a\x16.google.protobuf.Empty"/\x82\xd3\xe4\x93\x02!*\x1f/v1/{topic=projects/*/topics/*}\xda\x41\x05topic\x1ap\xca\x41\x15pubsub.googleapis.com\xd2\x41Uhttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/pubsub2\x83\x15\n\nSubscriber\x12\xb4\x01\n\x12\x43reateSubscription\x12\x1e.google.pubsub.v1.Subscription\x1a\x1e.google.pubsub.v1.Subscription"^\x82\xd3\xe4\x93\x02*\x1a%/v1/{name=projects/*/subscriptions/*}:\x01*\xda\x41+name,topic,push_config,ack_deadline_seconds\x12\xa1\x01\n\x0fGetSubscription\x12(.google.pubsub.v1.GetSubscriptionRequest\x1a\x1e.google.pubsub.v1.Subscription"D\x82\xd3\xe4\x93\x02/\x12-/v1/{subscription=projects/*/subscriptions/*}\xda\x41\x0csubscription\x12\xa0\x01\n\x12UpdateSubscription\x12+.google.pubsub.v1.UpdateSubscriptionRequest\x1a\x1e.google.pubsub.v1.Subscription"=\x82\xd3\xe4\x93\x02\x37\x32\x32/v1/{subscription.name=projects/*/subscriptions/*}:\x01*\x12\xa6\x01\n\x11ListSubscriptions\x12*.google.pubsub.v1.ListSubscriptionsRequest\x1a+.google.pubsub.v1.ListSubscriptionsResponse"8\x82\xd3\xe4\x93\x02(\x12&/v1/{project=projects/*}/subscriptions\xda\x41\x07project\x12\x9f\x01\n\x12\x44\x65leteSubscription\x12+.google.pubsub.v1.DeleteSubscriptionRequest\x1a\x16.google.protobuf.Empty"D\x82\xd3\xe4\x93\x02/*-/v1/{subscription=projects/*/subscriptions/*}\xda\x41\x0csubscription\x12\xcf\x01\n\x11ModifyAckDeadline\x12*.google.pubsub.v1.ModifyAckDeadlineRequest\x1a\x16.google.protobuf.Empty"v\x82\xd3\xe4\x93\x02\x44"?/v1/{subscription=projects/*/subscriptions/*}:modifyAckDeadline:\x01*\xda\x41)subscription,ack_ids,ack_deadline_seconds\x12\xa8\x01\n\x0b\x41\x63knowledge\x12$.google.pubsub.v1.AcknowledgeRequest\x1a\x16.google.protobuf.Empty"[\x82\xd3\xe4\x93\x02>"9/v1/{subscription=projects/*/subscriptions/*}:acknowledge:\x01*\xda\x41\x14subscription,ack_ids\x12\xb3\x01\n\x04Pull\x12\x1d.google.pubsub.v1.PullRequest\x1a\x1e.google.pubsub.v1.PullResponse"l\x82\xd3\xe4\x93\x02\x37"2/v1/{subscription=projects/*/subscriptions/*}:pull:\x01*\xda\x41,subscription,return_immediately,max_messages\x12\x66\n\rStreamingPull\x12&.google.pubsub.v1.StreamingPullRequest\x1a\'.google.pubsub.v1.StreamingPullResponse"\x00(\x01\x30\x01\x12\xbb\x01\n\x10ModifyPushConfig\x12).google.pubsub.v1.ModifyPushConfigRequest\x1a\x16.google.protobuf.Empty"d\x82\xd3\xe4\x93\x02\x43">/v1/{subscription=projects/*/subscriptions/*}:modifyPushConfig:\x01*\xda\x41\x18subscription,push_config\x12\x89\x01\n\x0bGetSnapshot\x12$.google.pubsub.v1.GetSnapshotRequest\x1a\x1a.google.pubsub.v1.Snapshot"8\x82\xd3\xe4\x93\x02\'\x12%/v1/{snapshot=projects/*/snapshots/*}\xda\x41\x08snapshot\x12\x96\x01\n\rListSnapshots\x12&.google.pubsub.v1.ListSnapshotsRequest\x1a\'.google.pubsub.v1.ListSnapshotsResponse"4\x82\xd3\xe4\x93\x02$\x12"/v1/{project=projects/*}/snapshots\xda\x41\x07project\x12\x97\x01\n\x0e\x43reateSnapshot\x12\'.google.pubsub.v1.CreateSnapshotRequest\x1a\x1a.google.pubsub.v1.Snapshot"@\x82\xd3\xe4\x93\x02&\x1a!/v1/{name=projects/*/snapshots/*}:\x01*\xda\x41\x11name,subscription\x12\x8c\x01\n\x0eUpdateSnapshot\x12\'.google.pubsub.v1.UpdateSnapshotRequest\x1a\x1a.google.pubsub.v1.Snapshot"5\x82\xd3\xe4\x93\x02/2*/v1/{snapshot.name=projects/*/snapshots/*}:\x01*\x12\x8b\x01\n\x0e\x44\x65leteSnapshot\x12\'.google.pubsub.v1.DeleteSnapshotRequest\x1a\x16.google.protobuf.Empty"8\x82\xd3\xe4\x93\x02\'*%/v1/{snapshot=projects/*/snapshots/*}\xda\x41\x08snapshot\x12\x84\x01\n\x04Seek\x12\x1d.google.pubsub.v1.SeekRequest\x1a\x1e.google.pubsub.v1.SeekResponse"=\x82\xd3\xe4\x93\x02\x37"2/v1/{subscription=projects/*/subscriptions/*}:seek:\x01*\x1ap\xca\x41\x15pubsub.googleapis.com\xd2\x41Uhttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/pubsubB\xae\x01\n\x14\x63om.google.pubsub.v1B\x0bPubsubProtoP\x01Z6google.golang.org/genproto/googleapis/pubsub/v1;pubsub\xf8\x01\x01\xaa\x02\x16Google.Cloud.PubSub.V1\xca\x02\x16Google\\Cloud\\PubSub\\V1\xea\x02\x19Google::Cloud::PubSub::V1b\x06proto3' - ), + serialized_options=b"\n\024com.google.pubsub.v1B\013PubsubProtoP\001Z6google.golang.org/genproto/googleapis/pubsub/v1;pubsub\370\001\001\252\002\026Google.Cloud.PubSub.V1\312\002\026Google\\Cloud\\PubSub\\V1\352\002\031Google::Cloud::PubSub::V1", + create_key=_descriptor._internal_create_key, + serialized_pb=b'\n)google/cloud/pubsub_v1/proto/pubsub.proto\x12\x10google.pubsub.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto";\n\x14MessageStoragePolicy\x12#\n\x1b\x61llowed_persistence_regions\x18\x01 \x03(\t"\xb2\x02\n\x05Topic\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x33\n\x06labels\x18\x02 \x03(\x0b\x32#.google.pubsub.v1.Topic.LabelsEntry\x12\x46\n\x16message_storage_policy\x18\x03 \x01(\x0b\x32&.google.pubsub.v1.MessageStoragePolicy\x12\x14\n\x0ckms_key_name\x18\x05 \x01(\t\x1a-\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01:T\xea\x41Q\n\x1bpubsub.googleapis.com/Topic\x12!projects/{project}/topics/{topic}\x12\x0f_deleted-topic_"\xf1\x01\n\rPubsubMessage\x12\x0c\n\x04\x64\x61ta\x18\x01 \x01(\x0c\x12\x43\n\nattributes\x18\x02 \x03(\x0b\x32/.google.pubsub.v1.PubsubMessage.AttributesEntry\x12\x12\n\nmessage_id\x18\x03 \x01(\t\x12\x30\n\x0cpublish_time\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x14\n\x0cordering_key\x18\x05 \x01(\t\x1a\x31\n\x0f\x41ttributesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01"E\n\x0fGetTopicRequest\x12\x32\n\x05topic\x18\x01 \x01(\tB#\xe0\x41\x02\xfa\x41\x1d\n\x1bpubsub.googleapis.com/Topic"w\n\x12UpdateTopicRequest\x12+\n\x05topic\x18\x01 \x01(\x0b\x32\x17.google.pubsub.v1.TopicB\x03\xe0\x41\x02\x12\x34\n\x0bupdate_mask\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.FieldMaskB\x03\xe0\x41\x02"|\n\x0ePublishRequest\x12\x32\n\x05topic\x18\x01 \x01(\tB#\xe0\x41\x02\xfa\x41\x1d\n\x1bpubsub.googleapis.com/Topic\x12\x36\n\x08messages\x18\x02 \x03(\x0b\x32\x1f.google.pubsub.v1.PubsubMessageB\x03\xe0\x41\x02"&\n\x0fPublishResponse\x12\x13\n\x0bmessage_ids\x18\x01 \x03(\t"\x80\x01\n\x11ListTopicsRequest\x12\x44\n\x07project\x18\x01 \x01(\tB3\xe0\x41\x02\xfa\x41-\n+cloudresourcemanager.googleapis.com/Project\x12\x11\n\tpage_size\x18\x02 \x01(\x05\x12\x12\n\npage_token\x18\x03 \x01(\t"V\n\x12ListTopicsResponse\x12\'\n\x06topics\x18\x01 \x03(\x0b\x32\x17.google.pubsub.v1.Topic\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t"z\n\x1dListTopicSubscriptionsRequest\x12\x32\n\x05topic\x18\x01 \x01(\tB#\xe0\x41\x02\xfa\x41\x1d\n\x1bpubsub.googleapis.com/Topic\x12\x11\n\tpage_size\x18\x02 \x01(\x05\x12\x12\n\npage_token\x18\x03 \x01(\t"y\n\x1eListTopicSubscriptionsResponse\x12>\n\rsubscriptions\x18\x01 \x03(\tB\'\xfa\x41$\n"pubsub.googleapis.com/Subscription\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t"v\n\x19ListTopicSnapshotsRequest\x12\x32\n\x05topic\x18\x01 \x01(\tB#\xe0\x41\x02\xfa\x41\x1d\n\x1bpubsub.googleapis.com/Topic\x12\x11\n\tpage_size\x18\x02 \x01(\x05\x12\x12\n\npage_token\x18\x03 \x01(\t"H\n\x1aListTopicSnapshotsResponse\x12\x11\n\tsnapshots\x18\x01 \x03(\t\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t"H\n\x12\x44\x65leteTopicRequest\x12\x32\n\x05topic\x18\x01 \x01(\tB#\xe0\x41\x02\xfa\x41\x1d\n\x1bpubsub.googleapis.com/Topic"]\n\x19\x44\x65tachSubscriptionRequest\x12@\n\x0csubscription\x18\x01 \x01(\tB*\xe0\x41\x02\xfa\x41$\n"pubsub.googleapis.com/Subscription"\x1c\n\x1a\x44\x65tachSubscriptionResponse"\xc0\x05\n\x0cSubscription\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x32\n\x05topic\x18\x02 \x01(\tB#\xe0\x41\x02\xfa\x41\x1d\n\x1bpubsub.googleapis.com/Topic\x12\x31\n\x0bpush_config\x18\x04 \x01(\x0b\x32\x1c.google.pubsub.v1.PushConfig\x12\x1c\n\x14\x61\x63k_deadline_seconds\x18\x05 \x01(\x05\x12\x1d\n\x15retain_acked_messages\x18\x07 \x01(\x08\x12=\n\x1amessage_retention_duration\x18\x08 \x01(\x0b\x32\x19.google.protobuf.Duration\x12:\n\x06labels\x18\t \x03(\x0b\x32*.google.pubsub.v1.Subscription.LabelsEntry\x12\x1f\n\x17\x65nable_message_ordering\x18\n \x01(\x08\x12=\n\x11\x65xpiration_policy\x18\x0b \x01(\x0b\x32".google.pubsub.v1.ExpirationPolicy\x12\x0e\n\x06\x66ilter\x18\x0c \x01(\t\x12>\n\x12\x64\x65\x61\x64_letter_policy\x18\r \x01(\x0b\x32".google.pubsub.v1.DeadLetterPolicy\x12\x33\n\x0cretry_policy\x18\x0e \x01(\x0b\x32\x1d.google.pubsub.v1.RetryPolicy\x12\x10\n\x08\x64\x65tached\x18\x0f \x01(\x08\x1a-\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01:X\xea\x41U\n"pubsub.googleapis.com/Subscription\x12/projects/{project}/subscriptions/{subscription}"u\n\x0bRetryPolicy\x12\x32\n\x0fminimum_backoff\x18\x01 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x32\n\x0fmaximum_backoff\x18\x02 \x01(\x0b\x32\x19.google.protobuf.Duration"L\n\x10\x44\x65\x61\x64LetterPolicy\x12\x19\n\x11\x64\x65\x61\x64_letter_topic\x18\x01 \x01(\t\x12\x1d\n\x15max_delivery_attempts\x18\x02 \x01(\x05":\n\x10\x45xpirationPolicy\x12&\n\x03ttl\x18\x01 \x01(\x0b\x32\x19.google.protobuf.Duration"\xad\x02\n\nPushConfig\x12\x15\n\rpush_endpoint\x18\x01 \x01(\t\x12@\n\nattributes\x18\x02 \x03(\x0b\x32,.google.pubsub.v1.PushConfig.AttributesEntry\x12<\n\noidc_token\x18\x03 \x01(\x0b\x32&.google.pubsub.v1.PushConfig.OidcTokenH\x00\x1a<\n\tOidcToken\x12\x1d\n\x15service_account_email\x18\x01 \x01(\t\x12\x10\n\x08\x61udience\x18\x02 \x01(\t\x1a\x31\n\x0f\x41ttributesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x42\x17\n\x15\x61uthentication_method"m\n\x0fReceivedMessage\x12\x0e\n\x06\x61\x63k_id\x18\x01 \x01(\t\x12\x30\n\x07message\x18\x02 \x01(\x0b\x32\x1f.google.pubsub.v1.PubsubMessage\x12\x18\n\x10\x64\x65livery_attempt\x18\x03 \x01(\x05"Z\n\x16GetSubscriptionRequest\x12@\n\x0csubscription\x18\x01 \x01(\tB*\xe0\x41\x02\xfa\x41$\n"pubsub.googleapis.com/Subscription"\x8c\x01\n\x19UpdateSubscriptionRequest\x12\x39\n\x0csubscription\x18\x01 \x01(\x0b\x32\x1e.google.pubsub.v1.SubscriptionB\x03\xe0\x41\x02\x12\x34\n\x0bupdate_mask\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.FieldMaskB\x03\xe0\x41\x02"\x87\x01\n\x18ListSubscriptionsRequest\x12\x44\n\x07project\x18\x01 \x01(\tB3\xe0\x41\x02\xfa\x41-\n+cloudresourcemanager.googleapis.com/Project\x12\x11\n\tpage_size\x18\x02 \x01(\x05\x12\x12\n\npage_token\x18\x03 \x01(\t"k\n\x19ListSubscriptionsResponse\x12\x35\n\rsubscriptions\x18\x01 \x03(\x0b\x32\x1e.google.pubsub.v1.Subscription\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t"]\n\x19\x44\x65leteSubscriptionRequest\x12@\n\x0csubscription\x18\x01 \x01(\tB*\xe0\x41\x02\xfa\x41$\n"pubsub.googleapis.com/Subscription"\x93\x01\n\x17ModifyPushConfigRequest\x12@\n\x0csubscription\x18\x01 \x01(\tB*\xe0\x41\x02\xfa\x41$\n"pubsub.googleapis.com/Subscription\x12\x36\n\x0bpush_config\x18\x02 \x01(\x0b\x32\x1c.google.pubsub.v1.PushConfigB\x03\xe0\x41\x02"\x8d\x01\n\x0bPullRequest\x12@\n\x0csubscription\x18\x01 \x01(\tB*\xe0\x41\x02\xfa\x41$\n"pubsub.googleapis.com/Subscription\x12!\n\x12return_immediately\x18\x02 \x01(\x08\x42\x05\x18\x01\xe0\x41\x01\x12\x19\n\x0cmax_messages\x18\x03 \x01(\x05\x42\x03\xe0\x41\x02"L\n\x0cPullResponse\x12<\n\x11received_messages\x18\x01 \x03(\x0b\x32!.google.pubsub.v1.ReceivedMessage"\x95\x01\n\x18ModifyAckDeadlineRequest\x12@\n\x0csubscription\x18\x01 \x01(\tB*\xe0\x41\x02\xfa\x41$\n"pubsub.googleapis.com/Subscription\x12\x14\n\x07\x61\x63k_ids\x18\x04 \x03(\tB\x03\xe0\x41\x02\x12!\n\x14\x61\x63k_deadline_seconds\x18\x03 \x01(\x05\x42\x03\xe0\x41\x02"l\n\x12\x41\x63knowledgeRequest\x12@\n\x0csubscription\x18\x01 \x01(\tB*\xe0\x41\x02\xfa\x41$\n"pubsub.googleapis.com/Subscription\x12\x14\n\x07\x61\x63k_ids\x18\x02 \x03(\tB\x03\xe0\x41\x02"\xe8\x01\n\x14StreamingPullRequest\x12@\n\x0csubscription\x18\x01 \x01(\tB*\xe0\x41\x02\xfa\x41$\n"pubsub.googleapis.com/Subscription\x12\x0f\n\x07\x61\x63k_ids\x18\x02 \x03(\t\x12\x1f\n\x17modify_deadline_seconds\x18\x03 \x03(\x05\x12\x1f\n\x17modify_deadline_ack_ids\x18\x04 \x03(\t\x12(\n\x1bstream_ack_deadline_seconds\x18\x05 \x01(\x05\x42\x03\xe0\x41\x02\x12\x11\n\tclient_id\x18\x06 \x01(\t"U\n\x15StreamingPullResponse\x12<\n\x11received_messages\x18\x01 \x03(\x0b\x32!.google.pubsub.v1.ReceivedMessage"\x83\x02\n\x15\x43reateSnapshotRequest\x12\x34\n\x04name\x18\x01 \x01(\tB&\xe0\x41\x02\xfa\x41 \n\x1epubsub.googleapis.com/Snapshot\x12@\n\x0csubscription\x18\x02 \x01(\tB*\xe0\x41\x02\xfa\x41$\n"pubsub.googleapis.com/Subscription\x12\x43\n\x06labels\x18\x03 \x03(\x0b\x32\x33.google.pubsub.v1.CreateSnapshotRequest.LabelsEntry\x1a-\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01"\x80\x01\n\x15UpdateSnapshotRequest\x12\x31\n\x08snapshot\x18\x01 \x01(\x0b\x32\x1a.google.pubsub.v1.SnapshotB\x03\xe0\x41\x02\x12\x34\n\x0bupdate_mask\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.FieldMaskB\x03\xe0\x41\x02"\xaf\x02\n\x08Snapshot\x12\x0c\n\x04name\x18\x01 \x01(\t\x12/\n\x05topic\x18\x02 \x01(\tB \xfa\x41\x1d\n\x1bpubsub.googleapis.com/Topic\x12/\n\x0b\x65xpire_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x36\n\x06labels\x18\x04 \x03(\x0b\x32&.google.pubsub.v1.Snapshot.LabelsEntry\x1a-\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01:L\xea\x41I\n\x1epubsub.googleapis.com/Snapshot\x12\'projects/{project}/snapshots/{snapshot}"N\n\x12GetSnapshotRequest\x12\x38\n\x08snapshot\x18\x01 \x01(\tB&\xe0\x41\x02\xfa\x41 \n\x1epubsub.googleapis.com/Snapshot"\x83\x01\n\x14ListSnapshotsRequest\x12\x44\n\x07project\x18\x01 \x01(\tB3\xe0\x41\x02\xfa\x41-\n+cloudresourcemanager.googleapis.com/Project\x12\x11\n\tpage_size\x18\x02 \x01(\x05\x12\x12\n\npage_token\x18\x03 \x01(\t"_\n\x15ListSnapshotsResponse\x12-\n\tsnapshots\x18\x01 \x03(\x0b\x32\x1a.google.pubsub.v1.Snapshot\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t"Q\n\x15\x44\x65leteSnapshotRequest\x12\x38\n\x08snapshot\x18\x01 \x01(\tB&\xe0\x41\x02\xfa\x41 \n\x1epubsub.googleapis.com/Snapshot"\xbe\x01\n\x0bSeekRequest\x12@\n\x0csubscription\x18\x01 \x01(\tB*\xe0\x41\x02\xfa\x41$\n"pubsub.googleapis.com/Subscription\x12*\n\x04time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.TimestampH\x00\x12\x37\n\x08snapshot\x18\x03 \x01(\tB#\xfa\x41 \n\x1epubsub.googleapis.com/SnapshotH\x00\x42\x08\n\x06target"\x0e\n\x0cSeekResponse2\xa3\x0b\n\tPublisher\x12q\n\x0b\x43reateTopic\x12\x17.google.pubsub.v1.Topic\x1a\x17.google.pubsub.v1.Topic"0\x82\xd3\xe4\x93\x02#\x1a\x1e/v1/{name=projects/*/topics/*}:\x01*\xda\x41\x04name\x12}\n\x0bUpdateTopic\x12$.google.pubsub.v1.UpdateTopicRequest\x1a\x17.google.pubsub.v1.Topic"/\x82\xd3\xe4\x93\x02)2$/v1/{topic.name=projects/*/topics/*}:\x01*\x12\x93\x01\n\x07Publish\x12 .google.pubsub.v1.PublishRequest\x1a!.google.pubsub.v1.PublishResponse"C\x82\xd3\xe4\x93\x02,"\'/v1/{topic=projects/*/topics/*}:publish:\x01*\xda\x41\x0etopic,messages\x12w\n\x08GetTopic\x12!.google.pubsub.v1.GetTopicRequest\x1a\x17.google.pubsub.v1.Topic"/\x82\xd3\xe4\x93\x02!\x12\x1f/v1/{topic=projects/*/topics/*}\xda\x41\x05topic\x12\x8a\x01\n\nListTopics\x12#.google.pubsub.v1.ListTopicsRequest\x1a$.google.pubsub.v1.ListTopicsResponse"1\x82\xd3\xe4\x93\x02!\x12\x1f/v1/{project=projects/*}/topics\xda\x41\x07project\x12\xba\x01\n\x16ListTopicSubscriptions\x12/.google.pubsub.v1.ListTopicSubscriptionsRequest\x1a\x30.google.pubsub.v1.ListTopicSubscriptionsResponse"=\x82\xd3\xe4\x93\x02/\x12-/v1/{topic=projects/*/topics/*}/subscriptions\xda\x41\x05topic\x12\xaa\x01\n\x12ListTopicSnapshots\x12+.google.pubsub.v1.ListTopicSnapshotsRequest\x1a,.google.pubsub.v1.ListTopicSnapshotsResponse"9\x82\xd3\xe4\x93\x02+\x12)/v1/{topic=projects/*/topics/*}/snapshots\xda\x41\x05topic\x12|\n\x0b\x44\x65leteTopic\x12$.google.pubsub.v1.DeleteTopicRequest\x1a\x16.google.protobuf.Empty"/\x82\xd3\xe4\x93\x02!*\x1f/v1/{topic=projects/*/topics/*}\xda\x41\x05topic\x12\xad\x01\n\x12\x44\x65tachSubscription\x12+.google.pubsub.v1.DetachSubscriptionRequest\x1a,.google.pubsub.v1.DetachSubscriptionResponse"<\x82\xd3\xe4\x93\x02\x36"4/v1/{subscription=projects/*/subscriptions/*}:detach\x1ap\xca\x41\x15pubsub.googleapis.com\xd2\x41Uhttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/pubsub2\x83\x15\n\nSubscriber\x12\xb4\x01\n\x12\x43reateSubscription\x12\x1e.google.pubsub.v1.Subscription\x1a\x1e.google.pubsub.v1.Subscription"^\x82\xd3\xe4\x93\x02*\x1a%/v1/{name=projects/*/subscriptions/*}:\x01*\xda\x41+name,topic,push_config,ack_deadline_seconds\x12\xa1\x01\n\x0fGetSubscription\x12(.google.pubsub.v1.GetSubscriptionRequest\x1a\x1e.google.pubsub.v1.Subscription"D\x82\xd3\xe4\x93\x02/\x12-/v1/{subscription=projects/*/subscriptions/*}\xda\x41\x0csubscription\x12\xa0\x01\n\x12UpdateSubscription\x12+.google.pubsub.v1.UpdateSubscriptionRequest\x1a\x1e.google.pubsub.v1.Subscription"=\x82\xd3\xe4\x93\x02\x37\x32\x32/v1/{subscription.name=projects/*/subscriptions/*}:\x01*\x12\xa6\x01\n\x11ListSubscriptions\x12*.google.pubsub.v1.ListSubscriptionsRequest\x1a+.google.pubsub.v1.ListSubscriptionsResponse"8\x82\xd3\xe4\x93\x02(\x12&/v1/{project=projects/*}/subscriptions\xda\x41\x07project\x12\x9f\x01\n\x12\x44\x65leteSubscription\x12+.google.pubsub.v1.DeleteSubscriptionRequest\x1a\x16.google.protobuf.Empty"D\x82\xd3\xe4\x93\x02/*-/v1/{subscription=projects/*/subscriptions/*}\xda\x41\x0csubscription\x12\xcf\x01\n\x11ModifyAckDeadline\x12*.google.pubsub.v1.ModifyAckDeadlineRequest\x1a\x16.google.protobuf.Empty"v\x82\xd3\xe4\x93\x02\x44"?/v1/{subscription=projects/*/subscriptions/*}:modifyAckDeadline:\x01*\xda\x41)subscription,ack_ids,ack_deadline_seconds\x12\xa8\x01\n\x0b\x41\x63knowledge\x12$.google.pubsub.v1.AcknowledgeRequest\x1a\x16.google.protobuf.Empty"[\x82\xd3\xe4\x93\x02>"9/v1/{subscription=projects/*/subscriptions/*}:acknowledge:\x01*\xda\x41\x14subscription,ack_ids\x12\xb3\x01\n\x04Pull\x12\x1d.google.pubsub.v1.PullRequest\x1a\x1e.google.pubsub.v1.PullResponse"l\x82\xd3\xe4\x93\x02\x37"2/v1/{subscription=projects/*/subscriptions/*}:pull:\x01*\xda\x41,subscription,return_immediately,max_messages\x12\x66\n\rStreamingPull\x12&.google.pubsub.v1.StreamingPullRequest\x1a\'.google.pubsub.v1.StreamingPullResponse"\x00(\x01\x30\x01\x12\xbb\x01\n\x10ModifyPushConfig\x12).google.pubsub.v1.ModifyPushConfigRequest\x1a\x16.google.protobuf.Empty"d\x82\xd3\xe4\x93\x02\x43">/v1/{subscription=projects/*/subscriptions/*}:modifyPushConfig:\x01*\xda\x41\x18subscription,push_config\x12\x89\x01\n\x0bGetSnapshot\x12$.google.pubsub.v1.GetSnapshotRequest\x1a\x1a.google.pubsub.v1.Snapshot"8\x82\xd3\xe4\x93\x02\'\x12%/v1/{snapshot=projects/*/snapshots/*}\xda\x41\x08snapshot\x12\x96\x01\n\rListSnapshots\x12&.google.pubsub.v1.ListSnapshotsRequest\x1a\'.google.pubsub.v1.ListSnapshotsResponse"4\x82\xd3\xe4\x93\x02$\x12"/v1/{project=projects/*}/snapshots\xda\x41\x07project\x12\x97\x01\n\x0e\x43reateSnapshot\x12\'.google.pubsub.v1.CreateSnapshotRequest\x1a\x1a.google.pubsub.v1.Snapshot"@\x82\xd3\xe4\x93\x02&\x1a!/v1/{name=projects/*/snapshots/*}:\x01*\xda\x41\x11name,subscription\x12\x8c\x01\n\x0eUpdateSnapshot\x12\'.google.pubsub.v1.UpdateSnapshotRequest\x1a\x1a.google.pubsub.v1.Snapshot"5\x82\xd3\xe4\x93\x02/2*/v1/{snapshot.name=projects/*/snapshots/*}:\x01*\x12\x8b\x01\n\x0e\x44\x65leteSnapshot\x12\'.google.pubsub.v1.DeleteSnapshotRequest\x1a\x16.google.protobuf.Empty"8\x82\xd3\xe4\x93\x02\'*%/v1/{snapshot=projects/*/snapshots/*}\xda\x41\x08snapshot\x12\x84\x01\n\x04Seek\x12\x1d.google.pubsub.v1.SeekRequest\x1a\x1e.google.pubsub.v1.SeekResponse"=\x82\xd3\xe4\x93\x02\x37"2/v1/{subscription=projects/*/subscriptions/*}:seek:\x01*\x1ap\xca\x41\x15pubsub.googleapis.com\xd2\x41Uhttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/pubsubB\xae\x01\n\x14\x63om.google.pubsub.v1B\x0bPubsubProtoP\x01Z6google.golang.org/genproto/googleapis/pubsub/v1;pubsub\xf8\x01\x01\xaa\x02\x16Google.Cloud.PubSub.V1\xca\x02\x16Google\\Cloud\\PubSub\\V1\xea\x02\x19Google::Cloud::PubSub::V1b\x06proto3', dependencies=[ google_dot_api_dot_annotations__pb2.DESCRIPTOR, google_dot_api_dot_client__pb2.DESCRIPTOR, @@ -54,6 +48,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="allowed_persistence_regions", @@ -72,6 +67,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ) ], extensions=[], @@ -93,6 +89,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="key", @@ -103,7 +100,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -111,6 +108,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="value", @@ -121,7 +119,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -129,12 +127,13 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], nested_types=[], enum_types=[], - serialized_options=_b("8\001"), + serialized_options=b"8\001", is_extendable=False, syntax="proto3", extension_ranges=[], @@ -149,6 +148,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="name", @@ -159,14 +159,15 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b("\340A\002"), + serialized_options=b"\340A\002", file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="labels", @@ -185,6 +186,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="message_storage_policy", @@ -203,6 +205,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="kms_key_name", @@ -213,7 +216,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -221,14 +224,13 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], nested_types=[_TOPIC_LABELSENTRY], enum_types=[], - serialized_options=_b( - "\352AQ\n\033pubsub.googleapis.com/Topic\022!projects/{project}/topics/{topic}\022\017_deleted-topic_" - ), + serialized_options=b"\352AQ\n\033pubsub.googleapis.com/Topic\022!projects/{project}/topics/{topic}\022\017_deleted-topic_", is_extendable=False, syntax="proto3", extension_ranges=[], @@ -244,6 +246,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="key", @@ -254,7 +257,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -262,6 +265,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="value", @@ -272,7 +276,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -280,12 +284,13 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], nested_types=[], enum_types=[], - serialized_options=_b("8\001"), + serialized_options=b"8\001", is_extendable=False, syntax="proto3", extension_ranges=[], @@ -300,6 +305,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="data", @@ -310,7 +316,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b(""), + default_value=b"", message_type=None, enum_type=None, containing_type=None, @@ -318,6 +324,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="attributes", @@ -336,6 +343,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="message_id", @@ -346,7 +354,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -354,6 +362,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="publish_time", @@ -372,6 +381,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="ordering_key", @@ -382,7 +392,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -390,6 +400,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], @@ -411,6 +422,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="topic", @@ -421,16 +433,15 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b( - "\340A\002\372A\035\n\033pubsub.googleapis.com/Topic" - ), + serialized_options=b"\340A\002\372A\035\n\033pubsub.googleapis.com/Topic", file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ) ], extensions=[], @@ -452,6 +463,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="topic", @@ -468,8 +480,9 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b("\340A\002"), + serialized_options=b"\340A\002", file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="update_mask", @@ -486,8 +499,9 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b("\340A\002"), + serialized_options=b"\340A\002", file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], @@ -509,6 +523,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="topic", @@ -519,16 +534,15 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b( - "\340A\002\372A\035\n\033pubsub.googleapis.com/Topic" - ), + serialized_options=b"\340A\002\372A\035\n\033pubsub.googleapis.com/Topic", file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="messages", @@ -545,8 +559,9 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b("\340A\002"), + serialized_options=b"\340A\002", file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], @@ -568,6 +583,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="message_ids", @@ -586,6 +602,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ) ], extensions=[], @@ -607,6 +624,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="project", @@ -617,16 +635,15 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b( - "\340A\002\372A-\n+cloudresourcemanager.googleapis.com/Project" - ), + serialized_options=b"\340A\002\372A-\n+cloudresourcemanager.googleapis.com/Project", file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="page_size", @@ -645,6 +662,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="page_token", @@ -655,7 +673,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -663,6 +681,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], @@ -684,6 +703,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="topics", @@ -702,6 +722,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="next_page_token", @@ -712,7 +733,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -720,6 +741,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], @@ -741,6 +763,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="topic", @@ -751,16 +774,15 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b( - "\340A\002\372A\035\n\033pubsub.googleapis.com/Topic" - ), + serialized_options=b"\340A\002\372A\035\n\033pubsub.googleapis.com/Topic", file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="page_size", @@ -779,6 +801,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="page_token", @@ -789,7 +812,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -797,6 +820,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], @@ -818,6 +842,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="subscriptions", @@ -834,8 +859,9 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b('\372A$\n"pubsub.googleapis.com/Subscription'), + serialized_options=b'\372A$\n"pubsub.googleapis.com/Subscription', file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="next_page_token", @@ -846,7 +872,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -854,6 +880,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], @@ -875,6 +902,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="topic", @@ -885,16 +913,15 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b( - "\340A\002\372A\035\n\033pubsub.googleapis.com/Topic" - ), + serialized_options=b"\340A\002\372A\035\n\033pubsub.googleapis.com/Topic", file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="page_size", @@ -913,6 +940,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="page_token", @@ -923,7 +951,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -931,6 +959,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], @@ -952,6 +981,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="snapshots", @@ -970,6 +1000,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="next_page_token", @@ -980,7 +1011,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -988,6 +1019,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], @@ -1009,6 +1041,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="topic", @@ -1019,16 +1052,15 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b( - "\340A\002\372A\035\n\033pubsub.googleapis.com/Topic" - ), + serialized_options=b"\340A\002\372A\035\n\033pubsub.googleapis.com/Topic", file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ) ], extensions=[], @@ -1044,12 +1076,75 @@ ) +_DETACHSUBSCRIPTIONREQUEST = _descriptor.Descriptor( + name="DetachSubscriptionRequest", + full_name="google.pubsub.v1.DetachSubscriptionRequest", + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name="subscription", + full_name="google.pubsub.v1.DetachSubscriptionRequest.subscription", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=b"".decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=b'\340A\002\372A$\n"pubsub.googleapis.com/Subscription', + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + ) + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=2012, + serialized_end=2105, +) + + +_DETACHSUBSCRIPTIONRESPONSE = _descriptor.Descriptor( + name="DetachSubscriptionResponse", + full_name="google.pubsub.v1.DetachSubscriptionResponse", + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=2107, + serialized_end=2135, +) + + _SUBSCRIPTION_LABELSENTRY = _descriptor.Descriptor( name="LabelsEntry", full_name="google.pubsub.v1.Subscription.LabelsEntry", filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="key", @@ -1060,7 +1155,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -1068,6 +1163,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="value", @@ -1078,7 +1174,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -1086,12 +1182,13 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], nested_types=[], enum_types=[], - serialized_options=_b("8\001"), + serialized_options=b"8\001", is_extendable=False, syntax="proto3", extension_ranges=[], @@ -1106,6 +1203,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="name", @@ -1116,14 +1214,15 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b("\340A\002"), + serialized_options=b"\340A\002", file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="topic", @@ -1134,16 +1233,15 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b( - "\340A\002\372A\035\n\033pubsub.googleapis.com/Topic" - ), + serialized_options=b"\340A\002\372A\035\n\033pubsub.googleapis.com/Topic", file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="push_config", @@ -1162,6 +1260,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="ack_deadline_seconds", @@ -1180,6 +1279,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="retain_acked_messages", @@ -1198,6 +1298,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="message_retention_duration", @@ -1216,6 +1317,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="labels", @@ -1234,6 +1336,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="enable_message_ordering", @@ -1252,6 +1355,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="expiration_policy", @@ -1270,6 +1374,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="filter", @@ -1280,7 +1385,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -1288,6 +1393,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="dead_letter_policy", @@ -1306,6 +1412,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="retry_policy", @@ -1324,20 +1431,38 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + ), + _descriptor.FieldDescriptor( + name="detached", + full_name="google.pubsub.v1.Subscription.detached", + index=12, + number=15, + type=8, + cpp_type=7, + label=1, + has_default_value=False, + default_value=False, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], nested_types=[_SUBSCRIPTION_LABELSENTRY], enum_types=[], - serialized_options=_b( - '\352AU\n"pubsub.googleapis.com/Subscription\022/projects/{project}/subscriptions/{subscription}' - ), + serialized_options=b'\352AU\n"pubsub.googleapis.com/Subscription\022/projects/{project}/subscriptions/{subscription}', is_extendable=False, syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=2013, - serialized_end=2699, + serialized_start=2138, + serialized_end=2842, ) @@ -1347,6 +1472,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="minimum_backoff", @@ -1365,6 +1491,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="maximum_backoff", @@ -1383,6 +1510,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], @@ -1393,8 +1521,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=2701, - serialized_end=2818, + serialized_start=2844, + serialized_end=2961, ) @@ -1404,6 +1532,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="dead_letter_topic", @@ -1414,7 +1543,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -1422,6 +1551,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="max_delivery_attempts", @@ -1440,6 +1570,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], @@ -1450,8 +1581,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=2820, - serialized_end=2896, + serialized_start=2963, + serialized_end=3039, ) @@ -1461,6 +1592,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="ttl", @@ -1479,6 +1611,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ) ], extensions=[], @@ -1489,8 +1622,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=2898, - serialized_end=2956, + serialized_start=3041, + serialized_end=3099, ) @@ -1500,6 +1633,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="service_account_email", @@ -1510,7 +1644,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -1518,6 +1652,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="audience", @@ -1528,7 +1663,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -1536,6 +1671,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], @@ -1546,8 +1682,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=3124, - serialized_end=3184, + serialized_start=3267, + serialized_end=3327, ) _PUSHCONFIG_ATTRIBUTESENTRY = _descriptor.Descriptor( @@ -1556,6 +1692,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="key", @@ -1566,7 +1703,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -1574,6 +1711,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="value", @@ -1584,7 +1722,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -1592,12 +1730,13 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], nested_types=[], enum_types=[], - serialized_options=_b("8\001"), + serialized_options=b"8\001", is_extendable=False, syntax="proto3", extension_ranges=[], @@ -1612,6 +1751,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="push_endpoint", @@ -1622,7 +1762,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -1630,6 +1770,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="attributes", @@ -1648,6 +1789,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="oidc_token", @@ -1666,6 +1808,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], @@ -1681,11 +1824,12 @@ full_name="google.pubsub.v1.PushConfig.authentication_method", index=0, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[], ) ], - serialized_start=2959, - serialized_end=3260, + serialized_start=3102, + serialized_end=3403, ) @@ -1695,6 +1839,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="ack_id", @@ -1705,7 +1850,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -1713,6 +1858,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="message", @@ -1731,6 +1877,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="delivery_attempt", @@ -1749,6 +1896,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], @@ -1759,8 +1907,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=3262, - serialized_end=3371, + serialized_start=3405, + serialized_end=3514, ) @@ -1770,6 +1918,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="subscription", @@ -1780,16 +1929,15 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b( - '\340A\002\372A$\n"pubsub.googleapis.com/Subscription' - ), + serialized_options=b'\340A\002\372A$\n"pubsub.googleapis.com/Subscription', file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ) ], extensions=[], @@ -1800,8 +1948,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=3373, - serialized_end=3463, + serialized_start=3516, + serialized_end=3606, ) @@ -1811,6 +1959,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="subscription", @@ -1827,8 +1976,9 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b("\340A\002"), + serialized_options=b"\340A\002", file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="update_mask", @@ -1845,8 +1995,9 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b("\340A\002"), + serialized_options=b"\340A\002", file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], @@ -1857,8 +2008,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=3466, - serialized_end=3606, + serialized_start=3609, + serialized_end=3749, ) @@ -1868,6 +2019,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="project", @@ -1878,16 +2030,15 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b( - "\340A\002\372A-\n+cloudresourcemanager.googleapis.com/Project" - ), + serialized_options=b"\340A\002\372A-\n+cloudresourcemanager.googleapis.com/Project", file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="page_size", @@ -1906,6 +2057,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="page_token", @@ -1916,7 +2068,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -1924,6 +2076,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], @@ -1934,8 +2087,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=3609, - serialized_end=3744, + serialized_start=3752, + serialized_end=3887, ) @@ -1945,6 +2098,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="subscriptions", @@ -1963,6 +2117,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="next_page_token", @@ -1973,7 +2128,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -1981,6 +2136,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], @@ -1991,8 +2147,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=3746, - serialized_end=3853, + serialized_start=3889, + serialized_end=3996, ) @@ -2002,6 +2158,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="subscription", @@ -2012,16 +2169,15 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b( - '\340A\002\372A$\n"pubsub.googleapis.com/Subscription' - ), + serialized_options=b'\340A\002\372A$\n"pubsub.googleapis.com/Subscription', file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ) ], extensions=[], @@ -2032,8 +2188,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=3855, - serialized_end=3948, + serialized_start=3998, + serialized_end=4091, ) @@ -2043,6 +2199,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="subscription", @@ -2053,16 +2210,15 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b( - '\340A\002\372A$\n"pubsub.googleapis.com/Subscription' - ), + serialized_options=b'\340A\002\372A$\n"pubsub.googleapis.com/Subscription', file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="push_config", @@ -2079,8 +2235,9 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b("\340A\002"), + serialized_options=b"\340A\002", file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], @@ -2091,8 +2248,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=3951, - serialized_end=4098, + serialized_start=4094, + serialized_end=4241, ) @@ -2102,6 +2259,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="subscription", @@ -2112,16 +2270,15 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b( - '\340A\002\372A$\n"pubsub.googleapis.com/Subscription' - ), + serialized_options=b'\340A\002\372A$\n"pubsub.googleapis.com/Subscription', file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="return_immediately", @@ -2138,8 +2295,9 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b("\030\001\340A\001"), + serialized_options=b"\030\001\340A\001", file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="max_messages", @@ -2156,8 +2314,9 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b("\340A\002"), + serialized_options=b"\340A\002", file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], @@ -2168,8 +2327,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=4101, - serialized_end=4242, + serialized_start=4244, + serialized_end=4385, ) @@ -2179,6 +2338,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="received_messages", @@ -2197,6 +2357,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ) ], extensions=[], @@ -2207,8 +2368,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=4244, - serialized_end=4320, + serialized_start=4387, + serialized_end=4463, ) @@ -2218,6 +2379,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="subscription", @@ -2228,16 +2390,15 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b( - '\340A\002\372A$\n"pubsub.googleapis.com/Subscription' - ), + serialized_options=b'\340A\002\372A$\n"pubsub.googleapis.com/Subscription', file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="ack_ids", @@ -2254,8 +2415,9 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b("\340A\002"), + serialized_options=b"\340A\002", file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="ack_deadline_seconds", @@ -2272,8 +2434,9 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b("\340A\002"), + serialized_options=b"\340A\002", file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], @@ -2284,8 +2447,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=4323, - serialized_end=4472, + serialized_start=4466, + serialized_end=4615, ) @@ -2295,6 +2458,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="subscription", @@ -2305,16 +2469,15 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b( - '\340A\002\372A$\n"pubsub.googleapis.com/Subscription' - ), + serialized_options=b'\340A\002\372A$\n"pubsub.googleapis.com/Subscription', file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="ack_ids", @@ -2331,8 +2494,9 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b("\340A\002"), + serialized_options=b"\340A\002", file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], @@ -2343,8 +2507,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=4474, - serialized_end=4582, + serialized_start=4617, + serialized_end=4725, ) @@ -2354,6 +2518,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="subscription", @@ -2364,16 +2529,15 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b( - '\340A\002\372A$\n"pubsub.googleapis.com/Subscription' - ), + serialized_options=b'\340A\002\372A$\n"pubsub.googleapis.com/Subscription', file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="ack_ids", @@ -2392,6 +2556,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="modify_deadline_seconds", @@ -2410,6 +2575,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="modify_deadline_ack_ids", @@ -2428,6 +2594,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="stream_ack_deadline_seconds", @@ -2444,8 +2611,9 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b("\340A\002"), + serialized_options=b"\340A\002", file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="client_id", @@ -2456,7 +2624,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -2464,6 +2632,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], @@ -2474,8 +2643,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=4585, - serialized_end=4817, + serialized_start=4728, + serialized_end=4960, ) @@ -2485,6 +2654,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="received_messages", @@ -2503,6 +2673,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ) ], extensions=[], @@ -2513,8 +2684,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=4819, - serialized_end=4904, + serialized_start=4962, + serialized_end=5047, ) @@ -2524,6 +2695,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="key", @@ -2534,7 +2706,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -2542,6 +2714,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="value", @@ -2552,7 +2725,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -2560,12 +2733,13 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], nested_types=[], enum_types=[], - serialized_options=_b("8\001"), + serialized_options=b"8\001", is_extendable=False, syntax="proto3", extension_ranges=[], @@ -2580,6 +2754,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="name", @@ -2590,16 +2765,15 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b( - "\340A\002\372A \n\036pubsub.googleapis.com/Snapshot" - ), + serialized_options=b"\340A\002\372A \n\036pubsub.googleapis.com/Snapshot", file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="subscription", @@ -2610,16 +2784,15 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b( - '\340A\002\372A$\n"pubsub.googleapis.com/Subscription' - ), + serialized_options=b'\340A\002\372A$\n"pubsub.googleapis.com/Subscription', file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="labels", @@ -2638,6 +2811,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], @@ -2648,8 +2822,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=4907, - serialized_end=5166, + serialized_start=5050, + serialized_end=5309, ) @@ -2659,6 +2833,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="snapshot", @@ -2675,8 +2850,9 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b("\340A\002"), + serialized_options=b"\340A\002", file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="update_mask", @@ -2693,8 +2869,9 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b("\340A\002"), + serialized_options=b"\340A\002", file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], @@ -2705,8 +2882,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=5169, - serialized_end=5297, + serialized_start=5312, + serialized_end=5440, ) @@ -2716,6 +2893,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="key", @@ -2726,7 +2904,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -2734,6 +2912,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="value", @@ -2744,7 +2923,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -2752,12 +2931,13 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], nested_types=[], enum_types=[], - serialized_options=_b("8\001"), + serialized_options=b"8\001", is_extendable=False, syntax="proto3", extension_ranges=[], @@ -2772,6 +2952,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="name", @@ -2782,7 +2963,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -2790,6 +2971,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="topic", @@ -2800,14 +2982,15 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b("\372A\035\n\033pubsub.googleapis.com/Topic"), + serialized_options=b"\372A\035\n\033pubsub.googleapis.com/Topic", file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="expire_time", @@ -2826,6 +3009,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="labels", @@ -2844,20 +3028,19 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], nested_types=[_SNAPSHOT_LABELSENTRY], enum_types=[], - serialized_options=_b( - "\352AI\n\036pubsub.googleapis.com/Snapshot\022'projects/{project}/snapshots/{snapshot}" - ), + serialized_options=b"\352AI\n\036pubsub.googleapis.com/Snapshot\022'projects/{project}/snapshots/{snapshot}", is_extendable=False, syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=5300, - serialized_end=5603, + serialized_start=5443, + serialized_end=5746, ) @@ -2867,6 +3050,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="snapshot", @@ -2877,16 +3061,15 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b( - "\340A\002\372A \n\036pubsub.googleapis.com/Snapshot" - ), + serialized_options=b"\340A\002\372A \n\036pubsub.googleapis.com/Snapshot", file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ) ], extensions=[], @@ -2897,8 +3080,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=5605, - serialized_end=5683, + serialized_start=5748, + serialized_end=5826, ) @@ -2908,6 +3091,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="project", @@ -2918,16 +3102,15 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b( - "\340A\002\372A-\n+cloudresourcemanager.googleapis.com/Project" - ), + serialized_options=b"\340A\002\372A-\n+cloudresourcemanager.googleapis.com/Project", file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="page_size", @@ -2946,6 +3129,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="page_token", @@ -2956,7 +3140,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -2964,6 +3148,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], @@ -2974,8 +3159,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=5686, - serialized_end=5817, + serialized_start=5829, + serialized_end=5960, ) @@ -2985,6 +3170,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="snapshots", @@ -3003,6 +3189,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="next_page_token", @@ -3013,7 +3200,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -3021,6 +3208,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], @@ -3031,8 +3219,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=5819, - serialized_end=5914, + serialized_start=5962, + serialized_end=6057, ) @@ -3042,6 +3230,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="snapshot", @@ -3052,16 +3241,15 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b( - "\340A\002\372A \n\036pubsub.googleapis.com/Snapshot" - ), + serialized_options=b"\340A\002\372A \n\036pubsub.googleapis.com/Snapshot", file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ) ], extensions=[], @@ -3072,8 +3260,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=5916, - serialized_end=5997, + serialized_start=6059, + serialized_end=6140, ) @@ -3083,6 +3271,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="subscription", @@ -3093,16 +3282,15 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b( - '\340A\002\372A$\n"pubsub.googleapis.com/Subscription' - ), + serialized_options=b'\340A\002\372A$\n"pubsub.googleapis.com/Subscription', file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="time", @@ -3121,6 +3309,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="snapshot", @@ -3131,14 +3320,15 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b("\372A \n\036pubsub.googleapis.com/Snapshot"), + serialized_options=b"\372A \n\036pubsub.googleapis.com/Snapshot", file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], @@ -3154,11 +3344,12 @@ full_name="google.pubsub.v1.SeekRequest.target", index=0, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[], ) ], - serialized_start=6000, - serialized_end=6190, + serialized_start=6143, + serialized_end=6333, ) @@ -3168,6 +3359,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[], extensions=[], nested_types=[], @@ -3177,8 +3369,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=6192, - serialized_end=6206, + serialized_start=6335, + serialized_end=6349, ) _TOPIC_LABELSENTRY.containing_type = _TOPIC @@ -3285,6 +3477,12 @@ "ListTopicSnapshotsResponse" ] = _LISTTOPICSNAPSHOTSRESPONSE DESCRIPTOR.message_types_by_name["DeleteTopicRequest"] = _DELETETOPICREQUEST +DESCRIPTOR.message_types_by_name[ + "DetachSubscriptionRequest" +] = _DETACHSUBSCRIPTIONREQUEST +DESCRIPTOR.message_types_by_name[ + "DetachSubscriptionResponse" +] = _DETACHSUBSCRIPTIONRESPONSE DESCRIPTOR.message_types_by_name["Subscription"] = _SUBSCRIPTION DESCRIPTOR.message_types_by_name["RetryPolicy"] = _RETRYPOLICY DESCRIPTOR.message_types_by_name["DeadLetterPolicy"] = _DEADLETTERPOLICY @@ -3323,13 +3521,12 @@ MessageStoragePolicy = _reflection.GeneratedProtocolMessageType( "MessageStoragePolicy", (_message.Message,), - dict( - DESCRIPTOR=_MESSAGESTORAGEPOLICY, - __module__="google.cloud.pubsub_v1.proto.pubsub_pb2", - __doc__="""A message storage policy. - + { + "DESCRIPTOR": _MESSAGESTORAGEPOLICY, + "__module__": "google.cloud.pubsub_v1.proto.pubsub_pb2", + "__doc__": """A policy constraining the storage of messages published to the topic. - Attributes: + Attributes: allowed_persistence_regions: A list of IDs of GCP regions where messages that are published to the topic may be persisted in storage. Messages published @@ -3339,26 +3536,27 @@ are allowed, and is not a valid configuration. """, # @@protoc_insertion_point(class_scope:google.pubsub.v1.MessageStoragePolicy) - ), + }, ) _sym_db.RegisterMessage(MessageStoragePolicy) Topic = _reflection.GeneratedProtocolMessageType( "Topic", (_message.Message,), - dict( - LabelsEntry=_reflection.GeneratedProtocolMessageType( + { + "LabelsEntry": _reflection.GeneratedProtocolMessageType( "LabelsEntry", (_message.Message,), - dict( - DESCRIPTOR=_TOPIC_LABELSENTRY, - __module__="google.cloud.pubsub_v1.proto.pubsub_pb2" + { + "DESCRIPTOR": _TOPIC_LABELSENTRY, + "__module__": "google.cloud.pubsub_v1.proto.pubsub_pb2" # @@protoc_insertion_point(class_scope:google.pubsub.v1.Topic.LabelsEntry) - ), + }, ), - DESCRIPTOR=_TOPIC, - __module__="google.cloud.pubsub_v1.proto.pubsub_pb2", - __doc__="""A topic resource. + "DESCRIPTOR": _TOPIC, + "__module__": "google.cloud.pubsub_v1.proto.pubsub_pb2", + "__doc__": """A topic resource. + Attributes: name: Required. The name of the topic. It must have the format @@ -3381,7 +3579,7 @@ ``projects/*/locations/*/keyRings/*/cryptoKeys/*``. """, # @@protoc_insertion_point(class_scope:google.pubsub.v1.Topic) - ), + }, ) _sym_db.RegisterMessage(Topic) _sym_db.RegisterMessage(Topic.LabelsEntry) @@ -3389,24 +3587,25 @@ PubsubMessage = _reflection.GeneratedProtocolMessageType( "PubsubMessage", (_message.Message,), - dict( - AttributesEntry=_reflection.GeneratedProtocolMessageType( + { + "AttributesEntry": _reflection.GeneratedProtocolMessageType( "AttributesEntry", (_message.Message,), - dict( - DESCRIPTOR=_PUBSUBMESSAGE_ATTRIBUTESENTRY, - __module__="google.cloud.pubsub_v1.proto.pubsub_pb2" + { + "DESCRIPTOR": _PUBSUBMESSAGE_ATTRIBUTESENTRY, + "__module__": "google.cloud.pubsub_v1.proto.pubsub_pb2" # @@protoc_insertion_point(class_scope:google.pubsub.v1.PubsubMessage.AttributesEntry) - ), + }, ), - DESCRIPTOR=_PUBSUBMESSAGE, - __module__="google.cloud.pubsub_v1.proto.pubsub_pb2", - __doc__="""A message that is published by publishers and consumed by subscribers. + "DESCRIPTOR": _PUBSUBMESSAGE, + "__module__": "google.cloud.pubsub_v1.proto.pubsub_pb2", + "__doc__": """A message that is published by publishers and consumed by subscribers. The message must contain either a non-empty data field or at least one attribute. Note that client libraries represent this object differently depending on the language. See the corresponding client library documentation for more information. See Quotas and limits for more information about message limits. + Attributes: data: The message data field. If this field is empty, the message @@ -3438,7 +3637,7 @@ It is not subject to any SLA or deprecation policy. """, # @@protoc_insertion_point(class_scope:google.pubsub.v1.PubsubMessage) - ), + }, ) _sym_db.RegisterMessage(PubsubMessage) _sym_db.RegisterMessage(PubsubMessage.AttributesEntry) @@ -3446,50 +3645,53 @@ GetTopicRequest = _reflection.GeneratedProtocolMessageType( "GetTopicRequest", (_message.Message,), - dict( - DESCRIPTOR=_GETTOPICREQUEST, - __module__="google.cloud.pubsub_v1.proto.pubsub_pb2", - __doc__="""Request for the GetTopic method. + { + "DESCRIPTOR": _GETTOPICREQUEST, + "__module__": "google.cloud.pubsub_v1.proto.pubsub_pb2", + "__doc__": """Request for the GetTopic method. + Attributes: topic: Required. The name of the topic to get. Format is ``projects/{project}/topics/{topic}``. """, # @@protoc_insertion_point(class_scope:google.pubsub.v1.GetTopicRequest) - ), + }, ) _sym_db.RegisterMessage(GetTopicRequest) UpdateTopicRequest = _reflection.GeneratedProtocolMessageType( "UpdateTopicRequest", (_message.Message,), - dict( - DESCRIPTOR=_UPDATETOPICREQUEST, - __module__="google.cloud.pubsub_v1.proto.pubsub_pb2", - __doc__="""Request for the UpdateTopic method. + { + "DESCRIPTOR": _UPDATETOPICREQUEST, + "__module__": "google.cloud.pubsub_v1.proto.pubsub_pb2", + "__doc__": """Request for the UpdateTopic method. + Attributes: topic: Required. The updated topic object. update_mask: Required. Indicates which fields in the provided topic to update. Must be specified and non-empty. Note that if - ``update_mask`` contains "message\_storage\_policy" but the + ``update_mask`` contains “message_storage_policy” but the ``message_storage_policy`` is not set in the ``topic`` provided above, then the updated value is determined by the policy configured at the project or organization level. """, # @@protoc_insertion_point(class_scope:google.pubsub.v1.UpdateTopicRequest) - ), + }, ) _sym_db.RegisterMessage(UpdateTopicRequest) PublishRequest = _reflection.GeneratedProtocolMessageType( "PublishRequest", (_message.Message,), - dict( - DESCRIPTOR=_PUBLISHREQUEST, - __module__="google.cloud.pubsub_v1.proto.pubsub_pb2", - __doc__="""Request for the Publish method. + { + "DESCRIPTOR": _PUBLISHREQUEST, + "__module__": "google.cloud.pubsub_v1.proto.pubsub_pb2", + "__doc__": """Request for the Publish method. + Attributes: topic: Required. The messages in the request will be published on @@ -3498,17 +3700,18 @@ Required. The messages to publish. """, # @@protoc_insertion_point(class_scope:google.pubsub.v1.PublishRequest) - ), + }, ) _sym_db.RegisterMessage(PublishRequest) PublishResponse = _reflection.GeneratedProtocolMessageType( "PublishResponse", (_message.Message,), - dict( - DESCRIPTOR=_PUBLISHRESPONSE, - __module__="google.cloud.pubsub_v1.proto.pubsub_pb2", - __doc__="""Response for the ``Publish`` method. + { + "DESCRIPTOR": _PUBLISHRESPONSE, + "__module__": "google.cloud.pubsub_v1.proto.pubsub_pb2", + "__doc__": """Response for the ``Publish`` method. + Attributes: message_ids: The server-assigned ID of each published message, in the same @@ -3516,17 +3719,18 @@ unique within the topic. """, # @@protoc_insertion_point(class_scope:google.pubsub.v1.PublishResponse) - ), + }, ) _sym_db.RegisterMessage(PublishResponse) ListTopicsRequest = _reflection.GeneratedProtocolMessageType( "ListTopicsRequest", (_message.Message,), - dict( - DESCRIPTOR=_LISTTOPICSREQUEST, - __module__="google.cloud.pubsub_v1.proto.pubsub_pb2", - __doc__="""Request for the ``ListTopics`` method. + { + "DESCRIPTOR": _LISTTOPICSREQUEST, + "__module__": "google.cloud.pubsub_v1.proto.pubsub_pb2", + "__doc__": """Request for the ``ListTopics`` method. + Attributes: project: Required. The name of the project in which to list topics. @@ -3540,17 +3744,18 @@ next page of data. """, # @@protoc_insertion_point(class_scope:google.pubsub.v1.ListTopicsRequest) - ), + }, ) _sym_db.RegisterMessage(ListTopicsRequest) ListTopicsResponse = _reflection.GeneratedProtocolMessageType( "ListTopicsResponse", (_message.Message,), - dict( - DESCRIPTOR=_LISTTOPICSRESPONSE, - __module__="google.cloud.pubsub_v1.proto.pubsub_pb2", - __doc__="""Response for the ``ListTopics`` method. + { + "DESCRIPTOR": _LISTTOPICSRESPONSE, + "__module__": "google.cloud.pubsub_v1.proto.pubsub_pb2", + "__doc__": """Response for the ``ListTopics`` method. + Attributes: topics: The resulting topics. @@ -3560,17 +3765,18 @@ ``ListTopicsRequest``. """, # @@protoc_insertion_point(class_scope:google.pubsub.v1.ListTopicsResponse) - ), + }, ) _sym_db.RegisterMessage(ListTopicsResponse) ListTopicSubscriptionsRequest = _reflection.GeneratedProtocolMessageType( "ListTopicSubscriptionsRequest", (_message.Message,), - dict( - DESCRIPTOR=_LISTTOPICSUBSCRIPTIONSREQUEST, - __module__="google.cloud.pubsub_v1.proto.pubsub_pb2", - __doc__="""Request for the ``ListTopicSubscriptions`` method. + { + "DESCRIPTOR": _LISTTOPICSUBSCRIPTIONSREQUEST, + "__module__": "google.cloud.pubsub_v1.proto.pubsub_pb2", + "__doc__": """Request for the ``ListTopicSubscriptions`` method. + Attributes: topic: Required. The name of the topic that subscriptions are @@ -3584,37 +3790,40 @@ that the system should return the next page of data. """, # @@protoc_insertion_point(class_scope:google.pubsub.v1.ListTopicSubscriptionsRequest) - ), + }, ) _sym_db.RegisterMessage(ListTopicSubscriptionsRequest) ListTopicSubscriptionsResponse = _reflection.GeneratedProtocolMessageType( "ListTopicSubscriptionsResponse", (_message.Message,), - dict( - DESCRIPTOR=_LISTTOPICSUBSCRIPTIONSRESPONSE, - __module__="google.cloud.pubsub_v1.proto.pubsub_pb2", - __doc__="""Response for the ``ListTopicSubscriptions`` method. + { + "DESCRIPTOR": _LISTTOPICSUBSCRIPTIONSRESPONSE, + "__module__": "google.cloud.pubsub_v1.proto.pubsub_pb2", + "__doc__": """Response for the ``ListTopicSubscriptions`` method. + Attributes: subscriptions: - The names of the subscriptions that match the request. + The names of subscriptions attached to the topic specified in + the request. next_page_token: If not empty, indicates that there may be more subscriptions that match the request; this value should be passed in a new ``ListTopicSubscriptionsRequest`` to get more subscriptions. """, # @@protoc_insertion_point(class_scope:google.pubsub.v1.ListTopicSubscriptionsResponse) - ), + }, ) _sym_db.RegisterMessage(ListTopicSubscriptionsResponse) ListTopicSnapshotsRequest = _reflection.GeneratedProtocolMessageType( "ListTopicSnapshotsRequest", (_message.Message,), - dict( - DESCRIPTOR=_LISTTOPICSNAPSHOTSREQUEST, - __module__="google.cloud.pubsub_v1.proto.pubsub_pb2", - __doc__="""Request for the ``ListTopicSnapshots`` method. + { + "DESCRIPTOR": _LISTTOPICSNAPSHOTSREQUEST, + "__module__": "google.cloud.pubsub_v1.proto.pubsub_pb2", + "__doc__": """Request for the ``ListTopicSnapshots`` method. + Attributes: topic: Required. The name of the topic that snapshots are attached @@ -3628,17 +3837,18 @@ the next page of data. """, # @@protoc_insertion_point(class_scope:google.pubsub.v1.ListTopicSnapshotsRequest) - ), + }, ) _sym_db.RegisterMessage(ListTopicSnapshotsRequest) ListTopicSnapshotsResponse = _reflection.GeneratedProtocolMessageType( "ListTopicSnapshotsResponse", (_message.Message,), - dict( - DESCRIPTOR=_LISTTOPICSNAPSHOTSRESPONSE, - __module__="google.cloud.pubsub_v1.proto.pubsub_pb2", - __doc__="""Response for the ``ListTopicSnapshots`` method. + { + "DESCRIPTOR": _LISTTOPICSNAPSHOTSRESPONSE, + "__module__": "google.cloud.pubsub_v1.proto.pubsub_pb2", + "__doc__": """Response for the ``ListTopicSnapshots`` method. + Attributes: snapshots: The names of the snapshots that match the request. @@ -3648,43 +3858,75 @@ ``ListTopicSnapshotsRequest`` to get more snapshots. """, # @@protoc_insertion_point(class_scope:google.pubsub.v1.ListTopicSnapshotsResponse) - ), + }, ) _sym_db.RegisterMessage(ListTopicSnapshotsResponse) DeleteTopicRequest = _reflection.GeneratedProtocolMessageType( "DeleteTopicRequest", (_message.Message,), - dict( - DESCRIPTOR=_DELETETOPICREQUEST, - __module__="google.cloud.pubsub_v1.proto.pubsub_pb2", - __doc__="""Request for the ``DeleteTopic`` method. + { + "DESCRIPTOR": _DELETETOPICREQUEST, + "__module__": "google.cloud.pubsub_v1.proto.pubsub_pb2", + "__doc__": """Request for the ``DeleteTopic`` method. + Attributes: topic: Required. Name of the topic to delete. Format is ``projects/{project}/topics/{topic}``. """, # @@protoc_insertion_point(class_scope:google.pubsub.v1.DeleteTopicRequest) - ), + }, ) _sym_db.RegisterMessage(DeleteTopicRequest) +DetachSubscriptionRequest = _reflection.GeneratedProtocolMessageType( + "DetachSubscriptionRequest", + (_message.Message,), + { + "DESCRIPTOR": _DETACHSUBSCRIPTIONREQUEST, + "__module__": "google.cloud.pubsub_v1.proto.pubsub_pb2", + "__doc__": """Request for the DetachSubscription method. + + Attributes: + subscription: + Required. The subscription to detach. Format is + ``projects/{project}/subscriptions/{subscription}``. + """, + # @@protoc_insertion_point(class_scope:google.pubsub.v1.DetachSubscriptionRequest) + }, +) +_sym_db.RegisterMessage(DetachSubscriptionRequest) + +DetachSubscriptionResponse = _reflection.GeneratedProtocolMessageType( + "DetachSubscriptionResponse", + (_message.Message,), + { + "DESCRIPTOR": _DETACHSUBSCRIPTIONRESPONSE, + "__module__": "google.cloud.pubsub_v1.proto.pubsub_pb2", + "__doc__": """Response for the DetachSubscription method. Reserved for future use.""", + # @@protoc_insertion_point(class_scope:google.pubsub.v1.DetachSubscriptionResponse) + }, +) +_sym_db.RegisterMessage(DetachSubscriptionResponse) + Subscription = _reflection.GeneratedProtocolMessageType( "Subscription", (_message.Message,), - dict( - LabelsEntry=_reflection.GeneratedProtocolMessageType( + { + "LabelsEntry": _reflection.GeneratedProtocolMessageType( "LabelsEntry", (_message.Message,), - dict( - DESCRIPTOR=_SUBSCRIPTION_LABELSENTRY, - __module__="google.cloud.pubsub_v1.proto.pubsub_pb2" + { + "DESCRIPTOR": _SUBSCRIPTION_LABELSENTRY, + "__module__": "google.cloud.pubsub_v1.proto.pubsub_pb2" # @@protoc_insertion_point(class_scope:google.pubsub.v1.Subscription.LabelsEntry) - ), + }, ), - DESCRIPTOR=_SUBSCRIPTION, - __module__="google.cloud.pubsub_v1.proto.pubsub_pb2", - __doc__="""A subscription resource. + "DESCRIPTOR": _SUBSCRIPTION, + "__module__": "google.cloud.pubsub_v1.proto.pubsub_pb2", + "__doc__": """A subscription resource. + Attributes: name: Required. The name of the subscription. It must have the @@ -3724,13 +3966,13 @@ system will eventually redeliver the message. retain_acked_messages: Indicates whether to retain acknowledged messages. If true, - then messages are not expunged from the subscription's + then messages are not expunged from the subscription’s backlog, even if they are acknowledged, until they fall out of the ``message_retention_duration`` window. This must be true if you would like to Seek to a timestamp. message_retention_duration: How long to retain unacknowledged messages in the - subscription's backlog, from the moment a message is + subscription’s backlog, from the moment a message is published. If ``retain_acked_messages`` is true, then this also configures the retention of acknowledged messages, and thus configures how far back in time a ``Seek`` can be done. @@ -3748,7 +3990,7 @@ recommended for production use. It is not subject to any SLA or deprecation policy. expiration_policy: - A policy that specifies the conditions for this subscription's + A policy that specifies the conditions for this subscription’s expiration. A subscription is considered active as long as any connected subscriber is successfully consuming messages from the subscription or is issuing operations on the subscription. @@ -3759,32 +4001,32 @@ An expression written in the Cloud Pub/Sub filter language. If non-empty, then only ``PubsubMessage``\ s whose ``attributes`` field matches the filter are delivered on this subscription. - If empty, then no messages are filtered out. EXPERIMENTAL: - This feature is part of a closed alpha release. This API might - be changed in backward-incompatible ways and is not - recommended for production use. It is not subject to any SLA - or deprecation policy. + If empty, then no messages are filtered out. dead_letter_policy: A policy that specifies the conditions for dead lettering - messages in this subscription. If dead\_letter\_policy is not + messages in this subscription. If dead_letter_policy is not set, dead lettering is disabled. The Cloud Pub/Sub service - account associated with this subscriptions's parent project - (i.e., service-{project\_number}@gcp-sa- + account associated with this subscriptions’s parent project + (i.e., service-{project_number}@gcp-sa- pubsub.iam.gserviceaccount.com) must have permission to Acknowledge() messages on this subscription. retry_policy: - A policy that specifies how Cloud Pub/Sub retries message - delivery for this subscription. If not set, the default retry - policy is applied. This generally implies that messages will - be retried as soon as possible for healthy subscribers. + A policy that specifies how Pub/Sub retries message delivery + for this subscription. If not set, the default retry policy + is applied. This generally implies that messages will be + retried as soon as possible for healthy subscribers. RetryPolicy will be triggered on NACKs or acknowledgement - deadline exceeded events for a given message. EXPERIMENTAL: - This API might be changed in backward-incompatible ways and is - not recommended for production use. It is not subject to any - SLA or deprecation policy. + deadline exceeded events for a given message. + detached: + Indicates whether the subscription is detached from its topic. + Detached subscriptions don’t receive messages from their topic + and don’t retain any backlog. ``Pull`` and ``StreamingPull`` + requests will return FAILED_PRECONDITION. If the subscription + is a push subscription, pushes to the endpoint will not be + made. """, # @@protoc_insertion_point(class_scope:google.pubsub.v1.Subscription) - ), + }, ) _sym_db.RegisterMessage(Subscription) _sym_db.RegisterMessage(Subscription.LabelsEntry) @@ -3792,17 +4034,18 @@ RetryPolicy = _reflection.GeneratedProtocolMessageType( "RetryPolicy", (_message.Message,), - dict( - DESCRIPTOR=_RETRYPOLICY, - __module__="google.cloud.pubsub_v1.proto.pubsub_pb2", - __doc__="""A policy that specifies how Cloud Pub/Sub retries message delivery. + { + "DESCRIPTOR": _RETRYPOLICY, + "__module__": "google.cloud.pubsub_v1.proto.pubsub_pb2", + "__doc__": """A policy that specifies how Cloud Pub/Sub retries message delivery. Retry delay will be exponential based on provided minimum and maximum - backoffs. https://en.wikipedia.org/wiki/Exponential\_backoff. + backoffs. https://en.wikipedia.org/wiki/Exponential_backoff. RetryPolicy will be triggered on NACKs or acknowledgement deadline exceeded events for a given message. Retry Policy is implemented on a best effort basis. At times, the delay between consecutive deliveries may not match the configuration. That is, delay can be more or less than configured backoff. + Attributes: minimum_backoff: The minimum delay between consecutive deliveries of a given @@ -3814,27 +4057,28 @@ to 600 seconds. """, # @@protoc_insertion_point(class_scope:google.pubsub.v1.RetryPolicy) - ), + }, ) _sym_db.RegisterMessage(RetryPolicy) DeadLetterPolicy = _reflection.GeneratedProtocolMessageType( "DeadLetterPolicy", (_message.Message,), - dict( - DESCRIPTOR=_DEADLETTERPOLICY, - __module__="google.cloud.pubsub_v1.proto.pubsub_pb2", - __doc__="""Dead lettering is done on a best effort basis. The same message might + { + "DESCRIPTOR": _DEADLETTERPOLICY, + "__module__": "google.cloud.pubsub_v1.proto.pubsub_pb2", + "__doc__": """Dead lettering is done on a best effort basis. The same message might be dead lettered multiple times. If validation on any of the fields fails at subscription creation/updation, the create/update subscription request will fail. + Attributes: dead_letter_topic: The name of the topic to which dead letter messages should be published. Format is ``projects/{project}/topics/{topic}``.The Cloud Pub/Sub service account associated with the enclosing - subscription's parent project (i.e., - service-{project\_number}@gcp-sa- + subscription’s parent project (i.e., + service-{project_number}@gcp-sa- pubsub.iam.gserviceaccount.com) must have permission to Publish() to this topic. The operation will fail if the topic does not exist. Users should ensure that there is a @@ -3847,50 +4091,52 @@ number of times the acknowledgement deadline has been exceeded for the message). A NACK is any call to ModifyAckDeadline with a 0 deadline. Note that client libraries may - automatically extend ack\_deadlines. This field will be + automatically extend ack_deadlines. This field will be honored on a best effort basis. If this parameter is 0, a default value of 5 is used. """, # @@protoc_insertion_point(class_scope:google.pubsub.v1.DeadLetterPolicy) - ), + }, ) _sym_db.RegisterMessage(DeadLetterPolicy) ExpirationPolicy = _reflection.GeneratedProtocolMessageType( "ExpirationPolicy", (_message.Message,), - dict( - DESCRIPTOR=_EXPIRATIONPOLICY, - __module__="google.cloud.pubsub_v1.proto.pubsub_pb2", - __doc__="""A policy that specifies the conditions for resource expiration (i.e., + { + "DESCRIPTOR": _EXPIRATIONPOLICY, + "__module__": "google.cloud.pubsub_v1.proto.pubsub_pb2", + "__doc__": """A policy that specifies the conditions for resource expiration (i.e., automatic resource deletion). + Attributes: ttl: - Specifies the "time-to-live" duration for an associated + Specifies the “time-to-live” duration for an associated resource. The resource expires if it is not active for a - period of ``ttl``. The definition of "activity" depends on the + period of ``ttl``. The definition of “activity” depends on the type of the associated resource. The minimum and maximum allowed values for ``ttl`` depend on the type of the associated resource, as well. If ``ttl`` is not set, the associated resource never expires. """, # @@protoc_insertion_point(class_scope:google.pubsub.v1.ExpirationPolicy) - ), + }, ) _sym_db.RegisterMessage(ExpirationPolicy) PushConfig = _reflection.GeneratedProtocolMessageType( "PushConfig", (_message.Message,), - dict( - OidcToken=_reflection.GeneratedProtocolMessageType( + { + "OidcToken": _reflection.GeneratedProtocolMessageType( "OidcToken", (_message.Message,), - dict( - DESCRIPTOR=_PUSHCONFIG_OIDCTOKEN, - __module__="google.cloud.pubsub_v1.proto.pubsub_pb2", - __doc__="""Contains information needed for generating an `OpenID Connect token + { + "DESCRIPTOR": _PUSHCONFIG_OIDCTOKEN, + "__module__": "google.cloud.pubsub_v1.proto.pubsub_pb2", + "__doc__": """Contains information needed for generating an `OpenID Connect token `__. + Attributes: service_account_email: \ `Service account email @@ -3909,20 +4155,21 @@ specified, the Push endpoint URL will be used. """, # @@protoc_insertion_point(class_scope:google.pubsub.v1.PushConfig.OidcToken) - ), + }, ), - AttributesEntry=_reflection.GeneratedProtocolMessageType( + "AttributesEntry": _reflection.GeneratedProtocolMessageType( "AttributesEntry", (_message.Message,), - dict( - DESCRIPTOR=_PUSHCONFIG_ATTRIBUTESENTRY, - __module__="google.cloud.pubsub_v1.proto.pubsub_pb2" + { + "DESCRIPTOR": _PUSHCONFIG_ATTRIBUTESENTRY, + "__module__": "google.cloud.pubsub_v1.proto.pubsub_pb2" # @@protoc_insertion_point(class_scope:google.pubsub.v1.PushConfig.AttributesEntry) - ), + }, ), - DESCRIPTOR=_PUSHCONFIG, - __module__="google.cloud.pubsub_v1.proto.pubsub_pb2", - __doc__="""Configuration for a push delivery endpoint. + "DESCRIPTOR": _PUSHCONFIG, + "__module__": "google.cloud.pubsub_v1.proto.pubsub_pb2", + "__doc__": """Configuration for a push delivery endpoint. + Attributes: push_endpoint: A URL locating the endpoint to which messages should be @@ -3959,7 +4206,7 @@ every pushed message. """, # @@protoc_insertion_point(class_scope:google.pubsub.v1.PushConfig) - ), + }, ) _sym_db.RegisterMessage(PushConfig) _sym_db.RegisterMessage(PushConfig.OidcToken) @@ -3968,60 +4215,62 @@ ReceivedMessage = _reflection.GeneratedProtocolMessageType( "ReceivedMessage", (_message.Message,), - dict( - DESCRIPTOR=_RECEIVEDMESSAGE, - __module__="google.cloud.pubsub_v1.proto.pubsub_pb2", - __doc__="""A message and its corresponding acknowledgment ID. + { + "DESCRIPTOR": _RECEIVEDMESSAGE, + "__module__": "google.cloud.pubsub_v1.proto.pubsub_pb2", + "__doc__": """A message and its corresponding acknowledgment ID. + Attributes: ack_id: This ID can be used to acknowledge the received message. message: The message. delivery_attempt: - Delivery attempt counter is 1 + (the sum of number of NACKs - and number of ack\_deadline exceeds) for this message. A NACK - is any call to ModifyAckDeadline with a 0 deadline. An - ack\_deadline exceeds event is whenever a message is not - acknowledged within ack\_deadline. Note that ack\_deadline is - initially Subscription.ackDeadlineSeconds, but may get - extended automatically by the client library. The first - delivery of a given message will have this value as 1. The - value is calculated at best effort and is approximate. If a - DeadLetterPolicy is not set on the subscription, this will be - 0. EXPERIMENTAL: This feature is part of a closed alpha - release. This API might be changed in backward-incompatible - ways and is not recommended for production use. It is not - subject to any SLA or deprecation policy. + The approximate number of times that Cloud Pub/Sub has + attempted to deliver the associated message to a subscriber. + More precisely, this is 1 + (number of NACKs) + (number of + ack_deadline exceeds) for this message. A NACK is any call to + ModifyAckDeadline with a 0 deadline. An ack_deadline exceeds + event is whenever a message is not acknowledged within + ack_deadline. Note that ack_deadline is initially + Subscription.ackDeadlineSeconds, but may get extended + automatically by the client library. Upon the first delivery + of a given message, ``delivery_attempt`` will have a value of + 1. The value is calculated at best effort and is approximate. + If a DeadLetterPolicy is not set on the subscription, this + will be 0. """, # @@protoc_insertion_point(class_scope:google.pubsub.v1.ReceivedMessage) - ), + }, ) _sym_db.RegisterMessage(ReceivedMessage) GetSubscriptionRequest = _reflection.GeneratedProtocolMessageType( "GetSubscriptionRequest", (_message.Message,), - dict( - DESCRIPTOR=_GETSUBSCRIPTIONREQUEST, - __module__="google.cloud.pubsub_v1.proto.pubsub_pb2", - __doc__="""Request for the GetSubscription method. + { + "DESCRIPTOR": _GETSUBSCRIPTIONREQUEST, + "__module__": "google.cloud.pubsub_v1.proto.pubsub_pb2", + "__doc__": """Request for the GetSubscription method. + Attributes: subscription: Required. The name of the subscription to get. Format is ``projects/{project}/subscriptions/{sub}``. """, # @@protoc_insertion_point(class_scope:google.pubsub.v1.GetSubscriptionRequest) - ), + }, ) _sym_db.RegisterMessage(GetSubscriptionRequest) UpdateSubscriptionRequest = _reflection.GeneratedProtocolMessageType( "UpdateSubscriptionRequest", (_message.Message,), - dict( - DESCRIPTOR=_UPDATESUBSCRIPTIONREQUEST, - __module__="google.cloud.pubsub_v1.proto.pubsub_pb2", - __doc__="""Request for the UpdateSubscription method. + { + "DESCRIPTOR": _UPDATESUBSCRIPTIONREQUEST, + "__module__": "google.cloud.pubsub_v1.proto.pubsub_pb2", + "__doc__": """Request for the UpdateSubscription method. + Attributes: subscription: Required. The updated subscription object. @@ -4030,17 +4279,18 @@ to update. Must be specified and non-empty. """, # @@protoc_insertion_point(class_scope:google.pubsub.v1.UpdateSubscriptionRequest) - ), + }, ) _sym_db.RegisterMessage(UpdateSubscriptionRequest) ListSubscriptionsRequest = _reflection.GeneratedProtocolMessageType( "ListSubscriptionsRequest", (_message.Message,), - dict( - DESCRIPTOR=_LISTSUBSCRIPTIONSREQUEST, - __module__="google.cloud.pubsub_v1.proto.pubsub_pb2", - __doc__="""Request for the ``ListSubscriptions`` method. + { + "DESCRIPTOR": _LISTSUBSCRIPTIONSREQUEST, + "__module__": "google.cloud.pubsub_v1.proto.pubsub_pb2", + "__doc__": """Request for the ``ListSubscriptions`` method. + Attributes: project: Required. The name of the project in which to list @@ -4054,17 +4304,18 @@ the next page of data. """, # @@protoc_insertion_point(class_scope:google.pubsub.v1.ListSubscriptionsRequest) - ), + }, ) _sym_db.RegisterMessage(ListSubscriptionsRequest) ListSubscriptionsResponse = _reflection.GeneratedProtocolMessageType( "ListSubscriptionsResponse", (_message.Message,), - dict( - DESCRIPTOR=_LISTSUBSCRIPTIONSRESPONSE, - __module__="google.cloud.pubsub_v1.proto.pubsub_pb2", - __doc__="""Response for the ``ListSubscriptions`` method. + { + "DESCRIPTOR": _LISTSUBSCRIPTIONSRESPONSE, + "__module__": "google.cloud.pubsub_v1.proto.pubsub_pb2", + "__doc__": """Response for the ``ListSubscriptions`` method. + Attributes: subscriptions: The subscriptions that match the request. @@ -4074,34 +4325,36 @@ ``ListSubscriptionsRequest`` to get more subscriptions. """, # @@protoc_insertion_point(class_scope:google.pubsub.v1.ListSubscriptionsResponse) - ), + }, ) _sym_db.RegisterMessage(ListSubscriptionsResponse) DeleteSubscriptionRequest = _reflection.GeneratedProtocolMessageType( "DeleteSubscriptionRequest", (_message.Message,), - dict( - DESCRIPTOR=_DELETESUBSCRIPTIONREQUEST, - __module__="google.cloud.pubsub_v1.proto.pubsub_pb2", - __doc__="""Request for the DeleteSubscription method. + { + "DESCRIPTOR": _DELETESUBSCRIPTIONREQUEST, + "__module__": "google.cloud.pubsub_v1.proto.pubsub_pb2", + "__doc__": """Request for the DeleteSubscription method. + Attributes: subscription: Required. The subscription to delete. Format is ``projects/{project}/subscriptions/{sub}``. """, # @@protoc_insertion_point(class_scope:google.pubsub.v1.DeleteSubscriptionRequest) - ), + }, ) _sym_db.RegisterMessage(DeleteSubscriptionRequest) ModifyPushConfigRequest = _reflection.GeneratedProtocolMessageType( "ModifyPushConfigRequest", (_message.Message,), - dict( - DESCRIPTOR=_MODIFYPUSHCONFIGREQUEST, - __module__="google.cloud.pubsub_v1.proto.pubsub_pb2", - __doc__="""Request for the ModifyPushConfig method. + { + "DESCRIPTOR": _MODIFYPUSHCONFIGREQUEST, + "__module__": "google.cloud.pubsub_v1.proto.pubsub_pb2", + "__doc__": """Request for the ModifyPushConfig method. + Attributes: subscription: Required. The name of the subscription. Format is @@ -4115,17 +4368,18 @@ called. """, # @@protoc_insertion_point(class_scope:google.pubsub.v1.ModifyPushConfigRequest) - ), + }, ) _sym_db.RegisterMessage(ModifyPushConfigRequest) PullRequest = _reflection.GeneratedProtocolMessageType( "PullRequest", (_message.Message,), - dict( - DESCRIPTOR=_PULLREQUEST, - __module__="google.cloud.pubsub_v1.proto.pubsub_pb2", - __doc__="""Request for the ``Pull`` method. + { + "DESCRIPTOR": _PULLREQUEST, + "__module__": "google.cloud.pubsub_v1.proto.pubsub_pb2", + "__doc__": """Request for the ``Pull`` method. + Attributes: subscription: Required. The subscription from which messages should be @@ -4145,17 +4399,18 @@ return fewer than the number specified. """, # @@protoc_insertion_point(class_scope:google.pubsub.v1.PullRequest) - ), + }, ) _sym_db.RegisterMessage(PullRequest) PullResponse = _reflection.GeneratedProtocolMessageType( "PullResponse", (_message.Message,), - dict( - DESCRIPTOR=_PULLRESPONSE, - __module__="google.cloud.pubsub_v1.proto.pubsub_pb2", - __doc__="""Response for the ``Pull`` method. + { + "DESCRIPTOR": _PULLRESPONSE, + "__module__": "google.cloud.pubsub_v1.proto.pubsub_pb2", + "__doc__": """Response for the ``Pull`` method. + Attributes: received_messages: Received Pub/Sub messages. The list will be empty if there are @@ -4165,17 +4420,18 @@ more messages available in the backlog. """, # @@protoc_insertion_point(class_scope:google.pubsub.v1.PullResponse) - ), + }, ) _sym_db.RegisterMessage(PullResponse) ModifyAckDeadlineRequest = _reflection.GeneratedProtocolMessageType( "ModifyAckDeadlineRequest", (_message.Message,), - dict( - DESCRIPTOR=_MODIFYACKDEADLINEREQUEST, - __module__="google.cloud.pubsub_v1.proto.pubsub_pb2", - __doc__="""Request for the ModifyAckDeadline method. + { + "DESCRIPTOR": _MODIFYACKDEADLINEREQUEST, + "__module__": "google.cloud.pubsub_v1.proto.pubsub_pb2", + "__doc__": """Request for the ModifyAckDeadline method. + Attributes: subscription: Required. The name of the subscription. Format is @@ -4194,17 +4450,18 @@ deadline you can specify is 600 seconds (10 minutes). """, # @@protoc_insertion_point(class_scope:google.pubsub.v1.ModifyAckDeadlineRequest) - ), + }, ) _sym_db.RegisterMessage(ModifyAckDeadlineRequest) AcknowledgeRequest = _reflection.GeneratedProtocolMessageType( "AcknowledgeRequest", (_message.Message,), - dict( - DESCRIPTOR=_ACKNOWLEDGEREQUEST, - __module__="google.cloud.pubsub_v1.proto.pubsub_pb2", - __doc__="""Request for the Acknowledge method. + { + "DESCRIPTOR": _ACKNOWLEDGEREQUEST, + "__module__": "google.cloud.pubsub_v1.proto.pubsub_pb2", + "__doc__": """Request for the Acknowledge method. + Attributes: subscription: Required. The subscription whose message is being @@ -4216,20 +4473,21 @@ ``Pull`` response. Must not be empty. """, # @@protoc_insertion_point(class_scope:google.pubsub.v1.AcknowledgeRequest) - ), + }, ) _sym_db.RegisterMessage(AcknowledgeRequest) StreamingPullRequest = _reflection.GeneratedProtocolMessageType( "StreamingPullRequest", (_message.Message,), - dict( - DESCRIPTOR=_STREAMINGPULLREQUEST, - __module__="google.cloud.pubsub_v1.proto.pubsub_pb2", - __doc__="""Request for the ``StreamingPull`` streaming RPC method. This request + { + "DESCRIPTOR": _STREAMINGPULLREQUEST, + "__module__": "google.cloud.pubsub_v1.proto.pubsub_pb2", + "__doc__": """Request for the ``StreamingPull`` streaming RPC method. This request is used to establish the initial stream as well as to stream acknowledgements and ack deadline modifications from the client to the server. + Attributes: subscription: Required. The subscription for which to initialize the new @@ -4276,49 +4534,51 @@ A unique identifier that is used to distinguish client instances from each other. Only needs to be provided on the initial request. When a stream disconnects and reconnects for - the same stream, the client\_id should be set to the same - value so that state associated with the old stream can be - transferred to the new stream. The same client\_id should not + the same stream, the client_id should be set to the same value + so that state associated with the old stream can be + transferred to the new stream. The same client_id should not be used for different client instances. """, # @@protoc_insertion_point(class_scope:google.pubsub.v1.StreamingPullRequest) - ), + }, ) _sym_db.RegisterMessage(StreamingPullRequest) StreamingPullResponse = _reflection.GeneratedProtocolMessageType( "StreamingPullResponse", (_message.Message,), - dict( - DESCRIPTOR=_STREAMINGPULLRESPONSE, - __module__="google.cloud.pubsub_v1.proto.pubsub_pb2", - __doc__="""Response for the ``StreamingPull`` method. This response is used to + { + "DESCRIPTOR": _STREAMINGPULLRESPONSE, + "__module__": "google.cloud.pubsub_v1.proto.pubsub_pb2", + "__doc__": """Response for the ``StreamingPull`` method. This response is used to stream messages from the server to the client. + Attributes: received_messages: Received Pub/Sub messages. This will not be empty. """, # @@protoc_insertion_point(class_scope:google.pubsub.v1.StreamingPullResponse) - ), + }, ) _sym_db.RegisterMessage(StreamingPullResponse) CreateSnapshotRequest = _reflection.GeneratedProtocolMessageType( "CreateSnapshotRequest", (_message.Message,), - dict( - LabelsEntry=_reflection.GeneratedProtocolMessageType( + { + "LabelsEntry": _reflection.GeneratedProtocolMessageType( "LabelsEntry", (_message.Message,), - dict( - DESCRIPTOR=_CREATESNAPSHOTREQUEST_LABELSENTRY, - __module__="google.cloud.pubsub_v1.proto.pubsub_pb2" + { + "DESCRIPTOR": _CREATESNAPSHOTREQUEST_LABELSENTRY, + "__module__": "google.cloud.pubsub_v1.proto.pubsub_pb2" # @@protoc_insertion_point(class_scope:google.pubsub.v1.CreateSnapshotRequest.LabelsEntry) - ), + }, ), - DESCRIPTOR=_CREATESNAPSHOTREQUEST, - __module__="google.cloud.pubsub_v1.proto.pubsub_pb2", - __doc__="""Request for the ``CreateSnapshot`` method. + "DESCRIPTOR": _CREATESNAPSHOTREQUEST, + "__module__": "google.cloud.pubsub_v1.proto.pubsub_pb2", + "__doc__": """Request for the ``CreateSnapshot`` method. + Attributes: name: Required. User-provided name for this snapshot. If the name is @@ -4331,17 +4591,17 @@ Required. The subscription whose backlog the snapshot retains. Specifically, the created snapshot is guaranteed to retain: (a) The existing backlog on the subscription. More precisely, - this is defined as the messages in the subscription's backlog + this is defined as the messages in the subscription’s backlog that are unacknowledged upon the successful completion of the ``CreateSnapshot`` request; as well as: (b) Any messages - published to the subscription's topic following the successful + published to the subscription’s topic following the successful completion of the CreateSnapshot request. Format is ``projects/{project}/subscriptions/{sub}``. labels: See Creating and managing labels. """, # @@protoc_insertion_point(class_scope:google.pubsub.v1.CreateSnapshotRequest) - ), + }, ) _sym_db.RegisterMessage(CreateSnapshotRequest) _sym_db.RegisterMessage(CreateSnapshotRequest.LabelsEntry) @@ -4349,10 +4609,11 @@ UpdateSnapshotRequest = _reflection.GeneratedProtocolMessageType( "UpdateSnapshotRequest", (_message.Message,), - dict( - DESCRIPTOR=_UPDATESNAPSHOTREQUEST, - __module__="google.cloud.pubsub_v1.proto.pubsub_pb2", - __doc__="""Request for the UpdateSnapshot method. + { + "DESCRIPTOR": _UPDATESNAPSHOTREQUEST, + "__module__": "google.cloud.pubsub_v1.proto.pubsub_pb2", + "__doc__": """Request for the UpdateSnapshot method. + Attributes: snapshot: Required. The updated snapshot object. @@ -4361,29 +4622,30 @@ update. Must be specified and non-empty. """, # @@protoc_insertion_point(class_scope:google.pubsub.v1.UpdateSnapshotRequest) - ), + }, ) _sym_db.RegisterMessage(UpdateSnapshotRequest) Snapshot = _reflection.GeneratedProtocolMessageType( "Snapshot", (_message.Message,), - dict( - LabelsEntry=_reflection.GeneratedProtocolMessageType( + { + "LabelsEntry": _reflection.GeneratedProtocolMessageType( "LabelsEntry", (_message.Message,), - dict( - DESCRIPTOR=_SNAPSHOT_LABELSENTRY, - __module__="google.cloud.pubsub_v1.proto.pubsub_pb2" + { + "DESCRIPTOR": _SNAPSHOT_LABELSENTRY, + "__module__": "google.cloud.pubsub_v1.proto.pubsub_pb2" # @@protoc_insertion_point(class_scope:google.pubsub.v1.Snapshot.LabelsEntry) - ), + }, ), - DESCRIPTOR=_SNAPSHOT, - __module__="google.cloud.pubsub_v1.proto.pubsub_pb2", - __doc__="""A snapshot resource. Snapshots are used in Seek operations, which + "DESCRIPTOR": _SNAPSHOT, + "__module__": "google.cloud.pubsub_v1.proto.pubsub_pb2", + "__doc__": """A snapshot resource. Snapshots are used in Seek operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot. + Attributes: name: The name of the snapshot. @@ -4399,15 +4661,15 @@ of oldest unacked message in the subscription)``. For example, consider a subscription whose oldest unacked message is 3 days old. If a snapshot is created from this subscription, the - snapshot -- which will always capture this 3-day-old backlog - as long as the snapshot exists -- will expire in 4 days. The + snapshot – which will always capture this 3-day-old backlog as + long as the snapshot exists – will expire in 4 days. The service will refuse to create a snapshot that would expire in less than 1 hour after creation. labels: See Creating and managing labels. """, # @@protoc_insertion_point(class_scope:google.pubsub.v1.Snapshot) - ), + }, ) _sym_db.RegisterMessage(Snapshot) _sym_db.RegisterMessage(Snapshot.LabelsEntry) @@ -4415,27 +4677,29 @@ GetSnapshotRequest = _reflection.GeneratedProtocolMessageType( "GetSnapshotRequest", (_message.Message,), - dict( - DESCRIPTOR=_GETSNAPSHOTREQUEST, - __module__="google.cloud.pubsub_v1.proto.pubsub_pb2", - __doc__="""Request for the GetSnapshot method. + { + "DESCRIPTOR": _GETSNAPSHOTREQUEST, + "__module__": "google.cloud.pubsub_v1.proto.pubsub_pb2", + "__doc__": """Request for the GetSnapshot method. + Attributes: snapshot: Required. The name of the snapshot to get. Format is ``projects/{project}/snapshots/{snap}``. """, # @@protoc_insertion_point(class_scope:google.pubsub.v1.GetSnapshotRequest) - ), + }, ) _sym_db.RegisterMessage(GetSnapshotRequest) ListSnapshotsRequest = _reflection.GeneratedProtocolMessageType( "ListSnapshotsRequest", (_message.Message,), - dict( - DESCRIPTOR=_LISTSNAPSHOTSREQUEST, - __module__="google.cloud.pubsub_v1.proto.pubsub_pb2", - __doc__="""Request for the ``ListSnapshots`` method. + { + "DESCRIPTOR": _LISTSNAPSHOTSREQUEST, + "__module__": "google.cloud.pubsub_v1.proto.pubsub_pb2", + "__doc__": """Request for the ``ListSnapshots`` method. + Attributes: project: Required. The name of the project in which to list snapshots. @@ -4449,17 +4713,18 @@ next page of data. """, # @@protoc_insertion_point(class_scope:google.pubsub.v1.ListSnapshotsRequest) - ), + }, ) _sym_db.RegisterMessage(ListSnapshotsRequest) ListSnapshotsResponse = _reflection.GeneratedProtocolMessageType( "ListSnapshotsResponse", (_message.Message,), - dict( - DESCRIPTOR=_LISTSNAPSHOTSRESPONSE, - __module__="google.cloud.pubsub_v1.proto.pubsub_pb2", - __doc__="""Response for the ``ListSnapshots`` method. + { + "DESCRIPTOR": _LISTSNAPSHOTSRESPONSE, + "__module__": "google.cloud.pubsub_v1.proto.pubsub_pb2", + "__doc__": """Response for the ``ListSnapshots`` method. + Attributes: snapshots: The resulting snapshots. @@ -4469,34 +4734,36 @@ ``ListSnapshotsRequest``. """, # @@protoc_insertion_point(class_scope:google.pubsub.v1.ListSnapshotsResponse) - ), + }, ) _sym_db.RegisterMessage(ListSnapshotsResponse) DeleteSnapshotRequest = _reflection.GeneratedProtocolMessageType( "DeleteSnapshotRequest", (_message.Message,), - dict( - DESCRIPTOR=_DELETESNAPSHOTREQUEST, - __module__="google.cloud.pubsub_v1.proto.pubsub_pb2", - __doc__="""Request for the ``DeleteSnapshot`` method. + { + "DESCRIPTOR": _DELETESNAPSHOTREQUEST, + "__module__": "google.cloud.pubsub_v1.proto.pubsub_pb2", + "__doc__": """Request for the ``DeleteSnapshot`` method. + Attributes: snapshot: Required. The name of the snapshot to delete. Format is ``projects/{project}/snapshots/{snap}``. """, # @@protoc_insertion_point(class_scope:google.pubsub.v1.DeleteSnapshotRequest) - ), + }, ) _sym_db.RegisterMessage(DeleteSnapshotRequest) SeekRequest = _reflection.GeneratedProtocolMessageType( "SeekRequest", (_message.Message,), - dict( - DESCRIPTOR=_SEEKREQUEST, - __module__="google.cloud.pubsub_v1.proto.pubsub_pb2", - __doc__="""Request for the ``Seek`` method. + { + "DESCRIPTOR": _SEEKREQUEST, + "__module__": "google.cloud.pubsub_v1.proto.pubsub_pb2", + "__doc__": """Request for the ``Seek`` method. + Attributes: subscription: Required. The subscription to affect. @@ -4509,29 +4776,29 @@ in the subscription (configured by the combination of ``message_retention_duration`` and ``retain_acked_messages``). For example, if ``time`` corresponds to a point before the - message retention window (or to a point before the system's + message retention window (or to a point before the system’s notion of the subscription creation time), only retained messages will be marked as unacknowledged, and already- expunged messages will not be restored. snapshot: - The snapshot to seek to. The snapshot's topic must be the same + The snapshot to seek to. The snapshot’s topic must be the same as that of the provided subscription. Format is ``projects/{project}/snapshots/{snap}``. """, # @@protoc_insertion_point(class_scope:google.pubsub.v1.SeekRequest) - ), + }, ) _sym_db.RegisterMessage(SeekRequest) SeekResponse = _reflection.GeneratedProtocolMessageType( "SeekResponse", (_message.Message,), - dict( - DESCRIPTOR=_SEEKRESPONSE, - __module__="google.cloud.pubsub_v1.proto.pubsub_pb2", - __doc__="""Response for the ``Seek`` method (this response is empty).""", + { + "DESCRIPTOR": _SEEKRESPONSE, + "__module__": "google.cloud.pubsub_v1.proto.pubsub_pb2", + "__doc__": """Response for the ``Seek`` method (this response is empty).""", # @@protoc_insertion_point(class_scope:google.pubsub.v1.SeekResponse) - ), + }, ) _sym_db.RegisterMessage(SeekResponse) @@ -4551,6 +4818,7 @@ _LISTTOPICSUBSCRIPTIONSRESPONSE.fields_by_name["subscriptions"]._options = None _LISTTOPICSNAPSHOTSREQUEST.fields_by_name["topic"]._options = None _DELETETOPICREQUEST.fields_by_name["topic"]._options = None +_DETACHSUBSCRIPTIONREQUEST.fields_by_name["subscription"]._options = None _SUBSCRIPTION_LABELSENTRY._options = None _SUBSCRIPTION.fields_by_name["name"]._options = None _SUBSCRIPTION.fields_by_name["topic"]._options = None @@ -4592,11 +4860,10 @@ full_name="google.pubsub.v1.Publisher", file=DESCRIPTOR, index=0, - serialized_options=_b( - "\312A\025pubsub.googleapis.com\322AUhttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/pubsub" - ), - serialized_start=6209, - serialized_end=7476, + serialized_options=b"\312A\025pubsub.googleapis.com\322AUhttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/pubsub", + create_key=_descriptor._internal_create_key, + serialized_start=6352, + serialized_end=7795, methods=[ _descriptor.MethodDescriptor( name="CreateTopic", @@ -4605,9 +4872,8 @@ containing_service=None, input_type=_TOPIC, output_type=_TOPIC, - serialized_options=_b( - "\202\323\344\223\002#\032\036/v1/{name=projects/*/topics/*}:\001*\332A\004name" - ), + serialized_options=b"\202\323\344\223\002#\032\036/v1/{name=projects/*/topics/*}:\001*\332A\004name", + create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name="UpdateTopic", @@ -4616,9 +4882,8 @@ containing_service=None, input_type=_UPDATETOPICREQUEST, output_type=_TOPIC, - serialized_options=_b( - "\202\323\344\223\002)2$/v1/{topic.name=projects/*/topics/*}:\001*" - ), + serialized_options=b"\202\323\344\223\002)2$/v1/{topic.name=projects/*/topics/*}:\001*", + create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name="Publish", @@ -4627,9 +4892,8 @@ containing_service=None, input_type=_PUBLISHREQUEST, output_type=_PUBLISHRESPONSE, - serialized_options=_b( - "\202\323\344\223\002,\"'/v1/{topic=projects/*/topics/*}:publish:\001*\332A\016topic,messages" - ), + serialized_options=b"\202\323\344\223\002,\"'/v1/{topic=projects/*/topics/*}:publish:\001*\332A\016topic,messages", + create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name="GetTopic", @@ -4638,9 +4902,8 @@ containing_service=None, input_type=_GETTOPICREQUEST, output_type=_TOPIC, - serialized_options=_b( - "\202\323\344\223\002!\022\037/v1/{topic=projects/*/topics/*}\332A\005topic" - ), + serialized_options=b"\202\323\344\223\002!\022\037/v1/{topic=projects/*/topics/*}\332A\005topic", + create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name="ListTopics", @@ -4649,9 +4912,8 @@ containing_service=None, input_type=_LISTTOPICSREQUEST, output_type=_LISTTOPICSRESPONSE, - serialized_options=_b( - "\202\323\344\223\002!\022\037/v1/{project=projects/*}/topics\332A\007project" - ), + serialized_options=b"\202\323\344\223\002!\022\037/v1/{project=projects/*}/topics\332A\007project", + create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name="ListTopicSubscriptions", @@ -4660,9 +4922,8 @@ containing_service=None, input_type=_LISTTOPICSUBSCRIPTIONSREQUEST, output_type=_LISTTOPICSUBSCRIPTIONSRESPONSE, - serialized_options=_b( - "\202\323\344\223\002/\022-/v1/{topic=projects/*/topics/*}/subscriptions\332A\005topic" - ), + serialized_options=b"\202\323\344\223\002/\022-/v1/{topic=projects/*/topics/*}/subscriptions\332A\005topic", + create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name="ListTopicSnapshots", @@ -4671,9 +4932,8 @@ containing_service=None, input_type=_LISTTOPICSNAPSHOTSREQUEST, output_type=_LISTTOPICSNAPSHOTSRESPONSE, - serialized_options=_b( - "\202\323\344\223\002+\022)/v1/{topic=projects/*/topics/*}/snapshots\332A\005topic" - ), + serialized_options=b"\202\323\344\223\002+\022)/v1/{topic=projects/*/topics/*}/snapshots\332A\005topic", + create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name="DeleteTopic", @@ -4682,9 +4942,18 @@ containing_service=None, input_type=_DELETETOPICREQUEST, output_type=google_dot_protobuf_dot_empty__pb2._EMPTY, - serialized_options=_b( - "\202\323\344\223\002!*\037/v1/{topic=projects/*/topics/*}\332A\005topic" - ), + serialized_options=b"\202\323\344\223\002!*\037/v1/{topic=projects/*/topics/*}\332A\005topic", + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name="DetachSubscription", + full_name="google.pubsub.v1.Publisher.DetachSubscription", + index=8, + containing_service=None, + input_type=_DETACHSUBSCRIPTIONREQUEST, + output_type=_DETACHSUBSCRIPTIONRESPONSE, + serialized_options=b'\202\323\344\223\0026"4/v1/{subscription=projects/*/subscriptions/*}:detach', + create_key=_descriptor._internal_create_key, ), ], ) @@ -4698,11 +4967,10 @@ full_name="google.pubsub.v1.Subscriber", file=DESCRIPTOR, index=1, - serialized_options=_b( - "\312A\025pubsub.googleapis.com\322AUhttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/pubsub" - ), - serialized_start=7479, - serialized_end=10170, + serialized_options=b"\312A\025pubsub.googleapis.com\322AUhttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/pubsub", + create_key=_descriptor._internal_create_key, + serialized_start=7798, + serialized_end=10489, methods=[ _descriptor.MethodDescriptor( name="CreateSubscription", @@ -4711,9 +4979,8 @@ containing_service=None, input_type=_SUBSCRIPTION, output_type=_SUBSCRIPTION, - serialized_options=_b( - "\202\323\344\223\002*\032%/v1/{name=projects/*/subscriptions/*}:\001*\332A+name,topic,push_config,ack_deadline_seconds" - ), + serialized_options=b"\202\323\344\223\002*\032%/v1/{name=projects/*/subscriptions/*}:\001*\332A+name,topic,push_config,ack_deadline_seconds", + create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name="GetSubscription", @@ -4722,9 +4989,8 @@ containing_service=None, input_type=_GETSUBSCRIPTIONREQUEST, output_type=_SUBSCRIPTION, - serialized_options=_b( - "\202\323\344\223\002/\022-/v1/{subscription=projects/*/subscriptions/*}\332A\014subscription" - ), + serialized_options=b"\202\323\344\223\002/\022-/v1/{subscription=projects/*/subscriptions/*}\332A\014subscription", + create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name="UpdateSubscription", @@ -4733,9 +4999,8 @@ containing_service=None, input_type=_UPDATESUBSCRIPTIONREQUEST, output_type=_SUBSCRIPTION, - serialized_options=_b( - "\202\323\344\223\002722/v1/{subscription.name=projects/*/subscriptions/*}:\001*" - ), + serialized_options=b"\202\323\344\223\002722/v1/{subscription.name=projects/*/subscriptions/*}:\001*", + create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name="ListSubscriptions", @@ -4744,9 +5009,8 @@ containing_service=None, input_type=_LISTSUBSCRIPTIONSREQUEST, output_type=_LISTSUBSCRIPTIONSRESPONSE, - serialized_options=_b( - "\202\323\344\223\002(\022&/v1/{project=projects/*}/subscriptions\332A\007project" - ), + serialized_options=b"\202\323\344\223\002(\022&/v1/{project=projects/*}/subscriptions\332A\007project", + create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name="DeleteSubscription", @@ -4755,9 +5019,8 @@ containing_service=None, input_type=_DELETESUBSCRIPTIONREQUEST, output_type=google_dot_protobuf_dot_empty__pb2._EMPTY, - serialized_options=_b( - "\202\323\344\223\002/*-/v1/{subscription=projects/*/subscriptions/*}\332A\014subscription" - ), + serialized_options=b"\202\323\344\223\002/*-/v1/{subscription=projects/*/subscriptions/*}\332A\014subscription", + create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name="ModifyAckDeadline", @@ -4766,9 +5029,8 @@ containing_service=None, input_type=_MODIFYACKDEADLINEREQUEST, output_type=google_dot_protobuf_dot_empty__pb2._EMPTY, - serialized_options=_b( - '\202\323\344\223\002D"?/v1/{subscription=projects/*/subscriptions/*}:modifyAckDeadline:\001*\332A)subscription,ack_ids,ack_deadline_seconds' - ), + serialized_options=b'\202\323\344\223\002D"?/v1/{subscription=projects/*/subscriptions/*}:modifyAckDeadline:\001*\332A)subscription,ack_ids,ack_deadline_seconds', + create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name="Acknowledge", @@ -4777,9 +5039,8 @@ containing_service=None, input_type=_ACKNOWLEDGEREQUEST, output_type=google_dot_protobuf_dot_empty__pb2._EMPTY, - serialized_options=_b( - '\202\323\344\223\002>"9/v1/{subscription=projects/*/subscriptions/*}:acknowledge:\001*\332A\024subscription,ack_ids' - ), + serialized_options=b'\202\323\344\223\002>"9/v1/{subscription=projects/*/subscriptions/*}:acknowledge:\001*\332A\024subscription,ack_ids', + create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name="Pull", @@ -4788,9 +5049,8 @@ containing_service=None, input_type=_PULLREQUEST, output_type=_PULLRESPONSE, - serialized_options=_b( - '\202\323\344\223\0027"2/v1/{subscription=projects/*/subscriptions/*}:pull:\001*\332A,subscription,return_immediately,max_messages' - ), + serialized_options=b'\202\323\344\223\0027"2/v1/{subscription=projects/*/subscriptions/*}:pull:\001*\332A,subscription,return_immediately,max_messages', + create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name="StreamingPull", @@ -4800,6 +5060,7 @@ input_type=_STREAMINGPULLREQUEST, output_type=_STREAMINGPULLRESPONSE, serialized_options=None, + create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name="ModifyPushConfig", @@ -4808,9 +5069,8 @@ containing_service=None, input_type=_MODIFYPUSHCONFIGREQUEST, output_type=google_dot_protobuf_dot_empty__pb2._EMPTY, - serialized_options=_b( - '\202\323\344\223\002C">/v1/{subscription=projects/*/subscriptions/*}:modifyPushConfig:\001*\332A\030subscription,push_config' - ), + serialized_options=b'\202\323\344\223\002C">/v1/{subscription=projects/*/subscriptions/*}:modifyPushConfig:\001*\332A\030subscription,push_config', + create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name="GetSnapshot", @@ -4819,9 +5079,8 @@ containing_service=None, input_type=_GETSNAPSHOTREQUEST, output_type=_SNAPSHOT, - serialized_options=_b( - "\202\323\344\223\002'\022%/v1/{snapshot=projects/*/snapshots/*}\332A\010snapshot" - ), + serialized_options=b"\202\323\344\223\002'\022%/v1/{snapshot=projects/*/snapshots/*}\332A\010snapshot", + create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name="ListSnapshots", @@ -4830,9 +5089,8 @@ containing_service=None, input_type=_LISTSNAPSHOTSREQUEST, output_type=_LISTSNAPSHOTSRESPONSE, - serialized_options=_b( - '\202\323\344\223\002$\022"/v1/{project=projects/*}/snapshots\332A\007project' - ), + serialized_options=b'\202\323\344\223\002$\022"/v1/{project=projects/*}/snapshots\332A\007project', + create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name="CreateSnapshot", @@ -4841,9 +5099,8 @@ containing_service=None, input_type=_CREATESNAPSHOTREQUEST, output_type=_SNAPSHOT, - serialized_options=_b( - "\202\323\344\223\002&\032!/v1/{name=projects/*/snapshots/*}:\001*\332A\021name,subscription" - ), + serialized_options=b"\202\323\344\223\002&\032!/v1/{name=projects/*/snapshots/*}:\001*\332A\021name,subscription", + create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name="UpdateSnapshot", @@ -4852,9 +5109,8 @@ containing_service=None, input_type=_UPDATESNAPSHOTREQUEST, output_type=_SNAPSHOT, - serialized_options=_b( - "\202\323\344\223\002/2*/v1/{snapshot.name=projects/*/snapshots/*}:\001*" - ), + serialized_options=b"\202\323\344\223\002/2*/v1/{snapshot.name=projects/*/snapshots/*}:\001*", + create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name="DeleteSnapshot", @@ -4863,9 +5119,8 @@ containing_service=None, input_type=_DELETESNAPSHOTREQUEST, output_type=google_dot_protobuf_dot_empty__pb2._EMPTY, - serialized_options=_b( - "\202\323\344\223\002'*%/v1/{snapshot=projects/*/snapshots/*}\332A\010snapshot" - ), + serialized_options=b"\202\323\344\223\002'*%/v1/{snapshot=projects/*/snapshots/*}\332A\010snapshot", + create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name="Seek", @@ -4874,9 +5129,8 @@ containing_service=None, input_type=_SEEKREQUEST, output_type=_SEEKRESPONSE, - serialized_options=_b( - '\202\323\344\223\0027"2/v1/{subscription=projects/*/subscriptions/*}:seek:\001*' - ), + serialized_options=b'\202\323\344\223\0027"2/v1/{subscription=projects/*/subscriptions/*}:seek:\001*', + create_key=_descriptor._internal_create_key, ), ], ) diff --git a/google/cloud/pubsub_v1/proto/pubsub_pb2_grpc.py b/google/cloud/pubsub_v1/proto/pubsub_pb2_grpc.py index dd1a36587..5e99bf2de 100644 --- a/google/cloud/pubsub_v1/proto/pubsub_pb2_grpc.py +++ b/google/cloud/pubsub_v1/proto/pubsub_pb2_grpc.py @@ -58,6 +58,11 @@ def __init__(self, channel): request_serializer=google_dot_cloud_dot_pubsub__v1_dot_proto_dot_pubsub__pb2.DeleteTopicRequest.SerializeToString, response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, ) + self.DetachSubscription = channel.unary_unary( + "/google.pubsub.v1.Publisher/DetachSubscription", + request_serializer=google_dot_cloud_dot_pubsub__v1_dot_proto_dot_pubsub__pb2.DetachSubscriptionRequest.SerializeToString, + response_deserializer=google_dot_cloud_dot_pubsub__v1_dot_proto_dot_pubsub__pb2.DetachSubscriptionResponse.FromString, + ) class PublisherServicer(object): @@ -105,7 +110,7 @@ def ListTopics(self, request, context): raise NotImplementedError("Method not implemented!") def ListTopicSubscriptions(self, request, context): - """Lists the names of the subscriptions on this topic. + """Lists the names of the attached subscriptions on this topic. """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") @@ -134,6 +139,16 @@ def DeleteTopic(self, request, context): context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") + def DetachSubscription(self, request, context): + """Detaches a subscription from this topic. All messages retained in the + subscription are dropped. Subsequent `Pull` and `StreamingPull` requests + will return FAILED_PRECONDITION. If the subscription is a push + subscription, pushes to the endpoint will stop. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + def add_PublisherServicer_to_server(servicer, server): rpc_method_handlers = { @@ -177,6 +192,11 @@ def add_PublisherServicer_to_server(servicer, server): request_deserializer=google_dot_cloud_dot_pubsub__v1_dot_proto_dot_pubsub__pb2.DeleteTopicRequest.FromString, response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString, ), + "DetachSubscription": grpc.unary_unary_rpc_method_handler( + servicer.DetachSubscription, + request_deserializer=google_dot_cloud_dot_pubsub__v1_dot_proto_dot_pubsub__pb2.DetachSubscriptionRequest.FromString, + response_serializer=google_dot_cloud_dot_pubsub__v1_dot_proto_dot_pubsub__pb2.DetachSubscriptionResponse.SerializeToString, + ), } generic_handler = grpc.method_handlers_generic_handler( "google.pubsub.v1.Publisher", rpc_method_handlers diff --git a/google/cloud/pubsub_v1/publisher/_batch/base.py b/google/cloud/pubsub_v1/publisher/_batch/base.py index 53d3dee5b..212a4b277 100644 --- a/google/cloud/pubsub_v1/publisher/_batch/base.py +++ b/google/cloud/pubsub_v1/publisher/_batch/base.py @@ -109,32 +109,6 @@ def status(self): """ raise NotImplementedError - def will_accept(self, message): - """Return True if the batch is able to accept the message. - - In concurrent implementations, the attributes on the current batch - may be modified by other workers. With this in mind, the caller will - likely want to hold a lock that will make sure the state remains - the same after the "will accept?" question is answered. - - Args: - message (~.pubsub_v1.types.PubsubMessage): The Pub/Sub message. - - Returns: - bool: Whether this batch can accept the message. - """ - # If this batch is not accepting messages generally, return False. - if self.status != BatchStatus.ACCEPTING_MESSAGES: - return False - - # If this message will make the batch exceed the ``max_messages`` - # setting, return False. - if len(self.messages) >= self.settings.max_messages: - return False - - # Okay, everything is good. - return True - def cancel(self, cancellation_reason): """Complete pending futures with an exception. diff --git a/google/cloud/pubsub_v1/publisher/_batch/thread.py b/google/cloud/pubsub_v1/publisher/_batch/thread.py index 73210011d..67c9f2de3 100644 --- a/google/cloud/pubsub_v1/publisher/_batch/thread.py +++ b/google/cloud/pubsub_v1/publisher/_batch/thread.py @@ -333,8 +333,8 @@ def publish(self, message): self._status != base.BatchStatus.ERROR ), "Publish after stop() or publish error." - if not self.will_accept(message): - return future + if self.status != base.BatchStatus.ACCEPTING_MESSAGES: + return size_increase = types.PublishRequest(messages=[message]).ByteSize() diff --git a/google/cloud/pubsub_v1/publisher/client.py b/google/cloud/pubsub_v1/publisher/client.py index caa784407..8dbbea634 100644 --- a/google/cloud/pubsub_v1/publisher/client.py +++ b/google/cloud/pubsub_v1/publisher/client.py @@ -31,9 +31,12 @@ from google.cloud.pubsub_v1 import types from google.cloud.pubsub_v1.gapic import publisher_client from google.cloud.pubsub_v1.gapic.transports import publisher_grpc_transport +from google.cloud.pubsub_v1.publisher import exceptions +from google.cloud.pubsub_v1.publisher import futures from google.cloud.pubsub_v1.publisher._batch import thread from google.cloud.pubsub_v1.publisher._sequencer import ordered_sequencer from google.cloud.pubsub_v1.publisher._sequencer import unordered_sequencer +from google.cloud.pubsub_v1.publisher.flow_controller import FlowController __version__ = pkg_resources.get_distribution("google-cloud-pubsub").version @@ -93,7 +96,11 @@ class Client(object): # Optional publisher_options = pubsub_v1.types.PublisherOptions( - enable_message_ordering=False + enable_message_ordering=False, + flow_control=pubsub_v1.types.PublishFlowControl( + message_limit=2000, + limit_exceeded_behavior=pubsub_v1.types.LimitExceededBehavior.BLOCK, + ), ), # Optional @@ -198,6 +205,9 @@ def __init__(self, batch_settings=(), publisher_options=(), **kwargs): # Thread created to commit all sequencers after a timeout. self._commit_thread = None + # The object controlling the message publishing flow + self._flow_controller = FlowController(self.publisher_options.flow_control) + @classmethod def from_service_account_file(cls, filename, batch_settings=(), **kwargs): """Creates an instance of this client using the provided credentials @@ -364,6 +374,18 @@ def publish(self, topic, data, ordering_key="", **attrs): data=data, ordering_key=ordering_key, attributes=attrs ) + # Messages should go through flow control to prevent excessive + # queuing on the client side (depending on the settings). + try: + self._flow_controller.add(message) + except exceptions.FlowControlLimitError as exc: + future = futures.Future() + future.set_exception(exc) + return future + + def on_publish_done(future): + self._flow_controller.release(message) + with self._batch_lock: if self._is_stopped: raise RuntimeError("Cannot publish on a stopped publisher.") @@ -372,6 +394,7 @@ def publish(self, topic, data, ordering_key="", **attrs): # Delegate the publishing to the sequencer. future = sequencer.publish(message) + future.add_done_callback(on_publish_done) # Create a timer thread if necessary to enforce the batching # timeout. diff --git a/google/cloud/pubsub_v1/publisher/exceptions.py b/google/cloud/pubsub_v1/publisher/exceptions.py index 856be955a..89b3790a0 100644 --- a/google/cloud/pubsub_v1/publisher/exceptions.py +++ b/google/cloud/pubsub_v1/publisher/exceptions.py @@ -38,7 +38,12 @@ def __init__(self, ordering_key): super(PublishToPausedOrderingKeyException, self).__init__() +class FlowControlLimitError(Exception): + """An action resulted in exceeding the flow control limits.""" + + __all__ = ( + "FlowControlLimitError", "MessageTooLargeError", "PublishError", "TimeoutError", diff --git a/google/cloud/pubsub_v1/publisher/flow_controller.py b/google/cloud/pubsub_v1/publisher/flow_controller.py new file mode 100644 index 000000000..c10fadcef --- /dev/null +++ b/google/cloud/pubsub_v1/publisher/flow_controller.py @@ -0,0 +1,297 @@ +# Copyright 2020, Google LLC All rights reserved. +# +# 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. + +from collections import deque +import logging +import threading +import warnings + +from google.cloud.pubsub_v1 import types +from google.cloud.pubsub_v1.publisher import exceptions + + +_LOGGER = logging.getLogger(__name__) + + +class _QuantityReservation(object): + """A (partial) reservation of a quantifiable resource.""" + + def __init__(self, reserved, needed): + self.reserved = reserved + self.needed = needed + + +class FlowController(object): + """A class used to control the flow of messages passing through it. + + Args: + settings (~google.cloud.pubsub_v1.types.PublishFlowControl): + Desired flow control configuration. + """ + + def __init__(self, settings): + self._settings = settings + + # Load statistics. They represent the number of messages added, but not + # yet released (and their total size). + self._message_count = 0 + self._total_bytes = 0 + + # A FIFO queue of threads blocked on adding a message, from first to last. + # Only relevant if the configured limit exceeded behavior is BLOCK. + self._waiting = deque() + + # Reservations of available flow control bytes by the waiting threads. + # Each value is a _QuantityReservation instance. + self._byte_reservations = dict() + self._reserved_bytes = 0 + + # The lock is used to protect all internal state (message and byte count, + # waiting threads to add, etc.). + self._operational_lock = threading.Lock() + + # The condition for blocking the flow if capacity is exceeded. + self._has_capacity = threading.Condition(lock=self._operational_lock) + + def add(self, message): + """Add a message to flow control. + + Adding a message updates the internal load statistics, and an action is + taken if these limits are exceeded (depending on the flow control settings). + + Args: + message (:class:`~google.cloud.pubsub_v1.types.PubsubMessage`): + The message entering the flow control. + + Raises: + :exception:`~pubsub_v1.publisher.exceptions.FlowControlLimitError`: + Raised when the desired action is + :attr:`~google.cloud.pubsub_v1.types.LimitExceededBehavior.ERROR` and + the message would exceed flow control limits, or when the desired action + is :attr:`~google.cloud.pubsub_v1.types.LimitExceededBehavior.BLOCK` and + the message would block forever against the flow control limits. + """ + if self._settings.limit_exceeded_behavior == types.LimitExceededBehavior.IGNORE: + return + + with self._operational_lock: + if not self._would_overflow(message): + self._message_count += 1 + self._total_bytes += message.ByteSize() + return + + # Adding a message would overflow, react. + if ( + self._settings.limit_exceeded_behavior + == types.LimitExceededBehavior.ERROR + ): + # Raising an error means rejecting a message, thus we do not + # add anything to the existing load, but we do report the would-be + # load if we accepted the message. + load_info = self._load_info( + message_count=self._message_count + 1, + total_bytes=self._total_bytes + message.ByteSize(), + ) + error_msg = "Flow control limits would be exceeded - {}.".format( + load_info + ) + raise exceptions.FlowControlLimitError(error_msg) + + assert ( + self._settings.limit_exceeded_behavior + == types.LimitExceededBehavior.BLOCK + ) + + # Sanity check - if a message exceeds total flow control limits all + # by itself, it would block forever, thus raise error. + if ( + message.ByteSize() > self._settings.byte_limit + or self._settings.message_limit < 1 + ): + load_info = self._load_info( + message_count=1, total_bytes=message.ByteSize() + ) + error_msg = ( + "Total flow control limits too low for the message, " + "would block forever - {}.".format(load_info) + ) + raise exceptions.FlowControlLimitError(error_msg) + + current_thread = threading.current_thread() + + while self._would_overflow(message): + if current_thread not in self._byte_reservations: + self._waiting.append(current_thread) + self._byte_reservations[current_thread] = _QuantityReservation( + reserved=0, needed=message.ByteSize() + ) + + _LOGGER.debug( + "Blocking until there is enough free capacity in the flow - " + "{}.".format(self._load_info()) + ) + + self._has_capacity.wait() + + _LOGGER.debug( + "Woke up from waiting on free capacity in the flow - " + "{}.".format(self._load_info()) + ) + + # Message accepted, increase the load and remove thread stats. + self._message_count += 1 + self._total_bytes += message.ByteSize() + self._reserved_bytes -= self._byte_reservations[current_thread].reserved + del self._byte_reservations[current_thread] + self._waiting.remove(current_thread) + + def release(self, message): + """Release a mesage from flow control. + + Args: + message (:class:`~google.cloud.pubsub_v1.types.PubsubMessage`): + The message entering the flow control. + """ + if self._settings.limit_exceeded_behavior == types.LimitExceededBehavior.IGNORE: + return + + with self._operational_lock: + # Releasing a message decreases the load. + self._message_count -= 1 + self._total_bytes -= message.ByteSize() + + if self._message_count < 0 or self._total_bytes < 0: + warnings.warn( + "Releasing a message that was never added or already released.", + category=RuntimeWarning, + stacklevel=2, + ) + self._message_count = max(0, self._message_count) + self._total_bytes = max(0, self._total_bytes) + + self._distribute_available_bytes() + + # If at least one thread waiting to add() can be unblocked, wake them up. + if self._ready_to_unblock(): + _LOGGER.debug("Notifying threads waiting to add messages to flow.") + self._has_capacity.notify_all() + + def _distribute_available_bytes(self): + """Distribute availalbe free capacity among the waiting threads in FIFO order. + + The method assumes that the caller has obtained ``_operational_lock``. + """ + available = self._settings.byte_limit - self._total_bytes - self._reserved_bytes + + for thread in self._waiting: + if available <= 0: + break + + reservation = self._byte_reservations[thread] + still_needed = reservation.needed - reservation.reserved + + # Sanity check for any internal inconsistencies. + if still_needed < 0: + msg = "Too many bytes reserved: {} / {}".format( + reservation.reserved, reservation.needed + ) + warnings.warn(msg, category=RuntimeWarning) + still_needed = 0 + + can_give = min(still_needed, available) + reservation.reserved += can_give + self._reserved_bytes += can_give + available -= can_give + + def _ready_to_unblock(self): + """Determine if any of the threads waiting to add a message can proceed. + + The method assumes that the caller has obtained ``_operational_lock``. + + Returns: + bool + """ + if self._waiting: + # It's enough to only check the head of the queue, because FIFO + # distribution of any free capacity. + reservation = self._byte_reservations[self._waiting[0]] + return ( + reservation.reserved >= reservation.needed + and self._message_count < self._settings.message_limit + ) + + return False + + def _would_overflow(self, message): + """Determine if accepting a message would exceed flow control limits. + + The method assumes that the caller has obtained ``_operational_lock``. + + Args: + message (:class:`~google.cloud.pubsub_v1.types.PubsubMessage`): + The message entering the flow control. + + Returns: + bool + """ + reservation = self._byte_reservations.get(threading.current_thread()) + + if reservation: + enough_reserved = reservation.reserved >= reservation.needed + else: + enough_reserved = False + + bytes_taken = self._total_bytes + self._reserved_bytes + message.ByteSize() + size_overflow = bytes_taken > self._settings.byte_limit and not enough_reserved + msg_count_overflow = self._message_count + 1 > self._settings.message_limit + + return size_overflow or msg_count_overflow + + def _load_info(self, message_count=None, total_bytes=None, reserved_bytes=None): + """Return the current flow control load information. + + The caller can optionally adjust some of the values to fit its reporting + needs. + + The method assumes that the caller has obtained ``_operational_lock``. + + Args: + message_count (Optional[int]): + The value to override the current message count with. + total_bytes (Optional[int]): + The value to override the current total bytes with. + reserved_bytes (Optional[int]): + The value to override the current number of reserved bytes with. + + Returns: + str + """ + msg = "messages: {} / {}, bytes: {} / {} (reserved: {})" + + if message_count is None: + message_count = self._message_count + + if total_bytes is None: + total_bytes = self._total_bytes + + if reserved_bytes is None: + reserved_bytes = self._reserved_bytes + + return msg.format( + message_count, + self._settings.message_limit, + total_bytes, + self._settings.byte_limit, + reserved_bytes, + ) diff --git a/google/cloud/pubsub_v1/subscriber/client.py b/google/cloud/pubsub_v1/subscriber/client.py index 718e69083..00c8f2498 100644 --- a/google/cloud/pubsub_v1/subscriber/client.py +++ b/google/cloud/pubsub_v1/subscriber/client.py @@ -223,7 +223,8 @@ def callback(message): inundated with too many messages at once. scheduler (~google.cloud.pubsub_v1.subscriber.scheduler.Scheduler): An optional *scheduler* to use when executing the callback. This controls - how callbacks are executed concurrently. + how callbacks are executed concurrently. This object must not be shared + across multiple SubscriberClients. Returns: A :class:`~google.cloud.pubsub_v1.subscriber.futures.StreamingPullFuture` diff --git a/google/cloud/pubsub_v1/subscriber/scheduler.py b/google/cloud/pubsub_v1/subscriber/scheduler.py index 42674c824..ef2ef59cb 100644 --- a/google/cloud/pubsub_v1/subscriber/scheduler.py +++ b/google/cloud/pubsub_v1/subscriber/scheduler.py @@ -74,7 +74,8 @@ def _make_default_thread_pool_executor(): class ThreadScheduler(Scheduler): - """A thread pool-based scheduler. + """A thread pool-based scheduler. It must not be shared across + SubscriberClients. This scheduler is useful in typical I/O-bound message processing. diff --git a/google/cloud/pubsub_v1/types.py b/google/cloud/pubsub_v1/types.py index eb4f00681..b52b3ea60 100644 --- a/google/cloud/pubsub_v1/types.py +++ b/google/cloud/pubsub_v1/types.py @@ -13,7 +13,9 @@ # limitations under the License. from __future__ import absolute_import + import collections +import enum import sys from google.api import http_pb2 @@ -30,25 +32,6 @@ from google.cloud.pubsub_v1.proto import pubsub_pb2 -# Define the default publisher options. -# -# This class is used when creating a publisher client to pass in options -# to enable/disable features. -PublisherOptions = collections.namedtuple( - "PublisherConfig", ["enable_message_ordering"] -) -PublisherOptions.__new__.__defaults__ = (False,) # enable_message_ordering: False - -if sys.version_info >= (3, 5): - PublisherOptions.__doc__ = "The options for the publisher client." - PublisherOptions.enable_message_ordering.__doc__ = ( - "Whether to order messages in a batch by a supplied ordering key." - "EXPERIMENTAL: Message ordering is an alpha feature that requires " - "special permissions to use. Please contact the Cloud Pub/Sub team for " - "more information." - ) - - # Define the default values for batching. # # This class is used when creating a publisher or subscriber client, and @@ -81,6 +64,63 @@ ) +class LimitExceededBehavior(str, enum.Enum): + """The possible actions when exceeding the publish flow control limits.""" + + IGNORE = "ignore" + BLOCK = "block" + ERROR = "error" + + +PublishFlowControl = collections.namedtuple( + "PublishFlowControl", ["message_limit", "byte_limit", "limit_exceeded_behavior"] +) +PublishFlowControl.__new__.__defaults__ = ( + 10 * BatchSettings.__new__.__defaults__[2], # message limit + 10 * BatchSettings.__new__.__defaults__[0], # byte limit + LimitExceededBehavior.IGNORE, # desired behavior +) + +if sys.version_info >= (3, 5): + PublishFlowControl.__doc__ = ( + "The client flow control settings for message publishing." + ) + PublishFlowControl.message_limit.__doc__ = ( + "The maximum number of messages awaiting to be published." + ) + PublishFlowControl.byte_limit.__doc__ = ( + "The maximum total size of messages awaiting to be published." + ) + PublishFlowControl.limit_exceeded_behavior.__doc__ = ( + "The action to take when publish flow control limits are exceeded." + ) + +# Define the default publisher options. +# +# This class is used when creating a publisher client to pass in options +# to enable/disable features. +PublisherOptions = collections.namedtuple( + "PublisherConfig", ["enable_message_ordering", "flow_control"] +) +PublisherOptions.__new__.__defaults__ = ( + False, # enable_message_ordering: False + PublishFlowControl(), # default flow control settings +) + +if sys.version_info >= (3, 5): + PublisherOptions.__doc__ = "The options for the publisher client." + PublisherOptions.enable_message_ordering.__doc__ = ( + "Whether to order messages in a batch by a supplied ordering key." + "EXPERIMENTAL: Message ordering is an alpha feature that requires " + "special permissions to use. Please contact the Cloud Pub/Sub team for " + "more information." + ) + PublisherOptions.flow_control.__doc__ = ( + "Flow control settings for message publishing by the client. By default " + "the publisher client does not do any throttling." + ) + + # Define the type class and default values for flow control settings. # # This class is used when creating a publisher or subscriber client, and diff --git a/noxfile.py b/noxfile.py index 751b0e044..cf7a6e978 100644 --- a/noxfile.py +++ b/noxfile.py @@ -26,11 +26,12 @@ BLACK_VERSION = "black==19.3b0" BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] -if os.path.exists("samples"): - BLACK_PATHS.append("samples") +DEFAULT_PYTHON_VERSION = "3.7" +SYSTEM_TEST_PYTHON_VERSIONS = ["2.7", "3.7"] +UNIT_TEST_PYTHON_VERSIONS = ["2.7", "3.5", "3.6", "3.7", "3.8"] -@nox.session(python="3.7") +@nox.session(python=DEFAULT_PYTHON_VERSION) def lint(session): """Run linters. @@ -56,7 +57,7 @@ def blacken(session): session.run("black", *BLACK_PATHS) -@nox.session(python="3.7") +@nox.session(python=DEFAULT_PYTHON_VERSION) def lint_setup_py(session): """Verify that setup.py is valid (including RST check).""" session.install("docutils", "pygments") @@ -84,13 +85,13 @@ def default(session): ) -@nox.session(python=["2.7", "3.5", "3.6", "3.7", "3.8"]) +@nox.session(python=UNIT_TEST_PYTHON_VERSIONS) def unit(session): """Run the unit test suite.""" default(session) -@nox.session(python=["2.7", "3.7"]) +@nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS) def system(session): """Run the system test suite.""" system_test_path = os.path.join("tests", "system.py") @@ -120,7 +121,7 @@ def system(session): session.run("py.test", "--quiet", system_test_folder_path, *session.posargs) -@nox.session(python="3.7") +@nox.session(python=DEFAULT_PYTHON_VERSION) def cover(session): """Run the final coverage report. @@ -133,12 +134,12 @@ def cover(session): session.run("coverage", "erase") -@nox.session(python="3.7") +@nox.session(python=DEFAULT_PYTHON_VERSION) def docs(session): """Build the docs for this library.""" session.install("-e", ".") - session.install("sphinx<3.0.0", "alabaster", "recommonmark") + session.install("sphinx", "alabaster", "recommonmark") shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True) session.run( diff --git a/scripts/decrypt-secrets.sh b/scripts/decrypt-secrets.sh new file mode 100755 index 000000000..ff599eb2a --- /dev/null +++ b/scripts/decrypt-secrets.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +# Copyright 2015 Google Inc. All rights reserved. +# +# 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. + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +ROOT=$( dirname "$DIR" ) + +# Work from the project root. +cd $ROOT + +# Use SECRET_MANAGER_PROJECT if set, fallback to cloud-devrel-kokoro-resources. +PROJECT_ID="${SECRET_MANAGER_PROJECT:-cloud-devrel-kokoro-resources}" + +gcloud secrets versions access latest --secret="python-docs-samples-test-env" \ + > testing/test-env.sh +gcloud secrets versions access latest \ + --secret="python-docs-samples-service-account" \ + > testing/service-account.json +gcloud secrets versions access latest \ + --secret="python-docs-samples-client-secrets" \ + > testing/client-secrets.json \ No newline at end of file diff --git a/scripts/readme-gen/readme_gen.py b/scripts/readme-gen/readme_gen.py new file mode 100644 index 000000000..d309d6e97 --- /dev/null +++ b/scripts/readme-gen/readme_gen.py @@ -0,0 +1,66 @@ +#!/usr/bin/env python + +# Copyright 2016 Google Inc +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Generates READMEs using configuration defined in yaml.""" + +import argparse +import io +import os +import subprocess + +import jinja2 +import yaml + + +jinja_env = jinja2.Environment( + trim_blocks=True, + loader=jinja2.FileSystemLoader( + os.path.abspath(os.path.join(os.path.dirname(__file__), 'templates')))) + +README_TMPL = jinja_env.get_template('README.tmpl.rst') + + +def get_help(file): + return subprocess.check_output(['python', file, '--help']).decode() + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('source') + parser.add_argument('--destination', default='README.rst') + + args = parser.parse_args() + + source = os.path.abspath(args.source) + root = os.path.dirname(source) + destination = os.path.join(root, args.destination) + + jinja_env.globals['get_help'] = get_help + + with io.open(source, 'r') as f: + config = yaml.load(f) + + # This allows get_help to execute in the right directory. + os.chdir(root) + + output = README_TMPL.render(config) + + with io.open(destination, 'w') as f: + f.write(output) + + +if __name__ == '__main__': + main() diff --git a/scripts/readme-gen/templates/README.tmpl.rst b/scripts/readme-gen/templates/README.tmpl.rst new file mode 100644 index 000000000..4fd239765 --- /dev/null +++ b/scripts/readme-gen/templates/README.tmpl.rst @@ -0,0 +1,87 @@ +{# The following line is a lie. BUT! Once jinja2 is done with it, it will + become truth! #} +.. This file is automatically generated. Do not edit this file directly. + +{{product.name}} Python Samples +=============================================================================== + +.. image:: https://gstatic.com/cloudssh/images/open-btn.png + :target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor={{folder}}/README.rst + + +This directory contains samples for {{product.name}}. {{product.description}} + +{{description}} + +.. _{{product.name}}: {{product.url}} + +{% if required_api_url %} +To run the sample, you need to enable the API at: {{required_api_url}} +{% endif %} + +{% if required_role %} +To run the sample, you need to have `{{required_role}}` role. +{% endif %} + +{{other_required_steps}} + +{% if setup %} +Setup +------------------------------------------------------------------------------- + +{% for section in setup %} + +{% include section + '.tmpl.rst' %} + +{% endfor %} +{% endif %} + +{% if samples %} +Samples +------------------------------------------------------------------------------- + +{% for sample in samples %} +{{sample.name}} ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +{% if not sample.hide_cloudshell_button %} +.. image:: https://gstatic.com/cloudssh/images/open-btn.png + :target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor={{folder}}/{{sample.file}},{{folder}}/README.rst +{% endif %} + + +{{sample.description}} + +To run this sample: + +.. code-block:: bash + + $ python {{sample.file}} +{% if sample.show_help %} + + {{get_help(sample.file)|indent}} +{% endif %} + + +{% endfor %} +{% endif %} + +{% if cloud_client_library %} + +The client library +------------------------------------------------------------------------------- + +This sample uses the `Google Cloud Client Library for Python`_. +You can read the documentation for more details on API usage and use GitHub +to `browse the source`_ and `report issues`_. + +.. _Google Cloud Client Library for Python: + https://googlecloudplatform.github.io/google-cloud-python/ +.. _browse the source: + https://github.com/GoogleCloudPlatform/google-cloud-python +.. _report issues: + https://github.com/GoogleCloudPlatform/google-cloud-python/issues + +{% endif %} + +.. _Google Cloud SDK: https://cloud.google.com/sdk/ \ No newline at end of file diff --git a/scripts/readme-gen/templates/auth.tmpl.rst b/scripts/readme-gen/templates/auth.tmpl.rst new file mode 100644 index 000000000..1446b94a5 --- /dev/null +++ b/scripts/readme-gen/templates/auth.tmpl.rst @@ -0,0 +1,9 @@ +Authentication +++++++++++++++ + +This sample requires you to have authentication setup. Refer to the +`Authentication Getting Started Guide`_ for instructions on setting up +credentials for applications. + +.. _Authentication Getting Started Guide: + https://cloud.google.com/docs/authentication/getting-started diff --git a/scripts/readme-gen/templates/auth_api_key.tmpl.rst b/scripts/readme-gen/templates/auth_api_key.tmpl.rst new file mode 100644 index 000000000..11957ce27 --- /dev/null +++ b/scripts/readme-gen/templates/auth_api_key.tmpl.rst @@ -0,0 +1,14 @@ +Authentication +++++++++++++++ + +Authentication for this service is done via an `API Key`_. To obtain an API +Key: + +1. Open the `Cloud Platform Console`_ +2. Make sure that billing is enabled for your project. +3. From the **Credentials** page, create a new **API Key** or use an existing + one for your project. + +.. _API Key: + https://developers.google.com/api-client-library/python/guide/aaa_apikeys +.. _Cloud Console: https://console.cloud.google.com/project?_ diff --git a/scripts/readme-gen/templates/install_deps.tmpl.rst b/scripts/readme-gen/templates/install_deps.tmpl.rst new file mode 100644 index 000000000..a0406dba8 --- /dev/null +++ b/scripts/readme-gen/templates/install_deps.tmpl.rst @@ -0,0 +1,29 @@ +Install Dependencies +++++++++++++++++++++ + +#. Clone python-docs-samples and change directory to the sample directory you want to use. + + .. code-block:: bash + + $ git clone https://github.com/GoogleCloudPlatform/python-docs-samples.git + +#. Install `pip`_ and `virtualenv`_ if you do not already have them. You may want to refer to the `Python Development Environment Setup Guide`_ for Google Cloud Platform for instructions. + + .. _Python Development Environment Setup Guide: + https://cloud.google.com/python/setup + +#. Create a virtualenv. Samples are compatible with Python 2.7 and 3.4+. + + .. code-block:: bash + + $ virtualenv env + $ source env/bin/activate + +#. Install the dependencies needed to run the samples. + + .. code-block:: bash + + $ pip install -r requirements.txt + +.. _pip: https://pip.pypa.io/ +.. _virtualenv: https://virtualenv.pypa.io/ diff --git a/scripts/readme-gen/templates/install_portaudio.tmpl.rst b/scripts/readme-gen/templates/install_portaudio.tmpl.rst new file mode 100644 index 000000000..5ea33d18c --- /dev/null +++ b/scripts/readme-gen/templates/install_portaudio.tmpl.rst @@ -0,0 +1,35 @@ +Install PortAudio ++++++++++++++++++ + +Install `PortAudio`_. This is required by the `PyAudio`_ library to stream +audio from your computer's microphone. PyAudio depends on PortAudio for cross-platform compatibility, and is installed differently depending on the +platform. + +* For Mac OS X, you can use `Homebrew`_:: + + brew install portaudio + + **Note**: if you encounter an error when running `pip install` that indicates + it can't find `portaudio.h`, try running `pip install` with the following + flags:: + + pip install --global-option='build_ext' \ + --global-option='-I/usr/local/include' \ + --global-option='-L/usr/local/lib' \ + pyaudio + +* For Debian / Ubuntu Linux:: + + apt-get install portaudio19-dev python-all-dev + +* Windows may work without having to install PortAudio explicitly (it will get + installed with PyAudio). + +For more details, see the `PyAudio installation`_ page. + + +.. _PyAudio: https://people.csail.mit.edu/hubert/pyaudio/ +.. _PortAudio: http://www.portaudio.com/ +.. _PyAudio installation: + https://people.csail.mit.edu/hubert/pyaudio/#downloads +.. _Homebrew: http://brew.sh diff --git a/setup.py b/setup.py index 414e7620b..83fa16560 100644 --- a/setup.py +++ b/setup.py @@ -22,17 +22,17 @@ name = "google-cloud-pubsub" description = "Google Cloud Pub/Sub API client library" -version = "1.5.0" +version = "1.6.0" # Should be one of: # 'Development Status :: 3 - Alpha' # 'Development Status :: 4 - Beta' # 'Development Status :: 5 - Production/Stable' release_status = "Development Status :: 5 - Production/Stable" dependencies = [ - # google-api-core[grpc] 1.17.0 causes problems, thus restricting its - # version until the issue gets fixed. + # google-api-core[grpc] 1.17.0 up to 1.19.1 causes problems with stream + # recovery, thus those versions should not be used. # https://github.com/googleapis/python-pubsub/issues/74 - "google-api-core[grpc] >= 1.14.0, < 1.17.0", + "google-api-core[grpc] >= 1.14.0, != 1.17.*, != 1.18.*, != 1.19.*", "grpc-google-iam-v1 >= 0.12.3, < 0.13dev", 'enum34; python_version < "3.4"', ] diff --git a/synth.metadata b/synth.metadata index f48ab4626..da86b45aa 100644 --- a/synth.metadata +++ b/synth.metadata @@ -1,39 +1,32 @@ { "sources": [ - { - "generator": { - "name": "artman", - "version": "2.0.0", - "dockerImage": "googleapis/artman@sha256:b3b47805231a305d0f40c4bf069df20f6a2635574e6d4259fac651d3f9f6e098" - } - }, { "git": { "name": ".", "remote": "https://github.com/googleapis/python-pubsub.git", - "sha": "4ce898e80eeb16b18d1ee29c678ade149804d186" + "sha": "06085c4083b9dccdd50383257799904510bbf3a0" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "42ee97c1b93a0e3759bbba3013da309f670a90ab", - "internalRef": "307114445" + "sha": "86285bbd54fbf9708838219e3422aa47fb8fc0b0", + "internalRef": "314795690" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "f5e4c17dc78a966dbf29961dd01f9bbd63e20a04" + "sha": "973fec811e9203b4c147121a26f1484841c465fd" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "f5e4c17dc78a966dbf29961dd01f9bbd63e20a04" + "sha": "973fec811e9203b4c147121a26f1484841c465fd" } } ], @@ -44,8 +37,7 @@ "apiName": "pubsub", "apiVersion": "v1", "language": "python", - "generator": "gapic", - "config": "google/pubsub/artman_pubsub.yaml" + "generator": "bazel" } } ] diff --git a/synth.py b/synth.py index 645b7955b..b44cc0acf 100644 --- a/synth.py +++ b/synth.py @@ -14,6 +14,8 @@ """This script is used to synthesize generated parts of this library.""" +import textwrap + import synthtool as s from synthtool import gcp @@ -183,6 +185,82 @@ def _merge_dict(d1, d2): "from google.iam.v1 import iam_policy_pb2_grpc as iam_policy_pb2", ) +# Monkey patch the streaming_pull() GAPIC method to disable pre-fetching stream +# results. +s.replace( + "google/cloud/pubsub_v1/gapic/subscriber_client.py", + r"return self\._inner_api_calls\['streaming_pull'\]\(.*", + """ + # Wrappers in api-core should not automatically pre-fetch the first + # stream result, as this breaks the stream when re-opening it. + # https://github.com/googleapis/python-pubsub/issues/93#issuecomment-630762257 + self.transport.streaming_pull._prefetch_first_result_ = False + + \g<0>""" +) + +# Add missing blank line before Attributes: in generated docstrings +# https://github.com/googleapis/protoc-docs-plugin/pull/31 +s.replace( + "google/cloud/pubsub_v1/proto/pubsub_pb2.py", + "(\s+)Attributes:", + "\n\g<1>Attributes:" +) + +# Fix incomplete docstring examples. +s.replace( + "google/cloud/pubsub_v1/gapic/subscriber_client.py", + r"\s+>>> subscription = \{'ack_deadline_seconds': ack_deadline_seconds\}", + textwrap.indent( + """ +>>> subscription_name = 'projects/my-project/subscriptions/my-subscription' +>>> subscription = { +... 'name': subscription_name, +... 'ack_deadline_seconds': ack_deadline_seconds, +... }""", + prefix=" " * 12, + ) +) + +s.replace( + "google/cloud/pubsub_v1/gapic/subscriber_client.py", + r"\s+>>> snapshot = \{'expire_time': expire_time\}", + textwrap.indent( + """ +>>> snapshot_name = 'projects/my-project/snapshots/my-snapshot' +>>> snapshot = { +... 'name': snapshot_name, +... 'expire_time': expire_time, +... }""", + prefix=" " * 12, + ) +) + +s.replace( + "google/cloud/pubsub_v1/gapic/publisher_client.py", + r"\s+>>> # TODO: Initialize `topic`:\n\s+>>> topic = \{\}\n", + textwrap.indent( + """ +>>> topic_name = 'projects/my-project/topics/my-topic' +>>> topic_labels = {'source': 'external'} +>>> topic = {'name': topic_name, 'labels': topic_labels} +""", + prefix=" " * 12, + ), +) + +s.replace( + "google/cloud/pubsub_v1/gapic/publisher_client.py", + r"\s+>>> # TODO: Initialize `update_mask`:\n\s+>>> update_mask = \{\}\n", + textwrap.indent( + """ +>>> paths_element = 'labels' +>>> paths = [paths_element] +>>> update_mask = {'paths': paths} +""", + prefix=" " * 12, + ), +) # ---------------------------------------------------------------------------- # Add templated files diff --git a/testing/.gitignore b/testing/.gitignore new file mode 100644 index 000000000..b05fbd630 --- /dev/null +++ b/testing/.gitignore @@ -0,0 +1,3 @@ +test-env.sh +service-account.json +client-secrets.json \ No newline at end of file diff --git a/tests/unit/gapic/v1/test_publisher_client_v1.py b/tests/unit/gapic/v1/test_publisher_client_v1.py index 4fad76b78..ad4f38d8b 100644 --- a/tests/unit/gapic/v1/test_publisher_client_v1.py +++ b/tests/unit/gapic/v1/test_publisher_client_v1.py @@ -519,3 +519,42 @@ def test_test_iam_permissions_exception(self): with pytest.raises(CustomException): client.test_iam_permissions(resource, permissions) + + def test_detach_subscription(self): + # Setup Expected Response + expected_response = {} + expected_response = pubsub_pb2.DetachSubscriptionResponse(**expected_response) + + # Mock the API response + channel = ChannelStub(responses=[expected_response]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + client = publisher_client.PublisherClient() + + # Setup Request + subscription = client.subscription_path("[PROJECT]", "[SUBSCRIPTION]") + + response = client.detach_subscription(subscription) + assert expected_response == response + + assert len(channel.requests) == 1 + expected_request = pubsub_pb2.DetachSubscriptionRequest( + subscription=subscription + ) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_detach_subscription_exception(self): + # Mock the API response + channel = ChannelStub(responses=[CustomException()]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + client = publisher_client.PublisherClient() + + # Setup request + subscription = client.subscription_path("[PROJECT]", "[SUBSCRIPTION]") + + with pytest.raises(CustomException): + client.detach_subscription(subscription) diff --git a/tests/unit/gapic/v1/test_subscriber_client_v1.py b/tests/unit/gapic/v1/test_subscriber_client_v1.py index 4e34e1905..b059214d7 100644 --- a/tests/unit/gapic/v1/test_subscriber_client_v1.py +++ b/tests/unit/gapic/v1/test_subscriber_client_v1.py @@ -78,6 +78,7 @@ def test_create_subscription(self): retain_acked_messages = False enable_message_ordering = True filter_ = "filter-1274492040" + detached = True expected_response = { "name": name_2, "topic": topic_2, @@ -85,6 +86,7 @@ def test_create_subscription(self): "retain_acked_messages": retain_acked_messages, "enable_message_ordering": enable_message_ordering, "filter": filter_, + "detached": detached, } expected_response = pubsub_pb2.Subscription(**expected_response) @@ -130,6 +132,7 @@ def test_get_subscription(self): retain_acked_messages = False enable_message_ordering = True filter_ = "filter-1274492040" + detached = True expected_response = { "name": name, "topic": topic, @@ -137,6 +140,7 @@ def test_get_subscription(self): "retain_acked_messages": retain_acked_messages, "enable_message_ordering": enable_message_ordering, "filter": filter_, + "detached": detached, } expected_response = pubsub_pb2.Subscription(**expected_response) @@ -180,6 +184,7 @@ def test_update_subscription(self): retain_acked_messages = False enable_message_ordering = True filter_ = "filter-1274492040" + detached = True expected_response = { "name": name, "topic": topic, @@ -187,6 +192,7 @@ def test_update_subscription(self): "retain_acked_messages": retain_acked_messages, "enable_message_ordering": enable_message_ordering, "filter": filter_, + "detached": detached, } expected_response = pubsub_pb2.Subscription(**expected_response) diff --git a/tests/unit/pubsub_v1/publisher/batch/test_base.py b/tests/unit/pubsub_v1/publisher/batch/test_base.py index 96f18451d..f10b54ee5 100644 --- a/tests/unit/pubsub_v1/publisher/batch/test_base.py +++ b/tests/unit/pubsub_v1/publisher/batch/test_base.py @@ -46,33 +46,3 @@ def test_len(): assert len(batch) == 0 batch.publish(types.PubsubMessage(data=b"foo")) assert len(batch) == 1 - - -def test_will_accept(): - batch = create_batch(status=BatchStatus.ACCEPTING_MESSAGES) - message = types.PubsubMessage() - assert batch.will_accept(message) is True - - -def test_will_accept_oversize(): - batch = create_batch( - settings=types.BatchSettings(max_bytes=10), - status=BatchStatus.ACCEPTING_MESSAGES, - ) - message = types.PubsubMessage(data=b"abcdefghijklmnopqrstuvwxyz") - assert batch.will_accept(message) is True - - -def test_will_not_accept_status(): - batch = create_batch(status="talk to the hand") - message = types.PubsubMessage() - assert batch.will_accept(message) is False - - -def test_will_not_accept_number(): - batch = create_batch( - settings=types.BatchSettings(max_messages=-1), - status=BatchStatus.ACCEPTING_MESSAGES, - ) - message = types.PubsubMessage(data=b"abc") - assert batch.will_accept(message) is False diff --git a/tests/unit/pubsub_v1/publisher/batch/test_thread.py b/tests/unit/pubsub_v1/publisher/batch/test_thread.py index ce288a48e..e9d2b09c0 100644 --- a/tests/unit/pubsub_v1/publisher/batch/test_thread.py +++ b/tests/unit/pubsub_v1/publisher/batch/test_thread.py @@ -287,18 +287,56 @@ def test_publish_updating_batch_size(): assert batch.size > 0 # I do not always trust protobuf. -def test_publish_not_will_accept(): +def test_publish(): + batch = create_batch() + message = types.PubsubMessage() + future = batch.publish(message) + + assert len(batch.messages) == 1 + assert batch._futures == [future] + + +def test_publish_max_messages_zero(): batch = create_batch(topic="topic_foo", max_messages=0) - base_request_size = types.PublishRequest(topic="topic_foo").ByteSize() - # Publish the message. message = types.PubsubMessage(data=b"foobarbaz") + with mock.patch.object(batch, "commit") as commit: + future = batch.publish(message) + + assert future is not None + assert len(batch.messages) == 1 + assert batch._futures == [future] + commit.assert_called_once() + + +def test_publish_max_messages_enforced(): + batch = create_batch(topic="topic_foo", max_messages=1) + + message = types.PubsubMessage(data=b"foobarbaz") + message2 = types.PubsubMessage(data=b"foobarbaz2") + + future = batch.publish(message) + future2 = batch.publish(message2) + + assert future is not None + assert future2 is None + assert len(batch.messages) == 1 + assert len(batch._futures) == 1 + + +def test_publish_max_bytes_enforced(): + batch = create_batch(topic="topic_foo", max_bytes=15) + + message = types.PubsubMessage(data=b"foobarbaz") + message2 = types.PubsubMessage(data=b"foobarbaz2") + future = batch.publish(message) + future2 = batch.publish(message2) - assert future is None - assert batch.size == base_request_size - assert batch.messages == [] - assert batch._futures == [] + assert future is not None + assert future2 is None + assert len(batch.messages) == 1 + assert len(batch._futures) == 1 def test_publish_exceed_max_messages(): diff --git a/tests/unit/pubsub_v1/publisher/test_flow_controller.py b/tests/unit/pubsub_v1/publisher/test_flow_controller.py new file mode 100644 index 000000000..26a61663b --- /dev/null +++ b/tests/unit/pubsub_v1/publisher/test_flow_controller.py @@ -0,0 +1,409 @@ +# Copyright 2020, Google LLC All rights reserved. +# +# 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. + +from __future__ import absolute_import + +import threading +import time +import warnings + +import pytest + +from google.cloud.pubsub_v1 import types +from google.cloud.pubsub_v1.publisher import exceptions +from google.cloud.pubsub_v1.publisher.flow_controller import FlowController + + +def _run_in_daemon( + flow_controller, + action, + messages, + all_done_event, + error_event=None, + action_pause=None, +): + """Run flow controller action (add or remove messages) in a daemon thread. + """ + assert action in ("add", "release") + + def run_me(): + method = getattr(flow_controller, action) + + try: + for msg in messages: + if action_pause is not None: + time.sleep(action_pause) + method(msg) + except Exception: + if error_event is not None: + error_event.set() + else: + all_done_event.set() + + thread = threading.Thread(target=run_me) + thread.daemon = True + thread.start() + + +def test_no_overflow_no_error(): + settings = types.PublishFlowControl( + message_limit=100, + byte_limit=10000, + limit_exceeded_behavior=types.LimitExceededBehavior.ERROR, + ) + flow_controller = FlowController(settings) + + # there should be no errors + for data in (b"foo", b"bar", b"baz"): + msg = types.PubsubMessage(data=data) + flow_controller.add(msg) + + +def test_overflow_no_error_on_ignore(): + settings = types.PublishFlowControl( + message_limit=1, + byte_limit=2, + limit_exceeded_behavior=types.LimitExceededBehavior.IGNORE, + ) + flow_controller = FlowController(settings) + + # there should be no overflow errors + flow_controller.add(types.PubsubMessage(data=b"foo")) + flow_controller.add(types.PubsubMessage(data=b"bar")) + + +def test_message_count_overflow_error(): + settings = types.PublishFlowControl( + message_limit=1, + byte_limit=10000, + limit_exceeded_behavior=types.LimitExceededBehavior.ERROR, + ) + flow_controller = FlowController(settings) + + flow_controller.add(types.PubsubMessage(data=b"foo")) + with pytest.raises(exceptions.FlowControlLimitError) as error: + flow_controller.add(types.PubsubMessage(data=b"bar")) + + assert "messages: 2 / 1" in str(error.value) + + +def test_byte_size_overflow_error(): + settings = types.PublishFlowControl( + message_limit=10000, + byte_limit=199, + limit_exceeded_behavior=types.LimitExceededBehavior.ERROR, + ) + flow_controller = FlowController(settings) + + # Since the message data itself occupies 100 bytes, it means that both + # messages combined will exceed the imposed byte limit of 199, but a single + # message will not (the message size overhead is way lower than data size). + msg1 = types.PubsubMessage(data=b"x" * 100) + msg2 = types.PubsubMessage(data=b"y" * 100) + + flow_controller.add(msg1) + with pytest.raises(exceptions.FlowControlLimitError) as error: + flow_controller.add(msg2) + + total_size = msg1.ByteSize() + msg2.ByteSize() + expected_info = "bytes: {} / 199".format(total_size) + assert expected_info in str(error.value) + + +def test_no_error_on_moderate_message_flow(): + settings = types.PublishFlowControl( + message_limit=2, + byte_limit=250, + limit_exceeded_behavior=types.LimitExceededBehavior.ERROR, + ) + flow_controller = FlowController(settings) + + msg1 = types.PubsubMessage(data=b"x" * 100) + msg2 = types.PubsubMessage(data=b"y" * 100) + msg3 = types.PubsubMessage(data=b"z" * 100) + + # The flow control settings will accept two in-flight messages, but not three. + # If releasing messages works correctly, the sequence below will not raise errors. + flow_controller.add(msg1) + flow_controller.add(msg2) + flow_controller.release(msg1) + flow_controller.add(msg3) + flow_controller.release(msg2) + flow_controller.release(msg3) + + +def test_rejected_messages_do_not_increase_total_load(): + settings = types.PublishFlowControl( + message_limit=1, + byte_limit=150, + limit_exceeded_behavior=types.LimitExceededBehavior.ERROR, + ) + flow_controller = FlowController(settings) + + msg1 = types.PubsubMessage(data=b"x" * 100) + msg2 = types.PubsubMessage(data=b"y" * 100) + + flow_controller.add(msg1) + + for _ in range(5): + with pytest.raises(exceptions.FlowControlLimitError): + flow_controller.add(types.PubsubMessage(data=b"z" * 100)) + + # After releasing a message we should again be able to add another one, despite + # previously trying to add a lot of other messages. + flow_controller.release(msg1) + flow_controller.add(msg2) + + +def test_incorrectly_releasing_too_many_messages(): + settings = types.PublishFlowControl( + message_limit=1, + byte_limit=150, + limit_exceeded_behavior=types.LimitExceededBehavior.ERROR, + ) + flow_controller = FlowController(settings) + + msg1 = types.PubsubMessage(data=b"x" * 100) + msg2 = types.PubsubMessage(data=b"y" * 100) + msg3 = types.PubsubMessage(data=b"z" * 100) + + # Releasing a message that would make the load negative should result in a warning. + with warnings.catch_warnings(record=True) as warned: + flow_controller.release(msg1) + + assert len(warned) == 1 + assert issubclass(warned[0].category, RuntimeWarning) + warning_msg = str(warned[0].message) + assert "never added or already released" in warning_msg + + # Incorrectly removing a message does not mess up internal stats, we can + # still only add a single message at a time to this flow. + flow_controller.add(msg2) + + with pytest.raises(exceptions.FlowControlLimitError) as error: + flow_controller.add(msg3) + + error_msg = str(error.value) + assert "messages: 2 / 1" in error_msg + total_size = msg2.ByteSize() + msg3.ByteSize() + expected_size_info = "bytes: {} / 150".format(total_size) + assert expected_size_info in error_msg + + +def test_blocking_on_overflow_until_free_capacity(): + settings = types.PublishFlowControl( + message_limit=1, + byte_limit=150, + limit_exceeded_behavior=types.LimitExceededBehavior.BLOCK, + ) + flow_controller = FlowController(settings) + + msg1 = types.PubsubMessage(data=b"x" * 100) + msg2 = types.PubsubMessage(data=b"y" * 100) + msg3 = types.PubsubMessage(data=b"z" * 100) + msg4 = types.PubsubMessage(data=b"w" * 100) + + # If there is a concurrency bug in FlowController, we do not want to block + # the main thread running the tests, thus we delegate all add/release + # operations to daemon threads and check the outcome (blocked/not blocked) + # through Events. + adding_1_done = threading.Event() + adding_2_done = threading.Event() + adding_3_done = threading.Event() + adding_4_done = threading.Event() + releasing_1_done = threading.Event() + releasing_x_done = threading.Event() + + # Adding a message with free capacity should not block. + _run_in_daemon(flow_controller, "add", [msg1], adding_1_done) + if not adding_1_done.wait(timeout=0.1): + pytest.fail("Adding a message with enough flow capacity blocked or errored.") + + # Adding messages when there is not enough capacity should block, even if + # added through multiple threads. + _run_in_daemon(flow_controller, "add", [msg2], adding_2_done) + if adding_2_done.wait(timeout=0.1): + pytest.fail("Adding a message on overflow did not block.") + + _run_in_daemon(flow_controller, "add", [msg3], adding_3_done) + if adding_3_done.wait(timeout=0.1): + pytest.fail("Adding a message on overflow did not block.") + + _run_in_daemon(flow_controller, "add", [msg4], adding_4_done) + if adding_4_done.wait(timeout=0.1): + pytest.fail("Adding a message on overflow did not block.") + + # After releasing one message, there should be room for a new message, which + # should result in unblocking one of the waiting threads. + _run_in_daemon(flow_controller, "release", [msg1], releasing_1_done) + if not releasing_1_done.wait(timeout=0.1): + pytest.fail("Releasing a message blocked or errored.") + + done_status = [ + adding_2_done.wait(timeout=0.1), + adding_3_done.wait(timeout=0.1), + adding_4_done.wait(timeout=0.1), + ] + + # In sum() we use the fact that True==1 and False==0, and that Event.wait() + # returns False only if it times out, i.e. its internal flag has not been set. + done_count = sum(done_status) + assert done_count == 1, "Exactly one thread should have been unblocked." + + # Release another message and verify that yet another thread gets unblocked. + added_msg = [msg2, msg3, msg4][done_status.index(True)] + _run_in_daemon(flow_controller, "release", [added_msg], releasing_x_done) + + if not releasing_x_done.wait(timeout=0.1): + pytest.fail("Releasing messages blocked or errored.") + + released_count = sum( + ( + adding_2_done.wait(timeout=0.1), + adding_3_done.wait(timeout=0.1), + adding_4_done.wait(timeout=0.1), + ) + ) + assert released_count == 2, "Exactly two threads should have been unblocked." + + +def test_error_if_mesage_would_block_indefinitely(): + settings = types.PublishFlowControl( + message_limit=0, # simulate non-sane settings + byte_limit=1, + limit_exceeded_behavior=types.LimitExceededBehavior.BLOCK, + ) + flow_controller = FlowController(settings) + + msg = types.PubsubMessage(data=b"xyz") + adding_done = threading.Event() + error_event = threading.Event() + + _run_in_daemon(flow_controller, "add", [msg], adding_done, error_event=error_event) + + assert error_event.wait(timeout=0.1), "No error on adding too large a message." + + # Now that we know that an error occurs, we can check its type directly + # without the fear of blocking indefinitely. + flow_controller = FlowController(settings) # we want a fresh controller + with pytest.raises(exceptions.FlowControlLimitError) as error_info: + flow_controller.add(msg) + + error_msg = str(error_info.value) + assert "would block forever" in error_msg + assert "messages: 1 / 0" in error_msg + assert "bytes: {} / 1".format(msg.ByteSize()) in error_msg + + +def test_threads_posting_large_messages_do_not_starve(): + settings = types.PublishFlowControl( + message_limit=100, + byte_limit=110, + limit_exceeded_behavior=types.LimitExceededBehavior.BLOCK, + ) + flow_controller = FlowController(settings) + + large_msg = types.PubsubMessage(data=b"x" * 100) # close to entire byte limit + + adding_initial_done = threading.Event() + adding_large_done = threading.Event() + adding_busy_done = threading.Event() + releasing_busy_done = threading.Event() + releasing_large_done = threading.Event() + + # Occupy some of the flow capacity, then try to add a large message. Releasing + # enough messages should eventually allow the large message to come through, even + # if more messages are added after it (those should wait for the large message). + initial_messages = [types.PubsubMessage(data=b"x" * 10)] * 5 + _run_in_daemon(flow_controller, "add", initial_messages, adding_initial_done) + assert adding_initial_done.wait(timeout=0.1) + + _run_in_daemon(flow_controller, "add", [large_msg], adding_large_done) + + # Continuously keep adding more messages after the large one. + messages = [types.PubsubMessage(data=b"x" * 10)] * 10 + _run_in_daemon(flow_controller, "add", messages, adding_busy_done, action_pause=0.1) + + # At the same time, gradually keep releasing the messages - the freeed up + # capacity should be consumed by the large message, not the other small messages + # being added after it. + _run_in_daemon( + flow_controller, "release", messages, releasing_busy_done, action_pause=0.1 + ) + + # Sanity check - releasing should have completed by now. + if not releasing_busy_done.wait(timeout=1.1): + pytest.fail("Releasing messages blocked or errored.") + + # Enough messages released, the large message should have come through in + # the meantime. + if not adding_large_done.wait(timeout=0.1): + pytest.fail("A thread adding a large message starved.") + + if adding_busy_done.wait(timeout=0.1): + pytest.fail("Adding multiple small messages did not block.") + + # Releasing the large message should unblock adding the remaining "busy" messages + # that have not been added yet. + _run_in_daemon(flow_controller, "release", [large_msg], releasing_large_done) + if not releasing_large_done.wait(timeout=0.1): + pytest.fail("Releasing a message blocked or errored.") + + if not adding_busy_done.wait(timeout=1.0): + pytest.fail("Adding messages blocked or errored.") + + +def test_warning_on_internal_reservation_stats_error_when_unblocking(): + settings = types.PublishFlowControl( + message_limit=1, + byte_limit=150, + limit_exceeded_behavior=types.LimitExceededBehavior.BLOCK, + ) + flow_controller = FlowController(settings) + + msg1 = types.PubsubMessage(data=b"x" * 100) + msg2 = types.PubsubMessage(data=b"y" * 100) + + # If there is a concurrency bug in FlowController, we do not want to block + # the main thread running the tests, thus we delegate all add/release + # operations to daemon threads and check the outcome (blocked/not blocked) + # through Events. + adding_1_done = threading.Event() + adding_2_done = threading.Event() + releasing_1_done = threading.Event() + + # Adding a message with free capacity should not block. + _run_in_daemon(flow_controller, "add", [msg1], adding_1_done) + if not adding_1_done.wait(timeout=0.1): + pytest.fail("Adding a message with enough flow capacity blocked or errored.") + + # Adding messages when there is not enough capacity should block, even if + # added through multiple threads. + _run_in_daemon(flow_controller, "add", [msg2], adding_2_done) + if adding_2_done.wait(timeout=0.1): + pytest.fail("Adding a message on overflow did not block.") + + # Intentionally corrupt internal stats + reservation = next(iter(flow_controller._byte_reservations.values()), None) + assert reservation is not None, "No messages blocked by flow controller." + reservation.reserved = reservation.needed + 1 + + with warnings.catch_warnings(record=True) as warned: + _run_in_daemon(flow_controller, "release", [msg1], releasing_1_done) + if not releasing_1_done.wait(timeout=0.1): + pytest.fail("Releasing a message blocked or errored.") + + matches = [warning for warning in warned if warning.category is RuntimeWarning] + assert len(matches) == 1 + assert "too many bytes reserved" in str(matches[0].message).lower() diff --git a/tests/unit/pubsub_v1/publisher/test_publisher_client.py b/tests/unit/pubsub_v1/publisher/test_publisher_client.py index 4ca979892..b58ed133f 100644 --- a/tests/unit/pubsub_v1/publisher/test_publisher_client.py +++ b/tests/unit/pubsub_v1/publisher/test_publisher_client.py @@ -25,6 +25,7 @@ from google.cloud.pubsub_v1 import publisher from google.cloud.pubsub_v1 import types +from google.cloud.pubsub_v1.publisher import exceptions from google.cloud.pubsub_v1.publisher._sequencer import ordered_sequencer @@ -125,11 +126,16 @@ def test_publish(): creds = mock.Mock(spec=credentials.Credentials) client = publisher.Client(credentials=creds) + future1 = mock.sentinel.future1 + future2 = mock.sentinel.future2 + future1.add_done_callback = mock.Mock(spec=["__call__"]) + future2.add_done_callback = mock.Mock(spec=["__call__"]) + # Use a mock in lieu of the actual batch class. batch = mock.Mock(spec=client._batch_class) + # Set the mock up to claim indiscriminately that it accepts all messages. - batch.will_accept.return_value = True - batch.publish.side_effect = (mock.sentinel.future1, mock.sentinel.future2) + batch.publish.side_effect = (future1, future2) topic = "topic/path" client._set_batch(topic, batch) @@ -150,6 +156,29 @@ def test_publish(): ) +def test_publish_error_exceeding_flow_control_limits(): + creds = mock.Mock(spec=credentials.Credentials) + publisher_options = types.PublisherOptions( + flow_control=types.PublishFlowControl( + message_limit=10, + byte_limit=150, + limit_exceeded_behavior=types.LimitExceededBehavior.ERROR, + ) + ) + client = publisher.Client(credentials=creds, publisher_options=publisher_options) + + mock_batch = mock.Mock(spec=client._batch_class) + topic = "topic/path" + client._set_batch(topic, mock_batch) + + future1 = client.publish(topic, b"a" * 100) + future2 = client.publish(topic, b"b" * 100) + + future1.result() # no error, still within flow control limits + with pytest.raises(exceptions.FlowControlLimitError): + future2.result() + + def test_publish_data_not_bytestring_error(): creds = mock.Mock(spec=credentials.Credentials) client = publisher.Client(credentials=creds) @@ -185,7 +214,6 @@ def test_publish_attrs_bytestring(): # Use a mock in lieu of the actual batch class. batch = mock.Mock(spec=client._batch_class) # Set the mock up to claim indiscriminately that it accepts all messages. - batch.will_accept.return_value = True topic = "topic/path" client._set_batch(topic, batch) @@ -208,10 +236,13 @@ def test_publish_new_batch_needed(): # Use mocks in lieu of the actual batch class. batch1 = mock.Mock(spec=client._batch_class) batch2 = mock.Mock(spec=client._batch_class) + # Set the first mock up to claim indiscriminately that it rejects all # messages and the second accepts all. + future = mock.sentinel.future + future.add_done_callback = mock.Mock(spec=["__call__"]) batch1.publish.return_value = None - batch2.publish.return_value = mock.sentinel.future + batch2.publish.return_value = future topic = "topic/path" client._set_batch(topic, batch1) @@ -390,9 +421,14 @@ def test_publish_with_ordering_key(): # Use a mock in lieu of the actual batch class. batch = mock.Mock(spec=client._batch_class) + # Set the mock up to claim indiscriminately that it accepts all messages. - batch.will_accept.return_value = True - batch.publish.side_effect = (mock.sentinel.future1, mock.sentinel.future2) + future1 = mock.sentinel.future1 + future2 = mock.sentinel.future2 + future1.add_done_callback = mock.Mock(spec=["__call__"]) + future2.add_done_callback = mock.Mock(spec=["__call__"]) + + batch.publish.side_effect = (future1, future2) topic = "topic/path" ordering_key = "k1" diff --git a/tests/unit/pubsub_v1/subscriber/test_subscriber_client.py b/tests/unit/pubsub_v1/subscriber/test_subscriber_client.py index d8f671157..310485279 100644 --- a/tests/unit/pubsub_v1/subscriber/test_subscriber_client.py +++ b/tests/unit/pubsub_v1/subscriber/test_subscriber_client.py @@ -154,3 +154,15 @@ def test_closes_channel_as_context_manager(): pass mock_transport.channel.close.assert_called() + + +def test_streaming_pull_gapic_monkeypatch(): + transport = mock.NonCallableMock(spec=["streaming_pull"]) + transport.streaming_pull = mock.Mock(spec=[]) + client = subscriber.Client(transport=transport) + + client.streaming_pull(requests=iter([])) + + assert client.api.transport is transport + assert hasattr(transport.streaming_pull, "_prefetch_first_result_") + assert not transport.streaming_pull._prefetch_first_result_