From 4f690b9287beefbca6505cf88637f4a8c5077152 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 23 Jan 2023 10:08:23 -0500 Subject: [PATCH] docs: Add documentation for enums (#850) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs: Add documentation for enums fix: Add context manager return types chore: Update gapic-generator-python to v1.8.1 PiperOrigin-RevId: 503210727 Source-Link: https://github.com/googleapis/googleapis/commit/a391fd1dac18dfdfa00c18c8404f2c3a6ff8e98e Source-Link: https://github.com/googleapis/googleapis-gen/commit/0080f830dec37c3384157082bce279e37079ea58 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMDA4MGY4MzBkZWMzN2MzMzg0MTU3MDgyYmNlMjc5ZTM3MDc5ZWE1OCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- google/pubsub_v1/services/publisher/client.py | 2 +- .../services/schema_service/client.py | 2 +- .../pubsub_v1/services/subscriber/client.py | 2 +- google/pubsub_v1/types/pubsub.py | 34 +++++++++++++++++-- google/pubsub_v1/types/schema.py | 34 +++++++++++++++++-- .../snippet_metadata_google.pubsub.v1.json | 2 +- 6 files changed, 68 insertions(+), 8 deletions(-) diff --git a/google/pubsub_v1/services/publisher/client.py b/google/pubsub_v1/services/publisher/client.py index 2f192fd06..df459dafd 100644 --- a/google/pubsub_v1/services/publisher/client.py +++ b/google/pubsub_v1/services/publisher/client.py @@ -1437,7 +1437,7 @@ def sample_detach_subscription(): # Done; return the response. return response - def __enter__(self): + def __enter__(self) -> "PublisherClient": return self def __exit__(self, type, value, traceback): diff --git a/google/pubsub_v1/services/schema_service/client.py b/google/pubsub_v1/services/schema_service/client.py index d8c520312..da1be8d25 100644 --- a/google/pubsub_v1/services/schema_service/client.py +++ b/google/pubsub_v1/services/schema_service/client.py @@ -1537,7 +1537,7 @@ def sample_validate_message(): # Done; return the response. return response - def __enter__(self): + def __enter__(self) -> "SchemaServiceClient": return self def __exit__(self, type, value, traceback): diff --git a/google/pubsub_v1/services/subscriber/client.py b/google/pubsub_v1/services/subscriber/client.py index fe3bc17d1..eebfb8736 100644 --- a/google/pubsub_v1/services/subscriber/client.py +++ b/google/pubsub_v1/services/subscriber/client.py @@ -2322,7 +2322,7 @@ def sample_seek(): # Done; return the response. return response - def __enter__(self): + def __enter__(self) -> "SubscriberClient": return self def __exit__(self, type, value, traceback): diff --git a/google/pubsub_v1/types/pubsub.py b/google/pubsub_v1/types/pubsub.py index 4a4ea635a..878b1f381 100644 --- a/google/pubsub_v1/types/pubsub.py +++ b/google/pubsub_v1/types/pubsub.py @@ -735,7 +735,20 @@ class Subscription(proto.Message): """ class State(proto.Enum): - r"""Possible states for a subscription.""" + r"""Possible states for a subscription. + + Values: + STATE_UNSPECIFIED (0): + Default value. This value is unused. + ACTIVE (1): + The subscription can actively receive + messages + RESOURCE_ERROR (2): + The subscription cannot receive messages + because of an error with the resource to which + it pushes messages. See the more detailed error + state in the corresponding configuration. + """ STATE_UNSPECIFIED = 0 ACTIVE = 1 RESOURCE_ERROR = 2 @@ -1059,7 +1072,24 @@ class BigQueryConfig(proto.Message): """ class State(proto.Enum): - r"""Possible states for a BigQuery subscription.""" + r"""Possible states for a BigQuery subscription. + + Values: + STATE_UNSPECIFIED (0): + Default value. This value is unused. + ACTIVE (1): + The subscription can actively send messages + to BigQuery + PERMISSION_DENIED (2): + Cannot write to the BigQuery table because of + permission denied errors. + NOT_FOUND (3): + Cannot write to the BigQuery table because it + does not exist. + SCHEMA_MISMATCH (4): + Cannot write to the BigQuery table due to a + schema mismatch. + """ STATE_UNSPECIFIED = 0 ACTIVE = 1 PERMISSION_DENIED = 2 diff --git a/google/pubsub_v1/types/schema.py b/google/pubsub_v1/types/schema.py index a5ea2f06d..8f778a285 100644 --- a/google/pubsub_v1/types/schema.py +++ b/google/pubsub_v1/types/schema.py @@ -47,6 +47,16 @@ class SchemaView(proto.Enum): r"""View of Schema object fields to be returned by GetSchema and ListSchemas. + + Values: + SCHEMA_VIEW_UNSPECIFIED (0): + The default / unset value. + The API will default to the BASIC view. + BASIC (1): + Include the name and type of the schema, but + not the definition. + FULL (2): + Include all Schema object fields. """ SCHEMA_VIEW_UNSPECIFIED = 0 BASIC = 1 @@ -54,7 +64,18 @@ class SchemaView(proto.Enum): class Encoding(proto.Enum): - r"""Possible encoding types for messages.""" + r"""Possible encoding types for messages. + + Values: + ENCODING_UNSPECIFIED (0): + Unspecified + JSON (1): + JSON encoding + BINARY (2): + Binary encoding, as defined by the schema + type. For some schema types, binary encoding may + not be available. + """ ENCODING_UNSPECIFIED = 0 JSON = 1 BINARY = 2 @@ -82,7 +103,16 @@ class Schema(proto.Message): """ class Type(proto.Enum): - r"""Possible schema definition types.""" + r"""Possible schema definition types. + + Values: + TYPE_UNSPECIFIED (0): + Default value. This value is unused. + PROTOCOL_BUFFER (1): + A Protocol Buffer schema definition. + AVRO (2): + An Avro schema definition. + """ TYPE_UNSPECIFIED = 0 PROTOCOL_BUFFER = 1 AVRO = 2 diff --git a/samples/generated_samples/snippet_metadata_google.pubsub.v1.json b/samples/generated_samples/snippet_metadata_google.pubsub.v1.json index fab818afa..144fda2f6 100644 --- a/samples/generated_samples/snippet_metadata_google.pubsub.v1.json +++ b/samples/generated_samples/snippet_metadata_google.pubsub.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-pubsub", - "version": "2.14.0" + "version": "0.1.0" }, "snippets": [ {